/*! For license information please see 46713.5c09f54a8f4faa7d.js.LICENSE.txt */
(()=>{"use strict";var e={91744:(e,t)=>{function __awaiter(e,t,n,r){return new(n||(n=Promise))((function(a,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?a(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())}))}0;t.P=({vmsgWasmUrl:e})=>{const t=self,n=new WebAssembly.Memory({initial:2048,maximum:2048});let r=5242880;const a=function getWasmModule(e,t){if(!WebAssembly.instantiateStreaming)return getWasmModuleFallback(e,t);return WebAssembly.instantiateStreaming(fetch(e),t).catch((()=>getWasmModuleFallback(e,t)))}(e,{env:{memory:n,sbrk:e=>{const t=r;return r+=e,t},exit:()=>t.postMessage({type:"ERROR",error:"internal"}),pow:Math.pow,powf:Math.pow,exp:Math.exp,sqrtf:Math.sqrt,cos:Math.cos,log:Math.log,sin:Math.sin}}).then((e=>e.instance.exports));let i,o,s=!1;function getWasmModuleFallback(e,t){return fetch(e).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,t)))}t.addEventListener("message",(e=>__awaiter(void 0,void 0,void 0,(function*(){const r=e.data;try{switch(r.type){case"START_RECORDING":yield(f=r.config,__awaiter(void 0,void 0,void 0,(function*(){const e=yield a;if(s=!0,i=e.vmsg_init(f.sampleRate),!i||!e)throw new Error("init_failed");const t=new Uint32Array(n.buffer,i,1)[0];o=new Float32Array(n.buffer,t)}))),t.postMessage({type:"WORKER_RECORDING"});break;case"DATA_AVAILABLE":yield(c=r.data,__awaiter(void 0,void 0,void 0,(function*(){if(s&&(o.set(c),(yield a).vmsg_encode(i,c.length)<0))throw new Error("encoding_failed")})));break;case"STOP_RECORDING":{const e=yield __awaiter(void 0,void 0,void 0,(function*(){const e=yield a;if(s=!1,e.vmsg_flush(i)<0)throw new Error("flush_failed");const t=new Uint32Array(n.buffer,i+4,1)[0],r=new Uint32Array(n.buffer,i+8,1)[0],o=new Uint8Array(n.buffer,t,r),c=new Blob([o],{type:"audio/mpeg"});return e.vmsg_free(i),c}));t.postMessage({type:"BLOB_READY",blob:e});break}}}catch(e){t.postMessage({type:"ERROR",error:e.message})}var c,f}))))}}},t={};var n=function __webpack_require__(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,__webpack_require__),a.exports}(91744);addEventListener("message",(function onMessage(e){(function isInitAudioEncoderMessage(e){return"object"==typeof e&&null!==e&&"name"in e&&"init-audio-encoder"===e.name})(e.data)&&(removeEventListener("message",onMessage),(0,n.P)(e.data.config))}))})();