trtc-sdk-v5 5.10.0-beta.2 → 5.10.0-beta.3

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.
Files changed (59) hide show
  1. package/README-zh_CN.md +1 -2
  2. package/README.md +1 -2
  3. package/index.d.ts +1796 -1823
  4. package/package.json +1 -1
  5. package/{assets → plugins/ai-denoiser}/denoiser-wasm.js +1 -1
  6. package/plugins/cdn-streaming/cdn-streaming.esm.js +1 -1
  7. package/plugins/cdn-streaming/cdn-streaming.iife.js +1 -0
  8. package/plugins/cdn-streaming/package.json +2 -1
  9. package/plugins/cross-room/cross-room.esm.js +1 -1
  10. package/plugins/cross-room/cross-room.iife.js +1 -0
  11. package/plugins/cross-room/package.json +2 -1
  12. package/plugins/device-detector/device-detector.esm.js +1234 -93
  13. package/plugins/device-detector/device-detector.iife.js +1472 -0
  14. package/plugins/device-detector/package.json +2 -1
  15. package/plugins/video-decoder/package.json +1 -1
  16. package/plugins/video-decoder/video-decoder.esm.d.ts +20 -20
  17. package/plugins/video-decoder/video-decoder.esm.js +43 -1
  18. package/plugins/video-decoder/video-decoder.iife.js +43 -0
  19. package/plugins/video-effect/basic-beauty/basic-beauty.esm.js +2 -1
  20. package/plugins/video-effect/basic-beauty/basic-beauty.iife.js +2 -0
  21. package/plugins/video-effect/basic-beauty/package.json +2 -1
  22. package/plugins/video-effect/beauty/beauty.esm.js +2954 -1
  23. package/plugins/video-effect/beauty/beauty.iife.js +2954 -0
  24. package/plugins/video-effect/beauty/package.json +2 -1
  25. package/plugins/video-effect/virtual-background/package.json +2 -1
  26. package/plugins/video-effect/virtual-background/virtual-background.esm.js +60 -1
  27. package/plugins/video-effect/virtual-background/virtual-background.iife.js +60 -0
  28. package/plugins/video-effect/watermark/package.json +2 -1
  29. package/plugins/video-effect/watermark/watermark.esm.d.ts +2 -10
  30. package/plugins/video-effect/watermark/watermark.esm.js +1 -1
  31. package/plugins/video-effect/watermark/watermark.iife.js +1 -0
  32. package/trtc.esm.js +28 -28
  33. package/trtc.js +1 -1
  34. package/assets/debug-dialog.js +0 -1
  35. package/assets/selfie_segmentation/package.json +0 -27
  36. package/assets/selfie_segmentation/selfie_segmentation.binarypb +0 -0
  37. package/assets/selfie_segmentation/selfie_segmentation.tflite +0 -0
  38. package/assets/selfie_segmentation/selfie_segmentation_landscape.tflite +0 -0
  39. package/assets/selfie_segmentation/selfie_segmentation_solution_simd_wasm_bin.data +0 -0
  40. package/assets/selfie_segmentation/selfie_segmentation_solution_simd_wasm_bin.wasm +0 -0
  41. package/assets/selfie_segmentation/selfie_segmentation_solution_wasm_bin.wasm +0 -0
  42. package/assets/videodec.wasm +0 -0
  43. package/assets/videodec_simd.wasm +0 -0
  44. package/plugins/cdn-streaming/cdn-streaming.umd.js +0 -1
  45. package/plugins/cross-room/cross-room.umd.js +0 -1
  46. package/plugins/custom-encryption/custom-encryption.esm.d.ts +0 -31
  47. package/plugins/custom-encryption/custom-encryption.esm.js +0 -1
  48. package/plugins/custom-encryption/custom-encryption.umd.js +0 -1
  49. package/plugins/custom-encryption/package.json +0 -7
  50. package/plugins/device-detector/device-detector.umd.js +0 -39
  51. package/plugins/video-decoder/video-decoder.umd.js +0 -1
  52. package/plugins/video-effect/basic-beauty/basic-beauty.umd.js +0 -1
  53. package/plugins/video-effect/beauty/beauty.umd.js +0 -1
  54. package/plugins/video-effect/virtual-background/virtual-background.umd.js +0 -1
  55. package/plugins/video-effect/watermark/watermark.umd.js +0 -1
  56. package/plugins/voice-changer/package.json +0 -9
  57. package/plugins/voice-changer/voice-changer.esm.d.ts +0 -20
  58. package/plugins/voice-changer/voice-changer.esm.js +0 -1
  59. package/plugins/voice-changer/voice-changer.umd.js +0 -1
