@vkontakte/calls-audio-effects 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AudioEffects.d.ts +3 -0
- package/audio-effects.cjs.js +10 -0
- package/audio-effects.esm.js +10 -0
- package/effects/EffectVmojiLmarksAi.d.ts +17 -0
- package/effects/EffectVmojiLmarksVolume.d.ts +14 -0
- package/effects/EffectVoiceChange.d.ts +41 -0
- package/package.json +19 -0
- package/processor/AudioProcessor.d.ts +57 -0
- package/processor/WorkerAudioProcessor.d.ts +36 -0
- package/utils/Logger.d.ts +9 -0
- package/utils/Utils.d.ts +1 -0
- package/workers/VmojiLmarksAiWorker.d.ts +6 -0
- package/workers/VoiceChangeWorker.d.ts +12 -0
- package/worklets/PureWorklet.d.ts +5 -0
- package/worklets/VmojiLmarksVolumeWorklet.d.ts +6 -0
- package/worklets/VoiceChangeWorklet.d.ts +6 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vkontakte/calls-audio-effects v1.0.1
|
|
3
|
+
* Tue, 09 Jul 2024 11:39:58 GMT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
"use strict";var wa=Object.create;var lr=Object.defineProperty;var Ea=Object.getOwnPropertyDescriptor;var ka=Object.getOwnPropertyNames;var Pt=Object.getPrototypeOf,ba=Object.prototype.hasOwnProperty;var Aa=Reflect.get;var Pa=($,_)=>()=>(_||$((_={exports:{}}).exports,_),_.exports),Ca=($,_)=>{for(var g in _)lr($,g,{get:_[g],enumerable:!0})},Ct=($,_,g,b)=>{if(_&&typeof _=="object"||typeof _=="function")for(let u of ka(_))!ba.call($,u)&&u!==g&&lr($,u,{get:()=>_[u],enumerable:!(b=Ea(_,u))||b.enumerable});return $};var St=($,_,g)=>(g=$!=null?wa(Pt($)):{},Ct(_||!$||!$.__esModule?lr(g,"default",{value:$,enumerable:!0}):g,$)),Sa=$=>Ct(lr({},"__esModule",{value:!0}),$);var ue=($,_,g)=>Aa(Pt($),g,_);var K=($,_,g)=>new Promise((b,u)=>{var U=B=>{try{Q(g.next(B))}catch(V){u(V)}},H=B=>{try{Q(g.throw(B))}catch(V){u(V)}},Q=B=>B.done?b(B.value):Promise.resolve(B.value).then(U,H);Q((g=g.apply($,_)).next())});var Mr=Pa((Ft,$r)=>{var Rr=(()=>{var _;var $=typeof document!="undefined"?(_=document.currentScript)==null?void 0:_.src:void 0;return function(g={}){var b,u=g,U,H,Q=new Promise((e,r)=>{U=e,H=r}),B=typeof window=="object",V=typeof importScripts=="function",Nr=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";u.expectedDataFileDownloads||(u.expectedDataFileDownloads=0),u.expectedDataFileDownloads++,(()=>{var e=typeof ENVIRONMENT_IS_PTHREAD!="undefined"&&ENVIRONMENT_IS_PTHREAD,r=typeof ENVIRONMENT_IS_WASM_WORKER!="undefined"&&ENVIRONMENT_IS_WASM_WORKER;if(e||r)return;function t(n){var o="";typeof window=="object"?o=window.encodeURIComponent(window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/"):typeof process=="undefined"&&typeof location!="undefined"&&(o=encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/"));var i="wasm_bindings.data",s="wasm_bindings.data";typeof u.locateFilePackage=="function"&&!u.locateFile&&(u.locateFile=u.locateFilePackage,ee("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)"));var l=u.locateFile?u.locateFile(s,""):s,f=n.remote_package_size;function d(E,C,D,S){var c=new XMLHttpRequest;c.open("GET",E,!0),c.responseType="arraybuffer",c.onprogress=function(h){var T=E,P=C;if(h.total&&(P=h.total),h.loaded){c.addedTotal?u.dataFileDownloads[T].loaded=h.loaded:(c.addedTotal=!0,u.dataFileDownloads||(u.dataFileDownloads={}),u.dataFileDownloads[T]={loaded:h.loaded,total:P});var O=0,W=0,Ue=0;for(var He in u.dataFileDownloads){var Le=u.dataFileDownloads[He];O+=Le.total,W+=Le.loaded,Ue++}O=Math.ceil(O*u.expectedDataFileDownloads/Ue),u.setStatus&&u.setStatus(`Downloading data... (${W}/${O})`)}else u.dataFileDownloads||u.setStatus&&u.setStatus("Downloading data...")},c.onerror=function(h){throw new Error("NetworkError for: "+E)},c.onload=function(h){if(c.status==200||c.status==304||c.status==206||c.status==0&&c.response){var T=c.response;D(T)}else throw new Error(c.statusText+" : "+c.responseURL)},c.send(null)}function v(E){console.error("package error:",E)}var y=null,p=u.getPreloadedPackage?u.getPreloadedPackage(l,f):null;p||d(l,f,function(E){y?(y(E),y=null):p=E},v);function m(){function E(h,T){if(!h)throw T+new Error().stack}function C(h,T,P){this.start=h,this.end=T,this.audio=P}C.prototype={requests:{},open:function(h,T){this.name=T,this.requests[T]=this,u.addRunDependency(`fp ${this.name}`)},send:function(){},onload:function(){var h=this.byteArray.subarray(this.start,this.end);this.finish(h)},finish:function(h){var T=this;u.FS_createDataFile(this.name,null,h,!0,!0,!0),u.removeRunDependency(`fp ${T.name}`),this.requests[this.name]=null}};for(var D=n.files,S=0;S<D.length;++S)new C(D[S].start,D[S].end,D[S].audio||0).open("GET",D[S].filename);function c(h){E(h,"Loading data file failed."),E(h.constructor.name===ArrayBuffer.name,"bad input to processPackageData");var T=new Uint8Array(h);C.prototype.byteArray=T;for(var P=n.files,O=0;O<P.length;++O)C.prototype.requests[P[O].filename].onload();u.removeRunDependency("datafile_wasm_bindings.data")}u.addRunDependency("datafile_wasm_bindings.data"),u.preloadResults||(u.preloadResults={}),u.preloadResults[i]={fromCache:!1},p?(c(p),p=null):y=c}u.calledRun?m():(u.preRun||(u.preRun=[]),u.preRun.push(m))}t({files:[{filename:"/animoji_v4.cfg",start:0,end:333},{filename:"/balloon.cfg",start:333,end:409},{filename:"/cathedral.cfg",start:409,end:586},{filename:"/chorus.cfg",start:586,end:865},{filename:"/distortion.cfg",start:865,end:1007},{filename:"/echo.cfg",start:1007,end:1144},{filename:"/evil.cfg",start:1144,end:1285},{filename:"/giant.cfg",start:1285,end:1361},{filename:"/hall.cfg",start:1361,end:1534},{filename:"/phaser.cfg",start:1534,end:1634},{filename:"/robot.cfg",start:1634,end:1774},{filename:"/squirell.cfg",start:1774,end:1850},{filename:"/wav2lip_lite_rec-v4-v2.tflite",start:1850,end:1850}],remote_package_size:1850})})();var L=null,fr=Object.assign({},u),xr=[],ge="./this.program",Se=(e,r)=>{throw r},G="";function de(e){return u.locateFile?u.locateFile(e,G):G+e}var ye,J,ie;(B||V)&&(V?G=self.location.href:typeof document!="undefined"&&document.currentScript&&(G=document.currentScript.src),L&&(G=L),G.startsWith("blob:")?G="":G=G.substr(0,G.replace(/[?#].*/,"").lastIndexOf("/")+1),ye=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},V&&(ie=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),J=(e,r,t)=>{fetch(e,{credentials:"same-origin"}).then(n=>n.ok?n.arrayBuffer():Promise.reject(new Error(n.status+" : "+n.url))).then(r,t)});var Z=u.print||console.log.bind(console),ee=u.printErr||console.error.bind(console);Object.assign(u,fr),fr=null,u.arguments&&(xr=u.arguments),u.thisProgram&&(ge=u.thisProgram),u.quit&&(Se=u.quit);var Te;u.wasmBinary&&(Te=u.wasmBinary);var Be,dr=!1,cr,N,z,re,Ve,w,F,Ur,Hr;function Lr(){var e=Be.buffer;u.HEAP8=N=new Int8Array(e),u.HEAP16=re=new Int16Array(e),u.HEAPU8=z=new Uint8Array(e),u.HEAPU16=Ve=new Uint16Array(e),u.HEAP32=w=new Int32Array(e),u.HEAPU32=F=new Uint32Array(e),u.HEAPF32=Ur=new Float32Array(e),u.HEAPF64=Hr=new Float64Array(e)}var zr=[],Br=[],Vr=[],Mt=!1;function Ot(){if(u.preRun)for(typeof u.preRun=="function"&&(u.preRun=[u.preRun]);u.preRun.length;)It(u.preRun.shift());hr(zr)}function Wt(){Mt=!0,!u.noFSInit&&!a.init.initialized&&a.init(),a.ignorePermissions=!1,se.init(),hr(Br)}function jt(){if(u.postRun)for(typeof u.postRun=="function"&&(u.postRun=[u.postRun]);u.postRun.length;)xt(u.postRun.shift());hr(Vr)}function It(e){zr.unshift(e)}function Nt(e){Br.unshift(e)}function xt(e){Vr.unshift(e)}var ce=0,vr=null,De=null;function Ra(e){return e}function Ye(e){var r;ce++,(r=u.monitorRunDependencies)==null||r.call(u,ce)}function Fe(e){var t;if(ce--,(t=u.monitorRunDependencies)==null||t.call(u,ce),ce==0&&(vr!==null&&(clearInterval(vr),vr=null),De)){var r=De;De=null,r()}}function pr(e){var t;(t=u.onAbort)==null||t.call(u,e),e="Aborted("+e+")",ee(e),dr=!0,cr=1,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw H(r),r}var Ut="data:application/octet-stream;base64,",Yr=e=>e.startsWith(Ut);function Ht(){var e="wasm_bindings.wasm";return Yr(e)?e:de(e)}var qe;function qr(e){if(e==qe&&Te)return new Uint8Array(Te);if(ie)return ie(e);throw"both async and sync fetching of the wasm failed"}function Lt(e){return Te?Promise.resolve().then(()=>qr(e)):new Promise((r,t)=>{J(e,n=>r(new Uint8Array(n)),n=>{try{r(qr(e))}catch(o){t(o)}})})}function Gr(e,r,t){return Lt(e).then(n=>WebAssembly.instantiate(n,r)).then(t,n=>{ee(`failed to asynchronously prepare wasm: ${n}`),pr(n)})}function zt(e,r,t,n){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Yr(r)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(o=>{var i=WebAssembly.instantiateStreaming(o,t);return i.then(n,function(s){return ee(`wasm streaming compile failed: ${s}`),ee("falling back to ArrayBuffer instantiation"),Gr(r,t,n)})}):Gr(r,t,n)}function Bt(){return{a:la}}function Vt(){var e=Bt();function r(n,o){return x=n.exports,Be=x._,Lr(),ut=x.ca,Nt(x.$),Fe("wasm-instantiate"),x}Ye("wasm-instantiate");function t(n){r(n.instance)}if(u.instantiateWasm)try{return u.instantiateWasm(e,r)}catch(n){ee(`Module.instantiateWasm callback failed with error: ${n}`),H(n)}return qe||(qe=Ht()),zt(Te,qe,e,t).catch(H),{}}var k,j;function Yt(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var hr=e=>{for(;e.length>0;)e.shift()(u)},qt=u.noExitRuntime||!0;class Gt{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){F[this.ptr+4>>2]=r}get_type(){return F[this.ptr+4>>2]}set_destructor(r){F[this.ptr+8>>2]=r}get_destructor(){return F[this.ptr+8>>2]}set_caught(r){r=r?1:0,N[this.ptr+12]=r}get_caught(){return N[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,N[this.ptr+13]=r}get_rethrown(){return N[this.ptr+13]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){F[this.ptr+16>>2]=r}get_adjusted_ptr(){return F[this.ptr+16>>2]}get_exception_ptr(){var r=bt(this.get_type());if(r)return F[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var Xr=0,Xt=0,Kt=(e,r,t)=>{var n=new Gt(e);throw n.init(r,t),Xr=e,Xt++,Xr};function Ge(){var e=w[+I.varargs>>2];return I.varargs+=4,e}var _e=Ge,M={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];o==="."?e.splice(n,1):o===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=M.isAbs(e),t=e.substr(-1)==="/";return e=M.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=M.splitPath(e),t=r[0],n=r[1];return!t&&!n?".":(n&&(n=n.substr(0,n.length-1)),t+n)},basename:e=>{if(e==="/")return"/";e=M.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:(...e)=>M.normalize(e.join("/")),join2:(e,r)=>M.normalize(e+"/"+r)},Qt=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);pr("initRandomDevice")},Kr=e=>(Kr=Qt())(e),te={resolve:(...e)=>{for(var r="",t=!1,n=e.length-1;n>=-1&&!t;n--){var o=n>=0?e[n]:a.cwd();if(typeof o!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";r=o+"/"+r,t=M.isAbs(o)}return r=M.normalizeArray(r.split("/").filter(i=>!!i),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=te.resolve(e).substr(1),r=te.resolve(r).substr(1);function t(d){for(var v=0;v<d.length&&d[v]==="";v++);for(var y=d.length-1;y>=0&&d[y]==="";y--);return v>y?[]:d.slice(v,y-v+1)}for(var n=t(e.split("/")),o=t(r.split("/")),i=Math.min(n.length,o.length),s=i,l=0;l<i;l++)if(n[l]!==o[l]){s=l;break}for(var f=[],l=s;l<n.length;l++)f.push("..");return f=f.concat(o.slice(s)),f.join("/")}},Qr=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0,we=(e,r,t)=>{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&Qr)return Qr.decode(e.subarray(r,o));for(var i="";r<o;){var s=e[r++];if(!(s&128)){i+=String.fromCharCode(s);continue}var l=e[r++]&63;if((s&224)==192){i+=String.fromCharCode((s&31)<<6|l);continue}var f=e[r++]&63;if((s&240)==224?s=(s&15)<<12|l<<6|f:s=(s&7)<<18|l<<12|f<<6|e[r++]&63,s<65536)i+=String.fromCharCode(s);else{var d=s-65536;i+=String.fromCharCode(55296|d>>10,56320|d&1023)}}return i},mr=[],Re=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},gr=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,i=t+n-1,s=0;s<e.length;++s){var l=e.charCodeAt(s);if(l>=55296&&l<=57343){var f=e.charCodeAt(++s);l=65536+((l&1023)<<10)|f&1023}if(l<=127){if(t>=i)break;r[t++]=l}else if(l<=2047){if(t+1>=i)break;r[t++]=192|l>>6,r[t++]=128|l&63}else if(l<=65535){if(t+2>=i)break;r[t++]=224|l>>12,r[t++]=128|l>>6&63,r[t++]=128|l&63}else{if(t+3>=i)break;r[t++]=240|l>>18,r[t++]=128|l>>12&63,r[t++]=128|l>>6&63,r[t++]=128|l&63}}return r[t]=0,t-o};function Xe(e,r,t){var n=t>0?t:Re(e)+1,o=new Array(n),i=gr(e,o,0,o.length);return r&&(o.length=i),o}var Jt=()=>{if(!mr.length){var e=null;if(typeof window!="undefined"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
7
|
+
`)),!e)return null;mr=Xe(e,!0)}return mr.shift()},se={ttys:[],init(){},shutdown(){},register(e,r){se.ttys[e]={input:[],output:[],ops:r},a.registerDevice(e,se.stream_ops)},stream_ops:{open(e){var r=se.ttys[e.node.rdev];if(!r)throw new a.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new a.ErrnoError(60);for(var i=0,s=0;s<n;s++){var l;try{l=e.tty.ops.get_char(e.tty)}catch(f){throw new a.ErrnoError(29)}if(l===void 0&&i===0)throw new a.ErrnoError(6);if(l==null)break;i++,r[t+s]=l}return i&&(e.node.timestamp=Date.now()),i},write(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new a.ErrnoError(60);try{for(var i=0;i<n;i++)e.tty.ops.put_char(e.tty,r[t+i])}catch(s){throw new a.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),i}},default_tty_ops:{get_char(e){return Jt()},put_char(e,r){r===null||r===10?(Z(we(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(Z(we(e.output,0)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,r,t){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(ee(we(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(ee(we(e.output,0)),e.output=[])}}},Zt=(e,r)=>(z.fill(0,e,e+r),e),en=(e,r)=>Math.ceil(e/r)*r,Jr=e=>{e=en(e,65536);var r=kt(65536,e);return r?Zt(r,e):0},A={ops_table:null,mount(e){return A.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(a.isBlkdev(t)||a.isFIFO(t))throw new a.ErrnoError(63);A.ops_table||(A.ops_table={dir:{node:{getattr:A.node_ops.getattr,setattr:A.node_ops.setattr,lookup:A.node_ops.lookup,mknod:A.node_ops.mknod,rename:A.node_ops.rename,unlink:A.node_ops.unlink,rmdir:A.node_ops.rmdir,readdir:A.node_ops.readdir,symlink:A.node_ops.symlink},stream:{llseek:A.stream_ops.llseek}},file:{node:{getattr:A.node_ops.getattr,setattr:A.node_ops.setattr},stream:{llseek:A.stream_ops.llseek,read:A.stream_ops.read,write:A.stream_ops.write,allocate:A.stream_ops.allocate,mmap:A.stream_ops.mmap,msync:A.stream_ops.msync}},link:{node:{getattr:A.node_ops.getattr,setattr:A.node_ops.setattr,readlink:A.node_ops.readlink},stream:{}},chrdev:{node:{getattr:A.node_ops.getattr,setattr:A.node_ops.setattr},stream:a.chrdev_stream_ops}});var o=a.createNode(e,r,t,n);return a.isDir(o.mode)?(o.node_ops=A.ops_table.dir.node,o.stream_ops=A.ops_table.dir.stream,o.contents={}):a.isFile(o.mode)?(o.node_ops=A.ops_table.file.node,o.stream_ops=A.ops_table.file.stream,o.usedBytes=0,o.contents=null):a.isLink(o.mode)?(o.node_ops=A.ops_table.link.node,o.stream_ops=A.ops_table.link.stream):a.isChrdev(o.mode)&&(o.node_ops=A.ops_table.chrdev.node,o.stream_ops=A.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var o=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(o.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=a.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,a.isDir(e.mode)?r.size=4096:a.isFile(e.mode)?r.size=e.usedBytes:a.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){r.mode!==void 0&&(e.mode=r.mode),r.timestamp!==void 0&&(e.timestamp=r.timestamp),r.size!==void 0&&A.resizeFileStorage(e,r.size)},lookup(e,r){throw a.genericErrors[44]},mknod(e,r,t,n){return A.createNode(e,r,t,n)},rename(e,r,t){if(a.isDir(e.mode)){var n;try{n=a.lookupNode(r,t)}catch(i){}if(n)for(var o in n.contents)throw new a.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp},unlink(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=a.lookupNode(e,r);for(var n in t.contents)throw new a.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){var n=A.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!a.isLink(e.mode))throw new a.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var i=e.node.contents;if(o>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-o,n);if(s>8&&i.subarray)r.set(i.subarray(o,o+s),t);else for(var l=0;l<s;l++)r[t+l]=i[o+l];return s},write(e,r,t,n,o,i){if(r.buffer===N.buffer&&(i=!1),!n)return 0;var s=e.node;if(s.timestamp=Date.now(),r.subarray&&(!s.contents||s.contents.subarray)){if(i)return s.contents=r.subarray(t,t+n),s.usedBytes=n,n;if(s.usedBytes===0&&o===0)return s.contents=r.slice(t,t+n),s.usedBytes=n,n;if(o+n<=s.usedBytes)return s.contents.set(r.subarray(t,t+n),o),n}if(A.expandFileStorage(s,o+n),s.contents.subarray&&r.subarray)s.contents.set(r.subarray(t,t+n),o);else for(var l=0;l<n;l++)s.contents[o+l]=r[t+l];return s.usedBytes=Math.max(s.usedBytes,o+n),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&a.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new a.ErrnoError(28);return n},allocate(e,r,t){A.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap(e,r,t,n,o){if(!a.isFile(e.node.mode))throw new a.ErrnoError(43);var i,s,l=e.node.contents;if(!(o&2)&&l.buffer===N.buffer)s=!1,i=l.byteOffset;else{if((t>0||t+r<l.length)&&(l.subarray?l=l.subarray(t,t+r):l=Array.prototype.slice.call(l,t,t+r)),s=!0,i=Jr(r),!i)throw new a.ErrnoError(48);N.set(l,i)}return{ptr:i,allocated:s}},msync(e,r,t,n,o){return A.stream_ops.write(e,r,0,n,t,!1),0}}},rn=(e,r,t,n)=>{var o=n?"":`al ${e}`;J(e,i=>{r(new Uint8Array(i)),o&&Fe(o)},i=>{if(t)t();else throw`Loading data file "${e}" failed.`}),o&&Ye(o)},Zr=(e,r,t,n,o,i)=>{a.createDataFile(e,r,t,n,o,i)},tn=u.preloadPlugins||[],nn=(e,r,t,n)=>{typeof Browser!="undefined"&&Browser.init();var o=!1;return tn.forEach(i=>{o||i.canHandle(r)&&(i.handle(e,r,t,n),o=!0)}),o},et=(e,r,t,n,o,i,s,l,f,d)=>{var v=r?te.resolve(M.join2(e,r)):e,y=`cp ${v}`;function p(m){function E(C){d==null||d(),l||Zr(e,r,C,n,o,f),i==null||i(),Fe(y)}nn(m,v,E,()=>{s==null||s(),Fe(y)})||E(m)}Ye(y),typeof t=="string"?rn(t,p,s):p(t)},on=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t=="undefined")throw new Error(`Unknown file open mode: ${e}`);return t},yr=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},a={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(e){this.name="ErrnoError",this.errno=e}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=a.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return a.isDir(this.mode)}get isDevice(){return a.isChrdev(this.mode)}},lookupPath(e,r={}){if(e=te.resolve(e),!e)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(r=Object.assign(t,r),r.recurse_count>8)throw new a.ErrnoError(32);for(var n=e.split("/").filter(y=>!!y),o=a.root,i="/",s=0;s<n.length;s++){var l=s===n.length-1;if(l&&r.parent)break;if(o=a.lookupNode(o,n[s]),i=M.join2(i,n[s]),a.isMountpoint(o)&&(!l||l&&r.follow_mount)&&(o=o.mounted.root),!l||r.follow)for(var f=0;a.isLink(o.mode);){var d=a.readlink(i);i=te.resolve(M.dirname(i),d);var v=a.lookupPath(i,{recurse_count:r.recurse_count+1});if(o=v.node,f++>40)throw new a.ErrnoError(32)}}return{path:i,node:o}},getPath(e){for(var r;;){if(a.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%a.nameTable.length},hashAddNode(e){var r=a.hashName(e.parent.id,e.name);e.name_next=a.nameTable[r],a.nameTable[r]=e},hashRemoveNode(e){var r=a.hashName(e.parent.id,e.name);if(a.nameTable[r]===e)a.nameTable[r]=e.name_next;else for(var t=a.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=a.mayLookup(e);if(t)throw new a.ErrnoError(t);for(var n=a.hashName(e.id,r),o=a.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===r)return o}return a.lookup(e,r)},createNode(e,r,t,n){var o=new a.FSNode(e,r,t,n);return a.hashAddNode(o),o},destroyNode(e){a.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return a.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!a.isDir(e.mode))return 54;var r=a.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){try{var t=a.lookupNode(e,r);return 20}catch(n){}return a.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=a.lookupNode(e,r)}catch(i){return i.errno}var o=a.nodePermissions(e,"wx");if(o)return o;if(t){if(!a.isDir(n.mode))return 54;if(a.isRoot(n)||a.getPath(n)===a.cwd())return 10}else if(a.isDir(n.mode))return 31;return 0},mayOpen(e,r){return e?a.isLink(e.mode)?32:a.isDir(e.mode)&&(a.flagsToPermissionString(r)!=="r"||r&512)?31:a.nodePermissions(e,a.flagsToPermissionString(r)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=a.MAX_OPEN_FDS;e++)if(!a.streams[e])return e;throw new a.ErrnoError(33)},getStreamChecked(e){var r=a.getStream(e);if(!r)throw new a.ErrnoError(8);return r},getStream:e=>a.streams[e],createStream(e,r=-1){return e=Object.assign(new a.FSStream,e),r==-1&&(r=a.nextfd()),e.fd=r,a.streams[r]=e,e},closeStream(e){a.streams[e]=null},dupStream(e,r=-1){var n,o;var t=a.createStream(e,r);return(o=(n=t.stream_ops)==null?void 0:n.dup)==null||o.call(n,t),t},chrdev_stream_ops:{open(e){var t,n;var r=a.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,(n=(t=e.stream_ops).open)==null||n.call(t,e)},llseek(){throw new a.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){a.devices[e]={stream_ops:r}},getDevice:e=>a.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),a.syncFSRequests++,a.syncFSRequests>1&&ee(`warning: ${a.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=a.getMounts(a.root.mount),n=0;function o(s){return a.syncFSRequests--,r(s)}function i(s){if(s)return i.errored?void 0:(i.errored=!0,o(s));++n>=t.length&&o(null)}t.forEach(s=>{if(!s.type.syncfs)return i(null);s.type.syncfs(s,e,i)})},mount(e,r,t){var n=t==="/",o=!t,i;if(n&&a.root)throw new a.ErrnoError(10);if(!n&&!o){var s=a.lookupPath(t,{follow_mount:!1});if(t=s.path,i=s.node,a.isMountpoint(i))throw new a.ErrnoError(10);if(!a.isDir(i.mode))throw new a.ErrnoError(54)}var l={type:e,opts:r,mountpoint:t,mounts:[]},f=e.mount(l);return f.mount=l,l.root=f,n?a.root=f:i&&(i.mounted=l,i.mount&&i.mount.mounts.push(l)),f},unmount(e){var r=a.lookupPath(e,{follow_mount:!1});if(!a.isMountpoint(r.node))throw new a.ErrnoError(28);var t=r.node,n=t.mounted,o=a.getMounts(n);Object.keys(a.nameTable).forEach(s=>{for(var l=a.nameTable[s];l;){var f=l.name_next;o.includes(l.mount)&&a.destroyNode(l),l=f}}),t.mounted=null;var i=t.mount.mounts.indexOf(n);t.mount.mounts.splice(i,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var n=a.lookupPath(e,{parent:!0}),o=n.node,i=M.basename(e);if(!i||i==="."||i==="..")throw new a.ErrnoError(28);var s=a.mayCreate(o,i);if(s)throw new a.ErrnoError(s);if(!o.node_ops.mknod)throw new a.ErrnoError(63);return o.node_ops.mknod(o,i,r,t)},create(e,r){return r=r!==void 0?r:438,r&=4095,r|=32768,a.mknod(e,r,0)},mkdir(e,r){return r=r!==void 0?r:511,r&=1023,r|=16384,a.mknod(e,r,0)},mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{a.mkdir(n,r)}catch(i){if(i.errno!=20)throw i}}},mkdev(e,r,t){return typeof t=="undefined"&&(t=r,r=438),r|=8192,a.mknod(e,r,t)},symlink(e,r){if(!te.resolve(e))throw new a.ErrnoError(44);var t=a.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new a.ErrnoError(44);var o=M.basename(r),i=a.mayCreate(n,o);if(i)throw new a.ErrnoError(i);if(!n.node_ops.symlink)throw new a.ErrnoError(63);return n.node_ops.symlink(n,o,e)},rename(e,r){var t=M.dirname(e),n=M.dirname(r),o=M.basename(e),i=M.basename(r),s,l,f;if(s=a.lookupPath(e,{parent:!0}),l=s.node,s=a.lookupPath(r,{parent:!0}),f=s.node,!l||!f)throw new a.ErrnoError(44);if(l.mount!==f.mount)throw new a.ErrnoError(75);var d=a.lookupNode(l,o),v=te.relative(e,n);if(v.charAt(0)!==".")throw new a.ErrnoError(28);if(v=te.relative(r,t),v.charAt(0)!==".")throw new a.ErrnoError(55);var y;try{y=a.lookupNode(f,i)}catch(E){}if(d!==y){var p=a.isDir(d.mode),m=a.mayDelete(l,o,p);if(m)throw new a.ErrnoError(m);if(m=y?a.mayDelete(f,i,p):a.mayCreate(f,i),m)throw new a.ErrnoError(m);if(!l.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(d)||y&&a.isMountpoint(y))throw new a.ErrnoError(10);if(f!==l&&(m=a.nodePermissions(l,"w"),m))throw new a.ErrnoError(m);a.hashRemoveNode(d);try{l.node_ops.rename(d,f,i),d.parent=f}catch(E){throw E}finally{a.hashAddNode(d)}}},rmdir(e){var r=a.lookupPath(e,{parent:!0}),t=r.node,n=M.basename(e),o=a.lookupNode(t,n),i=a.mayDelete(t,n,!0);if(i)throw new a.ErrnoError(i);if(!t.node_ops.rmdir)throw new a.ErrnoError(63);if(a.isMountpoint(o))throw new a.ErrnoError(10);t.node_ops.rmdir(t,n),a.destroyNode(o)},readdir(e){var r=a.lookupPath(e,{follow:!0}),t=r.node;if(!t.node_ops.readdir)throw new a.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var r=a.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new a.ErrnoError(44);var n=M.basename(e),o=a.lookupNode(t,n),i=a.mayDelete(t,n,!1);if(i)throw new a.ErrnoError(i);if(!t.node_ops.unlink)throw new a.ErrnoError(63);if(a.isMountpoint(o))throw new a.ErrnoError(10);t.node_ops.unlink(t,n),a.destroyNode(o)},readlink(e){var r=a.lookupPath(e),t=r.node;if(!t)throw new a.ErrnoError(44);if(!t.node_ops.readlink)throw new a.ErrnoError(28);return te.resolve(a.getPath(t.parent),t.node_ops.readlink(t))},stat(e,r){var t=a.lookupPath(e,{follow:!r}),n=t.node;if(!n)throw new a.ErrnoError(44);if(!n.node_ops.getattr)throw new a.ErrnoError(63);return n.node_ops.getattr(n)},lstat(e){return a.stat(e,!0)},chmod(e,r,t){var n;if(typeof e=="string"){var o=a.lookupPath(e,{follow:!t});n=o.node}else n=e;if(!n.node_ops.setattr)throw new a.ErrnoError(63);n.node_ops.setattr(n,{mode:r&4095|n.mode&-4096,timestamp:Date.now()})},lchmod(e,r){a.chmod(e,r,!0)},fchmod(e,r){var t=a.getStreamChecked(e);a.chmod(t.node,r)},chown(e,r,t,n){var o;if(typeof e=="string"){var i=a.lookupPath(e,{follow:!n});o=i.node}else o=e;if(!o.node_ops.setattr)throw new a.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){a.chown(e,r,t,!0)},fchown(e,r,t){var n=a.getStreamChecked(e);a.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new a.ErrnoError(28);var t;if(typeof e=="string"){var n=a.lookupPath(e,{follow:!0});t=n.node}else t=e;if(!t.node_ops.setattr)throw new a.ErrnoError(63);if(a.isDir(t.mode))throw new a.ErrnoError(31);if(!a.isFile(t.mode))throw new a.ErrnoError(28);var o=a.nodePermissions(t,"w");if(o)throw new a.ErrnoError(o);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=a.getStreamChecked(e);if(!(t.flags&2097155))throw new a.ErrnoError(28);a.truncate(t.node,r)},utime(e,r,t){var n=a.lookupPath(e,{follow:!0}),o=n.node;o.node_ops.setattr(o,{timestamp:Math.max(r,t)})},open(e,r,t){if(e==="")throw new a.ErrnoError(44);r=typeof r=="string"?on(r):r,r&64?(t=typeof t=="undefined"?438:t,t=t&4095|32768):t=0;var n;if(typeof e=="object")n=e;else{e=M.normalize(e);try{var o=a.lookupPath(e,{follow:!(r&131072)});n=o.node}catch(f){}}var i=!1;if(r&64)if(n){if(r&128)throw new a.ErrnoError(20)}else n=a.mknod(e,t,0),i=!0;if(!n)throw new a.ErrnoError(44);if(a.isChrdev(n.mode)&&(r&=-513),r&65536&&!a.isDir(n.mode))throw new a.ErrnoError(54);if(!i){var s=a.mayOpen(n,r);if(s)throw new a.ErrnoError(s)}r&512&&!i&&a.truncate(n,0),r&=-131713;var l=a.createStream({node:n,path:a.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return l.stream_ops.open&&l.stream_ops.open(l),u.logReadFiles&&!(r&1)&&(a.readFiles||(a.readFiles={}),e in a.readFiles||(a.readFiles[e]=1)),l},close(e){if(a.isClosed(e))throw new a.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{a.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(a.isClosed(e))throw new a.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new a.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new a.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===1)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.read)throw new a.ErrnoError(28);var i=typeof o!="undefined";if(!i)o=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var s=e.stream_ops.read(e,r,t,n,o);return i||(e.position+=s),s},write(e,r,t,n,o,i){if(n<0||o<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if(!(e.flags&2097155))throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.write)throw new a.ErrnoError(28);e.seekable&&e.flags&1024&&a.llseek(e,0,2);var s=typeof o!="undefined";if(!s)o=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var l=e.stream_ops.write(e,r,t,n,o,i);return s||(e.position+=l),l},allocate(e,r,t){if(a.isClosed(e))throw new a.ErrnoError(8);if(r<0||t<=0)throw new a.ErrnoError(28);if(!(e.flags&2097155))throw new a.ErrnoError(8);if(!a.isFile(e.node.mode)&&!a.isDir(e.node.mode))throw new a.ErrnoError(43);if(!e.stream_ops.allocate)throw new a.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap(e,r,t,n,o){if(n&2&&!(o&2)&&(e.flags&2097155)!==2)throw new a.ErrnoError(2);if((e.flags&2097155)===1)throw new a.ErrnoError(2);if(!e.stream_ops.mmap)throw new a.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync(e,r,t,n,o){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new a.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=a.open(e,r.flags),o=a.stat(e),i=o.size,s=new Uint8Array(i);return a.read(n,s,0,i,0),r.encoding==="utf8"?t=we(s,0):r.encoding==="binary"&&(t=s),a.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=a.open(e,t.flags,t.mode);if(typeof r=="string"){var o=new Uint8Array(Re(r)+1),i=gr(r,o,0,o.length);a.write(n,o,0,i,void 0,t.canOwn)}else if(ArrayBuffer.isView(r))a.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");a.close(n)},cwd:()=>a.currentPath,chdir(e){var r=a.lookupPath(e,{follow:!0});if(r.node===null)throw new a.ErrnoError(44);if(!a.isDir(r.node.mode))throw new a.ErrnoError(54);var t=a.nodePermissions(r.node,"x");if(t)throw new a.ErrnoError(t);a.currentPath=r.path},createDefaultDirectories(){a.mkdir("/tmp"),a.mkdir("/home"),a.mkdir("/home/web_user")},createDefaultDevices(){a.mkdir("/dev"),a.registerDevice(a.makedev(1,3),{read:()=>0,write:(n,o,i,s,l)=>s}),a.mkdev("/dev/null",a.makedev(1,3)),se.register(a.makedev(5,0),se.default_tty_ops),se.register(a.makedev(6,0),se.default_tty1_ops),a.mkdev("/dev/tty",a.makedev(5,0)),a.mkdev("/dev/tty1",a.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(r=Kr(e).byteLength),e[--r]);a.createDevice("/dev","random",t),a.createDevice("/dev","urandom",t),a.mkdir("/dev/shm"),a.mkdir("/dev/shm/tmp")},createSpecialDirectories(){a.mkdir("/proc");var e=a.mkdir("/proc/self");a.mkdir("/proc/self/fd"),a.mount({mount(){var r=a.createNode(e,"fd",16895,73);return r.node_ops={lookup(t,n){var o=+n,i=a.getStreamChecked(o),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return s.parent=s,s}},r}},{},"/proc/self/fd")},createStandardStreams(){u.stdin?a.createDevice("/dev","stdin",u.stdin):a.symlink("/dev/tty","/dev/stdin"),u.stdout?a.createDevice("/dev","stdout",null,u.stdout):a.symlink("/dev/tty","/dev/stdout"),u.stderr?a.createDevice("/dev","stderr",null,u.stderr):a.symlink("/dev/tty1","/dev/stderr");var e=a.open("/dev/stdin",0),r=a.open("/dev/stdout",1),t=a.open("/dev/stderr",1)},staticInit(){[44].forEach(e=>{a.genericErrors[e]=new a.ErrnoError(e),a.genericErrors[e].stack="<generic error, no stack>"}),a.nameTable=new Array(4096),a.mount(A,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:A}},init(e,r,t){a.init.initialized=!0,u.stdin=e||u.stdin,u.stdout=r||u.stdout,u.stderr=t||u.stderr,a.createStandardStreams()},quit(){a.init.initialized=!1;for(var e=0;e<a.streams.length;e++){var r=a.streams[e];r&&a.close(r)}},findObject(e,r){var t=a.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=a.lookupPath(e,{follow:!r});e=t.path}catch(o){}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=a.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=M.basename(e),t=a.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(o){n.error=o.errno}return n},createPath(e,r,t,n){e=typeof e=="string"?e:a.getPath(e);for(var o=r.split("/").reverse();o.length;){var i=o.pop();if(i){var s=M.join2(e,i);try{a.mkdir(s)}catch(l){}e=s}}return s},createFile(e,r,t,n,o){var i=M.join2(typeof e=="string"?e:a.getPath(e),r),s=yr(n,o);return a.create(i,s)},createDataFile(e,r,t,n,o,i){var s=r;e&&(e=typeof e=="string"?e:a.getPath(e),s=r?M.join2(e,r):e);var l=yr(n,o),f=a.create(s,l);if(t){if(typeof t=="string"){for(var d=new Array(t.length),v=0,y=t.length;v<y;++v)d[v]=t.charCodeAt(v);t=d}a.chmod(f,l|146);var p=a.open(f,577);a.write(p,t,0,t.length,0,i),a.close(p),a.chmod(f,l)}},createDevice(e,r,t,n){var o=M.join2(typeof e=="string"?e:a.getPath(e),r),i=yr(!!t,!!n);a.createDevice.major||(a.createDevice.major=64);var s=a.makedev(a.createDevice.major++,0);return a.registerDevice(s,{open(l){l.seekable=!1},close(l){var f;(f=n==null?void 0:n.buffer)!=null&&f.length&&n(10)},read(l,f,d,v,y){for(var p=0,m=0;m<v;m++){var E;try{E=t()}catch(C){throw new a.ErrnoError(29)}if(E===void 0&&p===0)throw new a.ErrnoError(6);if(E==null)break;p++,f[d+m]=E}return p&&(l.node.timestamp=Date.now()),p},write(l,f,d,v,y){for(var p=0;p<v;p++)try{n(f[d+p])}catch(m){throw new a.ErrnoError(29)}return v&&(l.node.timestamp=Date.now()),p}}),a.mkdev(o,i,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest!="undefined")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(ye)try{e.contents=Xe(ye(e.url),!0),e.usedBytes=e.contents.length}catch(r){throw new a.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(e,r,t,n,o){class i{constructor(){this.lengthKnown=!1,this.chunks=[]}get(m){if(!(m>this.length-1||m<0)){var E=m%this.chunkSize,C=m/this.chunkSize|0;return this.getter(C)[E]}}setDataGetter(m){this.getter=m}cacheLength(){var m=new XMLHttpRequest;if(m.open("HEAD",t,!1),m.send(null),!(m.status>=200&&m.status<300||m.status===304))throw new Error("Couldn't load "+t+". Status: "+m.status);var E=Number(m.getResponseHeader("Content-length")),C,D=(C=m.getResponseHeader("Accept-Ranges"))&&C==="bytes",S=(C=m.getResponseHeader("Content-Encoding"))&&C==="gzip",c=1024*1024;D||(c=E);var h=(P,O)=>{if(P>O)throw new Error("invalid range ("+P+", "+O+") or no bytes requested!");if(O>E-1)throw new Error("only "+E+" bytes available! programmer error!");var W=new XMLHttpRequest;if(W.open("GET",t,!1),E!==c&&W.setRequestHeader("Range","bytes="+P+"-"+O),W.responseType="arraybuffer",W.overrideMimeType&&W.overrideMimeType("text/plain; charset=x-user-defined"),W.send(null),!(W.status>=200&&W.status<300||W.status===304))throw new Error("Couldn't load "+t+". Status: "+W.status);return W.response!==void 0?new Uint8Array(W.response||[]):Xe(W.responseText||"",!0)},T=this;T.setDataGetter(P=>{var O=P*c,W=(P+1)*c-1;if(W=Math.min(W,E-1),typeof T.chunks[P]=="undefined"&&(T.chunks[P]=h(O,W)),typeof T.chunks[P]=="undefined")throw new Error("doXHR failed!");return T.chunks[P]}),(S||!E)&&(c=E=1,E=this.getter(0).length,c=E,Z("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=E,this._chunkSize=c,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest!="undefined"){if(!V)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new i,l={isDevice:!1,contents:s}}else var l={isDevice:!1,url:t};var f=a.createFile(e,r,l,n,o);l.contents?f.contents=l.contents:l.url&&(f.contents=null,f.url=l.url),Object.defineProperties(f,{usedBytes:{get:function(){return this.contents.length}}});var d={},v=Object.keys(f.stream_ops);v.forEach(p=>{var m=f.stream_ops[p];d[p]=(...E)=>(a.forceLoadFile(f),m(...E))});function y(p,m,E,C,D){var S=p.node.contents;if(D>=S.length)return 0;var c=Math.min(S.length-D,C);if(S.slice)for(var h=0;h<c;h++)m[E+h]=S[D+h];else for(var h=0;h<c;h++)m[E+h]=S.get(D+h);return c}return d.read=(p,m,E,C,D)=>(a.forceLoadFile(f),y(p,m,E,C,D)),d.mmap=(p,m,E,C,D)=>{a.forceLoadFile(f);var S=Jr(m);if(!S)throw new a.ErrnoError(48);return y(p,N,S,m,E),{ptr:S,allocated:!0}},f.stream_ops=d,f}},Ke=(e,r)=>e?we(z,e,r):"",I={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(M.isAbs(r))return r;var n;if(e===-100)n=a.cwd();else{var o=I.getStreamFromFD(e);n=o.path}if(r.length==0){if(!t)throw new a.ErrnoError(44);return n}return M.join2(n,r)},doStat(e,r,t){var n=e(r);w[t>>2]=n.dev,w[t+4>>2]=n.mode,F[t+8>>2]=n.nlink,w[t+12>>2]=n.uid,w[t+16>>2]=n.gid,w[t+20>>2]=n.rdev,j=[n.size>>>0,(k=n.size,+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[t+24>>2]=j[0],w[t+28>>2]=j[1],w[t+32>>2]=4096,w[t+36>>2]=n.blocks;var o=n.atime.getTime(),i=n.mtime.getTime(),s=n.ctime.getTime();return j=[Math.floor(o/1e3)>>>0,(k=Math.floor(o/1e3),+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[t+40>>2]=j[0],w[t+44>>2]=j[1],F[t+48>>2]=o%1e3*1e3,j=[Math.floor(i/1e3)>>>0,(k=Math.floor(i/1e3),+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[t+56>>2]=j[0],w[t+60>>2]=j[1],F[t+64>>2]=i%1e3*1e3,j=[Math.floor(s/1e3)>>>0,(k=Math.floor(s/1e3),+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[t+72>>2]=j[0],w[t+76>>2]=j[1],F[t+80>>2]=s%1e3*1e3,j=[n.ino>>>0,(k=n.ino,+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[t+88>>2]=j[0],w[t+92>>2]=j[1],0},doMsync(e,r,t,n,o){if(!a.isFile(r.node.mode))throw new a.ErrnoError(43);if(n&2)return 0;var i=z.slice(e,e+t);a.msync(r,i,o,t,n)},getStreamFromFD(e){var r=a.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=Ke(e);return r}};function an(e,r,t){I.varargs=t;try{var n=I.getStreamFromFD(e);switch(r){case 0:{var o=Ge();if(o<0)return-28;for(;a.streams[o];)o++;var i;return i=a.dupStream(n,o),i.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var o=Ge();return n.flags|=o,0}case 12:{var o=_e(),s=0;return re[o+s>>1]=2,0}case 13:case 14:return 0}return-28}catch(l){if(typeof a=="undefined"||l.name!=="ErrnoError")throw l;return-l.errno}}var ve=(e,r,t)=>gr(e,z,r,t);function sn(e,r){try{if(r===0)return-28;var t=a.cwd(),n=Re(t)+1;return r<n?-68:(ve(t,e,r),n)}catch(o){if(typeof a=="undefined"||o.name!=="ErrnoError")throw o;return-o.errno}}function ln(e,r,t){I.varargs=t;try{var n=I.getStreamFromFD(e);switch(r){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),i=_e();w[i>>2]=o.c_iflag||0,w[i+4>>2]=o.c_oflag||0,w[i+8>>2]=o.c_cflag||0,w[i+12>>2]=o.c_lflag||0;for(var s=0;s<32;s++)N[i+s+17]=o.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var i=_e(),l=w[i>>2],f=w[i+4>>2],d=w[i+8>>2],v=w[i+12>>2],y=[],s=0;s<32;s++)y.push(N[i+s+17]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:l,c_oflag:f,c_cflag:d,c_lflag:v,c_cc:y})}return 0}case 21519:{if(!n.tty)return-59;var i=_e();return w[i>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var i=_e();return a.ioctl(n,r,i)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var p=n.tty.ops.ioctl_tiocgwinsz(n.tty),i=_e();re[i>>1]=p[0],re[i+2>>1]=p[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(m){if(typeof a=="undefined"||m.name!=="ErrnoError")throw m;return-m.errno}}function un(e,r,t){try{return r=I.getStr(r),r=I.calculateAt(e,r),r=M.normalize(r),r[r.length-1]==="/"&&(r=r.substr(0,r.length-1)),a.mkdir(r,t,0),0}catch(n){if(typeof a=="undefined"||n.name!=="ErrnoError")throw n;return-n.errno}}function fn(e,r,t,n){I.varargs=n;try{r=I.getStr(r),r=I.calculateAt(e,r);var o=n?Ge():0;return a.open(r,t,o).fd}catch(i){if(typeof a=="undefined"||i.name!=="ErrnoError")throw i;return-i.errno}}function dn(e,r,t,n){try{if(r=I.getStr(r),r=I.calculateAt(e,r),n<=0)return-28;var o=a.readlink(r),i=Math.min(n,Re(o)),s=N[t+i];return ve(o,t,n+1),N[t+i]=s,i}catch(l){if(typeof a=="undefined"||l.name!=="ErrnoError")throw l;return-l.errno}}function cn(e,r){try{return e=I.getStr(e),I.doStat(a.stat,e,r)}catch(t){if(typeof a=="undefined"||t.name!=="ErrnoError")throw t;return-t.errno}}var vn=()=>{pr("")},pn=(e,r,t,n,o)=>{},hn=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);rt=e},rt,Y=e=>{for(var r="",t=e;z[t];)r+=rt[z[t++]];return r},Ee={},pe={},Qe={},ke,R=e=>{throw new ke(e)},tt,Je=e=>{throw new tt(e)},X=(e,r,t)=>{e.forEach(function(l){Qe[l]=r});function n(l){var f=t(l);f.length!==e.length&&Je("Mismatched type converter count");for(var d=0;d<e.length;++d)ne(e[d],f[d])}var o=new Array(r.length),i=[],s=0;r.forEach((l,f)=>{pe.hasOwnProperty(l)?o[f]=pe[l]:(i.push(l),Ee.hasOwnProperty(l)||(Ee[l]=[]),Ee[l].push(()=>{o[f]=pe[l],++s,s===i.length&&n(o)}))}),i.length===0&&n(o)};function mn(e,r,t={}){var n=r.name;if(e||R(`type "${n}" must have a positive integer typeid pointer`),pe.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;R(`Cannot register type '${n}' twice`)}if(pe[e]=r,delete Qe[e],Ee.hasOwnProperty(e)){var o=Ee[e];delete Ee[e],o.forEach(i=>i())}}function ne(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return mn(e,r,t)}var le=8,gn=(e,r,t,n)=>{r=Y(r),ne(e,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,i){return i?t:n},argPackAdvance:le,readValueFromPointer:function(o){return this.fromWireType(z[o])},destructorFunction:null})},yn=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),_r=e=>{function r(t){return t.$$.ptrType.registeredClass.name}R(r(e)+" instance already deleted")},wr=!1,nt=e=>{},_n=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},ot=e=>{e.count.value-=1;var r=e.count.value===0;r&&_n(e)},at=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=at(e,r,t.baseClass);return n===null?null:t.downcast(n)},it={},wn=()=>Object.keys(Oe).length,En=()=>{var e=[];for(var r in Oe)Oe.hasOwnProperty(r)&&e.push(Oe[r]);return e},$e=[],Er=()=>{for(;$e.length;){var e=$e.pop();e.$$.deleteScheduled=!1,e.delete()}},Me,kn=e=>{Me=e,$e.length&&Me&&Me(Er)},bn=()=>{u.getInheritedInstanceCount=wn,u.getLiveInheritedInstances=En,u.flushPendingDeletes=Er,u.setDelayFunction=kn},Oe={},An=(e,r)=>{for(r===void 0&&R("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},Pn=(e,r)=>(r=An(e,r),Oe[r]),Ze=(e,r)=>{(!r.ptrType||!r.ptr)&&Je("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Je("Both smartPtrType and smartPtr must be specified"),r.count={value:1},We(Object.create(e,{$$:{value:r,writable:!0}}))};function Cn(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=Pn(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?Ze(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):Ze(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i=this.registeredClass.getActualType(r),s=it[i];if(!s)return o.call(this);var l;this.isConst?l=s.constPointerType:l=s.pointerType;var f=at(r,this.registeredClass,l.registeredClass);return f===null?o.call(this):this.isSmartPointer?Ze(l.registeredClass.instancePrototype,{ptrType:l,ptr:f,smartPtrType:this,smartPtr:e}):Ze(l.registeredClass.instancePrototype,{ptrType:l,ptr:f})}var We=e=>typeof FinalizationRegistry=="undefined"?(We=r=>r,e):(wr=new FinalizationRegistry(r=>{ot(r.$$)}),We=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var o={$$:t};wr.register(r,o,r)}return r},nt=r=>wr.unregister(r),We(e)),Sn=()=>{Object.assign(er.prototype,{isAliasOf(e){if(!(this instanceof er)||!(e instanceof er))return!1;var r=this.$$.ptrType.registeredClass,t=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,o=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return r===n&&t===o},clone(){if(this.$$.ptr||_r(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=We(Object.create(Object.getPrototypeOf(this),{$$:{value:yn(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||_r(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&R("Object already scheduled for deletion"),nt(this),ot(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||_r(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&R("Object already scheduled for deletion"),$e.push(this),$e.length===1&&Me&&Me(Er),this.$$.deleteScheduled=!0,this}})};function er(){}var rr=(e,r)=>Object.defineProperty(r,"name",{value:e}),kr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...o){return e[r].overloadTable.hasOwnProperty(o.length)||R(`Function '${t}' called with an invalid number of arguments (${o.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[o.length].apply(this,o)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},st=(e,r,t)=>{u.hasOwnProperty(e)?((t===void 0||u[e].overloadTable!==void 0&&u[e].overloadTable[t]!==void 0)&&R(`Cannot register public name '${e}' twice`),kr(u,e,e),u.hasOwnProperty(t)&&R(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),u[e].overloadTable[t]=r):(u[e]=r,t!==void 0&&(u[e].numArguments=t))},Tn=48,Dn=57,Fn=e=>{if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Tn&&r<=Dn?`_${e}`:e};function Rn(e,r,t,n,o,i,s,l){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=s,this.downcast=l,this.pureVirtualFunctions=[]}var tr=(e,r,t)=>{for(;r!==t;)r.upcast||R(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function $n(e,r){if(r===null)return this.isReference&&R(`null is not a valid ${this.name}`),0;r.$$||R(`Cannot pass "${Sr(r)}" as a ${this.name}`),r.$$.ptr||R(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=tr(r.$$.ptr,t,this.registeredClass);return n}function Mn(e,r){var t;if(r===null)return this.isReference&&R(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&R(`Cannot pass "${Sr(r)}" as a ${this.name}`),r.$$.ptr||R(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&R(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=tr(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&R("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:R(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var o=r.clone();t=this.rawShare(t,me.toHandle(()=>o.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:R("Unsupporting sharing policy")}return t}function On(e,r){if(r===null)return this.isReference&&R(`null is not a valid ${this.name}`),0;r.$$||R(`Cannot pass "${Sr(r)}" as a ${this.name}`),r.$$.ptr||R(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&R(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=tr(r.$$.ptr,t,this.registeredClass);return n}function nr(e){return this.fromWireType(F[e>>2])}var Wn=()=>{Object.assign(je.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},argPackAdvance:le,readValueFromPointer:nr,fromWireType:Cn})};function je(e,r,t,n,o,i,s,l,f,d,v){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=s,this.rawGetPointee=l,this.rawConstructor=f,this.rawShare=d,this.rawDestructor=v,!o&&r.baseClass===void 0?n?(this.toWireType=$n,this.destructorFunction=null):(this.toWireType=On,this.destructorFunction=null):this.toWireType=Mn}var lt=(e,r,t)=>{u.hasOwnProperty(e)||Je("Replacing nonexistent public symbol"),u[e].overloadTable!==void 0&&t!==void 0?u[e].overloadTable[t]=r:(u[e]=r,u[e].argCount=t)},jn=(e,r,t)=>{e=e.replace(/p/g,"i");var n=u["dynCall_"+e];return n(r,...t)},or=[],ut,ft=e=>{var r=or[e];return r||(e>=or.length&&(or.length=e+1),or[e]=r=ut.get(e)),r},In=(e,r,t=[])=>{if(e.includes("j"))return jn(e,r,t);var n=ft(r)(...t);return n},Nn=(e,r)=>(...t)=>In(e,r,t),q=(e,r)=>{e=Y(e);function t(){return e.includes("j")?Nn(e,r):ft(r)}var n=t();return typeof n!="function"&&R(`unknown function pointer with signature ${e}: ${r}`),n},xn=(e,r)=>{var t=rr(r,function(n){this.name=r,this.message=n;var o=new Error(n).stack;o!==void 0&&(this.stack=this.toString()+`
|
|
8
|
+
`+o.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t},dt,ct=e=>{var r=Et(e),t=Y(r);return ae(r),t},he=(e,r)=>{var t=[],n={};function o(i){if(!n[i]&&!pe[i]){if(Qe[i]){Qe[i].forEach(o);return}t.push(i),n[i]=!0}}throw r.forEach(o),new dt(`${e}: `+t.map(ct).join([", "]))},Un=(e,r,t,n,o,i,s,l,f,d,v,y,p)=>{v=Y(v),i=q(o,i),l&&(l=q(s,l)),d&&(d=q(f,d)),p=q(y,p);var m=Fn(v);st(m,function(){he(`Cannot construct ${v} due to unbound types`,[n])}),X([e,r,t],n?[n]:[],E=>{var W,Ue;E=E[0];var C,D;n?(C=E.registeredClass,D=C.instancePrototype):D=er.prototype;var S=rr(v,function(...He){if(Object.getPrototypeOf(this)!==c)throw new ke("Use 'new' to construct "+v);if(h.constructor_body===void 0)throw new ke(v+" has no accessible constructor");var Le=h.constructor_body[He.length];if(Le===void 0)throw new ke(`Tried to invoke ctor of ${v} with invalid number of parameters (${He.length}) - expected (${Object.keys(h.constructor_body).toString()}) parameters instead!`);return Le.apply(this,He)}),c=Object.create(D,{constructor:{value:S}});S.prototype=c;var h=new Rn(v,S,c,p,C,i,l,d);h.baseClass&&((Ue=(W=h.baseClass).__derivedClasses)!=null||(W.__derivedClasses=[]),h.baseClass.__derivedClasses.push(h));var T=new je(v,h,!0,!1,!1),P=new je(v+"*",h,!1,!1,!1),O=new je(v+" const*",h,!1,!0,!1);return it[e]={pointerType:P,constPointerType:O},lt(m,S),[T,P,O]})},br=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function Hn(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function ar(e,r,t,n,o,i){var s=r.length;s<2&&R("argTypes array size mismatch! Must at least get return value and 'this' types!");var l=r[1]!==null&&t!==null,f=Hn(r),d=r[0].name!=="void",v=s-2,y=new Array(v),p=[],m=[],E=function(...C){C.length!==v&&R(`function ${e} called with ${C.length} arguments, expected ${v}`),m.length=0;var D;p.length=l?2:1,p[0]=o,l&&(D=r[1].toWireType(m,this),p[1]=D);for(var S=0;S<v;++S)y[S]=r[S+2].toWireType(m,C[S]),p.push(y[S]);var c=n(...p);function h(T){if(f)br(m);else for(var P=l?1:2;P<r.length;P++){var O=P===1?D:y[P-2];r[P].destructorFunction!==null&&r[P].destructorFunction(O)}if(d)return r[0].fromWireType(T)}return h(c)};return rr(e,E)}var ir=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(F[r+n*4>>2]);return t},Ar=e=>{e=e.trim();let r=e.indexOf("(");return r!==-1?e.substr(0,r):e},Ln=(e,r,t,n,o,i,s,l)=>{var f=ir(t,n);r=Y(r),r=Ar(r),i=q(o,i),X([],[e],d=>{d=d[0];var v=`${d.name}.${r}`;function y(){he(`Cannot call ${v} due to unbound types`,f)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]);var p=d.registeredClass.constructor;return p[r]===void 0?(y.argCount=t-1,p[r]=y):(kr(p,r,v),p[r].overloadTable[t-1]=y),X([],f,m=>{var E=[m[0],null].concat(m.slice(1)),C=ar(v,E,null,i,s,l);if(p[r].overloadTable===void 0?(C.argCount=t-1,p[r]=C):p[r].overloadTable[t-1]=C,d.registeredClass.__derivedClasses)for(let D of d.registeredClass.__derivedClasses)D.constructor.hasOwnProperty(r)||(D.constructor[r]=C);return[]}),[]})},zn=(e,r,t,n,o,i)=>{var s=ir(r,t);o=q(n,o),X([],[e],l=>{l=l[0];var f=`constructor ${l.name}`;if(l.registeredClass.constructor_body===void 0&&(l.registeredClass.constructor_body=[]),l.registeredClass.constructor_body[r-1]!==void 0)throw new ke(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${l.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return l.registeredClass.constructor_body[r-1]=()=>{he(`Cannot construct ${l.name} due to unbound types`,s)},X([],s,d=>(d.splice(1,0,null),l.registeredClass.constructor_body[r-1]=ar(f,d,null,o,i),[])),[]})},Bn=(e,r,t,n,o,i,s,l,f)=>{var d=ir(t,n);r=Y(r),r=Ar(r),i=q(o,i),X([],[e],v=>{v=v[0];var y=`${v.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),l&&v.registeredClass.pureVirtualFunctions.push(r);function p(){he(`Cannot call ${y} due to unbound types`,d)}var m=v.registeredClass.instancePrototype,E=m[r];return E===void 0||E.overloadTable===void 0&&E.className!==v.name&&E.argCount===t-2?(p.argCount=t-2,p.className=v.name,m[r]=p):(kr(m,r,y),m[r].overloadTable[t-2]=p),X([],d,C=>{var D=ar(y,C,v,i,s,f);return m[r].overloadTable===void 0?(D.argCount=t-2,m[r]=D):m[r].overloadTable[t-2]=D,[]}),[]})},vt=(e,r,t)=>(e instanceof Object||R(`${t} with invalid "this": ${e}`),e instanceof r.registeredClass.constructor||R(`${t} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||R(`cannot call emscripten binding method ${t} on deleted object`),tr(e.$$.ptr,e.$$.ptrType.registeredClass,r.registeredClass)),Vn=(e,r,t,n,o,i,s,l,f,d)=>{r=Y(r),o=q(n,o),X([],[e],v=>{v=v[0];var y=`${v.name}.${r}`,p={get(){he(`Cannot access ${y} due to unbound types`,[t,s])},enumerable:!0,configurable:!0};return f?p.set=()=>he(`Cannot access ${y} due to unbound types`,[t,s]):p.set=m=>R(y+" is a read-only property"),Object.defineProperty(v.registeredClass.instancePrototype,r,p),X([],f?[t,s]:[t],m=>{var E=m[0],C={get(){var S=vt(this,v,y+" getter");return E.fromWireType(o(i,S))},enumerable:!0};if(f){f=q(l,f);var D=m[1];C.set=function(S){var c=vt(this,v,y+" setter"),h=[];f(d,c,D.toWireType(h,S)),br(h)}}return Object.defineProperty(v.registeredClass.instancePrototype,r,C),[]}),[]})},Pr=[],oe=[],Cr=e=>{e>9&&--oe[e+1]===0&&(oe[e]=void 0,Pr.push(e))},Yn=()=>oe.length/2-5-Pr.length,qn=()=>{oe.push(0,1,void 0,1,null,1,!0,1,!1,1),u.count_emval_handles=Yn},me={toValue:e=>(e||R("Cannot use deleted val. handle = "+e),oe[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=Pr.pop()||oe.length;return oe[r]=e,oe[r+1]=1,r}}}},Gn={name:"emscripten::val",fromWireType:e=>{var r=me.toValue(e);return Cr(e),r},toWireType:(e,r)=>me.toHandle(r),argPackAdvance:le,readValueFromPointer:nr,destructorFunction:null},pt=e=>ne(e,Gn),Sr=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Xn=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(Ur[t>>2])};case 8:return function(t){return this.fromWireType(Hr[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},Kn=(e,r,t)=>{r=Y(r),ne(e,{name:r,fromWireType:n=>n,toWireType:(n,o)=>o,argPackAdvance:le,readValueFromPointer:Xn(r,t),destructorFunction:null})},Qn=(e,r,t,n,o,i,s)=>{var l=ir(r,t);e=Y(e),e=Ar(e),o=q(n,o),st(e,function(){he(`Cannot call ${e} due to unbound types`,l)},r-1),X([],l,f=>{var d=[f[0],null].concat(f.slice(1));return lt(e,ar(e,d,null,o,i,s),r-1),[]})},Jn=(e,r,t)=>{switch(r){case 1:return t?n=>N[n]:n=>z[n];case 2:return t?n=>re[n>>1]:n=>Ve[n>>1];case 4:return t?n=>w[n>>2]:n=>F[n>>2];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},Zn=(e,r,t,n,o)=>{r=Y(r),o===-1&&(o=4294967295);var i=v=>v;if(n===0){var s=32-8*t;i=v=>v<<s>>>s}var l=r.includes("unsigned"),f=(v,y)=>{},d;l?d=function(v,y){return f(y,this.name),y>>>0}:d=function(v,y){return f(y,this.name),y},ne(e,{name:r,fromWireType:i,toWireType:d,argPackAdvance:le,readValueFromPointer:Jn(r,t,n!==0),destructorFunction:null})},eo=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],o=n[r];function i(s){var l=F[s>>2],f=F[s+4>>2];return new o(N.buffer,f,l)}t=Y(t),ne(e,{name:t,fromWireType:i,argPackAdvance:le,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},ro=(e,r)=>{pt(e)},to=(e,r,t,n,o,i,s,l,f,d,v,y)=>{t=Y(t),i=q(o,i),l=q(s,l),d=q(f,d),y=q(v,y),X([e],[r],p=>{p=p[0];var m=new je(t,p.registeredClass,!1,!1,!0,p,n,i,l,d,y);return[m]})},no=(e,r)=>{r=Y(r);var t=r==="std::string";ne(e,{name:r,fromWireType(n){var o=F[n>>2],i=n+4,s;if(t)for(var l=i,f=0;f<=o;++f){var d=i+f;if(f==o||z[d]==0){var v=d-l,y=Ke(l,v);s===void 0?s=y:(s+=String.fromCharCode(0),s+=y),l=d+1}}else{for(var p=new Array(o),f=0;f<o;++f)p[f]=String.fromCharCode(z[i+f]);s=p.join("")}return ae(n),s},toWireType(n,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var i,s=typeof o=="string";s||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Int8Array||R("Cannot pass non-string to std::string"),t&&s?i=Re(o):i=o.length;var l=Fr(4+i+1),f=l+4;if(F[l>>2]=i,t&&s)ve(o,f,i+1);else if(s)for(var d=0;d<i;++d){var v=o.charCodeAt(d);v>255&&(ae(f),R("String has UTF-16 code units that do not fit in 8 bits")),z[f+d]=v}else for(var d=0;d<i;++d)z[f+d]=o[d];return n!==null&&n.push(ae,l),l},argPackAdvance:le,readValueFromPointer:nr,destructorFunction(n){ae(n)}})},ht=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0,oo=(e,r)=>{for(var t=e,n=t>>1,o=n+r/2;!(n>=o)&&Ve[n];)++n;if(t=n<<1,t-e>32&&ht)return ht.decode(z.subarray(e,t));for(var i="",s=0;!(s>=r/2);++s){var l=re[e+s*2>>1];if(l==0)break;i+=String.fromCharCode(l)}return i},ao=(e,r,t)=>{if(t!=null||(t=2147483647),t<2)return 0;t-=2;for(var n=r,o=t<e.length*2?t/2:e.length,i=0;i<o;++i){var s=e.charCodeAt(i);re[r>>1]=s,r+=2}return re[r>>1]=0,r-n},io=e=>e.length*2,so=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var o=w[e+t*4>>2];if(o==0)break;if(++t,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|i&1023)}else n+=String.fromCharCode(o)}return n},lo=(e,r,t)=>{if(t!=null||(t=2147483647),t<4)return 0;for(var n=r,o=n+t-4,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343){var l=e.charCodeAt(++i);s=65536+((s&1023)<<10)|l&1023}if(w[r>>2]=s,r+=4,r+4>o)break}return w[r>>2]=0,r-n},uo=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&++t,r+=4}return r},fo=(e,r,t)=>{t=Y(t);var n,o,i,s;r===2?(n=oo,o=ao,s=io,i=l=>Ve[l>>1]):r===4&&(n=so,o=lo,s=uo,i=l=>F[l>>2]),ne(e,{name:t,fromWireType:l=>{for(var f=F[l>>2],d,v=l+4,y=0;y<=f;++y){var p=l+4+y*r;if(y==f||i(p)==0){var m=p-v,E=n(v,m);d===void 0?d=E:(d+=String.fromCharCode(0),d+=E),v=p+r}}return ae(l),d},toWireType:(l,f)=>{typeof f!="string"&&R(`Cannot pass non-string to C++ string type ${t}`);var d=s(f),v=Fr(4+d+r);return F[v>>2]=d/r,o(f,v+4,d+r),l!==null&&l.push(ae,v),v},argPackAdvance:le,readValueFromPointer:nr,destructorFunction(l){ae(l)}})},co=(e,r)=>{r=Y(r),ne(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}})},vo=1,po=()=>vo,ho=(e,r,t)=>z.copyWithin(e,r,r+t),Tr=[],mo=(e,r,t,n)=>(e=Tr[e],r=me.toValue(r),e(null,r,t,n)),go=e=>{var r=Tr.length;return Tr.push(e),r},mt=(e,r)=>{var t=pe[e];return t===void 0&&R(`${r} has unknown type ${ct(e)}`),t},yo=(e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=mt(F[r+n*4>>2],"parameter "+n);return t},_o=Reflect.construct,wo=(e,r,t)=>{var n=[],o=e.toWireType(n,t);return n.length&&(F[r>>2]=me.toHandle(n)),o},Eo=(e,r,t)=>{var n=yo(e,r),o=n.shift();e--;var i=new Array(e),s=(f,d,v,y)=>{for(var p=0,m=0;m<e;++m)i[m]=n[m].readValueFromPointer(y+p),p+=n[m].argPackAdvance;var E=t===1?_o(d,i):d.apply(f,i);return wo(o,v,E)},l=`methodCaller<(${n.map(f=>f.name).join(", ")}) => ${o.name}>`;return go(rr(l,s))},ko=e=>{e>9&&(oe[e+1]+=1)},bo=e=>{var r=me.toValue(e);br(r),Cr(e)},Ao=(e,r)=>{e=mt(e,"_emval_take_value");var t=e.readValueFromPointer(r);return me.toHandle(t)},Ie=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN;function Po(e,r,t){var n=Ie(e,r),o=new Date(n*1e3);w[t>>2]=o.getUTCSeconds(),w[t+4>>2]=o.getUTCMinutes(),w[t+8>>2]=o.getUTCHours(),w[t+12>>2]=o.getUTCDate(),w[t+16>>2]=o.getUTCMonth(),w[t+20>>2]=o.getUTCFullYear()-1900,w[t+24>>2]=o.getUTCDay();var i=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),s=(o.getTime()-i)/(1e3*60*60*24)|0;w[t+28>>2]=s}var Ne=e=>e%4===0&&(e%100!==0||e%400===0),Co=[0,31,60,91,121,152,182,213,244,274,305,335],So=[0,31,59,90,120,151,181,212,243,273,304,334],To=e=>{var r=Ne(e.getFullYear()),t=r?Co:So,n=t[e.getMonth()]+e.getDate()-1;return n};function Do(e,r,t){var n=Ie(e,r),o=new Date(n*1e3);w[t>>2]=o.getSeconds(),w[t+4>>2]=o.getMinutes(),w[t+8>>2]=o.getHours(),w[t+12>>2]=o.getDate(),w[t+16>>2]=o.getMonth(),w[t+20>>2]=o.getFullYear()-1900,w[t+24>>2]=o.getDay();var i=To(o)|0;w[t+28>>2]=i,w[t+36>>2]=-(o.getTimezoneOffset()*60);var s=new Date(o.getFullYear(),0,1),l=new Date(o.getFullYear(),6,1).getTimezoneOffset(),f=s.getTimezoneOffset(),d=(l!=f&&o.getTimezoneOffset()==Math.min(f,l))|0;w[t+32>>2]=d}function Fo(e,r,t,n,o,i,s,l){var f=Ie(o,i);try{if(isNaN(f))return 61;var d=I.getStreamFromFD(n),v=a.mmap(d,e,f,r,t),y=v.ptr;return w[s>>2]=v.allocated,F[l>>2]=y,0}catch(p){if(typeof a=="undefined"||p.name!=="ErrnoError")throw p;return-p.errno}}function Ro(e,r,t,n,o,i,s){var l=Ie(i,s);try{var f=I.getStreamFromFD(o);t&2&&I.doMsync(e,f,r,n,l)}catch(d){if(typeof a=="undefined"||d.name!=="ErrnoError")throw d;return-d.errno}}var $o=(e,r,t,n)=>{var o=new Date().getFullYear(),i=new Date(o,0,1),s=new Date(o,6,1),l=i.getTimezoneOffset(),f=s.getTimezoneOffset(),d=Math.max(l,f);F[e>>2]=d*60,w[r>>2]=+(l!=f);var v=m=>m.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1],y=v(i),p=v(s);f<l?(ve(y,t,17),ve(p,n,17)):(ve(y,n,17),ve(p,t,17))},Mo=()=>Date.now(),gt=()=>2147483648,Oo=()=>gt(),yt;yt=()=>performance.now();var Wo=e=>{var r=Be.buffer,t=(e-r.byteLength+65535)/65536;try{return Be.grow(t),Lr(),1}catch(n){}},jo=e=>{var r=z.length;e>>>=0;var t=gt();if(e>t)return!1;for(var n=(f,d)=>f+(d-f%d)%d,o=1;o<=4;o*=2){var i=r*(1+.2/o);i=Math.min(i,e+100663296);var s=Math.min(t,n(Math.max(e,i),65536)),l=Wo(s);if(l)return!0}return!1},Dr={},Io=()=>ge||"./this.program",xe=()=>{if(!xe.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Io()};for(var t in Dr)Dr[t]===void 0?delete r[t]:r[t]=Dr[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);xe.strings=n}return xe.strings},No=(e,r)=>{for(var t=0;t<e.length;++t)N[r++]=e.charCodeAt(t);N[r]=0},xo=(e,r)=>{var t=0;return xe().forEach((n,o)=>{var i=r+t;F[e+o*4>>2]=i,No(n,i),t+=n.length+1}),0},Uo=(e,r)=>{var t=xe();F[e>>2]=t.length;var n=0;return t.forEach(o=>n+=o.length+1),F[r>>2]=n,0},Ho=0,Lo=()=>qt||Ho>0,zo=e=>{var r;cr=e,Lo()||((r=u.onExit)==null||r.call(u,e),dr=!0),Se(e,new Yt(e))},Bo=(e,r)=>{cr=e,zo(e)},Vo=Bo;function Yo(e){try{var r=I.getStreamFromFD(e);return a.close(r),0}catch(t){if(typeof a=="undefined"||t.name!=="ErrnoError")throw t;return t.errno}}function qo(e,r){try{var t=0,n=0,o=0,i=I.getStreamFromFD(e),s=i.tty?2:a.isDir(i.mode)?3:a.isLink(i.mode)?7:4;return N[r]=s,re[r+2>>1]=o,j=[t>>>0,(k=t,+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[r+8>>2]=j[0],w[r+12>>2]=j[1],j=[n>>>0,(k=n,+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[r+16>>2]=j[0],w[r+20>>2]=j[1],0}catch(l){if(typeof a=="undefined"||l.name!=="ErrnoError")throw l;return l.errno}}var Go=(e,r,t,n)=>{for(var o=0,i=0;i<t;i++){var s=F[r>>2],l=F[r+4>>2];r+=8;var f=a.read(e,N,s,l,n);if(f<0)return-1;if(o+=f,f<l)break;typeof n!="undefined"&&(n+=f)}return o};function Xo(e,r,t,n){try{var o=I.getStreamFromFD(e),i=Go(o,r,t);return F[n>>2]=i,0}catch(s){if(typeof a=="undefined"||s.name!=="ErrnoError")throw s;return s.errno}}function Ko(e,r,t,n,o){var i=Ie(r,t);try{if(isNaN(i))return 61;var s=I.getStreamFromFD(e);return a.llseek(s,i,n),j=[s.position>>>0,(k=s.position,+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[o>>2]=j[0],w[o+4>>2]=j[1],s.getdents&&i===0&&n===0&&(s.getdents=null),0}catch(l){if(typeof a=="undefined"||l.name!=="ErrnoError")throw l;return l.errno}}var Qo=(e,r,t,n)=>{for(var o=0,i=0;i<t;i++){var s=F[r>>2],l=F[r+4>>2];r+=8;var f=a.write(e,N,s,l,n);if(f<0)return-1;o+=f,typeof n!="undefined"&&(n+=f)}return o};function Jo(e,r,t,n){try{var o=I.getStreamFromFD(e),i=Qo(o,r,t);return F[n>>2]=i,0}catch(s){if(typeof a=="undefined"||s.name!=="ErrnoError")throw s;return s.errno}}var Zo=(e,r)=>{for(var t=0,n=0;n<=r;t+=e[n++]);return t},_t=[31,29,31,30,31,30,31,31,30,31,30,31],wt=[31,28,31,30,31,30,31,31,30,31,30,31],ea=(e,r)=>{for(var t=new Date(e.getTime());r>0;){var n=Ne(t.getFullYear()),o=t.getMonth(),i=(n?_t:wt)[o];if(r>i-t.getDate())r-=i-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+r),t}return t},ra=(e,r)=>{N.set(e,r)},ta=(e,r,t,n)=>{var o=F[n+40>>2],i={tm_sec:w[n>>2],tm_min:w[n+4>>2],tm_hour:w[n+8>>2],tm_mday:w[n+12>>2],tm_mon:w[n+16>>2],tm_year:w[n+20>>2],tm_wday:w[n+24>>2],tm_yday:w[n+28>>2],tm_isdst:w[n+32>>2],tm_gmtoff:w[n+36>>2],tm_zone:o?Ke(o):""},s=Ke(t),l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var f in l)s=s.replace(new RegExp(f,"g"),l[f]);var d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],v=["January","February","March","April","May","June","July","August","September","October","November","December"];function y(c,h,T){for(var P=typeof c=="number"?c.toString():c||"";P.length<h;)P=T[0]+P;return P}function p(c,h){return y(c,h,"0")}function m(c,h){function T(O){return O<0?-1:O>0?1:0}var P;return(P=T(c.getFullYear()-h.getFullYear()))===0&&(P=T(c.getMonth()-h.getMonth()))===0&&(P=T(c.getDate()-h.getDate())),P}function E(c){switch(c.getDay()){case 0:return new Date(c.getFullYear()-1,11,29);case 1:return c;case 2:return new Date(c.getFullYear(),0,3);case 3:return new Date(c.getFullYear(),0,2);case 4:return new Date(c.getFullYear(),0,1);case 5:return new Date(c.getFullYear()-1,11,31);case 6:return new Date(c.getFullYear()-1,11,30)}}function C(c){var h=ea(new Date(c.tm_year+1900,0,1),c.tm_yday),T=new Date(h.getFullYear(),0,4),P=new Date(h.getFullYear()+1,0,4),O=E(T),W=E(P);return m(O,h)<=0?m(W,h)<=0?h.getFullYear()+1:h.getFullYear():h.getFullYear()-1}var D={"%a":c=>d[c.tm_wday].substring(0,3),"%A":c=>d[c.tm_wday],"%b":c=>v[c.tm_mon].substring(0,3),"%B":c=>v[c.tm_mon],"%C":c=>{var h=c.tm_year+1900;return p(h/100|0,2)},"%d":c=>p(c.tm_mday,2),"%e":c=>y(c.tm_mday,2," "),"%g":c=>C(c).toString().substring(2),"%G":C,"%H":c=>p(c.tm_hour,2),"%I":c=>{var h=c.tm_hour;return h==0?h=12:h>12&&(h-=12),p(h,2)},"%j":c=>p(c.tm_mday+Zo(Ne(c.tm_year+1900)?_t:wt,c.tm_mon-1),3),"%m":c=>p(c.tm_mon+1,2),"%M":c=>p(c.tm_min,2),"%n":()=>`
|
|
9
|
+
`,"%p":c=>c.tm_hour>=0&&c.tm_hour<12?"AM":"PM","%S":c=>p(c.tm_sec,2),"%t":()=>" ","%u":c=>c.tm_wday||7,"%U":c=>{var h=c.tm_yday+7-c.tm_wday;return p(Math.floor(h/7),2)},"%V":c=>{var h=Math.floor((c.tm_yday+7-(c.tm_wday+6)%7)/7);if((c.tm_wday+371-c.tm_yday-2)%7<=2&&h++,h){if(h==53){var P=(c.tm_wday+371-c.tm_yday)%7;P!=4&&(P!=3||!Ne(c.tm_year))&&(h=1)}}else{h=52;var T=(c.tm_wday+7-c.tm_yday-1)%7;(T==4||T==5&&Ne(c.tm_year%400-1))&&h++}return p(h,2)},"%w":c=>c.tm_wday,"%W":c=>{var h=c.tm_yday+7-(c.tm_wday+6)%7;return p(Math.floor(h/7),2)},"%y":c=>(c.tm_year+1900).toString().substring(2),"%Y":c=>c.tm_year+1900,"%z":c=>{var h=c.tm_gmtoff,T=h>=0;return h=Math.abs(h)/60,h=h/60*100+h%60,(T?"+":"-")+("0000"+h).slice(-4)},"%Z":c=>c.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var f in D)s.includes(f)&&(s=s.replace(new RegExp(f,"g"),D[f](i)));s=s.replace(/\0\0/g,"%");var S=Xe(s,!1);return S.length>r?0:(ra(S,e),S.length-1)},na=(e,r,t,n,o)=>ta(e,r,t,n),oa=a.createPath,aa=e=>a.unlink(e),ia=a.createLazyFile,sa=a.createDevice;a.createPreloadedFile=et,a.staticInit(),u.FS_createPath=a.createPath,u.FS_createDataFile=a.createDataFile,u.FS_createPreloadedFile=a.createPreloadedFile,u.FS_unlink=a.unlink,u.FS_createLazyFile=a.createLazyFile,u.FS_createDevice=a.createDevice,hn(),ke=u.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},tt=u.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},Sn(),bn(),Wn(),dt=u.UnboundTypeError=xn(Error,"UnboundTypeError"),qn();var la={a:Kt,q:an,N:sn,Q:ln,J:un,r:fn,I:dn,O:cn,T:vn,D:pn,V:gn,e:Un,s:Ln,n:zn,g:Bn,m:Vn,U:pt,v:Kn,i:Qn,c:Zn,b:eo,x:ro,o:to,u:no,l:fo,W:co,R:po,S:ho,Y:mo,d:Cr,Z:Eo,w:ko,X:bo,h:Ao,A:Po,B:Do,y:Fo,z:Ro,G:$o,t:Mo,H:Oo,j:yt,F:jo,L:xo,M:Uo,f:Vo,k:Yo,K:qo,P:Xo,C:Ko,p:Jo,E:na},x=Vt(),ua=()=>(ua=x.$)(),Et=e=>(Et=x.aa)(e),Fr=e=>(Fr=x.ba)(e),ae=e=>(ae=x.da)(e),kt=(e,r)=>(kt=x.ea)(e,r),bt=e=>(bt=x.fa)(e),fa=u.dynCall_jjj=(e,r,t,n,o)=>(fa=u.dynCall_jjj=x.ga)(e,r,t,n,o),da=u.dynCall_iiiijj=(e,r,t,n,o,i,s,l)=>(da=u.dynCall_iiiijj=x.ha)(e,r,t,n,o,i,s,l),ca=u.dynCall_viijj=(e,r,t,n,o,i,s)=>(ca=u.dynCall_viijj=x.ia)(e,r,t,n,o,i,s),va=u.dynCall_viiijjjj=(e,r,t,n,o,i,s,l,f,d,v,y)=>(va=u.dynCall_viiijjjj=x.ja)(e,r,t,n,o,i,s,l,f,d,v,y),pa=u.dynCall_iji=(e,r,t,n)=>(pa=u.dynCall_iji=x.ka)(e,r,t,n),ha=u.dynCall_jiji=(e,r,t,n,o)=>(ha=u.dynCall_jiji=x.la)(e,r,t,n,o),ma=u.dynCall_viijii=(e,r,t,n,o,i,s)=>(ma=u.dynCall_viijii=x.ma)(e,r,t,n,o,i,s),ga=u.dynCall_iiiiij=(e,r,t,n,o,i,s)=>(ga=u.dynCall_iiiiij=x.na)(e,r,t,n,o,i,s),ya=u.dynCall_iiiiijj=(e,r,t,n,o,i,s,l,f)=>(ya=u.dynCall_iiiiijj=x.oa)(e,r,t,n,o,i,s,l,f),_a=u.dynCall_iiiiiijj=(e,r,t,n,o,i,s,l,f,d)=>(_a=u.dynCall_iiiiiijj=x.pa)(e,r,t,n,o,i,s,l,f,d);u.addRunDependency=Ye,u.removeRunDependency=Fe,u.FS_createPreloadedFile=et,u.FS_unlink=aa,u.FS_createPath=oa,u.FS_createDevice=sa,u.FS_createDataFile=Zr,u.FS_createLazyFile=ia;var sr;De=function e(){sr||At(),sr||(De=e)};function At(){if(ce>0||(Ot(),ce>0))return;function e(){sr||(sr=!0,u.calledRun=!0,!dr&&(Wt(),U(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),jt()))}u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("")},1),e()},1)):e()}if(u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();return At(),b=Q,b}})();typeof Ft=="object"&&typeof $r=="object"?$r.exports=Rr:typeof define=="function"&&define.amd&&define([],()=>Rr);Rr.getUrl=function($){return"https://st.mycdn.me/static/audio-processing/0-0-7/"+$}});var Fa={};Ca(Fa,{EffectVmojiLmarksAi:()=>Pe,EffectVmojiLmarksVolume:()=>Ae,EffectVoiceChange:()=>Ce,EffectVoiceChangeMode:()=>jr,VoiceChangeEffectType:()=>Ir});module.exports=Sa(Fa);var ze=class{constructor(_,g="AudioEffects"){this.loggerFunction=_,this.loggerName=g}debug(..._){this.loggerFunction("DEBUG",`[${this.loggerName}]`,..._)}log(..._){this.loggerFunction("LOG",`[${this.loggerName}]`,..._)}warn(..._){this.loggerFunction("WARN",`[${this.loggerName}]`,..._)}error(..._){this.loggerFunction("ERROR",`[${this.loggerName}]`,..._)}};function ur($,_=[]){let g=_.join(","),b=typeof $=="string"?[$,`exports.default(${g});`]:[`(${$})(${g});`],u=new Blob(b,{type:"application/javascript; charset=utf-8"});return window.URL.createObjectURL(u)}var be=class{constructor(){this.outputStream=null;this.audioContext=null;this.workletNode=null;this.sourceNode=null;this.logger=new ze(()=>{})}init(H){return K(this,arguments,function*({sampleRate:_,isOutputAudio:g=!1,isOutputStream:b=!1,workletFunction:u,workletName:U}){if(this.logger.debug("init"),this.createAudioContext(_),yield this.createWorklet(u,U),this.workletNode&&this.audioContext&&(g&&(this.workletNode.connect(this.audioContext.destination),this.logger.debug("connected to standart audio output")),b)){let Q=this.audioContext.createMediaStreamDestination();this.workletNode.connect(Q),this.outputStream=Q.stream,this.logger.debug("connected to output MediaStream")}})}setSourceStream(_){var g;if(this.audioContext&&this.workletNode){let b=null;if(_){let u=new MediaStream(_.getAudioTracks().filter(U=>U.contentHint!=="music"));b=this.audioContext.createMediaStreamSource(u)}(g=this.sourceNode)==null||g.disconnect(this.workletNode),b==null||b.connect(this.workletNode),this.sourceNode=b,this.logger.debug("source stream "+(_?"set":"set to null"))}}destroy(){var _;this.logger.debug("destroy"),(_=this.audioContext)==null||_.close(),this.workletNode=null,this.sourceNode=null,this.audioContext=null,this.outputStream=null}resume(){var _;this.logger.debug("resume"),(_=this.audioContext)==null||_.resume()}pause(){var _;this.logger.debug("pause"),(_=this.audioContext)==null||_.suspend()}setLogger(_=()=>{},g){this.logger=new ze(_,g)}static isSupported(){try{let _=window;return!!(_.WebAssembly&&_.Worker&&(_.AudioContext||_.webkitAudioContext)&&_.AudioWorkletNode)}catch(_){return!1}}createAudioContext(_){let g=window.AudioContext||window.webkitAudioContext,b=new g(_?{sampleRate:_}:{});this.audioContext=b,this.logger.debug("created AudioContext")}createWorklet(_,g){return K(this,null,function*(){if(this.logger.debug(`${g} init started`),!this.audioContext)return;yield this.audioContext.audioWorklet.addModule(ur(_));let b=new AudioWorkletNode(this.audioContext,g);return this.workletNode=b,new Promise(u=>{b.port.onmessage=({data:U})=>{switch(U.type){case"init":{this.logger.debug(`${g} init success`),u();break}case"data":{this.onWorkletData(U.data);break}}}})})}sendDataToWorklet(_,g=[]){var b;(b=this.workletNode)==null||b.port.postMessage(_,g)}};function Dt(){let B=[.26691192,.5013858,.3037737,.58564115,.35116732,.67516255,.41435885,.7225562,.4775504,.7752158,.5881356,.79627967,.68818885,.7594179,.75138044,.7120243,.8040401,.65936464,.85143363,.57510924,.8777635,.4855879,.4512206,.58564115,.5038802,.56457734,.5512739,.5540454,.5776037,.56457734,.60393345,.5540454,.66712505,.56457734,.70398676,.57510924,.65132713,.606705,.6144654,.6172369,.5776037,.6172369,.5407419,.6172369,.5038802,.606705,.46701849,.58564115,.5407419,.58564115,.5776037,.58564115,.6144654,.58564115,.68818885,.57510924,.6144654,.58564115,.5776037,.58564115,.5407419,.58564115],V=B[59],Nr=1-B[59];class L extends AudioWorkletProcessor{constructor(){super();this.lastTime=0;this.frameSampleCount=0;this.frameSampleAverage=0;this.maxInputVolume=.3;this.sequence=0;this.port.postMessage({type:"init"})}process(ge){var ye;let Se=currentTime,G=0,de=(ye=ge==null?void 0:ge[0])==null?void 0:ye[0];if(de!=null&&de.length&&(G=de.reduce((ie,Z)=>ie+Math.abs(Z),0)/de.length),this.frameSampleAverage=(this.frameSampleAverage*this.frameSampleCount+G)/(this.frameSampleCount+1),this.frameSampleCount+=1,Se-this.lastTime>1/25){let J=[];for(let Z=0;Z<31*2;Z+=1)J.push(B[Z]);this.frameSampleAverage>.015&&(J[59]=this.frameSampleAverage/this.maxInputVolume>.5?this.sequence%2===0?this.frameSampleAverage/2:this.frameSampleAverage:this.frameSampleAverage,J[59]=V+Nr*J[59]/.5),this.sequence+=1,this.frameSampleCount=1,this.maxInputVolume=Math.max(this.maxInputVolume,this.frameSampleAverage),this.lastTime=Se;let ie=new Float32Array(J).buffer;this.port.postMessage({type:"data",data:ie},[ie])}return!0}}registerProcessor("vmojiLmarksVolumeWorklet",L)}var Ae=class extends be{constructor(){super(...arguments);this.onData=()=>{}}init(){return K(this,null,function*(){yield ue(Ae.prototype,this,"init").call(this,{workletFunction:Dt,workletName:"vmojiLmarksVolumeWorklet"})})}onWorkletData(g){this.onData(g)}};var Or=St(Mr());var fe=class extends be{constructor(){super(...arguments);this.worker=null}init(g){return K(this,null,function*(){yield ue(fe.prototype,this,"init").call(this,g),yield this.createWorker(g.workerFunctionString,g.workerArgs)})}destroy(){var g;super.destroy(),(g=this.worker)==null||g.terminate(),this.worker=null}sendDataToWorker(g,b=[]){var u;(u=this.worker)==null||u.postMessage(g,b)}static isSupported(){try{let g=window;return!!(super.isSupported()&&g.Worker)}catch(g){return!1}}createWorker(g,b=[]){return new Promise((u,U)=>{this.logger.debug("worker init started"),this.worker=new Worker(ur(g,b)),this.worker.onmessage=({data:H})=>{switch(H.type){case"init":{this.logger.debug("worker init success"),u();break}case"error":{this.logger.error(H.error),U(H.error);break}case"data":{this.onWorkerData(H.data);break}case"debug":{this.logger.debug(H.message);break}}}})}};function Rt(){class $ extends AudioWorkletProcessor{constructor(){super(),this.port.postMessage({type:"init"})}process(g){var b;return(b=g==null?void 0:g[0])!=null&&b[0]&&this.port.postMessage({type:"data",data:g[0][0].buffer},[g[0][0].buffer]),!0}}registerProcessor("pureWorklet",$)}var Ta=16e3,Pe=class extends fe{constructor(){super(...arguments);this.onData=()=>{}}init(){return K(this,null,function*(){yield ue(Pe.prototype,this,"init").call(this,{sampleRate:Ta,workletFunction:Rt,workletName:"pureWorklet",workerFunctionString:`"use strict";var exports=(()=>{var g=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var b=(o,t)=>{for(var e in t)g(o,e,{get:t[e],enumerable:!0})},y=(o,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!f.call(o,n)&&n!==e&&g(o,n,{get:()=>t[n],enumerable:!(s=w(t,n))||s.enumerable});return o};var A=o=>y(g({},"__esModule",{value:!0}),o);var v={};b(v,{default:()=>x});var x=(o,t)=>{let e=null,s=null;function n(){return o({locateFile:t}).then(r=>{e=r;let l=new e.ConfigInput("animoji_v4.cfg",!0,"/"),i=new e.Config(l);s=e.AnimojiFactory.createAlgorithm(i)})}function p(r){self.postMessage({type:"error",error:typeof r=="number"&&e?e.getExMessage(r):r})}function k(r){var l;if(!(!e||!s))try{let i=new e.vector$float$,h=new Float32Array(r);for(let u of h)i.push_back(u);let a=e.animate(s,i),d=(l=a==null?void 0:a.size)==null?void 0:l.call(a);if(!d)return;let c=new Float32Array(d);for(let u=0;u<d;u++)c[u]=a.get(u);self.postMessage({type:"data",data:c.buffer},[c.buffer])}catch(i){p(i)}}n().then(()=>{self.onmessage=r=>{k(r.data.data)},self.postMessage({type:"init"})}).catch(p)};return A(v);})();
|
|
10
|
+
`,workerArgs:[Or.default,Or.default.getUrl]})})}onWorkletData(g){this.sendDataToWorker({data:g},[g])}onWorkerData(g){this.onData(g)}static isSupported(){try{let g=super.isSupported(),b=/firefox/i.test(navigator.userAgent);return g&&!b}catch(g){return!1}}};var Wr=St(Mr());function $t(){class $ extends AudioWorkletProcessor{constructor(){super();this.samplesQueue=[];this.port.postMessage({type:"init"}),this.port.onmessage=({data:{data:b}})=>{this.samplesQueue.push(b)}}process(b,u){var U;if((U=b==null?void 0:b[0])!=null&&U[0]&&this.port.postMessage({type:"data",data:b[0][0].buffer},[b[0][0].buffer]),this.samplesQueue.length>0){let H=new Float32Array(this.samplesQueue.shift());u[0].forEach(B=>{for(let V=0;V<H.length;V++)B[V]=H[V]})}return!0}}registerProcessor("voiceChangeWorklet",$)}var jr=(g=>(g.PLAYBACK="playback",g.OUTPUT_STREAM="output_stream",g))(jr||{}),Ir=(L=>(L.BALLOON="balloon",L.CATHEDRAL="cathedral",L.CHORUS="chorus",L.DISTORTION="distortion",L.ECHO="echo",L.EVIL="evil",L.GIANT="giant",L.HALL="hall",L.PHASER="phaser",L.ROBOT="robot",L.SQUIRELL="squirell",L))(Ir||{}),Da=44100,Ce=class extends fe{constructor(g="playback"){super();this.mode=g}init(){return K(this,null,function*(){yield ue(Ce.prototype,this,"init").call(this,{sampleRate:Da,isOutputAudio:this.mode==="playback",isOutputStream:this.mode==="output_stream",workletFunction:$t,workletName:"voiceChangeWorklet",workerFunctionString:'"use strict";var exports=(()=>{var p=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var W=(s,r)=>{for(var e in r)p(s,e,{get:r[e],enumerable:!0})},A=(s,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of b(r))!y.call(s,i)&&i!==e&&p(s,i,{get:()=>r[i],enumerable:!(a=m(r,i))||a.enumerable});return s};var R=s=>A(p({},"__esModule",{value:!0}),s);var E={};W(E,{VoiceChangeWorkerRequestType:()=>f,default:()=>v});var f=(e=>(e.SET_EFFECTS="set_effects",e.DATA="data",e))(f||{}),v=(s,r)=>{let e=null,a=[];function i(){return s({locateFile:r}).then(t=>{e=t})}function k(t,l=!1){if(e)try{for(let o of t){let g=`${o}${l?".cfg":""}`,c=new e.ConfigInput(g,l,"/"),u=new e.Config(c),n=e.EffectFactory.createAlgorithm(u);a.push({configInput:c,config:u,effect:n})}}catch(o){d(o)}}function h(){for(let t of a)t.configInput.delete(),t.config.delete(),t.effect.delete();a=[]}function d(t){self.postMessage({type:"error",error:typeof t=="number"&&e?e.getExMessage(t):t})}function w(t){var l;if(!(!e||!a.length))try{let o=new e.vector$float$,g=new Float32Array(t);for(let n of g)o.push_back(n);for(let{effect:n}of a)o=e.applyEffect(n,o);let c=(l=o==null?void 0:o.size)==null?void 0:l.call(o);if(!c)return;let u=new Float32Array(c);for(let n=0;n<c;n++)u[n]=o.get(n);self.postMessage({type:"data",data:u.buffer},[u.buffer])}catch(o){d(o)}}i().then(()=>{self.onmessage=({data:t})=>{switch(t.type){case"set_effects":{h(),k(t.effects,t.isPreset);break}case"data":{w(t.data);break}}},self.postMessage({type:"init"})}).catch(d)};return R(E);})();\n',workerArgs:[Wr.default,Wr.default.getUrl]})})}setEffects(g,b){this.logger.debug("setEffects",g,b),this.sendDataToWorker({type:"set_effects",effects:g,isPreset:b})}onWorkletData(g){this.sendDataToWorker({type:"data",data:g},[g])}onWorkerData(g){this.sendDataToWorklet({data:g},[g])}};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vkontakte/calls-audio-effects v1.0.1
|
|
3
|
+
* Tue, 09 Jul 2024 11:39:58 GMT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
var _a=Object.create;var kt=Object.defineProperty;var wa=Object.getOwnPropertyDescriptor;var Ea=Object.getOwnPropertyNames;var bt=Object.getPrototypeOf,ka=Object.prototype.hasOwnProperty;var ba=Reflect.get;var Aa=($,_)=>()=>(_||$((_={exports:{}}).exports,_),_.exports);var Pa=($,_,y,b)=>{if(_&&typeof _=="object"||typeof _=="function")for(let u of Ea(_))!ka.call($,u)&&u!==y&&kt($,u,{get:()=>_[u],enumerable:!(b=wa(_,u))||b.enumerable});return $};var At=($,_,y)=>(y=$!=null?_a(bt($)):{},Pa(_||!$||!$.__esModule?kt(y,"default",{value:$,enumerable:!0}):y,$));var ue=($,_,y)=>ba(bt($),y,_);var K=($,_,y)=>new Promise((b,u)=>{var U=B=>{try{Q(y.next(B))}catch(V){u(V)}},H=B=>{try{Q(y.throw(B))}catch(V){u(V)}},Q=B=>B.done?b(B.value):Promise.resolve(B.value).then(U,H);Q((y=y.apply($,_)).next())});var $r=Aa((St,Rr)=>{var Fr=(()=>{var _;var $=typeof document!="undefined"?(_=document.currentScript)==null?void 0:_.src:void 0;return function(y={}){var b,u=y,U,H,Q=new Promise((e,r)=>{U=e,H=r}),B=typeof window=="object",V=typeof importScripts=="function",Wr=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";u.expectedDataFileDownloads||(u.expectedDataFileDownloads=0),u.expectedDataFileDownloads++,(()=>{var e=typeof ENVIRONMENT_IS_PTHREAD!="undefined"&&ENVIRONMENT_IS_PTHREAD,r=typeof ENVIRONMENT_IS_WASM_WORKER!="undefined"&&ENVIRONMENT_IS_WASM_WORKER;if(e||r)return;function t(n){var o="";typeof window=="object"?o=window.encodeURIComponent(window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/"):typeof process=="undefined"&&typeof location!="undefined"&&(o=encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/"));var i="wasm_bindings.data",s="wasm_bindings.data";typeof u.locateFilePackage=="function"&&!u.locateFile&&(u.locateFile=u.locateFilePackage,ee("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)"));var l=u.locateFile?u.locateFile(s,""):s,f=n.remote_package_size;function d(E,C,D,S){var c=new XMLHttpRequest;c.open("GET",E,!0),c.responseType="arraybuffer",c.onprogress=function(h){var T=E,P=C;if(h.total&&(P=h.total),h.loaded){c.addedTotal?u.dataFileDownloads[T].loaded=h.loaded:(c.addedTotal=!0,u.dataFileDownloads||(u.dataFileDownloads={}),u.dataFileDownloads[T]={loaded:h.loaded,total:P});var O=0,W=0,Ie=0;for(var Ne in u.dataFileDownloads){var xe=u.dataFileDownloads[Ne];O+=xe.total,W+=xe.loaded,Ie++}O=Math.ceil(O*u.expectedDataFileDownloads/Ie),u.setStatus&&u.setStatus(`Downloading data... (${W}/${O})`)}else u.dataFileDownloads||u.setStatus&&u.setStatus("Downloading data...")},c.onerror=function(h){throw new Error("NetworkError for: "+E)},c.onload=function(h){if(c.status==200||c.status==304||c.status==206||c.status==0&&c.response){var T=c.response;D(T)}else throw new Error(c.statusText+" : "+c.responseURL)},c.send(null)}function v(E){console.error("package error:",E)}var g=null,p=u.getPreloadedPackage?u.getPreloadedPackage(l,f):null;p||d(l,f,function(E){g?(g(E),g=null):p=E},v);function m(){function E(h,T){if(!h)throw T+new Error().stack}function C(h,T,P){this.start=h,this.end=T,this.audio=P}C.prototype={requests:{},open:function(h,T){this.name=T,this.requests[T]=this,u.addRunDependency(`fp ${this.name}`)},send:function(){},onload:function(){var h=this.byteArray.subarray(this.start,this.end);this.finish(h)},finish:function(h){var T=this;u.FS_createDataFile(this.name,null,h,!0,!0,!0),u.removeRunDependency(`fp ${T.name}`),this.requests[this.name]=null}};for(var D=n.files,S=0;S<D.length;++S)new C(D[S].start,D[S].end,D[S].audio||0).open("GET",D[S].filename);function c(h){E(h,"Loading data file failed."),E(h.constructor.name===ArrayBuffer.name,"bad input to processPackageData");var T=new Uint8Array(h);C.prototype.byteArray=T;for(var P=n.files,O=0;O<P.length;++O)C.prototype.requests[P[O].filename].onload();u.removeRunDependency("datafile_wasm_bindings.data")}u.addRunDependency("datafile_wasm_bindings.data"),u.preloadResults||(u.preloadResults={}),u.preloadResults[i]={fromCache:!1},p?(c(p),p=null):g=c}u.calledRun?m():(u.preRun||(u.preRun=[]),u.preRun.push(m))}t({files:[{filename:"/animoji_v4.cfg",start:0,end:333},{filename:"/balloon.cfg",start:333,end:409},{filename:"/cathedral.cfg",start:409,end:586},{filename:"/chorus.cfg",start:586,end:865},{filename:"/distortion.cfg",start:865,end:1007},{filename:"/echo.cfg",start:1007,end:1144},{filename:"/evil.cfg",start:1144,end:1285},{filename:"/giant.cfg",start:1285,end:1361},{filename:"/hall.cfg",start:1361,end:1534},{filename:"/phaser.cfg",start:1534,end:1634},{filename:"/robot.cfg",start:1634,end:1774},{filename:"/squirell.cfg",start:1774,end:1850},{filename:"/wav2lip_lite_rec-v4-v2.tflite",start:1850,end:1850}],remote_package_size:1850})})();var L=null,ur=Object.assign({},u),jr=[],ge="./this.program",Ae=(e,r)=>{throw r},G="";function de(e){return u.locateFile?u.locateFile(e,G):G+e}var ye,J,ie;(B||V)&&(V?G=self.location.href:typeof document!="undefined"&&document.currentScript&&(G=document.currentScript.src),L&&(G=L),G.startsWith("blob:")?G="":G=G.substr(0,G.replace(/[?#].*/,"").lastIndexOf("/")+1),ye=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},V&&(ie=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),J=(e,r,t)=>{fetch(e,{credentials:"same-origin"}).then(n=>n.ok?n.arrayBuffer():Promise.reject(new Error(n.status+" : "+n.url))).then(r,t)});var Z=u.print||console.log.bind(console),ee=u.printErr||console.error.bind(console);Object.assign(u,ur),ur=null,u.arguments&&(jr=u.arguments),u.thisProgram&&(ge=u.thisProgram),u.quit&&(Ae=u.quit);var Pe;u.wasmBinary&&(Pe=u.wasmBinary);var Be,fr=!1,dr,N,z,re,Ve,w,F,Ir,Nr;function xr(){var e=Be.buffer;u.HEAP8=N=new Int8Array(e),u.HEAP16=re=new Int16Array(e),u.HEAPU8=z=new Uint8Array(e),u.HEAPU16=Ve=new Uint16Array(e),u.HEAP32=w=new Int32Array(e),u.HEAPU32=F=new Uint32Array(e),u.HEAPF32=Ir=new Float32Array(e),u.HEAPF64=Nr=new Float64Array(e)}var Ur=[],Hr=[],Lr=[],$t=!1;function Mt(){if(u.preRun)for(typeof u.preRun=="function"&&(u.preRun=[u.preRun]);u.preRun.length;)jt(u.preRun.shift());pr(Ur)}function Ot(){$t=!0,!u.noFSInit&&!a.init.initialized&&a.init(),a.ignorePermissions=!1,se.init(),pr(Hr)}function Wt(){if(u.postRun)for(typeof u.postRun=="function"&&(u.postRun=[u.postRun]);u.postRun.length;)Nt(u.postRun.shift());pr(Lr)}function jt(e){Ur.unshift(e)}function It(e){Hr.unshift(e)}function Nt(e){Lr.unshift(e)}var ce=0,cr=null,Ce=null;function Ta(e){return e}function Ye(e){var r;ce++,(r=u.monitorRunDependencies)==null||r.call(u,ce)}function Se(e){var t;if(ce--,(t=u.monitorRunDependencies)==null||t.call(u,ce),ce==0&&(cr!==null&&(clearInterval(cr),cr=null),Ce)){var r=Ce;Ce=null,r()}}function vr(e){var t;(t=u.onAbort)==null||t.call(u,e),e="Aborted("+e+")",ee(e),fr=!0,dr=1,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw H(r),r}var xt="data:application/octet-stream;base64,",zr=e=>e.startsWith(xt);function Ut(){var e="wasm_bindings.wasm";return zr(e)?e:de(e)}var qe;function Br(e){if(e==qe&&Pe)return new Uint8Array(Pe);if(ie)return ie(e);throw"both async and sync fetching of the wasm failed"}function Ht(e){return Pe?Promise.resolve().then(()=>Br(e)):new Promise((r,t)=>{J(e,n=>r(new Uint8Array(n)),n=>{try{r(Br(e))}catch(o){t(o)}})})}function Vr(e,r,t){return Ht(e).then(n=>WebAssembly.instantiate(n,r)).then(t,n=>{ee(`failed to asynchronously prepare wasm: ${n}`),vr(n)})}function Lt(e,r,t,n){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!zr(r)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(o=>{var i=WebAssembly.instantiateStreaming(o,t);return i.then(n,function(s){return ee(`wasm streaming compile failed: ${s}`),ee("falling back to ArrayBuffer instantiation"),Vr(r,t,n)})}):Vr(r,t,n)}function zt(){return{a:sa}}function Bt(){var e=zt();function r(n,o){return x=n.exports,Be=x._,xr(),it=x.ca,It(x.$),Se("wasm-instantiate"),x}Ye("wasm-instantiate");function t(n){r(n.instance)}if(u.instantiateWasm)try{return u.instantiateWasm(e,r)}catch(n){ee(`Module.instantiateWasm callback failed with error: ${n}`),H(n)}return qe||(qe=Ut()),Lt(Pe,qe,e,t).catch(H),{}}var k,j;function Vt(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var pr=e=>{for(;e.length>0;)e.shift()(u)},Yt=u.noExitRuntime||!0;class qt{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){F[this.ptr+4>>2]=r}get_type(){return F[this.ptr+4>>2]}set_destructor(r){F[this.ptr+8>>2]=r}get_destructor(){return F[this.ptr+8>>2]}set_caught(r){r=r?1:0,N[this.ptr+12]=r}get_caught(){return N[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,N[this.ptr+13]=r}get_rethrown(){return N[this.ptr+13]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){F[this.ptr+16>>2]=r}get_adjusted_ptr(){return F[this.ptr+16>>2]}get_exception_ptr(){var r=wt(this.get_type());if(r)return F[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var Yr=0,Gt=0,Xt=(e,r,t)=>{var n=new qt(e);throw n.init(r,t),Yr=e,Gt++,Yr};function Ge(){var e=w[+I.varargs>>2];return I.varargs+=4,e}var _e=Ge,M={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];o==="."?e.splice(n,1):o===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=M.isAbs(e),t=e.substr(-1)==="/";return e=M.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=M.splitPath(e),t=r[0],n=r[1];return!t&&!n?".":(n&&(n=n.substr(0,n.length-1)),t+n)},basename:e=>{if(e==="/")return"/";e=M.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:(...e)=>M.normalize(e.join("/")),join2:(e,r)=>M.normalize(e+"/"+r)},Kt=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);vr("initRandomDevice")},qr=e=>(qr=Kt())(e),te={resolve:(...e)=>{for(var r="",t=!1,n=e.length-1;n>=-1&&!t;n--){var o=n>=0?e[n]:a.cwd();if(typeof o!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";r=o+"/"+r,t=M.isAbs(o)}return r=M.normalizeArray(r.split("/").filter(i=>!!i),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=te.resolve(e).substr(1),r=te.resolve(r).substr(1);function t(d){for(var v=0;v<d.length&&d[v]==="";v++);for(var g=d.length-1;g>=0&&d[g]==="";g--);return v>g?[]:d.slice(v,g-v+1)}for(var n=t(e.split("/")),o=t(r.split("/")),i=Math.min(n.length,o.length),s=i,l=0;l<i;l++)if(n[l]!==o[l]){s=l;break}for(var f=[],l=s;l<n.length;l++)f.push("..");return f=f.concat(o.slice(s)),f.join("/")}},Gr=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0,we=(e,r,t)=>{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&Gr)return Gr.decode(e.subarray(r,o));for(var i="";r<o;){var s=e[r++];if(!(s&128)){i+=String.fromCharCode(s);continue}var l=e[r++]&63;if((s&224)==192){i+=String.fromCharCode((s&31)<<6|l);continue}var f=e[r++]&63;if((s&240)==224?s=(s&15)<<12|l<<6|f:s=(s&7)<<18|l<<12|f<<6|e[r++]&63,s<65536)i+=String.fromCharCode(s);else{var d=s-65536;i+=String.fromCharCode(55296|d>>10,56320|d&1023)}}return i},hr=[],Te=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},mr=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,i=t+n-1,s=0;s<e.length;++s){var l=e.charCodeAt(s);if(l>=55296&&l<=57343){var f=e.charCodeAt(++s);l=65536+((l&1023)<<10)|f&1023}if(l<=127){if(t>=i)break;r[t++]=l}else if(l<=2047){if(t+1>=i)break;r[t++]=192|l>>6,r[t++]=128|l&63}else if(l<=65535){if(t+2>=i)break;r[t++]=224|l>>12,r[t++]=128|l>>6&63,r[t++]=128|l&63}else{if(t+3>=i)break;r[t++]=240|l>>18,r[t++]=128|l>>12&63,r[t++]=128|l>>6&63,r[t++]=128|l&63}}return r[t]=0,t-o};function Xe(e,r,t){var n=t>0?t:Te(e)+1,o=new Array(n),i=mr(e,o,0,o.length);return r&&(o.length=i),o}var Qt=()=>{if(!hr.length){var e=null;if(typeof window!="undefined"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
7
|
+
`)),!e)return null;hr=Xe(e,!0)}return hr.shift()},se={ttys:[],init(){},shutdown(){},register(e,r){se.ttys[e]={input:[],output:[],ops:r},a.registerDevice(e,se.stream_ops)},stream_ops:{open(e){var r=se.ttys[e.node.rdev];if(!r)throw new a.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new a.ErrnoError(60);for(var i=0,s=0;s<n;s++){var l;try{l=e.tty.ops.get_char(e.tty)}catch(f){throw new a.ErrnoError(29)}if(l===void 0&&i===0)throw new a.ErrnoError(6);if(l==null)break;i++,r[t+s]=l}return i&&(e.node.timestamp=Date.now()),i},write(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new a.ErrnoError(60);try{for(var i=0;i<n;i++)e.tty.ops.put_char(e.tty,r[t+i])}catch(s){throw new a.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),i}},default_tty_ops:{get_char(e){return Qt()},put_char(e,r){r===null||r===10?(Z(we(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(Z(we(e.output,0)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,r,t){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(ee(we(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(ee(we(e.output,0)),e.output=[])}}},Jt=(e,r)=>(z.fill(0,e,e+r),e),Zt=(e,r)=>Math.ceil(e/r)*r,Xr=e=>{e=Zt(e,65536);var r=_t(65536,e);return r?Jt(r,e):0},A={ops_table:null,mount(e){return A.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(a.isBlkdev(t)||a.isFIFO(t))throw new a.ErrnoError(63);A.ops_table||(A.ops_table={dir:{node:{getattr:A.node_ops.getattr,setattr:A.node_ops.setattr,lookup:A.node_ops.lookup,mknod:A.node_ops.mknod,rename:A.node_ops.rename,unlink:A.node_ops.unlink,rmdir:A.node_ops.rmdir,readdir:A.node_ops.readdir,symlink:A.node_ops.symlink},stream:{llseek:A.stream_ops.llseek}},file:{node:{getattr:A.node_ops.getattr,setattr:A.node_ops.setattr},stream:{llseek:A.stream_ops.llseek,read:A.stream_ops.read,write:A.stream_ops.write,allocate:A.stream_ops.allocate,mmap:A.stream_ops.mmap,msync:A.stream_ops.msync}},link:{node:{getattr:A.node_ops.getattr,setattr:A.node_ops.setattr,readlink:A.node_ops.readlink},stream:{}},chrdev:{node:{getattr:A.node_ops.getattr,setattr:A.node_ops.setattr},stream:a.chrdev_stream_ops}});var o=a.createNode(e,r,t,n);return a.isDir(o.mode)?(o.node_ops=A.ops_table.dir.node,o.stream_ops=A.ops_table.dir.stream,o.contents={}):a.isFile(o.mode)?(o.node_ops=A.ops_table.file.node,o.stream_ops=A.ops_table.file.stream,o.usedBytes=0,o.contents=null):a.isLink(o.mode)?(o.node_ops=A.ops_table.link.node,o.stream_ops=A.ops_table.link.stream):a.isChrdev(o.mode)&&(o.node_ops=A.ops_table.chrdev.node,o.stream_ops=A.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var o=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(o.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=a.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,a.isDir(e.mode)?r.size=4096:a.isFile(e.mode)?r.size=e.usedBytes:a.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){r.mode!==void 0&&(e.mode=r.mode),r.timestamp!==void 0&&(e.timestamp=r.timestamp),r.size!==void 0&&A.resizeFileStorage(e,r.size)},lookup(e,r){throw a.genericErrors[44]},mknod(e,r,t,n){return A.createNode(e,r,t,n)},rename(e,r,t){if(a.isDir(e.mode)){var n;try{n=a.lookupNode(r,t)}catch(i){}if(n)for(var o in n.contents)throw new a.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp},unlink(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=a.lookupNode(e,r);for(var n in t.contents)throw new a.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){var n=A.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!a.isLink(e.mode))throw new a.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var i=e.node.contents;if(o>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-o,n);if(s>8&&i.subarray)r.set(i.subarray(o,o+s),t);else for(var l=0;l<s;l++)r[t+l]=i[o+l];return s},write(e,r,t,n,o,i){if(r.buffer===N.buffer&&(i=!1),!n)return 0;var s=e.node;if(s.timestamp=Date.now(),r.subarray&&(!s.contents||s.contents.subarray)){if(i)return s.contents=r.subarray(t,t+n),s.usedBytes=n,n;if(s.usedBytes===0&&o===0)return s.contents=r.slice(t,t+n),s.usedBytes=n,n;if(o+n<=s.usedBytes)return s.contents.set(r.subarray(t,t+n),o),n}if(A.expandFileStorage(s,o+n),s.contents.subarray&&r.subarray)s.contents.set(r.subarray(t,t+n),o);else for(var l=0;l<n;l++)s.contents[o+l]=r[t+l];return s.usedBytes=Math.max(s.usedBytes,o+n),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&a.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new a.ErrnoError(28);return n},allocate(e,r,t){A.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap(e,r,t,n,o){if(!a.isFile(e.node.mode))throw new a.ErrnoError(43);var i,s,l=e.node.contents;if(!(o&2)&&l.buffer===N.buffer)s=!1,i=l.byteOffset;else{if((t>0||t+r<l.length)&&(l.subarray?l=l.subarray(t,t+r):l=Array.prototype.slice.call(l,t,t+r)),s=!0,i=Xr(r),!i)throw new a.ErrnoError(48);N.set(l,i)}return{ptr:i,allocated:s}},msync(e,r,t,n,o){return A.stream_ops.write(e,r,0,n,t,!1),0}}},en=(e,r,t,n)=>{var o=n?"":`al ${e}`;J(e,i=>{r(new Uint8Array(i)),o&&Se(o)},i=>{if(t)t();else throw`Loading data file "${e}" failed.`}),o&&Ye(o)},Kr=(e,r,t,n,o,i)=>{a.createDataFile(e,r,t,n,o,i)},rn=u.preloadPlugins||[],tn=(e,r,t,n)=>{typeof Browser!="undefined"&&Browser.init();var o=!1;return rn.forEach(i=>{o||i.canHandle(r)&&(i.handle(e,r,t,n),o=!0)}),o},Qr=(e,r,t,n,o,i,s,l,f,d)=>{var v=r?te.resolve(M.join2(e,r)):e,g=`cp ${v}`;function p(m){function E(C){d==null||d(),l||Kr(e,r,C,n,o,f),i==null||i(),Se(g)}tn(m,v,E,()=>{s==null||s(),Se(g)})||E(m)}Ye(g),typeof t=="string"?en(t,p,s):p(t)},nn=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t=="undefined")throw new Error(`Unknown file open mode: ${e}`);return t},gr=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},a={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(e){this.name="ErrnoError",this.errno=e}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=a.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return a.isDir(this.mode)}get isDevice(){return a.isChrdev(this.mode)}},lookupPath(e,r={}){if(e=te.resolve(e),!e)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(r=Object.assign(t,r),r.recurse_count>8)throw new a.ErrnoError(32);for(var n=e.split("/").filter(g=>!!g),o=a.root,i="/",s=0;s<n.length;s++){var l=s===n.length-1;if(l&&r.parent)break;if(o=a.lookupNode(o,n[s]),i=M.join2(i,n[s]),a.isMountpoint(o)&&(!l||l&&r.follow_mount)&&(o=o.mounted.root),!l||r.follow)for(var f=0;a.isLink(o.mode);){var d=a.readlink(i);i=te.resolve(M.dirname(i),d);var v=a.lookupPath(i,{recurse_count:r.recurse_count+1});if(o=v.node,f++>40)throw new a.ErrnoError(32)}}return{path:i,node:o}},getPath(e){for(var r;;){if(a.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%a.nameTable.length},hashAddNode(e){var r=a.hashName(e.parent.id,e.name);e.name_next=a.nameTable[r],a.nameTable[r]=e},hashRemoveNode(e){var r=a.hashName(e.parent.id,e.name);if(a.nameTable[r]===e)a.nameTable[r]=e.name_next;else for(var t=a.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=a.mayLookup(e);if(t)throw new a.ErrnoError(t);for(var n=a.hashName(e.id,r),o=a.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===r)return o}return a.lookup(e,r)},createNode(e,r,t,n){var o=new a.FSNode(e,r,t,n);return a.hashAddNode(o),o},destroyNode(e){a.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return a.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!a.isDir(e.mode))return 54;var r=a.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){try{var t=a.lookupNode(e,r);return 20}catch(n){}return a.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=a.lookupNode(e,r)}catch(i){return i.errno}var o=a.nodePermissions(e,"wx");if(o)return o;if(t){if(!a.isDir(n.mode))return 54;if(a.isRoot(n)||a.getPath(n)===a.cwd())return 10}else if(a.isDir(n.mode))return 31;return 0},mayOpen(e,r){return e?a.isLink(e.mode)?32:a.isDir(e.mode)&&(a.flagsToPermissionString(r)!=="r"||r&512)?31:a.nodePermissions(e,a.flagsToPermissionString(r)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=a.MAX_OPEN_FDS;e++)if(!a.streams[e])return e;throw new a.ErrnoError(33)},getStreamChecked(e){var r=a.getStream(e);if(!r)throw new a.ErrnoError(8);return r},getStream:e=>a.streams[e],createStream(e,r=-1){return e=Object.assign(new a.FSStream,e),r==-1&&(r=a.nextfd()),e.fd=r,a.streams[r]=e,e},closeStream(e){a.streams[e]=null},dupStream(e,r=-1){var n,o;var t=a.createStream(e,r);return(o=(n=t.stream_ops)==null?void 0:n.dup)==null||o.call(n,t),t},chrdev_stream_ops:{open(e){var t,n;var r=a.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,(n=(t=e.stream_ops).open)==null||n.call(t,e)},llseek(){throw new a.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){a.devices[e]={stream_ops:r}},getDevice:e=>a.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),a.syncFSRequests++,a.syncFSRequests>1&&ee(`warning: ${a.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=a.getMounts(a.root.mount),n=0;function o(s){return a.syncFSRequests--,r(s)}function i(s){if(s)return i.errored?void 0:(i.errored=!0,o(s));++n>=t.length&&o(null)}t.forEach(s=>{if(!s.type.syncfs)return i(null);s.type.syncfs(s,e,i)})},mount(e,r,t){var n=t==="/",o=!t,i;if(n&&a.root)throw new a.ErrnoError(10);if(!n&&!o){var s=a.lookupPath(t,{follow_mount:!1});if(t=s.path,i=s.node,a.isMountpoint(i))throw new a.ErrnoError(10);if(!a.isDir(i.mode))throw new a.ErrnoError(54)}var l={type:e,opts:r,mountpoint:t,mounts:[]},f=e.mount(l);return f.mount=l,l.root=f,n?a.root=f:i&&(i.mounted=l,i.mount&&i.mount.mounts.push(l)),f},unmount(e){var r=a.lookupPath(e,{follow_mount:!1});if(!a.isMountpoint(r.node))throw new a.ErrnoError(28);var t=r.node,n=t.mounted,o=a.getMounts(n);Object.keys(a.nameTable).forEach(s=>{for(var l=a.nameTable[s];l;){var f=l.name_next;o.includes(l.mount)&&a.destroyNode(l),l=f}}),t.mounted=null;var i=t.mount.mounts.indexOf(n);t.mount.mounts.splice(i,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var n=a.lookupPath(e,{parent:!0}),o=n.node,i=M.basename(e);if(!i||i==="."||i==="..")throw new a.ErrnoError(28);var s=a.mayCreate(o,i);if(s)throw new a.ErrnoError(s);if(!o.node_ops.mknod)throw new a.ErrnoError(63);return o.node_ops.mknod(o,i,r,t)},create(e,r){return r=r!==void 0?r:438,r&=4095,r|=32768,a.mknod(e,r,0)},mkdir(e,r){return r=r!==void 0?r:511,r&=1023,r|=16384,a.mknod(e,r,0)},mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{a.mkdir(n,r)}catch(i){if(i.errno!=20)throw i}}},mkdev(e,r,t){return typeof t=="undefined"&&(t=r,r=438),r|=8192,a.mknod(e,r,t)},symlink(e,r){if(!te.resolve(e))throw new a.ErrnoError(44);var t=a.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new a.ErrnoError(44);var o=M.basename(r),i=a.mayCreate(n,o);if(i)throw new a.ErrnoError(i);if(!n.node_ops.symlink)throw new a.ErrnoError(63);return n.node_ops.symlink(n,o,e)},rename(e,r){var t=M.dirname(e),n=M.dirname(r),o=M.basename(e),i=M.basename(r),s,l,f;if(s=a.lookupPath(e,{parent:!0}),l=s.node,s=a.lookupPath(r,{parent:!0}),f=s.node,!l||!f)throw new a.ErrnoError(44);if(l.mount!==f.mount)throw new a.ErrnoError(75);var d=a.lookupNode(l,o),v=te.relative(e,n);if(v.charAt(0)!==".")throw new a.ErrnoError(28);if(v=te.relative(r,t),v.charAt(0)!==".")throw new a.ErrnoError(55);var g;try{g=a.lookupNode(f,i)}catch(E){}if(d!==g){var p=a.isDir(d.mode),m=a.mayDelete(l,o,p);if(m)throw new a.ErrnoError(m);if(m=g?a.mayDelete(f,i,p):a.mayCreate(f,i),m)throw new a.ErrnoError(m);if(!l.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(d)||g&&a.isMountpoint(g))throw new a.ErrnoError(10);if(f!==l&&(m=a.nodePermissions(l,"w"),m))throw new a.ErrnoError(m);a.hashRemoveNode(d);try{l.node_ops.rename(d,f,i),d.parent=f}catch(E){throw E}finally{a.hashAddNode(d)}}},rmdir(e){var r=a.lookupPath(e,{parent:!0}),t=r.node,n=M.basename(e),o=a.lookupNode(t,n),i=a.mayDelete(t,n,!0);if(i)throw new a.ErrnoError(i);if(!t.node_ops.rmdir)throw new a.ErrnoError(63);if(a.isMountpoint(o))throw new a.ErrnoError(10);t.node_ops.rmdir(t,n),a.destroyNode(o)},readdir(e){var r=a.lookupPath(e,{follow:!0}),t=r.node;if(!t.node_ops.readdir)throw new a.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var r=a.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new a.ErrnoError(44);var n=M.basename(e),o=a.lookupNode(t,n),i=a.mayDelete(t,n,!1);if(i)throw new a.ErrnoError(i);if(!t.node_ops.unlink)throw new a.ErrnoError(63);if(a.isMountpoint(o))throw new a.ErrnoError(10);t.node_ops.unlink(t,n),a.destroyNode(o)},readlink(e){var r=a.lookupPath(e),t=r.node;if(!t)throw new a.ErrnoError(44);if(!t.node_ops.readlink)throw new a.ErrnoError(28);return te.resolve(a.getPath(t.parent),t.node_ops.readlink(t))},stat(e,r){var t=a.lookupPath(e,{follow:!r}),n=t.node;if(!n)throw new a.ErrnoError(44);if(!n.node_ops.getattr)throw new a.ErrnoError(63);return n.node_ops.getattr(n)},lstat(e){return a.stat(e,!0)},chmod(e,r,t){var n;if(typeof e=="string"){var o=a.lookupPath(e,{follow:!t});n=o.node}else n=e;if(!n.node_ops.setattr)throw new a.ErrnoError(63);n.node_ops.setattr(n,{mode:r&4095|n.mode&-4096,timestamp:Date.now()})},lchmod(e,r){a.chmod(e,r,!0)},fchmod(e,r){var t=a.getStreamChecked(e);a.chmod(t.node,r)},chown(e,r,t,n){var o;if(typeof e=="string"){var i=a.lookupPath(e,{follow:!n});o=i.node}else o=e;if(!o.node_ops.setattr)throw new a.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){a.chown(e,r,t,!0)},fchown(e,r,t){var n=a.getStreamChecked(e);a.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new a.ErrnoError(28);var t;if(typeof e=="string"){var n=a.lookupPath(e,{follow:!0});t=n.node}else t=e;if(!t.node_ops.setattr)throw new a.ErrnoError(63);if(a.isDir(t.mode))throw new a.ErrnoError(31);if(!a.isFile(t.mode))throw new a.ErrnoError(28);var o=a.nodePermissions(t,"w");if(o)throw new a.ErrnoError(o);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=a.getStreamChecked(e);if(!(t.flags&2097155))throw new a.ErrnoError(28);a.truncate(t.node,r)},utime(e,r,t){var n=a.lookupPath(e,{follow:!0}),o=n.node;o.node_ops.setattr(o,{timestamp:Math.max(r,t)})},open(e,r,t){if(e==="")throw new a.ErrnoError(44);r=typeof r=="string"?nn(r):r,r&64?(t=typeof t=="undefined"?438:t,t=t&4095|32768):t=0;var n;if(typeof e=="object")n=e;else{e=M.normalize(e);try{var o=a.lookupPath(e,{follow:!(r&131072)});n=o.node}catch(f){}}var i=!1;if(r&64)if(n){if(r&128)throw new a.ErrnoError(20)}else n=a.mknod(e,t,0),i=!0;if(!n)throw new a.ErrnoError(44);if(a.isChrdev(n.mode)&&(r&=-513),r&65536&&!a.isDir(n.mode))throw new a.ErrnoError(54);if(!i){var s=a.mayOpen(n,r);if(s)throw new a.ErrnoError(s)}r&512&&!i&&a.truncate(n,0),r&=-131713;var l=a.createStream({node:n,path:a.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return l.stream_ops.open&&l.stream_ops.open(l),u.logReadFiles&&!(r&1)&&(a.readFiles||(a.readFiles={}),e in a.readFiles||(a.readFiles[e]=1)),l},close(e){if(a.isClosed(e))throw new a.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{a.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(a.isClosed(e))throw new a.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new a.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new a.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===1)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.read)throw new a.ErrnoError(28);var i=typeof o!="undefined";if(!i)o=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var s=e.stream_ops.read(e,r,t,n,o);return i||(e.position+=s),s},write(e,r,t,n,o,i){if(n<0||o<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if(!(e.flags&2097155))throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.write)throw new a.ErrnoError(28);e.seekable&&e.flags&1024&&a.llseek(e,0,2);var s=typeof o!="undefined";if(!s)o=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var l=e.stream_ops.write(e,r,t,n,o,i);return s||(e.position+=l),l},allocate(e,r,t){if(a.isClosed(e))throw new a.ErrnoError(8);if(r<0||t<=0)throw new a.ErrnoError(28);if(!(e.flags&2097155))throw new a.ErrnoError(8);if(!a.isFile(e.node.mode)&&!a.isDir(e.node.mode))throw new a.ErrnoError(43);if(!e.stream_ops.allocate)throw new a.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap(e,r,t,n,o){if(n&2&&!(o&2)&&(e.flags&2097155)!==2)throw new a.ErrnoError(2);if((e.flags&2097155)===1)throw new a.ErrnoError(2);if(!e.stream_ops.mmap)throw new a.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync(e,r,t,n,o){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new a.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=a.open(e,r.flags),o=a.stat(e),i=o.size,s=new Uint8Array(i);return a.read(n,s,0,i,0),r.encoding==="utf8"?t=we(s,0):r.encoding==="binary"&&(t=s),a.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=a.open(e,t.flags,t.mode);if(typeof r=="string"){var o=new Uint8Array(Te(r)+1),i=mr(r,o,0,o.length);a.write(n,o,0,i,void 0,t.canOwn)}else if(ArrayBuffer.isView(r))a.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");a.close(n)},cwd:()=>a.currentPath,chdir(e){var r=a.lookupPath(e,{follow:!0});if(r.node===null)throw new a.ErrnoError(44);if(!a.isDir(r.node.mode))throw new a.ErrnoError(54);var t=a.nodePermissions(r.node,"x");if(t)throw new a.ErrnoError(t);a.currentPath=r.path},createDefaultDirectories(){a.mkdir("/tmp"),a.mkdir("/home"),a.mkdir("/home/web_user")},createDefaultDevices(){a.mkdir("/dev"),a.registerDevice(a.makedev(1,3),{read:()=>0,write:(n,o,i,s,l)=>s}),a.mkdev("/dev/null",a.makedev(1,3)),se.register(a.makedev(5,0),se.default_tty_ops),se.register(a.makedev(6,0),se.default_tty1_ops),a.mkdev("/dev/tty",a.makedev(5,0)),a.mkdev("/dev/tty1",a.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(r=qr(e).byteLength),e[--r]);a.createDevice("/dev","random",t),a.createDevice("/dev","urandom",t),a.mkdir("/dev/shm"),a.mkdir("/dev/shm/tmp")},createSpecialDirectories(){a.mkdir("/proc");var e=a.mkdir("/proc/self");a.mkdir("/proc/self/fd"),a.mount({mount(){var r=a.createNode(e,"fd",16895,73);return r.node_ops={lookup(t,n){var o=+n,i=a.getStreamChecked(o),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return s.parent=s,s}},r}},{},"/proc/self/fd")},createStandardStreams(){u.stdin?a.createDevice("/dev","stdin",u.stdin):a.symlink("/dev/tty","/dev/stdin"),u.stdout?a.createDevice("/dev","stdout",null,u.stdout):a.symlink("/dev/tty","/dev/stdout"),u.stderr?a.createDevice("/dev","stderr",null,u.stderr):a.symlink("/dev/tty1","/dev/stderr");var e=a.open("/dev/stdin",0),r=a.open("/dev/stdout",1),t=a.open("/dev/stderr",1)},staticInit(){[44].forEach(e=>{a.genericErrors[e]=new a.ErrnoError(e),a.genericErrors[e].stack="<generic error, no stack>"}),a.nameTable=new Array(4096),a.mount(A,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:A}},init(e,r,t){a.init.initialized=!0,u.stdin=e||u.stdin,u.stdout=r||u.stdout,u.stderr=t||u.stderr,a.createStandardStreams()},quit(){a.init.initialized=!1;for(var e=0;e<a.streams.length;e++){var r=a.streams[e];r&&a.close(r)}},findObject(e,r){var t=a.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=a.lookupPath(e,{follow:!r});e=t.path}catch(o){}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=a.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=M.basename(e),t=a.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(o){n.error=o.errno}return n},createPath(e,r,t,n){e=typeof e=="string"?e:a.getPath(e);for(var o=r.split("/").reverse();o.length;){var i=o.pop();if(i){var s=M.join2(e,i);try{a.mkdir(s)}catch(l){}e=s}}return s},createFile(e,r,t,n,o){var i=M.join2(typeof e=="string"?e:a.getPath(e),r),s=gr(n,o);return a.create(i,s)},createDataFile(e,r,t,n,o,i){var s=r;e&&(e=typeof e=="string"?e:a.getPath(e),s=r?M.join2(e,r):e);var l=gr(n,o),f=a.create(s,l);if(t){if(typeof t=="string"){for(var d=new Array(t.length),v=0,g=t.length;v<g;++v)d[v]=t.charCodeAt(v);t=d}a.chmod(f,l|146);var p=a.open(f,577);a.write(p,t,0,t.length,0,i),a.close(p),a.chmod(f,l)}},createDevice(e,r,t,n){var o=M.join2(typeof e=="string"?e:a.getPath(e),r),i=gr(!!t,!!n);a.createDevice.major||(a.createDevice.major=64);var s=a.makedev(a.createDevice.major++,0);return a.registerDevice(s,{open(l){l.seekable=!1},close(l){var f;(f=n==null?void 0:n.buffer)!=null&&f.length&&n(10)},read(l,f,d,v,g){for(var p=0,m=0;m<v;m++){var E;try{E=t()}catch(C){throw new a.ErrnoError(29)}if(E===void 0&&p===0)throw new a.ErrnoError(6);if(E==null)break;p++,f[d+m]=E}return p&&(l.node.timestamp=Date.now()),p},write(l,f,d,v,g){for(var p=0;p<v;p++)try{n(f[d+p])}catch(m){throw new a.ErrnoError(29)}return v&&(l.node.timestamp=Date.now()),p}}),a.mkdev(o,i,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest!="undefined")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(ye)try{e.contents=Xe(ye(e.url),!0),e.usedBytes=e.contents.length}catch(r){throw new a.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(e,r,t,n,o){class i{constructor(){this.lengthKnown=!1,this.chunks=[]}get(m){if(!(m>this.length-1||m<0)){var E=m%this.chunkSize,C=m/this.chunkSize|0;return this.getter(C)[E]}}setDataGetter(m){this.getter=m}cacheLength(){var m=new XMLHttpRequest;if(m.open("HEAD",t,!1),m.send(null),!(m.status>=200&&m.status<300||m.status===304))throw new Error("Couldn't load "+t+". Status: "+m.status);var E=Number(m.getResponseHeader("Content-length")),C,D=(C=m.getResponseHeader("Accept-Ranges"))&&C==="bytes",S=(C=m.getResponseHeader("Content-Encoding"))&&C==="gzip",c=1024*1024;D||(c=E);var h=(P,O)=>{if(P>O)throw new Error("invalid range ("+P+", "+O+") or no bytes requested!");if(O>E-1)throw new Error("only "+E+" bytes available! programmer error!");var W=new XMLHttpRequest;if(W.open("GET",t,!1),E!==c&&W.setRequestHeader("Range","bytes="+P+"-"+O),W.responseType="arraybuffer",W.overrideMimeType&&W.overrideMimeType("text/plain; charset=x-user-defined"),W.send(null),!(W.status>=200&&W.status<300||W.status===304))throw new Error("Couldn't load "+t+". Status: "+W.status);return W.response!==void 0?new Uint8Array(W.response||[]):Xe(W.responseText||"",!0)},T=this;T.setDataGetter(P=>{var O=P*c,W=(P+1)*c-1;if(W=Math.min(W,E-1),typeof T.chunks[P]=="undefined"&&(T.chunks[P]=h(O,W)),typeof T.chunks[P]=="undefined")throw new Error("doXHR failed!");return T.chunks[P]}),(S||!E)&&(c=E=1,E=this.getter(0).length,c=E,Z("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=E,this._chunkSize=c,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest!="undefined"){if(!V)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new i,l={isDevice:!1,contents:s}}else var l={isDevice:!1,url:t};var f=a.createFile(e,r,l,n,o);l.contents?f.contents=l.contents:l.url&&(f.contents=null,f.url=l.url),Object.defineProperties(f,{usedBytes:{get:function(){return this.contents.length}}});var d={},v=Object.keys(f.stream_ops);v.forEach(p=>{var m=f.stream_ops[p];d[p]=(...E)=>(a.forceLoadFile(f),m(...E))});function g(p,m,E,C,D){var S=p.node.contents;if(D>=S.length)return 0;var c=Math.min(S.length-D,C);if(S.slice)for(var h=0;h<c;h++)m[E+h]=S[D+h];else for(var h=0;h<c;h++)m[E+h]=S.get(D+h);return c}return d.read=(p,m,E,C,D)=>(a.forceLoadFile(f),g(p,m,E,C,D)),d.mmap=(p,m,E,C,D)=>{a.forceLoadFile(f);var S=Xr(m);if(!S)throw new a.ErrnoError(48);return g(p,N,S,m,E),{ptr:S,allocated:!0}},f.stream_ops=d,f}},Ke=(e,r)=>e?we(z,e,r):"",I={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(M.isAbs(r))return r;var n;if(e===-100)n=a.cwd();else{var o=I.getStreamFromFD(e);n=o.path}if(r.length==0){if(!t)throw new a.ErrnoError(44);return n}return M.join2(n,r)},doStat(e,r,t){var n=e(r);w[t>>2]=n.dev,w[t+4>>2]=n.mode,F[t+8>>2]=n.nlink,w[t+12>>2]=n.uid,w[t+16>>2]=n.gid,w[t+20>>2]=n.rdev,j=[n.size>>>0,(k=n.size,+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[t+24>>2]=j[0],w[t+28>>2]=j[1],w[t+32>>2]=4096,w[t+36>>2]=n.blocks;var o=n.atime.getTime(),i=n.mtime.getTime(),s=n.ctime.getTime();return j=[Math.floor(o/1e3)>>>0,(k=Math.floor(o/1e3),+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[t+40>>2]=j[0],w[t+44>>2]=j[1],F[t+48>>2]=o%1e3*1e3,j=[Math.floor(i/1e3)>>>0,(k=Math.floor(i/1e3),+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[t+56>>2]=j[0],w[t+60>>2]=j[1],F[t+64>>2]=i%1e3*1e3,j=[Math.floor(s/1e3)>>>0,(k=Math.floor(s/1e3),+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[t+72>>2]=j[0],w[t+76>>2]=j[1],F[t+80>>2]=s%1e3*1e3,j=[n.ino>>>0,(k=n.ino,+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[t+88>>2]=j[0],w[t+92>>2]=j[1],0},doMsync(e,r,t,n,o){if(!a.isFile(r.node.mode))throw new a.ErrnoError(43);if(n&2)return 0;var i=z.slice(e,e+t);a.msync(r,i,o,t,n)},getStreamFromFD(e){var r=a.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=Ke(e);return r}};function on(e,r,t){I.varargs=t;try{var n=I.getStreamFromFD(e);switch(r){case 0:{var o=Ge();if(o<0)return-28;for(;a.streams[o];)o++;var i;return i=a.dupStream(n,o),i.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var o=Ge();return n.flags|=o,0}case 12:{var o=_e(),s=0;return re[o+s>>1]=2,0}case 13:case 14:return 0}return-28}catch(l){if(typeof a=="undefined"||l.name!=="ErrnoError")throw l;return-l.errno}}var ve=(e,r,t)=>mr(e,z,r,t);function an(e,r){try{if(r===0)return-28;var t=a.cwd(),n=Te(t)+1;return r<n?-68:(ve(t,e,r),n)}catch(o){if(typeof a=="undefined"||o.name!=="ErrnoError")throw o;return-o.errno}}function sn(e,r,t){I.varargs=t;try{var n=I.getStreamFromFD(e);switch(r){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),i=_e();w[i>>2]=o.c_iflag||0,w[i+4>>2]=o.c_oflag||0,w[i+8>>2]=o.c_cflag||0,w[i+12>>2]=o.c_lflag||0;for(var s=0;s<32;s++)N[i+s+17]=o.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var i=_e(),l=w[i>>2],f=w[i+4>>2],d=w[i+8>>2],v=w[i+12>>2],g=[],s=0;s<32;s++)g.push(N[i+s+17]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:l,c_oflag:f,c_cflag:d,c_lflag:v,c_cc:g})}return 0}case 21519:{if(!n.tty)return-59;var i=_e();return w[i>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var i=_e();return a.ioctl(n,r,i)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var p=n.tty.ops.ioctl_tiocgwinsz(n.tty),i=_e();re[i>>1]=p[0],re[i+2>>1]=p[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(m){if(typeof a=="undefined"||m.name!=="ErrnoError")throw m;return-m.errno}}function ln(e,r,t){try{return r=I.getStr(r),r=I.calculateAt(e,r),r=M.normalize(r),r[r.length-1]==="/"&&(r=r.substr(0,r.length-1)),a.mkdir(r,t,0),0}catch(n){if(typeof a=="undefined"||n.name!=="ErrnoError")throw n;return-n.errno}}function un(e,r,t,n){I.varargs=n;try{r=I.getStr(r),r=I.calculateAt(e,r);var o=n?Ge():0;return a.open(r,t,o).fd}catch(i){if(typeof a=="undefined"||i.name!=="ErrnoError")throw i;return-i.errno}}function fn(e,r,t,n){try{if(r=I.getStr(r),r=I.calculateAt(e,r),n<=0)return-28;var o=a.readlink(r),i=Math.min(n,Te(o)),s=N[t+i];return ve(o,t,n+1),N[t+i]=s,i}catch(l){if(typeof a=="undefined"||l.name!=="ErrnoError")throw l;return-l.errno}}function dn(e,r){try{return e=I.getStr(e),I.doStat(a.stat,e,r)}catch(t){if(typeof a=="undefined"||t.name!=="ErrnoError")throw t;return-t.errno}}var cn=()=>{vr("")},vn=(e,r,t,n,o)=>{},pn=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);Jr=e},Jr,Y=e=>{for(var r="",t=e;z[t];)r+=Jr[z[t++]];return r},Ee={},pe={},Qe={},ke,R=e=>{throw new ke(e)},Zr,Je=e=>{throw new Zr(e)},X=(e,r,t)=>{e.forEach(function(l){Qe[l]=r});function n(l){var f=t(l);f.length!==e.length&&Je("Mismatched type converter count");for(var d=0;d<e.length;++d)ne(e[d],f[d])}var o=new Array(r.length),i=[],s=0;r.forEach((l,f)=>{pe.hasOwnProperty(l)?o[f]=pe[l]:(i.push(l),Ee.hasOwnProperty(l)||(Ee[l]=[]),Ee[l].push(()=>{o[f]=pe[l],++s,s===i.length&&n(o)}))}),i.length===0&&n(o)};function hn(e,r,t={}){var n=r.name;if(e||R(`type "${n}" must have a positive integer typeid pointer`),pe.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;R(`Cannot register type '${n}' twice`)}if(pe[e]=r,delete Qe[e],Ee.hasOwnProperty(e)){var o=Ee[e];delete Ee[e],o.forEach(i=>i())}}function ne(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return hn(e,r,t)}var le=8,mn=(e,r,t,n)=>{r=Y(r),ne(e,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,i){return i?t:n},argPackAdvance:le,readValueFromPointer:function(o){return this.fromWireType(z[o])},destructorFunction:null})},gn=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),yr=e=>{function r(t){return t.$$.ptrType.registeredClass.name}R(r(e)+" instance already deleted")},_r=!1,et=e=>{},yn=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1;var r=e.count.value===0;r&&yn(e)},tt=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=tt(e,r,t.baseClass);return n===null?null:t.downcast(n)},nt={},_n=()=>Object.keys(Re).length,wn=()=>{var e=[];for(var r in Re)Re.hasOwnProperty(r)&&e.push(Re[r]);return e},De=[],wr=()=>{for(;De.length;){var e=De.pop();e.$$.deleteScheduled=!1,e.delete()}},Fe,En=e=>{Fe=e,De.length&&Fe&&Fe(wr)},kn=()=>{u.getInheritedInstanceCount=_n,u.getLiveInheritedInstances=wn,u.flushPendingDeletes=wr,u.setDelayFunction=En},Re={},bn=(e,r)=>{for(r===void 0&&R("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},An=(e,r)=>(r=bn(e,r),Re[r]),Ze=(e,r)=>{(!r.ptrType||!r.ptr)&&Je("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Je("Both smartPtrType and smartPtr must be specified"),r.count={value:1},$e(Object.create(e,{$$:{value:r,writable:!0}}))};function Pn(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=An(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?Ze(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):Ze(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i=this.registeredClass.getActualType(r),s=nt[i];if(!s)return o.call(this);var l;this.isConst?l=s.constPointerType:l=s.pointerType;var f=tt(r,this.registeredClass,l.registeredClass);return f===null?o.call(this):this.isSmartPointer?Ze(l.registeredClass.instancePrototype,{ptrType:l,ptr:f,smartPtrType:this,smartPtr:e}):Ze(l.registeredClass.instancePrototype,{ptrType:l,ptr:f})}var $e=e=>typeof FinalizationRegistry=="undefined"?($e=r=>r,e):(_r=new FinalizationRegistry(r=>{rt(r.$$)}),$e=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var o={$$:t};_r.register(r,o,r)}return r},et=r=>_r.unregister(r),$e(e)),Cn=()=>{Object.assign(er.prototype,{isAliasOf(e){if(!(this instanceof er)||!(e instanceof er))return!1;var r=this.$$.ptrType.registeredClass,t=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,o=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return r===n&&t===o},clone(){if(this.$$.ptr||yr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=$e(Object.create(Object.getPrototypeOf(this),{$$:{value:gn(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||yr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&R("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||yr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&R("Object already scheduled for deletion"),De.push(this),De.length===1&&Fe&&Fe(wr),this.$$.deleteScheduled=!0,this}})};function er(){}var rr=(e,r)=>Object.defineProperty(r,"name",{value:e}),Er=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...o){return e[r].overloadTable.hasOwnProperty(o.length)||R(`Function '${t}' called with an invalid number of arguments (${o.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[o.length].apply(this,o)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},ot=(e,r,t)=>{u.hasOwnProperty(e)?((t===void 0||u[e].overloadTable!==void 0&&u[e].overloadTable[t]!==void 0)&&R(`Cannot register public name '${e}' twice`),Er(u,e,e),u.hasOwnProperty(t)&&R(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),u[e].overloadTable[t]=r):(u[e]=r,t!==void 0&&(u[e].numArguments=t))},Sn=48,Tn=57,Dn=e=>{if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Sn&&r<=Tn?`_${e}`:e};function Fn(e,r,t,n,o,i,s,l){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=s,this.downcast=l,this.pureVirtualFunctions=[]}var tr=(e,r,t)=>{for(;r!==t;)r.upcast||R(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function Rn(e,r){if(r===null)return this.isReference&&R(`null is not a valid ${this.name}`),0;r.$$||R(`Cannot pass "${Cr(r)}" as a ${this.name}`),r.$$.ptr||R(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=tr(r.$$.ptr,t,this.registeredClass);return n}function $n(e,r){var t;if(r===null)return this.isReference&&R(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&R(`Cannot pass "${Cr(r)}" as a ${this.name}`),r.$$.ptr||R(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&R(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=tr(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&R("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:R(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var o=r.clone();t=this.rawShare(t,me.toHandle(()=>o.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:R("Unsupporting sharing policy")}return t}function Mn(e,r){if(r===null)return this.isReference&&R(`null is not a valid ${this.name}`),0;r.$$||R(`Cannot pass "${Cr(r)}" as a ${this.name}`),r.$$.ptr||R(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&R(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=tr(r.$$.ptr,t,this.registeredClass);return n}function nr(e){return this.fromWireType(F[e>>2])}var On=()=>{Object.assign(Me.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},argPackAdvance:le,readValueFromPointer:nr,fromWireType:Pn})};function Me(e,r,t,n,o,i,s,l,f,d,v){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=s,this.rawGetPointee=l,this.rawConstructor=f,this.rawShare=d,this.rawDestructor=v,!o&&r.baseClass===void 0?n?(this.toWireType=Rn,this.destructorFunction=null):(this.toWireType=Mn,this.destructorFunction=null):this.toWireType=$n}var at=(e,r,t)=>{u.hasOwnProperty(e)||Je("Replacing nonexistent public symbol"),u[e].overloadTable!==void 0&&t!==void 0?u[e].overloadTable[t]=r:(u[e]=r,u[e].argCount=t)},Wn=(e,r,t)=>{e=e.replace(/p/g,"i");var n=u["dynCall_"+e];return n(r,...t)},or=[],it,st=e=>{var r=or[e];return r||(e>=or.length&&(or.length=e+1),or[e]=r=it.get(e)),r},jn=(e,r,t=[])=>{if(e.includes("j"))return Wn(e,r,t);var n=st(r)(...t);return n},In=(e,r)=>(...t)=>jn(e,r,t),q=(e,r)=>{e=Y(e);function t(){return e.includes("j")?In(e,r):st(r)}var n=t();return typeof n!="function"&&R(`unknown function pointer with signature ${e}: ${r}`),n},Nn=(e,r)=>{var t=rr(r,function(n){this.name=r,this.message=n;var o=new Error(n).stack;o!==void 0&&(this.stack=this.toString()+`
|
|
8
|
+
`+o.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t},lt,ut=e=>{var r=yt(e),t=Y(r);return ae(r),t},he=(e,r)=>{var t=[],n={};function o(i){if(!n[i]&&!pe[i]){if(Qe[i]){Qe[i].forEach(o);return}t.push(i),n[i]=!0}}throw r.forEach(o),new lt(`${e}: `+t.map(ut).join([", "]))},xn=(e,r,t,n,o,i,s,l,f,d,v,g,p)=>{v=Y(v),i=q(o,i),l&&(l=q(s,l)),d&&(d=q(f,d)),p=q(g,p);var m=Dn(v);ot(m,function(){he(`Cannot construct ${v} due to unbound types`,[n])}),X([e,r,t],n?[n]:[],E=>{var W,Ie;E=E[0];var C,D;n?(C=E.registeredClass,D=C.instancePrototype):D=er.prototype;var S=rr(v,function(...Ne){if(Object.getPrototypeOf(this)!==c)throw new ke("Use 'new' to construct "+v);if(h.constructor_body===void 0)throw new ke(v+" has no accessible constructor");var xe=h.constructor_body[Ne.length];if(xe===void 0)throw new ke(`Tried to invoke ctor of ${v} with invalid number of parameters (${Ne.length}) - expected (${Object.keys(h.constructor_body).toString()}) parameters instead!`);return xe.apply(this,Ne)}),c=Object.create(D,{constructor:{value:S}});S.prototype=c;var h=new Fn(v,S,c,p,C,i,l,d);h.baseClass&&((Ie=(W=h.baseClass).__derivedClasses)!=null||(W.__derivedClasses=[]),h.baseClass.__derivedClasses.push(h));var T=new Me(v,h,!0,!1,!1),P=new Me(v+"*",h,!1,!1,!1),O=new Me(v+" const*",h,!1,!0,!1);return nt[e]={pointerType:P,constPointerType:O},at(m,S),[T,P,O]})},kr=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function Un(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function ar(e,r,t,n,o,i){var s=r.length;s<2&&R("argTypes array size mismatch! Must at least get return value and 'this' types!");var l=r[1]!==null&&t!==null,f=Un(r),d=r[0].name!=="void",v=s-2,g=new Array(v),p=[],m=[],E=function(...C){C.length!==v&&R(`function ${e} called with ${C.length} arguments, expected ${v}`),m.length=0;var D;p.length=l?2:1,p[0]=o,l&&(D=r[1].toWireType(m,this),p[1]=D);for(var S=0;S<v;++S)g[S]=r[S+2].toWireType(m,C[S]),p.push(g[S]);var c=n(...p);function h(T){if(f)kr(m);else for(var P=l?1:2;P<r.length;P++){var O=P===1?D:g[P-2];r[P].destructorFunction!==null&&r[P].destructorFunction(O)}if(d)return r[0].fromWireType(T)}return h(c)};return rr(e,E)}var ir=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(F[r+n*4>>2]);return t},br=e=>{e=e.trim();let r=e.indexOf("(");return r!==-1?e.substr(0,r):e},Hn=(e,r,t,n,o,i,s,l)=>{var f=ir(t,n);r=Y(r),r=br(r),i=q(o,i),X([],[e],d=>{d=d[0];var v=`${d.name}.${r}`;function g(){he(`Cannot call ${v} due to unbound types`,f)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]);var p=d.registeredClass.constructor;return p[r]===void 0?(g.argCount=t-1,p[r]=g):(Er(p,r,v),p[r].overloadTable[t-1]=g),X([],f,m=>{var E=[m[0],null].concat(m.slice(1)),C=ar(v,E,null,i,s,l);if(p[r].overloadTable===void 0?(C.argCount=t-1,p[r]=C):p[r].overloadTable[t-1]=C,d.registeredClass.__derivedClasses)for(let D of d.registeredClass.__derivedClasses)D.constructor.hasOwnProperty(r)||(D.constructor[r]=C);return[]}),[]})},Ln=(e,r,t,n,o,i)=>{var s=ir(r,t);o=q(n,o),X([],[e],l=>{l=l[0];var f=`constructor ${l.name}`;if(l.registeredClass.constructor_body===void 0&&(l.registeredClass.constructor_body=[]),l.registeredClass.constructor_body[r-1]!==void 0)throw new ke(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${l.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return l.registeredClass.constructor_body[r-1]=()=>{he(`Cannot construct ${l.name} due to unbound types`,s)},X([],s,d=>(d.splice(1,0,null),l.registeredClass.constructor_body[r-1]=ar(f,d,null,o,i),[])),[]})},zn=(e,r,t,n,o,i,s,l,f)=>{var d=ir(t,n);r=Y(r),r=br(r),i=q(o,i),X([],[e],v=>{v=v[0];var g=`${v.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),l&&v.registeredClass.pureVirtualFunctions.push(r);function p(){he(`Cannot call ${g} due to unbound types`,d)}var m=v.registeredClass.instancePrototype,E=m[r];return E===void 0||E.overloadTable===void 0&&E.className!==v.name&&E.argCount===t-2?(p.argCount=t-2,p.className=v.name,m[r]=p):(Er(m,r,g),m[r].overloadTable[t-2]=p),X([],d,C=>{var D=ar(g,C,v,i,s,f);return m[r].overloadTable===void 0?(D.argCount=t-2,m[r]=D):m[r].overloadTable[t-2]=D,[]}),[]})},ft=(e,r,t)=>(e instanceof Object||R(`${t} with invalid "this": ${e}`),e instanceof r.registeredClass.constructor||R(`${t} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||R(`cannot call emscripten binding method ${t} on deleted object`),tr(e.$$.ptr,e.$$.ptrType.registeredClass,r.registeredClass)),Bn=(e,r,t,n,o,i,s,l,f,d)=>{r=Y(r),o=q(n,o),X([],[e],v=>{v=v[0];var g=`${v.name}.${r}`,p={get(){he(`Cannot access ${g} due to unbound types`,[t,s])},enumerable:!0,configurable:!0};return f?p.set=()=>he(`Cannot access ${g} due to unbound types`,[t,s]):p.set=m=>R(g+" is a read-only property"),Object.defineProperty(v.registeredClass.instancePrototype,r,p),X([],f?[t,s]:[t],m=>{var E=m[0],C={get(){var S=ft(this,v,g+" getter");return E.fromWireType(o(i,S))},enumerable:!0};if(f){f=q(l,f);var D=m[1];C.set=function(S){var c=ft(this,v,g+" setter"),h=[];f(d,c,D.toWireType(h,S)),kr(h)}}return Object.defineProperty(v.registeredClass.instancePrototype,r,C),[]}),[]})},Ar=[],oe=[],Pr=e=>{e>9&&--oe[e+1]===0&&(oe[e]=void 0,Ar.push(e))},Vn=()=>oe.length/2-5-Ar.length,Yn=()=>{oe.push(0,1,void 0,1,null,1,!0,1,!1,1),u.count_emval_handles=Vn},me={toValue:e=>(e||R("Cannot use deleted val. handle = "+e),oe[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=Ar.pop()||oe.length;return oe[r]=e,oe[r+1]=1,r}}}},qn={name:"emscripten::val",fromWireType:e=>{var r=me.toValue(e);return Pr(e),r},toWireType:(e,r)=>me.toHandle(r),argPackAdvance:le,readValueFromPointer:nr,destructorFunction:null},dt=e=>ne(e,qn),Cr=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Gn=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(Ir[t>>2])};case 8:return function(t){return this.fromWireType(Nr[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},Xn=(e,r,t)=>{r=Y(r),ne(e,{name:r,fromWireType:n=>n,toWireType:(n,o)=>o,argPackAdvance:le,readValueFromPointer:Gn(r,t),destructorFunction:null})},Kn=(e,r,t,n,o,i,s)=>{var l=ir(r,t);e=Y(e),e=br(e),o=q(n,o),ot(e,function(){he(`Cannot call ${e} due to unbound types`,l)},r-1),X([],l,f=>{var d=[f[0],null].concat(f.slice(1));return at(e,ar(e,d,null,o,i,s),r-1),[]})},Qn=(e,r,t)=>{switch(r){case 1:return t?n=>N[n]:n=>z[n];case 2:return t?n=>re[n>>1]:n=>Ve[n>>1];case 4:return t?n=>w[n>>2]:n=>F[n>>2];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},Jn=(e,r,t,n,o)=>{r=Y(r),o===-1&&(o=4294967295);var i=v=>v;if(n===0){var s=32-8*t;i=v=>v<<s>>>s}var l=r.includes("unsigned"),f=(v,g)=>{},d;l?d=function(v,g){return f(g,this.name),g>>>0}:d=function(v,g){return f(g,this.name),g},ne(e,{name:r,fromWireType:i,toWireType:d,argPackAdvance:le,readValueFromPointer:Qn(r,t,n!==0),destructorFunction:null})},Zn=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],o=n[r];function i(s){var l=F[s>>2],f=F[s+4>>2];return new o(N.buffer,f,l)}t=Y(t),ne(e,{name:t,fromWireType:i,argPackAdvance:le,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},eo=(e,r)=>{dt(e)},ro=(e,r,t,n,o,i,s,l,f,d,v,g)=>{t=Y(t),i=q(o,i),l=q(s,l),d=q(f,d),g=q(v,g),X([e],[r],p=>{p=p[0];var m=new Me(t,p.registeredClass,!1,!1,!0,p,n,i,l,d,g);return[m]})},to=(e,r)=>{r=Y(r);var t=r==="std::string";ne(e,{name:r,fromWireType(n){var o=F[n>>2],i=n+4,s;if(t)for(var l=i,f=0;f<=o;++f){var d=i+f;if(f==o||z[d]==0){var v=d-l,g=Ke(l,v);s===void 0?s=g:(s+=String.fromCharCode(0),s+=g),l=d+1}}else{for(var p=new Array(o),f=0;f<o;++f)p[f]=String.fromCharCode(z[i+f]);s=p.join("")}return ae(n),s},toWireType(n,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var i,s=typeof o=="string";s||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Int8Array||R("Cannot pass non-string to std::string"),t&&s?i=Te(o):i=o.length;var l=Dr(4+i+1),f=l+4;if(F[l>>2]=i,t&&s)ve(o,f,i+1);else if(s)for(var d=0;d<i;++d){var v=o.charCodeAt(d);v>255&&(ae(f),R("String has UTF-16 code units that do not fit in 8 bits")),z[f+d]=v}else for(var d=0;d<i;++d)z[f+d]=o[d];return n!==null&&n.push(ae,l),l},argPackAdvance:le,readValueFromPointer:nr,destructorFunction(n){ae(n)}})},ct=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0,no=(e,r)=>{for(var t=e,n=t>>1,o=n+r/2;!(n>=o)&&Ve[n];)++n;if(t=n<<1,t-e>32&&ct)return ct.decode(z.subarray(e,t));for(var i="",s=0;!(s>=r/2);++s){var l=re[e+s*2>>1];if(l==0)break;i+=String.fromCharCode(l)}return i},oo=(e,r,t)=>{if(t!=null||(t=2147483647),t<2)return 0;t-=2;for(var n=r,o=t<e.length*2?t/2:e.length,i=0;i<o;++i){var s=e.charCodeAt(i);re[r>>1]=s,r+=2}return re[r>>1]=0,r-n},ao=e=>e.length*2,io=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var o=w[e+t*4>>2];if(o==0)break;if(++t,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|i&1023)}else n+=String.fromCharCode(o)}return n},so=(e,r,t)=>{if(t!=null||(t=2147483647),t<4)return 0;for(var n=r,o=n+t-4,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343){var l=e.charCodeAt(++i);s=65536+((s&1023)<<10)|l&1023}if(w[r>>2]=s,r+=4,r+4>o)break}return w[r>>2]=0,r-n},lo=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&++t,r+=4}return r},uo=(e,r,t)=>{t=Y(t);var n,o,i,s;r===2?(n=no,o=oo,s=ao,i=l=>Ve[l>>1]):r===4&&(n=io,o=so,s=lo,i=l=>F[l>>2]),ne(e,{name:t,fromWireType:l=>{for(var f=F[l>>2],d,v=l+4,g=0;g<=f;++g){var p=l+4+g*r;if(g==f||i(p)==0){var m=p-v,E=n(v,m);d===void 0?d=E:(d+=String.fromCharCode(0),d+=E),v=p+r}}return ae(l),d},toWireType:(l,f)=>{typeof f!="string"&&R(`Cannot pass non-string to C++ string type ${t}`);var d=s(f),v=Dr(4+d+r);return F[v>>2]=d/r,o(f,v+4,d+r),l!==null&&l.push(ae,v),v},argPackAdvance:le,readValueFromPointer:nr,destructorFunction(l){ae(l)}})},fo=(e,r)=>{r=Y(r),ne(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}})},co=1,vo=()=>co,po=(e,r,t)=>z.copyWithin(e,r,r+t),Sr=[],ho=(e,r,t,n)=>(e=Sr[e],r=me.toValue(r),e(null,r,t,n)),mo=e=>{var r=Sr.length;return Sr.push(e),r},vt=(e,r)=>{var t=pe[e];return t===void 0&&R(`${r} has unknown type ${ut(e)}`),t},go=(e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=vt(F[r+n*4>>2],"parameter "+n);return t},yo=Reflect.construct,_o=(e,r,t)=>{var n=[],o=e.toWireType(n,t);return n.length&&(F[r>>2]=me.toHandle(n)),o},wo=(e,r,t)=>{var n=go(e,r),o=n.shift();e--;var i=new Array(e),s=(f,d,v,g)=>{for(var p=0,m=0;m<e;++m)i[m]=n[m].readValueFromPointer(g+p),p+=n[m].argPackAdvance;var E=t===1?yo(d,i):d.apply(f,i);return _o(o,v,E)},l=`methodCaller<(${n.map(f=>f.name).join(", ")}) => ${o.name}>`;return mo(rr(l,s))},Eo=e=>{e>9&&(oe[e+1]+=1)},ko=e=>{var r=me.toValue(e);kr(r),Pr(e)},bo=(e,r)=>{e=vt(e,"_emval_take_value");var t=e.readValueFromPointer(r);return me.toHandle(t)},Oe=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN;function Ao(e,r,t){var n=Oe(e,r),o=new Date(n*1e3);w[t>>2]=o.getUTCSeconds(),w[t+4>>2]=o.getUTCMinutes(),w[t+8>>2]=o.getUTCHours(),w[t+12>>2]=o.getUTCDate(),w[t+16>>2]=o.getUTCMonth(),w[t+20>>2]=o.getUTCFullYear()-1900,w[t+24>>2]=o.getUTCDay();var i=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),s=(o.getTime()-i)/(1e3*60*60*24)|0;w[t+28>>2]=s}var We=e=>e%4===0&&(e%100!==0||e%400===0),Po=[0,31,60,91,121,152,182,213,244,274,305,335],Co=[0,31,59,90,120,151,181,212,243,273,304,334],So=e=>{var r=We(e.getFullYear()),t=r?Po:Co,n=t[e.getMonth()]+e.getDate()-1;return n};function To(e,r,t){var n=Oe(e,r),o=new Date(n*1e3);w[t>>2]=o.getSeconds(),w[t+4>>2]=o.getMinutes(),w[t+8>>2]=o.getHours(),w[t+12>>2]=o.getDate(),w[t+16>>2]=o.getMonth(),w[t+20>>2]=o.getFullYear()-1900,w[t+24>>2]=o.getDay();var i=So(o)|0;w[t+28>>2]=i,w[t+36>>2]=-(o.getTimezoneOffset()*60);var s=new Date(o.getFullYear(),0,1),l=new Date(o.getFullYear(),6,1).getTimezoneOffset(),f=s.getTimezoneOffset(),d=(l!=f&&o.getTimezoneOffset()==Math.min(f,l))|0;w[t+32>>2]=d}function Do(e,r,t,n,o,i,s,l){var f=Oe(o,i);try{if(isNaN(f))return 61;var d=I.getStreamFromFD(n),v=a.mmap(d,e,f,r,t),g=v.ptr;return w[s>>2]=v.allocated,F[l>>2]=g,0}catch(p){if(typeof a=="undefined"||p.name!=="ErrnoError")throw p;return-p.errno}}function Fo(e,r,t,n,o,i,s){var l=Oe(i,s);try{var f=I.getStreamFromFD(o);t&2&&I.doMsync(e,f,r,n,l)}catch(d){if(typeof a=="undefined"||d.name!=="ErrnoError")throw d;return-d.errno}}var Ro=(e,r,t,n)=>{var o=new Date().getFullYear(),i=new Date(o,0,1),s=new Date(o,6,1),l=i.getTimezoneOffset(),f=s.getTimezoneOffset(),d=Math.max(l,f);F[e>>2]=d*60,w[r>>2]=+(l!=f);var v=m=>m.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1],g=v(i),p=v(s);f<l?(ve(g,t,17),ve(p,n,17)):(ve(g,n,17),ve(p,t,17))},$o=()=>Date.now(),pt=()=>2147483648,Mo=()=>pt(),ht;ht=()=>performance.now();var Oo=e=>{var r=Be.buffer,t=(e-r.byteLength+65535)/65536;try{return Be.grow(t),xr(),1}catch(n){}},Wo=e=>{var r=z.length;e>>>=0;var t=pt();if(e>t)return!1;for(var n=(f,d)=>f+(d-f%d)%d,o=1;o<=4;o*=2){var i=r*(1+.2/o);i=Math.min(i,e+100663296);var s=Math.min(t,n(Math.max(e,i),65536)),l=Oo(s);if(l)return!0}return!1},Tr={},jo=()=>ge||"./this.program",je=()=>{if(!je.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:jo()};for(var t in Tr)Tr[t]===void 0?delete r[t]:r[t]=Tr[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);je.strings=n}return je.strings},Io=(e,r)=>{for(var t=0;t<e.length;++t)N[r++]=e.charCodeAt(t);N[r]=0},No=(e,r)=>{var t=0;return je().forEach((n,o)=>{var i=r+t;F[e+o*4>>2]=i,Io(n,i),t+=n.length+1}),0},xo=(e,r)=>{var t=je();F[e>>2]=t.length;var n=0;return t.forEach(o=>n+=o.length+1),F[r>>2]=n,0},Uo=0,Ho=()=>Yt||Uo>0,Lo=e=>{var r;dr=e,Ho()||((r=u.onExit)==null||r.call(u,e),fr=!0),Ae(e,new Vt(e))},zo=(e,r)=>{dr=e,Lo(e)},Bo=zo;function Vo(e){try{var r=I.getStreamFromFD(e);return a.close(r),0}catch(t){if(typeof a=="undefined"||t.name!=="ErrnoError")throw t;return t.errno}}function Yo(e,r){try{var t=0,n=0,o=0,i=I.getStreamFromFD(e),s=i.tty?2:a.isDir(i.mode)?3:a.isLink(i.mode)?7:4;return N[r]=s,re[r+2>>1]=o,j=[t>>>0,(k=t,+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[r+8>>2]=j[0],w[r+12>>2]=j[1],j=[n>>>0,(k=n,+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[r+16>>2]=j[0],w[r+20>>2]=j[1],0}catch(l){if(typeof a=="undefined"||l.name!=="ErrnoError")throw l;return l.errno}}var qo=(e,r,t,n)=>{for(var o=0,i=0;i<t;i++){var s=F[r>>2],l=F[r+4>>2];r+=8;var f=a.read(e,N,s,l,n);if(f<0)return-1;if(o+=f,f<l)break;typeof n!="undefined"&&(n+=f)}return o};function Go(e,r,t,n){try{var o=I.getStreamFromFD(e),i=qo(o,r,t);return F[n>>2]=i,0}catch(s){if(typeof a=="undefined"||s.name!=="ErrnoError")throw s;return s.errno}}function Xo(e,r,t,n,o){var i=Oe(r,t);try{if(isNaN(i))return 61;var s=I.getStreamFromFD(e);return a.llseek(s,i,n),j=[s.position>>>0,(k=s.position,+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],w[o>>2]=j[0],w[o+4>>2]=j[1],s.getdents&&i===0&&n===0&&(s.getdents=null),0}catch(l){if(typeof a=="undefined"||l.name!=="ErrnoError")throw l;return l.errno}}var Ko=(e,r,t,n)=>{for(var o=0,i=0;i<t;i++){var s=F[r>>2],l=F[r+4>>2];r+=8;var f=a.write(e,N,s,l,n);if(f<0)return-1;o+=f,typeof n!="undefined"&&(n+=f)}return o};function Qo(e,r,t,n){try{var o=I.getStreamFromFD(e),i=Ko(o,r,t);return F[n>>2]=i,0}catch(s){if(typeof a=="undefined"||s.name!=="ErrnoError")throw s;return s.errno}}var Jo=(e,r)=>{for(var t=0,n=0;n<=r;t+=e[n++]);return t},mt=[31,29,31,30,31,30,31,31,30,31,30,31],gt=[31,28,31,30,31,30,31,31,30,31,30,31],Zo=(e,r)=>{for(var t=new Date(e.getTime());r>0;){var n=We(t.getFullYear()),o=t.getMonth(),i=(n?mt:gt)[o];if(r>i-t.getDate())r-=i-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+r),t}return t},ea=(e,r)=>{N.set(e,r)},ra=(e,r,t,n)=>{var o=F[n+40>>2],i={tm_sec:w[n>>2],tm_min:w[n+4>>2],tm_hour:w[n+8>>2],tm_mday:w[n+12>>2],tm_mon:w[n+16>>2],tm_year:w[n+20>>2],tm_wday:w[n+24>>2],tm_yday:w[n+28>>2],tm_isdst:w[n+32>>2],tm_gmtoff:w[n+36>>2],tm_zone:o?Ke(o):""},s=Ke(t),l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var f in l)s=s.replace(new RegExp(f,"g"),l[f]);var d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],v=["January","February","March","April","May","June","July","August","September","October","November","December"];function g(c,h,T){for(var P=typeof c=="number"?c.toString():c||"";P.length<h;)P=T[0]+P;return P}function p(c,h){return g(c,h,"0")}function m(c,h){function T(O){return O<0?-1:O>0?1:0}var P;return(P=T(c.getFullYear()-h.getFullYear()))===0&&(P=T(c.getMonth()-h.getMonth()))===0&&(P=T(c.getDate()-h.getDate())),P}function E(c){switch(c.getDay()){case 0:return new Date(c.getFullYear()-1,11,29);case 1:return c;case 2:return new Date(c.getFullYear(),0,3);case 3:return new Date(c.getFullYear(),0,2);case 4:return new Date(c.getFullYear(),0,1);case 5:return new Date(c.getFullYear()-1,11,31);case 6:return new Date(c.getFullYear()-1,11,30)}}function C(c){var h=Zo(new Date(c.tm_year+1900,0,1),c.tm_yday),T=new Date(h.getFullYear(),0,4),P=new Date(h.getFullYear()+1,0,4),O=E(T),W=E(P);return m(O,h)<=0?m(W,h)<=0?h.getFullYear()+1:h.getFullYear():h.getFullYear()-1}var D={"%a":c=>d[c.tm_wday].substring(0,3),"%A":c=>d[c.tm_wday],"%b":c=>v[c.tm_mon].substring(0,3),"%B":c=>v[c.tm_mon],"%C":c=>{var h=c.tm_year+1900;return p(h/100|0,2)},"%d":c=>p(c.tm_mday,2),"%e":c=>g(c.tm_mday,2," "),"%g":c=>C(c).toString().substring(2),"%G":C,"%H":c=>p(c.tm_hour,2),"%I":c=>{var h=c.tm_hour;return h==0?h=12:h>12&&(h-=12),p(h,2)},"%j":c=>p(c.tm_mday+Jo(We(c.tm_year+1900)?mt:gt,c.tm_mon-1),3),"%m":c=>p(c.tm_mon+1,2),"%M":c=>p(c.tm_min,2),"%n":()=>`
|
|
9
|
+
`,"%p":c=>c.tm_hour>=0&&c.tm_hour<12?"AM":"PM","%S":c=>p(c.tm_sec,2),"%t":()=>" ","%u":c=>c.tm_wday||7,"%U":c=>{var h=c.tm_yday+7-c.tm_wday;return p(Math.floor(h/7),2)},"%V":c=>{var h=Math.floor((c.tm_yday+7-(c.tm_wday+6)%7)/7);if((c.tm_wday+371-c.tm_yday-2)%7<=2&&h++,h){if(h==53){var P=(c.tm_wday+371-c.tm_yday)%7;P!=4&&(P!=3||!We(c.tm_year))&&(h=1)}}else{h=52;var T=(c.tm_wday+7-c.tm_yday-1)%7;(T==4||T==5&&We(c.tm_year%400-1))&&h++}return p(h,2)},"%w":c=>c.tm_wday,"%W":c=>{var h=c.tm_yday+7-(c.tm_wday+6)%7;return p(Math.floor(h/7),2)},"%y":c=>(c.tm_year+1900).toString().substring(2),"%Y":c=>c.tm_year+1900,"%z":c=>{var h=c.tm_gmtoff,T=h>=0;return h=Math.abs(h)/60,h=h/60*100+h%60,(T?"+":"-")+("0000"+h).slice(-4)},"%Z":c=>c.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var f in D)s.includes(f)&&(s=s.replace(new RegExp(f,"g"),D[f](i)));s=s.replace(/\0\0/g,"%");var S=Xe(s,!1);return S.length>r?0:(ea(S,e),S.length-1)},ta=(e,r,t,n,o)=>ra(e,r,t,n),na=a.createPath,oa=e=>a.unlink(e),aa=a.createLazyFile,ia=a.createDevice;a.createPreloadedFile=Qr,a.staticInit(),u.FS_createPath=a.createPath,u.FS_createDataFile=a.createDataFile,u.FS_createPreloadedFile=a.createPreloadedFile,u.FS_unlink=a.unlink,u.FS_createLazyFile=a.createLazyFile,u.FS_createDevice=a.createDevice,pn(),ke=u.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},Zr=u.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},Cn(),kn(),On(),lt=u.UnboundTypeError=Nn(Error,"UnboundTypeError"),Yn();var sa={a:Xt,q:on,N:an,Q:sn,J:ln,r:un,I:fn,O:dn,T:cn,D:vn,V:mn,e:xn,s:Hn,n:Ln,g:zn,m:Bn,U:dt,v:Xn,i:Kn,c:Jn,b:Zn,x:eo,o:ro,u:to,l:uo,W:fo,R:vo,S:po,Y:ho,d:Pr,Z:wo,w:Eo,X:ko,h:bo,A:Ao,B:To,y:Do,z:Fo,G:Ro,t:$o,H:Mo,j:ht,F:Wo,L:No,M:xo,f:Bo,k:Vo,K:Yo,P:Go,C:Xo,p:Qo,E:ta},x=Bt(),la=()=>(la=x.$)(),yt=e=>(yt=x.aa)(e),Dr=e=>(Dr=x.ba)(e),ae=e=>(ae=x.da)(e),_t=(e,r)=>(_t=x.ea)(e,r),wt=e=>(wt=x.fa)(e),ua=u.dynCall_jjj=(e,r,t,n,o)=>(ua=u.dynCall_jjj=x.ga)(e,r,t,n,o),fa=u.dynCall_iiiijj=(e,r,t,n,o,i,s,l)=>(fa=u.dynCall_iiiijj=x.ha)(e,r,t,n,o,i,s,l),da=u.dynCall_viijj=(e,r,t,n,o,i,s)=>(da=u.dynCall_viijj=x.ia)(e,r,t,n,o,i,s),ca=u.dynCall_viiijjjj=(e,r,t,n,o,i,s,l,f,d,v,g)=>(ca=u.dynCall_viiijjjj=x.ja)(e,r,t,n,o,i,s,l,f,d,v,g),va=u.dynCall_iji=(e,r,t,n)=>(va=u.dynCall_iji=x.ka)(e,r,t,n),pa=u.dynCall_jiji=(e,r,t,n,o)=>(pa=u.dynCall_jiji=x.la)(e,r,t,n,o),ha=u.dynCall_viijii=(e,r,t,n,o,i,s)=>(ha=u.dynCall_viijii=x.ma)(e,r,t,n,o,i,s),ma=u.dynCall_iiiiij=(e,r,t,n,o,i,s)=>(ma=u.dynCall_iiiiij=x.na)(e,r,t,n,o,i,s),ga=u.dynCall_iiiiijj=(e,r,t,n,o,i,s,l,f)=>(ga=u.dynCall_iiiiijj=x.oa)(e,r,t,n,o,i,s,l,f),ya=u.dynCall_iiiiiijj=(e,r,t,n,o,i,s,l,f,d)=>(ya=u.dynCall_iiiiiijj=x.pa)(e,r,t,n,o,i,s,l,f,d);u.addRunDependency=Ye,u.removeRunDependency=Se,u.FS_createPreloadedFile=Qr,u.FS_unlink=oa,u.FS_createPath=na,u.FS_createDevice=ia,u.FS_createDataFile=Kr,u.FS_createLazyFile=aa;var sr;Ce=function e(){sr||Et(),sr||(Ce=e)};function Et(){if(ce>0||(Mt(),ce>0))return;function e(){sr||(sr=!0,u.calledRun=!0,!fr&&(Ot(),U(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),Wt()))}u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("")},1),e()},1)):e()}if(u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();return Et(),b=Q,b}})();typeof St=="object"&&typeof Rr=="object"?Rr.exports=Fr:typeof define=="function"&&define.amd&&define([],()=>Fr);Fr.getUrl=function($){return"https://st.mycdn.me/static/audio-processing/0-0-7/"+$}});var Ue=class{constructor(_,y="AudioEffects"){this.loggerFunction=_,this.loggerName=y}debug(..._){this.loggerFunction("DEBUG",`[${this.loggerName}]`,..._)}log(..._){this.loggerFunction("LOG",`[${this.loggerName}]`,..._)}warn(..._){this.loggerFunction("WARN",`[${this.loggerName}]`,..._)}error(..._){this.loggerFunction("ERROR",`[${this.loggerName}]`,..._)}};function lr($,_=[]){let y=_.join(","),b=typeof $=="string"?[$,`exports.default(${y});`]:[`(${$})(${y});`],u=new Blob(b,{type:"application/javascript; charset=utf-8"});return window.URL.createObjectURL(u)}var be=class{constructor(){this.outputStream=null;this.audioContext=null;this.workletNode=null;this.sourceNode=null;this.logger=new Ue(()=>{})}init(H){return K(this,arguments,function*({sampleRate:_,isOutputAudio:y=!1,isOutputStream:b=!1,workletFunction:u,workletName:U}){if(this.logger.debug("init"),this.createAudioContext(_),yield this.createWorklet(u,U),this.workletNode&&this.audioContext&&(y&&(this.workletNode.connect(this.audioContext.destination),this.logger.debug("connected to standart audio output")),b)){let Q=this.audioContext.createMediaStreamDestination();this.workletNode.connect(Q),this.outputStream=Q.stream,this.logger.debug("connected to output MediaStream")}})}setSourceStream(_){var y;if(this.audioContext&&this.workletNode){let b=null;if(_){let u=new MediaStream(_.getAudioTracks().filter(U=>U.contentHint!=="music"));b=this.audioContext.createMediaStreamSource(u)}(y=this.sourceNode)==null||y.disconnect(this.workletNode),b==null||b.connect(this.workletNode),this.sourceNode=b,this.logger.debug("source stream "+(_?"set":"set to null"))}}destroy(){var _;this.logger.debug("destroy"),(_=this.audioContext)==null||_.close(),this.workletNode=null,this.sourceNode=null,this.audioContext=null,this.outputStream=null}resume(){var _;this.logger.debug("resume"),(_=this.audioContext)==null||_.resume()}pause(){var _;this.logger.debug("pause"),(_=this.audioContext)==null||_.suspend()}setLogger(_=()=>{},y){this.logger=new Ue(_,y)}static isSupported(){try{let _=window;return!!(_.WebAssembly&&_.Worker&&(_.AudioContext||_.webkitAudioContext)&&_.AudioWorkletNode)}catch(_){return!1}}createAudioContext(_){let y=window.AudioContext||window.webkitAudioContext,b=new y(_?{sampleRate:_}:{});this.audioContext=b,this.logger.debug("created AudioContext")}createWorklet(_,y){return K(this,null,function*(){if(this.logger.debug(`${y} init started`),!this.audioContext)return;yield this.audioContext.audioWorklet.addModule(lr(_));let b=new AudioWorkletNode(this.audioContext,y);return this.workletNode=b,new Promise(u=>{b.port.onmessage=({data:U})=>{switch(U.type){case"init":{this.logger.debug(`${y} init success`),u();break}case"data":{this.onWorkletData(U.data);break}}}})})}sendDataToWorklet(_,y=[]){var b;(b=this.workletNode)==null||b.port.postMessage(_,y)}};function Ct(){let B=[.26691192,.5013858,.3037737,.58564115,.35116732,.67516255,.41435885,.7225562,.4775504,.7752158,.5881356,.79627967,.68818885,.7594179,.75138044,.7120243,.8040401,.65936464,.85143363,.57510924,.8777635,.4855879,.4512206,.58564115,.5038802,.56457734,.5512739,.5540454,.5776037,.56457734,.60393345,.5540454,.66712505,.56457734,.70398676,.57510924,.65132713,.606705,.6144654,.6172369,.5776037,.6172369,.5407419,.6172369,.5038802,.606705,.46701849,.58564115,.5407419,.58564115,.5776037,.58564115,.6144654,.58564115,.68818885,.57510924,.6144654,.58564115,.5776037,.58564115,.5407419,.58564115],V=B[59],Wr=1-B[59];class L extends AudioWorkletProcessor{constructor(){super();this.lastTime=0;this.frameSampleCount=0;this.frameSampleAverage=0;this.maxInputVolume=.3;this.sequence=0;this.port.postMessage({type:"init"})}process(ge){var ye;let Ae=currentTime,G=0,de=(ye=ge==null?void 0:ge[0])==null?void 0:ye[0];if(de!=null&&de.length&&(G=de.reduce((ie,Z)=>ie+Math.abs(Z),0)/de.length),this.frameSampleAverage=(this.frameSampleAverage*this.frameSampleCount+G)/(this.frameSampleCount+1),this.frameSampleCount+=1,Ae-this.lastTime>1/25){let J=[];for(let Z=0;Z<31*2;Z+=1)J.push(B[Z]);this.frameSampleAverage>.015&&(J[59]=this.frameSampleAverage/this.maxInputVolume>.5?this.sequence%2===0?this.frameSampleAverage/2:this.frameSampleAverage:this.frameSampleAverage,J[59]=V+Wr*J[59]/.5),this.sequence+=1,this.frameSampleCount=1,this.maxInputVolume=Math.max(this.maxInputVolume,this.frameSampleAverage),this.lastTime=Ae;let ie=new Float32Array(J).buffer;this.port.postMessage({type:"data",data:ie},[ie])}return!0}}registerProcessor("vmojiLmarksVolumeWorklet",L)}var He=class extends be{constructor(){super(...arguments);this.onData=()=>{}}init(){return K(this,null,function*(){yield ue(He.prototype,this,"init").call(this,{workletFunction:Ct,workletName:"vmojiLmarksVolumeWorklet"})})}onWorkletData(y){this.onData(y)}};var Mr=At($r());var fe=class extends be{constructor(){super(...arguments);this.worker=null}init(y){return K(this,null,function*(){yield ue(fe.prototype,this,"init").call(this,y),yield this.createWorker(y.workerFunctionString,y.workerArgs)})}destroy(){var y;super.destroy(),(y=this.worker)==null||y.terminate(),this.worker=null}sendDataToWorker(y,b=[]){var u;(u=this.worker)==null||u.postMessage(y,b)}static isSupported(){try{let y=window;return!!(super.isSupported()&&y.Worker)}catch(y){return!1}}createWorker(y,b=[]){return new Promise((u,U)=>{this.logger.debug("worker init started"),this.worker=new Worker(lr(y,b)),this.worker.onmessage=({data:H})=>{switch(H.type){case"init":{this.logger.debug("worker init success"),u();break}case"error":{this.logger.error(H.error),U(H.error);break}case"data":{this.onWorkerData(H.data);break}case"debug":{this.logger.debug(H.message);break}}}})}};function Tt(){class $ extends AudioWorkletProcessor{constructor(){super(),this.port.postMessage({type:"init"})}process(y){var b;return(b=y==null?void 0:y[0])!=null&&b[0]&&this.port.postMessage({type:"data",data:y[0][0].buffer},[y[0][0].buffer]),!0}}registerProcessor("pureWorklet",$)}var Ca=16e3,Le=class extends fe{constructor(){super(...arguments);this.onData=()=>{}}init(){return K(this,null,function*(){yield ue(Le.prototype,this,"init").call(this,{sampleRate:Ca,workletFunction:Tt,workletName:"pureWorklet",workerFunctionString:`"use strict";var exports=(()=>{var g=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var b=(o,t)=>{for(var e in t)g(o,e,{get:t[e],enumerable:!0})},y=(o,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!f.call(o,n)&&n!==e&&g(o,n,{get:()=>t[n],enumerable:!(s=w(t,n))||s.enumerable});return o};var A=o=>y(g({},"__esModule",{value:!0}),o);var v={};b(v,{default:()=>x});var x=(o,t)=>{let e=null,s=null;function n(){return o({locateFile:t}).then(r=>{e=r;let l=new e.ConfigInput("animoji_v4.cfg",!0,"/"),i=new e.Config(l);s=e.AnimojiFactory.createAlgorithm(i)})}function p(r){self.postMessage({type:"error",error:typeof r=="number"&&e?e.getExMessage(r):r})}function k(r){var l;if(!(!e||!s))try{let i=new e.vector$float$,h=new Float32Array(r);for(let u of h)i.push_back(u);let a=e.animate(s,i),d=(l=a==null?void 0:a.size)==null?void 0:l.call(a);if(!d)return;let c=new Float32Array(d);for(let u=0;u<d;u++)c[u]=a.get(u);self.postMessage({type:"data",data:c.buffer},[c.buffer])}catch(i){p(i)}}n().then(()=>{self.onmessage=r=>{k(r.data.data)},self.postMessage({type:"init"})}).catch(p)};return A(v);})();
|
|
10
|
+
`,workerArgs:[Mr.default,Mr.default.getUrl]})})}onWorkletData(y){this.sendDataToWorker({data:y},[y])}onWorkerData(y){this.onData(y)}static isSupported(){try{let y=super.isSupported(),b=/firefox/i.test(navigator.userAgent);return y&&!b}catch(y){return!1}}};var Or=At($r());function Dt(){class $ extends AudioWorkletProcessor{constructor(){super();this.samplesQueue=[];this.port.postMessage({type:"init"}),this.port.onmessage=({data:{data:b}})=>{this.samplesQueue.push(b)}}process(b,u){var U;if((U=b==null?void 0:b[0])!=null&&U[0]&&this.port.postMessage({type:"data",data:b[0][0].buffer},[b[0][0].buffer]),this.samplesQueue.length>0){let H=new Float32Array(this.samplesQueue.shift());u[0].forEach(B=>{for(let V=0;V<H.length;V++)B[V]=H[V]})}return!0}}registerProcessor("voiceChangeWorklet",$)}var Ft=(y=>(y.PLAYBACK="playback",y.OUTPUT_STREAM="output_stream",y))(Ft||{}),Rt=(L=>(L.BALLOON="balloon",L.CATHEDRAL="cathedral",L.CHORUS="chorus",L.DISTORTION="distortion",L.ECHO="echo",L.EVIL="evil",L.GIANT="giant",L.HALL="hall",L.PHASER="phaser",L.ROBOT="robot",L.SQUIRELL="squirell",L))(Rt||{}),Sa=44100,ze=class extends fe{constructor(y="playback"){super();this.mode=y}init(){return K(this,null,function*(){yield ue(ze.prototype,this,"init").call(this,{sampleRate:Sa,isOutputAudio:this.mode==="playback",isOutputStream:this.mode==="output_stream",workletFunction:Dt,workletName:"voiceChangeWorklet",workerFunctionString:'"use strict";var exports=(()=>{var p=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var W=(s,r)=>{for(var e in r)p(s,e,{get:r[e],enumerable:!0})},A=(s,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of b(r))!y.call(s,i)&&i!==e&&p(s,i,{get:()=>r[i],enumerable:!(a=m(r,i))||a.enumerable});return s};var R=s=>A(p({},"__esModule",{value:!0}),s);var E={};W(E,{VoiceChangeWorkerRequestType:()=>f,default:()=>v});var f=(e=>(e.SET_EFFECTS="set_effects",e.DATA="data",e))(f||{}),v=(s,r)=>{let e=null,a=[];function i(){return s({locateFile:r}).then(t=>{e=t})}function k(t,l=!1){if(e)try{for(let o of t){let g=`${o}${l?".cfg":""}`,c=new e.ConfigInput(g,l,"/"),u=new e.Config(c),n=e.EffectFactory.createAlgorithm(u);a.push({configInput:c,config:u,effect:n})}}catch(o){d(o)}}function h(){for(let t of a)t.configInput.delete(),t.config.delete(),t.effect.delete();a=[]}function d(t){self.postMessage({type:"error",error:typeof t=="number"&&e?e.getExMessage(t):t})}function w(t){var l;if(!(!e||!a.length))try{let o=new e.vector$float$,g=new Float32Array(t);for(let n of g)o.push_back(n);for(let{effect:n}of a)o=e.applyEffect(n,o);let c=(l=o==null?void 0:o.size)==null?void 0:l.call(o);if(!c)return;let u=new Float32Array(c);for(let n=0;n<c;n++)u[n]=o.get(n);self.postMessage({type:"data",data:u.buffer},[u.buffer])}catch(o){d(o)}}i().then(()=>{self.onmessage=({data:t})=>{switch(t.type){case"set_effects":{h(),k(t.effects,t.isPreset);break}case"data":{w(t.data);break}}},self.postMessage({type:"init"})}).catch(d)};return R(E);})();\n',workerArgs:[Or.default,Or.default.getUrl]})})}setEffects(y,b){this.logger.debug("setEffects",y,b),this.sendDataToWorker({type:"set_effects",effects:y,isPreset:b})}onWorkletData(y){this.sendDataToWorker({type:"data",data:y},[y])}onWorkerData(y){this.sendDataToWorklet({data:y},[y])}};export{Le as EffectVmojiLmarksAi,He as EffectVmojiLmarksVolume,ze as EffectVoiceChange,Ft as EffectVoiceChangeMode,Rt as VoiceChangeEffectType};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DataProcessing } from '../processor/AudioProcessor';
|
|
2
|
+
import { WorkerAudioProcessor } from '../processor/WorkerAudioProcessor';
|
|
3
|
+
/**
|
|
4
|
+
* Эффект, генерирующий точки для отрисовки анимации Vmoji
|
|
5
|
+
* из входящего аудиопотока с использованием воркера с нейронкой в wasm-модуле wav2lip.
|
|
6
|
+
*/
|
|
7
|
+
export declare class EffectVmojiLmarksAi extends WorkerAudioProcessor implements DataProcessing {
|
|
8
|
+
/**
|
|
9
|
+
* Коллбек, вызывающийся при генерации очередной серии точек Vmoji
|
|
10
|
+
* @param {ArrayBuffer} data - точки Vmoji
|
|
11
|
+
*/
|
|
12
|
+
onData: (data: ArrayBuffer) => void;
|
|
13
|
+
init(): Promise<void>;
|
|
14
|
+
protected onWorkletData(data: ArrayBuffer): void;
|
|
15
|
+
protected onWorkerData(data: ArrayBuffer): void;
|
|
16
|
+
static isSupported(): boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AudioProcessor, DataProcessing } from '../processor/AudioProcessor';
|
|
2
|
+
/**
|
|
3
|
+
* Эффект, генерирующий точки для отрисовки анимации Vmoji
|
|
4
|
+
* из входящего аудиопотока на основе громкости аудио (plain js).
|
|
5
|
+
*/
|
|
6
|
+
export declare class EffectVmojiLmarksVolume extends AudioProcessor implements DataProcessing {
|
|
7
|
+
/**
|
|
8
|
+
* Коллбек, вызывающийся при генерации очередной серии точек Vmoji
|
|
9
|
+
* @param {ArrayBuffer} data - точки Vmoji
|
|
10
|
+
*/
|
|
11
|
+
onData: (data: ArrayBuffer) => void;
|
|
12
|
+
init(): Promise<void>;
|
|
13
|
+
protected onWorkletData(data: ArrayBuffer): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { WorkerAudioProcessor } from '../processor/WorkerAudioProcessor';
|
|
2
|
+
export interface VoiceChangeWorkletRequest {
|
|
3
|
+
data: ArrayBuffer;
|
|
4
|
+
}
|
|
5
|
+
export declare enum EffectVoiceChangeMode {
|
|
6
|
+
/** режим проигрывания обработанного аудио через стандартный аудио выход */
|
|
7
|
+
PLAYBACK = "playback",
|
|
8
|
+
/** режим вывода обработанного аудио в outputStream */
|
|
9
|
+
OUTPUT_STREAM = "output_stream"
|
|
10
|
+
}
|
|
11
|
+
export declare const enum VoiceChangeEffectType {
|
|
12
|
+
BALLOON = "balloon",
|
|
13
|
+
CATHEDRAL = "cathedral",
|
|
14
|
+
CHORUS = "chorus",
|
|
15
|
+
DISTORTION = "distortion",
|
|
16
|
+
ECHO = "echo",
|
|
17
|
+
EVIL = "evil",
|
|
18
|
+
GIANT = "giant",
|
|
19
|
+
HALL = "hall",
|
|
20
|
+
PHASER = "phaser",
|
|
21
|
+
ROBOT = "robot",
|
|
22
|
+
SQUIRELL = "squirell"
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Эффект, изменяющий голос из входящего аудиопотока
|
|
26
|
+
* с использованием wasm-модуля wav2lip и направляющий
|
|
27
|
+
* обработанный голос на стандартный выход (динамик) или в отдельный MediaStream.
|
|
28
|
+
*/
|
|
29
|
+
export declare class EffectVoiceChange extends WorkerAudioProcessor {
|
|
30
|
+
private mode;
|
|
31
|
+
/**
|
|
32
|
+
* @typedef {string} EffectVoiceChangeMode
|
|
33
|
+
* @param {EffectVoiceChangeMode} mode - режим вывода: аудио выход или MediaStream
|
|
34
|
+
*/
|
|
35
|
+
constructor(mode?: EffectVoiceChangeMode);
|
|
36
|
+
init(): Promise<void>;
|
|
37
|
+
setEffects(effects: string[], isPreset?: false): void;
|
|
38
|
+
setEffects(effects: VoiceChangeEffectType[], isPreset: true): void;
|
|
39
|
+
protected onWorkletData(data: ArrayBuffer): void;
|
|
40
|
+
protected onWorkerData(data: ArrayBuffer): void;
|
|
41
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vkontakte/calls-audio-effects",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"author": "vk.com",
|
|
5
|
+
"description": "Audio effects library for video calls based on the vk.com platform",
|
|
6
|
+
"homepage": "https://vk.com",
|
|
7
|
+
"license": "GPL-3.0",
|
|
8
|
+
"main": "audio-effects.cjs.js",
|
|
9
|
+
"module": "audio-effects.esm.js",
|
|
10
|
+
"types": "AudioEffects.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"audio-effects.cjs.js",
|
|
13
|
+
"audio-effects.esm.js",
|
|
14
|
+
"**/*.d.ts"
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@vkontakte/audio-processing": "0.0.7"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Logger } from '../utils/Logger';
|
|
2
|
+
export interface AudioProcessorParams {
|
|
3
|
+
sampleRate?: number;
|
|
4
|
+
isOutputAudio?: boolean;
|
|
5
|
+
isOutputStream?: boolean;
|
|
6
|
+
workletFunction: Function;
|
|
7
|
+
workletName: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const enum WorkletResponseType {
|
|
10
|
+
INIT = "init",
|
|
11
|
+
DATA = "data"
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Интерфейс, добавляющий классу AudioProcessor коллбек для передачи данных наружу.
|
|
15
|
+
*/
|
|
16
|
+
export interface DataProcessing {
|
|
17
|
+
onData: (data: any) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Базовый класс аудиопроцессинга,
|
|
21
|
+
* подразумевающий использование определенного AudioWorklet
|
|
22
|
+
* для обработки входящего аудио.
|
|
23
|
+
*/
|
|
24
|
+
export declare abstract class AudioProcessor {
|
|
25
|
+
/**
|
|
26
|
+
* MediaStream, в который производится вывод результата
|
|
27
|
+
* обработки аудио, если при инициализации был установлен флаг isOutputStream.
|
|
28
|
+
*/
|
|
29
|
+
outputStream: MediaStream | null;
|
|
30
|
+
protected audioContext: AudioContext | null;
|
|
31
|
+
protected workletNode: AudioWorkletNode | null;
|
|
32
|
+
private sourceNode;
|
|
33
|
+
protected logger: Logger;
|
|
34
|
+
/**
|
|
35
|
+
* @typedef {Object} AudioProcessorParams
|
|
36
|
+
* @param {AudioProcessorParams} params
|
|
37
|
+
* @param {number} [params.sampleRate] - Специфичный sampleRate для создания AudioContext.
|
|
38
|
+
* По-умолчанию используется значение на основе использумого аудио оборудования.
|
|
39
|
+
* @param {boolean} [params.isOutputAudio=false] - Выводить ли результат работы AudioWorklet
|
|
40
|
+
* на стандартный выход AudioContext (динамик).
|
|
41
|
+
* @param {boolean} [params.isOutputStream=false] - Выводить ли результат работы AudioWorklet
|
|
42
|
+
* в отдельный MediaStream outputStream, доступный публично.
|
|
43
|
+
* @param {Function} params.workletFunction - Функция, объявляющая и регистрирующая класс ворклета.
|
|
44
|
+
* @param {string} params.workletName - Зарегистрированное имя ворклета.
|
|
45
|
+
*/
|
|
46
|
+
init({ sampleRate, isOutputAudio, isOutputStream, workletFunction, workletName, }: AudioProcessorParams): Promise<void>;
|
|
47
|
+
setSourceStream(stream: MediaStream | null): void;
|
|
48
|
+
destroy(): void;
|
|
49
|
+
resume(): void;
|
|
50
|
+
pause(): void;
|
|
51
|
+
setLogger(loggerFunction?: () => void, loggerName?: string): void;
|
|
52
|
+
static isSupported(): boolean;
|
|
53
|
+
private createAudioContext;
|
|
54
|
+
private createWorklet;
|
|
55
|
+
protected abstract onWorkletData(data: unknown): void;
|
|
56
|
+
protected sendDataToWorklet(data: any, transfer?: any[]): void;
|
|
57
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AudioProcessor, AudioProcessorParams } from './AudioProcessor';
|
|
2
|
+
export interface WorkerAudioProcessorParams extends AudioProcessorParams {
|
|
3
|
+
workerFunctionString: string;
|
|
4
|
+
workerArgs: unknown[];
|
|
5
|
+
}
|
|
6
|
+
export declare const enum WorkerResponseType {
|
|
7
|
+
INIT = "init",
|
|
8
|
+
DATA = "data",
|
|
9
|
+
ERROR = "error",
|
|
10
|
+
DEBUG = "debug"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Аудиопроцесс, добавляющий в цепочку обработки аудио определенный воркер
|
|
14
|
+
* и функции для обмена данных с ним.
|
|
15
|
+
*/
|
|
16
|
+
export declare abstract class WorkerAudioProcessor extends AudioProcessor {
|
|
17
|
+
private worker;
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Object} WorkerAudioProcessorParams
|
|
20
|
+
* @param {WorkerAudioProcessorParams} params
|
|
21
|
+
* @param {number} [params.sampleRate] - Специфичный sampleRate для создания AudioContext.
|
|
22
|
+
* По-умолчанию используется значение на основе использумого аудио оборудования.
|
|
23
|
+
* @param {boolean} [params.isOutputAudio=false] - Выводить ли результат работы AudioWorklet
|
|
24
|
+
* на стандартный выход AudioContext (динамик).
|
|
25
|
+
* @param {Function} params.workletFunction - Функция, объявляющая и регистрирующая класс ворклета.
|
|
26
|
+
* @param {string} params.workletName - Зарегистрированное имя ворклета.
|
|
27
|
+
* @param {Function} params.workerFunction - Функция воркера.
|
|
28
|
+
* @param {*[]} params.workerArgs - Параметры для передачи в функцию воркера при его инциализации.
|
|
29
|
+
*/
|
|
30
|
+
init(params: WorkerAudioProcessorParams): Promise<void>;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
protected abstract onWorkerData(data: unknown): void;
|
|
33
|
+
protected sendDataToWorker(data: any, transfer?: any[]): void;
|
|
34
|
+
static isSupported(): boolean;
|
|
35
|
+
private createWorker;
|
|
36
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class Logger {
|
|
2
|
+
private loggerName;
|
|
3
|
+
private loggerFunction;
|
|
4
|
+
constructor(loggerFunction: Function, loggerName?: string);
|
|
5
|
+
debug(...args: any[]): void;
|
|
6
|
+
log(...args: any[]): void;
|
|
7
|
+
warn(...args: any[]): void;
|
|
8
|
+
error(...args: any[]): void;
|
|
9
|
+
}
|
package/utils/Utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createBlobObject(functionData: Function | string, args?: unknown[]): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import wav2lip from '@vkontakte/audio-processing';
|
|
2
|
+
export declare const enum VoiceChangeWorkerRequestType {
|
|
3
|
+
SET_EFFECTS = "set_effects",
|
|
4
|
+
DATA = "data"
|
|
5
|
+
}
|
|
6
|
+
export interface VoiceEffect {
|
|
7
|
+
configInput: wav2lip.ConfigInput;
|
|
8
|
+
config: wav2lip.Config;
|
|
9
|
+
effect: wav2lip.Effect;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: (createWav2lipModule: typeof wav2lip, urlResolver: (url: string) => string) => void;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ворклет, передающий входящие семплы по своему порту
|
|
3
|
+
* и подставляющий входящие по порту семплы в качестве исходящих для аудио контекста.
|
|
4
|
+
* Используется для внешней обработки входящих семплов.
|
|
5
|
+
*/
|
|
6
|
+
export declare function voiceChangeWorkletFunction(): void;
|