trtc-sdk-v5 5.9.2-beta.9 → 5.9.2-osm.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/plugins/cdn-streaming/cdn-streaming.esm.js +1 -1
- package/plugins/cdn-streaming/cdn-streaming.iife.js +1 -1
- package/plugins/cdn-streaming/package.json +1 -1
- package/plugins/cross-room/cross-room.esm.js +1 -1
- package/plugins/cross-room/cross-room.iife.js +1 -1
- package/plugins/cross-room/package.json +1 -1
- package/plugins/device-detector/device-detector.esm.js +1 -1
- package/plugins/device-detector/device-detector.iife.js +1 -1
- package/plugins/device-detector/package.json +1 -1
- package/plugins/video-decoder/package.json +1 -1
- package/plugins/video-decoder/video-decoder.esm.js +9 -9
- package/plugins/video-decoder/video-decoder.iife.js +9 -9
- package/plugins/video-effect/basic-beauty/basic-beauty.esm.js +2 -2
- package/plugins/video-effect/basic-beauty/basic-beauty.iife.js +2 -2
- package/plugins/video-effect/basic-beauty/package.json +1 -1
- package/plugins/video-effect/beauty/beauty.esm.js +1928 -1709
- package/plugins/video-effect/beauty/beauty.iife.js +1928 -1709
- package/plugins/video-effect/beauty/package.json +1 -1
- package/plugins/video-effect/virtual-background/package.json +1 -1
- package/plugins/video-effect/watermark/package.json +1 -1
- package/plugins/video-effect/watermark/watermark.esm.js +1 -1
- package/plugins/video-effect/watermark/watermark.iife.js +1 -1
- package/trtc.esm.js +28 -28
- package/trtc.js +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var $o=Object.create;var nn=Object.defineProperty,Lo=Object.defineProperties,To=Object.getOwnPropertyDescriptor,Mo=Object.getOwnPropertyDescriptors,Fo=Object.getOwnPropertyNames,_o=Object.getOwnPropertySymbols,Bo=Object.getPrototypeOf,bo=Object.prototype.hasOwnProperty,Ho=Object.prototype.propertyIsEnumerable;var so=(T,p,s)=>p in T?nn(T,p,{enumerable:!0,configurable:!0,writable:!0,value:s}):T[p]=s,br=(T,p)=>{for(var s in p||(p={}))bo.call(p,s)&&so(T,s,p[s]);if(_o)for(var s of _o(p))Ho.call(p,s)&&so(T,s,p[s]);return T},Er=(T,p)=>Lo(T,Mo(p));var Wo=(T,p)=>()=>(p||T((p={exports:{}}).exports,p),p.exports);var Vo=(T,p,s,v)=>{if(p&&typeof p=="object"||typeof p=="function")for(let S of Fo(p))!bo.call(T,S)&&S!==s&&nn(T,S,{get:()=>p[S],enumerable:!(v=To(p,S))||v.enumerable});return T};var jo=(T,p,s)=>(s=T!=null?$o(Bo(T)):{},Vo(p||!T||!T.__esModule?nn(s,"default",{value:T,enumerable:!0}):s,T));var Le=(T,p,s,v)=>{for(var S=v>1?void 0:v?To(p,s):p,I=T.length-1,A;I>=0;I--)(A=T[I])&&(S=(v?A(p,s,S):A(S))||S);return v&&S&&nn(p,s,S),S};var fe=(T,p,s)=>so(T,typeof p!="symbol"?p+"":p,s);var wo=Wo((ai,uo)=>{"use strict";var Go=Object.prototype.hasOwnProperty,be="~";function lt(){}Object.create&&(lt.prototype=Object.create(null),new lt().__proto__||(be=!1));function zo(T,p,s){this.fn=T,this.context=p,this.once=s||!1}function Eo(T,p,s,v,S){if(typeof s!="function")throw new TypeError("The listener must be a function");var I=new zo(s,v||T,S),A=be?be+p:p;return T._events[A]?T._events[A].fn?T._events[A]=[T._events[A],I]:T._events[A].push(I):(T._events[A]=I,T._eventsCount++),T}function on(T,p){--T._eventsCount===0?T._events=new lt:delete T._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(be?v.slice(1):v);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(s)):p};pe.prototype.listeners=function(p){var s=be?be+p:p,v=this._events[s];if(!v)return[];if(v.fn)return[v.fn];for(var S=0,I=v.length,A=new Array(I);S<I;S++)A[S]=v[S].fn;return A};pe.prototype.listenerCount=function(p){var s=be?be+p:p,v=this._events[s];return v?v.fn?1:v.length:0};pe.prototype.emit=function(p,s,v,S,I,A){var H=be?be+p:p;if(!this._events[H])return!1;var D=this._events[H],C=arguments.length,F,L;if(D.fn){switch(D.once&&this.removeListener(p,D.fn,void 0,!0),C){case 1:return D.fn.call(D.context),!0;case 2:return D.fn.call(D.context,s),!0;case 3:return D.fn.call(D.context,s,v),!0;case 4:return D.fn.call(D.context,s,v,S),!0;case 5:return D.fn.call(D.context,s,v,S,I),!0;case 6:return D.fn.call(D.context,s,v,S,I,A),!0}for(L=1,F=new Array(C-1);L<C;L++)F[L-1]=arguments[L];D.fn.apply(D.context,F)}else{var W=D.length,me;for(L=0;L<W;L++)switch(D[L].once&&this.removeListener(p,D[L].fn,void 0,!0),C){case 1:D[L].fn.call(D[L].context);break;case 2:D[L].fn.call(D[L].context,s);break;case 3:D[L].fn.call(D[L].context,s,v);break;case 4:D[L].fn.call(D[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];D[L].fn.apply(D[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 I=be?be+p:p;if(!this._events[I])return this;if(!s)return on(this,I),this;var A=this._events[I];if(A.fn)A.fn===s&&(!S||A.once)&&(!v||A.context===v)&&on(this,I);else{for(var H=0,D=[],C=A.length;H<C;H++)(A[H].fn!==s||S&&!A[H].once||v&&A[H].context!==v)&&D.push(A[H]);D.length?this._events[I]=D.length===1?D[0]:D:on(this,I)}return this};pe.prototype.removeAllListeners=function(p){var s;return p?(s=be?be+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=be;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(T){return typeof T=="object"&&T&&"then"in T}var ft=new Map;function je(T,p,s={}){return(v,S,I)=>{let A=s.action||S;if(!s.context){let D=ft.get(v)||[];ft.has(v)||ft.set(v,D),D.push({from:T,to:p,action:A})}let H=I.value;I.value=function(...D){let C=this;if(s.context&&(C=ce.get(typeof s.context=="function"?s.context.call(this,...D):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(T)?T.length==0?C.state instanceof dt&&C.state.abort(C):(typeof C.state!="string"||!T.includes(C.state))&&(F=new Nr(C._state,`${C.name} ${A} to ${p} failed: current state ${C._state} not from ${T.join("|")}`)):T!==C.state&&(F=new Nr(C._state,`${C.name} ${A} to ${p} failed: current state ${C._state} not from ${T}`));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,D);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 ${T} to ${p} failed: ${q}`,q instanceof Error?q:new Error(String(q))))}}}}function Po(...T){return(p,s,v)=>{let S=v.value,I=s;v.value=function(...A){if(!T.includes(this.state.toString()))throw new Nr(this.state,`${this.name} ${I} failed: current state ${this.state} not in ${T}`);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(T,p){let s=this._state;this._state=T;let v=T.toString();T&&this.emit(v,s),this.emit(ce.STATECHANGED,T,s,p),this.updateDevTools({value:T,old:s,err:p instanceof Error?p.message:String(p)})}var ce=class T extends Ao.default{constructor(p,s,v){super(),this.name=p,this.groupName=s,this._state=T.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=[],I=[],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})}):I.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}`)}),I.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 D=[...v];return Object.defineProperties(p,{stateDiagram:{value:D},allStates:{value:A}}),D}static get(p){let s;return typeof p=="string"?(s=T.instances.get(p),s||T.instances.set(p,s=new T(p,void 0,Object.create(T.prototype)))):(s=T.instances2.get(p),s||T.instances2.set(p,s=new T(p.constructor.name,void 0,Object.create(T.prototype)))),s}static getState(p){var s;return(s=T.get(p))===null||s===void 0?void 0:s.state}updateDevTools(p={}){Xo(T.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(br({},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 T;self.onmessage=p=>{if(p.data.type==="init"){let{canvas:s,wasmScript:v,wasmBinary:S}=p.data,I=s==null?void 0:s.getContext("2d"),A=0,H=0,D={wasmBinary:S,postRun:()=>{T=new D.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=D.HEAPU32[C>>2],Re=D.HEAPU32[(C>>2)+1],Me=D.HEAPU32[(C>>2)+2],q=D.HEAPU8.subarray(me,me+L),ze=D.HEAPU8.subarray(Re,Re+W),lr=D.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?(I==null||I.drawImage(he,0,0,s.width,s.height),I==null||I.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)()(D)}else if(p.data.type==="decode"){let{packet:s}=p.data;T==null||T.decode(s.data,s.type=="key",s.timestamp)}else if(p.data.type==="setCodec"){let{codec:s,format:v,description:S}=p.data;T==null||T.setCodec(s,v,S!=null?S:"")}}}var Ge=class extends ce{constructor(s,v,S=!1,I,A=!1){super();this.createModule=s;this.wasmBinary=v;this.workerMode=S;this.canvas=I;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 I=new RegExp("\\{(.+)\\}","s").exec(Yo.toString())[1];this.worker=new Worker(URL.createObjectURL(new Blob([I],{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(D=>{this.worker.onmessage=C=>{if(C.data.type==="ready")delete this.wasmBinary,D(),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=I=>console.log(I),v.printErr=I=>console.log(`[JS] ERROR: ${I}`),v.onAbort=()=>console.log("[JS] FATAL: WASM ABORTED"),new Promise(I=>{v.postRun=A=>{this.decoder=new this.module.VideoDecoder(this),console.log("video soft decoder initialize success"),I()},s&&Object.assign(v,s),this.createModule(v)})}configure(s){var v,S,I;this.config=s,(S=this.decoder)==null||S.setCodec(this.config.codec,this.config.description?"avcc":"annexb",(v=this.config.description)!=null?v:""),(I=this.worker)==null||I.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,I=S>>2,A=this.module.HEAPU32[s>>2],H=this.module.HEAPU32[(s>>2)+1],D=this.module.HEAPU32[(s>>2)+2],C=this.module.HEAPU8.subarray(A,A+S),F=this.module.HEAPU8.subarray(H,H+I),L=this.module.HEAPU8.subarray(D,D+I);if(this.yuvMode){this.emit("videoFrame",[C,F,L]);return}let W=new Uint8Array(S+I+I);W.set(C),W.set(F,S),W.set(L,S+I),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 T=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 I=Object.assign({},s),A=[],H="./this.program",D=(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),T&&(W=T),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,I),I=null,s.arguments&&(A=s.arguments),s.thisProgram&&(H=s.thisProgram),s.quit&&(D=s.quit);var he;s.wasmBinary&&(he=s.wasmBinary);var Do=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 De=0,qe=null,dr=null;function fo(e){return e}function ir(e){De++,s.monitorRunDependencies&&s.monitorRunDependencies(De)}function wr(e){if(De--,s.monitorRunDependencies&&s.monitorRunDependencies(De),De==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 Tn(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,bn=0;function yt(e,r,t){var n=new Tn(e);throw n.init(r,t),Sr=e,bn++,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+=`
|
|
1
|
+
var $o=Object.create;var nn=Object.defineProperty,Lo=Object.defineProperties,To=Object.getOwnPropertyDescriptor,Mo=Object.getOwnPropertyDescriptors,Fo=Object.getOwnPropertyNames,_o=Object.getOwnPropertySymbols,Bo=Object.getPrototypeOf,bo=Object.prototype.hasOwnProperty,Ho=Object.prototype.propertyIsEnumerable;var so=(T,p,s)=>p in T?nn(T,p,{enumerable:!0,configurable:!0,writable:!0,value:s}):T[p]=s,br=(T,p)=>{for(var s in p||(p={}))bo.call(p,s)&&so(T,s,p[s]);if(_o)for(var s of _o(p))Ho.call(p,s)&&so(T,s,p[s]);return T},Er=(T,p)=>Lo(T,Mo(p));var Wo=(T,p)=>()=>(p||T((p={exports:{}}).exports,p),p.exports);var Vo=(T,p,s,v)=>{if(p&&typeof p=="object"||typeof p=="function")for(let S of Fo(p))!bo.call(T,S)&&S!==s&&nn(T,S,{get:()=>p[S],enumerable:!(v=To(p,S))||v.enumerable});return T};var jo=(T,p,s)=>(s=T!=null?$o(Bo(T)):{},Vo(p||!T||!T.__esModule?nn(s,"default",{value:T,enumerable:!0}):s,T));var Le=(T,p,s,v)=>{for(var S=v>1?void 0:v?To(p,s):p,D=T.length-1,A;D>=0;D--)(A=T[D])&&(S=(v?A(p,s,S):A(S))||S);return v&&S&&nn(p,s,S),S};var fe=(T,p,s)=>so(T,typeof p!="symbol"?p+"":p,s);var wo=Wo((ai,uo)=>{"use strict";var Go=Object.prototype.hasOwnProperty,be="~";function lt(){}Object.create&&(lt.prototype=Object.create(null),new lt().__proto__||(be=!1));function zo(T,p,s){this.fn=T,this.context=p,this.once=s||!1}function Eo(T,p,s,v,S){if(typeof s!="function")throw new TypeError("The listener must be a function");var D=new zo(s,v||T,S),A=be?be+p:p;return T._events[A]?T._events[A].fn?T._events[A]=[T._events[A],D]:T._events[A].push(D):(T._events[A]=D,T._eventsCount++),T}function on(T,p){--T._eventsCount===0?T._events=new lt:delete T._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(be?v.slice(1):v);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(s)):p};pe.prototype.listeners=function(p){var s=be?be+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=be?be+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 M=be?be+p:p;if(!this._events[M])return!1;var I=this._events[M],C=arguments.length,B,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,B=new Array(C-1);L<C;L++)B[L-1]=arguments[L];I.fn.apply(I.context,B)}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(!B)for(me=1,B=new Array(C-1);me<C;me++)B[me-1]=arguments[me];I[L].fn.apply(I[L].context,B)}}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=be?be+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 M=0,I=[],C=A.length;M<C;M++)(A[M].fn!==s||S&&!A[M].once||v&&A[M].context!==v)&&I.push(A[M]);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=be?be+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=be;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(T){return typeof T=="object"&&T&&"then"in T}var ft=new Map;function je(T,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:T,to:p,action:A})}let M=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 B=null;Array.isArray(T)?T.length==0?C.state instanceof dt&&C.state.abort(C):(typeof C.state!="string"||!T.includes(C.state))&&(B=new Nr(C._state,`${C.name} ${A} to ${p} failed: current state ${C._state} not from ${T.join("|")}`)):T!==C.state&&(B=new Nr(C._state,`${C.name} ${A} to ${p} failed: current state ${C._state} not from ${T}`));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(B)return L(B);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=M.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 ${T} to ${p} failed: ${q}`,q instanceof Error?q:new Error(String(q))))}}}}function Po(...T){return(p,s,v)=>{let S=v.value,D=s;v.value=function(...A){if(!T.includes(this.state.toString()))throw new Nr(this.state,`${this.name} ${D} failed: current state ${this.state} not in ${T}`);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(T,p){let s=this._state;this._state=T;let v=T.toString();T&&this.emit(v,s),this.emit(ce.STATECHANGED,T,s,p),this.updateDevTools({value:T,old:s,err:p instanceof Error?p.message:String(p)})}var ce=class T extends Ao.default{constructor(p,s,v){super(),this.name=p,this.groupName=s,this._state=T.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,M=Object.getPrototypeOf(p);ft.has(M)&&(M.stateDiagram.forEach(C=>v.add(C)),M.allStates.forEach(C=>A.add(C))),s.forEach(({from:C,to:B,action:L})=>{typeof C=="string"?S.push({from:C,to:B,action:L}):C.length?C.forEach(W=>{S.push({from:W,to:B,action:L})}):D.push({to:B,action:L})}),S.forEach(({from:C,to:B,action:L})=>{A.add(C),A.add(B),A.add(L+"ing"),v.add(`${C} --> ${L}ing : ${L}`),v.add(`${L}ing --> ${B} : ${L} \u{1F7E2}`),v.add(`${L}ing --> ${C} : ${L} \u{1F534}`)}),D.forEach(({to:C,action:B})=>{v.add(`${B}ing --> ${C} : ${B} \u{1F7E2}`),A.forEach(L=>{L!==C&&v.add(`${L} --> ${B}ing : ${B}`)})});let I=[...v];return Object.defineProperties(p,{stateDiagram:{value:I},allStates:{value:A}}),I}static get(p){let s;return typeof p=="string"?(s=T.instances.get(p),s||T.instances.set(p,s=new T(p,void 0,Object.create(T.prototype)))):(s=T.instances2.get(p),s||T.instances2.set(p,s=new T(p.constructor.name,void 0,Object.create(T.prototype)))),s}static getState(p){var s;return(s=T.get(p))===null||s===void 0?void 0:s.state}updateDevTools(p={}){Xo(T.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(br({},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,{sync:!0})],or.prototype,"reset",1),Le([je([],"closed",{ignoreError:!0,sync:!0})],or.prototype,"close",1);function Yo(){var T;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,M=0,I={wasmBinary:S,postRun:()=>{T=new I.VideoDecoder({videoInfo(C,B){A=C,M=B,console.log("video info",C,B)},yuvData(C,B){let L=A*M,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:M,format:"I420",timestamp:B});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;T==null||T.decode(s.data,s.type=="key",s.timestamp)}else if(p.data.type==="setCodec"){let{codec:s,format:v,description:S}=p.data;T==null||T.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(),M=await this.wasmBinary;return console.warn("worker mode",M),this.worker.postMessage({type:"init",canvas:A,wasmScript:this.createModule.toString(),wasmBinary:M},A?[A,M]:[M]),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:B}=C.data;this.emit("videoFrame",B)}}})}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 D,A,M;this.config=s;let v=this.config.codec.startsWith("avc")?"avc":"hevc",S=this.config.description?v=="avc"?"avcc":"hvcc":"annexb";(A=this.decoder)==null||A.setCodec(v,S,(D=this.config.description)!=null?D:""),(M=this.worker)==null||M.postMessage({type:"setCodec",codec:v,format:S,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],M=this.module.HEAPU32[(s>>2)+1],I=this.module.HEAPU32[(s>>2)+2],C=this.module.HEAPU8.subarray(A,A+S),B=this.module.HEAPU8.subarray(M,M+D),L=this.module.HEAPU8.subarray(I,I+D);if(this.yuvMode){this.emit("videoFrame",{y:C,u:B,v:L,timestamp:v});return}let W=new Uint8Array(S+D+D);W.set(C),W.set(B,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",{sync:!0})],Ge.prototype,"configure",1),Le([je([],ce.INIT,{sync:!0})],Ge.prototype,"reset",1),Le([je([],"closed",{sync:!0})],Ge.prototype,"close",1);var Jo=(()=>{var T=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=[],M="./this.program",I=(e,r)=>{throw r},C=typeof window=="object",B=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||B)&&(B?W=self.location.href:typeof document!="undefined"&&document.currentScript&&(W=document.currentScript.src),T&&(W=T),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},B&&(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&&(M=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||B)&&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 Tn(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,bn=0;function yt(e,r,t){var n=new Tn(e);throw n.init(r,t),Sr=e,bn++,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
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)},Tt=s.preloadPlugins||[];function wn(e,r,t,n){typeof Browser!="undefined"&&Browser.init();var u=!1;return Tt.forEach(function(l){u||l.canHandle(r)&&(l.handle(e,r,t,n),u=!0)}),u}function bt(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",Te=1024*1024;re||(Te=$);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),$!==Te&&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)},Tr=this;Tr.setDataGetter(Ce=>{var nr=Ce*Te,ue=(Ce+1)*Te-1;if(ue=Math.min(ue,$-1),typeof Tr.chunks[Ce]=="undefined"&&(Tr.chunks[Ce]=oe(nr,ue)),typeof Tr.chunks[Ce]=="undefined")throw new Error("doXHR failed!");return Tr.chunks[Ce]}),(se||!$)&&(Te=$=1,$=this.getter(0).length,Te=$,lr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=$,this._chunkSize=Te,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 Te=Math.min(se.length-re,Z);if(se.slice)for(var oe=0;oe<Te;oe++)P[$+oe]=se[re+oe];else for(var oe=0;oe<Te;oe++)P[$+oe]=se.get(re+oe);return Te}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 It={};function Ir(){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=Ir,s.getLiveInheritedInstances=Pn,s.flushPendingDeletes=Qr,s.setDelayFunction=xe}var yr={};function Dr(e,r){for(r===void 0&&K("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r}function Dt(e,r){return r=Dr(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},Ie(Object.create(e,{$$:{value:r}}))}function Rn(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=Dt(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=It[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 Ie=function(e){return typeof FinalizationRegistry=="undefined"?(Ie=r=>r,e):(Jr=new FinalizationRegistry(r=>{Ct(r.$$)}),Ie=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var u={$$:t};Jr.register(r,u,r)}return r},Pt=r=>Jr.unregister(r),Ie(e))};function In(){if(this.$$.ptr||Rr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Ie(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 Dn(){Ue.prototype.isAliasOf=Cr,Ue.prototype.clone=In,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)!==Te)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)}),Te=Object.create(re,{constructor:{value:se}});se.prototype=Te;var oe=new Nt(R,se,Te,k,Z,l,d,h);oe.baseClass&&(oe.baseClass.__derivedClasses===void 0&&(oe.baseClass.__derivedClasses=[]),oe.baseClass.__derivedClasses.push(oe));var Tr=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
|
|
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()},F={ops_table:null,mount(e){return F.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(a.isBlkdev(t)||a.isFIFO(t))throw new a.ErrnoError(63);F.ops_table||(F.ops_table={dir:{node:{getattr:F.node_ops.getattr,setattr:F.node_ops.setattr,lookup:F.node_ops.lookup,mknod:F.node_ops.mknod,rename:F.node_ops.rename,unlink:F.node_ops.unlink,rmdir:F.node_ops.rmdir,readdir:F.node_ops.readdir,symlink:F.node_ops.symlink},stream:{llseek:F.stream_ops.llseek}},file:{node:{getattr:F.node_ops.getattr,setattr:F.node_ops.setattr},stream:{llseek:F.stream_ops.llseek,read:F.stream_ops.read,write:F.stream_ops.write,allocate:F.stream_ops.allocate,mmap:F.stream_ops.mmap,msync:F.stream_ops.msync}},link:{node:{getattr:F.node_ops.getattr,setattr:F.node_ops.setattr,readlink:F.node_ops.readlink},stream:{}},chrdev:{node:{getattr:F.node_ops.getattr,setattr:F.node_ops.setattr},stream:a.chrdev_stream_ops}});var u=a.createNode(e,r,t,n);return a.isDir(u.mode)?(u.node_ops=F.ops_table.dir.node,u.stream_ops=F.ops_table.dir.stream,u.contents={}):a.isFile(u.mode)?(u.node_ops=F.ops_table.file.node,u.stream_ops=F.ops_table.file.stream,u.usedBytes=0,u.contents=null):a.isLink(u.mode)?(u.node_ops=F.ops_table.link.node,u.stream_ops=F.ops_table.link.stream):a.isChrdev(u.mode)&&(u.node_ops=F.ops_table.chrdev.node,u.stream_ops=F.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&&F.resizeFileStorage(e,r.size)},lookup(e,r){throw a.genericErrors[44]},mknod(e,r,t,n){return F.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=F.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(F.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){F.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 F.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)},Tt=s.preloadPlugins||[];function wn(e,r,t,n){typeof Browser!="undefined"&&Browser.init();var u=!1;return Tt.forEach(function(l){u||l.canHandle(r)&&(l.handle(e,r,t,n),u=!0)}),u}function bt(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(F,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:F}},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",Te=1024*1024;re||(Te=$);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),$!==Te&&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)},Tr=this;Tr.setDataGetter(Ce=>{var nr=Ce*Te,ue=(Ce+1)*Te-1;if(ue=Math.min(ue,$-1),typeof Tr.chunks[Ce]=="undefined"&&(Tr.chunks[Ce]=oe(nr,ue)),typeof Tr.chunks[Ce]=="undefined")throw new Error("doXHR failed!");return Tr.chunks[Ce]}),(se||!$)&&(Te=$=1,$=this.getter(0).length,Te=$,lr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=$,this._chunkSize=Te,this.lengthKnown=!0},typeof XMLHttpRequest!="undefined"){if(!B)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 Te=Math.min(se.length-re,Z);if(se.slice)for(var oe=0;oe<Te;oe++)P[$+oe]=se[re+oe];else for(var oe=0;oe<Te;oe++)P[$+oe]=se.get(re+oe);return Te}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)!==Te)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)}),Te=Object.create(re,{constructor:{value:se}});se.prototype=Te;var oe=new Nt(R,se,Te,k,Z,l,d,h);oe.baseClass&&(oe.baseClass.__derivedClasses===void 0&&(oe.baseClass.__derivedClasses=[]),oe.baseClass.__derivedClasses.push(oe));var Tr=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),[Tr,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
5
|
return function ${_r(e)}(${x}) {
|
|
6
6
|
if (arguments.length !== ${f-2}) {
|
|
7
7
|
throwBindingError('function ${e} called with ${arguments.length} arguments, expected ${f-2} args!');
|
|
@@ -20,24 +20,24 @@ return ret;
|
|
|
20
20
|
`;for(var h=0;h<e-1;++h)t[h+1].deleteObject&&(x+=" argType"+h+".deleteObject(arg"+h+`);
|
|
21
21
|
`);n.isVoid||(x+=` return retType.toWireType(destructors, rv);
|
|
22
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 b=()=>{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=bt,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"}},Dn(),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:b,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(De>0||(pn(),De>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 T=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 I=Object.assign({},s),A=[],H="./this.program",D=(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),T&&(W=T),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,I),I=null,s.arguments&&(A=s.arguments),s.thisProgram&&(H=s.thisProgram),s.quit&&(D=s.quit);var he;s.wasmBinary&&(he=s.wasmBinary);var Do=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,De=null,qe=null;function dr(o){Xe++,s.monitorRunDependencies&&s.monitorRunDependencies(Xe)}function fo(o){if(Xe--,s.monitorRunDependencies&&s.monitorRunDependencies(Xe),Xe==0&&(De!==null&&(clearInterval(De),De=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 b=WebAssembly.instantiateStreaming(g,c);return b.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 b=m.exports;return ee=b,$r=ee.v,mt(),ht=ee.z,vn(ee.w),fo("wasm-instantiate"),b}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 Tn(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 bn(){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),b=[],w=0;i.forEach((_,O)=>{Ye.hasOwnProperty(_)?g[O]=Ye[_]:(b.push(_),G.hasOwnProperty(_)||(G[_]=[]),G[_].push(()=>{g[O]=Ye[_],++w,w===b.length&&m(g)}))}),b.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(b=>b())}}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 b=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>>b])},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 Tt(o){}function wn(o){o.smartPtr?o.smartPtrType.rawDestructor(o.smartPtr):o.ptrType.registeredClass.rawDestructor(o.ptr)}function bt(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 b=this.registeredClass.getActualType(i),w=Ar[b];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=>{bt(i.$$)}),He=i=>{var c=i.$$,m=!!c.smartPtr;if(m){var g={$$:c};Kr.register(i,g,i)}return i},Tt=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"),Tt(this),bt(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,b,w,_){this.name=o,this.constructor=i,this.instancePrototype=c,this.rawDestructor=m,this.baseClass=g,this.getActualType=b,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 It(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 Ir(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=Ir,xe.prototype.deleteObject=Qr,xe.prototype.fromWireType=Qe}function xe(o,i,c,m,g,b,w,_,O,E,B){this.name=o,this.registeredClass=i,this.isReference=c,this.isConst=m,this.isSmartPointer=g,this.pointeeType=b,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=It,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)},Dr=[],Dt=o=>{var i=Dr[o];return i||(o>=Dr.length&&(Dr.length=o+1),Dr[o]=i=ht.get(o)),i},Or=(o,i,c)=>{if(o.includes("j"))return yr(o,i,c);var m=Dt(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 Ie(o,i){o=ve(o);function c(){return o.includes("j")?Rn(o,i):Dt(i)}var m=c();return typeof m!="function"&&z(`unknown function pointer with signature ${o}: ${i}`),m}function In(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(b){if(!m[b]&&!Ye[b]){if(fr[b]){fr[b].forEach(g);return}c.push(b),m[b]=!0}}throw i.forEach(g),new Ot(`${o}: `+c.map(kt).join([", "]))}function
|
|
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 b=()=>{Fe("")};function w(){return Date.now()}var _=()=>ie.length,O=()=>_(),E=(e,r,t)=>ie.copyWithin(e,r,r+t),H=e=>{Fe("OOM")},V=e=>{var r=ie.length;e>>>=0,H(e)},j={},J=()=>M||"./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=bt,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:b,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 T=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=[],M="./this.program",I=(o,i)=>{throw i},C=typeof window=="object",B=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||B)&&(B?W=self.location.href:typeof document!="undefined"&&document.currentScript&&(W=document.currentScript.src),T&&(W=T),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},B&&(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&&(M=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||B)&&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 b=WebAssembly.instantiateStreaming(g,c);return b.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 b=m.exports;return ee=b,$r=ee.v,mt(),ht=ee.z,vn(ee.w),fo("wasm-instantiate"),b}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 Tn(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 bn(){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),b=[],w=0;i.forEach((_,O)=>{Ye.hasOwnProperty(_)?g[O]=Ye[_]:(b.push(_),G.hasOwnProperty(_)||(G[_]=[]),G[_].push(()=>{g[O]=Ye[_],++w,w===b.length&&m(g)}))}),b.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(b=>b())}}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 b=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>>b])},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 F(o){function i(c){return c.$$.ptrType.registeredClass.name}z(i(o)+" instance already deleted")}var Kr=!1;function Tt(o){}function wn(o){o.smartPtr?o.smartPtrType.rawDestructor(o.smartPtr):o.ptrType.registeredClass.rawDestructor(o.ptr)}function bt(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 b=this.registeredClass.getActualType(i),w=Ar[b];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=>{bt(i.$$)}),He=i=>{var c=i.$$,m=!!c.smartPtr;if(m){var g={$$:c};Kr.register(i,g,i)}return i},Tt=i=>Kr.unregister(i),He(o))};function cr(){if(this.$$.ptr||F(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||F(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&z("Object already scheduled for deletion"),Tt(this),bt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function At(){return!this.$$.ptr}function Pr(){return this.$$.ptr||F(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,b,w,_){this.name=o,this.constructor=i,this.instancePrototype=c,this.rawDestructor=m,this.baseClass=g,this.getActualType=b,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,b,w,_,O,E,H){this.name=o,this.registeredClass=i,this.isReference=c,this.isConst=m,this.isSmartPointer=g,this.pointeeType=b,this.sharingPolicy=w,this.rawGetPointee=_,this.rawConstructor=O,this.rawShare=E,this.rawDestructor=H,!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(b){if(!m[b]&&!Ye[b]){if(fr[b]){fr[b].forEach(g);return}c.push(b),m[b]=!0}}throw i.forEach(g),new Ot(`${o}: `+c.map(kt).join([", "]))}function In(o,i,c,m,g,b,w,_,O,E,H,V,j){H=ve(H),b=De(g,b),_&&(_=De(w,_)),E&&(E=De(O,E)),j=De(V,j);var J=Cr(H);Jr(J,function(){et(`Cannot construct ${H} 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 "+H);if(Pe.constructor_body===void 0)throw new le(H+" has no accessible constructor");var Qt=Pe.constructor_body[arguments.length];if(Qt===void 0)throw new le(`Tried to invoke ctor of ${H} 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(H,Ve,ct,j,Ee,b,_,E);Pe.baseClass&&(Pe.baseClass.__derivedClasses===void 0&&(Pe.baseClass.__derivedClasses=[]),Pe.baseClass.__derivedClasses.push(Pe));var io=new xe(H,Pe,!0,!1,!1),Jt=new xe(H+"*",Pe,!1,!1,!1),Zt=new xe(H+" 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,b){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 H=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
25
|
return function ${Cr(o)}(${V}) {
|
|
26
26
|
if (arguments.length !== ${w-2}) {
|
|
27
27
|
throwBindingError('function ${o} called with ${arguments.length} arguments, expected ${w-2} args!');
|
|
28
28
|
}`;O&&(J+=`var destructors = [];
|
|
29
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
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+=(
|
|
31
|
+
`,Ee.push("argType"+E),de.push(i[E+2]);if(_&&(j="thisWired"+(j.length>0?", ":"")+j),J+=(H||b?"var rv = ":"")+"invoker(fn"+(j.length>0?", ":"")+j+`);
|
|
32
32
|
`,O)J+=`runDestructors(destructors);
|
|
33
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
|
|
34
|
+
`,Ee.push(Ve+"_dtor"),de.push(i[E].destructorFunction))}return H&&(J+=`var ret = retType.fromWireType(rv);
|
|
35
35
|
return ret;
|
|
36
36
|
`),J+=`}
|
|
37
|
-
`,Ee.push(J),xt(Function,Ee).apply(null,de)}function rt(o,i,c,m,g,b){var w=Ue(i,c);g=
|
|
37
|
+
`,Ee.push(J),xt(Function,Ee).apply(null,de)}function rt(o,i,c,m,g,b){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,b),[]}),[]})}function Ut(o,i,c,m,g,b,w,_,O){var E=Ue(c,m);i=ve(i),b=De(g,b),Ze([],[o],function(H){H=H[0];var V=`${H.name}.${i}`;i.startsWith("@@")&&(i=Symbol[i.substring(2)]),_&&H.registeredClass.pureVirtualFunctions.push(i);function j(){et(`Cannot call ${V} due to unbound types`,E)}var J=H.registeredClass.instancePrototype,ne=J[i];return ne===void 0||ne.overloadTable===void 0&&ne.className!==H.name&&ne.argCount===c-2?(j.argCount=c-2,j.className=H.name,J[i]=j):(Rr(J,i,V),J[i].overloadTable[c-2]=j),Ze([],E,function(Ee){var de=_r(V,Ee,H,b,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,b){return b},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 b=Sr(c),w=V=>V;if(m===0){var _=32-8*c;w=V=>V<<_>>>_}var O=i.includes("unsigned"),E=(V,j)=>{},H;O?H=function(V,j){return E(j,this.name),j>>>0}:H=function(V,j){return E(j,this.name),j},Ae(o,{name:i,fromWireType:w,toWireType:H,argPackAdvance:8,readValueFromPointer:Ne(i,b,m!==0),destructorFunction:null})}function Fn(o,i,c){var m=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],g=m[i];function b(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:b,argPackAdvance:8,readValueFromPointer:b},{ignoreDuplicateRegistrations:!0})}var kr=(o,i,c,m)=>{if(!(m>0))return 0;for(var g=c,b=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>=b)break;i[c++]=_}else if(_<=2047){if(c+1>=b)break;i[c++]=192|_>>6,i[c++]=128|_&63}else if(_<=65535){if(c+2>=b)break;i[c++]=224|_>>12,i[c++]=128|_>>6&63,i[c++]=128|_&63}else{if(c+3>=b)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 b="";i<g;){var w=o[i++];if(!(w&128)){b+=String.fromCharCode(w);continue}var _=o[i++]&63;if((w&224)==192){b+=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)b+=String.fromCharCode(w);else{var E=w-65536;b+=String.fromCharCode(55296|E>>10,56320|E&1023)}}return b},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],b=m+4,w;if(c)for(var _=b,O=0;O<=g;++O){var E=b+O;if(O==g||Y[E]==0){var H=E-_,V=Ft(_,H);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[b+O]);w=j.join("")}return $e(m),w},toWireType:function(m,g){g instanceof ArrayBuffer&&(g=new Uint8Array(g));var b,w=typeof g=="string";w||g instanceof Uint8Array||g instanceof Uint8ClampedArray||g instanceof Int8Array||z("Cannot pass non-string to std::string"),c&&w?b=Bn(g):b=g.length;var _=st(4+b+1),O=_+4;if(U[_>>2]=b,c&&w)Lt(g,O,b+1);else if(w)for(var E=0;E<b;++E){var H=g.charCodeAt(E);H>255&&($e(O),z("String has UTF-16 code units that do not fit in 8 bits")),Y[O+E]=H}else for(var E=0;E<b;++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 b="",w=0;!(w>=i/2);++w){var _=ie[o+w*2>>1];if(_==0)break;b+=String.fromCharCode(_)}return b},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,b=0;b<g;++b){var w=o.charCodeAt(b);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 b=g-65536;m+=String.fromCharCode(55296|b>>10,56320|b&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,b=0;b<o.length;++b){var w=o.charCodeAt(b);if(w>=55296&&w<=57343){var _=o.charCodeAt(++b);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,b,w,_;i===2?(m=ot,g=Hn,w=Ht,b=()=>we,_=1):i===4&&(m=Wn,g=Wt,w=Vt,b=()=>U,_=2),Ae(o,{name:c,fromWireType:function(O){for(var E=U[O>>2],H=b(),V,j=O+4,J=0;J<=E;++J){var ne=O+4+J*i;if(J==E||H[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 H=w(E),V=st(4+H+i);return U[V>>2]=H>>_,g(E,V+4,H+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("_")+"$",b=zt[g];if(b!==void 0)return b;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 H=Cr("methodCaller_"+g),V="return function "+H+`(handle, name, destructors, args) {
|
|
38
38
|
`,j=0,E=0;E<o-1;++E)V+=" var arg"+E+" = argType"+E+".readValueFromPointer(args"+(j?"+"+j:"")+`);
|
|
39
39
|
`,j+=c[E+1].argPackAdvance;V+=" var rv = handle[name]("+O+`);
|
|
40
40
|
`;for(var E=0;E<o-1;++E)c[E+1].deleteObject&&(V+=" argType"+E+".deleteObject(arg"+E+`);
|
|
41
41
|
`);m.isVoid||(V+=` return retType.toWireType(destructors, rv);
|
|
42
42
|
`),V+=`};
|
|
43
|
-
`,w.push(V);var J=xt(Function,w).apply(null,_);return b=zn(J),zt[g]=b,b}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,b=0;b<c;b++){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};bn(),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=
|
|
43
|
+
`,w.push(V);var J=xt(Function,w).apply(null,_);return b=zn(J),zt[g]=b,b}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,b=0;b<c;b++){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};bn(),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:Tn,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(br({},s),{wasmPath:`${this.core.assetsPath}videodec_simd.wasm`})):new sn(Er(br({},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 M=this.core.room.videoManager.createDecodeContext(Er(br({},p),{createDecoder:this.createDecoder}));return s(M.trackDoneOB,v(1),S(()=>{this.core.clearStarted(this,this.getGroup(p)),this.stop({track:A})})),this.contextMap.set(A,M),M.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(br({},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:M,endTime:I})=>{M>s.startPerformanceTime&&(D+=I===0?co()-M:I-M)});let A=0;return S&&S.durationItemList.forEach(M=>{M.startTime>s.startPerformanceTime&&(A+=M.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};
|