trtc-sdk-v5 5.10.0-beta.4 → 5.10.0-beta.5
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/README-zh_CN.md +2 -1
- package/README.md +2 -1
- package/assets/debug-dialog.js +1 -0
- package/{plugins/ai-denoiser → assets}/denoiser-wasm.js +1 -1
- package/assets/selfie_segmentation/package.json +27 -0
- package/assets/selfie_segmentation/selfie_segmentation.binarypb +0 -0
- package/assets/selfie_segmentation/selfie_segmentation.tflite +0 -0
- package/assets/selfie_segmentation/selfie_segmentation_landscape.tflite +0 -0
- package/assets/selfie_segmentation/selfie_segmentation_solution_simd_wasm_bin.data +0 -0
- package/assets/selfie_segmentation/selfie_segmentation_solution_simd_wasm_bin.wasm +0 -0
- package/assets/selfie_segmentation/selfie_segmentation_solution_wasm_bin.wasm +0 -0
- package/assets/videodec.wasm +0 -0
- package/assets/videodec_simd.wasm +0 -0
- package/index.d.ts +1823 -1796
- package/package.json +1 -1
- package/plugins/cdn-streaming/cdn-streaming.esm.js +1 -1
- package/plugins/cdn-streaming/cdn-streaming.umd.js +1 -0
- package/plugins/cdn-streaming/package.json +1 -2
- package/plugins/cross-room/cross-room.esm.js +1 -1
- package/plugins/cross-room/cross-room.umd.js +1 -0
- package/plugins/cross-room/package.json +1 -2
- package/plugins/custom-encryption/custom-encryption.esm.d.ts +31 -0
- package/plugins/custom-encryption/custom-encryption.esm.js +1 -0
- package/plugins/custom-encryption/custom-encryption.umd.js +1 -0
- package/plugins/custom-encryption/package.json +7 -0
- package/plugins/device-detector/device-detector.esm.js +93 -1234
- package/plugins/device-detector/device-detector.umd.js +39 -0
- package/plugins/device-detector/package.json +1 -2
- package/plugins/video-decoder/package.json +1 -1
- package/plugins/video-decoder/video-decoder.esm.d.ts +20 -20
- package/plugins/video-decoder/video-decoder.esm.js +1 -43
- package/plugins/video-decoder/video-decoder.umd.js +1 -0
- package/plugins/video-effect/basic-beauty/basic-beauty.esm.js +1 -2
- package/plugins/video-effect/basic-beauty/basic-beauty.umd.js +1 -0
- package/plugins/video-effect/basic-beauty/package.json +1 -2
- package/plugins/video-effect/beauty/beauty.esm.js +1 -2954
- package/plugins/video-effect/beauty/beauty.umd.js +1 -0
- package/plugins/video-effect/beauty/package.json +1 -2
- package/plugins/video-effect/virtual-background/package.json +1 -2
- package/plugins/video-effect/virtual-background/virtual-background.esm.js +1 -60
- package/plugins/video-effect/virtual-background/virtual-background.umd.js +1 -0
- package/plugins/video-effect/watermark/package.json +1 -2
- package/plugins/video-effect/watermark/watermark.esm.d.ts +10 -2
- package/plugins/video-effect/watermark/watermark.esm.js +1 -1
- package/plugins/video-effect/watermark/watermark.umd.js +1 -0
- package/plugins/voice-changer/package.json +9 -0
- package/plugins/voice-changer/voice-changer.esm.d.ts +20 -0
- package/plugins/voice-changer/voice-changer.esm.js +1 -0
- package/plugins/voice-changer/voice-changer.umd.js +1 -0
- package/trtc.esm.js +28 -28
- package/trtc.js +1 -1
- package/plugins/cdn-streaming/cdn-streaming.iife.js +0 -1
- package/plugins/cross-room/cross-room.iife.js +0 -1
- package/plugins/device-detector/device-detector.iife.js +0 -1472
- package/plugins/video-decoder/video-decoder.iife.js +0 -43
- package/plugins/video-effect/basic-beauty/basic-beauty.iife.js +0 -2
- package/plugins/video-effect/beauty/beauty.iife.js +0 -2954
- package/plugins/video-effect/virtual-background/virtual-background.iife.js +0 -60
- package/plugins/video-effect/watermark/watermark.iife.js +0 -1
|
@@ -1,43 +1 @@
|
|
|
1
|
-
var $o=Object.create;var nn=Object.defineProperty,Lo=Object.defineProperties,bo=Object.getOwnPropertyDescriptor,Mo=Object.getOwnPropertyDescriptors,Fo=Object.getOwnPropertyNames,_o=Object.getOwnPropertySymbols,Bo=Object.getPrototypeOf,To=Object.prototype.hasOwnProperty,Ho=Object.prototype.propertyIsEnumerable;var so=(b,p,s)=>p in b?nn(b,p,{enumerable:!0,configurable:!0,writable:!0,value:s}):b[p]=s,Tr=(b,p)=>{for(var s in p||(p={}))To.call(p,s)&&so(b,s,p[s]);if(_o)for(var s of _o(p))Ho.call(p,s)&&so(b,s,p[s]);return b},Er=(b,p)=>Lo(b,Mo(p));var Wo=(b,p)=>()=>(p||b((p={exports:{}}).exports,p),p.exports);var Vo=(b,p,s,v)=>{if(p&&typeof p=="object"||typeof p=="function")for(let S of Fo(p))!To.call(b,S)&&S!==s&&nn(b,S,{get:()=>p[S],enumerable:!(v=bo(p,S))||v.enumerable});return b};var jo=(b,p,s)=>(s=b!=null?$o(Bo(b)):{},Vo(p||!b||!b.__esModule?nn(s,"default",{value:b,enumerable:!0}):s,b));var Le=(b,p,s,v)=>{for(var S=v>1?void 0:v?bo(p,s):p,D=b.length-1,A;D>=0;D--)(A=b[D])&&(S=(v?A(p,s,S):A(S))||S);return v&&S&&nn(p,s,S),S};var fe=(b,p,s)=>so(b,typeof p!="symbol"?p+"":p,s);var wo=Wo((ai,uo)=>{"use strict";var Go=Object.prototype.hasOwnProperty,Te="~";function lt(){}Object.create&&(lt.prototype=Object.create(null),new lt().__proto__||(Te=!1));function zo(b,p,s){this.fn=b,this.context=p,this.once=s||!1}function Eo(b,p,s,v,S){if(typeof s!="function")throw new TypeError("The listener must be a function");var D=new zo(s,v||b,S),A=Te?Te+p:p;return b._events[A]?b._events[A].fn?b._events[A]=[b._events[A],D]:b._events[A].push(D):(b._events[A]=D,b._eventsCount++),b}function on(b,p){--b._eventsCount===0?b._events=new lt:delete b._events[p]}function pe(){this._events=new lt,this._eventsCount=0}pe.prototype.eventNames=function(){var p=[],s,v;if(this._eventsCount===0)return p;for(v in s=this._events)Go.call(s,v)&&p.push(Te?v.slice(1):v);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(s)):p};pe.prototype.listeners=function(p){var s=Te?Te+p:p,v=this._events[s];if(!v)return[];if(v.fn)return[v.fn];for(var S=0,D=v.length,A=new Array(D);S<D;S++)A[S]=v[S].fn;return A};pe.prototype.listenerCount=function(p){var s=Te?Te+p:p,v=this._events[s];return v?v.fn?1:v.length:0};pe.prototype.emit=function(p,s,v,S,D,A){var H=Te?Te+p:p;if(!this._events[H])return!1;var I=this._events[H],C=arguments.length,F,L;if(I.fn){switch(I.once&&this.removeListener(p,I.fn,void 0,!0),C){case 1:return I.fn.call(I.context),!0;case 2:return I.fn.call(I.context,s),!0;case 3:return I.fn.call(I.context,s,v),!0;case 4:return I.fn.call(I.context,s,v,S),!0;case 5:return I.fn.call(I.context,s,v,S,D),!0;case 6:return I.fn.call(I.context,s,v,S,D,A),!0}for(L=1,F=new Array(C-1);L<C;L++)F[L-1]=arguments[L];I.fn.apply(I.context,F)}else{var W=I.length,me;for(L=0;L<W;L++)switch(I[L].once&&this.removeListener(p,I[L].fn,void 0,!0),C){case 1:I[L].fn.call(I[L].context);break;case 2:I[L].fn.call(I[L].context,s);break;case 3:I[L].fn.call(I[L].context,s,v);break;case 4:I[L].fn.call(I[L].context,s,v,S);break;default:if(!F)for(me=1,F=new Array(C-1);me<C;me++)F[me-1]=arguments[me];I[L].fn.apply(I[L].context,F)}}return!0};pe.prototype.on=function(p,s,v){return Eo(this,p,s,v,!1)};pe.prototype.once=function(p,s,v){return Eo(this,p,s,v,!0)};pe.prototype.removeListener=function(p,s,v,S){var D=Te?Te+p:p;if(!this._events[D])return this;if(!s)return on(this,D),this;var A=this._events[D];if(A.fn)A.fn===s&&(!S||A.once)&&(!v||A.context===v)&&on(this,D);else{for(var H=0,I=[],C=A.length;H<C;H++)(A[H].fn!==s||S&&!A[H].once||v&&A[H].context!==v)&&I.push(A[H]);I.length?this._events[D]=I.length===1?I[0]:I:on(this,D)}return this};pe.prototype.removeAllListeners=function(p){var s;return p?(s=Te?Te+p:p,this._events[s]&&on(this,s)):(this._events=new lt,this._eventsCount=0),this};pe.prototype.off=pe.prototype.removeListener;pe.prototype.addListener=pe.prototype.on;pe.prefixed=Te;pe.EventEmitter=pe;typeof uo!="undefined"&&(uo.exports=pe)});var Ao=jo(wo(),1),So=Symbol("instance"),si=Symbol("abortCtrl"),an=Symbol("cacheResult"),dt=class{constructor(p,s,v){this.oldState=p,this.newState=s,this.action=v,this.aborted=!1}abort(p){this.aborted=!0,pt.call(p,this.oldState,new Error(`action '${this.action}' aborted`))}toString(){return`${this.action}ing`}},Nr=class extends Error{constructor(p,s,v){super(s),this.state=p,this.message=s,this.cause=v}};function Ko(b){return typeof b=="object"&&b&&"then"in b}var ft=new Map;function je(b,p,s={}){return(v,S,D)=>{let A=s.action||S;if(!s.context){let I=ft.get(v)||[];ft.has(v)||ft.set(v,I),I.push({from:b,to:p,action:A})}let H=D.value;D.value=function(...I){let C=this;if(s.context&&(C=ce.get(typeof s.context=="function"?s.context.call(this,...I):s.context)),C.state===p)return s.sync?C[an]:Promise.resolve(C[an]);C.state instanceof dt&&C.state.action==s.abortAction&&C.state.abort(C);let F=null;Array.isArray(b)?b.length==0?C.state instanceof dt&&C.state.abort(C):(typeof C.state!="string"||!b.includes(C.state))&&(F=new Nr(C._state,`${C.name} ${A} to ${p} failed: current state ${C._state} not from ${b.join("|")}`)):b!==C.state&&(F=new Nr(C._state,`${C.name} ${A} to ${p} failed: current state ${C._state} not from ${b}`));let L=q=>{if(s.fail&&s.fail.call(this,q),s.sync){if(s.ignoreError)return q;throw q}else return s.ignoreError?Promise.resolve(q):Promise.reject(q)};if(F)return L(F);let W=C.state,me=new dt(W,p,A);pt.call(C,me);let Re=q=>{var ze;return C[an]=q,me.aborted||(pt.call(C,p),(ze=s.success)===null||ze===void 0||ze.call(this,C[an])),q},Me=q=>(pt.call(C,W,q),L(q));try{let q=H.apply(this,I);return Ko(q)?q.then(Re).catch(Me):s.sync?Re(q):Promise.resolve(Re(q))}catch(q){return Me(new Nr(C._state,`${C.name} ${A} from ${b} to ${p} failed: ${q}`,q instanceof Error?q:new Error(String(q))))}}}}function Po(...b){return(p,s,v)=>{let S=v.value,D=s;v.value=function(...A){if(!b.includes(this.state.toString()))throw new Nr(this.state,`${this.name} ${D} failed: current state ${this.state} not in ${b}`);return S.apply(this,A)}}}var Xo=typeof window!="undefined"&&window.__AFSM__?(s,v)=>{window.dispatchEvent(new CustomEvent(s,{detail:v}))}:typeof importScripts!="undefined"?(s,v)=>{postMessage({type:s,payload:v})}:()=>{};function pt(b,p){let s=this._state;this._state=b;let v=b.toString();b&&this.emit(v,s),this.emit(ce.STATECHANGED,b,s,p),this.updateDevTools({value:b,old:s,err:p instanceof Error?p.message:String(p)})}var ce=class b extends Ao.default{constructor(p,s,v){super(),this.name=p,this.groupName=s,this._state=b.INIT,p||(p=Date.now().toString(36)),v?Object.setPrototypeOf(this,v):v=Object.getPrototypeOf(this),s||(this.groupName=this.constructor.name);let S=v[So];S?this.name=S.name+"-"+S.count++:v[So]={name:this.name,count:0},this.updateDevTools({diagram:this.stateDiagram})}get stateDiagram(){let p=Object.getPrototypeOf(this),s=ft.get(p)||[],v=new Set,S=[],D=[],A=new Set,H=Object.getPrototypeOf(p);ft.has(H)&&(H.stateDiagram.forEach(C=>v.add(C)),H.allStates.forEach(C=>A.add(C))),s.forEach(({from:C,to:F,action:L})=>{typeof C=="string"?S.push({from:C,to:F,action:L}):C.length?C.forEach(W=>{S.push({from:W,to:F,action:L})}):D.push({to:F,action:L})}),S.forEach(({from:C,to:F,action:L})=>{A.add(C),A.add(F),A.add(L+"ing"),v.add(`${C} --> ${L}ing : ${L}`),v.add(`${L}ing --> ${F} : ${L} \u{1F7E2}`),v.add(`${L}ing --> ${C} : ${L} \u{1F534}`)}),D.forEach(({to:C,action:F})=>{v.add(`${F}ing --> ${C} : ${F} \u{1F7E2}`),A.forEach(L=>{L!==C&&v.add(`${L} --> ${F}ing : ${F}`)})});let I=[...v];return Object.defineProperties(p,{stateDiagram:{value:I},allStates:{value:A}}),I}static get(p){let s;return typeof p=="string"?(s=b.instances.get(p),s||b.instances.set(p,s=new b(p,void 0,Object.create(b.prototype)))):(s=b.instances2.get(p),s||b.instances2.set(p,s=new b(p.constructor.name,void 0,Object.create(b.prototype)))),s}static getState(p){var s;return(s=b.get(p))===null||s===void 0?void 0:s.state}updateDevTools(p={}){Xo(b.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},p))}get state(){return this._state}set state(p){pt.call(this,p)}};ce.STATECHANGED="stateChanged";ce.UPDATEAFSM="updateAFSM";ce.INIT="[*]";ce.ON="on";ce.OFF="off";ce.instances=new Map;ce.instances2=new WeakMap;var or=class extends ce{constructor(){super(...arguments);fe(this,"decoder");fe(this,"config")}async initialize(){this.decoder=new VideoDecoder({output:s=>{this.emit("videoFrame",s)},error:s=>{this.close(),this.emit("error",s)}})}configure(s){this.config=s,this.decoder.configure(Er(Tr({},s),{codec:this.getCodec(s)}))}getCodec(s){switch(s.codec){case"hevc":return"hvc1.1.6.L0.12.34.56.78.9A.BC";case"av1":return"av01.0.05M.08";case"avc":return"avc1.420028";default:return s.codec}}decode(s){this.decoder.state==="configured"&&this.decoder.decode(new EncodedVideoChunk(s))}flush(){this.decoder.flush()}reset(){this.decoder.reset()}close(){this.decoder.state!=="closed"&&this.decoder.close()}};Le([je([ce.INIT,"closed"],"initialized")],or.prototype,"initialize",1),Le([je("initialized","configured",{sync:!0})],or.prototype,"configure",1),Le([Po("configured")],or.prototype,"decode",1),Le([je([],ce.INIT)],or.prototype,"reset",1),Le([je([],"closed",{ignoreError:!0,sync:!0})],or.prototype,"close",1);function Yo(){var b;self.onmessage=p=>{if(p.data.type==="init"){let{canvas:s,wasmScript:v,wasmBinary:S}=p.data,D=s==null?void 0:s.getContext("2d"),A=0,H=0,I={wasmBinary:S,postRun:()=>{b=new I.VideoDecoder({videoInfo(C,F){A=C,H=F,console.log("video info",C,F)},yuvData(C,F){let L=A*H,W=L>>2,me=I.HEAPU32[C>>2],Re=I.HEAPU32[(C>>2)+1],Me=I.HEAPU32[(C>>2)+2],q=I.HEAPU8.subarray(me,me+L),ze=I.HEAPU8.subarray(Re,Re+W),lr=I.HEAPU8.subarray(Me,Me+W),ae=new Uint8Array(L+W+W);ae.set(q),ae.set(ze,L),ae.set(lr,L+W);let he=new VideoFrame(ae,{codedWidth:A,codedHeight:H,format:"I420",timestamp:F});s?(D==null||D.drawImage(he,0,0,s.width,s.height),D==null||D.commit()):self.postMessage({type:"yuvData",videoFrame:he},[he])}}),self.postMessage({type:"ready"})}};Function("var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;return "+v)()(I)}else if(p.data.type==="decode"){let{packet:s}=p.data;b==null||b.decode(s.data,s.type=="key",s.timestamp)}else if(p.data.type==="setCodec"){let{codec:s,format:v,description:S}=p.data;b==null||b.setCodec(s,v,S!=null?S:"")}}}var Ge=class extends ce{constructor(s,v,S=!1,D,A=!1){super();this.createModule=s;this.wasmBinary=v;this.workerMode=S;this.canvas=D;this.yuvMode=A;fe(this,"worker");fe(this,"decoder");fe(this,"config");fe(this,"module",{});fe(this,"width",0);fe(this,"height",0)}async initialize(s){var S;if(this.workerMode){let D=new RegExp("\\{(.+)\\}","s").exec(Yo.toString())[1];this.worker=new Worker(URL.createObjectURL(new Blob([D],{type:"text/javascript"})));let A=(S=this.canvas)==null?void 0:S.transferControlToOffscreen(),H=await this.wasmBinary;return console.warn("worker mode",H),this.worker.postMessage({type:"init",canvas:A,wasmScript:this.createModule.toString(),wasmBinary:H},A?[A,H]:[H]),new Promise(I=>{this.worker.onmessage=C=>{if(C.data.type==="ready")delete this.wasmBinary,I(),console.warn("worker mode initialize success");else if(C.data.type==="yuvData"){let{videoFrame:F}=C.data;this.emit("videoFrame",F)}}})}let v=this.module;return this.wasmBinary&&(v.wasmBinary=await this.wasmBinary),v.print=D=>console.log(D),v.printErr=D=>console.log(`[JS] ERROR: ${D}`),v.onAbort=()=>console.log("[JS] FATAL: WASM ABORTED"),new Promise(D=>{v.postRun=A=>{this.decoder=new this.module.VideoDecoder(this),console.log("video soft decoder initialize success"),D()},s&&Object.assign(v,s),this.createModule(v)})}configure(s){var v,S,D;this.config=s,(S=this.decoder)==null||S.setCodec(this.config.codec,this.config.description?"avcc":"annexb",(v=this.config.description)!=null?v:""),(D=this.worker)==null||D.postMessage({type:"setCodec",codec:this.config.codec,format:this.config.description?"avcc":"annexb",description:this.config.description})}decode(s){var v,S;(v=this.decoder)==null||v.decode(s.data,s.type=="key",s.timestamp),this.state==="configured"&&((S=this.worker)==null||S.postMessage({type:"decode",packet:s}))}flush(){}reset(){this.config=void 0,this.decoder&&this.decoder.clear()}close(){this.removeAllListeners(),this.decoder&&(this.decoder.clear(),this.decoder.delete())}videoInfo(s,v){this.width=s,this.height=v;let S={width:s,height:v};this.emit("videoCodecInfo",S)}yuvData(s,v){if(!this.module)return;let S=this.width*this.height,D=S>>2,A=this.module.HEAPU32[s>>2],H=this.module.HEAPU32[(s>>2)+1],I=this.module.HEAPU32[(s>>2)+2],C=this.module.HEAPU8.subarray(A,A+S),F=this.module.HEAPU8.subarray(H,H+D),L=this.module.HEAPU8.subarray(I,I+D);if(this.yuvMode){this.emit("videoFrame",[C,F,L]);return}let W=new Uint8Array(S+D+D);W.set(C),W.set(F,S),W.set(L,S+D),this.emit("videoFrame",new VideoFrame(W,{codedWidth:this.width,codedHeight:this.height,format:"I420",timestamp:v}))}errorInfo(s){let v={errMsg:s};this.emit("error",v)}};Le([je([ce.INIT,"closed"],"initialized")],Ge.prototype,"initialize",1),Le([je("initialized","configured")],Ge.prototype,"configure",1),Le([je([],ce.INIT)],Ge.prototype,"reset",1),Le([je([],"closed")],Ge.prototype,"close",1);var Jo=(()=>{var b=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return function(p={}){var s=p,v,S;s.ready=new Promise((e,r)=>{v=e,S=r});var D=Object.assign({},s),A=[],H="./this.program",I=(e,r)=>{throw r},C=typeof window=="object",F=typeof importScripts=="function",L=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",W="";function me(e){return s.locateFile?s.locateFile(e,W):W+e}var Re,Me,q,ze;(C||F)&&(F?W=self.location.href:typeof document!="undefined"&&document.currentScript&&(W=document.currentScript.src),b&&(W=b),W.indexOf("blob:")!==0?W=W.substr(0,W.replace(/[?#].*/,"").lastIndexOf("/")+1):W="",Re=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},F&&(q=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Me=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{if(n.status==200||n.status==0&&n.response){r(n.response);return}t()},n.onerror=t,n.send(null)},ze=e=>document.title=e);var lr=s.print||console.log.bind(console),ae=s.printErr||console.error.bind(console);Object.assign(s,D),D=null,s.arguments&&(A=s.arguments),s.thisProgram&&(H=s.thisProgram),s.quit&&(I=s.quit);var he;s.wasmBinary&&(he=s.wasmBinary);var Io=s.noExitRuntime||!0;typeof WebAssembly!="object"&&Fe("no native wasm support detected");var $r,ee,Lr=!1,dn;function Ke(e,r){e||Fe(r)}var Y,ie,we,Se,U,X,Mr,mt;function ht(){var e=$r.buffer;s.HEAP8=Y=new Int8Array(e),s.HEAP16=we=new Int16Array(e),s.HEAP32=U=new Int32Array(e),s.HEAPU8=ie=new Uint8Array(e),s.HEAPU16=Se=new Uint16Array(e),s.HEAPU32=X=new Uint32Array(e),s.HEAPF32=Mr=new Float32Array(e),s.HEAPF64=mt=new Float64Array(e)}var Fr,Br=[],Hr=[],vt=[],fn=!1;function pn(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)vn(s.preRun.shift());Gr(Br)}function mn(){fn=!0,!s.noFSInit&&!a.init.initialized&&a.init(),a.ignorePermissions=!1,Be.init(),Gr(Hr)}function hn(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)Xe(s.postRun.shift());Gr(vt)}function vn(e){Br.unshift(e)}function gn(e){Hr.unshift(e)}function Xe(e){vt.unshift(e)}var Ie=0,qe=null,dr=null;function fo(e){return e}function ir(e){Ie++,s.monitorRunDependencies&&s.monitorRunDependencies(Ie)}function wr(e){if(Ie--,s.monitorRunDependencies&&s.monitorRunDependencies(Ie),Ie==0&&(qe!==null&&(clearInterval(qe),qe=null),dr)){var r=dr;dr=null,r()}}function Fe(e){s.onAbort&&s.onAbort(e),e="Aborted("+e+")",ae(e),Lr=!0,dn=1,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw S(r),r}var ar="data:application/octet-stream;base64,";function Wr(e){return e.startsWith(ar)}var sr;sr="videodec.wasm",Wr(sr)||(sr=me(sr));function Vr(e){if(e==sr&&he)return new Uint8Array(he);if(q)return q(e);throw"both async and sync fetching of the wasm failed"}function yn(e){return!he&&(C||F)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(r=>{if(!r.ok)throw"failed to load wasm binary file at '"+e+"'";return r.arrayBuffer()}).catch(()=>Vr(e)):Promise.resolve().then(()=>Vr(e))}function gt(e,r,t){return yn(e).then(n=>WebAssembly.instantiate(n,r)).then(n=>n).then(t,n=>{ae("failed to asynchronously prepare wasm: "+n),Fe(n)})}function jr(e,r,t,n){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Wr(r)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(u=>{var l=WebAssembly.instantiateStreaming(u,t);return l.then(n,function(f){return ae("wasm streaming compile failed: "+f),ae("falling back to ArrayBuffer instantiation"),gt(r,t,n)})}):gt(r,t,n)}function _n(){var e={a:ko};function r(n,u){var l=n.exports;return ee=l,$r=ee.E,ht(),Fr=ee.H,gn(ee.F),wr("wasm-instantiate"),l}ir("wasm-instantiate");function t(n){r(n.instance)}if(s.instantiateWasm)try{return s.instantiateWasm(e,r)}catch(n){ae("Module.instantiateWasm callback failed with error: "+n),S(n)}return jr(he,sr,e,t).catch(S),{}}var N,Q,Gr=e=>{for(;e.length>0;)e.shift()(s)};function bn(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(r){X[this.ptr+4>>2]=r},this.get_type=function(){return X[this.ptr+4>>2]},this.set_destructor=function(r){X[this.ptr+8>>2]=r},this.get_destructor=function(){return X[this.ptr+8>>2]},this.set_caught=function(r){r=r?1:0,Y[this.ptr+12>>0]=r},this.get_caught=function(){return Y[this.ptr+12>>0]!=0},this.set_rethrown=function(r){r=r?1:0,Y[this.ptr+13>>0]=r},this.get_rethrown=function(){return Y[this.ptr+13>>0]!=0},this.init=function(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)},this.set_adjusted_ptr=function(r){X[this.ptr+16>>2]=r},this.get_adjusted_ptr=function(){return X[this.ptr+16>>2]},this.get_exception_ptr=function(){var r=go(this.get_type());if(r)return X[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var Sr=0,Tn=0;function yt(e,r,t){var n=new bn(e);throw n.init(r,t),Sr=e,Tn++,Sr}var ve=e=>(U[ho()>>2]=e,e),G={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 u=e[n];u==="."?e.splice(n,1):u===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=G.isAbs(e),t=e.substr(-1)==="/";return e=G.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=G.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=G.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments);return G.normalize(e.join("/"))},join2:(e,r)=>G.normalize(e+"/"+r)},Ye=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);Fe("initRandomDevice")},fr=e=>(fr=Ye())(e),le={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:a.cwd();if(typeof n!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=G.isAbs(n)}return e=G.normalizeArray(e.split("/").filter(u=>!!u),!r).join("/"),(r?"/":"")+e||"."},relative:(e,r)=>{e=le.resolve(e).substr(1),r=le.resolve(r).substr(1);function t(h){for(var R=0;R<h.length&&h[R]==="";R++);for(var x=h.length-1;x>=0&&h[x]==="";x--);return R>x?[]:h.slice(R,x-R+1)}for(var n=t(e.split("/")),u=t(r.split("/")),l=Math.min(n.length,u.length),f=l,d=0;d<l;d++)if(n[d]!==u[d]){f=d;break}for(var y=[],d=f;d<n.length;d++)y.push("..");return y=y.concat(u.slice(f)),y.join("/")}},z=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0,Je=(e,r,t)=>{for(var n=r+t,u=r;e[u]&&!(u>=n);)++u;if(u-r>16&&e.buffer&&z)return z.decode(e.subarray(r,u));for(var l="";r<u;){var f=e[r++];if(!(f&128)){l+=String.fromCharCode(f);continue}var d=e[r++]&63;if((f&224)==192){l+=String.fromCharCode((f&31)<<6|d);continue}var y=e[r++]&63;if((f&240)==224?f=(f&15)<<12|d<<6|y:f=(f&7)<<18|d<<12|y<<6|e[r++]&63,f<65536)l+=String.fromCharCode(f);else{var h=f-65536;l+=String.fromCharCode(55296|h>>10,56320|h&1023)}}return l},ur=[],Ze=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},zr=(e,r,t,n)=>{if(!(n>0))return 0;for(var u=t,l=t+n-1,f=0;f<e.length;++f){var d=e.charCodeAt(f);if(d>=55296&&d<=57343){var y=e.charCodeAt(++f);d=65536+((d&1023)<<10)|y&1023}if(d<=127){if(t>=l)break;r[t++]=d}else if(d<=2047){if(t+1>=l)break;r[t++]=192|d>>6,r[t++]=128|d&63}else if(d<=65535){if(t+2>=l)break;r[t++]=224|d>>12,r[t++]=128|d>>6&63,r[t++]=128|d&63}else{if(t+3>=l)break;r[t++]=240|d>>18,r[t++]=128|d>>12&63,r[t++]=128|d>>6&63,r[t++]=128|d&63}}return r[t]=0,t-u};function Ae(e,r,t){var n=t>0?t:Ze(e)+1,u=new Array(n),l=zr(e,u,0,u.length);return r&&(u.length=l),u}var En=()=>{if(!ur.length){var e=null;if(typeof window!="undefined"&&typeof window.prompt=="function"?(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
2
|
-
`)):typeof readline=="function"&&(e=readline(),e!==null&&(e+=`
|
|
3
|
-
`)),!e)return null;ur=Ae(e,!0)}return ur.shift()},Be={ttys:[],init:function(){},shutdown:function(){},register:function(e,r){Be.ttys[e]={input:[],output:[],ops:r},a.registerDevice(e,Be.stream_ops)},stream_ops:{open:function(e){var r=Be.ttys[e.node.rdev];if(!r)throw new a.ErrnoError(43);e.tty=r,e.seekable=!1},close:function(e){e.tty.ops.fsync(e.tty)},fsync:function(e){e.tty.ops.fsync(e.tty)},read:function(e,r,t,n,u){if(!e.tty||!e.tty.ops.get_char)throw new a.ErrnoError(60);for(var l=0,f=0;f<n;f++){var d;try{d=e.tty.ops.get_char(e.tty)}catch(y){throw new a.ErrnoError(29)}if(d===void 0&&l===0)throw new a.ErrnoError(6);if(d==null)break;l++,r[t+f]=d}return l&&(e.node.timestamp=Date.now()),l},write:function(e,r,t,n,u){if(!e.tty||!e.tty.ops.put_char)throw new a.ErrnoError(60);try{for(var l=0;l<n;l++)e.tty.ops.put_char(e.tty,r[t+l])}catch(f){throw new a.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),l}},default_tty_ops:{get_char:function(e){return En()},put_char:function(e,r){r===null||r===10?(lr(Je(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync:function(e){e.output&&e.output.length>0&&(lr(Je(e.output,0)),e.output=[])},ioctl_tcgets:function(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:function(e,r,t){return 0},ioctl_tiocgwinsz:function(e){return[24,80]}},default_tty1_ops:{put_char:function(e,r){r===null||r===10?(ae(Je(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync:function(e){e.output&&e.output.length>0&&(ae(Je(e.output,0)),e.output=[])}}},_t=e=>{Fe()},M={ops_table:null,mount(e){return M.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(a.isBlkdev(t)||a.isFIFO(t))throw new a.ErrnoError(63);M.ops_table||(M.ops_table={dir:{node:{getattr:M.node_ops.getattr,setattr:M.node_ops.setattr,lookup:M.node_ops.lookup,mknod:M.node_ops.mknod,rename:M.node_ops.rename,unlink:M.node_ops.unlink,rmdir:M.node_ops.rmdir,readdir:M.node_ops.readdir,symlink:M.node_ops.symlink},stream:{llseek:M.stream_ops.llseek}},file:{node:{getattr:M.node_ops.getattr,setattr:M.node_ops.setattr},stream:{llseek:M.stream_ops.llseek,read:M.stream_ops.read,write:M.stream_ops.write,allocate:M.stream_ops.allocate,mmap:M.stream_ops.mmap,msync:M.stream_ops.msync}},link:{node:{getattr:M.node_ops.getattr,setattr:M.node_ops.setattr,readlink:M.node_ops.readlink},stream:{}},chrdev:{node:{getattr:M.node_ops.getattr,setattr:M.node_ops.setattr},stream:a.chrdev_stream_ops}});var u=a.createNode(e,r,t,n);return a.isDir(u.mode)?(u.node_ops=M.ops_table.dir.node,u.stream_ops=M.ops_table.dir.stream,u.contents={}):a.isFile(u.mode)?(u.node_ops=M.ops_table.file.node,u.stream_ops=M.ops_table.file.stream,u.usedBytes=0,u.contents=null):a.isLink(u.mode)?(u.node_ops=M.ops_table.link.node,u.stream_ops=M.ops_table.link.stream):a.isChrdev(u.mode)&&(u.node_ops=M.ops_table.chrdev.node,u.stream_ops=M.ops_table.chrdev.stream),u.timestamp=Date.now(),e&&(e.contents[r]=u,e.timestamp=u.timestamp),u},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 u=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(u.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&&M.resizeFileStorage(e,r.size)},lookup(e,r){throw a.genericErrors[44]},mknod(e,r,t,n){return M.createNode(e,r,t,n)},rename(e,r,t){if(a.isDir(e.mode)){var n;try{n=a.lookupNode(r,t)}catch(l){}if(n)for(var u 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,e.parent=r},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 in e.contents)e.contents.hasOwnProperty(t)&&r.push(t);return r},symlink(e,r,t){var n=M.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,u){var l=e.node.contents;if(u>=e.node.usedBytes)return 0;var f=Math.min(e.node.usedBytes-u,n);if(f>8&&l.subarray)r.set(l.subarray(u,u+f),t);else for(var d=0;d<f;d++)r[t+d]=l[u+d];return f},write(e,r,t,n,u,l){if(!n)return 0;var f=e.node;if(f.timestamp=Date.now(),r.subarray&&(!f.contents||f.contents.subarray)){if(l)return f.contents=r.subarray(t,t+n),f.usedBytes=n,n;if(f.usedBytes===0&&u===0)return f.contents=r.slice(t,t+n),f.usedBytes=n,n;if(u+n<=f.usedBytes)return f.contents.set(r.subarray(t,t+n),u),n}if(M.expandFileStorage(f,u+n),f.contents.subarray&&r.subarray)f.contents.set(r.subarray(t,t+n),u);else for(var d=0;d<n;d++)f.contents[u+d]=r[t+d];return f.usedBytes=Math.max(f.usedBytes,u+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){M.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap(e,r,t,n,u){if(!a.isFile(e.node.mode))throw new a.ErrnoError(43);var l,f,d=e.node.contents;if(!(u&2)&&d.buffer===Y.buffer)f=!1,l=d.byteOffset;else{if((t>0||t+r<d.length)&&(d.subarray?d=d.subarray(t,t+r):d=Array.prototype.slice.call(d,t,t+r)),f=!0,l=_t(r),!l)throw new a.ErrnoError(48);Y.set(d,l)}return{ptr:l,allocated:f}},msync(e,r,t,n,u){return M.stream_ops.write(e,r,0,n,t,!1),0}}},Kr=(e,r,t,n)=>{var u=n?"":`al ${e}`;Me(e,l=>{Ke(l,`Loading data file "${e}" failed (no arrayBuffer).`),r(new Uint8Array(l)),u&&wr(u)},l=>{if(t)t();else throw`Loading data file "${e}" failed.`}),u&&ir(u)},bt=s.preloadPlugins||[];function wn(e,r,t,n){typeof Browser!="undefined"&&Browser.init();var u=!1;return bt.forEach(function(l){u||l.canHandle(r)&&(l.handle(e,r,t,n),u=!0)}),u}function Tt(e,r,t,n,u,l,f,d,y,h){var R=r?le.resolve(G.join2(e,r)):e,x=`cp ${R}`;function k(P){function $(Z){h&&h(),d||a.createDataFile(e,r,Z,n,u,y),l&&l(),wr(x)}wn(P,R,$,()=>{f&&f(),wr(x)})||$(P)}ir(x),typeof t=="string"?Kr(t,P=>k(P),f):k(t)}function Et(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}function Ar(e,r){var t=0;return e&&(t|=365),r&&(t|=146),t}var a={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(e,r={})=>{if(e=le.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(x=>!!x),u=a.root,l="/",f=0;f<n.length;f++){var d=f===n.length-1;if(d&&r.parent)break;if(u=a.lookupNode(u,n[f]),l=G.join2(l,n[f]),a.isMountpoint(u)&&(!d||d&&r.follow_mount)&&(u=u.mounted.root),!d||r.follow)for(var y=0;a.isLink(u.mode);){var h=a.readlink(l);l=le.resolve(G.dirname(l),h);var R=a.lookupPath(l,{recurse_count:r.recurse_count+1});if(u=R.node,y++>40)throw new a.ErrnoError(32)}}return{path:l,node:u}},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,e);for(var n=a.hashName(e.id,r),u=a.nameTable[n];u;u=u.name_next){var l=u.name;if(u.parent.id===e.id&&l===r)return u}return a.lookup(e,r)},createNode:(e,r,t,n)=>{var u=new a.FSNode(e,r,t,n);return a.hashAddNode(u),u},destroyNode:e=>{a.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>(e&61440)===32768,isDir:e=>(e&61440)===16384,isLink:e=>(e&61440)===40960,isChrdev:e=>(e&61440)===8192,isBlkdev:e=>(e&61440)===24576,isFIFO:e=>(e&61440)===4096,isSocket:e=>(e&49152)===49152,flagsToPermissionString:e=>{var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions:(e,r)=>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=>{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(l){return l.errno}var u=a.nodePermissions(e,"wx");if(u)return u;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)=>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)=>(a.FSStream||(a.FSStream=function(){this.shared={}},a.FSStream.prototype={},Object.defineProperties(a.FSStream.prototype,{object:{get(){return this.node},set(t){this.node=t}},isRead:{get(){return(this.flags&2097155)!==1}},isWrite:{get(){return(this.flags&2097155)!==0}},isAppend:{get(){return this.flags&1024}},flags:{get(){return this.shared.flags},set(t){this.shared.flags=t}},position:{get(){return this.shared.position},set(t){this.shared.position=t}}})),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},chrdev_stream_ops:{open:e=>{var r=a.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(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.apply(t,n.mounts)}return r},syncfs:(e,r)=>{typeof e=="function"&&(r=e,e=!1),a.syncFSRequests++,a.syncFSRequests>1&&ae(`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 u(f){return a.syncFSRequests--,r(f)}function l(f){if(f)return l.errored?void 0:(l.errored=!0,u(f));++n>=t.length&&u(null)}t.forEach(f=>{if(!f.type.syncfs)return l(null);f.type.syncfs(f,e,l)})},mount:(e,r,t)=>{var n=t==="/",u=!t,l;if(n&&a.root)throw new a.ErrnoError(10);if(!n&&!u){var f=a.lookupPath(t,{follow_mount:!1});if(t=f.path,l=f.node,a.isMountpoint(l))throw new a.ErrnoError(10);if(!a.isDir(l.mode))throw new a.ErrnoError(54)}var d={type:e,opts:r,mountpoint:t,mounts:[]},y=e.mount(d);return y.mount=d,d.root=y,n?a.root=y:l&&(l.mounted=d,l.mount&&l.mount.mounts.push(d)),y},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,u=a.getMounts(n);Object.keys(a.nameTable).forEach(f=>{for(var d=a.nameTable[f];d;){var y=d.name_next;u.includes(d.mount)&&a.destroyNode(d),d=y}}),t.mounted=null;var l=t.mount.mounts.indexOf(n);t.mount.mounts.splice(l,1)},lookup:(e,r)=>e.node_ops.lookup(e,r),mknod:(e,r,t)=>{var n=a.lookupPath(e,{parent:!0}),u=n.node,l=G.basename(e);if(!l||l==="."||l==="..")throw new a.ErrnoError(28);var f=a.mayCreate(u,l);if(f)throw new a.ErrnoError(f);if(!u.node_ops.mknod)throw new a.ErrnoError(63);return u.node_ops.mknod(u,l,r,t)},create:(e,r)=>(r=r!==void 0?r:438,r&=4095,r|=32768,a.mknod(e,r,0)),mkdir:(e,r)=>(r=r!==void 0?r:511,r&=1023,r|=16384,a.mknod(e,r,0)),mkdirTree:(e,r)=>{for(var t=e.split("/"),n="",u=0;u<t.length;++u)if(t[u]){n+="/"+t[u];try{a.mkdir(n,r)}catch(l){if(l.errno!=20)throw l}}},mkdev:(e,r,t)=>(typeof t=="undefined"&&(t=r,r=438),r|=8192,a.mknod(e,r,t)),symlink:(e,r)=>{if(!le.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 u=G.basename(r),l=a.mayCreate(n,u);if(l)throw new a.ErrnoError(l);if(!n.node_ops.symlink)throw new a.ErrnoError(63);return n.node_ops.symlink(n,u,e)},rename:(e,r)=>{var t=G.dirname(e),n=G.dirname(r),u=G.basename(e),l=G.basename(r),f,d,y;if(f=a.lookupPath(e,{parent:!0}),d=f.node,f=a.lookupPath(r,{parent:!0}),y=f.node,!d||!y)throw new a.ErrnoError(44);if(d.mount!==y.mount)throw new a.ErrnoError(75);var h=a.lookupNode(d,u),R=le.relative(e,n);if(R.charAt(0)!==".")throw new a.ErrnoError(28);if(R=le.relative(r,t),R.charAt(0)!==".")throw new a.ErrnoError(55);var x;try{x=a.lookupNode(y,l)}catch($){}if(h!==x){var k=a.isDir(h.mode),P=a.mayDelete(d,u,k);if(P)throw new a.ErrnoError(P);if(P=x?a.mayDelete(y,l,k):a.mayCreate(y,l),P)throw new a.ErrnoError(P);if(!d.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(h)||x&&a.isMountpoint(x))throw new a.ErrnoError(10);if(y!==d&&(P=a.nodePermissions(d,"w"),P))throw new a.ErrnoError(P);a.hashRemoveNode(h);try{d.node_ops.rename(h,y,l)}catch($){throw $}finally{a.hashAddNode(h)}}},rmdir:e=>{var r=a.lookupPath(e,{parent:!0}),t=r.node,n=G.basename(e),u=a.lookupNode(t,n),l=a.mayDelete(t,n,!0);if(l)throw new a.ErrnoError(l);if(!t.node_ops.rmdir)throw new a.ErrnoError(63);if(a.isMountpoint(u))throw new a.ErrnoError(10);t.node_ops.rmdir(t,n),a.destroyNode(u)},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=G.basename(e),u=a.lookupNode(t,n),l=a.mayDelete(t,n,!1);if(l)throw new a.ErrnoError(l);if(!t.node_ops.unlink)throw new a.ErrnoError(63);if(a.isMountpoint(u))throw new a.ErrnoError(10);t.node_ops.unlink(t,n),a.destroyNode(u)},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 le.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=>a.stat(e,!0),chmod:(e,r,t)=>{var n;if(typeof e=="string"){var u=a.lookupPath(e,{follow:!t});n=u.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 u;if(typeof e=="string"){var l=a.lookupPath(e,{follow:!n});u=l.node}else u=e;if(!u.node_ops.setattr)throw new a.ErrnoError(63);u.node_ops.setattr(u,{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 u=a.nodePermissions(t,"w");if(u)throw new a.ErrnoError(u);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate:(e,r)=>{var t=a.getStreamChecked(e);if((t.flags&2097155)===0)throw new a.ErrnoError(28);a.truncate(t.node,r)},utime:(e,r,t)=>{var n=a.lookupPath(e,{follow:!0}),u=n.node;u.node_ops.setattr(u,{timestamp:Math.max(r,t)})},open:(e,r,t)=>{if(e==="")throw new a.ErrnoError(44);r=typeof r=="string"?Et(r):r,t=typeof t=="undefined"?438:t,r&64?t=t&4095|32768:t=0;var n;if(typeof e=="object")n=e;else{e=G.normalize(e);try{var u=a.lookupPath(e,{follow:!(r&131072)});n=u.node}catch(y){}}var l=!1;if(r&64)if(n){if(r&128)throw new a.ErrnoError(20)}else n=a.mknod(e,t,0),l=!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(!l){var f=a.mayOpen(n,r);if(f)throw new a.ErrnoError(f)}r&512&&!l&&a.truncate(n,0),r&=-131713;var d=a.createStream({node:n,path:a.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return d.stream_ops.open&&d.stream_ops.open(d),s.logReadFiles&&!(r&1)&&(a.readFiles||(a.readFiles={}),e in a.readFiles||(a.readFiles[e]=1)),d},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=>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,u)=>{if(n<0||u<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 l=typeof u!="undefined";if(!l)u=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var f=e.stream_ops.read(e,r,t,n,u);return l||(e.position+=f),f},write:(e,r,t,n,u,l)=>{if(n<0||u<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===0)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 f=typeof u!="undefined";if(!f)u=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var d=e.stream_ops.write(e,r,t,n,u,l);return f||(e.position+=d),d},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)===0)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,u)=>{if((n&2)!==0&&(u&2)===0&&(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,u)},msync:(e,r,t,n,u)=>e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,u):0,munmap:e=>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),u=a.stat(e),l=u.size,f=new Uint8Array(l);return a.read(n,f,0,l,0),r.encoding==="utf8"?t=Je(f,0):r.encoding==="binary"&&(t=f),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 u=new Uint8Array(Ze(r)+1),l=zr(r,u,0,u.length);a.write(n,u,0,l,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,u,l,f,d)=>f}),a.mkdev("/dev/null",a.makedev(1,3)),Be.register(a.makedev(5,0),Be.default_tty_ops),Be.register(a.makedev(6,0),Be.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=fr(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 u=+n,l=a.getStreamChecked(u),f={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>l.path}};return f.parent=f,f}},r}},{},"/proc/self/fd")},createStandardStreams:()=>{s.stdin?a.createDevice("/dev","stdin",s.stdin):a.symlink("/dev/tty","/dev/stdin"),s.stdout?a.createDevice("/dev","stdout",null,s.stdout):a.symlink("/dev/tty","/dev/stdout"),s.stderr?a.createDevice("/dev","stderr",null,s.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)},ensureErrnoError:()=>{a.ErrnoError||(a.ErrnoError=function(r,t){this.name="ErrnoError",this.node=t,this.setErrno=function(n){this.errno=n},this.setErrno(r),this.message="FS error"},a.ErrnoError.prototype=new Error,a.ErrnoError.prototype.constructor=a.ErrnoError,[44].forEach(e=>{a.genericErrors[e]=new a.ErrnoError(e),a.genericErrors[e].stack="<generic error, no stack>"}))},staticInit:()=>{a.ensureErrnoError(),a.nameTable=new Array(4096),a.mount(M,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:M}},init:(e,r,t)=>{a.init.initialized=!0,a.ensureErrnoError(),s.stdin=e||s.stdin,s.stdout=r||s.stdout,s.stderr=t||s.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(u){}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=G.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(u){n.error=u.errno}return n},createPath:(e,r,t,n)=>{e=typeof e=="string"?e:a.getPath(e);for(var u=r.split("/").reverse();u.length;){var l=u.pop();if(l){var f=G.join2(e,l);try{a.mkdir(f)}catch(d){}e=f}}return f},createFile:(e,r,t,n,u)=>{var l=G.join2(typeof e=="string"?e:a.getPath(e),r),f=Ar(n,u);return a.create(l,f)},createDataFile:(e,r,t,n,u,l)=>{var f=r;e&&(e=typeof e=="string"?e:a.getPath(e),f=r?G.join2(e,r):e);var d=Ar(n,u),y=a.create(f,d);if(t){if(typeof t=="string"){for(var h=new Array(t.length),R=0,x=t.length;R<x;++R)h[R]=t.charCodeAt(R);t=h}a.chmod(y,d|146);var k=a.open(y,577);a.write(k,t,0,t.length,0,l),a.close(k),a.chmod(y,d)}return y},createDevice:(e,r,t,n)=>{var u=G.join2(typeof e=="string"?e:a.getPath(e),r),l=Ar(!!t,!!n);a.createDevice.major||(a.createDevice.major=64);var f=a.makedev(a.createDevice.major++,0);return a.registerDevice(f,{open:d=>{d.seekable=!1},close:d=>{n&&n.buffer&&n.buffer.length&&n(10)},read:(d,y,h,R,x)=>{for(var k=0,P=0;P<R;P++){var $;try{$=t()}catch(Z){throw new a.ErrnoError(29)}if($===void 0&&k===0)throw new a.ErrnoError(6);if($==null)break;k++,y[h+P]=$}return k&&(d.node.timestamp=Date.now()),k},write:(d,y,h,R,x)=>{for(var k=0;k<R;k++)try{n(y[h+k])}catch(P){throw new a.ErrnoError(29)}return R&&(d.node.timestamp=Date.now()),k}}),a.mkdev(u,l,f)},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(Re)try{e.contents=Ae(Re(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,u)=>{function l(){this.lengthKnown=!1,this.chunks=[]}if(l.prototype.get=function(P){if(!(P>this.length-1||P<0)){var $=P%this.chunkSize,Z=P/this.chunkSize|0;return this.getter(Z)[$]}},l.prototype.setDataGetter=function(P){this.getter=P},l.prototype.cacheLength=function(){var P=new XMLHttpRequest;if(P.open("HEAD",t,!1),P.send(null),!(P.status>=200&&P.status<300||P.status===304))throw new Error("Couldn't load "+t+". Status: "+P.status);var $=Number(P.getResponseHeader("Content-length")),Z,re=(Z=P.getResponseHeader("Accept-Ranges"))&&Z==="bytes",se=(Z=P.getResponseHeader("Content-Encoding"))&&Z==="gzip",be=1024*1024;re||(be=$);var oe=(Ce,nr)=>{if(Ce>nr)throw new Error("invalid range ("+Ce+", "+nr+") or no bytes requested!");if(nr>$-1)throw new Error("only "+$+" bytes available! programmer error!");var ue=new XMLHttpRequest;if(ue.open("GET",t,!1),$!==be&&ue.setRequestHeader("Range","bytes="+Ce+"-"+nr),ue.responseType="arraybuffer",ue.overrideMimeType&&ue.overrideMimeType("text/plain; charset=x-user-defined"),ue.send(null),!(ue.status>=200&&ue.status<300||ue.status===304))throw new Error("Couldn't load "+t+". Status: "+ue.status);return ue.response!==void 0?new Uint8Array(ue.response||[]):Ae(ue.responseText||"",!0)},br=this;br.setDataGetter(Ce=>{var nr=Ce*be,ue=(Ce+1)*be-1;if(ue=Math.min(ue,$-1),typeof br.chunks[Ce]=="undefined"&&(br.chunks[Ce]=oe(nr,ue)),typeof br.chunks[Ce]=="undefined")throw new Error("doXHR failed!");return br.chunks[Ce]}),(se||!$)&&(be=$=1,$=this.getter(0).length,be=$,lr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=$,this._chunkSize=be,this.lengthKnown=!0},typeof XMLHttpRequest!="undefined"){if(!F)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var f=new l;Object.defineProperties(f,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var d={isDevice:!1,contents:f}}else var d={isDevice:!1,url:t};var y=a.createFile(e,r,d,n,u);d.contents?y.contents=d.contents:d.url&&(y.contents=null,y.url=d.url),Object.defineProperties(y,{usedBytes:{get:function(){return this.contents.length}}});var h={},R=Object.keys(y.stream_ops);R.forEach(k=>{var P=y.stream_ops[k];h[k]=function(){return a.forceLoadFile(y),P.apply(null,arguments)}});function x(k,P,$,Z,re){var se=k.node.contents;if(re>=se.length)return 0;var be=Math.min(se.length-re,Z);if(se.slice)for(var oe=0;oe<be;oe++)P[$+oe]=se[re+oe];else for(var oe=0;oe<be;oe++)P[$+oe]=se.get(re+oe);return be}return h.read=(k,P,$,Z,re)=>(a.forceLoadFile(y),x(k,P,$,Z,re)),h.mmap=(k,P,$,Z,re)=>{a.forceLoadFile(y);var se=_t(P);if(!se)throw new a.ErrnoError(48);return x(k,Y,se,P,$),{ptr:se,allocated:!0}},y.stream_ops=h,y}},wt=(e,r)=>e?Je(ie,e,r):"",te={DEFAULT_POLLMASK:5,calculateAt:function(e,r,t){if(G.isAbs(r))return r;var n;if(e===-100)n=a.cwd();else{var u=te.getStreamFromFD(e);n=u.path}if(r.length==0){if(!t)throw new a.ErrnoError(44);return n}return G.join2(n,r)},doStat:function(e,r,t){try{var n=e(r)}catch(d){if(d&&d.node&&G.normalize(r)!==G.normalize(a.getPath(d.node)))return-54;throw d}U[t>>2]=n.dev,U[t+4>>2]=n.mode,X[t+8>>2]=n.nlink,U[t+12>>2]=n.uid,U[t+16>>2]=n.gid,U[t+20>>2]=n.rdev,Q=[n.size>>>0,(N=n.size,+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[t+24>>2]=Q[0],U[t+28>>2]=Q[1],U[t+32>>2]=4096,U[t+36>>2]=n.blocks;var u=n.atime.getTime(),l=n.mtime.getTime(),f=n.ctime.getTime();return Q=[Math.floor(u/1e3)>>>0,(N=Math.floor(u/1e3),+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[t+40>>2]=Q[0],U[t+44>>2]=Q[1],X[t+48>>2]=u%1e3*1e3,Q=[Math.floor(l/1e3)>>>0,(N=Math.floor(l/1e3),+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[t+56>>2]=Q[0],U[t+60>>2]=Q[1],X[t+64>>2]=l%1e3*1e3,Q=[Math.floor(f/1e3)>>>0,(N=Math.floor(f/1e3),+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[t+72>>2]=Q[0],U[t+76>>2]=Q[1],X[t+80>>2]=f%1e3*1e3,Q=[n.ino>>>0,(N=n.ino,+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[t+88>>2]=Q[0],U[t+92>>2]=Q[1],0},doMsync:function(e,r,t,n,u){if(!a.isFile(r.node.mode))throw new a.ErrnoError(43);if(n&2)return 0;var l=ie.slice(e,e+t);a.msync(r,l,u,t,n)},varargs:void 0,get(){te.varargs+=4;var e=U[te.varargs-4>>2];return e},getStr(e){var r=wt(e);return r},getStreamFromFD:function(e){var r=a.getStreamChecked(e);return r}};function Xr(e,r,t){te.varargs=t;try{var n=te.getStreamFromFD(e);switch(r){case 0:{var u=te.get();if(u<0)return-28;var l;return l=a.createStream(n,u),l.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var u=te.get();return n.flags|=u,0}case 5:{var u=te.get(),f=0;return we[u+f>>1]=2,0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:return ve(28),-1;default:return-28}}catch(d){if(typeof a=="undefined"||d.name!=="ErrnoError")throw d;return-d.errno}}function pr(e,r,t,n){te.varargs=n;try{r=te.getStr(r),r=te.calculateAt(e,r);var u=n?te.get():0;return a.open(r,t,u).fd}catch(l){if(typeof a=="undefined"||l.name!=="ErrnoError")throw l;return-l.errno}}function Sn(e,r,t,n,u){}function qr(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(`Unknown type size: ${e}`)}}function mr(){for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);St=e}var St=void 0;function ge(e){for(var r="",t=e;ie[t];)r+=St[ie[t++]];return r}var Oe={},Qe={},He={},cr=void 0;function K(e){throw new cr(e)}var At=void 0;function Pr(e){throw new At(e)}function hr(e,r,t){e.forEach(function(d){He[d]=r});function n(d){var y=t(d);y.length!==e.length&&Pr("Mismatched type converter count");for(var h=0;h<e.length;++h)ke(e[h],y[h])}var u=new Array(r.length),l=[],f=0;r.forEach((d,y)=>{Qe.hasOwnProperty(d)?u[y]=Qe[d]:(l.push(d),Oe.hasOwnProperty(d)||(Oe[d]=[]),Oe[d].push(()=>{u[y]=Qe[d],++f,f===l.length&&n(u)}))}),l.length===0&&n(u)}function We(e,r,t={}){var n=r.name;if(e||K(`type "${n}" must have a positive integer typeid pointer`),Qe.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;K(`Cannot register type '${n}' twice`)}if(Qe[e]=r,delete He[e],Oe.hasOwnProperty(e)){var u=Oe[e];delete Oe[e],u.forEach(l=>l())}}function ke(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return We(e,r,t)}function An(e,r,t,n,u){var l=qr(t);r=ge(r),ke(e,{name:r,fromWireType:function(f){return!!f},toWireType:function(f,d){return d?n:u},argPackAdvance:8,readValueFromPointer:function(f){var d;if(t===1)d=Y;else if(t===2)d=we;else if(t===4)d=U;else throw new TypeError("Unknown boolean type size: "+r);return this.fromWireType(d[f>>l])},destructorFunction:null})}function Cr(e){if(!(this instanceof Ue)||!(e instanceof Ue))return!1;for(var r=this.$$.ptrType.registeredClass,t=this.$$.ptr,n=e.$$.ptrType.registeredClass,u=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)u=n.upcast(u),n=n.baseClass;return r===n&&t===u}function Yr(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function Rr(e){function r(t){return t.$$.ptrType.registeredClass.name}K(r(e)+" instance already deleted")}var Jr=!1;function Pt(e){}function Zr(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function Ct(e){e.count.value-=1;var r=e.count.value===0;r&&Zr(e)}function Rt(e,r,t){if(r===t)return e;if(t.baseClass===void 0)return null;var n=Rt(e,r,t.baseClass);return n===null?null:t.downcast(n)}var Dt={};function Dr(){return Object.keys(yr).length}function Pn(){var e=[];for(var r in yr)yr.hasOwnProperty(r)&&e.push(yr[r]);return e}var vr=[];function Qr(){for(;vr.length;){var e=vr.pop();e.$$.deleteScheduled=!1,e.delete()}}var gr=void 0;function xe(e){gr=e,vr.length&&gr&&gr(Qr)}function Cn(){s.getInheritedInstanceCount=Dr,s.getLiveInheritedInstances=Pn,s.flushPendingDeletes=Qr,s.setDelayFunction=xe}var yr={};function Ir(e,r){for(r===void 0&&K("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r}function It(e,r){return r=Ir(e,r),yr[r]}function Or(e,r){(!r.ptrType||!r.ptr)&&Pr("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Pr("Both smartPtrType and smartPtr must be specified"),r.count={value:1},De(Object.create(e,{$$:{value:r}}))}function Rn(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=It(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 u(){return this.isSmartPointer?Or(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):Or(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var l=this.registeredClass.getActualType(r),f=Dt[l];if(!f)return u.call(this);var d;this.isConst?d=f.constPointerType:d=f.pointerType;var y=Rt(r,this.registeredClass,d.registeredClass);return y===null?u.call(this):this.isSmartPointer?Or(d.registeredClass.instancePrototype,{ptrType:d,ptr:y,smartPtrType:this,smartPtr:e}):Or(d.registeredClass.instancePrototype,{ptrType:d,ptr:y})}var De=function(e){return typeof FinalizationRegistry=="undefined"?(De=r=>r,e):(Jr=new FinalizationRegistry(r=>{Ct(r.$$)}),De=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var u={$$:t};Jr.register(r,u,r)}return r},Pt=r=>Jr.unregister(r),De(e))};function Dn(){if(this.$$.ptr||Rr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=De(Object.create(Object.getPrototypeOf(this),{$$:{value:Yr(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Ot(){this.$$.ptr||Rr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&K("Object already scheduled for deletion"),Pt(this),Ct(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function kt(){return!this.$$.ptr}function et(){return this.$$.ptr||Rr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&K("Object already scheduled for deletion"),vr.push(this),vr.length===1&&gr&&gr(Qr),this.$$.deleteScheduled=!0,this}function In(){Ue.prototype.isAliasOf=Cr,Ue.prototype.clone=Dn,Ue.prototype.delete=Ot,Ue.prototype.isDeleted=kt,Ue.prototype.deleteLater=et}function Ue(){}var On=48,xt=57;function _r(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=On&&r<=xt?`_${e}`:e}function rt(e,r){return e=_r(e),{[e]:function(){return r.apply(this,arguments)}}[e]}function Ut(e,r,t){if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(){return e[r].overloadTable.hasOwnProperty(arguments.length)||K(`Function '${t}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[arguments.length].apply(this,arguments)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}}function kn(e,r,t){s.hasOwnProperty(e)?((t===void 0||s[e].overloadTable!==void 0&&s[e].overloadTable[t]!==void 0)&&K(`Cannot register public name '${e}' twice`),Ut(s,e,e),s.hasOwnProperty(t)&&K(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),s[e].overloadTable[t]=r):(s[e]=r,t!==void 0&&(s[e].numArguments=t))}function Nt(e,r,t,n,u,l,f,d){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=u,this.getActualType=l,this.upcast=f,this.downcast=d,this.pureVirtualFunctions=[]}function ye(e,r,t){for(;r!==t;)r.upcast||K(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e}function $t(e,r){if(r===null)return this.isReference&&K(`null is not a valid ${this.name}`),0;r.$$||K(`Cannot pass "${it(r)}" as a ${this.name}`),r.$$.ptr||K(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=ye(r.$$.ptr,t,this.registeredClass);return n}function xn(e,r){var t;if(r===null)return this.isReference&&K(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;r.$$||K(`Cannot pass "${it(r)}" as a ${this.name}`),r.$$.ptr||K(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&K(`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=ye(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&K("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:K(`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 u=r.clone();t=this.rawShare(t,xr.toHandle(function(){u.delete()})),e!==null&&e.push(this.rawDestructor,t)}break;default:K("Unsupporting sharing policy")}return t}function Un(e,r){if(r===null)return this.isReference&&K(`null is not a valid ${this.name}`),0;r.$$||K(`Cannot pass "${it(r)}" as a ${this.name}`),r.$$.ptr||K(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&K(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=ye(r.$$.ptr,t,this.registeredClass);return n}function er(e){return this.fromWireType(U[e>>2])}function Nn(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function tt(e){this.rawDestructor&&this.rawDestructor(e)}function $n(e){e!==null&&e.delete()}function Ln(){Ne.prototype.getPointee=Nn,Ne.prototype.destructor=tt,Ne.prototype.argPackAdvance=8,Ne.prototype.readValueFromPointer=er,Ne.prototype.deleteObject=$n,Ne.prototype.fromWireType=Rn}function Ne(e,r,t,n,u,l,f,d,y,h,R){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=u,this.pointeeType=l,this.sharingPolicy=f,this.rawGetPointee=d,this.rawConstructor=y,this.rawShare=h,this.rawDestructor=R,!u&&r.baseClass===void 0?n?(this.toWireType=$t,this.destructorFunction=null):(this.toWireType=Un,this.destructorFunction=null):this.toWireType=xn}function Mn(e,r,t){s.hasOwnProperty(e)||Pr("Replacing nonexistant public symbol"),s[e].overloadTable!==void 0&&t!==void 0?s[e].overloadTable[t]=r:(s[e]=r,s[e].argCount=t)}var Fn=(e,r,t)=>{var n=s["dynCall_"+e];return t&&t.length?n.apply(null,[r].concat(t)):n.call(null,r)},kr=[],Lt=e=>{var r=kr[e];return r||(e>=kr.length&&(kr.length=e+1),kr[e]=r=Fr.get(e)),r},Bn=(e,r,t)=>{if(e.includes("j"))return Fn(e,r,t);var n=Lt(r).apply(null,t);return n},Mt=(e,r)=>{var t=[];return function(){return t.length=0,Object.assign(t,arguments),Bn(e,r,t)}};function rr(e,r){e=ge(e);function t(){return e.includes("j")?Mt(e,r):Lt(r)}var n=t();return typeof n!="function"&&K(`unknown function pointer with signature ${e}: ${r}`),n}function Ft(e,r){var t=rt(r,function(n){this.name=r,this.message=n;var u=new Error(n).stack;u!==void 0&&(this.stack=this.toString()+`
|
|
4
|
-
`+u.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}var Bt=void 0;function nt(e){var r=vo(e),t=ge(r);return tr(r),t}function ot(e,r){var t=[],n={};function u(l){if(!n[l]&&!Qe[l]){if(He[l]){He[l].forEach(u);return}t.push(l),n[l]=!0}}throw r.forEach(u),new Bt(`${e}: `+t.map(nt).join([", "]))}function Hn(e,r,t,n,u,l,f,d,y,h,R,x,k){R=ge(R),l=rr(u,l),d&&(d=rr(f,d)),h&&(h=rr(y,h)),k=rr(x,k);var P=_r(R);kn(P,function(){ot(`Cannot construct ${R} due to unbound types`,[n])}),hr([e,r,t],n?[n]:[],function($){$=$[0];var Z,re;n?(Z=$.registeredClass,re=Z.instancePrototype):re=Ue.prototype;var se=rt(P,function(){if(Object.getPrototypeOf(this)!==be)throw new cr("Use 'new' to construct "+R);if(oe.constructor_body===void 0)throw new cr(R+" has no accessible constructor");var ue=oe.constructor_body[arguments.length];if(ue===void 0)throw new cr(`Tried to invoke ctor of ${R} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(oe.constructor_body).toString()}) parameters instead!`);return ue.apply(this,arguments)}),be=Object.create(re,{constructor:{value:se}});se.prototype=be;var oe=new Nt(R,se,be,k,Z,l,d,h);oe.baseClass&&(oe.baseClass.__derivedClasses===void 0&&(oe.baseClass.__derivedClasses=[]),oe.baseClass.__derivedClasses.push(oe));var br=new Ne(R,oe,!0,!1,!1),Ce=new Ne(R+"*",oe,!1,!1,!1),nr=new Ne(R+" const*",oe,!1,!0,!1);return Dt[e]={pointerType:Ce,constPointerType:nr},Mn(P,se),[br,Ce,nr]})}function Ht(e,r){for(var t=[],n=0;n<e;n++)t.push(X[r+n*4>>2]);return t}function Wn(e){for(;e.length;){var r=e.pop(),t=e.pop();t(r)}}function Wt(e,r){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var t=rt(e.name||"unknownFunctionName",function(){});t.prototype=e.prototype;var n=new t,u=e.apply(n,r);return u instanceof Object?u:n}function Vt(e,r,t,n,u,l){var f=r.length;f<2&&K("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var d=r[1]!==null&&t!==null,y=!1,h=1;h<r.length;++h)if(r[h]!==null&&r[h].destructorFunction===void 0){y=!0;break}for(var R=r[0].name!=="void",x="",k="",h=0;h<f-2;++h)x+=(h!==0?", ":"")+"arg"+h,k+=(h!==0?", ":"")+"arg"+h+"Wired";var P=`
|
|
5
|
-
return function ${_r(e)}(${x}) {
|
|
6
|
-
if (arguments.length !== ${f-2}) {
|
|
7
|
-
throwBindingError('function ${e} called with ${arguments.length} arguments, expected ${f-2} args!');
|
|
8
|
-
}`;y&&(P+=`var destructors = [];
|
|
9
|
-
`);var $=y?"destructors":"null",Z=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],re=[K,n,u,Wn,r[0],r[1]];d&&(P+="var thisWired = classParam.toWireType("+$+`, this);
|
|
10
|
-
`);for(var h=0;h<f-2;++h)P+="var arg"+h+"Wired = argType"+h+".toWireType("+$+", arg"+h+"); // "+r[h+2].name+`
|
|
11
|
-
`,Z.push("argType"+h),re.push(r[h+2]);if(d&&(k="thisWired"+(k.length>0?", ":"")+k),P+=(R||l?"var rv = ":"")+"invoker(fn"+(k.length>0?", ":"")+k+`);
|
|
12
|
-
`,y)P+=`runDestructors(destructors);
|
|
13
|
-
`;else for(var h=d?1:2;h<r.length;++h){var se=h===1?"thisWired":"arg"+(h-2)+"Wired";r[h].destructorFunction!==null&&(P+=se+"_dtor("+se+"); // "+r[h].name+`
|
|
14
|
-
`,Z.push(se+"_dtor"),re.push(r[h].destructorFunction))}return R&&(P+=`var ret = retType.fromWireType(rv);
|
|
15
|
-
return ret;
|
|
16
|
-
`),P+=`}
|
|
17
|
-
`,Z.push(P),Wt(Function,Z).apply(null,re)}function Vn(e,r,t,n,u,l){var f=Ht(r,t);u=rr(n,u),hr([],[e],function(d){d=d[0];var y=`constructor ${d.name}`;if(d.registeredClass.constructor_body===void 0&&(d.registeredClass.constructor_body=[]),d.registeredClass.constructor_body[r-1]!==void 0)throw new cr(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${d.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return d.registeredClass.constructor_body[r-1]=()=>{ot(`Cannot construct ${d.name} due to unbound types`,f)},hr([],f,function(h){return h.splice(1,0,null),d.registeredClass.constructor_body[r-1]=Vt(y,h,null,u,l),[]}),[]})}function jn(e,r,t,n,u,l,f,d,y){var h=Ht(t,n);r=ge(r),l=rr(u,l),hr([],[e],function(R){R=R[0];var x=`${R.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),d&&R.registeredClass.pureVirtualFunctions.push(r);function k(){ot(`Cannot call ${x} due to unbound types`,h)}var P=R.registeredClass.instancePrototype,$=P[r];return $===void 0||$.overloadTable===void 0&&$.className!==R.name&&$.argCount===t-2?(k.argCount=t-2,k.className=R.name,P[r]=k):(Ut(P,r,x),P[r].overloadTable[t-2]=k),hr([],h,function(Z){var re=Vt(x,Z,R,l,f,y);return P[r].overloadTable===void 0?(re.argCount=t-2,P[r]=re):P[r].overloadTable[t-2]=re,[]}),[]})}function Gn(){Object.assign(jt.prototype,{get(e){return this.allocated[e]},has(e){return this.allocated[e]!==void 0},allocate(e){var r=this.freelist.pop()||this.allocated.length;return this.allocated[r]=e,r},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function jt(){this.allocated=[void 0],this.freelist=[]}var _e=new jt;function Gt(e){e>=_e.reserved&&--_e.get(e).refcount===0&&_e.free(e)}function zn(){for(var e=0,r=_e.reserved;r<_e.allocated.length;++r)_e.allocated[r]!==void 0&&++e;return e}function Kn(){_e.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),_e.reserved=_e.allocated.length,s.count_emval_handles=zn}var xr={toValue:e=>(e||K("Cannot use deleted val. handle = "+e),_e.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return _e.allocate({refcount:1,value:e})}}};function zt(e,r){r=ge(r),ke(e,{name:r,fromWireType:function(t){var n=xr.toValue(t);return Gt(t),n},toWireType:function(t,n){return xr.toHandle(n)},argPackAdvance:8,readValueFromPointer:er,destructorFunction:null})}function it(e){if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e}function Xn(e,r){switch(r){case 2:return function(t){return this.fromWireType(Mr[t>>2])};case 3:return function(t){return this.fromWireType(mt[t>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Kt(e,r,t){var n=qr(t);r=ge(r),ke(e,{name:r,fromWireType:function(u){return u},toWireType:function(u,l){return l},argPackAdvance:8,readValueFromPointer:Xn(r,n),destructorFunction:null})}function qn(e,r,t){switch(r){case 0:return t?function(u){return Y[u]}:function(u){return ie[u]};case 1:return t?function(u){return we[u>>1]}:function(u){return Se[u>>1]};case 2:return t?function(u){return U[u>>2]}:function(u){return X[u>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function Yn(e,r,t,n,u){r=ge(r),u===-1&&(u=4294967295);var l=qr(t),f=x=>x;if(n===0){var d=32-8*t;f=x=>x<<d>>>d}var y=r.includes("unsigned"),h=(x,k)=>{},R;y?R=function(x,k){return h(k,this.name),k>>>0}:R=function(x,k){return h(k,this.name),k},ke(e,{name:r,fromWireType:f,toWireType:R,argPackAdvance:8,readValueFromPointer:qn(r,l,n!==0),destructorFunction:null})}function Jn(e,r,t){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],u=n[r];function l(f){f=f>>2;var d=X,y=d[f],h=d[f+1];return new u(d.buffer,h,y)}t=ge(t),ke(e,{name:t,fromWireType:l,argPackAdvance:8,readValueFromPointer:l},{ignoreDuplicateRegistrations:!0})}var Zn=(e,r,t)=>zr(e,ie,r,t);function Qn(e,r){r=ge(r);var t=r==="std::string";ke(e,{name:r,fromWireType:function(n){var u=X[n>>2],l=n+4,f;if(t)for(var d=l,y=0;y<=u;++y){var h=l+y;if(y==u||ie[h]==0){var R=h-d,x=wt(d,R);f===void 0?f=x:(f+="\0",f+=x),d=h+1}}else{for(var k=new Array(u),y=0;y<u;++y)k[y]=String.fromCharCode(ie[l+y]);f=k.join("")}return tr(n),f},toWireType:function(n,u){u instanceof ArrayBuffer&&(u=new Uint8Array(u));var l,f=typeof u=="string";f||u instanceof Uint8Array||u instanceof Uint8ClampedArray||u instanceof Int8Array||K("Cannot pass non-string to std::string"),t&&f?l=Ze(u):l=u.length;var d=ao(4+l+1),y=d+4;if(X[d>>2]=l,t&&f)Zn(u,y,l+1);else if(f)for(var h=0;h<l;++h){var R=u.charCodeAt(h);R>255&&(tr(y),K("String has UTF-16 code units that do not fit in 8 bits")),ie[y+h]=R}else for(var h=0;h<l;++h)ie[y+h]=u[h];return n!==null&&n.push(tr,d),d},argPackAdvance:8,readValueFromPointer:er,destructorFunction:function(n){tr(n)}})}var at=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0,eo=(e,r)=>{for(var t=e,n=t>>1,u=n+r/2;!(n>=u)&&Se[n];)++n;if(t=n<<1,t-e>32&&at)return at.decode(ie.subarray(e,t));for(var l="",f=0;!(f>=r/2);++f){var d=we[e+f*2>>1];if(d==0)break;l+=String.fromCharCode(d)}return l},ro=(e,r,t)=>{if(t===void 0&&(t=2147483647),t<2)return 0;t-=2;for(var n=r,u=t<e.length*2?t/2:e.length,l=0;l<u;++l){var f=e.charCodeAt(l);we[r>>1]=f,r+=2}return we[r>>1]=0,r-n},po=e=>e.length*2,to=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var u=U[e+t*4>>2];if(u==0)break;if(++t,u>=65536){var l=u-65536;n+=String.fromCharCode(55296|l>>10,56320|l&1023)}else n+=String.fromCharCode(u)}return n},$e=(e,r,t)=>{if(t===void 0&&(t=2147483647),t<4)return 0;for(var n=r,u=n+t-4,l=0;l<e.length;++l){var f=e.charCodeAt(l);if(f>=55296&&f<=57343){var d=e.charCodeAt(++l);f=65536+((f&1023)<<10)|d&1023}if(U[r>>2]=f,r+=4,r+4>u)break}return U[r>>2]=0,r-n},st=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},Xt=function(e,r,t){t=ge(t);var n,u,l,f,d;r===2?(n=eo,u=ro,f=po,l=()=>Se,d=1):r===4&&(n=to,u=$e,f=st,l=()=>X,d=2),ke(e,{name:t,fromWireType:function(y){for(var h=X[y>>2],R=l(),x,k=y+4,P=0;P<=h;++P){var $=y+4+P*r;if(P==h||R[$>>d]==0){var Z=$-k,re=n(k,Z);x===void 0?x=re:(x+="\0",x+=re),k=$+r}}return tr(y),x},toWireType:function(y,h){typeof h!="string"&&K(`Cannot pass non-string to C++ string type ${t}`);var R=f(h),x=ao(4+R+r);return X[x>>2]=R>>d,u(h,x+4,R+r),y!==null&&y.push(tr,x),x},argPackAdvance:8,readValueFromPointer:er,destructorFunction:function(y){tr(y)}})};function no(e,r){r=ge(r),ke(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:function(){},toWireType:function(t,n){}})}var oo={};function qt(e){var r=oo[e];return r===void 0?ge(e):r}var ut=[];function Ur(e,r,t,n){e=ut[e],r=xr.toValue(r),t=qt(t),e(r,t,null,n)}function Yt(e){var r=ut.length;return ut.push(e),r}function o(e,r){var t=Qe[e];return t===void 0&&K(r+" has unknown type "+nt(e)),t}function i(e,r){for(var t=new Array(e),n=0;n<e;++n)t[n]=o(X[r+n*4>>2],"parameter "+n);return t}var c=[];function m(e,r){var t=i(e,r),n=t[0],u=n.name+"_$"+t.slice(1).map(function($){return $.name}).join("_")+"$",l=c[u];if(l!==void 0)return l;for(var f=["retType"],d=[n],y="",h=0;h<e-1;++h)y+=(h!==0?", ":"")+"arg"+h,f.push("argType"+h),d.push(t[1+h]);for(var R=_r("methodCaller_"+u),x="return function "+R+`(handle, name, destructors, args) {
|
|
18
|
-
`,k=0,h=0;h<e-1;++h)x+=" var arg"+h+" = argType"+h+".readValueFromPointer(args"+(k?"+"+k:"")+`);
|
|
19
|
-
`,k+=t[h+1].argPackAdvance;x+=" var rv = handle[name]("+y+`);
|
|
20
|
-
`;for(var h=0;h<e-1;++h)t[h+1].deleteObject&&(x+=" argType"+h+".deleteObject(arg"+h+`);
|
|
21
|
-
`);n.isVoid||(x+=` return retType.toWireType(destructors, rv);
|
|
22
|
-
`),x+=`};
|
|
23
|
-
`,f.push(x);var P=Wt(Function,f).apply(null,d);return l=Yt(P),c[u]=l,l}function g(e,r){return r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN}var T=()=>{Fe("")};function w(){return Date.now()}var _=()=>ie.length,O=()=>_(),E=(e,r,t)=>ie.copyWithin(e,r,r+t),B=e=>{Fe("OOM")},V=e=>{var r=ie.length;e>>>=0,B(e)},j={},J=()=>H||"./this.program",ne=()=>{if(!ne.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,_:J()};for(var t in j)j[t]===void 0?delete r[t]:r[t]=j[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);ne.strings=n}return ne.strings},Ee=(e,r)=>{for(var t=0;t<e.length;++t)Y[r++>>0]=e.charCodeAt(t);Y[r>>0]=0},de=(e,r)=>{var t=0;return ne().forEach(function(n,u){var l=r+t;X[e+u*4>>2]=l,Ee(n,l),t+=n.length+1}),0},Ve=(e,r)=>{var t=ne();X[e>>2]=t.length;var n=0;return t.forEach(function(u){n+=u.length+1}),X[r>>2]=n,0};function ct(e){try{var r=te.getStreamFromFD(e);return a.close(r),0}catch(t){if(typeof a=="undefined"||t.name!=="ErrnoError")throw t;return t.errno}}function Pe(e,r){try{var t=0,n=0,u=0,l=te.getStreamFromFD(e),f=l.tty?2:a.isDir(l.mode)?3:a.isLink(l.mode)?7:4;return Y[r>>0]=f,we[r+2>>1]=u,Q=[t>>>0,(N=t,+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+8>>2]=Q[0],U[r+12>>2]=Q[1],Q=[n>>>0,(N=n,+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+16>>2]=Q[0],U[r+20>>2]=Q[1],0}catch(d){if(typeof a=="undefined"||d.name!=="ErrnoError")throw d;return d.errno}}var io=(e,r,t,n)=>{for(var u=0,l=0;l<t;l++){var f=X[r>>2],d=X[r+4>>2];r+=8;var y=a.read(e,Y,f,d,n);if(y<0)return-1;if(u+=y,y<d)break;typeof n!="undefined"&&(n+=y)}return u};function Jt(e,r,t,n){try{var u=te.getStreamFromFD(e),l=io(u,r,t);return X[n>>2]=l,0}catch(f){if(typeof a=="undefined"||f.name!=="ErrnoError")throw f;return f.errno}}function Zt(e,r,t,n,u){var l=g(r,t);try{if(isNaN(l))return 61;var f=te.getStreamFromFD(e);return a.llseek(f,l,n),Q=[f.position>>>0,(N=f.position,+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[u>>2]=Q[0],U[u+4>>2]=Q[1],f.getdents&&l===0&&n===0&&(f.getdents=null),0}catch(d){if(typeof a=="undefined"||d.name!=="ErrnoError")throw d;return d.errno}}var Qt=(e,r,t,n)=>{for(var u=0,l=0;l<t;l++){var f=X[r>>2],d=X[r+4>>2];r+=8;var y=a.write(e,Y,f,d,n);if(y<0)return-1;u+=y,typeof n!="undefined"&&(n+=y)}return u};function Oo(e,r,t,n){try{var u=te.getStreamFromFD(e),l=Qt(u,r,t);return X[n>>2]=l,0}catch(f){if(typeof a=="undefined"||f.name!=="ErrnoError")throw f;return f.errno}}var mo=function(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},en=365,rn=146;Object.defineProperties(mo.prototype,{read:{get:function(){return(this.mode&en)===en},set:function(e){e?this.mode|=en:this.mode&=~en}},write:{get:function(){return(this.mode&rn)===rn},set:function(e){e?this.mode|=rn:this.mode&=~rn}},isFolder:{get:function(){return a.isDir(this.mode)}},isDevice:{get:function(){return a.isChrdev(this.mode)}}}),a.FSNode=mo,a.createPreloadedFile=Tt,a.staticInit(),mr(),cr=s.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},At=s.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},In(),Cn(),Ln(),Bt=s.UnboundTypeError=Ft(Error,"UnboundTypeError"),Gn(),Kn();var ko={p:yt,C:Xr,w:pr,t:Sn,n:An,r:Hn,q:Vn,d:jn,D:zt,k:Kt,c:Yn,b:Jn,j:Qn,f:Xt,o:no,g:Ur,m:Gt,l:m,a:T,e:w,v:O,A:E,u:V,y:de,z:Ve,i:ct,x:Pe,B:Jt,s:Zt,h:Oo},ti=_n(),xo=()=>(xo=ee.F)(),ao=e=>(ao=ee.G)(e),tr=e=>(tr=ee.I)(e),ho=()=>(ho=ee.J)(),vo=e=>(vo=ee.K)(e),Uo=s.__embind_initialize_bindings=()=>(Uo=s.__embind_initialize_bindings=ee.L)(),go=e=>(go=ee.M)(e),No=s.dynCall_jiji=(e,r,t,n,u)=>(No=s.dynCall_jiji=ee.N)(e,r,t,n,u),ni=s._ff_h264_cabac_tables=67061,tn;dr=function e(){tn||yo(),tn||(dr=e)};function yo(){if(Ie>0||(pn(),Ie>0))return;function e(){tn||(tn=!0,s.calledRun=!0,!Lr&&(mn(),v(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),hn()))}s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),e()},1)):e()}if(s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return yo(),p.ready}})(),Co=Jo;var sn=class extends Ge{constructor(p){super(Co,p!=null&&p.wasmPath?fetch(p==null?void 0:p.wasmPath).then(s=>s.arrayBuffer()):void 0,p==null?void 0:p.workerMode,p==null?void 0:p.canvas,p==null?void 0:p.yuvMode)}};var Zo=(()=>{var b=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return function(p={}){var s=p,v,S;s.ready=new Promise((o,i)=>{v=o,S=i});var D=Object.assign({},s),A=[],H="./this.program",I=(o,i)=>{throw i},C=typeof window=="object",F=typeof importScripts=="function",L=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",W="";function me(o){return s.locateFile?s.locateFile(o,W):W+o}var Re,Me,q,ze;(C||F)&&(F?W=self.location.href:typeof document!="undefined"&&document.currentScript&&(W=document.currentScript.src),b&&(W=b),W.indexOf("blob:")!==0?W=W.substr(0,W.replace(/[?#].*/,"").lastIndexOf("/")+1):W="",Re=o=>{var i=new XMLHttpRequest;return i.open("GET",o,!1),i.send(null),i.responseText},F&&(q=o=>{var i=new XMLHttpRequest;return i.open("GET",o,!1),i.responseType="arraybuffer",i.send(null),new Uint8Array(i.response)}),Me=(o,i,c)=>{var m=new XMLHttpRequest;m.open("GET",o,!0),m.responseType="arraybuffer",m.onload=()=>{if(m.status==200||m.status==0&&m.response){i(m.response);return}c()},m.onerror=c,m.send(null)},ze=o=>document.title=o);var lr=s.print||console.log.bind(console),ae=s.printErr||console.error.bind(console);Object.assign(s,D),D=null,s.arguments&&(A=s.arguments),s.thisProgram&&(H=s.thisProgram),s.quit&&(I=s.quit);var he;s.wasmBinary&&(he=s.wasmBinary);var Io=s.noExitRuntime||!0;typeof WebAssembly!="object"&&ir("no native wasm support detected");var $r,ee,Lr=!1,dn,Ke,Y,ie,we,Se,U,X,Mr;function mt(){var o=$r.buffer;s.HEAP8=Ke=new Int8Array(o),s.HEAP16=ie=new Int16Array(o),s.HEAP32=Se=new Int32Array(o),s.HEAPU8=Y=new Uint8Array(o),s.HEAPU16=we=new Uint16Array(o),s.HEAPU32=U=new Uint32Array(o),s.HEAPF32=X=new Float32Array(o),s.HEAPF64=Mr=new Float64Array(o)}var ht,Fr=[],Br=[],Hr=[],vt=!1;function fn(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)hn(s.preRun.shift());jr(Fr)}function pn(){vt=!0,jr(Br)}function mn(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)gn(s.postRun.shift());jr(Hr)}function hn(o){Fr.unshift(o)}function vn(o){Br.unshift(o)}function gn(o){Hr.unshift(o)}var Xe=0,Ie=null,qe=null;function dr(o){Xe++,s.monitorRunDependencies&&s.monitorRunDependencies(Xe)}function fo(o){if(Xe--,s.monitorRunDependencies&&s.monitorRunDependencies(Xe),Xe==0&&(Ie!==null&&(clearInterval(Ie),Ie=null),qe)){var i=qe;qe=null,i()}}function ir(o){s.onAbort&&s.onAbort(o),o="Aborted("+o+")",ae(o),Lr=!0,dn=1,o+=". Build with -sASSERTIONS for more info.";var i=new WebAssembly.RuntimeError(o);throw S(i),i}var wr="data:application/octet-stream;base64,";function Fe(o){return o.startsWith(wr)}var ar;ar="videodec_simd.wasm",Fe(ar)||(ar=me(ar));function Wr(o){if(o==ar&&he)return new Uint8Array(he);if(q)return q(o);throw"both async and sync fetching of the wasm failed"}function sr(o){return!he&&(C||F)&&typeof fetch=="function"?fetch(o,{credentials:"same-origin"}).then(i=>{if(!i.ok)throw"failed to load wasm binary file at '"+o+"'";return i.arrayBuffer()}).catch(()=>Wr(o)):Promise.resolve().then(()=>Wr(o))}function Vr(o,i,c){return sr(o).then(m=>WebAssembly.instantiate(m,i)).then(m=>m).then(c,m=>{ae("failed to asynchronously prepare wasm: "+m),ir(m)})}function yn(o,i,c,m){return!o&&typeof WebAssembly.instantiateStreaming=="function"&&!Fe(i)&&typeof fetch=="function"?fetch(i,{credentials:"same-origin"}).then(g=>{var T=WebAssembly.instantiateStreaming(g,c);return T.then(m,function(w){return ae("wasm streaming compile failed: "+w),ae("falling back to ArrayBuffer instantiation"),Vr(i,c,m)})}):Vr(i,c,m)}function gt(){var o={a:ro};function i(m,g){var T=m.exports;return ee=T,$r=ee.v,mt(),ht=ee.z,vn(ee.w),fo("wasm-instantiate"),T}dr("wasm-instantiate");function c(m){i(m.instance)}if(s.instantiateWasm)try{return s.instantiateWasm(o,i)}catch(m){ae("Module.instantiateWasm callback failed with error: "+m),S(m)}return yn(he,ar,o,c).catch(S),{}}var jr=o=>{for(;o.length>0;)o.shift()(s)};function _n(o){this.excPtr=o,this.ptr=o-24,this.set_type=function(i){U[this.ptr+4>>2]=i},this.get_type=function(){return U[this.ptr+4>>2]},this.set_destructor=function(i){U[this.ptr+8>>2]=i},this.get_destructor=function(){return U[this.ptr+8>>2]},this.set_caught=function(i){i=i?1:0,Ke[this.ptr+12>>0]=i},this.get_caught=function(){return Ke[this.ptr+12>>0]!=0},this.set_rethrown=function(i){i=i?1:0,Ke[this.ptr+13>>0]=i},this.get_rethrown=function(){return Ke[this.ptr+13>>0]!=0},this.init=function(i,c){this.set_adjusted_ptr(0),this.set_type(i),this.set_destructor(c)},this.set_adjusted_ptr=function(i){U[this.ptr+16>>2]=i},this.get_adjusted_ptr=function(){return U[this.ptr+16>>2]},this.get_exception_ptr=function(){var i=qt(this.get_type());if(i)return U[this.excPtr>>2];var c=this.get_adjusted_ptr();return c!==0?c:this.excPtr}}var N=0,Q=0;function Gr(o,i,c){var m=new _n(o);throw m.init(i,c),N=o,Q++,N}function bn(o,i,c,m,g){}function Sr(o){switch(o){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(`Unknown type size: ${o}`)}}function Tn(){for(var o=new Array(256),i=0;i<256;++i)o[i]=String.fromCharCode(i);yt=o}var yt=void 0;function ve(o){for(var i="",c=o;Y[c];)i+=yt[Y[c++]];return i}var G={},Ye={},fr={},le=void 0;function z(o){throw new le(o)}var Je=void 0;function ur(o){throw new Je(o)}function Ze(o,i,c){o.forEach(function(_){fr[_]=i});function m(_){var O=c(_);O.length!==o.length&&ur("Mismatched type converter count");for(var E=0;E<o.length;++E)Ae(o[E],O[E])}var g=new Array(i.length),T=[],w=0;i.forEach((_,O)=>{Ye.hasOwnProperty(_)?g[O]=Ye[_]:(T.push(_),G.hasOwnProperty(_)||(G[_]=[]),G[_].push(()=>{g[O]=Ye[_],++w,w===T.length&&m(g)}))}),T.length===0&&m(g)}function zr(o,i,c={}){var m=i.name;if(o||z(`type "${m}" must have a positive integer typeid pointer`),Ye.hasOwnProperty(o)){if(c.ignoreDuplicateRegistrations)return;z(`Cannot register type '${m}' twice`)}if(Ye[o]=i,delete fr[o],G.hasOwnProperty(o)){var g=G[o];delete G[o],g.forEach(T=>T())}}function Ae(o,i,c={}){if(!("argPackAdvance"in i))throw new TypeError("registerType registeredInstance requires argPackAdvance");return zr(o,i,c)}function En(o,i,c,m,g){var T=Sr(c);i=ve(i),Ae(o,{name:i,fromWireType:function(w){return!!w},toWireType:function(w,_){return _?m:g},argPackAdvance:8,readValueFromPointer:function(w){var _;if(c===1)_=Ke;else if(c===2)_=ie;else if(c===4)_=Se;else throw new TypeError("Unknown boolean type size: "+i);return this.fromWireType(_[w>>T])},destructorFunction:null})}function Be(o){if(!(this instanceof We)||!(o instanceof We))return!1;for(var i=this.$$.ptrType.registeredClass,c=this.$$.ptr,m=o.$$.ptrType.registeredClass,g=o.$$.ptr;i.baseClass;)c=i.upcast(c),i=i.baseClass;for(;m.baseClass;)g=m.upcast(g),m=m.baseClass;return i===m&&c===g}function _t(o){return{count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType}}function M(o){function i(c){return c.$$.ptrType.registeredClass.name}z(i(o)+" instance already deleted")}var Kr=!1;function bt(o){}function wn(o){o.smartPtr?o.smartPtrType.rawDestructor(o.smartPtr):o.ptrType.registeredClass.rawDestructor(o.ptr)}function Tt(o){o.count.value-=1;var i=o.count.value===0;i&&wn(o)}function Et(o,i,c){if(i===c)return o;if(c.baseClass===void 0)return null;var m=Et(o,i,c.baseClass);return m===null?null:c.downcast(m)}var Ar={};function a(){return Object.keys(mr).length}function wt(){var o=[];for(var i in mr)mr.hasOwnProperty(i)&&o.push(mr[i]);return o}var te=[];function Xr(){for(;te.length;){var o=te.pop();o.$$.deleteScheduled=!1,o.delete()}}var pr=void 0;function Sn(o){pr=o,te.length&&pr&&pr(Xr)}function qr(){s.getInheritedInstanceCount=a,s.getLiveInheritedInstances=wt,s.flushPendingDeletes=Xr,s.setDelayFunction=Sn}var mr={};function St(o,i){for(i===void 0&&z("ptr should not be undefined");o.baseClass;)i=o.upcast(i),o=o.baseClass;return i}function ge(o,i){return i=St(o,i),mr[i]}function Oe(o,i){(!i.ptrType||!i.ptr)&&ur("makeClassHandle requires ptr and ptrType");var c=!!i.smartPtrType,m=!!i.smartPtr;return c!==m&&ur("Both smartPtrType and smartPtr must be specified"),i.count={value:1},He(Object.create(o,{$$:{value:i}}))}function Qe(o){var i=this.getPointee(o);if(!i)return this.destructor(o),null;var c=ge(this.registeredClass,i);if(c!==void 0){if(c.$$.count.value===0)return c.$$.ptr=i,c.$$.smartPtr=o,c.clone();var m=c.clone();return this.destructor(o),m}function g(){return this.isSmartPointer?Oe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:i,smartPtrType:this,smartPtr:o}):Oe(this.registeredClass.instancePrototype,{ptrType:this,ptr:o})}var T=this.registeredClass.getActualType(i),w=Ar[T];if(!w)return g.call(this);var _;this.isConst?_=w.constPointerType:_=w.pointerType;var O=Et(i,this.registeredClass,_.registeredClass);return O===null?g.call(this):this.isSmartPointer?Oe(_.registeredClass.instancePrototype,{ptrType:_,ptr:O,smartPtrType:this,smartPtr:o}):Oe(_.registeredClass.instancePrototype,{ptrType:_,ptr:O})}var He=function(o){return typeof FinalizationRegistry=="undefined"?(He=i=>i,o):(Kr=new FinalizationRegistry(i=>{Tt(i.$$)}),He=i=>{var c=i.$$,m=!!c.smartPtr;if(m){var g={$$:c};Kr.register(i,g,i)}return i},bt=i=>Kr.unregister(i),He(o))};function cr(){if(this.$$.ptr||M(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var o=He(Object.create(Object.getPrototypeOf(this),{$$:{value:_t(this.$$)}}));return o.$$.count.value+=1,o.$$.deleteScheduled=!1,o}function K(){this.$$.ptr||M(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&z("Object already scheduled for deletion"),bt(this),Tt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function At(){return!this.$$.ptr}function Pr(){return this.$$.ptr||M(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&z("Object already scheduled for deletion"),te.push(this),te.length===1&&pr&&pr(Xr),this.$$.deleteScheduled=!0,this}function hr(){We.prototype.isAliasOf=Be,We.prototype.clone=cr,We.prototype.delete=K,We.prototype.isDeleted=At,We.prototype.deleteLater=Pr}function We(){}var ke=48,An=57;function Cr(o){if(o===void 0)return"_unknown";o=o.replace(/[^a-zA-Z0-9_]/g,"$");var i=o.charCodeAt(0);return i>=ke&&i<=An?`_${o}`:o}function Yr(o,i){return o=Cr(o),{[o]:function(){return i.apply(this,arguments)}}[o]}function Rr(o,i,c){if(o[i].overloadTable===void 0){var m=o[i];o[i]=function(){return o[i].overloadTable.hasOwnProperty(arguments.length)||z(`Function '${c}' called with an invalid number of arguments (${arguments.length}) - expects one of (${o[i].overloadTable})!`),o[i].overloadTable[arguments.length].apply(this,arguments)},o[i].overloadTable=[],o[i].overloadTable[m.argCount]=m}}function Jr(o,i,c){s.hasOwnProperty(o)?((c===void 0||s[o].overloadTable!==void 0&&s[o].overloadTable[c]!==void 0)&&z(`Cannot register public name '${o}' twice`),Rr(s,o,o),s.hasOwnProperty(c)&&z(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`),s[o].overloadTable[c]=i):(s[o]=i,c!==void 0&&(s[o].numArguments=c))}function Pt(o,i,c,m,g,T,w,_){this.name=o,this.constructor=i,this.instancePrototype=c,this.rawDestructor=m,this.baseClass=g,this.getActualType=T,this.upcast=w,this.downcast=_,this.pureVirtualFunctions=[]}function Zr(o,i,c){for(;i!==c;)i.upcast||z(`Expected null or instance of ${c.name}, got an instance of ${i.name}`),o=i.upcast(o),i=i.baseClass;return o}function Ct(o,i){if(i===null)return this.isReference&&z(`null is not a valid ${this.name}`),0;i.$$||z(`Cannot pass "${tt(i)}" as a ${this.name}`),i.$$.ptr||z(`Cannot pass deleted object as a pointer of type ${this.name}`);var c=i.$$.ptrType.registeredClass,m=Zr(i.$$.ptr,c,this.registeredClass);return m}function Rt(o,i){var c;if(i===null)return this.isReference&&z(`null is not a valid ${this.name}`),this.isSmartPointer?(c=this.rawConstructor(),o!==null&&o.push(this.rawDestructor,c),c):0;i.$$||z(`Cannot pass "${tt(i)}" as a ${this.name}`),i.$$.ptr||z(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&i.$$.ptrType.isConst&&z(`Cannot convert argument of type ${i.$$.smartPtrType?i.$$.smartPtrType.name:i.$$.ptrType.name} to parameter type ${this.name}`);var m=i.$$.ptrType.registeredClass;if(c=Zr(i.$$.ptr,m,this.registeredClass),this.isSmartPointer)switch(i.$$.smartPtr===void 0&&z("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:i.$$.smartPtrType===this?c=i.$$.smartPtr:z(`Cannot convert argument of type ${i.$$.smartPtrType?i.$$.smartPtrType.name:i.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:c=i.$$.smartPtr;break;case 2:if(i.$$.smartPtrType===this)c=i.$$.smartPtr;else{var g=i.clone();c=this.rawShare(c,er.toHandle(function(){g.delete()})),o!==null&&o.push(this.rawDestructor,c)}break;default:z("Unsupporting sharing policy")}return c}function Dt(o,i){if(i===null)return this.isReference&&z(`null is not a valid ${this.name}`),0;i.$$||z(`Cannot pass "${tt(i)}" as a ${this.name}`),i.$$.ptr||z(`Cannot pass deleted object as a pointer of type ${this.name}`),i.$$.ptrType.isConst&&z(`Cannot convert argument of type ${i.$$.ptrType.name} to parameter type ${this.name}`);var c=i.$$.ptrType.registeredClass,m=Zr(i.$$.ptr,c,this.registeredClass);return m}function Dr(o){return this.fromWireType(Se[o>>2])}function Pn(o){return this.rawGetPointee&&(o=this.rawGetPointee(o)),o}function vr(o){this.rawDestructor&&this.rawDestructor(o)}function Qr(o){o!==null&&o.delete()}function gr(){xe.prototype.getPointee=Pn,xe.prototype.destructor=vr,xe.prototype.argPackAdvance=8,xe.prototype.readValueFromPointer=Dr,xe.prototype.deleteObject=Qr,xe.prototype.fromWireType=Qe}function xe(o,i,c,m,g,T,w,_,O,E,B){this.name=o,this.registeredClass=i,this.isReference=c,this.isConst=m,this.isSmartPointer=g,this.pointeeType=T,this.sharingPolicy=w,this.rawGetPointee=_,this.rawConstructor=O,this.rawShare=E,this.rawDestructor=B,!g&&i.baseClass===void 0?m?(this.toWireType=Ct,this.destructorFunction=null):(this.toWireType=Dt,this.destructorFunction=null):this.toWireType=Rt}function Cn(o,i,c){s.hasOwnProperty(o)||ur("Replacing nonexistant public symbol"),s[o].overloadTable!==void 0&&c!==void 0?s[o].overloadTable[c]=i:(s[o]=i,s[o].argCount=c)}var yr=(o,i,c)=>{var m=s["dynCall_"+o];return c&&c.length?m.apply(null,[i].concat(c)):m.call(null,i)},Ir=[],It=o=>{var i=Ir[o];return i||(o>=Ir.length&&(Ir.length=o+1),Ir[o]=i=ht.get(o)),i},Or=(o,i,c)=>{if(o.includes("j"))return yr(o,i,c);var m=It(i).apply(null,c);return m},Rn=(o,i)=>{var c=[];return function(){return c.length=0,Object.assign(c,arguments),Or(o,i,c)}};function De(o,i){o=ve(o);function c(){return o.includes("j")?Rn(o,i):It(i)}var m=c();return typeof m!="function"&&z(`unknown function pointer with signature ${o}: ${i}`),m}function Dn(o,i){var c=Yr(i,function(m){this.name=i,this.message=m;var g=new Error(m).stack;g!==void 0&&(this.stack=this.toString()+`
|
|
24
|
-
`+g.replace(/^Error(:[^\n]*)?\n/,""))});return c.prototype=Object.create(o.prototype),c.prototype.constructor=c,c.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},c}var Ot=void 0;function kt(o){var i=Xt(o),c=ve(i);return $e(i),c}function et(o,i){var c=[],m={};function g(T){if(!m[T]&&!Ye[T]){if(fr[T]){fr[T].forEach(g);return}c.push(T),m[T]=!0}}throw i.forEach(g),new Ot(`${o}: `+c.map(kt).join([", "]))}function In(o,i,c,m,g,T,w,_,O,E,B,V,j){B=ve(B),T=De(g,T),_&&(_=De(w,_)),E&&(E=De(O,E)),j=De(V,j);var J=Cr(B);Jr(J,function(){et(`Cannot construct ${B} due to unbound types`,[m])}),Ze([o,i,c],m?[m]:[],function(ne){ne=ne[0];var Ee,de;m?(Ee=ne.registeredClass,de=Ee.instancePrototype):de=We.prototype;var Ve=Yr(J,function(){if(Object.getPrototypeOf(this)!==ct)throw new le("Use 'new' to construct "+B);if(Pe.constructor_body===void 0)throw new le(B+" has no accessible constructor");var Qt=Pe.constructor_body[arguments.length];if(Qt===void 0)throw new le(`Tried to invoke ctor of ${B} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(Pe.constructor_body).toString()}) parameters instead!`);return Qt.apply(this,arguments)}),ct=Object.create(de,{constructor:{value:Ve}});Ve.prototype=ct;var Pe=new Pt(B,Ve,ct,j,Ee,T,_,E);Pe.baseClass&&(Pe.baseClass.__derivedClasses===void 0&&(Pe.baseClass.__derivedClasses=[]),Pe.baseClass.__derivedClasses.push(Pe));var io=new xe(B,Pe,!0,!1,!1),Jt=new xe(B+"*",Pe,!1,!1,!1),Zt=new xe(B+" const*",Pe,!1,!0,!1);return Ar[o]={pointerType:Jt,constPointerType:Zt},Cn(J,Ve),[io,Jt,Zt]})}function Ue(o,i){for(var c=[],m=0;m<o;m++)c.push(U[i+m*4>>2]);return c}function On(o){for(;o.length;){var i=o.pop(),c=o.pop();c(i)}}function xt(o,i){if(!(o instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof o} which is not a function`);var c=Yr(o.name||"unknownFunctionName",function(){});c.prototype=o.prototype;var m=new c,g=o.apply(m,i);return g instanceof Object?g:m}function _r(o,i,c,m,g,T){var w=i.length;w<2&&z("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var _=i[1]!==null&&c!==null,O=!1,E=1;E<i.length;++E)if(i[E]!==null&&i[E].destructorFunction===void 0){O=!0;break}for(var B=i[0].name!=="void",V="",j="",E=0;E<w-2;++E)V+=(E!==0?", ":"")+"arg"+E,j+=(E!==0?", ":"")+"arg"+E+"Wired";var J=`
|
|
25
|
-
return function ${Cr(o)}(${V}) {
|
|
26
|
-
if (arguments.length !== ${w-2}) {
|
|
27
|
-
throwBindingError('function ${o} called with ${arguments.length} arguments, expected ${w-2} args!');
|
|
28
|
-
}`;O&&(J+=`var destructors = [];
|
|
29
|
-
`);var ne=O?"destructors":"null",Ee=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],de=[z,m,g,On,i[0],i[1]];_&&(J+="var thisWired = classParam.toWireType("+ne+`, this);
|
|
30
|
-
`);for(var E=0;E<w-2;++E)J+="var arg"+E+"Wired = argType"+E+".toWireType("+ne+", arg"+E+"); // "+i[E+2].name+`
|
|
31
|
-
`,Ee.push("argType"+E),de.push(i[E+2]);if(_&&(j="thisWired"+(j.length>0?", ":"")+j),J+=(B||T?"var rv = ":"")+"invoker(fn"+(j.length>0?", ":"")+j+`);
|
|
32
|
-
`,O)J+=`runDestructors(destructors);
|
|
33
|
-
`;else for(var E=_?1:2;E<i.length;++E){var Ve=E===1?"thisWired":"arg"+(E-2)+"Wired";i[E].destructorFunction!==null&&(J+=Ve+"_dtor("+Ve+"); // "+i[E].name+`
|
|
34
|
-
`,Ee.push(Ve+"_dtor"),de.push(i[E].destructorFunction))}return B&&(J+=`var ret = retType.fromWireType(rv);
|
|
35
|
-
return ret;
|
|
36
|
-
`),J+=`}
|
|
37
|
-
`,Ee.push(J),xt(Function,Ee).apply(null,de)}function rt(o,i,c,m,g,T){var w=Ue(i,c);g=De(m,g),Ze([],[o],function(_){_=_[0];var O=`constructor ${_.name}`;if(_.registeredClass.constructor_body===void 0&&(_.registeredClass.constructor_body=[]),_.registeredClass.constructor_body[i-1]!==void 0)throw new le(`Cannot register multiple constructors with identical number of parameters (${i-1}) for class '${_.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return _.registeredClass.constructor_body[i-1]=()=>{et(`Cannot construct ${_.name} due to unbound types`,w)},Ze([],w,function(E){return E.splice(1,0,null),_.registeredClass.constructor_body[i-1]=_r(O,E,null,g,T),[]}),[]})}function Ut(o,i,c,m,g,T,w,_,O){var E=Ue(c,m);i=ve(i),T=De(g,T),Ze([],[o],function(B){B=B[0];var V=`${B.name}.${i}`;i.startsWith("@@")&&(i=Symbol[i.substring(2)]),_&&B.registeredClass.pureVirtualFunctions.push(i);function j(){et(`Cannot call ${V} due to unbound types`,E)}var J=B.registeredClass.instancePrototype,ne=J[i];return ne===void 0||ne.overloadTable===void 0&&ne.className!==B.name&&ne.argCount===c-2?(j.argCount=c-2,j.className=B.name,J[i]=j):(Rr(J,i,V),J[i].overloadTable[c-2]=j),Ze([],E,function(Ee){var de=_r(V,Ee,B,T,w,O);return J[i].overloadTable===void 0?(de.argCount=c-2,J[i]=de):J[i].overloadTable[c-2]=de,[]}),[]})}function kn(){Object.assign(Nt.prototype,{get(o){return this.allocated[o]},has(o){return this.allocated[o]!==void 0},allocate(o){var i=this.freelist.pop()||this.allocated.length;return this.allocated[i]=o,i},free(o){this.allocated[o]=void 0,this.freelist.push(o)}})}function Nt(){this.allocated=[void 0],this.freelist=[]}var ye=new Nt;function $t(o){o>=ye.reserved&&--ye.get(o).refcount===0&&ye.free(o)}function xn(){for(var o=0,i=ye.reserved;i<ye.allocated.length;++i)ye.allocated[i]!==void 0&&++o;return o}function Un(){ye.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),ye.reserved=ye.allocated.length,s.count_emval_handles=xn}var er={toValue:o=>(o||z("Cannot use deleted val. handle = "+o),ye.get(o).value),toHandle:o=>{switch(o){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return ye.allocate({refcount:1,value:o})}}};function Nn(o,i){i=ve(i),Ae(o,{name:i,fromWireType:function(c){var m=er.toValue(c);return $t(c),m},toWireType:function(c,m){return er.toHandle(m)},argPackAdvance:8,readValueFromPointer:Dr,destructorFunction:null})}function tt(o){if(o===null)return"null";var i=typeof o;return i==="object"||i==="array"||i==="function"?o.toString():""+o}function $n(o,i){switch(i){case 2:return function(c){return this.fromWireType(X[c>>2])};case 3:return function(c){return this.fromWireType(Mr[c>>3])};default:throw new TypeError("Unknown float type: "+o)}}function Ln(o,i,c){var m=Sr(c);i=ve(i),Ae(o,{name:i,fromWireType:function(g){return g},toWireType:function(g,T){return T},argPackAdvance:8,readValueFromPointer:$n(i,m),destructorFunction:null})}function Ne(o,i,c){switch(i){case 0:return c?function(g){return Ke[g]}:function(g){return Y[g]};case 1:return c?function(g){return ie[g>>1]}:function(g){return we[g>>1]};case 2:return c?function(g){return Se[g>>2]}:function(g){return U[g>>2]};default:throw new TypeError("Unknown integer type: "+o)}}function Mn(o,i,c,m,g){i=ve(i),g===-1&&(g=4294967295);var T=Sr(c),w=V=>V;if(m===0){var _=32-8*c;w=V=>V<<_>>>_}var O=i.includes("unsigned"),E=(V,j)=>{},B;O?B=function(V,j){return E(j,this.name),j>>>0}:B=function(V,j){return E(j,this.name),j},Ae(o,{name:i,fromWireType:w,toWireType:B,argPackAdvance:8,readValueFromPointer:Ne(i,T,m!==0),destructorFunction:null})}function Fn(o,i,c){var m=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],g=m[i];function T(w){w=w>>2;var _=U,O=_[w],E=_[w+1];return new g(_.buffer,E,O)}c=ve(c),Ae(o,{name:c,fromWireType:T,argPackAdvance:8,readValueFromPointer:T},{ignoreDuplicateRegistrations:!0})}var kr=(o,i,c,m)=>{if(!(m>0))return 0;for(var g=c,T=c+m-1,w=0;w<o.length;++w){var _=o.charCodeAt(w);if(_>=55296&&_<=57343){var O=o.charCodeAt(++w);_=65536+((_&1023)<<10)|O&1023}if(_<=127){if(c>=T)break;i[c++]=_}else if(_<=2047){if(c+1>=T)break;i[c++]=192|_>>6,i[c++]=128|_&63}else if(_<=65535){if(c+2>=T)break;i[c++]=224|_>>12,i[c++]=128|_>>6&63,i[c++]=128|_&63}else{if(c+3>=T)break;i[c++]=240|_>>18,i[c++]=128|_>>12&63,i[c++]=128|_>>6&63,i[c++]=128|_&63}}return i[c]=0,c-g},Lt=(o,i,c)=>kr(o,Y,i,c),Bn=o=>{for(var i=0,c=0;c<o.length;++c){var m=o.charCodeAt(c);m<=127?i++:m<=2047?i+=2:m>=55296&&m<=57343?(i+=4,++c):i+=3}return i},Mt=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0,rr=(o,i,c)=>{for(var m=i+c,g=i;o[g]&&!(g>=m);)++g;if(g-i>16&&o.buffer&&Mt)return Mt.decode(o.subarray(i,g));for(var T="";i<g;){var w=o[i++];if(!(w&128)){T+=String.fromCharCode(w);continue}var _=o[i++]&63;if((w&224)==192){T+=String.fromCharCode((w&31)<<6|_);continue}var O=o[i++]&63;if((w&240)==224?w=(w&15)<<12|_<<6|O:w=(w&7)<<18|_<<12|O<<6|o[i++]&63,w<65536)T+=String.fromCharCode(w);else{var E=w-65536;T+=String.fromCharCode(55296|E>>10,56320|E&1023)}}return T},Ft=(o,i)=>o?rr(Y,o,i):"";function Bt(o,i){i=ve(i);var c=i==="std::string";Ae(o,{name:i,fromWireType:function(m){var g=U[m>>2],T=m+4,w;if(c)for(var _=T,O=0;O<=g;++O){var E=T+O;if(O==g||Y[E]==0){var B=E-_,V=Ft(_,B);w===void 0?w=V:(w+="\0",w+=V),_=E+1}}else{for(var j=new Array(g),O=0;O<g;++O)j[O]=String.fromCharCode(Y[T+O]);w=j.join("")}return $e(m),w},toWireType:function(m,g){g instanceof ArrayBuffer&&(g=new Uint8Array(g));var T,w=typeof g=="string";w||g instanceof Uint8Array||g instanceof Uint8ClampedArray||g instanceof Int8Array||z("Cannot pass non-string to std::string"),c&&w?T=Bn(g):T=g.length;var _=st(4+T+1),O=_+4;if(U[_>>2]=T,c&&w)Lt(g,O,T+1);else if(w)for(var E=0;E<T;++E){var B=g.charCodeAt(E);B>255&&($e(O),z("String has UTF-16 code units that do not fit in 8 bits")),Y[O+E]=B}else for(var E=0;E<T;++E)Y[O+E]=g[E];return m!==null&&m.push($e,_),_},argPackAdvance:8,readValueFromPointer:Dr,destructorFunction:function(m){$e(m)}})}var nt=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0,ot=(o,i)=>{for(var c=o,m=c>>1,g=m+i/2;!(m>=g)&&we[m];)++m;if(c=m<<1,c-o>32&&nt)return nt.decode(Y.subarray(o,c));for(var T="",w=0;!(w>=i/2);++w){var _=ie[o+w*2>>1];if(_==0)break;T+=String.fromCharCode(_)}return T},Hn=(o,i,c)=>{if(c===void 0&&(c=2147483647),c<2)return 0;c-=2;for(var m=i,g=c<o.length*2?c/2:o.length,T=0;T<g;++T){var w=o.charCodeAt(T);ie[i>>1]=w,i+=2}return ie[i>>1]=0,i-m},Ht=o=>o.length*2,Wn=(o,i)=>{for(var c=0,m="";!(c>=i/4);){var g=Se[o+c*4>>2];if(g==0)break;if(++c,g>=65536){var T=g-65536;m+=String.fromCharCode(55296|T>>10,56320|T&1023)}else m+=String.fromCharCode(g)}return m},Wt=(o,i,c)=>{if(c===void 0&&(c=2147483647),c<4)return 0;for(var m=i,g=m+c-4,T=0;T<o.length;++T){var w=o.charCodeAt(T);if(w>=55296&&w<=57343){var _=o.charCodeAt(++T);w=65536+((w&1023)<<10)|_&1023}if(Se[i>>2]=w,i+=4,i+4>g)break}return Se[i>>2]=0,i-m},Vt=o=>{for(var i=0,c=0;c<o.length;++c){var m=o.charCodeAt(c);m>=55296&&m<=57343&&++c,i+=4}return i},Vn=function(o,i,c){c=ve(c);var m,g,T,w,_;i===2?(m=ot,g=Hn,w=Ht,T=()=>we,_=1):i===4&&(m=Wn,g=Wt,w=Vt,T=()=>U,_=2),Ae(o,{name:c,fromWireType:function(O){for(var E=U[O>>2],B=T(),V,j=O+4,J=0;J<=E;++J){var ne=O+4+J*i;if(J==E||B[ne>>_]==0){var Ee=ne-j,de=m(j,Ee);V===void 0?V=de:(V+="\0",V+=de),j=ne+i}}return $e(O),V},toWireType:function(O,E){typeof E!="string"&&z(`Cannot pass non-string to C++ string type ${c}`);var B=w(E),V=st(4+B+i);return U[V>>2]=B>>_,g(E,V+4,B+i),O!==null&&O.push($e,V),V},argPackAdvance:8,readValueFromPointer:Dr,destructorFunction:function(O){$e(O)}})};function jn(o,i){i=ve(i),Ae(o,{isVoid:!0,name:i,argPackAdvance:0,fromWireType:function(){},toWireType:function(c,m){}})}var Gn={};function jt(o){var i=Gn[o];return i===void 0?ve(o):i}var _e=[];function Gt(o,i,c,m){o=_e[o],i=er.toValue(i),c=jt(c),o(i,c,null,m)}function zn(o){var i=_e.length;return _e.push(o),i}function Kn(o,i){var c=Ye[o];return c===void 0&&z(i+" has unknown type "+kt(o)),c}function xr(o,i){for(var c=new Array(o),m=0;m<o;++m)c[m]=Kn(U[i+m*4>>2],"parameter "+m);return c}var zt=[];function it(o,i){var c=xr(o,i),m=c[0],g=m.name+"_$"+c.slice(1).map(function(ne){return ne.name}).join("_")+"$",T=zt[g];if(T!==void 0)return T;for(var w=["retType"],_=[m],O="",E=0;E<o-1;++E)O+=(E!==0?", ":"")+"arg"+E,w.push("argType"+E),_.push(c[1+E]);for(var B=Cr("methodCaller_"+g),V="return function "+B+`(handle, name, destructors, args) {
|
|
38
|
-
`,j=0,E=0;E<o-1;++E)V+=" var arg"+E+" = argType"+E+".readValueFromPointer(args"+(j?"+"+j:"")+`);
|
|
39
|
-
`,j+=c[E+1].argPackAdvance;V+=" var rv = handle[name]("+O+`);
|
|
40
|
-
`;for(var E=0;E<o-1;++E)c[E+1].deleteObject&&(V+=" argType"+E+".deleteObject(arg"+E+`);
|
|
41
|
-
`);m.isVoid||(V+=` return retType.toWireType(destructors, rv);
|
|
42
|
-
`),V+=`};
|
|
43
|
-
`,w.push(V);var J=xt(Function,w).apply(null,_);return T=zn(J),zt[g]=T,T}var Xn=()=>{ir("")},Kt;Kt=()=>performance.now();var qn=(o,i,c)=>Y.copyWithin(o,i,i+c),Yn=o=>{ir("OOM")},Jn=o=>{var i=Y.length;o>>>=0,Yn(o)},Zn=[null,[],[]],Qn=(o,i)=>{var c=Zn[o];i===0||i===10?((o===1?lr:ae)(rr(c,0)),c.length=0):c.push(i)},at={varargs:void 0,get(){at.varargs+=4;var o=Se[at.varargs-4>>2];return o},getStr(o){var i=Ft(o);return i}},eo=(o,i,c,m)=>{for(var g=0,T=0;T<c;T++){var w=U[i>>2],_=U[i+4>>2];i+=8;for(var O=0;O<_;O++)Qn(o,Y[w+O]);g+=_}return U[m>>2]=g,0};Tn(),le=s.BindingError=class extends Error{constructor(i){super(i),this.name="BindingError"}},Je=s.InternalError=class extends Error{constructor(i){super(i),this.name="InternalError"}},hr(),qr(),gr(),Ot=s.UnboundTypeError=Dn(Error,"UnboundTypeError"),kn(),Un();var ro={o:Gr,r:bn,m:En,q:In,p:rt,d:Ut,u:Nn,k:Ln,b:Mn,a:Fn,j:Bt,g:Vn,n:jn,e:Gt,l:$t,h:it,f:Xn,c:Kt,t:qn,s:Jn,i:eo},po=gt(),to=()=>(to=ee.w)(),$e=o=>($e=ee.x)(o),st=o=>(st=ee.y)(o),Xt=o=>(Xt=ee.A)(o),no=s.__embind_initialize_bindings=()=>(no=s.__embind_initialize_bindings=ee.B)(),oo=()=>(oo=ee.__errno_location)(),qt=o=>(qt=ee.C)(o),ut=s.dynCall_jiji=(o,i,c,m,g)=>(ut=s.dynCall_jiji=ee.D)(o,i,c,m,g),Ur;qe=function o(){Ur||Yt(),Ur||(qe=o)};function Yt(){if(Xe>0||(fn(),Xe>0))return;function o(){Ur||(Ur=!0,s.calledRun=!0,!Lr&&(pn(),v(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),mn()))}s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),o()},1)):o()}if(s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return Yt(),p.ready}})(),Ro=Zo;var un=class extends Ge{constructor(p){super(Ro,p!=null&&p.wasmPath?fetch(p.wasmPath).then(s=>s.arrayBuffer()):void 0,p==null?void 0:p.workerMode,p==null?void 0:p.canvas,p==null?void 0:p.yuvMode)}};var Qo="web.sdk.qcloud.com";var ei=`https://${Qo}/trtc/webrtc/v5/doc`;var Mi=`${ei}/zh-cn/`;var Do=(A=>(A[A.TRACE=0]="TRACE",A[A.DEBUG=1]="DEBUG",A[A.INFO=2]="INFO",A[A.WARN=3]="WARN",A[A.ERROR=4]="ERROR",A[A.NONE=5]="NONE",A))(Do||{});var Fi=7*24*3600*1e3;var cn={CANVAS:"canvas",AUDIO:"audio",VIDEO:"video",SCREEN:"screen",SMALL:"small",BIG:"big",AUXILIARY:"auxiliary",SMALL_VIDEO:"smallVideo",FACING_MODE_USER:"user",FACING_MODE_ENVIRONMENT:"environment",MUTE:"mute",UNMUTE:"unmute",ENDED:"ended",PLAYING:"playing",PAUSE:"pause",ERROR:"error",LOADEDDATA:"loadeddata",LOADEDMETADATA:"loadedmetadata",AUDIO_INPUT:"audioinput",VIDEO_INPUT:"videoinput",DETAIL:"detail",TEXT:"text",MAIN:"main",BACKUP:"backup",BANNED:"banned",KICK:"kick",USER_TIME_OUT:"user_time_out",ROOM_DISBAND:"room_disband",SEI_MESSAGE:"sei-message",ADD:"add",REMOVE:"remove",REPLACE:"replace",TRACK:"track",SUBSCRIBE:"subscribe",UNSUBSCRIBE:"unsubscribe",TRANSCEIVER_DIRECTION_SENDONLY:"sendonly",TRANSCEIVER_DIRECTION_RECVONLY:"recvonly",ENTER_PICTURE_IN_PICTURE:"enterpictureinpicture",LEAVE_PICTURE_IN_PICTURE:"leavepictureinpicture"};var Bi=cn.MAIN,Hi=cn.AUXILIARY;var Wi=cn.BIG,Vi=cn.SMALL,ji=10*1e3;var Gi=Object.keys(Do);var zi=10*1e3;var fa=typeof window!="undefined"&&typeof window.glog=="function"?window.glog:()=>{};function co(){return!performance||!performance.now?Date.now():Math.floor(performance.now())}var{toString:pa}=Object.prototype;var ln=class ln{constructor(p){this.core=p;fe(this,"contextMap",new Map);fe(this,"decodeProcessorMap",new WeakMap);this.addKVReportBeforeExitRoom=this.addKVReportBeforeExitRoom.bind(this),this.createDecoder=this.createDecoder.bind(this),this.core.innerEmitter.on("51",this.addKVReportBeforeExitRoom)}getAlias(){return"videoDecoder"}getGroup(p){return p!=null&&p.track?`${p.track.userId}${p.track.streamType}`:"*"}getName(){return ln.Name}getValidateRule(p){return{type:this.core.enums.BASIC_TYPE.Object}}createDecoder(p,s){switch(p){case"wasm":return this.core.rtcDectection.isSIMDSupported()?new un(Er(Tr({},s),{wasmPath:`${this.core.assetsPath}videodec_simd.wasm`})):new sn(Er(Tr({},s),{wasmPath:`${this.core.assetsPath}videodec.wasm`}));case"webCodecs":return new or;case"mse":throw new Error("mse decoder not supported yet");default:throw new Error("Unsupported decoder type")}}start(p){this.decodeProcessorMap.set(p.track,this.decode(p)),this.core.room.videoManager.addDecodeProcessor({processor:({frame:s,track:v})=>{var S;return((S=this.decodeProcessorMap.get(v))==null?void 0:S({frame:s,track:v}))||s},type:3})}decode(p){let{pipe:s,take:v,subscribe:S}=this.core.rx;return({frame:D,track:A})=>{if(A!==p.track||D.type==="empty")return D;if(this.contextMap.has(A))return this.contextMap.get(A).decode(D);let H=this.core.room.videoManager.createDecodeContext(Er(Tr({},p),{createDecoder:this.createDecoder}));return s(H.trackDoneOB,v(1),S(()=>{this.core.clearStarted(this,this.getGroup(p)),this.stop({track:A})})),this.contextMap.set(A,H),H.decode(D)}}stop(p){if(!(p!=null&&p.track))this.contextMap.forEach((s,v)=>{s.close("stop"),this.contextMap.delete(v)});else{let s=this.contextMap.get(p.track);s&&(s.close("stop"),this.report(s,p.track),this.contextMap.delete(p.track))}this.contextMap.size===0&&this.core.room.videoManager.removeDecodeProcessor({type:3})}report(p,s){if(p.isReported)return;p.isReported=!0;let v=co()-p.startPerformanceTime,{renderFreezeTotal:S,dataFreezeTotal:D}=this.getRemoteTrackFreezeDuration(s,p);v&&this.core.kvStatManager.addNumber({key:514850,value:Math.floor(S/v*100),split:1}),v&&this.core.kvStatManager.addNumber({key:514851,value:Math.floor(D/v*100),split:1}),p.inputFrameCount&&this.core.kvStatManager.addNumber({key:514852,value:Math.floor(p.decodedFrameCount/p.inputFrameCount*100),split:1})}addKVReportBeforeExitRoom({room:p}){p===this.core.room&&this.contextMap.forEach((s,v)=>{this.report(s,v)})}update(p){let s=this.contextMap.get(p.track);if(s){if(p.type==="mock"){s.mock(this.core.enums.DECODE_FAILED_ERROR_CODE.TEST);return}s.close("update"),this.contextMap.set(p.track,this.core.room.videoManager.createDecodeContext(Er(Tr({},p),{createDecoder:this.createDecoder})))}}getRemoteTrackFreezeDuration(p,s){let v=this.core.room.badCaseDetector.getRenderFreezeMap().get(`${p.userId}_${p.streamType}`),S=this.core.room.badCaseDetector.getDataFreezeMap().get(`${p.userId}_${p.streamType}`),D=0;v&&v.freezeTimeline.forEach(({startTime:H,endTime:I})=>{H>s.startPerformanceTime&&(D+=I===0?co()-H:I-H)});let A=0;return S&&S.durationItemList.forEach(H=>{H.startTime>s.startPerformanceTime&&(A+=H.getDuration())}),{renderFreezeTotal:D,dataFreezeTotal:A}}destroy(){this.core.innerEmitter.off("51",this.addKVReportBeforeExitRoom)}};fe(ln,"Name","TRTCVideoDecoder");var lo=ln;var Aa=lo;export{lo as VideoDecoderPlugin,Aa as default};
|
|
1
|
+
var __create=Object.create,__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropNames=Object.getOwnPropertyNames,__getOwnPropSymbols=Object.getOwnPropertySymbols,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__commonJS=(e,t)=>function(){return t||(0,e[__getOwnPropNames(e)[0]])((t={exports:{}}).exports,t),t.exports},__copyProps=(e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of __getOwnPropNames(t))__hasOwnProp.call(e,o)||o===r||__defProp(e,o,{get:()=>t[o],enumerable:!(n=__getOwnPropDesc(t,o))||n.enumerable});return e},__toESM=(e,t,r)=>(r=null!=e?__create(__getProtoOf(e)):{},__copyProps(!t&&e&&e.__esModule?r:__defProp(r,"default",{value:e,enumerable:!0}),e)),__decorateClass=(e,t,r,n)=>{for(var o,a=n>1?void 0:n?__getOwnPropDesc(t,r):t,i=e.length-1;i>=0;i--)(o=e[i])&&(a=(n?o(t,r,a):o(a))||a);return n&&a&&__defProp(t,r,a),a},__publicField=(e,t,r)=>__defNormalProp(e,"symbol"!=typeof t?t+"":t,r),require_eventemitter3=__commonJS({"../node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js"(e,t){"use strict";var r=Object.prototype.hasOwnProperty,n="~";function o(){}function a(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function i(e,t,r,o,i){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new a(r,o||e,i),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function u(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),u.prototype.eventNames=function(){var e,t,o=[];if(0===this._eventsCount)return o;for(t in e=this._events)r.call(e,t)&&o.push(n?t.slice(1):t);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},u.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,a=r.length,i=new Array(a);o<a;o++)i[o]=r[o].fn;return i},u.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},u.prototype.emit=function(e,t,r,o,a,i){var s=n?n+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,o),!0;case 5:return l.fn.call(l.context,t,r,o,a),!0;case 6:return l.fn.call(l.context,t,r,o,a,i),!0}for(c=1,u=new Array(d-1);c<d;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var p,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,r);break;case 4:l[c].fn.call(l[c].context,t,r,o);break;default:if(!u)for(p=1,u=new Array(d-1);p<d;p++)u[p-1]=arguments[p];l[c].fn.apply(l[c].context,u)}}return!0},u.prototype.on=function(e,t,r){return i(this,e,t,r,!1)},u.prototype.once=function(e,t,r){return i(this,e,t,r,!0)},u.prototype.removeListener=function(e,t,r,o){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var i=this._events[a];if(i.fn)i.fn!==t||o&&!i.once||r&&i.context!==r||s(this,a);else{for(var u=0,c=[],l=i.length;u<l;u++)(i[u].fn!==t||o&&!i[u].once||r&&i[u].context!==r)&&c.push(i[u]);c.length?this._events[a]=1===c.length?c[0]:c:s(this,a)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new o,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=n,u.EventEmitter=u,void 0!==t&&(t.exports=u)}}),import_eventemitter3=__toESM(require_eventemitter3(),1),instance=Symbol("instance"),abortCtrl=Symbol("abortCtrl"),cacheResult=Symbol("cacheResult"),MiddleState=class{constructor(e,t,r){this.oldState=e,this.newState=t,this.action=r,this.aborted=!1}abort(e){this.aborted=!0,setState.call(e,this.oldState,new Error(`action '${this.action}' aborted`))}toString(){return`${this.action}ing`}},FSMError=class extends Error{constructor(e,t,r){super(t),this.state=e,this.message=t,this.cause=r}};function thenAble(e){return"object"==typeof e&&e&&"then"in e}var stateDiagram=new Map;function ChangeState(e,t,r={}){return(n,o,a)=>{const i=r.action||o;if(!r.context){const r=stateDiagram.get(n)||[];stateDiagram.has(n)||stateDiagram.set(n,r),r.push({from:e,to:t,action:i})}const s=a.value;a.value=function(...n){let o=this;if(r.context&&(o=FSM.get("function"==typeof r.context?r.context.call(this,...n):r.context)),o.state===t)return r.sync?o[cacheResult]:Promise.resolve(o[cacheResult]);o.state instanceof MiddleState&&o.state.action==r.abortAction&&o.state.abort(o);let a=null;Array.isArray(e)?0==e.length?o.state instanceof MiddleState&&o.state.abort(o):"string"==typeof o.state&&e.includes(o.state)||(a=new FSMError(o._state,`${o.name} ${i} to ${t} failed: current state ${o._state} not from ${e.join("|")}`)):e!==o.state&&(a=new FSMError(o._state,`${o.name} ${i} to ${t} failed: current state ${o._state} not from ${e}`));const u=e=>{if(r.fail&&r.fail.call(this,e),r.sync){if(r.ignoreError)return e;throw e}return r.ignoreError?Promise.resolve(e):Promise.reject(e)};if(a)return u(a);const c=o.state,l=new MiddleState(c,t,i);setState.call(o,l);const d=e=>{var n;return o[cacheResult]=e,l.aborted||(setState.call(o,t),null===(n=r.success)||void 0===n||n.call(this,o[cacheResult])),e},p=e=>(setState.call(o,c,e),u(e));try{const e=s.apply(this,n);return thenAble(e)?e.then(d).catch(p):r.sync?d(e):Promise.resolve(d(e))}catch(r){return p(new FSMError(o._state,`${o.name} ${i} from ${e} to ${t} failed: ${r}`,r instanceof Error?r:new Error(String(r))))}}}}function Includes(...e){return(t,r,n)=>{const o=n.value,a=r;n.value=function(...t){if(!e.includes(this.state.toString()))throw new FSMError(this.state,`${this.name} ${a} failed: current state ${this.state} not in ${e}`);return o.apply(this,t)}}}var sendDevTools=(()=>{const e="undefined"!=typeof window&&window.__AFSM__,t="undefined"!=typeof importScripts;return e?(e,t)=>{window.dispatchEvent(new CustomEvent(e,{detail:t}))}:t?(e,t)=>{postMessage({type:e,payload:t})}:()=>{}})();function setState(e,t){const r=this._state;this._state=e;const n=e.toString();e&&this.emit(n,r),this.emit(FSM.STATECHANGED,e,r,t),this.updateDevTools({value:e,old:r,err:t instanceof Error?t.message:String(t)})}var FSM=class e extends import_eventemitter3.default{constructor(t,r,n){super(),this.name=t,this.groupName=r,this._state=e.INIT,t||(t=Date.now().toString(36)),n?Object.setPrototypeOf(this,n):n=Object.getPrototypeOf(this),r||(this.groupName=this.constructor.name);const o=n[instance];o?this.name=o.name+"-"+o.count++:n[instance]={name:this.name,count:0},this.updateDevTools({diagram:this.stateDiagram})}get stateDiagram(){const e=Object.getPrototypeOf(this),t=stateDiagram.get(e)||[];let r=new Set,n=[],o=[];const a=new Set,i=Object.getPrototypeOf(e);stateDiagram.has(i)&&(i.stateDiagram.forEach((e=>r.add(e))),i.allStates.forEach((e=>a.add(e)))),t.forEach((({from:e,to:t,action:r})=>{"string"==typeof e?n.push({from:e,to:t,action:r}):e.length?e.forEach((e=>{n.push({from:e,to:t,action:r})})):o.push({to:t,action:r})})),n.forEach((({from:e,to:t,action:n})=>{a.add(e),a.add(t),a.add(n+"ing"),r.add(`${e} --\x3e ${n}ing : ${n}`),r.add(`${n}ing --\x3e ${t} : ${n} 🟢`),r.add(`${n}ing --\x3e ${e} : ${n} 🔴`)})),o.forEach((({to:e,action:t})=>{r.add(`${t}ing --\x3e ${e} : ${t} 🟢`),a.forEach((n=>{n!==e&&r.add(`${n} --\x3e ${t}ing : ${t}`)}))}));const s=[...r];return Object.defineProperties(e,{stateDiagram:{value:s},allStates:{value:a}}),s}static get(t){let r;return"string"==typeof t?(r=e.instances.get(t),r||e.instances.set(t,r=new e(t,void 0,Object.create(e.prototype)))):(r=e.instances2.get(t),r||e.instances2.set(t,r=new e(t.constructor.name,void 0,Object.create(e.prototype)))),r}static getState(t){var r;return null===(r=e.get(t))||void 0===r?void 0:r.state}updateDevTools(t={}){sendDevTools(e.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},t))}get state(){return this._state}set state(e){setState.call(this,e)}};FSM.STATECHANGED="stateChanged",FSM.UPDATEAFSM="updateAFSM",FSM.INIT="[*]",FSM.ON="on",FSM.OFF="off",FSM.instances=new Map,FSM.instances2=new WeakMap;var VideoDecoderHard=class extends FSM{constructor(){super(...arguments),__publicField(this,"decoder"),__publicField(this,"config")}async initialize(){this.decoder=new VideoDecoder({output:e=>{this.emit("videoFrame",e)},error:e=>{this.close(),this.emit("error",e)}})}configure(e){this.config=e,this.decoder.configure(__spreadProps(__spreadValues({},e),{codec:this.getCodec(e)}))}getCodec(e){switch(e.codec){case"hevc":return"hvc1.1.6.L0.12.34.56.78.9A.BC";case"av1":return"av01.0.05M.08";case"avc":return"avc1.420028";default:return e.codec}}decode(e){"configured"===this.decoder.state&&this.decoder.decode(new EncodedVideoChunk(e))}flush(){this.decoder.flush()}reset(){this.decoder.reset()}close(){"closed"!==this.decoder.state&&this.decoder.close()}};function WorkerScripts(){var e;self.onmessage=t=>{if("init"===t.data.type){const{canvas:r,wasmScript:n,wasmBinary:o}=t.data,a=null==r?void 0:r.getContext("2d");let i=0,s=0;const u={wasmBinary:o,postRun:()=>{e=new u.VideoDecoder({videoInfo(e,t){i=e,s=t,console.log("video info",e,t)},yuvData(e,t){const n=i*s,o=n>>2;let c=u.HEAPU32[e>>2],l=u.HEAPU32[1+(e>>2)],d=u.HEAPU32[2+(e>>2)],p=u.HEAPU8.subarray(c,c+n),f=u.HEAPU8.subarray(l,l+o),h=u.HEAPU8.subarray(d,d+o);const m=new Uint8Array(n+o+o);m.set(p),m.set(f,n),m.set(h,n+o);const v=new VideoFrame(m,{codedWidth:i,codedHeight:s,format:"I420",timestamp:t});r?(null==a||a.drawImage(v,0,0,r.width,r.height),null==a||a.commit()):self.postMessage({type:"yuvData",videoFrame:v},[v])}}),self.postMessage({type:"ready"})}};Function("var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;return "+n)()(u)}else if("decode"===t.data.type){const{packet:r}=t.data;null==e||e.decode(r.data,"key"==r.type,r.timestamp)}else if("setCodec"===t.data.type){const{codec:r,format:n,description:o}=t.data;null==e||e.setCodec(r,n,null!=o?o:"")}}}__decorateClass([ChangeState([FSM.INIT,"closed"],"initialized")],VideoDecoderHard.prototype,"initialize",1),__decorateClass([ChangeState("initialized","configured",{sync:!0})],VideoDecoderHard.prototype,"configure",1),__decorateClass([Includes("configured")],VideoDecoderHard.prototype,"decode",1),__decorateClass([ChangeState([],FSM.INIT,{sync:!0})],VideoDecoderHard.prototype,"reset",1),__decorateClass([ChangeState([],"closed",{ignoreError:!0,sync:!0})],VideoDecoderHard.prototype,"close",1);var VideoDecoderSoftBase=class extends FSM{constructor(e,t,r=!1,n,o=!1){super(),this.createModule=e,this.wasmBinary=t,this.workerMode=r,this.canvas=n,this.yuvMode=o,__publicField(this,"worker"),__publicField(this,"decoder"),__publicField(this,"config"),__publicField(this,"module",{}),__publicField(this,"width",0),__publicField(this,"height",0)}async initialize(e){var t;if(this.workerMode){const e=new RegExp("\\{(.+)\\}","s").exec(WorkerScripts.toString())[1];this.worker=new Worker(URL.createObjectURL(new Blob([e],{type:"text/javascript"})));const r=null==(t=this.canvas)?void 0:t.transferControlToOffscreen(),n=await this.wasmBinary;return console.warn("worker mode",n),this.worker.postMessage({type:"init",canvas:r,wasmScript:this.createModule.toString(),wasmBinary:n},r?[r,n]:[n]),new Promise((e=>{this.worker.onmessage=t=>{if("ready"===t.data.type)delete this.wasmBinary,e(),console.warn("worker mode initialize success");else if("yuvData"===t.data.type){const{videoFrame:e}=t.data;this.emit("videoFrame",e)}}}))}const r=this.module;return this.wasmBinary&&(r.wasmBinary=await this.wasmBinary),r.print=e=>console.log(e),r.printErr=e=>console.log(`[JS] ERROR: ${e}`),r.onAbort=()=>console.log("[JS] FATAL: WASM ABORTED"),new Promise((t=>{r.postRun=e=>{this.decoder=new this.module.VideoDecoder(this),console.log("video soft decoder initialize success"),t()},e&&Object.assign(r,e),this.createModule(r)}))}configure(e){var t,r,n;this.config=e;const o=this.config.codec.startsWith("avc")?"avc":"hevc",a=this.config.description?"avc"==o?"avcc":"hvcc":"annexb";null==(r=this.decoder)||r.setCodec(o,a,null!=(t=this.config.description)?t:""),null==(n=this.worker)||n.postMessage({type:"setCodec",codec:o,format:a,description:this.config.description})}decode(e){var t,r;null==(t=this.decoder)||t.decode(e.data,"key"==e.type,e.timestamp),"configured"===this.state&&(null==(r=this.worker)||r.postMessage({type:"decode",packet:e}))}flush(){}reset(){this.config=void 0,this.decoder&&this.decoder.clear()}close(){this.removeAllListeners(),this.decoder&&(this.decoder.clear(),this.decoder.delete())}videoInfo(e,t){this.width=e,this.height=t;let r={width:e,height:t};this.emit("videoCodecInfo",r)}yuvData(e,t){if(!this.module)return;const r=this.width*this.height,n=r>>2;let o=this.module.HEAPU32[e>>2],a=this.module.HEAPU32[1+(e>>2)],i=this.module.HEAPU32[2+(e>>2)],s=this.module.HEAPU8.subarray(o,o+r),u=this.module.HEAPU8.subarray(a,a+n),c=this.module.HEAPU8.subarray(i,i+n);if(this.yuvMode)return void this.emit("videoFrame",{y:s,u:u,v:c,timestamp:t});const l=new Uint8Array(r+n+n);l.set(s),l.set(u,r),l.set(c,r+n),this.emit("videoFrame",new VideoFrame(l,{codedWidth:this.width,codedHeight:this.height,format:"I420",timestamp:t}))}errorInfo(e){let t={errMsg:e};this.emit("error",t)}};__decorateClass([ChangeState([FSM.INIT,"closed"],"initialized")],VideoDecoderSoftBase.prototype,"initialize",1),__decorateClass([ChangeState("initialized","configured",{sync:!0})],VideoDecoderSoftBase.prototype,"configure",1),__decorateClass([ChangeState([],FSM.INIT,{sync:!0})],VideoDecoderSoftBase.prototype,"reset",1),__decorateClass([ChangeState([],"closed",{sync:!0})],VideoDecoderSoftBase.prototype,"close",1);var Module=(()=>{var e="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0;return function(t={}){var r,n,o=t;o.ready=new Promise(((e,t)=>{r=e,n=t}));var a,i,s,u=Object.assign({},o),c="./this.program",l="object"==typeof window,d="function"==typeof importScripts,p=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(l||d)&&(d?p=self.location.href:"undefined"!=typeof document&&document.currentScript&&(p=document.currentScript.src),e&&(p=e),p=0!==p.indexOf("blob:")?p.substr(0,p.replace(/[?#].*/,"").lastIndexOf("/")+1):"",a=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},d&&(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),i=(e,t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)});var f,h=o.print||console.log.bind(console),m=o.printErr||console.error.bind(console);Object.assign(o,u),u=null,o.arguments&&o.arguments,o.thisProgram&&(c=o.thisProgram),o.quit&&o.quit,o.wasmBinary&&(f=o.wasmBinary);var v,y;o.noExitRuntime;"object"!=typeof WebAssembly&&x("no native wasm support detected");var g,w,_,E,b,$,P,T,C,k=!1;var S=[],A=[],D=[];var F=0,O=null,M=null;function R(e){F++,o.monitorRunDependencies&&o.monitorRunDependencies(F)}function j(e){if(F--,o.monitorRunDependencies&&o.monitorRunDependencies(F),0==F&&(null!==O&&(clearInterval(O),O=null),M)){var t=M;M=null,t()}}function x(e){o.onAbort&&o.onAbort(e),m(e="Aborted("+e+")"),k=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}var I,N,U,W,B="data:application/octet-stream;base64,";function V(e){return e.startsWith(B)}function L(e){if(e==I&&f)return new Uint8Array(f);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}function z(e,t,r){return function(e){return f||!l&&!d||"function"!=typeof fetch?Promise.resolve().then((()=>L(e))):fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>L(e)))}(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{m("failed to asynchronously prepare wasm: "+e),x(e)}))}V(I="videodec.wasm")||(N=I,I=o.locateFile?o.locateFile(N,p):p+N);var H=e=>{for(;e.length>0;)e.shift()(o)};function G(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){$[this.ptr+4>>2]=e},this.get_type=function(){return $[this.ptr+4>>2]},this.set_destructor=function(e){$[this.ptr+8>>2]=e},this.get_destructor=function(){return $[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,g[this.ptr+12|0]=e},this.get_caught=function(){return 0!=g[this.ptr+12|0]},this.set_rethrown=function(e){e=e?1:0,g[this.ptr+13|0]=e},this.get_rethrown=function(){return 0!=g[this.ptr+13|0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){$[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return $[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Jt(this.get_type()))return $[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var q={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=q.isAbs(e),r="/"===e.substr(-1);return(e=q.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=q.splitPath(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=q.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return q.normalize(e.join("/"))},join2:(e,t)=>q.normalize(e+"/"+t)},X=e=>(X=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);x("initRandomDevice")})())(e),K={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:ue.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,t=q.isAbs(n)}return(t?"/":"")+(e=q.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=K.resolve(e).substr(1),t=K.resolve(t).substr(1);for(var n=r(e.split("/")),o=r(t.split("/")),a=Math.min(n.length,o.length),i=a,s=0;s<a;s++)if(n[s]!==o[s]){i=s;break}var u=[];for(s=i;s<n.length;s++)u.push("..");return(u=u.concat(o.slice(i))).join("/")}},Y="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,J=(e,t,r)=>{for(var n=t+r,o=t;e[o]&&!(o>=n);)++o;if(o-t>16&&e.buffer&&Y)return Y.decode(e.subarray(t,o));for(var a="";t<o;){var i=e[t++];if(128&i){var s=63&e[t++];if(192!=(224&i)){var u=63&e[t++];if((i=224==(240&i)?(15&i)<<12|s<<6|u:(7&i)<<18|s<<12|u<<6|63&e[t++])<65536)a+=String.fromCharCode(i);else{var c=i-65536;a+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},Z=[],Q=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},ee=(e,t,r,n)=>{if(!(n>0))return 0;for(var o=r,a=r+n-1,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343)s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i);if(s<=127){if(r>=a)break;t[r++]=s}else if(s<=2047){if(r+1>=a)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=a)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=a)break;t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}return t[r]=0,r-o};function te(e,t,r){var n=r>0?r:Q(e)+1,o=new Array(n),a=ee(e,o,0,o.length);return t&&(o.length=a),o}var re={ttys:[],init:function(){},shutdown:function(){},register:function(e,t){re.ttys[e]={input:[],output:[],ops:t},ue.registerDevice(e,re.stream_ops)},stream_ops:{open:function(e){var t=re.ttys[e.node.rdev];if(!t)throw new ue.ErrnoError(43);e.tty=t,e.seekable=!1},close:function(e){e.tty.ops.fsync(e.tty)},fsync:function(e){e.tty.ops.fsync(e.tty)},read:function(e,t,r,n,o){if(!e.tty||!e.tty.ops.get_char)throw new ue.ErrnoError(60);for(var a=0,i=0;i<n;i++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new ue.ErrnoError(29)}if(void 0===s&&0===a)throw new ue.ErrnoError(6);if(null==s)break;a++,t[r+i]=s}return a&&(e.node.timestamp=Date.now()),a},write:function(e,t,r,n,o){if(!e.tty||!e.tty.ops.put_char)throw new ue.ErrnoError(60);try{for(var a=0;a<n;a++)e.tty.ops.put_char(e.tty,t[r+a])}catch(e){throw new ue.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),a}},default_tty_ops:{get_char:function(e){return(()=>{if(!Z.length){var e=null;if("undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n"),!e)return null;Z=te(e,!0)}return Z.shift()})()},put_char:function(e,t){null===t||10===t?(h(J(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync:function(e){e.output&&e.output.length>0&&(h(J(e.output,0)),e.output=[])},ioctl_tcgets:function(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:function(e,t,r){return 0},ioctl_tiocgwinsz:function(e){return[24,80]}},default_tty1_ops:{put_char:function(e,t){null===t||10===t?(m(J(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync:function(e){e.output&&e.output.length>0&&(m(J(e.output,0)),e.output=[])}}},ne=e=>{x()},oe={ops_table:null,mount:e=>oe.createNode(null,"/",16895,0),createNode(e,t,r,n){if(ue.isBlkdev(r)||ue.isFIFO(r))throw new ue.ErrnoError(63);oe.ops_table||(oe.ops_table={dir:{node:{getattr:oe.node_ops.getattr,setattr:oe.node_ops.setattr,lookup:oe.node_ops.lookup,mknod:oe.node_ops.mknod,rename:oe.node_ops.rename,unlink:oe.node_ops.unlink,rmdir:oe.node_ops.rmdir,readdir:oe.node_ops.readdir,symlink:oe.node_ops.symlink},stream:{llseek:oe.stream_ops.llseek}},file:{node:{getattr:oe.node_ops.getattr,setattr:oe.node_ops.setattr},stream:{llseek:oe.stream_ops.llseek,read:oe.stream_ops.read,write:oe.stream_ops.write,allocate:oe.stream_ops.allocate,mmap:oe.stream_ops.mmap,msync:oe.stream_ops.msync}},link:{node:{getattr:oe.node_ops.getattr,setattr:oe.node_ops.setattr,readlink:oe.node_ops.readlink},stream:{}},chrdev:{node:{getattr:oe.node_ops.getattr,setattr:oe.node_ops.setattr},stream:ue.chrdev_stream_ops}});var o=ue.createNode(e,t,r,n);return ue.isDir(o.mode)?(o.node_ops=oe.ops_table.dir.node,o.stream_ops=oe.ops_table.dir.stream,o.contents={}):ue.isFile(o.mode)?(o.node_ops=oe.ops_table.file.node,o.stream_ops=oe.ops_table.file.stream,o.usedBytes=0,o.contents=null):ue.isLink(o.mode)?(o.node_ops=oe.ops_table.link.node,o.stream_ops=oe.ops_table.link.stream):ue.isChrdev(o.mode)&&(o.node_ops=oe.ops_table.chrdev.node,o.stream_ops=oe.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[t]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var n=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=ue.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,ue.isDir(e.mode)?t.size=4096:ue.isFile(e.mode)?t.size=e.usedBytes:ue.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&oe.resizeFileStorage(e,t.size)},lookup(e,t){throw ue.genericErrors[44]},mknod:(e,t,r,n)=>oe.createNode(e,t,r,n),rename(e,t,r){if(ue.isDir(e.mode)){var n;try{n=ue.lookupNode(t,r)}catch(e){}if(n)for(var o in n.contents)throw new ue.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=ue.lookupNode(e,t);for(var n in r.contents)throw new ue.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var n=oe.createNode(e,t,41471,0);return n.link=r,n},readlink(e){if(!ue.isLink(e.mode))throw new ue.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,n,o){var a=e.node.contents;if(o>=e.node.usedBytes)return 0;var i=Math.min(e.node.usedBytes-o,n);if(i>8&&a.subarray)t.set(a.subarray(o,o+i),r);else for(var s=0;s<i;s++)t[r+s]=a[o+s];return i},write(e,t,r,n,o,a){if(!n)return 0;var i=e.node;if(i.timestamp=Date.now(),t.subarray&&(!i.contents||i.contents.subarray)){if(a)return i.contents=t.subarray(r,r+n),i.usedBytes=n,n;if(0===i.usedBytes&&0===o)return i.contents=t.slice(r,r+n),i.usedBytes=n,n;if(o+n<=i.usedBytes)return i.contents.set(t.subarray(r,r+n),o),n}if(oe.expandFileStorage(i,o+n),i.contents.subarray&&t.subarray)i.contents.set(t.subarray(r,r+n),o);else for(var s=0;s<n;s++)i.contents[o+s]=t[r+s];return i.usedBytes=Math.max(i.usedBytes,o+n),n},llseek(e,t,r){var n=t;if(1===r?n+=e.position:2===r&&ue.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new ue.ErrnoError(28);return n},allocate(e,t,r){oe.expandFileStorage(e.node,t+r),e.node.usedBytes=Math.max(e.node.usedBytes,t+r)},mmap(e,t,r,n,o){if(!ue.isFile(e.node.mode))throw new ue.ErrnoError(43);var a,i,s=e.node.contents;if(2&o||s.buffer!==g.buffer){if((r>0||r+t<s.length)&&(s=s.subarray?s.subarray(r,r+t):Array.prototype.slice.call(s,r,r+t)),i=!0,!(a=ne()))throw new ue.ErrnoError(48);g.set(s,a)}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:(e,t,r,n,o)=>(oe.stream_ops.write(e,t,0,n,r,!1),0)}},ae=(e,t,r,n)=>{var o=n?"":`al ${e}`;i(e,(r=>{var n;n=`Loading data file "${e}" failed (no arrayBuffer).`,r||x(n),t(new Uint8Array(r)),o&&j()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),o&&R()},ie=o.preloadPlugins||[];function se(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r}var ue={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(e,t={})=>{if(!(e=K.resolve(e)))return{path:"",node:null};if((t=Object.assign({follow_mount:!0,recurse_count:0},t)).recurse_count>8)throw new ue.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),n=ue.root,o="/",a=0;a<r.length;a++){var i=a===r.length-1;if(i&&t.parent)break;if(n=ue.lookupNode(n,r[a]),o=q.join2(o,r[a]),ue.isMountpoint(n)&&(!i||i&&t.follow_mount)&&(n=n.mounted.root),!i||t.follow)for(var s=0;ue.isLink(n.mode);){var u=ue.readlink(o);if(o=K.resolve(q.dirname(o),u),n=ue.lookupPath(o,{recurse_count:t.recurse_count+1}).node,s++>40)throw new ue.ErrnoError(32)}}return{path:o,node:n}},getPath:e=>{for(var t;;){if(ue.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName:(e,t)=>{for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%ue.nameTable.length},hashAddNode:e=>{var t=ue.hashName(e.parent.id,e.name);e.name_next=ue.nameTable[t],ue.nameTable[t]=e},hashRemoveNode:e=>{var t=ue.hashName(e.parent.id,e.name);if(ue.nameTable[t]===e)ue.nameTable[t]=e.name_next;else for(var r=ue.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode:(e,t)=>{var r=ue.mayLookup(e);if(r)throw new ue.ErrnoError(r,e);for(var n=ue.hashName(e.id,t),o=ue.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===t)return o}return ue.lookup(e,t)},createNode:(e,t,r,n)=>{var o=new ue.FSNode(e,t,r,n);return ue.hashAddNode(o),o},destroyNode:e=>{ue.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>!(49152&~e),flagsToPermissionString:e=>{var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>ue.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup:e=>{var t=ue.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate:(e,t)=>{try{ue.lookupNode(e,t);return 20}catch(e){}return ue.nodePermissions(e,"wx")},mayDelete:(e,t,r)=>{var n;try{n=ue.lookupNode(e,t)}catch(e){return e.errno}var o=ue.nodePermissions(e,"wx");if(o)return o;if(r){if(!ue.isDir(n.mode))return 54;if(ue.isRoot(n)||ue.getPath(n)===ue.cwd())return 10}else if(ue.isDir(n.mode))return 31;return 0},mayOpen:(e,t)=>e?ue.isLink(e.mode)?32:ue.isDir(e.mode)&&("r"!==ue.flagsToPermissionString(t)||512&t)?31:ue.nodePermissions(e,ue.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd:()=>{for(var e=0;e<=ue.MAX_OPEN_FDS;e++)if(!ue.streams[e])return e;throw new ue.ErrnoError(33)},getStreamChecked:e=>{var t=ue.getStream(e);if(!t)throw new ue.ErrnoError(8);return t},getStream:e=>ue.streams[e],createStream:(e,t=-1)=>(ue.FSStream||(ue.FSStream=function(){this.shared={}},ue.FSStream.prototype={},Object.defineProperties(ue.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return!!(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new ue.FSStream,e),-1==t&&(t=ue.nextfd()),e.fd=t,ue.streams[t]=e,e),closeStream:e=>{ue.streams[e]=null},chrdev_stream_ops:{open:e=>{var t=ue.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:()=>{throw new ue.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice:(e,t)=>{ue.devices[e]={stream_ops:t}},getDevice:e=>ue.devices[e],getMounts:e=>{for(var t=[],r=[e];r.length;){var n=r.pop();t.push(n),r.push.apply(r,n.mounts)}return t},syncfs:(e,t)=>{"function"==typeof e&&(t=e,e=!1),ue.syncFSRequests++,ue.syncFSRequests>1&&m(`warning: ${ue.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=ue.getMounts(ue.root.mount),n=0;function o(e){return ue.syncFSRequests--,t(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,o(e));++n>=r.length&&o(null)}r.forEach((t=>{if(!t.type.syncfs)return a(null);t.type.syncfs(t,e,a)}))},mount:(e,t,r)=>{var n,o="/"===r,a=!r;if(o&&ue.root)throw new ue.ErrnoError(10);if(!o&&!a){var i=ue.lookupPath(r,{follow_mount:!1});if(r=i.path,n=i.node,ue.isMountpoint(n))throw new ue.ErrnoError(10);if(!ue.isDir(n.mode))throw new ue.ErrnoError(54)}var s={type:e,opts:t,mountpoint:r,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?ue.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount:e=>{var t=ue.lookupPath(e,{follow_mount:!1});if(!ue.isMountpoint(t.node))throw new ue.ErrnoError(28);var r=t.node,n=r.mounted,o=ue.getMounts(n);Object.keys(ue.nameTable).forEach((e=>{for(var t=ue.nameTable[e];t;){var r=t.name_next;o.includes(t.mount)&&ue.destroyNode(t),t=r}})),r.mounted=null;var a=r.mount.mounts.indexOf(n);r.mount.mounts.splice(a,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod:(e,t,r)=>{var n=ue.lookupPath(e,{parent:!0}).node,o=q.basename(e);if(!o||"."===o||".."===o)throw new ue.ErrnoError(28);var a=ue.mayCreate(n,o);if(a)throw new ue.ErrnoError(a);if(!n.node_ops.mknod)throw new ue.ErrnoError(63);return n.node_ops.mknod(n,o,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,ue.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,ue.mknod(e,t,0)),mkdirTree:(e,t)=>{for(var r=e.split("/"),n="",o=0;o<r.length;++o)if(r[o]){n+="/"+r[o];try{ue.mkdir(n,t)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,t,r)=>(void 0===r&&(r=t,t=438),t|=8192,ue.mknod(e,t,r)),symlink:(e,t)=>{if(!K.resolve(e))throw new ue.ErrnoError(44);var r=ue.lookupPath(t,{parent:!0}).node;if(!r)throw new ue.ErrnoError(44);var n=q.basename(t),o=ue.mayCreate(r,n);if(o)throw new ue.ErrnoError(o);if(!r.node_ops.symlink)throw new ue.ErrnoError(63);return r.node_ops.symlink(r,n,e)},rename:(e,t)=>{var r,n,o=q.dirname(e),a=q.dirname(t),i=q.basename(e),s=q.basename(t);if(r=ue.lookupPath(e,{parent:!0}).node,n=ue.lookupPath(t,{parent:!0}).node,!r||!n)throw new ue.ErrnoError(44);if(r.mount!==n.mount)throw new ue.ErrnoError(75);var u,c=ue.lookupNode(r,i),l=K.relative(e,a);if("."!==l.charAt(0))throw new ue.ErrnoError(28);if("."!==(l=K.relative(t,o)).charAt(0))throw new ue.ErrnoError(55);try{u=ue.lookupNode(n,s)}catch(e){}if(c!==u){var d=ue.isDir(c.mode),p=ue.mayDelete(r,i,d);if(p)throw new ue.ErrnoError(p);if(p=u?ue.mayDelete(n,s,d):ue.mayCreate(n,s))throw new ue.ErrnoError(p);if(!r.node_ops.rename)throw new ue.ErrnoError(63);if(ue.isMountpoint(c)||u&&ue.isMountpoint(u))throw new ue.ErrnoError(10);if(n!==r&&(p=ue.nodePermissions(r,"w")))throw new ue.ErrnoError(p);ue.hashRemoveNode(c);try{r.node_ops.rename(c,n,s)}catch(e){throw e}finally{ue.hashAddNode(c)}}},rmdir:e=>{var t=ue.lookupPath(e,{parent:!0}).node,r=q.basename(e),n=ue.lookupNode(t,r),o=ue.mayDelete(t,r,!0);if(o)throw new ue.ErrnoError(o);if(!t.node_ops.rmdir)throw new ue.ErrnoError(63);if(ue.isMountpoint(n))throw new ue.ErrnoError(10);t.node_ops.rmdir(t,r),ue.destroyNode(n)},readdir:e=>{var t=ue.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new ue.ErrnoError(54);return t.node_ops.readdir(t)},unlink:e=>{var t=ue.lookupPath(e,{parent:!0}).node;if(!t)throw new ue.ErrnoError(44);var r=q.basename(e),n=ue.lookupNode(t,r),o=ue.mayDelete(t,r,!1);if(o)throw new ue.ErrnoError(o);if(!t.node_ops.unlink)throw new ue.ErrnoError(63);if(ue.isMountpoint(n))throw new ue.ErrnoError(10);t.node_ops.unlink(t,r),ue.destroyNode(n)},readlink:e=>{var t=ue.lookupPath(e).node;if(!t)throw new ue.ErrnoError(44);if(!t.node_ops.readlink)throw new ue.ErrnoError(28);return K.resolve(ue.getPath(t.parent),t.node_ops.readlink(t))},stat:(e,t)=>{var r=ue.lookupPath(e,{follow:!t}).node;if(!r)throw new ue.ErrnoError(44);if(!r.node_ops.getattr)throw new ue.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>ue.stat(e,!0),chmod:(e,t,r)=>{var n;"string"==typeof e?n=ue.lookupPath(e,{follow:!r}).node:n=e;if(!n.node_ops.setattr)throw new ue.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&t|-4096&n.mode,timestamp:Date.now()})},lchmod:(e,t)=>{ue.chmod(e,t,!0)},fchmod:(e,t)=>{var r=ue.getStreamChecked(e);ue.chmod(r.node,t)},chown:(e,t,r,n)=>{var o;"string"==typeof e?o=ue.lookupPath(e,{follow:!n}).node:o=e;if(!o.node_ops.setattr)throw new ue.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown:(e,t,r)=>{ue.chown(e,t,r,!0)},fchown:(e,t,r)=>{var n=ue.getStreamChecked(e);ue.chown(n.node,t,r)},truncate:(e,t)=>{if(t<0)throw new ue.ErrnoError(28);var r;"string"==typeof e?r=ue.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new ue.ErrnoError(63);if(ue.isDir(r.mode))throw new ue.ErrnoError(31);if(!ue.isFile(r.mode))throw new ue.ErrnoError(28);var n=ue.nodePermissions(r,"w");if(n)throw new ue.ErrnoError(n);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate:(e,t)=>{var r=ue.getStreamChecked(e);if(!(2097155&r.flags))throw new ue.ErrnoError(28);ue.truncate(r.node,t)},utime:(e,t,r)=>{var n=ue.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(t,r)})},open:(e,t,r)=>{if(""===e)throw new ue.ErrnoError(44);var n;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?function(e){var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t}(t):t)?4095&r|32768:0,"object"==typeof e)n=e;else{e=q.normalize(e);try{n=ue.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var a=!1;if(64&t)if(n){if(128&t)throw new ue.ErrnoError(20)}else n=ue.mknod(e,r,0),a=!0;if(!n)throw new ue.ErrnoError(44);if(ue.isChrdev(n.mode)&&(t&=-513),65536&t&&!ue.isDir(n.mode))throw new ue.ErrnoError(54);if(!a){var i=ue.mayOpen(n,t);if(i)throw new ue.ErrnoError(i)}512&t&&!a&&ue.truncate(n,0),t&=-131713;var s=ue.createStream({node:n,path:ue.getPath(n),flags:t,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!o.logReadFiles||1&t||(ue.readFiles||(ue.readFiles={}),e in ue.readFiles||(ue.readFiles[e]=1)),s},close:e=>{if(ue.isClosed(e))throw new ue.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{ue.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek:(e,t,r)=>{if(ue.isClosed(e))throw new ue.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new ue.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new ue.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read:(e,t,r,n,o)=>{if(n<0||o<0)throw new ue.ErrnoError(28);if(ue.isClosed(e))throw new ue.ErrnoError(8);if(1==(2097155&e.flags))throw new ue.ErrnoError(8);if(ue.isDir(e.node.mode))throw new ue.ErrnoError(31);if(!e.stream_ops.read)throw new ue.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new ue.ErrnoError(70)}else o=e.position;var i=e.stream_ops.read(e,t,r,n,o);return a||(e.position+=i),i},write:(e,t,r,n,o,a)=>{if(n<0||o<0)throw new ue.ErrnoError(28);if(ue.isClosed(e))throw new ue.ErrnoError(8);if(!(2097155&e.flags))throw new ue.ErrnoError(8);if(ue.isDir(e.node.mode))throw new ue.ErrnoError(31);if(!e.stream_ops.write)throw new ue.ErrnoError(28);e.seekable&&1024&e.flags&&ue.llseek(e,0,2);var i=void 0!==o;if(i){if(!e.seekable)throw new ue.ErrnoError(70)}else o=e.position;var s=e.stream_ops.write(e,t,r,n,o,a);return i||(e.position+=s),s},allocate:(e,t,r)=>{if(ue.isClosed(e))throw new ue.ErrnoError(8);if(t<0||r<=0)throw new ue.ErrnoError(28);if(!(2097155&e.flags))throw new ue.ErrnoError(8);if(!ue.isFile(e.node.mode)&&!ue.isDir(e.node.mode))throw new ue.ErrnoError(43);if(!e.stream_ops.allocate)throw new ue.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap:(e,t,r,n,o)=>{if(2&n&&!(2&o)&&2!=(2097155&e.flags))throw new ue.ErrnoError(2);if(1==(2097155&e.flags))throw new ue.ErrnoError(2);if(!e.stream_ops.mmap)throw new ue.ErrnoError(43);return e.stream_ops.mmap(e,t,r,n,o)},msync:(e,t,r,n,o)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,n,o):0,munmap:e=>0,ioctl:(e,t,r)=>{if(!e.stream_ops.ioctl)throw new ue.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile:(e,t={})=>{if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,n=ue.open(e,t.flags),o=ue.stat(e).size,a=new Uint8Array(o);return ue.read(n,a,0,o,0),"utf8"===t.encoding?r=J(a,0):"binary"===t.encoding&&(r=a),ue.close(n),r},writeFile:(e,t,r={})=>{r.flags=r.flags||577;var n=ue.open(e,r.flags,r.mode);if("string"==typeof t){var o=new Uint8Array(Q(t)+1),a=ee(t,o,0,o.length);ue.write(n,o,0,a,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");ue.write(n,t,0,t.byteLength,void 0,r.canOwn)}ue.close(n)},cwd:()=>ue.currentPath,chdir:e=>{var t=ue.lookupPath(e,{follow:!0});if(null===t.node)throw new ue.ErrnoError(44);if(!ue.isDir(t.node.mode))throw new ue.ErrnoError(54);var r=ue.nodePermissions(t.node,"x");if(r)throw new ue.ErrnoError(r);ue.currentPath=t.path},createDefaultDirectories:()=>{ue.mkdir("/tmp"),ue.mkdir("/home"),ue.mkdir("/home/web_user")},createDefaultDevices:()=>{ue.mkdir("/dev"),ue.registerDevice(ue.makedev(1,3),{read:()=>0,write:(e,t,r,n,o)=>n}),ue.mkdev("/dev/null",ue.makedev(1,3)),re.register(ue.makedev(5,0),re.default_tty_ops),re.register(ue.makedev(6,0),re.default_tty1_ops),ue.mkdev("/dev/tty",ue.makedev(5,0)),ue.mkdev("/dev/tty1",ue.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=X(e).byteLength),e[--t]);ue.createDevice("/dev","random",r),ue.createDevice("/dev","urandom",r),ue.mkdir("/dev/shm"),ue.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{ue.mkdir("/proc");var e=ue.mkdir("/proc/self");ue.mkdir("/proc/self/fd"),ue.mount({mount:()=>{var t=ue.createNode(e,"fd",16895,73);return t.node_ops={lookup:(e,t)=>{var r=+t,n=ue.getStreamChecked(r),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},t}},{},"/proc/self/fd")},createStandardStreams:()=>{o.stdin?ue.createDevice("/dev","stdin",o.stdin):ue.symlink("/dev/tty","/dev/stdin"),o.stdout?ue.createDevice("/dev","stdout",null,o.stdout):ue.symlink("/dev/tty","/dev/stdout"),o.stderr?ue.createDevice("/dev","stderr",null,o.stderr):ue.symlink("/dev/tty1","/dev/stderr");ue.open("/dev/stdin",0),ue.open("/dev/stdout",1),ue.open("/dev/stderr",1)},ensureErrnoError:()=>{ue.ErrnoError||(ue.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},ue.ErrnoError.prototype=new Error,ue.ErrnoError.prototype.constructor=ue.ErrnoError,[44].forEach((e=>{ue.genericErrors[e]=new ue.ErrnoError(e),ue.genericErrors[e].stack="<generic error, no stack>"})))},staticInit:()=>{ue.ensureErrnoError(),ue.nameTable=new Array(4096),ue.mount(oe,{},"/"),ue.createDefaultDirectories(),ue.createDefaultDevices(),ue.createSpecialDirectories(),ue.filesystems={MEMFS:oe}},init:(e,t,r)=>{ue.init.initialized=!0,ue.ensureErrnoError(),o.stdin=e||o.stdin,o.stdout=t||o.stdout,o.stderr=r||o.stderr,ue.createStandardStreams()},quit:()=>{ue.init.initialized=!1;for(var e=0;e<ue.streams.length;e++){var t=ue.streams[e];t&&ue.close(t)}},findObject:(e,t)=>{var r=ue.analyzePath(e,t);return r.exists?r.object:null},analyzePath:(e,t)=>{try{e=(n=ue.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=ue.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=q.basename(e),n=ue.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot="/"===n.path}catch(e){r.error=e.errno}return r},createPath:(e,t,r,n)=>{e="string"==typeof e?e:ue.getPath(e);for(var o=t.split("/").reverse();o.length;){var a=o.pop();if(a){var i=q.join2(e,a);try{ue.mkdir(i)}catch(e){}e=i}}return i},createFile:(e,t,r,n,o)=>{var a=q.join2("string"==typeof e?e:ue.getPath(e),t),i=se(n,o);return ue.create(a,i)},createDataFile:(e,t,r,n,o,a)=>{var i=t;e&&(e="string"==typeof e?e:ue.getPath(e),i=t?q.join2(e,t):e);var s=se(n,o),u=ue.create(i,s);if(r){if("string"==typeof r){for(var c=new Array(r.length),l=0,d=r.length;l<d;++l)c[l]=r.charCodeAt(l);r=c}ue.chmod(u,146|s);var p=ue.open(u,577);ue.write(p,r,0,r.length,0,a),ue.close(p),ue.chmod(u,s)}return u},createDevice:(e,t,r,n)=>{var o=q.join2("string"==typeof e?e:ue.getPath(e),t),a=se(!!r,!!n);ue.createDevice.major||(ue.createDevice.major=64);var i=ue.makedev(ue.createDevice.major++,0);return ue.registerDevice(i,{open:e=>{e.seekable=!1},close:e=>{n&&n.buffer&&n.buffer.length&&n(10)},read:(e,t,n,o,a)=>{for(var i=0,s=0;s<o;s++){var u;try{u=r()}catch(e){throw new ue.ErrnoError(29)}if(void 0===u&&0===i)throw new ue.ErrnoError(6);if(null==u)break;i++,t[n+s]=u}return i&&(e.node.timestamp=Date.now()),i},write:(e,t,r,o,a)=>{for(var i=0;i<o;i++)try{n(t[r+i])}catch(e){throw new ue.ErrnoError(29)}return o&&(e.node.timestamp=Date.now()),i}}),ue.mkdev(o,a,i)},forceLoadFile:e=>{if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)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(!a)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=te(a(e.url),!0),e.usedBytes=e.contents.length}catch(e){throw new ue.ErrnoError(29)}},createLazyFile:(e,t,r,n,o)=>{function a(){this.lengthKnown=!1,this.chunks=[]}if(a.prototype.get=function(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},a.prototype.setDataGetter=function(e){this.getter=e},a.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,n=Number(e.getResponseHeader("Content-length")),o=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,a=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,i=1048576;o||(i=n);var s=this;s.setDataGetter((e=>{var t=e*i,o=(e+1)*i-1;if(o=Math.min(o,n-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",r,!1),n!==i&&o.setRequestHeader("Range","bytes="+e+"-"+t),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+r+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):te(o.responseText||"",!0)})(t,o)),void 0===s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]})),!a&&n||(i=n=1,n=this.getter(0).length,i=n,h("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!d)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i=new a;Object.defineProperties(i,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:i}}else s={isDevice:!1,url:r};var u=ue.createFile(e,t,s,n,o);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var c={};function l(e,t,r,n,o){var a=e.node.contents;if(o>=a.length)return 0;var i=Math.min(a.length-o,n);if(a.slice)for(var s=0;s<i;s++)t[r+s]=a[o+s];else for(s=0;s<i;s++)t[r+s]=a.get(o+s);return i}return Object.keys(u.stream_ops).forEach((e=>{var t=u.stream_ops[e];c[e]=function(){return ue.forceLoadFile(u),t.apply(null,arguments)}})),c.read=(e,t,r,n,o)=>(ue.forceLoadFile(u),l(e,t,r,n,o)),c.mmap=(e,t,r,n,o)=>{ue.forceLoadFile(u);var a=ne();if(!a)throw new ue.ErrnoError(48);return l(e,g,a,t,r),{ptr:a,allocated:!0}},u.stream_ops=c,u}},ce=(e,t)=>e?J(w,e,t):"",le={DEFAULT_POLLMASK:5,calculateAt:function(e,t,r){if(q.isAbs(t))return t;var n;-100===e?n=ue.cwd():n=le.getStreamFromFD(e).path;if(0==t.length){if(!r)throw new ue.ErrnoError(44);return n}return q.join2(n,t)},doStat:function(e,t,r){try{var n=e(t)}catch(e){if(e&&e.node&&q.normalize(t)!==q.normalize(ue.getPath(e.node)))return-54;throw e}b[r>>2]=n.dev,b[r+4>>2]=n.mode,$[r+8>>2]=n.nlink,b[r+12>>2]=n.uid,b[r+16>>2]=n.gid,b[r+20>>2]=n.rdev,W=[n.size>>>0,(U=n.size,+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[r+24>>2]=W[0],b[r+28>>2]=W[1],b[r+32>>2]=4096,b[r+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),i=n.ctime.getTime();return W=[Math.floor(o/1e3)>>>0,(U=Math.floor(o/1e3),+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[r+40>>2]=W[0],b[r+44>>2]=W[1],$[r+48>>2]=o%1e3*1e3,W=[Math.floor(a/1e3)>>>0,(U=Math.floor(a/1e3),+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[r+56>>2]=W[0],b[r+60>>2]=W[1],$[r+64>>2]=a%1e3*1e3,W=[Math.floor(i/1e3)>>>0,(U=Math.floor(i/1e3),+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[r+72>>2]=W[0],b[r+76>>2]=W[1],$[r+80>>2]=i%1e3*1e3,W=[n.ino>>>0,(U=n.ino,+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[r+88>>2]=W[0],b[r+92>>2]=W[1],0},doMsync:function(e,t,r,n,o){if(!ue.isFile(t.node.mode))throw new ue.ErrnoError(43);if(2&n)return 0;var a=w.slice(e,e+r);ue.msync(t,a,o,r,n)},varargs:void 0,get:()=>(le.varargs+=4,b[le.varargs-4>>2]),getStr:e=>ce(e),getStreamFromFD:function(e){return ue.getStreamChecked(e)}};function de(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(`Unknown type size: ${e}`)}}var pe=void 0;function fe(e){for(var t="",r=e;w[r];)t+=pe[w[r++]];return t}var he={},me={},ve={},ye=void 0;function ge(e){throw new ye(e)}var we=void 0;function _e(e){throw new we(e)}function Ee(e,t,r){function n(t){var n=r(t);n.length!==e.length&&_e("Mismatched type converter count");for(var o=0;o<e.length;++o)be(e[o],n[o])}e.forEach((function(e){ve[e]=t}));var o=new Array(t.length),a=[],i=0;t.forEach(((e,t)=>{me.hasOwnProperty(e)?o[t]=me[e]:(a.push(e),he.hasOwnProperty(e)||(he[e]=[]),he[e].push((()=>{o[t]=me[e],++i===a.length&&n(o)})))})),0===a.length&&n(o)}function be(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t,r={}){var n=t.name;if(e||ge(`type "${n}" must have a positive integer typeid pointer`),me.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;ge(`Cannot register type '${n}' twice`)}if(me[e]=t,delete ve[e],he.hasOwnProperty(e)){var o=he[e];delete he[e],o.forEach((e=>e()))}}(e,t,r)}function $e(e){if(!(this instanceof He))return!1;if(!(e instanceof He))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=e.$$.ptrType.registeredClass,o=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return t===n&&r===o}function Pe(e){ge(e.$$.ptrType.registeredClass.name+" instance already deleted")}var Te=!1;function Ce(e){}function ke(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function Se(e,t,r){if(t===r)return e;if(void 0===r.baseClass)return null;var n=Se(e,t,r.baseClass);return null===n?null:r.downcast(n)}var Ae={};function De(){return Object.keys(xe).length}function Fe(){var e=[];for(var t in xe)xe.hasOwnProperty(t)&&e.push(xe[t]);return e}var Oe=[];function Me(){for(;Oe.length;){var e=Oe.pop();e.$$.deleteScheduled=!1,e.delete()}}var Re=void 0;function je(e){Re=e,Oe.length&&Re&&Re(Me)}var xe={};function Ie(e,t){return t=function(e,t){for(void 0===t&&ge("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),xe[t]}function Ne(e,t){return t.ptrType&&t.ptr||_e("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&_e("Both smartPtrType and smartPtr must be specified"),t.count={value:1},We(Object.create(e,{$$:{value:t}}))}function Ue(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=Ie(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?Ne(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Ne(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a,i=this.registeredClass.getActualType(t),s=Ae[i];if(!s)return o.call(this);a=this.isConst?s.constPointerType:s.pointerType;var u=Se(t,this.registeredClass,a.registeredClass);return null===u?o.call(this):this.isSmartPointer?Ne(a.registeredClass.instancePrototype,{ptrType:a,ptr:u,smartPtrType:this,smartPtr:e}):Ne(a.registeredClass.instancePrototype,{ptrType:a,ptr:u})}var We=function(e){return"undefined"==typeof FinalizationRegistry?(We=e=>e,e):(Te=new FinalizationRegistry((e=>{ke(e.$$)})),Ce=e=>Te.unregister(e),(We=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};Te.register(e,r,e)}return e})(e))};function Be(){if(this.$$.ptr||Pe(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=We(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function Ve(){this.$$.ptr||Pe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ge("Object already scheduled for deletion"),Ce(this),ke(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Le(){return!this.$$.ptr}function ze(){return this.$$.ptr||Pe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ge("Object already scheduled for deletion"),Oe.push(this),1===Oe.length&&Re&&Re(Me),this.$$.deleteScheduled=!0,this}function He(){}var Ge=48,qe=57;function Xe(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=Ge&&t<=qe?`_${e}`:e}function Ke(e,t){return e=Xe(e),{[e]:function(){return t.apply(this,arguments)}}[e]}function Ye(e,t,r){if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||ge(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}}function Je(e,t,r,n,o,a,i,s){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=o,this.getActualType=a,this.upcast=i,this.downcast=s,this.pureVirtualFunctions=[]}function Ze(e,t,r){for(;t!==r;)t.upcast||ge(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e}function Qe(e,t){if(null===t)return this.isReference&&ge(`null is not a valid ${this.name}`),0;t.$$||ge(`Cannot pass "${Pt(t)}" as a ${this.name}`),t.$$.ptr||ge(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ze(t.$$.ptr,r,this.registeredClass)}function et(e,t){var r;if(null===t)return this.isReference&&ge(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||ge(`Cannot pass "${Pt(t)}" as a ${this.name}`),t.$$.ptr||ge(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&ge(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;if(r=Ze(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&ge("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:ge(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var o=t.clone();r=this.rawShare(r,$t.toHandle((function(){o.delete()}))),null!==e&&e.push(this.rawDestructor,r)}break;default:ge("Unsupporting sharing policy")}return r}function tt(e,t){if(null===t)return this.isReference&&ge(`null is not a valid ${this.name}`),0;t.$$||ge(`Cannot pass "${Pt(t)}" as a ${this.name}`),t.$$.ptr||ge(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&ge(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ze(t.$$.ptr,r,this.registeredClass)}function rt(e){return this.fromWireType(b[e>>2])}function nt(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function ot(e){this.rawDestructor&&this.rawDestructor(e)}function at(e){null!==e&&e.delete()}function it(e,t,r,n,o,a,i,s,u,c,l){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=o,this.pointeeType=a,this.sharingPolicy=i,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=c,this.rawDestructor=l,o||void 0!==t.baseClass?this.toWireType=et:n?(this.toWireType=Qe,this.destructorFunction=null):(this.toWireType=tt,this.destructorFunction=null)}var st=[],ut=e=>{var t=st[e];return t||(e>=st.length&&(st.length=e+1),st[e]=t=C.get(e)),t},ct=(e,t,r)=>e.includes("j")?((e,t,r)=>{var n=o["dynCall_"+e];return r&&r.length?n.apply(null,[t].concat(r)):n.call(null,t)})(e,t,r):ut(t).apply(null,r),lt=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),ct(e,t,r)}};function dt(e,t){var r=(e=fe(e)).includes("j")?lt(e,t):ut(t);return"function"!=typeof r&&ge(`unknown function pointer with signature ${e}: ${t}`),r}var pt=void 0;function ft(e){var t=Yt(e),r=fe(t);return Xt(t),r}function ht(e,t){var r=[],n={};throw t.forEach((function e(t){n[t]||me[t]||(ve[t]?ve[t].forEach(e):(r.push(t),n[t]=!0))})),new pt(`${e}: `+r.map(ft).join([", "]))}function mt(e,t){for(var r=[],n=0;n<e;n++)r.push($[t+4*n>>2]);return r}function vt(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=Ke(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var n=new r,o=e.apply(n,t);return o instanceof Object?o:n}function gt(e,t,r,n,o,a){var i=t.length;i<2&&ge("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==t[1]&&null!==r,u=!1,c=1;c<t.length;++c)if(null!==t[c]&&void 0===t[c].destructorFunction){u=!0;break}var l="void"!==t[0].name,d="",p="";for(c=0;c<i-2;++c)d+=(0!==c?", ":"")+"arg"+c,p+=(0!==c?", ":"")+"arg"+c+"Wired";var f=`\n return function ${Xe(e)}(${d}) {\n if (arguments.length !== ${i-2}) {\n throwBindingError('function ${e} called with ${arguments.length} arguments, expected ${i-2} args!');\n }`;u&&(f+="var destructors = [];\n");var h=u?"destructors":"null",m=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],v=[ge,n,o,vt,t[0],t[1]];s&&(f+="var thisWired = classParam.toWireType("+h+", this);\n");for(c=0;c<i-2;++c)f+="var arg"+c+"Wired = argType"+c+".toWireType("+h+", arg"+c+"); // "+t[c+2].name+"\n",m.push("argType"+c),v.push(t[c+2]);if(s&&(p="thisWired"+(p.length>0?", ":"")+p),f+=(l||a?"var rv = ":"")+"invoker(fn"+(p.length>0?", ":"")+p+");\n",u)f+="runDestructors(destructors);\n";else for(c=s?1:2;c<t.length;++c){var y=1===c?"thisWired":"arg"+(c-2)+"Wired";null!==t[c].destructorFunction&&(f+=y+"_dtor("+y+"); // "+t[c].name+"\n",m.push(y+"_dtor"),v.push(t[c].destructorFunction))}return l&&(f+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),f+="}\n",m.push(f),yt(Function,m).apply(null,v)}function wt(){this.allocated=[void 0],this.freelist=[]}var _t=new wt;function Et(e){e>=_t.reserved&&0==--_t.get(e).refcount&&_t.free(e)}function bt(){for(var e=0,t=_t.reserved;t<_t.allocated.length;++t)void 0!==_t.allocated[t]&&++e;return e}var $t={toValue:e=>(e||ge("Cannot use deleted val. handle = "+e),_t.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return _t.allocate({refcount:1,value:e})}}};function Pt(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}function Tt(e,t){switch(t){case 2:return function(e){return this.fromWireType(P[e>>2])};case 3:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Ct(e,t,r){switch(t){case 0:return r?function(e){return g[e]}:function(e){return w[e]};case 1:return r?function(e){return _[e>>1]}:function(e){return E[e>>1]};case 2:return r?function(e){return b[e>>2]}:function(e){return $[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}var kt="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,St=(e,t)=>{for(var r=e,n=r>>1,o=n+t/2;!(n>=o)&&E[n];)++n;if((r=n<<1)-e>32&&kt)return kt.decode(w.subarray(e,r));for(var a="",i=0;!(i>=t/2);++i){var s=_[e+2*i>>1];if(0==s)break;a+=String.fromCharCode(s)}return a},At=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var n=t,o=(r-=2)<2*e.length?r/2:e.length,a=0;a<o;++a){var i=e.charCodeAt(a);_[t>>1]=i,t+=2}return _[t>>1]=0,t-n},Dt=e=>2*e.length,Ft=(e,t)=>{for(var r=0,n="";!(r>=t/4);){var o=b[e+4*r>>2];if(0==o)break;if(++r,o>=65536){var a=o-65536;n+=String.fromCharCode(55296|a>>10,56320|1023&a)}else n+=String.fromCharCode(o)}return n},Ot=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var n=t,o=n+r-4,a=0;a<e.length;++a){var i=e.charCodeAt(a);if(i>=55296&&i<=57343)i=65536+((1023&i)<<10)|1023&e.charCodeAt(++a);if(b[t>>2]=i,(t+=4)+4>o)break}return b[t>>2]=0,t-n},Mt=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t};var Rt={};var jt=[];var xt=[];var It={},Nt=()=>{if(!Nt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:c||"./this.program"};for(var t in It)void 0===It[t]?delete e[t]:e[t]=It[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Nt.strings=r}return Nt.strings};var Ut,Wt,Bt,Vt=function(e,t,r,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=ue.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=n},Lt=365,zt=146;Object.defineProperties(Vt.prototype,{read:{get:function(){return(this.mode&Lt)===Lt},set:function(e){e?this.mode|=Lt:this.mode&=-366}},write:{get:function(){return(this.mode&zt)===zt},set:function(e){e?this.mode|=zt:this.mode&=-147}},isFolder:{get:function(){return ue.isDir(this.mode)}},isDevice:{get:function(){return ue.isChrdev(this.mode)}}}),ue.FSNode=Vt,ue.createPreloadedFile=function(e,t,r,n,o,a,i,s,u,c){var l=t?K.resolve(q.join2(e,t)):e;function d(r){function d(r){c&&c(),s||ue.createDataFile(e,t,r,n,o,u),a&&a(),j()}(function(e,t,r,n){"undefined"!=typeof Browser&&Browser.init();var o=!1;return ie.forEach((function(a){o||a.canHandle(t)&&(a.handle(e,t,r,n),o=!0)})),o})(r,l,d,(()=>{i&&i(),j()}))||d(r)}R(),"string"==typeof r?ae(r,(e=>d(e)),i):d(r)},ue.staticInit(),function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);pe=e}(),ye=o.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},we=o.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},He.prototype.isAliasOf=$e,He.prototype.clone=Be,He.prototype.delete=Ve,He.prototype.isDeleted=Le,He.prototype.deleteLater=ze,o.getInheritedInstanceCount=De,o.getLiveInheritedInstances=Fe,o.flushPendingDeletes=Me,o.setDelayFunction=je,it.prototype.getPointee=nt,it.prototype.destructor=ot,it.prototype.argPackAdvance=8,it.prototype.readValueFromPointer=rt,it.prototype.deleteObject=at,it.prototype.fromWireType=Ue,pt=o.UnboundTypeError=(Ut=Error,(Bt=Ke(Wt="UnboundTypeError",(function(e){this.name=Wt,this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create(Ut.prototype),Bt.prototype.constructor=Bt,Bt.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},Bt),Object.assign(wt.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}}),_t.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),_t.reserved=_t.allocated.length,o.count_emval_handles=bt;var Ht,Gt={p:function(e,t,r){throw new G(e).init(t,r),e},C:function(e,t,r){le.varargs=r;try{var n=le.getStreamFromFD(e);switch(t){case 0:return(o=le.get())<0?-28:ue.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=le.get();return n.flags|=o,0;case 5:o=le.get();return _[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return a=28,b[Kt()>>2]=a,-1}}catch(e){if(void 0===ue||"ErrnoError"!==e.name)throw e;return-e.errno}var a},w:function(e,t,r,n){le.varargs=n;try{t=le.getStr(t),t=le.calculateAt(e,t);var o=n?le.get():0;return ue.open(t,r,o).fd}catch(e){if(void 0===ue||"ErrnoError"!==e.name)throw e;return-e.errno}},t:function(e,t,r,n,o){},n:function(e,t,r,n,o){var a=de(r);be(e,{name:t=fe(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:o},argPackAdvance:8,readValueFromPointer:function(e){var n;if(1===r)n=g;else if(2===r)n=_;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+t);n=b}return this.fromWireType(n[e>>a])},destructorFunction:null})},r:function(e,t,r,n,a,i,s,u,c,l,d,p,f){d=fe(d),i=dt(a,i),u&&(u=dt(s,u)),l&&(l=dt(c,l)),f=dt(p,f);var h=Xe(d);!function(e,t,r){o.hasOwnProperty(e)?((void 0===r||void 0!==o[e].overloadTable&&void 0!==o[e].overloadTable[r])&&ge(`Cannot register public name '${e}' twice`),Ye(o,e,e),o.hasOwnProperty(r)&&ge(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),o[e].overloadTable[r]=t):(o[e]=t,void 0!==r&&(o[e].numArguments=r))}(h,(function(){ht(`Cannot construct ${d} due to unbound types`,[n])})),Ee([e,t,r],n?[n]:[],(function(t){var r,a;t=t[0],a=n?(r=t.registeredClass).instancePrototype:He.prototype;var s=Ke(h,(function(){if(Object.getPrototypeOf(this)!==c)throw new ye("Use 'new' to construct "+d);if(void 0===p.constructor_body)throw new ye(d+" has no accessible constructor");var e=p.constructor_body[arguments.length];if(void 0===e)throw new ye(`Tried to invoke ctor of ${d} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(p.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),c=Object.create(a,{constructor:{value:s}});s.prototype=c;var p=new Je(d,s,c,f,r,i,u,l);p.baseClass&&(void 0===p.baseClass.__derivedClasses&&(p.baseClass.__derivedClasses=[]),p.baseClass.__derivedClasses.push(p));var m=new it(d,p,!0,!1,!1),v=new it(d+"*",p,!1,!1,!1),y=new it(d+" const*",p,!1,!0,!1);return Ae[e]={pointerType:v,constPointerType:y},function(e,t,r){o.hasOwnProperty(e)||_e("Replacing nonexistant public symbol"),void 0!==o[e].overloadTable&&void 0!==r?o[e].overloadTable[r]=t:(o[e]=t,o[e].argCount=r)}(h,s),[m,v,y]}))},q:function(e,t,r,n,o,a){var i=mt(t,r);o=dt(n,o),Ee([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new ye(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{ht(`Cannot construct ${e.name} due to unbound types`,i)},Ee([],i,(function(n){return n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=gt(r,n,null,o,a),[]})),[]}))},d:function(e,t,r,n,o,a,i,s,u){var c=mt(r,n);t=fe(t),a=dt(o,a),Ee([],[e],(function(e){var n=`${(e=e[0]).name}.${t}`;function o(){ht(`Cannot call ${n} due to unbound types`,c)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,d=l[t];return void 0===d||void 0===d.overloadTable&&d.className!==e.name&&d.argCount===r-2?(o.argCount=r-2,o.className=e.name,l[t]=o):(Ye(l,t,n),l[t].overloadTable[r-2]=o),Ee([],c,(function(o){var s=gt(n,o,e,a,i,u);return void 0===l[t].overloadTable?(s.argCount=r-2,l[t]=s):l[t].overloadTable[r-2]=s,[]})),[]}))},D:function(e,t){be(e,{name:t=fe(t),fromWireType:function(e){var t=$t.toValue(e);return Et(e),t},toWireType:function(e,t){return $t.toHandle(t)},argPackAdvance:8,readValueFromPointer:rt,destructorFunction:null})},k:function(e,t,r){var n=de(r);be(e,{name:t=fe(t),fromWireType:function(e){return e},toWireType:function(e,t){return t},argPackAdvance:8,readValueFromPointer:Tt(t,n),destructorFunction:null})},c:function(e,t,r,n,o){t=fe(t),-1===o&&(o=4294967295);var a=de(r),i=e=>e;if(0===n){var s=32-8*r;i=e=>e<<s>>>s}var u=t.includes("unsigned");be(e,{name:t,fromWireType:i,toWireType:u?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:8,readValueFromPointer:Ct(t,a,0!==n),destructorFunction:null})},b:function(e,t,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function o(e){var t=$,r=t[e>>=2],o=t[e+1];return new n(t.buffer,o,r)}be(e,{name:r=fe(r),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},j:function(e,t){var r="std::string"===(t=fe(t));be(e,{name:t,fromWireType:function(e){var t,n=$[e>>2],o=e+4;if(r)for(var a=o,i=0;i<=n;++i){var s=o+i;if(i==n||0==w[s]){var u=ce(a,s-a);void 0===t?t=u:(t+=String.fromCharCode(0),t+=u),a=s+1}}else{var c=new Array(n);for(i=0;i<n;++i)c[i]=String.fromCharCode(w[o+i]);t=c.join("")}return Xt(e),t},toWireType:function(e,t){var n;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var o="string"==typeof t;o||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||ge("Cannot pass non-string to std::string"),n=r&&o?Q(t):t.length;var a=qt(4+n+1),i=a+4;if($[a>>2]=n,r&&o)ee(t,w,i,n+1);else if(o)for(var s=0;s<n;++s){var u=t.charCodeAt(s);u>255&&(Xt(i),ge("String has UTF-16 code units that do not fit in 8 bits")),w[i+s]=u}else for(s=0;s<n;++s)w[i+s]=t[s];return null!==e&&e.push(Xt,a),a},argPackAdvance:8,readValueFromPointer:rt,destructorFunction:function(e){Xt(e)}})},f:function(e,t,r){var n,o,a,i,s;r=fe(r),2===t?(n=St,o=At,i=Dt,a=()=>E,s=1):4===t&&(n=Ft,o=Ot,i=Mt,a=()=>$,s=2),be(e,{name:r,fromWireType:function(e){for(var r,o=$[e>>2],i=a(),u=e+4,c=0;c<=o;++c){var l=e+4+c*t;if(c==o||0==i[l>>s]){var d=n(u,l-u);void 0===r?r=d:(r+=String.fromCharCode(0),r+=d),u=l+t}}return Xt(e),r},toWireType:function(e,n){"string"!=typeof n&&ge(`Cannot pass non-string to C++ string type ${r}`);var a=i(n),u=qt(4+a+t);return $[u>>2]=a>>s,o(n,u+4,a+t),null!==e&&e.push(Xt,u),u},argPackAdvance:8,readValueFromPointer:rt,destructorFunction:function(e){Xt(e)}})},o:function(e,t){be(e,{isVoid:!0,name:t=fe(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},g:function(e,t,r,n){var o,a;(e=jt[e])(t=$t.toValue(t),r=void 0===(a=Rt[o=r])?fe(o):a,null,n)},m:Et,l:function(e,t){var r=function(e,t){for(var r,n,o,a=new Array(e),i=0;i<e;++i)a[i]=(r=$[t+4*i>>2],n="parameter "+i,o=void 0,void 0===(o=me[r])&&ge(n+" has unknown type "+ft(r)),o);return a}(e,t),n=r[0],o=n.name+"_$"+r.slice(1).map((function(e){return e.name})).join("_")+"$",a=xt[o];if(void 0!==a)return a;for(var i=["retType"],s=[n],u="",c=0;c<e-1;++c)u+=(0!==c?", ":"")+"arg"+c,i.push("argType"+c),s.push(r[1+c]);var l="return function "+Xe("methodCaller_"+o)+"(handle, name, destructors, args) {\n",d=0;for(c=0;c<e-1;++c)l+=" var arg"+c+" = argType"+c+".readValueFromPointer(args"+(d?"+"+d:"")+");\n",d+=r[c+1].argPackAdvance;for(l+=" var rv = handle[name]("+u+");\n",c=0;c<e-1;++c)r[c+1].deleteObject&&(l+=" argType"+c+".deleteObject(arg"+c+");\n");n.isVoid||(l+=" return retType.toWireType(destructors, rv);\n"),l+="};\n",i.push(l);var p,f,h=yt(Function,i).apply(null,s);return p=h,f=jt.length,jt.push(p),a=f,xt[o]=a,a},a:()=>{x("")},e:function(){return Date.now()},v:()=>w.length,A:(e,t,r)=>w.copyWithin(e,t,t+r),u:e=>{w.length;x("OOM")},y:(e,t)=>{var r=0;return Nt().forEach((function(n,o){var a=t+r;$[e+4*o>>2]=a,((e,t)=>{for(var r=0;r<e.length;++r)g[0|t++]=e.charCodeAt(r);g[0|t]=0})(n,a),r+=n.length+1})),0},z:(e,t)=>{var r=Nt();$[e>>2]=r.length;var n=0;return r.forEach((function(e){n+=e.length+1})),$[t>>2]=n,0},i:function(e){try{var t=le.getStreamFromFD(e);return ue.close(t),0}catch(e){if(void 0===ue||"ErrnoError"!==e.name)throw e;return e.errno}},x:function(e,t){try{var r=le.getStreamFromFD(e),n=r.tty?2:ue.isDir(r.mode)?3:ue.isLink(r.mode)?7:4;return g[t|0]=n,_[t+2>>1]=0,W=[0,(U=0,+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[t+8>>2]=W[0],b[t+12>>2]=W[1],W=[0,(U=0,+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[t+16>>2]=W[0],b[t+20>>2]=W[1],0}catch(e){if(void 0===ue||"ErrnoError"!==e.name)throw e;return e.errno}},B:function(e,t,r,n){try{var o=((e,t,r,n)=>{for(var o=0,a=0;a<r;a++){var i=$[t>>2],s=$[t+4>>2];t+=8;var u=ue.read(e,g,i,s,n);if(u<0)return-1;if(o+=u,u<s)break;void 0!==n&&(n+=u)}return o})(le.getStreamFromFD(e),t,r);return $[n>>2]=o,0}catch(e){if(void 0===ue||"ErrnoError"!==e.name)throw e;return e.errno}},s:function(e,t,r,n,o){var a,i,s=(i=r)+2097152>>>0<4194305-!!(a=t)?(a>>>0)+4294967296*i:NaN;try{if(isNaN(s))return 61;var u=le.getStreamFromFD(e);return ue.llseek(u,s,n),W=[u.position>>>0,(U=u.position,+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[o>>2]=W[0],b[o+4>>2]=W[1],u.getdents&&0===s&&0===n&&(u.getdents=null),0}catch(e){if(void 0===ue||"ErrnoError"!==e.name)throw e;return e.errno}},h:function(e,t,r,n){try{var o=((e,t,r,n)=>{for(var o=0,a=0;a<r;a++){var i=$[t>>2],s=$[t+4>>2];t+=8;var u=ue.write(e,g,i,s,n);if(u<0)return-1;o+=u,void 0!==n&&(n+=u)}return o})(le.getStreamFromFD(e),t,r);return $[n>>2]=o,0}catch(e){if(void 0===ue||"ErrnoError"!==e.name)throw e;return e.errno}}},qt=(function(){var e,t,r,a,i={a:Gt};function s(e,t){var r,n,a=e.exports;return v=(y=a).E,r=v.buffer,o.HEAP8=g=new Int8Array(r),o.HEAP16=_=new Int16Array(r),o.HEAP32=b=new Int32Array(r),o.HEAPU8=w=new Uint8Array(r),o.HEAPU16=E=new Uint16Array(r),o.HEAPU32=$=new Uint32Array(r),o.HEAPF32=P=new Float32Array(r),o.HEAPF64=T=new Float64Array(r),C=y.H,n=y.F,A.unshift(n),j(),a}if(R(),o.instantiateWasm)try{return o.instantiateWasm(i,s)}catch(e){m("Module.instantiateWasm callback failed with error: "+e),n(e)}(e=f,t=I,r=i,a=function(e){s(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||V(t)||"function"!=typeof fetch?z(t,r,a):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(a,(function(e){return m("wasm streaming compile failed: "+e),m("falling back to ArrayBuffer instantiation"),z(t,r,a)}))))).catch(n)}(),e=>(qt=y.G)(e)),Xt=e=>(Xt=y.I)(e),Kt=()=>(Kt=y.J)(),Yt=e=>(Yt=y.K)(e),Jt=(o.__embind_initialize_bindings=()=>(o.__embind_initialize_bindings=y.L)(),e=>(Jt=y.M)(e));o.dynCall_jiji=(e,t,r,n,a)=>(o.dynCall_jiji=y.N)(e,t,r,n,a),o._ff_h264_cabac_tables=67061;function Zt(){function e(){Ht||(Ht=!0,o.calledRun=!0,k||(o.noFSInit||ue.init.initialized||ue.init(),ue.ignorePermissions=!1,re.init(),H(A),r(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),function(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)e=o.postRun.shift(),D.unshift(e);var e;H(D)}()))}F>0||(!function(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)e=o.preRun.shift(),S.unshift(e);var e;H(S)}(),F>0||(o.setStatus?(o.setStatus("Running..."),setTimeout((function(){setTimeout((function(){o.setStatus("")}),1),e()}),1)):e()))}if(M=function e(){Ht||Zt(),Ht||(M=e)},o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return Zt(),t.ready}})(),videodec_default=Module,VideoDecoderSoft=class extends VideoDecoderSoftBase{constructor(e){super(videodec_default,(null==e?void 0:e.wasmPath)?fetch(null==e?void 0:e.wasmPath).then((e=>e.arrayBuffer())):void 0,null==e?void 0:e.workerMode,null==e?void 0:e.canvas,null==e?void 0:e.yuvMode)}},Module2=(()=>{var e="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0;return function(t={}){var r,n,o=t;o.ready=new Promise(((e,t)=>{r=e,n=t}));var a,i=Object.assign({},o),s="object"==typeof window,u="function"==typeof importScripts,c=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(s||u)&&(u?c=self.location.href:"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),e&&(c=e),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",u&&(a=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}));var l,d=o.print||console.log.bind(console),p=o.printErr||console.error.bind(console);Object.assign(o,i),i=null,o.arguments&&o.arguments,o.thisProgram&&o.thisProgram,o.quit&&o.quit,o.wasmBinary&&(l=o.wasmBinary);var f,h;o.noExitRuntime;"object"!=typeof WebAssembly&&F("no native wasm support detected");var m,v,y,g,w,_,E,b,$,P=!1;var T=[],C=[],k=[];var S=0,A=null,D=null;function F(e){o.onAbort&&o.onAbort(e),p(e="Aborted("+e+")"),P=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}var O,M,R="data:application/octet-stream;base64,";function j(e){return e.startsWith(R)}function x(e){if(e==O&&l)return new Uint8Array(l);if(a)return a(e);throw"both async and sync fetching of the wasm failed"}function I(e,t,r){return function(e){return l||!s&&!u||"function"!=typeof fetch?Promise.resolve().then((()=>x(e))):fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>x(e)))}(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{p("failed to asynchronously prepare wasm: "+e),F(e)}))}j(O="videodec_simd.wasm")||(M=O,O=o.locateFile?o.locateFile(M,c):c+M);var N=e=>{for(;e.length>0;)e.shift()(o)};function U(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){_[this.ptr+4>>2]=e},this.get_type=function(){return _[this.ptr+4>>2]},this.set_destructor=function(e){_[this.ptr+8>>2]=e},this.get_destructor=function(){return _[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,m[this.ptr+12|0]=e},this.get_caught=function(){return 0!=m[this.ptr+12|0]},this.set_rethrown=function(e){e=e?1:0,m[this.ptr+13|0]=e},this.get_rethrown=function(){return 0!=m[this.ptr+13|0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){_[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return _[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Tt(this.get_type()))return _[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}function W(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(`Unknown type size: ${e}`)}}var B=void 0;function V(e){for(var t="",r=e;v[r];)t+=B[v[r++]];return t}var L={},z={},H={},G=void 0;function q(e){throw new G(e)}var X=void 0;function K(e){throw new X(e)}function Y(e,t,r){function n(t){var n=r(t);n.length!==e.length&&K("Mismatched type converter count");for(var o=0;o<e.length;++o)J(e[o],n[o])}e.forEach((function(e){H[e]=t}));var o=new Array(t.length),a=[],i=0;t.forEach(((e,t)=>{z.hasOwnProperty(e)?o[t]=z[e]:(a.push(e),L.hasOwnProperty(e)||(L[e]=[]),L[e].push((()=>{o[t]=z[e],++i===a.length&&n(o)})))})),0===a.length&&n(o)}function J(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t,r={}){var n=t.name;if(e||q(`type "${n}" must have a positive integer typeid pointer`),z.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;q(`Cannot register type '${n}' twice`)}if(z[e]=t,delete H[e],L.hasOwnProperty(e)){var o=L[e];delete L[e],o.forEach((e=>e()))}}(e,t,r)}function Z(e){if(!(this instanceof _e))return!1;if(!(e instanceof _e))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=e.$$.ptrType.registeredClass,o=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return t===n&&r===o}function Q(e){q(e.$$.ptrType.registeredClass.name+" instance already deleted")}var ee=!1;function te(e){}function re(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function ne(e,t,r){if(t===r)return e;if(void 0===r.baseClass)return null;var n=ne(e,t,r.baseClass);return null===n?null:r.downcast(n)}var oe={};function ae(){return Object.keys(de).length}function ie(){var e=[];for(var t in de)de.hasOwnProperty(t)&&e.push(de[t]);return e}var se=[];function ue(){for(;se.length;){var e=se.pop();e.$$.deleteScheduled=!1,e.delete()}}var ce=void 0;function le(e){ce=e,se.length&&ce&&ce(ue)}var de={};function pe(e,t){return t=function(e,t){for(void 0===t&&q("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),de[t]}function fe(e,t){return t.ptrType&&t.ptr||K("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&K("Both smartPtrType and smartPtr must be specified"),t.count={value:1},me(Object.create(e,{$$:{value:t}}))}function he(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=pe(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?fe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):fe(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a,i=this.registeredClass.getActualType(t),s=oe[i];if(!s)return o.call(this);a=this.isConst?s.constPointerType:s.pointerType;var u=ne(t,this.registeredClass,a.registeredClass);return null===u?o.call(this):this.isSmartPointer?fe(a.registeredClass.instancePrototype,{ptrType:a,ptr:u,smartPtrType:this,smartPtr:e}):fe(a.registeredClass.instancePrototype,{ptrType:a,ptr:u})}var me=function(e){return"undefined"==typeof FinalizationRegistry?(me=e=>e,e):(ee=new FinalizationRegistry((e=>{re(e.$$)})),te=e=>ee.unregister(e),(me=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};ee.register(e,r,e)}return e})(e))};function ve(){if(this.$$.ptr||Q(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=me(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function ye(){this.$$.ptr||Q(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&q("Object already scheduled for deletion"),te(this),re(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function ge(){return!this.$$.ptr}function we(){return this.$$.ptr||Q(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&q("Object already scheduled for deletion"),se.push(this),1===se.length&&ce&&ce(ue),this.$$.deleteScheduled=!0,this}function _e(){}var Ee=48,be=57;function $e(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=Ee&&t<=be?`_${e}`:e}function Pe(e,t){return e=$e(e),{[e]:function(){return t.apply(this,arguments)}}[e]}function Te(e,t,r){if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||q(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}}function Ce(e,t,r,n,o,a,i,s){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=o,this.getActualType=a,this.upcast=i,this.downcast=s,this.pureVirtualFunctions=[]}function ke(e,t,r){for(;t!==r;)t.upcast||q(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e}function Se(e,t){if(null===t)return this.isReference&&q(`null is not a valid ${this.name}`),0;t.$$||q(`Cannot pass "${Qe(t)}" as a ${this.name}`),t.$$.ptr||q(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ke(t.$$.ptr,r,this.registeredClass)}function Ae(e,t){var r;if(null===t)return this.isReference&&q(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||q(`Cannot pass "${Qe(t)}" as a ${this.name}`),t.$$.ptr||q(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&q(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;if(r=ke(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&q("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:q(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var o=t.clone();r=this.rawShare(r,Ze.toHandle((function(){o.delete()}))),null!==e&&e.push(this.rawDestructor,r)}break;default:q("Unsupporting sharing policy")}return r}function De(e,t){if(null===t)return this.isReference&&q(`null is not a valid ${this.name}`),0;t.$$||q(`Cannot pass "${Qe(t)}" as a ${this.name}`),t.$$.ptr||q(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&q(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ke(t.$$.ptr,r,this.registeredClass)}function Fe(e){return this.fromWireType(w[e>>2])}function Oe(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function Me(e){this.rawDestructor&&this.rawDestructor(e)}function Re(e){null!==e&&e.delete()}function je(e,t,r,n,o,a,i,s,u,c,l){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=o,this.pointeeType=a,this.sharingPolicy=i,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=c,this.rawDestructor=l,o||void 0!==t.baseClass?this.toWireType=Ae:n?(this.toWireType=Se,this.destructorFunction=null):(this.toWireType=De,this.destructorFunction=null)}var xe=[],Ie=e=>{var t=xe[e];return t||(e>=xe.length&&(xe.length=e+1),xe[e]=t=$.get(e)),t},Ne=(e,t,r)=>e.includes("j")?((e,t,r)=>{var n=o["dynCall_"+e];return r&&r.length?n.apply(null,[t].concat(r)):n.call(null,t)})(e,t,r):Ie(t).apply(null,r),Ue=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Ne(e,t,r)}};function We(e,t){var r=(e=V(e)).includes("j")?Ue(e,t):Ie(t);return"function"!=typeof r&&q(`unknown function pointer with signature ${e}: ${t}`),r}var Be=void 0;function Ve(e){var t=Pt(e),r=V(t);return bt(t),r}function Le(e,t){var r=[],n={};throw t.forEach((function e(t){n[t]||z[t]||(H[t]?H[t].forEach(e):(r.push(t),n[t]=!0))})),new Be(`${e}: `+r.map(Ve).join([", "]))}function ze(e,t){for(var r=[],n=0;n<e;n++)r.push(_[t+4*n>>2]);return r}function He(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function Ge(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=Pe(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var n=new r,o=e.apply(n,t);return o instanceof Object?o:n}function qe(e,t,r,n,o,a){var i=t.length;i<2&&q("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==t[1]&&null!==r,u=!1,c=1;c<t.length;++c)if(null!==t[c]&&void 0===t[c].destructorFunction){u=!0;break}var l="void"!==t[0].name,d="",p="";for(c=0;c<i-2;++c)d+=(0!==c?", ":"")+"arg"+c,p+=(0!==c?", ":"")+"arg"+c+"Wired";var f=`\n return function ${$e(e)}(${d}) {\n if (arguments.length !== ${i-2}) {\n throwBindingError('function ${e} called with ${arguments.length} arguments, expected ${i-2} args!');\n }`;u&&(f+="var destructors = [];\n");var h=u?"destructors":"null",m=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],v=[q,n,o,He,t[0],t[1]];s&&(f+="var thisWired = classParam.toWireType("+h+", this);\n");for(c=0;c<i-2;++c)f+="var arg"+c+"Wired = argType"+c+".toWireType("+h+", arg"+c+"); // "+t[c+2].name+"\n",m.push("argType"+c),v.push(t[c+2]);if(s&&(p="thisWired"+(p.length>0?", ":"")+p),f+=(l||a?"var rv = ":"")+"invoker(fn"+(p.length>0?", ":"")+p+");\n",u)f+="runDestructors(destructors);\n";else for(c=s?1:2;c<t.length;++c){var y=1===c?"thisWired":"arg"+(c-2)+"Wired";null!==t[c].destructorFunction&&(f+=y+"_dtor("+y+"); // "+t[c].name+"\n",m.push(y+"_dtor"),v.push(t[c].destructorFunction))}return l&&(f+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),f+="}\n",m.push(f),Ge(Function,m).apply(null,v)}function Xe(){this.allocated=[void 0],this.freelist=[]}var Ke=new Xe;function Ye(e){e>=Ke.reserved&&0==--Ke.get(e).refcount&&Ke.free(e)}function Je(){for(var e=0,t=Ke.reserved;t<Ke.allocated.length;++t)void 0!==Ke.allocated[t]&&++e;return e}var Ze={toValue:e=>(e||q("Cannot use deleted val. handle = "+e),Ke.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return Ke.allocate({refcount:1,value:e})}}};function Qe(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}function et(e,t){switch(t){case 2:return function(e){return this.fromWireType(E[e>>2])};case 3:return function(e){return this.fromWireType(b[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function tt(e,t,r){switch(t){case 0:return r?function(e){return m[e]}:function(e){return v[e]};case 1:return r?function(e){return y[e>>1]}:function(e){return g[e>>1]};case 2:return r?function(e){return w[e>>2]}:function(e){return _[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}var rt="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,nt=(e,t,r)=>{for(var n=t+r,o=t;e[o]&&!(o>=n);)++o;if(o-t>16&&e.buffer&&rt)return rt.decode(e.subarray(t,o));for(var a="";t<o;){var i=e[t++];if(128&i){var s=63&e[t++];if(192!=(224&i)){var u=63&e[t++];if((i=224==(240&i)?(15&i)<<12|s<<6|u:(7&i)<<18|s<<12|u<<6|63&e[t++])<65536)a+=String.fromCharCode(i);else{var c=i-65536;a+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},ot=(e,t)=>e?nt(v,e,t):"";var at="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,it=(e,t)=>{for(var r=e,n=r>>1,o=n+t/2;!(n>=o)&&g[n];)++n;if((r=n<<1)-e>32&&at)return at.decode(v.subarray(e,r));for(var a="",i=0;!(i>=t/2);++i){var s=y[e+2*i>>1];if(0==s)break;a+=String.fromCharCode(s)}return a},st=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var n=t,o=(r-=2)<2*e.length?r/2:e.length,a=0;a<o;++a){var i=e.charCodeAt(a);y[t>>1]=i,t+=2}return y[t>>1]=0,t-n},ut=e=>2*e.length,ct=(e,t)=>{for(var r=0,n="";!(r>=t/4);){var o=w[e+4*r>>2];if(0==o)break;if(++r,o>=65536){var a=o-65536;n+=String.fromCharCode(55296|a>>10,56320|1023&a)}else n+=String.fromCharCode(o)}return n},lt=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var n=t,o=n+r-4,a=0;a<e.length;++a){var i=e.charCodeAt(a);if(i>=55296&&i<=57343)i=65536+((1023&i)<<10)|1023&e.charCodeAt(++a);if(w[t>>2]=i,(t+=4)+4>o)break}return w[t>>2]=0,t-n},dt=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t};var pt={};var ft=[];var ht=[];var mt;mt=()=>performance.now();var vt,yt,gt,wt=[null,[],[]];!function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);B=e}(),G=o.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},X=o.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},_e.prototype.isAliasOf=Z,_e.prototype.clone=ve,_e.prototype.delete=ye,_e.prototype.isDeleted=ge,_e.prototype.deleteLater=we,o.getInheritedInstanceCount=ae,o.getLiveInheritedInstances=ie,o.flushPendingDeletes=ue,o.setDelayFunction=le,je.prototype.getPointee=Oe,je.prototype.destructor=Me,je.prototype.argPackAdvance=8,je.prototype.readValueFromPointer=Fe,je.prototype.deleteObject=Re,je.prototype.fromWireType=he,Be=o.UnboundTypeError=(vt=Error,(gt=Pe(yt="UnboundTypeError",(function(e){this.name=yt,this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create(vt.prototype),gt.prototype.constructor=gt,gt.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},gt),Object.assign(Xe.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}}),Ke.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),Ke.reserved=Ke.allocated.length,o.count_emval_handles=Je;var _t,Et={o:function(e,t,r){throw new U(e).init(t,r),e},r:function(e,t,r,n,o){},m:function(e,t,r,n,o){var a=W(r);J(e,{name:t=V(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:o},argPackAdvance:8,readValueFromPointer:function(e){var n;if(1===r)n=m;else if(2===r)n=y;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+t);n=w}return this.fromWireType(n[e>>a])},destructorFunction:null})},q:function(e,t,r,n,a,i,s,u,c,l,d,p,f){d=V(d),i=We(a,i),u&&(u=We(s,u)),l&&(l=We(c,l)),f=We(p,f);var h=$e(d);!function(e,t,r){o.hasOwnProperty(e)?((void 0===r||void 0!==o[e].overloadTable&&void 0!==o[e].overloadTable[r])&&q(`Cannot register public name '${e}' twice`),Te(o,e,e),o.hasOwnProperty(r)&&q(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),o[e].overloadTable[r]=t):(o[e]=t,void 0!==r&&(o[e].numArguments=r))}(h,(function(){Le(`Cannot construct ${d} due to unbound types`,[n])})),Y([e,t,r],n?[n]:[],(function(t){var r,a;t=t[0],a=n?(r=t.registeredClass).instancePrototype:_e.prototype;var s=Pe(h,(function(){if(Object.getPrototypeOf(this)!==c)throw new G("Use 'new' to construct "+d);if(void 0===p.constructor_body)throw new G(d+" has no accessible constructor");var e=p.constructor_body[arguments.length];if(void 0===e)throw new G(`Tried to invoke ctor of ${d} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(p.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),c=Object.create(a,{constructor:{value:s}});s.prototype=c;var p=new Ce(d,s,c,f,r,i,u,l);p.baseClass&&(void 0===p.baseClass.__derivedClasses&&(p.baseClass.__derivedClasses=[]),p.baseClass.__derivedClasses.push(p));var m=new je(d,p,!0,!1,!1),v=new je(d+"*",p,!1,!1,!1),y=new je(d+" const*",p,!1,!0,!1);return oe[e]={pointerType:v,constPointerType:y},function(e,t,r){o.hasOwnProperty(e)||K("Replacing nonexistant public symbol"),void 0!==o[e].overloadTable&&void 0!==r?o[e].overloadTable[r]=t:(o[e]=t,o[e].argCount=r)}(h,s),[m,v,y]}))},p:function(e,t,r,n,o,a){var i=ze(t,r);o=We(n,o),Y([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new G(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Le(`Cannot construct ${e.name} due to unbound types`,i)},Y([],i,(function(n){return n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=qe(r,n,null,o,a),[]})),[]}))},d:function(e,t,r,n,o,a,i,s,u){var c=ze(r,n);t=V(t),a=We(o,a),Y([],[e],(function(e){var n=`${(e=e[0]).name}.${t}`;function o(){Le(`Cannot call ${n} due to unbound types`,c)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,d=l[t];return void 0===d||void 0===d.overloadTable&&d.className!==e.name&&d.argCount===r-2?(o.argCount=r-2,o.className=e.name,l[t]=o):(Te(l,t,n),l[t].overloadTable[r-2]=o),Y([],c,(function(o){var s=qe(n,o,e,a,i,u);return void 0===l[t].overloadTable?(s.argCount=r-2,l[t]=s):l[t].overloadTable[r-2]=s,[]})),[]}))},u:function(e,t){J(e,{name:t=V(t),fromWireType:function(e){var t=Ze.toValue(e);return Ye(e),t},toWireType:function(e,t){return Ze.toHandle(t)},argPackAdvance:8,readValueFromPointer:Fe,destructorFunction:null})},k:function(e,t,r){var n=W(r);J(e,{name:t=V(t),fromWireType:function(e){return e},toWireType:function(e,t){return t},argPackAdvance:8,readValueFromPointer:et(t,n),destructorFunction:null})},b:function(e,t,r,n,o){t=V(t),-1===o&&(o=4294967295);var a=W(r),i=e=>e;if(0===n){var s=32-8*r;i=e=>e<<s>>>s}var u=t.includes("unsigned");J(e,{name:t,fromWireType:i,toWireType:u?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:8,readValueFromPointer:tt(t,a,0!==n),destructorFunction:null})},a:function(e,t,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function o(e){var t=_,r=t[e>>=2],o=t[e+1];return new n(t.buffer,o,r)}J(e,{name:r=V(r),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},j:function(e,t){var r="std::string"===(t=V(t));J(e,{name:t,fromWireType:function(e){var t,n=_[e>>2],o=e+4;if(r)for(var a=o,i=0;i<=n;++i){var s=o+i;if(i==n||0==v[s]){var u=ot(a,s-a);void 0===t?t=u:(t+=String.fromCharCode(0),t+=u),a=s+1}}else{var c=new Array(n);for(i=0;i<n;++i)c[i]=String.fromCharCode(v[o+i]);t=c.join("")}return bt(e),t},toWireType:function(e,t){var n;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var o="string"==typeof t;o||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||q("Cannot pass non-string to std::string"),n=r&&o?(e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t})(t):t.length;var a=$t(4+n+1),i=a+4;if(_[a>>2]=n,r&&o)((e,t,r,n)=>{if(!(n>0))return 0;for(var o=r,a=r+n-1,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),s<=127){if(r>=a)break;t[r++]=s}else if(s<=2047){if(r+1>=a)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=a)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=a)break;t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}t[r]=0})(t,v,i,n+1);else if(o)for(var s=0;s<n;++s){var u=t.charCodeAt(s);u>255&&(bt(i),q("String has UTF-16 code units that do not fit in 8 bits")),v[i+s]=u}else for(s=0;s<n;++s)v[i+s]=t[s];return null!==e&&e.push(bt,a),a},argPackAdvance:8,readValueFromPointer:Fe,destructorFunction:function(e){bt(e)}})},g:function(e,t,r){var n,o,a,i,s;r=V(r),2===t?(n=it,o=st,i=ut,a=()=>g,s=1):4===t&&(n=ct,o=lt,i=dt,a=()=>_,s=2),J(e,{name:r,fromWireType:function(e){for(var r,o=_[e>>2],i=a(),u=e+4,c=0;c<=o;++c){var l=e+4+c*t;if(c==o||0==i[l>>s]){var d=n(u,l-u);void 0===r?r=d:(r+=String.fromCharCode(0),r+=d),u=l+t}}return bt(e),r},toWireType:function(e,n){"string"!=typeof n&&q(`Cannot pass non-string to C++ string type ${r}`);var a=i(n),u=$t(4+a+t);return _[u>>2]=a>>s,o(n,u+4,a+t),null!==e&&e.push(bt,u),u},argPackAdvance:8,readValueFromPointer:Fe,destructorFunction:function(e){bt(e)}})},n:function(e,t){J(e,{isVoid:!0,name:t=V(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},e:function(e,t,r,n){var o,a;(e=ft[e])(t=Ze.toValue(t),r=void 0===(a=pt[o=r])?V(o):a,null,n)},l:Ye,h:function(e,t){var r=function(e,t){for(var r,n,o,a=new Array(e),i=0;i<e;++i)a[i]=(r=_[t+4*i>>2],n="parameter "+i,o=void 0,void 0===(o=z[r])&&q(n+" has unknown type "+Ve(r)),o);return a}(e,t),n=r[0],o=n.name+"_$"+r.slice(1).map((function(e){return e.name})).join("_")+"$",a=ht[o];if(void 0!==a)return a;for(var i=["retType"],s=[n],u="",c=0;c<e-1;++c)u+=(0!==c?", ":"")+"arg"+c,i.push("argType"+c),s.push(r[1+c]);var l="return function "+$e("methodCaller_"+o)+"(handle, name, destructors, args) {\n",d=0;for(c=0;c<e-1;++c)l+=" var arg"+c+" = argType"+c+".readValueFromPointer(args"+(d?"+"+d:"")+");\n",d+=r[c+1].argPackAdvance;for(l+=" var rv = handle[name]("+u+");\n",c=0;c<e-1;++c)r[c+1].deleteObject&&(l+=" argType"+c+".deleteObject(arg"+c+");\n");n.isVoid||(l+=" return retType.toWireType(destructors, rv);\n"),l+="};\n",i.push(l);var p,f,h=Ge(Function,i).apply(null,s);return p=h,f=ft.length,ft.push(p),a=f,ht[o]=a,a},f:()=>{F("")},c:mt,t:(e,t,r)=>v.copyWithin(e,t,t+r),s:e=>{v.length;F("OOM")},i:(e,t,r,n)=>{for(var o,a,i,s=0,u=0;u<r;u++){var c=_[t>>2],l=_[t+4>>2];t+=8;for(var f=0;f<l;f++)o=e,a=v[c+f],i=void 0,i=wt[o],0===a||10===a?((1===o?d:p)(nt(i,0)),i.length=0):i.push(a);s+=l}return _[n>>2]=s,0}},bt=(function(){var e,t,r,a,i={a:Et};function s(e,t){var r,n,a=e.exports;return f=(h=a).v,r=f.buffer,o.HEAP8=m=new Int8Array(r),o.HEAP16=y=new Int16Array(r),o.HEAP32=w=new Int32Array(r),o.HEAPU8=v=new Uint8Array(r),o.HEAPU16=g=new Uint16Array(r),o.HEAPU32=_=new Uint32Array(r),o.HEAPF32=E=new Float32Array(r),o.HEAPF64=b=new Float64Array(r),$=h.z,n=h.w,C.unshift(n),function(){if(S--,o.monitorRunDependencies&&o.monitorRunDependencies(S),0==S&&(null!==A&&(clearInterval(A),A=null),D)){var e=D;D=null,e()}}(),a}if(S++,o.monitorRunDependencies&&o.monitorRunDependencies(S),o.instantiateWasm)try{return o.instantiateWasm(i,s)}catch(e){p("Module.instantiateWasm callback failed with error: "+e),n(e)}(e=l,t=O,r=i,a=function(e){s(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||j(t)||"function"!=typeof fetch?I(t,r,a):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(a,(function(e){return p("wasm streaming compile failed: "+e),p("falling back to ArrayBuffer instantiation"),I(t,r,a)}))))).catch(n)}(),e=>(bt=h.x)(e)),$t=e=>($t=h.y)(e),Pt=e=>(Pt=h.A)(e),Tt=(o.__embind_initialize_bindings=()=>(o.__embind_initialize_bindings=h.B)(),e=>(Tt=h.C)(e));o.dynCall_jiji=(e,t,r,n,a)=>(o.dynCall_jiji=h.D)(e,t,r,n,a);function Ct(){function e(){_t||(_t=!0,o.calledRun=!0,P||(N(C),r(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),function(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)e=o.postRun.shift(),k.unshift(e);var e;N(k)}()))}S>0||(!function(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)e=o.preRun.shift(),T.unshift(e);var e;N(T)}(),S>0||(o.setStatus?(o.setStatus("Running..."),setTimeout((function(){setTimeout((function(){o.setStatus("")}),1),e()}),1)):e()))}if(D=function e(){_t||Ct(),_t||(D=e)},o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return Ct(),t.ready}})(),videodec_simd_default=Module2,VideoDecoderSoftSIMD=class extends VideoDecoderSoftBase{constructor(e){super(videodec_simd_default,(null==e?void 0:e.wasmPath)?fetch(e.wasmPath).then((e=>e.arrayBuffer())):void 0,null==e?void 0:e.workerMode,null==e?void 0:e.canvas,null==e?void 0:e.yuvMode)}},BASE_HOST="web.sdk.qcloud.com",BASE_DOC_URL=`https://${BASE_HOST}/trtc/webrtc/v5/doc`,DOC_URL=`${BASE_DOC_URL}/zh-cn/`,LOG_LEVEL=(e=>(e[e.TRACE=0]="TRACE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.NONE=5]="NONE",e))(LOG_LEVEL||{}),STORAGE_EXPIRES_TIME=6048e5,NAME={CANVAS:"canvas",AUDIO:"audio",VIDEO:"video",SCREEN:"screen",SMALL:"small",BIG:"big",AUXILIARY:"auxiliary",SMALL_VIDEO:"smallVideo",FACING_MODE_USER:"user",FACING_MODE_ENVIRONMENT:"environment",MUTE:"mute",UNMUTE:"unmute",ENDED:"ended",PLAYING:"playing",PAUSE:"pause",ERROR:"error",LOADEDDATA:"loadeddata",LOADEDMETADATA:"loadedmetadata",AUDIO_INPUT:"audioinput",VIDEO_INPUT:"videoinput",DETAIL:"detail",TEXT:"text",MAIN:"main",BACKUP:"backup",BANNED:"banned",KICK:"kick",USER_TIME_OUT:"user_time_out",ROOM_DISBAND:"room_disband",SEI_MESSAGE:"sei-message",ADD:"add",REMOVE:"remove",REPLACE:"replace",TRACK:"track",SUBSCRIBE:"subscribe",UNSUBSCRIBE:"unsubscribe",TRANSCEIVER_DIRECTION_SENDONLY:"sendonly",TRANSCEIVER_DIRECTION_RECVONLY:"recvonly",ENTER_PICTURE_IN_PICTURE:"enterpictureinpicture",LEAVE_PICTURE_IN_PICTURE:"leavepictureinpicture"},REMOTE_STREAM_TYPE_MAIN=NAME.MAIN,REMOTE_STREAM_TYPE_AUX=NAME.AUXILIARY,STREAM_TYPE_BIG=NAME.BIG,STREAM_TYPE_SMALL=NAME.SMALL,PEERCONNECTION_CONNECTING_TIMEOUT=1e4,LOG_LEVEL_NAME=Object.keys(LOG_LEVEL),MAX_RTT=1e4,glog="undefined"!=typeof window&&"function"==typeof window.glog?window.glog:()=>{};function performanceNow(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}var{toString:toString}=Object.prototype,_TRTCVideoDecoder=class e{constructor(e){this.core=e,__publicField(this,"contextMap",new Map),__publicField(this,"decodeProcessorMap",new WeakMap),this.addKVReportBeforeExitRoom=this.addKVReportBeforeExitRoom.bind(this),this.createDecoder=this.createDecoder.bind(this),this.core.innerEmitter.on("51",this.addKVReportBeforeExitRoom)}getAlias(){return"videoDecoder"}getGroup(e){return(null==e?void 0:e.track)?`${e.track.userId}${e.track.streamType}`:"*"}getName(){return e.Name}getValidateRule(e){return{type:this.core.enums.BASIC_TYPE.Object}}createDecoder(e,t){switch(e){case"wasm":return!1?new VideoDecoderSoftSIMD(__spreadProps(__spreadValues({},t),{wasmPath:`${this.core.assetsPath||"."}/videodec_simd.wasm`})):new VideoDecoderSoft(__spreadProps(__spreadValues({},t),{wasmPath:`${this.core.assetsPath||"."}/videodec.wasm`}));case"webCodecs":return new VideoDecoderHard;case"mse":throw new Error("mse decoder not supported yet");default:throw new Error("Unsupported decoder type")}}start(e){this.decodeProcessorMap.set(e.track,this.decode(e)),this.core.room.videoManager.addDecodeProcessor({processor:({frame:e,track:t})=>{var r;return(null==(r=this.decodeProcessorMap.get(t))?void 0:r({frame:e,track:t}))||e},type:3})}decode(e){const{pipe:t,take:r,subscribe:n}=this.core.rx;return({frame:o,track:a})=>{if(a!==e.track||"empty"===o.type)return o;if(this.contextMap.has(a))return this.contextMap.get(a).decode(o);const i=this.core.room.videoManager.createDecodeContext(__spreadProps(__spreadValues({},e),{createDecoder:this.createDecoder}));return t(i.trackDoneOB,r(1),n((()=>{this.core.clearStarted(this,this.getGroup(e)),this.stop({track:a})}))),this.contextMap.set(a,i),i.decode(o)}}stop(e){if(null==e?void 0:e.track){const t=this.contextMap.get(e.track);t&&(t.close("stop"),this.report(t,e.track),this.contextMap.delete(e.track))}else this.contextMap.forEach(((e,t)=>{e.close("stop"),this.contextMap.delete(t)}));0===this.contextMap.size&&this.core.room.videoManager.removeDecodeProcessor({type:3})}report(e,t){if(e.isReported)return;e.isReported=!0;const r=performanceNow()-e.startPerformanceTime,{renderFreezeTotal:n,dataFreezeTotal:o}=this.getRemoteTrackFreezeDuration(t,e);r&&this.core.kvStatManager.addNumber({key:514850,value:Math.floor(n/r*100),split:1}),r&&this.core.kvStatManager.addNumber({key:514851,value:Math.floor(o/r*100),split:1}),e.inputFrameCount&&this.core.kvStatManager.addNumber({key:514852,value:Math.floor(e.decodedFrameCount/e.inputFrameCount*100),split:1})}addKVReportBeforeExitRoom({room:e}){e===this.core.room&&this.contextMap.forEach(((e,t)=>{this.report(e,t)}))}update(e){const t=this.contextMap.get(e.track);t&&("mock"!==e.type?(t.close("update"),this.contextMap.set(e.track,this.core.room.videoManager.createDecodeContext(__spreadProps(__spreadValues({},e),{createDecoder:this.createDecoder})))):t.mock(this.core.enums.DECODE_FAILED_ERROR_CODE.TEST))}getRemoteTrackFreezeDuration(e,t){const r=this.core.room.badCaseDetector.getRenderFreezeMap().get(`${e.userId}_${e.streamType}`),n=this.core.room.badCaseDetector.getDataFreezeMap().get(`${e.userId}_${e.streamType}`);let o=0;r&&r.freezeTimeline.forEach((({startTime:e,endTime:r})=>{e>t.startPerformanceTime&&(o+=0===r?performanceNow()-e:r-e)}));let a=0;return n&&n.durationItemList.forEach((e=>{e.startTime>t.startPerformanceTime&&(a+=e.getDuration())})),{renderFreezeTotal:o,dataFreezeTotal:a}}destroy(){this.core.innerEmitter.off("51",this.addKVReportBeforeExitRoom)}};__publicField(_TRTCVideoDecoder,"Name","TRTCVideoDecoder");var TRTCVideoDecoder=_TRTCVideoDecoder,index_default=TRTCVideoDecoder;export{index_default as default};export{TRTCVideoDecoder};
|