@@ -0,0 +1,43 @@
1
+ "use strict";var TRTCVideoDecoder=(()=>{var Lo=Object.create;var Nr=Object.defineProperty,Mo=Object.defineProperties,bo=Object.getOwnPropertyDescriptor,Fo=Object.getOwnPropertyDescriptors,Bo=Object.getOwnPropertyNames,_o=Object.getOwnPropertySymbols,Ho=Object.getPrototypeOf,To=Object.prototype.hasOwnProperty,Wo=Object.prototype.propertyIsEnumerable;var uo=(_,p,s)=>p in _?Nr(_,p,{enumerable:!0,configurable:!0,writable:!0,value:s}):_[p]=s,Tr=(_,p)=>{for(var s in p||(p={}))To.call(p,s)&&uo(_,s,p[s]);if(_o)for(var s of _o(p))Wo.call(p,s)&&uo(_,s,p[s]);return _},Er=(_,p)=>Mo(_,Fo(p));var Vo=(_,p)=>()=>(p||_((p={exports:{}}).exports,p),p.exports),jo=(_,p)=>{for(var s in p)Nr(_,s,{get:p[s],enumerable:!0})},Eo=(_,p,s,v)=>{if(p&&typeof p=="object"||typeof p=="function")for(let S of Bo(p))!To.call(_,S)&&S!==s&&Nr(_,S,{get:()=>p[S],enumerable:!(v=bo(p,S))||v.enumerable});return _};var Go=(_,p,s)=>(s=_!=null?Lo(Ho(_)):{},Eo(p||!_||!_.__esModule?Nr(s,"default",{value:_,enumerable:!0}):s,_)),zo=_=>Eo(Nr({},"__esModule",{value:!0}),_),Le=(_,p,s,v)=>{for(var S=v>1?void 0:v?bo(p,s):p,D=_.length-1,A;D>=0;D--)(A=_[D])&&(S=(v?A(p,s,S):A(S))||S);return v&&S&&Nr(p,s,S),S};var fe=(_,p,s)=>uo(_,typeof p!="symbol"?p+"":p,s);var So=Vo((li,co)=>{"use strict";var Ko=Object.prototype.hasOwnProperty,Te="~";function dt(){}Object.create&&(dt.prototype=Object.create(null),new dt().__proto__||(Te=!1));function Xo(_,p,s){this.fn=_,this.context=p,this.once=s||!1}function wo(_,p,s,v,S){if(typeof s!="function")throw new TypeError("The listener must be a function");var D=new Xo(s,v||_,S),A=Te?Te+p:p;return _._events[A]?_._events[A].fn?_._events[A]=[_._events[A],D]:_._events[A].push(D):(_._events[A]=D,_._eventsCount++),_}function on(_,p){--_._eventsCount===0?_._events=new dt:delete _._events[p]}function pe(){this._events=new dt,this._eventsCount=0}pe.prototype.eventNames=function(){var p=[],s,v;if(this._eventsCount===0)return p;for(v in s=this._events)Ko.call(s,v)&&p.push(Te?v.slice(1):v);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(s)):p};pe.prototype.listeners=function(p){var s=Te?Te+p:p,v=this._events[s];if(!v)return[];if(v.fn)return[v.fn];for(var S=0,D=v.length,A=new Array(D);S<D;S++)A[S]=v[S].fn;return A};pe.prototype.listenerCount=function(p){var s=Te?Te+p:p,v=this._events[s];return v?v.fn?1:v.length:0};pe.prototype.emit=function(p,s,v,S,D,A){var H=Te?Te+p:p;if(!this._events[H])return!1;var I=this._events[H],C=arguments.length,F,L;if(I.fn){switch(I.once&&this.removeListener(p,I.fn,void 0,!0),C){case 1:return I.fn.call(I.context),!0;case 2:return I.fn.call(I.context,s),!0;case 3:return I.fn.call(I.context,s,v),!0;case 4:return I.fn.call(I.context,s,v,S),!0;case 5:return I.fn.call(I.context,s,v,S,D),!0;case 6:return I.fn.call(I.context,s,v,S,D,A),!0}for(L=1,F=new Array(C-1);L<C;L++)F[L-1]=arguments[L];I.fn.apply(I.context,F)}else{var W=I.length,me;for(L=0;L<W;L++)switch(I[L].once&&this.removeListener(p,I[L].fn,void 0,!0),C){case 1:I[L].fn.call(I[L].context);break;case 2:I[L].fn.call(I[L].context,s);break;case 3:I[L].fn.call(I[L].context,s,v);break;case 4:I[L].fn.call(I[L].context,s,v,S);break;default:if(!F)for(me=1,F=new Array(C-1);me<C;me++)F[me-1]=arguments[me];I[L].fn.apply(I[L].context,F)}}return!0};pe.prototype.on=function(p,s,v){return wo(this,p,s,v,!1)};pe.prototype.once=function(p,s,v){return wo(this,p,s,v,!0)};pe.prototype.removeListener=function(p,s,v,S){var D=Te?Te+p:p;if(!this._events[D])return this;if(!s)return on(this,D),this;var A=this._events[D];if(A.fn)A.fn===s&&(!S||A.once)&&(!v||A.context===v)&&on(this,D);else{for(var H=0,I=[],C=A.length;H<C;H++)(A[H].fn!==s||S&&!A[H].once||v&&A[H].context!==v)&&I.push(A[H]);I.length?this._events[D]=I.length===1?I[0]:I:on(this,D)}return this};pe.prototype.removeAllListeners=function(p){var s;return p?(s=Te?Te+p:p,this._events[s]&&on(this,s)):(this._events=new dt,this._eventsCount=0),this};pe.prototype.off=pe.prototype.removeListener;pe.prototype.addListener=pe.prototype.on;pe.prefixed=Te;pe.EventEmitter=pe;typeof co!="undefined"&&(co.exports=pe)});var ii={};jo(ii,{VideoDecoderPlugin:()=>ln,default:()=>oi});var Po=Go(So(),1),Ao=Symbol("instance"),di=Symbol("abortCtrl"),an=Symbol("cacheResult"),ft=class{constructor(p,s,v){this.oldState=p,this.newState=s,this.action=v,this.aborted=!1}abort(p){this.aborted=!0,mt.call(p,this.oldState,new Error(`action '${this.action}' aborted`))}toString(){return`${this.action}ing`}},$r=class extends Error{constructor(p,s,v){super(s),this.state=p,this.message=s,this.cause=v}};function qo(_){return typeof _=="object"&&_&&"then"in _}var pt=new Map;function je(_,p,s={}){return(v,S,D)=>{let A=s.action||S;if(!s.context){let I=pt.get(v)||[];pt.has(v)||pt.set(v,I),I.push({from:_,to:p,action:A})}let H=D.value;D.value=function(...I){let C=this;if(s.context&&(C=ce.get(typeof s.context=="function"?s.context.call(this,...I):s.context)),C.state===p)return s.sync?C[an]:Promise.resolve(C[an]);C.state instanceof ft&&C.state.action==s.abortAction&&C.state.abort(C);let F=null;Array.isArray(_)?_.length==0?C.state instanceof ft&&C.state.abort(C):(typeof C.state!="string"||!_.includes(C.state))&&(F=new $r(C._state,`${C.name} ${A} to ${p} failed: current state ${C._state} not from ${_.join("|")}`)):_!==C.state&&(F=new $r(C._state,`${C.name} ${A} to ${p} failed: current state ${C._state} not from ${_}`));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 ft(W,p,A);mt.call(C,me);let Re=q=>{var ze;return C[an]=q,me.aborted||(mt.call(C,p),(ze=s.success)===null||ze===void 0||ze.call(this,C[an])),q},Me=q=>(mt.call(C,W,q),L(q));try{let q=H.apply(this,I);return qo(q)?q.then(Re).catch(Me):s.sync?Re(q):Promise.resolve(Re(q))}catch(q){return Me(new $r(C._state,`${C.name} ${A} from ${_} to ${p} failed: ${q}`,q instanceof Error?q:new Error(String(q))))}}}}function Co(..._){return(p,s,v)=>{let S=v.value,D=s;v.value=function(...A){if(!_.includes(this.state.toString()))throw new $r(this.state,`${this.name} ${D} failed: current state ${this.state} not in ${_}`);return S.apply(this,A)}}}var Yo=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 mt(_,p){let s=this._state;this._state=_;let v=_.toString();_&&this.emit(v,s),this.emit(ce.STATECHANGED,_,s,p),this.updateDevTools({value:_,old:s,err:p instanceof Error?p.message:String(p)})}var ce=class _ extends Po.default{constructor(p,s,v){super(),this.name=p,this.groupName=s,this._state=_.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[Ao];S?this.name=S.name+"-"+S.count++:v[Ao]={name:this.name,count:0},this.updateDevTools({diagram:this.stateDiagram})}get stateDiagram(){let p=Object.getPrototypeOf(this),s=pt.get(p)||[],v=new Set,S=[],D=[],A=new Set,H=Object.getPrototypeOf(p);pt.has(H)&&(H.stateDiagram.forEach(C=>v.add(C)),H.allStates.forEach(C=>A.add(C))),s.forEach(({from:C,to:F,action:L})=>{typeof C=="string"?S.push({from:C,to:F,action:L}):C.length?C.forEach(W=>{S.push({from:W,to:F,action:L})}):D.push({to:F,action:L})}),S.forEach(({from:C,to:F,action:L})=>{A.add(C),A.add(F),A.add(L+"ing"),v.add(`${C} --> ${L}ing : ${L}`),v.add(`${L}ing --> ${F} : ${L} \u{1F7E2}`),v.add(`${L}ing --> ${C} : ${L} \u{1F534}`)}),D.forEach(({to:C,action:F})=>{v.add(`${F}ing --> ${C} : ${F} \u{1F7E2}`),A.forEach(L=>{L!==C&&v.add(`${L} --> ${F}ing : ${F}`)})});let I=[...v];return Object.defineProperties(p,{stateDiagram:{value:I},allStates:{value:A}}),I}static get(p){let s;return typeof p=="string"?(s=_.instances.get(p),s||_.instances.set(p,s=new _(p,void 0,Object.create(_.prototype)))):(s=_.instances2.get(p),s||_.instances2.set(p,s=new _(p.constructor.name,void 0,Object.create(_.prototype)))),s}static getState(p){var s;return(s=_.get(p))===null||s===void 0?void 0:s.state}updateDevTools(p={}){Yo(_.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},p))}get state(){return this._state}set state(p){mt.call(this,p)}};ce.STATECHANGED="stateChanged";ce.UPDATEAFSM="updateAFSM";ce.INIT="[*]";ce.ON="on";ce.OFF="off";ce.instances=new Map;ce.instances2=new WeakMap;var or=class extends ce{constructor(){super(...arguments);fe(this,"decoder");fe(this,"config")}async initialize(){this.decoder=new VideoDecoder({output:s=>{this.emit("videoFrame",s)},error:s=>{this.close(),this.emit("error",s)}})}configure(s){this.config=s,this.decoder.configure(Er(Tr({},s),{codec:this.getCodec(s)}))}getCodec(s){switch(s.codec){case"hevc":return"hvc1.1.6.L0.12.34.56.78.9A.BC";case"av1":return"av01.0.05M.08";case"avc":return"avc1.420028";default:return s.codec}}decode(s){this.decoder.state==="configured"&&this.decoder.decode(new EncodedVideoChunk(s))}flush(){this.decoder.flush()}reset(){this.decoder.reset()}close(){this.decoder.state!=="closed"&&this.decoder.close()}};Le([je([ce.INIT,"closed"],"initialized")],or.prototype,"initialize",1),Le([je("initialized","configured",{sync:!0})],or.prototype,"configure",1),Le([Co("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 Zo(){var _;self.onmessage=p=>{if(p.data.type==="init"){let{canvas:s,wasmScript:v,wasmBinary:S}=p.data,D=s==null?void 0:s.getContext("2d"),A=0,H=0,I={wasmBinary:S,postRun:()=>{_=new I.VideoDecoder({videoInfo(C,F){A=C,H=F,console.log("video info",C,F)},yuvData(C,F){let L=A*H,W=L>>2,me=I.HEAPU32[C>>2],Re=I.HEAPU32[(C>>2)+1],Me=I.HEAPU32[(C>>2)+2],q=I.HEAPU8.subarray(me,me+L),ze=I.HEAPU8.subarray(Re,Re+W),lr=I.HEAPU8.subarray(Me,Me+W),ae=new Uint8Array(L+W+W);ae.set(q),ae.set(ze,L),ae.set(lr,L+W);let he=new VideoFrame(ae,{codedWidth:A,codedHeight:H,format:"I420",timestamp:F});s?(D==null||D.drawImage(he,0,0,s.width,s.height),D==null||D.commit()):self.postMessage({type:"yuvData",videoFrame:he},[he])}}),self.postMessage({type:"ready"})}};Function("var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;return "+v)()(I)}else if(p.data.type==="decode"){let{packet:s}=p.data;_==null||_.decode(s.data,s.type=="key",s.timestamp)}else if(p.data.type==="setCodec"){let{codec:s,format:v,description:S}=p.data;_==null||_.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(Zo.toString())[1];this.worker=new Worker(URL.createObjectURL(new Blob([D],{type:"text/javascript"})));let A=(S=this.canvas)==null?void 0:S.transferControlToOffscreen(),H=await this.wasmBinary;return console.warn("worker mode",H),this.worker.postMessage({type:"init",canvas:A,wasmScript:this.createModule.toString(),wasmBinary:H},A?[A,H]:[H]),new Promise(I=>{this.worker.onmessage=C=>{if(C.data.type==="ready")delete this.wasmBinary,I(),console.warn("worker mode initialize success");else if(C.data.type==="yuvData"){let{videoFrame:F}=C.data;this.emit("videoFrame",F)}}})}let v=this.module;return this.wasmBinary&&(v.wasmBinary=await this.wasmBinary),v.print=D=>console.log(D),v.printErr=D=>console.log(`[JS] ERROR: ${D}`),v.onAbort=()=>console.log("[JS] FATAL: WASM ABORTED"),new Promise(D=>{v.postRun=A=>{this.decoder=new this.module.VideoDecoder(this),console.log("video soft decoder initialize success"),D()},s&&Object.assign(v,s),this.createModule(v)})}configure(s){var v,S,D;this.config=s,(S=this.decoder)==null||S.setCodec(this.config.codec,this.config.description?"avcc":"annexb",(v=this.config.description)!=null?v:""),(D=this.worker)==null||D.postMessage({type:"setCodec",codec:this.config.codec,format:this.config.description?"avcc":"annexb",description:this.config.description})}decode(s){var v,S;(v=this.decoder)==null||v.decode(s.data,s.type=="key",s.timestamp),this.state==="configured"&&((S=this.worker)==null||S.postMessage({type:"decode",packet:s}))}flush(){}reset(){this.config=void 0,this.decoder&&this.decoder.clear()}close(){this.removeAllListeners(),this.decoder&&(this.decoder.clear(),this.decoder.delete())}videoInfo(s,v){this.width=s,this.height=v;let S={width:s,height:v};this.emit("videoCodecInfo",S)}yuvData(s,v){if(!this.module)return;let S=this.width*this.height,D=S>>2,A=this.module.HEAPU32[s>>2],H=this.module.HEAPU32[(s>>2)+1],I=this.module.HEAPU32[(s>>2)+2],C=this.module.HEAPU8.subarray(A,A+S),F=this.module.HEAPU8.subarray(H,H+D),L=this.module.HEAPU8.subarray(I,I+D);if(this.yuvMode){this.emit("videoFrame",[C,F,L]);return}let W=new Uint8Array(S+D+D);W.set(C),W.set(F,S),W.set(L,S+D),this.emit("videoFrame",new VideoFrame(W,{codedWidth:this.width,codedHeight:this.height,format:"I420",timestamp:v}))}errorInfo(s){let v={errMsg:s};this.emit("error",v)}};Le([je([ce.INIT,"closed"],"initialized")],Ge.prototype,"initialize",1),Le([je("initialized","configured")],Ge.prototype,"configure",1),Le([je([],ce.INIT)],Ge.prototype,"reset",1),Le([je([],"closed")],Ge.prototype,"close",1);var Qo=(()=>{var _=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return function(p={}){var s=p,v,S;s.ready=new Promise((e,r)=>{v=e,S=r});var D=Object.assign({},s),A=[],H="./this.program",I=(e,r)=>{throw r},C=typeof window=="object",F=typeof importScripts=="function",L=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",W="";function me(e){return s.locateFile?s.locateFile(e,W):W+e}var Re,Me,q,ze;(C||F)&&(F?W=self.location.href:typeof document!="undefined"&&document.currentScript&&(W=document.currentScript.src),_&&(W=_),W.indexOf("blob:")!==0?W=W.substr(0,W.replace(/[?#].*/,"").lastIndexOf("/")+1):W="",Re=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},F&&(q=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Me=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{if(n.status==200||n.status==0&&n.response){r(n.response);return}t()},n.onerror=t,n.send(null)},ze=e=>document.title=e);var lr=s.print||console.log.bind(console),ae=s.printErr||console.error.bind(console);Object.assign(s,D),D=null,s.arguments&&(A=s.arguments),s.thisProgram&&(H=s.thisProgram),s.quit&&(I=s.quit);var he;s.wasmBinary&&(he=s.wasmBinary);var Oo=s.noExitRuntime||!0;typeof WebAssembly!="object"&&Fe("no native wasm support detected");var Lr,ee,Mr=!1,fn;function Ke(e,r){e||Fe(r)}var Y,ie,we,Se,U,X,Fr,ht;function vt(){var e=Lr.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=Fr=new Float32Array(e),s.HEAPF64=ht=new Float64Array(e)}var Br,Hr=[],Wr=[],gt=[],pn=!1;function mn(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)gn(s.preRun.shift());zr(Hr)}function hn(){pn=!0,!s.noFSInit&&!a.init.initialized&&a.init(),a.ignorePermissions=!1,Be.init(),zr(Wr)}function vn(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)Xe(s.postRun.shift());zr(gt)}function gn(e){Hr.unshift(e)}function yn(e){Wr.unshift(e)}function Xe(e){gt.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),Mr=!0,fn=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 Vr(e){return e.startsWith(ar)}var sr;sr="videodec.wasm",Vr(sr)||(sr=me(sr));function jr(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 _n(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(()=>jr(e)):Promise.resolve().then(()=>jr(e))}function yt(e,r,t){return _n(e).then(n=>WebAssembly.instantiate(n,r)).then(n=>n).then(t,n=>{ae("failed to asynchronously prepare wasm: "+n),Fe(n)})}function Gr(e,r,t,n){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Vr(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"),yt(r,t,n)})}):yt(r,t,n)}function bn(){var e={a:xo};function r(n,u){var l=n.exports;return ee=l,Lr=ee.E,vt(),Br=ee.H,yn(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 Gr(he,sr,e,t).catch(S),{}}var N,Q,zr=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,En=0;function _t(e,r,t){var n=new Tn(e);throw n.init(r,t),Sr=e,En++,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},Kr=(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=Kr(e,u,0,u.length);return r&&(u.length=l),u}var wn=()=>{if(!ur.length){var e=null;if(typeof window!="undefined"&&typeof window.prompt=="function"?(e=window.prompt("Input: "),e!==null&&(e+=`
2
+ `)):typeof readline=="function"&&(e=readline(),e!==null&&(e+=`
3
+ `)),!e)return null;ur=Ae(e,!0)}return ur.shift()},Be={ttys:[],init:function(){},shutdown:function(){},register:function(e,r){Be.ttys[e]={input:[],output:[],ops:r},a.registerDevice(e,Be.stream_ops)},stream_ops:{open:function(e){var r=Be.ttys[e.node.rdev];if(!r)throw new a.ErrnoError(43);e.tty=r,e.seekable=!1},close:function(e){e.tty.ops.fsync(e.tty)},fsync:function(e){e.tty.ops.fsync(e.tty)},read:function(e,r,t,n,u){if(!e.tty||!e.tty.ops.get_char)throw new a.ErrnoError(60);for(var l=0,f=0;f<n;f++){var d;try{d=e.tty.ops.get_char(e.tty)}catch(y){throw new a.ErrnoError(29)}if(d===void 0&&l===0)throw new a.ErrnoError(6);if(d==null)break;l++,r[t+f]=d}return l&&(e.node.timestamp=Date.now()),l},write:function(e,r,t,n,u){if(!e.tty||!e.tty.ops.put_char)throw new a.ErrnoError(60);try{for(var l=0;l<n;l++)e.tty.ops.put_char(e.tty,r[t+l])}catch(f){throw new a.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),l}},default_tty_ops:{get_char:function(e){return wn()},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=[])}}},bt=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=bt(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}}},Xr=(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 Sn(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 Et(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)}Sn(P,R,$,()=>{f&&f(),wr(x)})||$(P)}ir(x),typeof t=="string"?Xr(t,P=>k(P),f):k(t)}function wt(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"?wt(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=Kr(r,u,0,u.length);a.write(n,u,0,l,void 0,t.canOwn)}else if(ArrayBuffer.isView(r))a.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");a.close(n)},cwd:()=>a.currentPath,chdir:e=>{var r=a.lookupPath(e,{follow:!0});if(r.node===null)throw new a.ErrnoError(44);if(!a.isDir(r.node.mode))throw new a.ErrnoError(54);var t=a.nodePermissions(r.node,"x");if(t)throw new a.ErrnoError(t);a.currentPath=r.path},createDefaultDirectories:()=>{a.mkdir("/tmp"),a.mkdir("/home"),a.mkdir("/home/web_user")},createDefaultDevices:()=>{a.mkdir("/dev"),a.registerDevice(a.makedev(1,3),{read:()=>0,write:(n,u,l,f,d)=>f}),a.mkdev("/dev/null",a.makedev(1,3)),Be.register(a.makedev(5,0),Be.default_tty_ops),Be.register(a.makedev(6,0),Be.default_tty1_ops),a.mkdev("/dev/tty",a.makedev(5,0)),a.mkdev("/dev/tty1",a.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(r=fr(e).byteLength),e[--r]);a.createDevice("/dev","random",t),a.createDevice("/dev","urandom",t),a.mkdir("/dev/shm"),a.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{a.mkdir("/proc");var e=a.mkdir("/proc/self");a.mkdir("/proc/self/fd"),a.mount({mount:()=>{var r=a.createNode(e,"fd",16895,73);return r.node_ops={lookup:(t,n)=>{var u=+n,l=a.getStreamChecked(u),f={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>l.path}};return f.parent=f,f}},r}},{},"/proc/self/fd")},createStandardStreams:()=>{s.stdin?a.createDevice("/dev","stdin",s.stdin):a.symlink("/dev/tty","/dev/stdin"),s.stdout?a.createDevice("/dev","stdout",null,s.stdout):a.symlink("/dev/tty","/dev/stdout"),s.stderr?a.createDevice("/dev","stderr",null,s.stderr):a.symlink("/dev/tty1","/dev/stderr");var e=a.open("/dev/stdin",0),r=a.open("/dev/stdout",1),t=a.open("/dev/stderr",1)},ensureErrnoError:()=>{a.ErrnoError||(a.ErrnoError=function(r,t){this.name="ErrnoError",this.node=t,this.setErrno=function(n){this.errno=n},this.setErrno(r),this.message="FS error"},a.ErrnoError.prototype=new Error,a.ErrnoError.prototype.constructor=a.ErrnoError,[44].forEach(e=>{a.genericErrors[e]=new a.ErrnoError(e),a.genericErrors[e].stack="<generic error, no stack>"}))},staticInit:()=>{a.ensureErrnoError(),a.nameTable=new Array(4096),a.mount(M,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:M}},init:(e,r,t)=>{a.init.initialized=!0,a.ensureErrnoError(),s.stdin=e||s.stdin,s.stdout=r||s.stdout,s.stderr=t||s.stderr,a.createStandardStreams()},quit:()=>{a.init.initialized=!1;for(var e=0;e<a.streams.length;e++){var r=a.streams[e];r&&a.close(r)}},findObject:(e,r)=>{var t=a.analyzePath(e,r);return t.exists?t.object:null},analyzePath:(e,r)=>{try{var t=a.lookupPath(e,{follow:!r});e=t.path}catch(u){}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=a.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=G.basename(e),t=a.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(u){n.error=u.errno}return n},createPath:(e,r,t,n)=>{e=typeof e=="string"?e:a.getPath(e);for(var u=r.split("/").reverse();u.length;){var l=u.pop();if(l){var f=G.join2(e,l);try{a.mkdir(f)}catch(d){}e=f}}return f},createFile:(e,r,t,n,u)=>{var l=G.join2(typeof e=="string"?e:a.getPath(e),r),f=Ar(n,u);return a.create(l,f)},createDataFile:(e,r,t,n,u,l)=>{var f=r;e&&(e=typeof e=="string"?e:a.getPath(e),f=r?G.join2(e,r):e);var d=Ar(n,u),y=a.create(f,d);if(t){if(typeof t=="string"){for(var h=new Array(t.length),R=0,x=t.length;R<x;++R)h[R]=t.charCodeAt(R);t=h}a.chmod(y,d|146);var k=a.open(y,577);a.write(k,t,0,t.length,0,l),a.close(k),a.chmod(y,d)}return y},createDevice:(e,r,t,n)=>{var u=G.join2(typeof e=="string"?e:a.getPath(e),r),l=Ar(!!t,!!n);a.createDevice.major||(a.createDevice.major=64);var f=a.makedev(a.createDevice.major++,0);return a.registerDevice(f,{open:d=>{d.seekable=!1},close:d=>{n&&n.buffer&&n.buffer.length&&n(10)},read:(d,y,h,R,x)=>{for(var k=0,P=0;P<R;P++){var $;try{$=t()}catch(Z){throw new a.ErrnoError(29)}if($===void 0&&k===0)throw new a.ErrnoError(6);if($==null)break;k++,y[h+P]=$}return k&&(d.node.timestamp=Date.now()),k},write:(d,y,h,R,x)=>{for(var k=0;k<R;k++)try{n(y[h+k])}catch(P){throw new a.ErrnoError(29)}return R&&(d.node.timestamp=Date.now()),k}}),a.mkdev(u,l,f)},forceLoadFile:e=>{if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest!="undefined")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(Re)try{e.contents=Ae(Re(e.url),!0),e.usedBytes=e.contents.length}catch(r){throw new a.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile:(e,r,t,n,u)=>{function l(){this.lengthKnown=!1,this.chunks=[]}if(l.prototype.get=function(P){if(!(P>this.length-1||P<0)){var $=P%this.chunkSize,Z=P/this.chunkSize|0;return this.getter(Z)[$]}},l.prototype.setDataGetter=function(P){this.getter=P},l.prototype.cacheLength=function(){var P=new XMLHttpRequest;if(P.open("HEAD",t,!1),P.send(null),!(P.status>=200&&P.status<300||P.status===304))throw new Error("Couldn't load "+t+". Status: "+P.status);var $=Number(P.getResponseHeader("Content-length")),Z,re=(Z=P.getResponseHeader("Accept-Ranges"))&&Z==="bytes",se=(Z=P.getResponseHeader("Content-Encoding"))&&Z==="gzip",be=1024*1024;re||(be=$);var oe=(Ce,nr)=>{if(Ce>nr)throw new Error("invalid range ("+Ce+", "+nr+") or no bytes requested!");if(nr>$-1)throw new Error("only "+$+" bytes available! programmer error!");var ue=new XMLHttpRequest;if(ue.open("GET",t,!1),$!==be&&ue.setRequestHeader("Range","bytes="+Ce+"-"+nr),ue.responseType="arraybuffer",ue.overrideMimeType&&ue.overrideMimeType("text/plain; charset=x-user-defined"),ue.send(null),!(ue.status>=200&&ue.status<300||ue.status===304))throw new Error("Couldn't load "+t+". Status: "+ue.status);return ue.response!==void 0?new Uint8Array(ue.response||[]):Ae(ue.responseText||"",!0)},br=this;br.setDataGetter(Ce=>{var nr=Ce*be,ue=(Ce+1)*be-1;if(ue=Math.min(ue,$-1),typeof br.chunks[Ce]=="undefined"&&(br.chunks[Ce]=oe(nr,ue)),typeof br.chunks[Ce]=="undefined")throw new Error("doXHR failed!");return br.chunks[Ce]}),(se||!$)&&(be=$=1,$=this.getter(0).length,be=$,lr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=$,this._chunkSize=be,this.lengthKnown=!0},typeof XMLHttpRequest!="undefined"){if(!F)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var f=new l;Object.defineProperties(f,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var d={isDevice:!1,contents:f}}else var d={isDevice:!1,url:t};var y=a.createFile(e,r,d,n,u);d.contents?y.contents=d.contents:d.url&&(y.contents=null,y.url=d.url),Object.defineProperties(y,{usedBytes:{get:function(){return this.contents.length}}});var h={},R=Object.keys(y.stream_ops);R.forEach(k=>{var P=y.stream_ops[k];h[k]=function(){return a.forceLoadFile(y),P.apply(null,arguments)}});function x(k,P,$,Z,re){var se=k.node.contents;if(re>=se.length)return 0;var be=Math.min(se.length-re,Z);if(se.slice)for(var oe=0;oe<be;oe++)P[$+oe]=se[re+oe];else for(var oe=0;oe<be;oe++)P[$+oe]=se.get(re+oe);return be}return h.read=(k,P,$,Z,re)=>(a.forceLoadFile(y),x(k,P,$,Z,re)),h.mmap=(k,P,$,Z,re)=>{a.forceLoadFile(y);var se=bt(P);if(!se)throw new a.ErrnoError(48);return x(k,Y,se,P,$),{ptr:se,allocated:!0}},y.stream_ops=h,y}},St=(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=St(e);return r},getStreamFromFD:function(e){var r=a.getStreamChecked(e);return r}};function qr(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 An(e,r,t,n,u){}function Yr(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);At=e}var At=void 0;function ge(e){for(var r="",t=e;ie[t];)r+=At[ie[t++]];return r}var Oe={},Qe={},He={},cr=void 0;function K(e){throw new cr(e)}var Pt=void 0;function Pr(e){throw new Pt(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 Pn(e,r,t,n,u){var l=Yr(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 Jr(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 Zr=!1;function Ct(e){}function Qr(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function Rt(e){e.count.value-=1;var r=e.count.value===0;r&&Qr(e)}function Dt(e,r,t){if(r===t)return e;if(t.baseClass===void 0)return null;var n=Dt(e,r,t.baseClass);return n===null?null:t.downcast(n)}var It={};function Dr(){return Object.keys(yr).length}function Cn(){var e=[];for(var r in yr)yr.hasOwnProperty(r)&&e.push(yr[r]);return e}var vr=[];function et(){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(et)}function Rn(){s.getInheritedInstanceCount=Dr,s.getLiveInheritedInstances=Cn,s.flushPendingDeletes=et,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 Ot(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 Dn(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=Ot(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=Dt(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):(Zr=new FinalizationRegistry(r=>{Rt(r.$$)}),De=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var u={$$:t};Zr.register(r,u,r)}return r},Ct=r=>Zr.unregister(r),De(e))};function In(){if(this.$$.ptr||Rr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=De(Object.create(Object.getPrototypeOf(this),{$$:{value:Jr(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function kt(){this.$$.ptr||Rr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&K("Object already scheduled for deletion"),Ct(this),Rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function xt(){return!this.$$.ptr}function rt(){return this.$$.ptr||Rr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&K("Object already scheduled for deletion"),vr.push(this),vr.length===1&&gr&&gr(et),this.$$.deleteScheduled=!0,this}function On(){Ue.prototype.isAliasOf=Cr,Ue.prototype.clone=In,Ue.prototype.delete=kt,Ue.prototype.isDeleted=xt,Ue.prototype.deleteLater=rt}function Ue(){}var kn=48,Ut=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>=kn&&r<=Ut?`_${e}`:e}function tt(e,r){return e=_r(e),{[e]:function(){return r.apply(this,arguments)}}[e]}function Nt(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 xn(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`),Nt(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 $t(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 Lt(e,r){if(r===null)return this.isReference&&K(`null is not a valid ${this.name}`),0;r.$$||K(`Cannot pass "${at(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 Un(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 "${at(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 Nn(e,r){if(r===null)return this.isReference&&K(`null is not a valid ${this.name}`),0;r.$$||K(`Cannot pass "${at(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 $n(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function nt(e){this.rawDestructor&&this.rawDestructor(e)}function Ln(e){e!==null&&e.delete()}function Mn(){Ne.prototype.getPointee=$n,Ne.prototype.destructor=nt,Ne.prototype.argPackAdvance=8,Ne.prototype.readValueFromPointer=er,Ne.prototype.deleteObject=Ln,Ne.prototype.fromWireType=Dn}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=Lt,this.destructorFunction=null):(this.toWireType=Nn,this.destructorFunction=null):this.toWireType=Un}function Fn(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 Bn=(e,r,t)=>{var n=s["dynCall_"+e];return t&&t.length?n.apply(null,[r].concat(t)):n.call(null,r)},kr=[],Mt=e=>{var r=kr[e];return r||(e>=kr.length&&(kr.length=e+1),kr[e]=r=Br.get(e)),r},Hn=(e,r,t)=>{if(e.includes("j"))return Bn(e,r,t);var n=Mt(r).apply(null,t);return n},Ft=(e,r)=>{var t=[];return function(){return t.length=0,Object.assign(t,arguments),Hn(e,r,t)}};function rr(e,r){e=ge(e);function t(){return e.includes("j")?Ft(e,r):Mt(r)}var n=t();return typeof n!="function"&&K(`unknown function pointer with signature ${e}: ${r}`),n}function Bt(e,r){var t=tt(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 Ht=void 0;function ot(e){var r=vo(e),t=ge(r);return tr(r),t}function it(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 Ht(`${e}: `+t.map(ot).join([", "]))}function Wn(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);xn(P,function(){it(`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=tt(P,function(){if(Object.getPrototypeOf(this)!==be)throw new cr("Use 'new' to construct "+R);if(oe.constructor_body===void 0)throw new cr(R+" has no accessible constructor");var ue=oe.constructor_body[arguments.length];if(ue===void 0)throw new cr(`Tried to invoke ctor of ${R} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(oe.constructor_body).toString()}) parameters instead!`);return ue.apply(this,arguments)}),be=Object.create(re,{constructor:{value:se}});se.prototype=be;var oe=new $t(R,se,be,k,Z,l,d,h);oe.baseClass&&(oe.baseClass.__derivedClasses===void 0&&(oe.baseClass.__derivedClasses=[]),oe.baseClass.__derivedClasses.push(oe));var br=new Ne(R,oe,!0,!1,!1),Ce=new Ne(R+"*",oe,!1,!1,!1),nr=new Ne(R+" const*",oe,!1,!0,!1);return It[e]={pointerType:Ce,constPointerType:nr},Fn(P,se),[br,Ce,nr]})}function Wt(e,r){for(var t=[],n=0;n<e;n++)t.push(X[r+n*4>>2]);return t}function Vn(e){for(;e.length;){var r=e.pop(),t=e.pop();t(r)}}function Vt(e,r){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var t=tt(e.name||"unknownFunctionName",function(){});t.prototype=e.prototype;var n=new t,u=e.apply(n,r);return u instanceof Object?u:n}function jt(e,r,t,n,u,l){var f=r.length;f<2&&K("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var d=r[1]!==null&&t!==null,y=!1,h=1;h<r.length;++h)if(r[h]!==null&&r[h].destructorFunction===void 0){y=!0;break}for(var R=r[0].name!=="void",x="",k="",h=0;h<f-2;++h)x+=(h!==0?", ":"")+"arg"+h,k+=(h!==0?", ":"")+"arg"+h+"Wired";var P=`
5
+ return function ${_r(e)}(${x}) {
6
+ if (arguments.length !== ${f-2}) {
7
+ throwBindingError('function ${e} called with ${arguments.length} arguments, expected ${f-2} args!');
8
+ }`;y&&(P+=`var destructors = [];
9
+ `);var $=y?"destructors":"null",Z=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],re=[K,n,u,Vn,r[0],r[1]];d&&(P+="var thisWired = classParam.toWireType("+$+`, this);
10
+ `);for(var h=0;h<f-2;++h)P+="var arg"+h+"Wired = argType"+h+".toWireType("+$+", arg"+h+"); // "+r[h+2].name+`
11
+ `,Z.push("argType"+h),re.push(r[h+2]);if(d&&(k="thisWired"+(k.length>0?", ":"")+k),P+=(R||l?"var rv = ":"")+"invoker(fn"+(k.length>0?", ":"")+k+`);
12
+ `,y)P+=`runDestructors(destructors);
13
+ `;else for(var h=d?1:2;h<r.length;++h){var se=h===1?"thisWired":"arg"+(h-2)+"Wired";r[h].destructorFunction!==null&&(P+=se+"_dtor("+se+"); // "+r[h].name+`
14
+ `,Z.push(se+"_dtor"),re.push(r[h].destructorFunction))}return R&&(P+=`var ret = retType.fromWireType(rv);
15
+ return ret;
16
+ `),P+=`}
17
+ `,Z.push(P),Vt(Function,Z).apply(null,re)}function jn(e,r,t,n,u,l){var f=Wt(r,t);u=rr(n,u),hr([],[e],function(d){d=d[0];var y=`constructor ${d.name}`;if(d.registeredClass.constructor_body===void 0&&(d.registeredClass.constructor_body=[]),d.registeredClass.constructor_body[r-1]!==void 0)throw new cr(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${d.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return d.registeredClass.constructor_body[r-1]=()=>{it(`Cannot construct ${d.name} due to unbound types`,f)},hr([],f,function(h){return h.splice(1,0,null),d.registeredClass.constructor_body[r-1]=jt(y,h,null,u,l),[]}),[]})}function Gn(e,r,t,n,u,l,f,d,y){var h=Wt(t,n);r=ge(r),l=rr(u,l),hr([],[e],function(R){R=R[0];var x=`${R.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),d&&R.registeredClass.pureVirtualFunctions.push(r);function k(){it(`Cannot call ${x} due to unbound types`,h)}var P=R.registeredClass.instancePrototype,$=P[r];return $===void 0||$.overloadTable===void 0&&$.className!==R.name&&$.argCount===t-2?(k.argCount=t-2,k.className=R.name,P[r]=k):(Nt(P,r,x),P[r].overloadTable[t-2]=k),hr([],h,function(Z){var re=jt(x,Z,R,l,f,y);return P[r].overloadTable===void 0?(re.argCount=t-2,P[r]=re):P[r].overloadTable[t-2]=re,[]}),[]})}function zn(){Object.assign(Gt.prototype,{get(e){return this.allocated[e]},has(e){return this.allocated[e]!==void 0},allocate(e){var r=this.freelist.pop()||this.allocated.length;return this.allocated[r]=e,r},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function Gt(){this.allocated=[void 0],this.freelist=[]}var _e=new Gt;function zt(e){e>=_e.reserved&&--_e.get(e).refcount===0&&_e.free(e)}function Kn(){for(var e=0,r=_e.reserved;r<_e.allocated.length;++r)_e.allocated[r]!==void 0&&++e;return e}function Xn(){_e.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),_e.reserved=_e.allocated.length,s.count_emval_handles=Kn}var xr={toValue:e=>(e||K("Cannot use deleted val. handle = "+e),_e.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return _e.allocate({refcount:1,value:e})}}};function Kt(e,r){r=ge(r),ke(e,{name:r,fromWireType:function(t){var n=xr.toValue(t);return zt(t),n},toWireType:function(t,n){return xr.toHandle(n)},argPackAdvance:8,readValueFromPointer:er,destructorFunction:null})}function at(e){if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e}function qn(e,r){switch(r){case 2:return function(t){return this.fromWireType(Fr[t>>2])};case 3:return function(t){return this.fromWireType(ht[t>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Xt(e,r,t){var n=Yr(t);r=ge(r),ke(e,{name:r,fromWireType:function(u){return u},toWireType:function(u,l){return l},argPackAdvance:8,readValueFromPointer:qn(r,n),destructorFunction:null})}function Yn(e,r,t){switch(r){case 0:return t?function(u){return Y[u]}:function(u){return ie[u]};case 1:return t?function(u){return we[u>>1]}:function(u){return Se[u>>1]};case 2:return t?function(u){return U[u>>2]}:function(u){return X[u>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function Jn(e,r,t,n,u){r=ge(r),u===-1&&(u=4294967295);var l=Yr(t),f=x=>x;if(n===0){var d=32-8*t;f=x=>x<<d>>>d}var y=r.includes("unsigned"),h=(x,k)=>{},R;y?R=function(x,k){return h(k,this.name),k>>>0}:R=function(x,k){return h(k,this.name),k},ke(e,{name:r,fromWireType:f,toWireType:R,argPackAdvance:8,readValueFromPointer:Yn(r,l,n!==0),destructorFunction:null})}function Zn(e,r,t){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],u=n[r];function l(f){f=f>>2;var d=X,y=d[f],h=d[f+1];return new u(d.buffer,h,y)}t=ge(t),ke(e,{name:t,fromWireType:l,argPackAdvance:8,readValueFromPointer:l},{ignoreDuplicateRegistrations:!0})}var Qn=(e,r,t)=>Kr(e,ie,r,t);function eo(e,r){r=ge(r);var t=r==="std::string";ke(e,{name:r,fromWireType:function(n){var u=X[n>>2],l=n+4,f;if(t)for(var d=l,y=0;y<=u;++y){var h=l+y;if(y==u||ie[h]==0){var R=h-d,x=St(d,R);f===void 0?f=x:(f+="\0",f+=x),d=h+1}}else{for(var k=new Array(u),y=0;y<u;++y)k[y]=String.fromCharCode(ie[l+y]);f=k.join("")}return tr(n),f},toWireType:function(n,u){u instanceof ArrayBuffer&&(u=new Uint8Array(u));var l,f=typeof u=="string";f||u instanceof Uint8Array||u instanceof Uint8ClampedArray||u instanceof Int8Array||K("Cannot pass non-string to std::string"),t&&f?l=Ze(u):l=u.length;var d=so(4+l+1),y=d+4;if(X[d>>2]=l,t&&f)Qn(u,y,l+1);else if(f)for(var h=0;h<l;++h){var R=u.charCodeAt(h);R>255&&(tr(y),K("String has UTF-16 code units that do not fit in 8 bits")),ie[y+h]=R}else for(var h=0;h<l;++h)ie[y+h]=u[h];return n!==null&&n.push(tr,d),d},argPackAdvance:8,readValueFromPointer:er,destructorFunction:function(n){tr(n)}})}var st=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0,ro=(e,r)=>{for(var t=e,n=t>>1,u=n+r/2;!(n>=u)&&Se[n];)++n;if(t=n<<1,t-e>32&&st)return st.decode(ie.subarray(e,t));for(var l="",f=0;!(f>=r/2);++f){var d=we[e+f*2>>1];if(d==0)break;l+=String.fromCharCode(d)}return l},to=(e,r,t)=>{if(t===void 0&&(t=2147483647),t<2)return 0;t-=2;for(var n=r,u=t<e.length*2?t/2:e.length,l=0;l<u;++l){var f=e.charCodeAt(l);we[r>>1]=f,r+=2}return we[r>>1]=0,r-n},po=e=>e.length*2,no=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var u=U[e+t*4>>2];if(u==0)break;if(++t,u>=65536){var l=u-65536;n+=String.fromCharCode(55296|l>>10,56320|l&1023)}else n+=String.fromCharCode(u)}return n},$e=(e,r,t)=>{if(t===void 0&&(t=2147483647),t<4)return 0;for(var n=r,u=n+t-4,l=0;l<e.length;++l){var f=e.charCodeAt(l);if(f>=55296&&f<=57343){var d=e.charCodeAt(++l);f=65536+((f&1023)<<10)|d&1023}if(U[r>>2]=f,r+=4,r+4>u)break}return U[r>>2]=0,r-n},ut=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&++t,r+=4}return r},qt=function(e,r,t){t=ge(t);var n,u,l,f,d;r===2?(n=ro,u=to,f=po,l=()=>Se,d=1):r===4&&(n=no,u=$e,f=ut,l=()=>X,d=2),ke(e,{name:t,fromWireType:function(y){for(var h=X[y>>2],R=l(),x,k=y+4,P=0;P<=h;++P){var $=y+4+P*r;if(P==h||R[$>>d]==0){var Z=$-k,re=n(k,Z);x===void 0?x=re:(x+="\0",x+=re),k=$+r}}return tr(y),x},toWireType:function(y,h){typeof h!="string"&&K(`Cannot pass non-string to C++ string type ${t}`);var R=f(h),x=so(4+R+r);return X[x>>2]=R>>d,u(h,x+4,R+r),y!==null&&y.push(tr,x),x},argPackAdvance:8,readValueFromPointer:er,destructorFunction:function(y){tr(y)}})};function oo(e,r){r=ge(r),ke(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:function(){},toWireType:function(t,n){}})}var io={};function Yt(e){var r=io[e];return r===void 0?ge(e):r}var ct=[];function Ur(e,r,t,n){e=ct[e],r=xr.toValue(r),t=Yt(t),e(r,t,null,n)}function Jt(e){var r=ct.length;return ct.push(e),r}function o(e,r){var t=Qe[e];return t===void 0&&K(r+" has unknown type "+ot(e)),t}function i(e,r){for(var t=new Array(e),n=0;n<e;++n)t[n]=o(X[r+n*4>>2],"parameter "+n);return t}var c=[];function m(e,r){var t=i(e,r),n=t[0],u=n.name+"_$"+t.slice(1).map(function($){return $.name}).join("_")+"$",l=c[u];if(l!==void 0)return l;for(var f=["retType"],d=[n],y="",h=0;h<e-1;++h)y+=(h!==0?", ":"")+"arg"+h,f.push("argType"+h),d.push(t[1+h]);for(var R=_r("methodCaller_"+u),x="return function "+R+`(handle, name, destructors, args) {
18
+ `,k=0,h=0;h<e-1;++h)x+=" var arg"+h+" = argType"+h+".readValueFromPointer(args"+(k?"+"+k:"")+`);
19
+ `,k+=t[h+1].argPackAdvance;x+=" var rv = handle[name]("+y+`);
20
+ `;for(var h=0;h<e-1;++h)t[h+1].deleteObject&&(x+=" argType"+h+".deleteObject(arg"+h+`);
21
+ `);n.isVoid||(x+=` return retType.toWireType(destructors, rv);
22
+ `),x+=`};
23
+ `,f.push(x);var P=Vt(Function,f).apply(null,d);return l=Jt(P),c[u]=l,l}function g(e,r){return r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN}var T=()=>{Fe("")};function w(){return Date.now()}var b=()=>ie.length,O=()=>b(),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 lt(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 ao=(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 Zt(e,r,t,n){try{var u=te.getStreamFromFD(e),l=ao(u,r,t);return X[n>>2]=l,0}catch(f){if(typeof a=="undefined"||f.name!=="ErrnoError")throw f;return f.errno}}function Qt(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 en=(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 ko(e,r,t,n){try{var u=te.getStreamFromFD(e),l=en(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},rn=365,tn=146;Object.defineProperties(mo.prototype,{read:{get:function(){return(this.mode&rn)===rn},set:function(e){e?this.mode|=rn:this.mode&=~rn}},write:{get:function(){return(this.mode&tn)===tn},set:function(e){e?this.mode|=tn:this.mode&=~tn}},isFolder:{get:function(){return a.isDir(this.mode)}},isDevice:{get:function(){return a.isChrdev(this.mode)}}}),a.FSNode=mo,a.createPreloadedFile=Et,a.staticInit(),mr(),cr=s.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},Pt=s.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},On(),Rn(),Mn(),Ht=s.UnboundTypeError=Bt(Error,"UnboundTypeError"),zn(),Xn();var xo={p:_t,C:qr,w:pr,t:An,n:Pn,r:Wn,q:jn,d:Gn,D:Kt,k:Xt,c:Jn,b:Zn,j:eo,f:qt,o:oo,g:Ur,m:zt,l:m,a:T,e:w,v:O,A:E,u:V,y:de,z:Ve,i:lt,x:Pe,B:Zt,s:Qt,h:ko},ai=bn(),Uo=()=>(Uo=ee.F)(),so=e=>(so=ee.G)(e),tr=e=>(tr=ee.I)(e),ho=()=>(ho=ee.J)(),vo=e=>(vo=ee.K)(e),No=s.__embind_initialize_bindings=()=>(No=s.__embind_initialize_bindings=ee.L)(),go=e=>(go=ee.M)(e),$o=s.dynCall_jiji=(e,r,t,n,u)=>($o=s.dynCall_jiji=ee.N)(e,r,t,n,u),si=s._ff_h264_cabac_tables=67061,nn;dr=function e(){nn||yo(),nn||(dr=e)};function yo(){if(Ie>0||(mn(),Ie>0))return;function e(){nn||(nn=!0,s.calledRun=!0,!Mr&&(hn(),v(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),vn()))}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}})(),Ro=Qo;var sn=class extends Ge{constructor(p){super(Ro,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 ei=(()=>{var _=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return function(p={}){var s=p,v,S;s.ready=new Promise((o,i)=>{v=o,S=i});var D=Object.assign({},s),A=[],H="./this.program",I=(o,i)=>{throw i},C=typeof window=="object",F=typeof importScripts=="function",L=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",W="";function me(o){return s.locateFile?s.locateFile(o,W):W+o}var Re,Me,q,ze;(C||F)&&(F?W=self.location.href:typeof document!="undefined"&&document.currentScript&&(W=document.currentScript.src),_&&(W=_),W.indexOf("blob:")!==0?W=W.substr(0,W.replace(/[?#].*/,"").lastIndexOf("/")+1):W="",Re=o=>{var i=new XMLHttpRequest;return i.open("GET",o,!1),i.send(null),i.responseText},F&&(q=o=>{var i=new XMLHttpRequest;return i.open("GET",o,!1),i.responseType="arraybuffer",i.send(null),new Uint8Array(i.response)}),Me=(o,i,c)=>{var m=new XMLHttpRequest;m.open("GET",o,!0),m.responseType="arraybuffer",m.onload=()=>{if(m.status==200||m.status==0&&m.response){i(m.response);return}c()},m.onerror=c,m.send(null)},ze=o=>document.title=o);var lr=s.print||console.log.bind(console),ae=s.printErr||console.error.bind(console);Object.assign(s,D),D=null,s.arguments&&(A=s.arguments),s.thisProgram&&(H=s.thisProgram),s.quit&&(I=s.quit);var he;s.wasmBinary&&(he=s.wasmBinary);var Oo=s.noExitRuntime||!0;typeof WebAssembly!="object"&&ir("no native wasm support detected");var Lr,ee,Mr=!1,fn,Ke,Y,ie,we,Se,U,X,Fr;function ht(){var o=Lr.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=Fr=new Float64Array(o)}var vt,Br=[],Hr=[],Wr=[],gt=!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(){gt=!0,Gr(Hr)}function hn(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)yn(s.postRun.shift());Gr(Wr)}function vn(o){Br.unshift(o)}function gn(o){Hr.unshift(o)}function yn(o){Wr.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),Mr=!0,fn=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 Vr(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(()=>Vr(o)):Promise.resolve().then(()=>Vr(o))}function jr(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 _n(o,i,c,m){return!o&&typeof WebAssembly.instantiateStreaming=="function"&&!Fe(i)&&typeof fetch=="function"?fetch(i,{credentials:"same-origin"}).then(g=>{var T=WebAssembly.instantiateStreaming(g,c);return T.then(m,function(w){return ae("wasm streaming compile failed: "+w),ae("falling back to ArrayBuffer instantiation"),jr(i,c,m)})}):jr(i,c,m)}function yt(){var o={a:to};function i(m,g){var T=m.exports;return ee=T,Lr=ee.v,ht(),vt=ee.z,gn(ee.w),fo("wasm-instantiate"),T}dr("wasm-instantiate");function c(m){i(m.instance)}if(s.instantiateWasm)try{return s.instantiateWasm(o,i)}catch(m){ae("Module.instantiateWasm callback failed with error: "+m),S(m)}return _n(he,ar,o,c).catch(S),{}}var Gr=o=>{for(;o.length>0;)o.shift()(s)};function bn(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=Yt(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 zr(o,i,c){var m=new bn(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 En(){for(var o=new Array(256),i=0;i<256;++i)o[i]=String.fromCharCode(i);_t=o}var _t=void 0;function ve(o){for(var i="",c=o;Y[c];)i+=_t[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(b){fr[b]=i});function m(b){var O=c(b);O.length!==o.length&&ur("Mismatched type converter count");for(var E=0;E<o.length;++E)Ae(o[E],O[E])}var g=new Array(i.length),T=[],w=0;i.forEach((b,O)=>{Ye.hasOwnProperty(b)?g[O]=Ye[b]:(T.push(b),G.hasOwnProperty(b)||(G[b]=[]),G[b].push(()=>{g[O]=Ye[b],++w,w===T.length&&m(g)}))}),T.length===0&&m(g)}function Kr(o,i,c={}){var m=i.name;if(o||z(`type "${m}" must have a positive integer typeid pointer`),Ye.hasOwnProperty(o)){if(c.ignoreDuplicateRegistrations)return;z(`Cannot register type '${m}' twice`)}if(Ye[o]=i,delete fr[o],G.hasOwnProperty(o)){var g=G[o];delete G[o],g.forEach(T=>T())}}function Ae(o,i,c={}){if(!("argPackAdvance"in i))throw new TypeError("registerType registeredInstance requires argPackAdvance");return Kr(o,i,c)}function wn(o,i,c,m,g){var T=Sr(c);i=ve(i),Ae(o,{name:i,fromWireType:function(w){return!!w},toWireType:function(w,b){return b?m:g},argPackAdvance:8,readValueFromPointer:function(w){var b;if(c===1)b=Ke;else if(c===2)b=ie;else if(c===4)b=Se;else throw new TypeError("Unknown boolean type size: "+i);return this.fromWireType(b[w>>T])},destructorFunction:null})}function Be(o){if(!(this instanceof We)||!(o instanceof We))return!1;for(var i=this.$$.ptrType.registeredClass,c=this.$$.ptr,m=o.$$.ptrType.registeredClass,g=o.$$.ptr;i.baseClass;)c=i.upcast(c),i=i.baseClass;for(;m.baseClass;)g=m.upcast(g),m=m.baseClass;return i===m&&c===g}function bt(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 Xr=!1;function Tt(o){}function Sn(o){o.smartPtr?o.smartPtrType.rawDestructor(o.smartPtr):o.ptrType.registeredClass.rawDestructor(o.ptr)}function Et(o){o.count.value-=1;var i=o.count.value===0;i&&Sn(o)}function wt(o,i,c){if(i===c)return o;if(c.baseClass===void 0)return null;var m=wt(o,i,c.baseClass);return m===null?null:c.downcast(m)}var Ar={};function a(){return Object.keys(mr).length}function St(){var o=[];for(var i in mr)mr.hasOwnProperty(i)&&o.push(mr[i]);return o}var te=[];function qr(){for(;te.length;){var o=te.pop();o.$$.deleteScheduled=!1,o.delete()}}var pr=void 0;function An(o){pr=o,te.length&&pr&&pr(qr)}function Yr(){s.getInheritedInstanceCount=a,s.getLiveInheritedInstances=St,s.flushPendingDeletes=qr,s.setDelayFunction=An}var mr={};function At(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=At(o,i),mr[i]}function Oe(o,i){(!i.ptrType||!i.ptr)&&ur("makeClassHandle requires ptr and ptrType");var c=!!i.smartPtrType,m=!!i.smartPtr;return c!==m&&ur("Both smartPtrType and smartPtr must be specified"),i.count={value:1},He(Object.create(o,{$$:{value:i}}))}function Qe(o){var i=this.getPointee(o);if(!i)return this.destructor(o),null;var c=ge(this.registeredClass,i);if(c!==void 0){if(c.$$.count.value===0)return c.$$.ptr=i,c.$$.smartPtr=o,c.clone();var m=c.clone();return this.destructor(o),m}function g(){return this.isSmartPointer?Oe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:i,smartPtrType:this,smartPtr:o}):Oe(this.registeredClass.instancePrototype,{ptrType:this,ptr:o})}var T=this.registeredClass.getActualType(i),w=Ar[T];if(!w)return g.call(this);var b;this.isConst?b=w.constPointerType:b=w.pointerType;var O=wt(i,this.registeredClass,b.registeredClass);return O===null?g.call(this):this.isSmartPointer?Oe(b.registeredClass.instancePrototype,{ptrType:b,ptr:O,smartPtrType:this,smartPtr:o}):Oe(b.registeredClass.instancePrototype,{ptrType:b,ptr:O})}var He=function(o){return typeof FinalizationRegistry=="undefined"?(He=i=>i,o):(Xr=new FinalizationRegistry(i=>{Et(i.$$)}),He=i=>{var c=i.$$,m=!!c.smartPtr;if(m){var g={$$:c};Xr.register(i,g,i)}return i},Tt=i=>Xr.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:bt(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),Et(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Pt(){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(qr),this.$$.deleteScheduled=!0,this}function hr(){We.prototype.isAliasOf=Be,We.prototype.clone=cr,We.prototype.delete=K,We.prototype.isDeleted=Pt,We.prototype.deleteLater=Pr}function We(){}var ke=48,Pn=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<=Pn?`_${o}`:o}function Jr(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 Zr(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 Ct(o,i,c,m,g,T,w,b){this.name=o,this.constructor=i,this.instancePrototype=c,this.rawDestructor=m,this.baseClass=g,this.getActualType=T,this.upcast=w,this.downcast=b,this.pureVirtualFunctions=[]}function Qr(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 Rt(o,i){if(i===null)return this.isReference&&z(`null is not a valid ${this.name}`),0;i.$$||z(`Cannot pass "${nt(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=Qr(i.$$.ptr,c,this.registeredClass);return m}function Dt(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 "${nt(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=Qr(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 "${nt(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=Qr(i.$$.ptr,c,this.registeredClass);return m}function Dr(o){return this.fromWireType(Se[o>>2])}function Cn(o){return this.rawGetPointee&&(o=this.rawGetPointee(o)),o}function vr(o){this.rawDestructor&&this.rawDestructor(o)}function et(o){o!==null&&o.delete()}function gr(){xe.prototype.getPointee=Cn,xe.prototype.destructor=vr,xe.prototype.argPackAdvance=8,xe.prototype.readValueFromPointer=Dr,xe.prototype.deleteObject=et,xe.prototype.fromWireType=Qe}function xe(o,i,c,m,g,T,w,b,O,E,B){this.name=o,this.registeredClass=i,this.isReference=c,this.isConst=m,this.isSmartPointer=g,this.pointeeType=T,this.sharingPolicy=w,this.rawGetPointee=b,this.rawConstructor=O,this.rawShare=E,this.rawDestructor=B,!g&&i.baseClass===void 0?m?(this.toWireType=Rt,this.destructorFunction=null):(this.toWireType=It,this.destructorFunction=null):this.toWireType=Dt}function Rn(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=[],Ot=o=>{var i=Ir[o];return i||(o>=Ir.length&&(Ir.length=o+1),Ir[o]=i=vt.get(o)),i},Or=(o,i,c)=>{if(o.includes("j"))return yr(o,i,c);var m=Ot(i).apply(null,c);return m},Dn=(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")?Dn(o,i):Ot(i)}var m=c();return typeof m!="function"&&z(`unknown function pointer with signature ${o}: ${i}`),m}function In(o,i){var c=Jr(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 kt=void 0;function xt(o){var i=qt(o),c=ve(i);return $e(i),c}function rt(o,i){var c=[],m={};function g(T){if(!m[T]&&!Ye[T]){if(fr[T]){fr[T].forEach(g);return}c.push(T),m[T]=!0}}throw i.forEach(g),new kt(`${o}: `+c.map(xt).join([", "]))}function On(o,i,c,m,g,T,w,b,O,E,B,V,j){B=ve(B),T=De(g,T),b&&(b=De(w,b)),E&&(E=De(O,E)),j=De(V,j);var J=Cr(B);Zr(J,function(){rt(`Cannot construct ${B} due to unbound types`,[m])}),Ze([o,i,c],m?[m]:[],function(ne){ne=ne[0];var Ee,de;m?(Ee=ne.registeredClass,de=Ee.instancePrototype):de=We.prototype;var Ve=Jr(J,function(){if(Object.getPrototypeOf(this)!==lt)throw new le("Use 'new' to construct "+B);if(Pe.constructor_body===void 0)throw new le(B+" has no accessible constructor");var en=Pe.constructor_body[arguments.length];if(en===void 0)throw new le(`Tried to invoke ctor of ${B} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(Pe.constructor_body).toString()}) parameters instead!`);return en.apply(this,arguments)}),lt=Object.create(de,{constructor:{value:Ve}});Ve.prototype=lt;var Pe=new Ct(B,Ve,lt,j,Ee,T,b,E);Pe.baseClass&&(Pe.baseClass.__derivedClasses===void 0&&(Pe.baseClass.__derivedClasses=[]),Pe.baseClass.__derivedClasses.push(Pe));var ao=new xe(B,Pe,!0,!1,!1),Zt=new xe(B+"*",Pe,!1,!1,!1),Qt=new xe(B+" const*",Pe,!1,!0,!1);return Ar[o]={pointerType:Zt,constPointerType:Qt},Rn(J,Ve),[ao,Zt,Qt]})}function Ue(o,i){for(var c=[],m=0;m<o;m++)c.push(U[i+m*4>>2]);return c}function kn(o){for(;o.length;){var i=o.pop(),c=o.pop();c(i)}}function Ut(o,i){if(!(o instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof o} which is not a function`);var c=Jr(o.name||"unknownFunctionName",function(){});c.prototype=o.prototype;var m=new c,g=o.apply(m,i);return g instanceof Object?g:m}function _r(o,i,c,m,g,T){var w=i.length;w<2&&z("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var b=i[1]!==null&&c!==null,O=!1,E=1;E<i.length;++E)if(i[E]!==null&&i[E].destructorFunction===void 0){O=!0;break}for(var B=i[0].name!=="void",V="",j="",E=0;E<w-2;++E)V+=(E!==0?", ":"")+"arg"+E,j+=(E!==0?", ":"")+"arg"+E+"Wired";var J=`
25
+ return function ${Cr(o)}(${V}) {
26
+ if (arguments.length !== ${w-2}) {
27
+ throwBindingError('function ${o} called with ${arguments.length} arguments, expected ${w-2} args!');
28
+ }`;O&&(J+=`var destructors = [];
29
+ `);var ne=O?"destructors":"null",Ee=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],de=[z,m,g,kn,i[0],i[1]];b&&(J+="var thisWired = classParam.toWireType("+ne+`, this);
30
+ `);for(var E=0;E<w-2;++E)J+="var arg"+E+"Wired = argType"+E+".toWireType("+ne+", arg"+E+"); // "+i[E+2].name+`
31
+ `,Ee.push("argType"+E),de.push(i[E+2]);if(b&&(j="thisWired"+(j.length>0?", ":"")+j),J+=(B||T?"var rv = ":"")+"invoker(fn"+(j.length>0?", ":"")+j+`);
32
+ `,O)J+=`runDestructors(destructors);
33
+ `;else for(var E=b?1:2;E<i.length;++E){var Ve=E===1?"thisWired":"arg"+(E-2)+"Wired";i[E].destructorFunction!==null&&(J+=Ve+"_dtor("+Ve+"); // "+i[E].name+`
34
+ `,Ee.push(Ve+"_dtor"),de.push(i[E].destructorFunction))}return B&&(J+=`var ret = retType.fromWireType(rv);
35
+ return ret;
36
+ `),J+=`}
37
+ `,Ee.push(J),Ut(Function,Ee).apply(null,de)}function tt(o,i,c,m,g,T){var w=Ue(i,c);g=De(m,g),Ze([],[o],function(b){b=b[0];var O=`constructor ${b.name}`;if(b.registeredClass.constructor_body===void 0&&(b.registeredClass.constructor_body=[]),b.registeredClass.constructor_body[i-1]!==void 0)throw new le(`Cannot register multiple constructors with identical number of parameters (${i-1}) for class '${b.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return b.registeredClass.constructor_body[i-1]=()=>{rt(`Cannot construct ${b.name} due to unbound types`,w)},Ze([],w,function(E){return E.splice(1,0,null),b.registeredClass.constructor_body[i-1]=_r(O,E,null,g,T),[]}),[]})}function Nt(o,i,c,m,g,T,w,b,O){var E=Ue(c,m);i=ve(i),T=De(g,T),Ze([],[o],function(B){B=B[0];var V=`${B.name}.${i}`;i.startsWith("@@")&&(i=Symbol[i.substring(2)]),b&&B.registeredClass.pureVirtualFunctions.push(i);function j(){rt(`Cannot call ${V} due to unbound types`,E)}var J=B.registeredClass.instancePrototype,ne=J[i];return ne===void 0||ne.overloadTable===void 0&&ne.className!==B.name&&ne.argCount===c-2?(j.argCount=c-2,j.className=B.name,J[i]=j):(Rr(J,i,V),J[i].overloadTable[c-2]=j),Ze([],E,function(Ee){var de=_r(V,Ee,B,T,w,O);return J[i].overloadTable===void 0?(de.argCount=c-2,J[i]=de):J[i].overloadTable[c-2]=de,[]}),[]})}function xn(){Object.assign($t.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 $t(){this.allocated=[void 0],this.freelist=[]}var ye=new $t;function Lt(o){o>=ye.reserved&&--ye.get(o).refcount===0&&ye.free(o)}function Un(){for(var o=0,i=ye.reserved;i<ye.allocated.length;++i)ye.allocated[i]!==void 0&&++o;return o}function Nn(){ye.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),ye.reserved=ye.allocated.length,s.count_emval_handles=Un}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 $n(o,i){i=ve(i),Ae(o,{name:i,fromWireType:function(c){var m=er.toValue(c);return Lt(c),m},toWireType:function(c,m){return er.toHandle(m)},argPackAdvance:8,readValueFromPointer:Dr,destructorFunction:null})}function nt(o){if(o===null)return"null";var i=typeof o;return i==="object"||i==="array"||i==="function"?o.toString():""+o}function Ln(o,i){switch(i){case 2:return function(c){return this.fromWireType(X[c>>2])};case 3:return function(c){return this.fromWireType(Fr[c>>3])};default:throw new TypeError("Unknown float type: "+o)}}function Mn(o,i,c){var m=Sr(c);i=ve(i),Ae(o,{name:i,fromWireType:function(g){return g},toWireType:function(g,T){return T},argPackAdvance:8,readValueFromPointer:Ln(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 Fn(o,i,c,m,g){i=ve(i),g===-1&&(g=4294967295);var T=Sr(c),w=V=>V;if(m===0){var b=32-8*c;w=V=>V<<b>>>b}var O=i.includes("unsigned"),E=(V,j)=>{},B;O?B=function(V,j){return E(j,this.name),j>>>0}:B=function(V,j){return E(j,this.name),j},Ae(o,{name:i,fromWireType:w,toWireType:B,argPackAdvance:8,readValueFromPointer:Ne(i,T,m!==0),destructorFunction:null})}function Bn(o,i,c){var m=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],g=m[i];function T(w){w=w>>2;var b=U,O=b[w],E=b[w+1];return new g(b.buffer,E,O)}c=ve(c),Ae(o,{name:c,fromWireType:T,argPackAdvance:8,readValueFromPointer:T},{ignoreDuplicateRegistrations:!0})}var kr=(o,i,c,m)=>{if(!(m>0))return 0;for(var g=c,T=c+m-1,w=0;w<o.length;++w){var b=o.charCodeAt(w);if(b>=55296&&b<=57343){var O=o.charCodeAt(++w);b=65536+((b&1023)<<10)|O&1023}if(b<=127){if(c>=T)break;i[c++]=b}else if(b<=2047){if(c+1>=T)break;i[c++]=192|b>>6,i[c++]=128|b&63}else if(b<=65535){if(c+2>=T)break;i[c++]=224|b>>12,i[c++]=128|b>>6&63,i[c++]=128|b&63}else{if(c+3>=T)break;i[c++]=240|b>>18,i[c++]=128|b>>12&63,i[c++]=128|b>>6&63,i[c++]=128|b&63}}return i[c]=0,c-g},Mt=(o,i,c)=>kr(o,Y,i,c),Hn=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},Ft=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&&Ft)return Ft.decode(o.subarray(i,g));for(var T="";i<g;){var w=o[i++];if(!(w&128)){T+=String.fromCharCode(w);continue}var b=o[i++]&63;if((w&224)==192){T+=String.fromCharCode((w&31)<<6|b);continue}var O=o[i++]&63;if((w&240)==224?w=(w&15)<<12|b<<6|O:w=(w&7)<<18|b<<12|O<<6|o[i++]&63,w<65536)T+=String.fromCharCode(w);else{var E=w-65536;T+=String.fromCharCode(55296|E>>10,56320|E&1023)}}return T},Bt=(o,i)=>o?rr(Y,o,i):"";function Ht(o,i){i=ve(i);var c=i==="std::string";Ae(o,{name:i,fromWireType:function(m){var g=U[m>>2],T=m+4,w;if(c)for(var b=T,O=0;O<=g;++O){var E=T+O;if(O==g||Y[E]==0){var B=E-b,V=Bt(b,B);w===void 0?w=V:(w+="\0",w+=V),b=E+1}}else{for(var j=new Array(g),O=0;O<g;++O)j[O]=String.fromCharCode(Y[T+O]);w=j.join("")}return $e(m),w},toWireType:function(m,g){g instanceof ArrayBuffer&&(g=new Uint8Array(g));var T,w=typeof g=="string";w||g instanceof Uint8Array||g instanceof Uint8ClampedArray||g instanceof Int8Array||z("Cannot pass non-string to std::string"),c&&w?T=Hn(g):T=g.length;var b=ut(4+T+1),O=b+4;if(U[b>>2]=T,c&&w)Mt(g,O,T+1);else if(w)for(var E=0;E<T;++E){var B=g.charCodeAt(E);B>255&&($e(O),z("String has UTF-16 code units that do not fit in 8 bits")),Y[O+E]=B}else for(var E=0;E<T;++E)Y[O+E]=g[E];return m!==null&&m.push($e,b),b},argPackAdvance:8,readValueFromPointer:Dr,destructorFunction:function(m){$e(m)}})}var ot=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0,it=(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&&ot)return ot.decode(Y.subarray(o,c));for(var T="",w=0;!(w>=i/2);++w){var b=ie[o+w*2>>1];if(b==0)break;T+=String.fromCharCode(b)}return T},Wn=(o,i,c)=>{if(c===void 0&&(c=2147483647),c<2)return 0;c-=2;for(var m=i,g=c<o.length*2?c/2:o.length,T=0;T<g;++T){var w=o.charCodeAt(T);ie[i>>1]=w,i+=2}return ie[i>>1]=0,i-m},Wt=o=>o.length*2,Vn=(o,i)=>{for(var c=0,m="";!(c>=i/4);){var g=Se[o+c*4>>2];if(g==0)break;if(++c,g>=65536){var T=g-65536;m+=String.fromCharCode(55296|T>>10,56320|T&1023)}else m+=String.fromCharCode(g)}return m},Vt=(o,i,c)=>{if(c===void 0&&(c=2147483647),c<4)return 0;for(var m=i,g=m+c-4,T=0;T<o.length;++T){var w=o.charCodeAt(T);if(w>=55296&&w<=57343){var b=o.charCodeAt(++T);w=65536+((w&1023)<<10)|b&1023}if(Se[i>>2]=w,i+=4,i+4>g)break}return Se[i>>2]=0,i-m},jt=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},jn=function(o,i,c){c=ve(c);var m,g,T,w,b;i===2?(m=it,g=Wn,w=Wt,T=()=>we,b=1):i===4&&(m=Vn,g=Vt,w=jt,T=()=>U,b=2),Ae(o,{name:c,fromWireType:function(O){for(var E=U[O>>2],B=T(),V,j=O+4,J=0;J<=E;++J){var ne=O+4+J*i;if(J==E||B[ne>>b]==0){var Ee=ne-j,de=m(j,Ee);V===void 0?V=de:(V+="\0",V+=de),j=ne+i}}return $e(O),V},toWireType:function(O,E){typeof E!="string"&&z(`Cannot pass non-string to C++ string type ${c}`);var B=w(E),V=ut(4+B+i);return U[V>>2]=B>>b,g(E,V+4,B+i),O!==null&&O.push($e,V),V},argPackAdvance:8,readValueFromPointer:Dr,destructorFunction:function(O){$e(O)}})};function Gn(o,i){i=ve(i),Ae(o,{isVoid:!0,name:i,argPackAdvance:0,fromWireType:function(){},toWireType:function(c,m){}})}var zn={};function Gt(o){var i=zn[o];return i===void 0?ve(o):i}var _e=[];function zt(o,i,c,m){o=_e[o],i=er.toValue(i),c=Gt(c),o(i,c,null,m)}function Kn(o){var i=_e.length;return _e.push(o),i}function Xn(o,i){var c=Ye[o];return c===void 0&&z(i+" has unknown type "+xt(o)),c}function xr(o,i){for(var c=new Array(o),m=0;m<o;++m)c[m]=Xn(U[i+m*4>>2],"parameter "+m);return c}var Kt=[];function at(o,i){var c=xr(o,i),m=c[0],g=m.name+"_$"+c.slice(1).map(function(ne){return ne.name}).join("_")+"$",T=Kt[g];if(T!==void 0)return T;for(var w=["retType"],b=[m],O="",E=0;E<o-1;++E)O+=(E!==0?", ":"")+"arg"+E,w.push("argType"+E),b.push(c[1+E]);for(var B=Cr("methodCaller_"+g),V="return function "+B+`(handle, name, destructors, args) {
38
+ `,j=0,E=0;E<o-1;++E)V+=" var arg"+E+" = argType"+E+".readValueFromPointer(args"+(j?"+"+j:"")+`);
39
+ `,j+=c[E+1].argPackAdvance;V+=" var rv = handle[name]("+O+`);
40
+ `;for(var E=0;E<o-1;++E)c[E+1].deleteObject&&(V+=" argType"+E+".deleteObject(arg"+E+`);
41
+ `);m.isVoid||(V+=` return retType.toWireType(destructors, rv);
42
+ `),V+=`};
43
+ `,w.push(V);var J=Ut(Function,w).apply(null,b);return T=Kn(J),Kt[g]=T,T}var qn=()=>{ir("")},Xt;Xt=()=>performance.now();var Yn=(o,i,c)=>Y.copyWithin(o,i,i+c),Jn=o=>{ir("OOM")},Zn=o=>{var i=Y.length;o>>>=0,Jn(o)},Qn=[null,[],[]],eo=(o,i)=>{var c=Qn[o];i===0||i===10?((o===1?lr:ae)(rr(c,0)),c.length=0):c.push(i)},st={varargs:void 0,get(){st.varargs+=4;var o=Se[st.varargs-4>>2];return o},getStr(o){var i=Bt(o);return i}},ro=(o,i,c,m)=>{for(var g=0,T=0;T<c;T++){var w=U[i>>2],b=U[i+4>>2];i+=8;for(var O=0;O<b;O++)eo(o,Y[w+O]);g+=b}return U[m>>2]=g,0};En(),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(),Yr(),gr(),kt=s.UnboundTypeError=In(Error,"UnboundTypeError"),xn(),Nn();var to={o:zr,r:Tn,m:wn,q:On,p:tt,d:Nt,u:$n,k:Mn,b:Fn,a:Bn,j:Ht,g:jn,n:Gn,e:zt,l:Lt,h:at,f:qn,c:Xt,t:Yn,s:Zn,i:ro},po=yt(),no=()=>(no=ee.w)(),$e=o=>($e=ee.x)(o),ut=o=>(ut=ee.y)(o),qt=o=>(qt=ee.A)(o),oo=s.__embind_initialize_bindings=()=>(oo=s.__embind_initialize_bindings=ee.B)(),io=()=>(io=ee.__errno_location)(),Yt=o=>(Yt=ee.C)(o),ct=s.dynCall_jiji=(o,i,c,m,g)=>(ct=s.dynCall_jiji=ee.D)(o,i,c,m,g),Ur;qe=function o(){Ur||Jt(),Ur||(qe=o)};function Jt(){if(Xe>0||(pn(),Xe>0))return;function o(){Ur||(Ur=!0,s.calledRun=!0,!Mr&&(mn(),v(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),hn()))}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 Jt(),p.ready}})(),Do=ei;var un=class extends Ge{constructor(p){super(Do,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 ri="web.sdk.qcloud.com";var ti=`https://${ri}/trtc/webrtc/v5/doc`;var Wi=`${ti}/zh-cn/`;var Io=(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))(Io||{});var Vi=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 ji=cn.MAIN,Gi=cn.AUXILIARY;var zi=cn.BIG,Ki=cn.SMALL,Xi=10*1e3;var qi=Object.keys(Io);var Yi=10*1e3;var va=typeof window!="undefined"&&typeof window.glog=="function"?window.glog:()=>{};function lo(){return!performance||!performance.now?Date.now():Math.floor(performance.now())}var{toString:ga}=Object.prototype;var dn=class dn{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 dn.Name}getValidateRule(p){return{type:this.core.enums.BASIC_TYPE.Object}}createDecoder(p,s){switch(p){case"wasm":return this.core.rtcDectection.isSIMDSupported()?new un(Er(Tr({},s),{wasmPath:`${this.core.assetsPath}videodec_simd.wasm`})):new sn(Er(Tr({},s),{wasmPath:`${this.core.assetsPath}videodec.wasm`}));case"webCodecs":return new or;case"mse":throw new Error("mse decoder not supported yet");default:throw new Error("Unsupported decoder type")}}start(p){this.decodeProcessorMap.set(p.track,this.decode(p)),this.core.room.videoManager.addDecodeProcessor({processor:({frame:s,track:v})=>{var S;return((S=this.decodeProcessorMap.get(v))==null?void 0:S({frame:s,track:v}))||s},type:3})}decode(p){let{pipe:s,take:v,subscribe:S}=this.core.rx;return({frame:D,track:A})=>{if(A!==p.track||D.type==="empty")return D;if(this.contextMap.has(A))return this.contextMap.get(A).decode(D);let H=this.core.room.videoManager.createDecodeContext(Er(Tr({},p),{createDecoder:this.createDecoder}));return s(H.trackDoneOB,v(1),S(()=>{this.core.clearStarted(this,this.getGroup(p)),this.stop({track:A})})),this.contextMap.set(A,H),H.decode(D)}}stop(p){if(!(p!=null&&p.track))this.contextMap.forEach((s,v)=>{s.close("stop"),this.contextMap.delete(v)});else{let s=this.contextMap.get(p.track);s&&(s.close("stop"),this.report(s,p.track),this.contextMap.delete(p.track))}this.contextMap.size===0&&this.core.room.videoManager.removeDecodeProcessor({type:3})}report(p,s){if(p.isReported)return;p.isReported=!0;let v=lo()-p.startPerformanceTime,{renderFreezeTotal:S,dataFreezeTotal:D}=this.getRemoteTrackFreezeDuration(s,p);v&&this.core.kvStatManager.addNumber({key:514850,value:Math.floor(S/v*100),split:1}),v&&this.core.kvStatManager.addNumber({key:514851,value:Math.floor(D/v*100),split:1}),p.inputFrameCount&&this.core.kvStatManager.addNumber({key:514852,value:Math.floor(p.decodedFrameCount/p.inputFrameCount*100),split:1})}addKVReportBeforeExitRoom({room:p}){p===this.core.room&&this.contextMap.forEach((s,v)=>{this.report(s,v)})}update(p){let s=this.contextMap.get(p.track);if(s){if(p.type==="mock"){s.mock(this.core.enums.DECODE_FAILED_ERROR_CODE.TEST);return}s.close("update"),this.contextMap.set(p.track,this.core.room.videoManager.createDecodeContext(Er(Tr({},p),{createDecoder:this.createDecoder})))}}getRemoteTrackFreezeDuration(p,s){let v=this.core.room.badCaseDetector.getRenderFreezeMap().get(`${p.userId}_${p.streamType}`),S=this.core.room.badCaseDetector.getDataFreezeMap().get(`${p.userId}_${p.streamType}`),D=0;v&&v.freezeTimeline.forEach(({startTime:H,endTime:I})=>{H>s.startPerformanceTime&&(D+=I===0?lo()-H:I-H)});let A=0;return S&&S.durationItemList.forEach(H=>{H.startTime>s.startPerformanceTime&&(A+=H.getDuration())}),{renderFreezeTotal:D,dataFreezeTotal:A}}destroy(){this.core.innerEmitter.off("51",this.addKVReportBeforeExitRoom)}};fe(dn,"Name","TRTCVideoDecoder");var ln=dn;var oi=ln;return zo(ii);})().default;