@keeratita/heic-converter 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +160 -14
- package/dist/heic-decoder.wasm +0 -0
- package/dist/index.d.mts +136 -8
- package/dist/index.d.ts +136 -8
- package/dist/index.js +6 -6
- package/dist/index.mjs +6 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;var Ea=(()=>{var S=(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href));return(async function(P={}){var f=P,_,O;f.ready=new Promise((e,r)=>{_=e,O=r;});var z=Object.assign({},f),N="./this.program",fe=typeof window=="object",V=typeof importScripts=="function",K=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",L="";function Ne(e){return f.locateFile?f.locateFile(e,L):L+e}var me,Ve,De;if(K){let{createRequire:e}=await import('module');var Fe=e((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))),Ye=Fe("fs"),qe=Fe("path");V?L=qe.dirname(L)+"/":L=Fe("url").fileURLToPath(new URL("./",(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)))),me=(r,t)=>(r=Cr(r)?new URL(r):qe.normalize(r),Ye.readFileSync(r,t?void 0:"utf8")),De=r=>{var t=me(r,true);return t.buffer||(t=new Uint8Array(t)),t},Ve=(r,t,n,o=true)=>{r=Cr(r)?new URL(r):qe.normalize(r),Ye.readFile(r,o?void 0:"utf8",(i,s)=>{i?n(i):t(o?s.buffer:s);});},!f.thisProgram&&process.argv.length>1&&(N=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2);}else (fe||V)&&(V?L=self.location.href:typeof document<"u"&&document.currentScript&&(L=document.currentScript.src),S&&(L=S),L.startsWith("blob:")?L="":L=L.substr(0,L.replace(/[?#].*/,"").lastIndexOf("/")+1),me=e=>{var r=new XMLHttpRequest;return r.open("GET",e,false),r.send(null),r.responseText},V&&(De=e=>{var r=new XMLHttpRequest;return r.open("GET",e,false),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Ve=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,true),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);});var Xe=f.print||console.log.bind(console),re=f.printErr||console.error.bind(console);Object.assign(f,z),z=null,f.arguments&&(f.arguments),f.thisProgram&&(N=f.thisProgram),f.quit&&(f.quit);var pe;f.wasmBinary&&(pe=f.wasmBinary);var Se,gr=false,I,x,de,ye,E,$,wr,_r;function Er(){var e=Se.buffer;f.HEAP8=I=new Int8Array(e),f.HEAP16=de=new Int16Array(e),f.HEAPU8=x=new Uint8Array(e),f.HEAPU16=ye=new Uint16Array(e),f.HEAP32=E=new Int32Array(e),f.HEAPU32=$=new Uint32Array(e),f.HEAPF32=wr=new Float32Array(e),f.HEAPF64=_r=new Float64Array(e);}var br=[],$r=[],kr=[];function at(){if(f.preRun)for(typeof f.preRun=="function"&&(f.preRun=[f.preRun]);f.preRun.length;)st(f.preRun.shift());Je(br);}function ot(){!f.noFSInit&&!a.init.initialized&&a.init(),a.ignorePermissions=false,Je($r);}function it(){if(f.postRun)for(typeof f.postRun=="function"&&(f.postRun=[f.postRun]);f.postRun.length;)ut(f.postRun.shift());Je(kr);}function st(e){br.unshift(e);}function lt(e){$r.unshift(e);}function ut(e){kr.unshift(e);}var ae=0,ge=null;function Ke(e){ae++,f.monitorRunDependencies?.(ae);}function Ae(e){if(ae--,f.monitorRunDependencies?.(ae),ae==0&&(ge)){var r=ge;ge=null,r();}}function we(e){f.onAbort?.(e),e="Aborted("+e+")",re(e),gr=true,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw O(r),r}var ft="data:application/octet-stream;base64,",Pr=e=>e.startsWith(ft),Cr=e=>e.startsWith("file://"),oe;f.locateFile?(oe="heic-decoder.wasm",Pr(oe)||(oe=Ne(oe))):oe=new URL("heic-decoder.wasm",(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))).href;function Tr(e){if(e==oe&&pe)return new Uint8Array(pe);if(De)return De(e);throw "both async and sync fetching of the wasm failed"}function dt(e){return !pe&&(fe||V)&&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(()=>Tr(e)):Promise.resolve().then(()=>Tr(e))}function Dr(e,r,t){return dt(e).then(n=>WebAssembly.instantiate(n,r)).then(t,n=>{re(`failed to asynchronously prepare wasm: ${n}`),we(n);})}function ct(e,r,t,n){return !e&&typeof WebAssembly.instantiateStreaming=="function"&&!Pr(r)&&!K&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(o=>{var i=WebAssembly.instantiateStreaming(o,t);return i.then(n,function(s){return re(`wasm streaming compile failed: ${s}`),re("falling back to ArrayBuffer instantiation"),Dr(r,t,n)})}):Dr(r,t,n)}function vt(){var e={a:ca};function r(n,o){return B=n.exports,Se=B.Q,Er(),xr=B.T,lt(B.R),Ae(),B}Ke();function t(n){r(n.instance);}if(f.instantiateWasm)try{return f.instantiateWasm(e,r)}catch(n){re(`Module.instantiateWasm callback failed with error: ${n}`),O(n);}return ct(pe,oe,e,t).catch(O),{}}var b,j,Je=e=>{for(;e.length>0;)e.shift()(f);};f.noExitRuntime||true;var Fr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,ce=(e,r,t)=>{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&Fr)return Fr.decode(e.subarray(r,o));for(var i="";r<o;){var s=e[r++];if(!(s&128)){i+=String.fromCharCode(s);continue}var l=e[r++]&63;if((s&224)==192){i+=String.fromCharCode((s&31)<<6|l);continue}var u=e[r++]&63;if((s&240)==224?s=(s&15)<<12|l<<6|u:s=(s&7)<<18|l<<12|u<<6|e[r++]&63,s<65536)i+=String.fromCharCode(s);else {var d=s-65536;i+=String.fromCharCode(55296|d>>10,56320|d&1023);}}return i},ie=(e,r)=>e?ce(x,e,r):"",ht=(e,r,t,n)=>{we(`Assertion failed: ${ie(e)}, at: `+[r?ie(r):"unknown filename",t,n?ie(n):"unknown function"]);};class mt{constructor(r){this.excPtr=r,this.ptr=r-24;}set_type(r){$[this.ptr+4>>2]=r;}get_type(){return $[this.ptr+4>>2]}set_destructor(r){$[this.ptr+8>>2]=r;}get_destructor(){return $[this.ptr+8>>2]}set_caught(r){r=r?1:0,I[this.ptr+12]=r;}get_caught(){return I[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,I[this.ptr+13]=r;}get_rethrown(){return I[this.ptr+13]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t);}set_adjusted_ptr(r){$[this.ptr+16>>2]=r;}get_adjusted_ptr(){return $[this.ptr+16>>2]}get_exception_ptr(){var r=Jr(this.get_type());if(r)return $[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var Sr=0,yt=(e,r,t)=>{var n=new mt(e);throw n.init(r,t),Sr=e,Sr},Re={},Qe=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r);}};function _e(e){return this.fromWireType($[e>>2])}var ve={},se={},Me={},Ar,Oe=e=>{throw new Ar(e)},le=(e,r,t)=>{e.forEach(function(l){Me[l]=r;});function n(l){var u=t(l);u.length!==e.length&&Oe("Mismatched type converter count");for(var d=0;d<e.length;++d)q(e[d],u[d]);}var o=new Array(r.length),i=[],s=0;r.forEach((l,u)=>{se.hasOwnProperty(l)?o[u]=se[l]:(i.push(l),ve.hasOwnProperty(l)||(ve[l]=[]),ve[l].push(()=>{o[u]=se[l],++s,s===i.length&&n(o);}));}),i.length===0&&n(o);},gt=e=>{var r=Re[e];delete Re[e];var t=r.rawConstructor,n=r.rawDestructor,o=r.fields,i=o.map(s=>s.getterReturnType).concat(o.map(s=>s.setterArgumentType));le([e],i,s=>{var l={};return o.forEach((u,d)=>{var v=u.fieldName,y=s[d],p=u.getter,h=u.getterContext,g=s[d+o.length],D=u.setter,A=u.setterContext;l[v]={read:T=>y.fromWireType(p(h,T)),write:(T,c)=>{var m=[];D(A,T,g.toWireType(m,c)),Qe(m);}};}),[{name:r.name,fromWireType:u=>{var d={};for(var v in l)d[v]=l[v].read(u);return n(u),d},toWireType:(u,d)=>{for(var v in l)if(!(v in d))throw new TypeError(`Missing field: "${v}"`);var y=t();for(v in l)l[v].write(y,d[v]);return u!==null&&u.push(n,y),y},argPackAdvance:X,readValueFromPointer:_e,destructorFunction:n}]});},wt=(e,r,t,n,o)=>{},_t=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);Rr=e;},Rr,U=e=>{for(var r="",t=e;x[t];)r+=Rr[x[t++]];return r},he,C=e=>{throw new he(e)};function Et(e,r,t={}){var n=r.name;if(e||C(`type "${n}" must have a positive integer typeid pointer`),se.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;C(`Cannot register type '${n}' twice`);}if(se[e]=r,delete Me[e],ve.hasOwnProperty(e)){var o=ve[e];delete ve[e],o.forEach(i=>i());}}function q(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return Et(e,r,t)}var X=8,bt=(e,r,t,n)=>{r=U(r),q(e,{name:r,fromWireType:function(o){return !!o},toWireType:function(o,i){return i?t:n},argPackAdvance:X,readValueFromPointer:function(o){return this.fromWireType(x[o])},destructorFunction:null});},$t=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Ze=e=>{function r(t){return t.$$.ptrType.registeredClass.name}C(r(e)+" instance already deleted");},er=false,Mr=e=>{},kt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr);},Or=e=>{e.count.value-=1;var r=e.count.value===0;r&&kt(e);},jr=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=jr(e,r,t.baseClass);return n===null?null:t.downcast(n)},Ir={},Pt=()=>Object.keys($e).length,Ct=()=>{var e=[];for(var r in $e)$e.hasOwnProperty(r)&&e.push($e[r]);return e},Ee=[],rr=()=>{for(;Ee.length;){var e=Ee.pop();e.$$.deleteScheduled=false,e.delete();}},be,Tt=e=>{be=e,Ee.length&&be&&be(rr);},Dt=()=>{f.getInheritedInstanceCount=Pt,f.getLiveInheritedInstances=Ct,f.flushPendingDeletes=rr,f.setDelayFunction=Tt;},$e={},Ft=(e,r)=>{for(r===void 0&&C("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},St=(e,r)=>(r=Ft(e,r),$e[r]),je=(e,r)=>{(!r.ptrType||!r.ptr)&&Oe("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Oe("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ke(Object.create(e,{$$:{value:r,writable:true}}))};function At(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=St(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?je(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):je(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i=this.registeredClass.getActualType(r),s=Ir[i];if(!s)return o.call(this);var l;this.isConst?l=s.constPointerType:l=s.pointerType;var u=jr(r,this.registeredClass,l.registeredClass);return u===null?o.call(this):this.isSmartPointer?je(l.registeredClass.instancePrototype,{ptrType:l,ptr:u,smartPtrType:this,smartPtr:e}):je(l.registeredClass.instancePrototype,{ptrType:l,ptr:u})}var ke=e=>typeof FinalizationRegistry>"u"?(ke=r=>r,e):(er=new FinalizationRegistry(r=>{Or(r.$$);}),ke=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var o={$$:t};er.register(r,o,r);}return r},Mr=r=>er.unregister(r),ke(e)),Rt=()=>{Object.assign(Ie.prototype,{isAliasOf(e){if(!(this instanceof Ie)||!(e instanceof Ie))return false;var r=this.$$.ptrType.registeredClass,t=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,o=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return r===n&&t===o},clone(){if(this.$$.ptr||Ze(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=ke(Object.create(Object.getPrototypeOf(this),{$$:{value:$t(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=false,e},delete(){this.$$.ptr||Ze(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&C("Object already scheduled for deletion"),Mr(this),Or(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0);},isDeleted(){return !this.$$.ptr},deleteLater(){return this.$$.ptr||Ze(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&C("Object already scheduled for deletion"),Ee.push(this),Ee.length===1&&be&&be(rr),this.$$.deleteScheduled=true,this}});};function Ie(){}var Pe=(e,r)=>Object.defineProperty(r,"name",{value:e}),Ur=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...o){return e[r].overloadTable.hasOwnProperty(o.length)||C(`Function '${t}' called with an invalid number of arguments (${o.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[o.length].apply(this,o)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n;}},tr=(e,r,t)=>{f.hasOwnProperty(e)?((t===void 0||f[e].overloadTable!==void 0&&f[e].overloadTable[t]!==void 0)&&C(`Cannot register public name '${e}' twice`),Ur(f,e,e),f.hasOwnProperty(t)&&C(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),f[e].overloadTable[t]=r):(f[e]=r,t!==void 0&&(f[e].numArguments=t));},Mt=48,Ot=57,jt=e=>{if(e===void 0)return "_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Mt&&r<=Ot?`_${e}`:e};function It(e,r,t,n,o,i,s,l){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=s,this.downcast=l,this.pureVirtualFunctions=[];}var nr=(e,r,t)=>{for(;r!==t;)r.upcast||C(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function Ut(e,r){if(r===null)return this.isReference&&C(`null is not a valid ${this.name}`),0;r.$$||C(`Cannot pass "${ur(r)}" as a ${this.name}`),r.$$.ptr||C(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=nr(r.$$.ptr,t,this.registeredClass);return n}function Bt(e,r){var t;if(r===null)return this.isReference&&C(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&C(`Cannot pass "${ur(r)}" as a ${this.name}`),r.$$.ptr||C(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&C(`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=nr(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&C("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:C(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else {var o=r.clone();t=this.rawShare(t,W.toHandle(()=>o.delete())),e!==null&&e.push(this.rawDestructor,t);}break;default:C("Unsupporting sharing policy");}return t}function xt(e,r){if(r===null)return this.isReference&&C(`null is not a valid ${this.name}`),0;r.$$||C(`Cannot pass "${ur(r)}" as a ${this.name}`),r.$$.ptr||C(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&C(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=nr(r.$$.ptr,t,this.registeredClass);return n}var Wt=()=>{Object.assign(Ue.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e);},argPackAdvance:X,readValueFromPointer:_e,fromWireType:At});};function Ue(e,r,t,n,o,i,s,l,u,d,v){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=s,this.rawGetPointee=l,this.rawConstructor=u,this.rawShare=d,this.rawDestructor=v,!o&&r.baseClass===void 0?n?(this.toWireType=Ut,this.destructorFunction=null):(this.toWireType=xt,this.destructorFunction=null):this.toWireType=Bt;}var Br=(e,r,t)=>{f.hasOwnProperty(e)||Oe("Replacing nonexistent public symbol"),f[e].overloadTable!==void 0&&t!==void 0?f[e].overloadTable[t]=r:(f[e]=r,f[e].argCount=t);},Ht=(e,r,t)=>{var n=f["dynCall_"+e];return n(r,...t)},Be=[],xr,Wr=e=>{var r=Be[e];return r||(e>=Be.length&&(Be.length=e+1),Be[e]=r=xr.get(e)),r},Lt=(e,r,t=[])=>{if(e.includes("j"))return Ht(e,r,t);var n=Wr(r)(...t);return n},zt=(e,r)=>(...t)=>Lt(e,r,t),Y=(e,r)=>{e=U(e);function t(){return e.includes("j")?zt(e,r):Wr(r)}var n=t();return typeof n!="function"&&C(`unknown function pointer with signature ${e}: ${r}`),n},Nt=(e,r)=>{var t=Pe(r,function(n){this.name=r,this.message=n;var o=new Error(n).stack;o!==void 0&&(this.stack=this.toString()+`
|
|
2
|
-
`+o.replace(/^Error(:[^\n]*)?\n/,""));});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t},Hr,Lr=e=>{var r=Kr(e),t=U(r);return Z(r),t},xe=(e,r)=>{var t=[],n={};function o(i){if(!n[i]&&!se[i]){if(Me[i]){Me[i].forEach(o);return}t.push(i),n[i]=true;}}throw r.forEach(o),new Hr(`${e}: `+t.map(Lr).join([", "]))},Vt=(e,r,t,n,o,i,s,l,u,d,v,y,p)=>{v=U(v),i=Y(o,i),l&&=Y(s,l),d&&=Y(u,d),p=Y(y,p);var h=jt(v);tr(h,function(){xe(`Cannot construct ${v} due to unbound types`,[n]);}),le([e,r,t],n?[n]:[],g=>{g=g[0];var D,A;n?(D=g.registeredClass,A=D.instancePrototype):A=Ie.prototype;var T=Pe(v,function(...R){if(Object.getPrototypeOf(this)!==c)throw new he("Use 'new' to construct "+v);if(m.constructor_body===void 0)throw new he(v+" has no accessible constructor");var Zr=m.constructor_body[R.length];if(Zr===void 0)throw new he(`Tried to invoke ctor of ${v} with invalid number of parameters (${R.length}) - expected (${Object.keys(m.constructor_body).toString()}) parameters instead!`);return Zr.apply(this,R)}),c=Object.create(A,{constructor:{value:T}});T.prototype=c;var m=new It(v,T,c,p,D,i,l,d);m.baseClass&&(m.baseClass.__derivedClasses??=[],m.baseClass.__derivedClasses.push(m));var M=new Ue(v,m,true,false,false),k=new Ue(v+"*",m,false,false,false),H=new Ue(v+" const*",m,false,true,false);return Ir[e]={pointerType:k,constPointerType:H},Br(h,T),[M,k,H]});},ar=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push($[r+n*4>>2]);return t};function Yt(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return true;return false}function or(e,r,t,n,o,i){var s=r.length;s<2&&C("argTypes array size mismatch! Must at least get return value and 'this' types!");var l=r[1]!==null&&t!==null,u=Yt(r),d=r[0].name!=="void",v=s-2,y=new Array(v),p=[],h=[],g=function(...D){D.length!==v&&C(`function ${e} called with ${D.length} arguments, expected ${v}`),h.length=0;var A;p.length=l?2:1,p[0]=o,l&&(A=r[1].toWireType(h,this),p[1]=A);for(var T=0;T<v;++T)y[T]=r[T+2].toWireType(h,D[T]),p.push(y[T]);var c=n(...p);function m(M){if(u)Qe(h);else for(var k=l?1:2;k<r.length;k++){var H=k===1?A:y[k-2];r[k].destructorFunction!==null&&r[k].destructorFunction(H);}if(d)return r[0].fromWireType(M)}return m(c)};return Pe(e,g)}var qt=(e,r,t,n,o,i)=>{var s=ar(r,t);o=Y(n,o),le([],[e],l=>{l=l[0];var u=`constructor ${l.name}`;if(l.registeredClass.constructor_body===void 0&&(l.registeredClass.constructor_body=[]),l.registeredClass.constructor_body[r-1]!==void 0)throw new he(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${l.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return l.registeredClass.constructor_body[r-1]=()=>{xe(`Cannot construct ${l.name} due to unbound types`,s);},le([],s,d=>(d.splice(1,0,null),l.registeredClass.constructor_body[r-1]=or(u,d,null,o,i),[])),[]});},zr=e=>{e=e.trim();let r=e.indexOf("(");return r!==-1?e.substr(0,r):e},Xt=(e,r,t,n,o,i,s,l,u)=>{var d=ar(t,n);r=U(r),r=zr(r),i=Y(o,i),le([],[e],v=>{v=v[0];var y=`${v.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),l&&v.registeredClass.pureVirtualFunctions.push(r);function p(){xe(`Cannot call ${y} due to unbound types`,d);}var h=v.registeredClass.instancePrototype,g=h[r];return g===void 0||g.overloadTable===void 0&&g.className!==v.name&&g.argCount===t-2?(p.argCount=t-2,p.className=v.name,h[r]=p):(Ur(h,r,y),h[r].overloadTable[t-2]=p),le([],d,D=>{var A=or(y,D,v,i,s);return h[r].overloadTable===void 0?(A.argCount=t-2,h[r]=A):h[r].overloadTable[t-2]=A,[]}),[]});},ir=[],J=[],sr=e=>{e>9&&--J[e+1]===0&&(J[e]=void 0,ir.push(e));},Gt=()=>J.length/2-5-ir.length,Kt=()=>{J.push(0,1,void 0,1,null,1,true,1,false,1),f.count_emval_handles=Gt;},W={toValue:e=>(e||C("Cannot use deleted val. handle = "+e),J[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case true:return 6;case false:return 8;default:{let r=ir.pop()||J.length;return J[r]=e,J[r+1]=1,r}}}},Jt={name:"emscripten::val",fromWireType:e=>{var r=W.toValue(e);return sr(e),r},toWireType:(e,r)=>W.toHandle(r),argPackAdvance:X,readValueFromPointer:_e,destructorFunction:null},Qt=e=>q(e,Jt),Zt=(e,r,t)=>{switch(r){case 1:return t?function(n){return this.fromWireType(I[n])}:function(n){return this.fromWireType(x[n])};case 2:return t?function(n){return this.fromWireType(de[n>>1])}:function(n){return this.fromWireType(ye[n>>1])};case 4:return t?function(n){return this.fromWireType(E[n>>2])}:function(n){return this.fromWireType($[n>>2])};default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},en=(e,r,t,n)=>{r=U(r);function o(){}o.values={},q(e,{name:r,constructor:o,fromWireType:function(i){return this.constructor.values[i]},toWireType:(i,s)=>s.value,argPackAdvance:X,readValueFromPointer:Zt(r,t,n),destructorFunction:null}),tr(r,o);},lr=(e,r)=>{var t=se[e];return t===void 0&&C(`${r} has unknown type ${Lr(e)}`),t},rn=(e,r,t)=>{var n=lr(e,"enum");r=U(r);var o=n.constructor,i=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:Pe(`${n.name}_${r}`,function(){})}});o.values[t]=i,o[r]=i;},ur=e=>{if(e===null)return "null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},tn=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(wr[t>>2])};case 8:return function(t){return this.fromWireType(_r[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},nn=(e,r,t)=>{r=U(r),q(e,{name:r,fromWireType:n=>n,toWireType:(n,o)=>o,argPackAdvance:X,readValueFromPointer:tn(r,t),destructorFunction:null});},an=(e,r,t,n,o,i,s)=>{var l=ar(r,t);e=U(e),e=zr(e),o=Y(n,o),tr(e,function(){xe(`Cannot call ${e} due to unbound types`,l);},r-1),le([],l,u=>{var d=[u[0],null].concat(u.slice(1));return Br(e,or(e,d,null,o,i),r-1),[]});},on=(e,r,t)=>{switch(r){case 1:return t?n=>I[n]:n=>x[n];case 2:return t?n=>de[n>>1]:n=>ye[n>>1];case 4:return t?n=>E[n>>2]:n=>$[n>>2];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},sn=(e,r,t,n,o)=>{r=U(r);var i=v=>v;if(n===0){var s=32-8*t;i=v=>v<<s>>>s;}var l=r.includes("unsigned"),u=(v,y)=>{},d;l?d=function(v,y){return u(y,this.name),y>>>0}:d=function(v,y){return u(y,this.name),y},q(e,{name:r,fromWireType:i,toWireType:d,argPackAdvance:X,readValueFromPointer:on(r,t,n!==0),destructorFunction:null});},ln=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],o=n[r];function i(s){var l=$[s>>2],u=$[s+4>>2];return new o(I.buffer,u,l)}t=U(t),q(e,{name:t,fromWireType:i,argPackAdvance:X,readValueFromPointer:i},{ignoreDuplicateRegistrations:true});},fr=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,i=t+n-1,s=0;s<e.length;++s){var l=e.charCodeAt(s);if(l>=55296&&l<=57343){var u=e.charCodeAt(++s);l=65536+((l&1023)<<10)|u&1023;}if(l<=127){if(t>=i)break;r[t++]=l;}else if(l<=2047){if(t+1>=i)break;r[t++]=192|l>>6,r[t++]=128|l&63;}else if(l<=65535){if(t+2>=i)break;r[t++]=224|l>>12,r[t++]=128|l>>6&63,r[t++]=128|l&63;}else {if(t+3>=i)break;r[t++]=240|l>>18,r[t++]=128|l>>12&63,r[t++]=128|l>>6&63,r[t++]=128|l&63;}}return r[t]=0,t-o},un=(e,r,t)=>fr(e,x,r,t),dr=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},fn=(e,r)=>{r=U(r);var t=r==="std::string";q(e,{name:r,fromWireType(n){var o=$[n>>2],i=n+4,s;if(t)for(var l=i,u=0;u<=o;++u){var d=i+u;if(u==o||x[d]==0){var v=d-l,y=ie(l,v);s===void 0?s=y:(s+="\0",s+=y),l=d+1;}}else {for(var p=new Array(o),u=0;u<o;++u)p[u]=String.fromCharCode(x[i+u]);s=p.join("");}return Z(n),s},toWireType(n,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var i,s=typeof o=="string";s||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Int8Array||C("Cannot pass non-string to std::string"),t&&s?i=dr(o):i=o.length;var l=pr(4+i+1),u=l+4;if($[l>>2]=i,t&&s)un(o,u,i+1);else if(s)for(var d=0;d<i;++d){var v=o.charCodeAt(d);v>255&&(Z(u),C("String has UTF-16 code units that do not fit in 8 bits")),x[u+d]=v;}else for(var d=0;d<i;++d)x[u+d]=o[d];return n!==null&&n.push(Z,l),l},argPackAdvance:X,readValueFromPointer:_e,destructorFunction(n){Z(n);}});},Nr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,dn=(e,r)=>{for(var t=e,n=t>>1,o=n+r/2;!(n>=o)&&ye[n];)++n;if(t=n<<1,t-e>32&&Nr)return Nr.decode(x.subarray(e,t));for(var i="",s=0;!(s>=r/2);++s){var l=de[e+s*2>>1];if(l==0)break;i+=String.fromCharCode(l);}return i},cn=(e,r,t)=>{if(t??=2147483647,t<2)return 0;t-=2;for(var n=r,o=t<e.length*2?t/2:e.length,i=0;i<o;++i){var s=e.charCodeAt(i);de[r>>1]=s,r+=2;}return de[r>>1]=0,r-n},vn=e=>e.length*2,hn=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var o=E[e+t*4>>2];if(o==0)break;if(++t,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|i&1023);}else n+=String.fromCharCode(o);}return n},mn=(e,r,t)=>{if(t??=2147483647,t<4)return 0;for(var n=r,o=n+t-4,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343){var l=e.charCodeAt(++i);s=65536+((s&1023)<<10)|l&1023;}if(E[r>>2]=s,r+=4,r+4>o)break}return E[r>>2]=0,r-n},pn=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},yn=(e,r,t)=>{t=U(t);var n,o,i,s;r===2?(n=dn,o=cn,s=vn,i=l=>ye[l>>1]):r===4&&(n=hn,o=mn,s=pn,i=l=>$[l>>2]),q(e,{name:t,fromWireType:l=>{for(var u=$[l>>2],d,v=l+4,y=0;y<=u;++y){var p=l+4+y*r;if(y==u||i(p)==0){var h=p-v,g=n(v,h);d===void 0?d=g:(d+="\0",d+=g),v=p+r;}}return Z(l),d},toWireType:(l,u)=>{typeof u!="string"&&C(`Cannot pass non-string to C++ string type ${t}`);var d=s(u),v=pr(4+d+r);return $[v>>2]=d/r,o(u,v+4,d+r),l!==null&&l.push(Z,v),v},argPackAdvance:X,readValueFromPointer:_e,destructorFunction(l){Z(l);}});},gn=(e,r,t,n,o,i)=>{Re[e]={name:U(r),rawConstructor:Y(t,n),rawDestructor:Y(o,i),fields:[]};},wn=(e,r,t,n,o,i,s,l,u,d)=>{Re[e].fields.push({fieldName:U(r),getterReturnType:t,getter:Y(n,o),getterContext:i,setterArgumentType:s,setter:Y(l,u),setterContext:d});},_n=(e,r)=>{r=U(r),q(e,{isVoid:true,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}});},We=[],En=(e,r,t,n)=>(e=We[e],r=W.toValue(r),e(null,r,t,n)),bn={},cr=e=>{var r=bn[e];return r===void 0?U(e):r},$n=(e,r,t,n,o)=>(e=We[e],r=W.toValue(r),t=cr(t),e(r,r[t],n,o)),Vr=()=>{if(typeof globalThis=="object")return globalThis;function e(r){r.$$$embind_global$$$=r;var t=typeof $$$embind_global$$$=="object"&&r.$$$embind_global$$$==r;return t||delete r.$$$embind_global$$$,t}if(typeof $$$embind_global$$$=="object"||(typeof global=="object"&&e(global)?$$$embind_global$$$=global:typeof self=="object"&&e(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},kn=e=>e===0?W.toHandle(Vr()):(e=cr(e),W.toHandle(Vr()[e])),Pn=e=>{var r=We.length;return We.push(e),r},Cn=(e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=lr($[r+n*4>>2],"parameter "+n);return t},Tn=Reflect.construct,Dn=(e,r,t)=>{var n=[],o=e.toWireType(n,t);return n.length&&($[r>>2]=W.toHandle(n)),o},Fn=(e,r,t)=>{var n=Cn(e,r),o=n.shift();e--;var i=new Array(e),s=(u,d,v,y)=>{for(var p=0,h=0;h<e;++h)i[h]=n[h].readValueFromPointer(y+p),p+=n[h].argPackAdvance;var g=t===1?Tn(d,i):d.apply(u,i);return Dn(o,v,g)},l=`methodCaller<(${n.map(u=>u.name).join(", ")}) => ${o.name}>`;return Pn(Pe(l,s))},Sn=e=>{e>9&&(J[e+1]+=1);},An=()=>W.toHandle([]),Rn=e=>W.toHandle(cr(e)),Mn=()=>W.toHandle({}),On=e=>{var r=W.toValue(e);Qe(r),sr(e);},jn=(e,r,t)=>{e=W.toValue(e),r=W.toValue(r),t=W.toValue(t),e[r]=t;},In=(e,r)=>{e=lr(e,"_emval_take_value");var t=e.readValueFromPointer(r);return W.toHandle(t)},Un=()=>{we("");},Bn=(e,r,t)=>x.copyWithin(e,r,r+t),xn=()=>2147483648,Wn=e=>{var r=Se.buffer,t=(e-r.byteLength+65535)/65536;try{return Se.grow(t),Er(),1}catch{}},Hn=e=>{var r=x.length;e>>>=0;var t=xn();if(e>t)return false;for(var n=(u,d)=>u+(d-u%d)%d,o=1;o<=4;o*=2){var i=r*(1+.2/o);i=Math.min(i,e+100663296);var s=Math.min(t,n(Math.max(e,i),65536)),l=Wn(s);if(l)return true}return false},vr={},Ln=()=>N||"./this.program",Ce=()=>{if(!Ce.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,_:Ln()};for(var t in vr)vr[t]===void 0?delete r[t]:r[t]=vr[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);Ce.strings=n;}return Ce.strings},zn=(e,r)=>{for(var t=0;t<e.length;++t)I[r++]=e.charCodeAt(t);I[r]=0;},Nn=(e,r)=>{var t=0;return Ce().forEach((n,o)=>{var i=r+t;$[e+o*4>>2]=i,zn(n,i),t+=n.length+1;}),0},Vn=(e,r)=>{var t=Ce();$[e>>2]=t.length;var n=0;return t.forEach(o=>n+=o.length+1),$[r>>2]=n,0},F={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];o==="."?e.splice(n,1):o===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--);}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=F.isAbs(e),t=e.substr(-1)==="/";return e=F.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=F.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=F.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:(...e)=>F.normalize(e.join("/")),join2:(e,r)=>F.normalize(e+"/"+r)},Yn=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return n=>crypto.getRandomValues(n);if(K)try{var e=Fe("crypto"),r=e.randomFillSync;if(r)return n=>e.randomFillSync(n);var t=e.randomBytes;return n=>(n.set(t(n.byteLength)),n)}catch{}we("initRandomDevice");},Yr=e=>(Yr=Yn())(e),Q={resolve:(...e)=>{for(var r="",t=false,n=e.length-1;n>=-1&&!t;n--){var o=n>=0?e[n]:a.cwd();if(typeof o!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!o)return "";r=o+"/"+r,t=F.isAbs(o);}return r=F.normalizeArray(r.split("/").filter(i=>!!i),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=Q.resolve(e).substr(1),r=Q.resolve(r).substr(1);function t(d){for(var v=0;v<d.length&&d[v]==="";v++);for(var y=d.length-1;y>=0&&d[y]==="";y--);return v>y?[]:d.slice(v,y-v+1)}for(var n=t(e.split("/")),o=t(r.split("/")),i=Math.min(n.length,o.length),s=i,l=0;l<i;l++)if(n[l]!==o[l]){s=l;break}for(var u=[],l=s;l<n.length;l++)u.push("..");return u=u.concat(o.slice(s)),u.join("/")}},hr=[];function He(e,r,t){var n=dr(e)+1,o=new Array(n),i=fr(e,o,0,o.length);return r&&(o.length=i),o}var qn=()=>{if(!hr.length){var e=null;if(K){var r=256,t=Buffer.alloc(r),n=0,o=process.stdin.fd;try{n=Ye.readSync(o,t);}catch(i){if(i.toString().includes("EOF"))n=0;else throw i}n>0?e=t.slice(0,n).toString("utf-8"):e=null;}else typeof window<"u"&&typeof window.prompt=="function"?(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
1
|
+
'use strict';var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;var F={QualityInvalid:v=>`Quality must be a number between 0.0 and 1.0, got: ${v}`,UnsupportedInputType:v=>`Unsupported input type. Expected Blob, File, ArrayBuffer, or Uint8Array. Got: ${v}`,DecoderInitFailed:v=>`Failed to initialize HEIC decoder: ${v}`,RenderEncodeFailed:(v,h)=>`Failed to render and encode image as ${v}: ${h}`,ConcurrencyInvalid:v=>`Concurrency must be a positive integer, got: ${v}`,ScaleInvalid:v=>`Scale must be a positive finite number, got: ${v}`,MaxWidthInvalid:v=>`maxWidth must be a positive finite number, got: ${v}`,MaxHeightInvalid:v=>`maxHeight must be a positive finite number, got: ${v}`,TargetSizeTooLarge:(v,h,u)=>`Target image size ${v}x${h} exceeds the maximum supported dimension of ${u}px`,BlobToBase64Failed:"Failed to convert Blob to base64 string",BlobToBase64FailedWithCause:v=>`Failed to convert Blob to base64 string: ${v}`,CanvasToBlobFailed:v=>`Failed to convert canvas to blob (type: ${v})`,CanvasUnsupported:"Canvas is not supported in the current environment. Conversion requires a browser environment or canvas polyfills.",InvalidDimensions:(v,h)=>`Invalid image dimensions: ${v}x${h}. Width and height must be positive integers.`,DataLengthMismatch:(v,h,u,_)=>`Image data length mismatch. Expected ${v} bytes for ${h}x${u}, got ${_}`,ContextUnavailable:"Failed to acquire 2D rendering context from canvas",UnsupportedFormat:v=>`Unsupported output format: ${v}`,DecodeFailed:"HEIC decoding failed",DecodeFailedWithDetail:v=>`HEIC decoding failed: ${v}`,WorkerUnsupported:"Web Worker is not supported in the current environment",WorkerCreateFailed:v=>`Failed to create Web Worker: ${v}`,WorkerPostFailed:v=>`Failed to post message to Web Worker: ${v}`,WorkerConversionFailed:"Worker conversion failed",WorkerFailed:"Worker failed",WorkerTimeout:"Web Worker conversion timed out",InputsMustBeArray:"Inputs must be an array of HEIC images",ConvertManyItemFailed:(v,h,u)=>`Conversion of item ${v} of ${h} failed: ${u}`};var So=(()=>{var v=(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href));return(async function(h={}){var u=h,_,E;u.ready=new Promise((e,r)=>{_=e,E=r;});var D=Object.assign({},u),L="./this.program",X=typeof window=="object",O=typeof importScripts=="function",N=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",H="";function re(e){return u.locateFile?u.locateFile(e,H):H+e}var z,te,ge;if(N){let{createRequire:e}=await import('module');var U=e((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))),Y=U("fs"),ne=U("path");O?H=ne.dirname(H)+"/":H=U("url").fileURLToPath(new URL("./",(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)))),z=(r,t)=>(r=Dr(r)?new URL(r):ne.normalize(r),Y.readFileSync(r,t?void 0:"utf8")),ge=r=>{var t=z(r,true);return t.buffer||(t=new Uint8Array(t)),t},te=(r,t,n,i=true)=>{r=Dr(r)?new URL(r):ne.normalize(r),Y.readFile(r,i?void 0:"utf8",(a,s)=>{a?n(a):t(i?s.buffer:s);});},!u.thisProgram&&process.argv.length>1&&(L=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2);}else (X||O)&&(O?H=self.location.href:typeof document<"u"&&document.currentScript&&(H=document.currentScript.src),v&&(H=v),H.startsWith("blob:")?H="":H=H.substr(0,H.replace(/[?#].*/,"").lastIndexOf("/")+1),z=e=>{var r=new XMLHttpRequest;return r.open("GET",e,false),r.send(null),r.responseText},O&&(ge=e=>{var r=new XMLHttpRequest;return r.open("GET",e,false),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),te=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,true),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);});var Ge=u.print||console.log.bind(console),de=u.printErr||console.error.bind(console);Object.assign(u,D),D=null,u.arguments&&(u.arguments),u.thisProgram&&(L=u.thisProgram),u.quit&&(u.quit);var $e;u.wasmBinary&&($e=u.wasmBinary);var Re,br=false,G,Q,ye,ke,k,P,Er,$r;function kr(){var e=Re.buffer;u.HEAP8=G=new Int8Array(e),u.HEAP16=ye=new Int16Array(e),u.HEAPU8=Q=new Uint8Array(e),u.HEAPU16=ke=new Uint16Array(e),u.HEAP32=k=new Int32Array(e),u.HEAPU32=P=new Uint32Array(e),u.HEAPF32=Er=new Float32Array(e),u.HEAPF64=$r=new Float64Array(e);}var Cr=[],Pr=[],Tr=[];function ut(){if(u.preRun)for(typeof u.preRun=="function"&&(u.preRun=[u.preRun]);u.preRun.length;)ct(u.preRun.shift());Je(Cr);}function dt(){!u.noFSInit&&!o.init.initialized&&o.init(),o.ignorePermissions=false,Je(Pr);}function ft(){if(u.postRun)for(typeof u.postRun=="function"&&(u.postRun=[u.postRun]);u.postRun.length;)mt(u.postRun.shift());Je(Tr);}function ct(e){Cr.unshift(e);}function vt(e){Pr.unshift(e);}function mt(e){Tr.unshift(e);}var ce=0,Ce=null;function Qe(e){ce++,u.monitorRunDependencies?.(ce);}function Oe(e){if(ce--,u.monitorRunDependencies?.(ce),ce==0&&(Ce)){var r=Ce;Ce=null,r();}}function we(e){u.onAbort?.(e),e="Aborted("+e+")",de(e),br=true,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw E(r),r}var ht="data:application/octet-stream;base64,",Fr=e=>e.startsWith(ht),Dr=e=>e.startsWith("file://"),ve;u.locateFile?(ve="heic-decoder.wasm",Fr(ve)||(ve=re(ve))):ve=new URL("heic-decoder.wasm",(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))).href;function Sr(e){if(e==ve&&$e)return new Uint8Array($e);if(ge)return ge(e);throw "both async and sync fetching of the wasm failed"}function pt(e){return !$e&&(X||O)&&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(()=>Sr(e)):Promise.resolve().then(()=>Sr(e))}function Ar(e,r,t){return pt(e).then(n=>WebAssembly.instantiate(n,r)).then(t,n=>{de(`failed to asynchronously prepare wasm: ${n}`),we(n);})}function gt(e,r,t,n){return !e&&typeof WebAssembly.instantiateStreaming=="function"&&!Fr(r)&&!N&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(i=>{var a=WebAssembly.instantiateStreaming(i,t);return a.then(n,function(s){return de(`wasm streaming compile failed: ${s}`),de("falling back to ArrayBuffer instantiation"),Ar(r,t,n)})}):Ar(r,t,n)}function yt(){var e={a:wo};function r(n,i){return V=n.exports,Re=V.R,kr(),zr=V.U,vt(V.S),Oe(),V}Qe();function t(n){r(n.instance);}if(u.instantiateWasm)try{return u.instantiateWasm(e,r)}catch(n){de(`Module.instantiateWasm callback failed with error: ${n}`),E(n);}return gt($e,ve,e,t).catch(E),{}}var C,q,Je=e=>{for(;e.length>0;)e.shift()(u);};u.noExitRuntime||true;var Mr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,_e=(e,r,t)=>{for(var n=r+t,i=r;e[i]&&!(i>=n);)++i;if(i-r>16&&e.buffer&&Mr)return Mr.decode(e.subarray(r,i));for(var a="";r<i;){var s=e[r++];if(!(s&128)){a+=String.fromCharCode(s);continue}var l=e[r++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|l);continue}var d=e[r++]&63;if((s&240)==224?s=(s&15)<<12|l<<6|d:s=(s&7)<<18|l<<12|d<<6|e[r++]&63,s<65536)a+=String.fromCharCode(s);else {var f=s-65536;a+=String.fromCharCode(55296|f>>10,56320|f&1023);}}return a},me=(e,r)=>e?_e(Q,e,r):"",wt=(e,r,t,n)=>{we(`Assertion failed: ${me(e)}, at: `+[r?me(r):"unknown filename",t,n?me(n):"unknown function"]);};class _t{constructor(r){this.excPtr=r,this.ptr=r-24;}set_type(r){P[this.ptr+4>>2]=r;}get_type(){return P[this.ptr+4>>2]}set_destructor(r){P[this.ptr+8>>2]=r;}get_destructor(){return P[this.ptr+8>>2]}set_caught(r){r=r?1:0,G[this.ptr+12]=r;}get_caught(){return G[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,G[this.ptr+13]=r;}get_rethrown(){return G[this.ptr+13]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t);}set_adjusted_ptr(r){P[this.ptr+16>>2]=r;}get_adjusted_ptr(){return P[this.ptr+16>>2]}get_exception_ptr(){var r=et(this.get_type());if(r)return P[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var Ir=0,Et=(e,r,t)=>{var n=new _t(e);throw n.init(r,t),Ir=e,Ir},x={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 i=e[n];i==="."?e.splice(n,1):i===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--);}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=x.isAbs(e),t=e.substr(-1)==="/";return e=x.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=x.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=x.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:(...e)=>x.normalize(e.join("/")),join2:(e,r)=>x.normalize(e+"/"+r)},$t=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return n=>crypto.getRandomValues(n);if(N)try{var e=U("crypto"),r=e.randomFillSync;if(r)return n=>e.randomFillSync(n);var t=e.randomBytes;return n=>(n.set(t(n.byteLength)),n)}catch{}we("initRandomDevice");},Rr=e=>(Rr=$t())(e),se={resolve:(...e)=>{for(var r="",t=false,n=e.length-1;n>=-1&&!t;n--){var i=n>=0?e[n]:o.cwd();if(typeof i!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!i)return "";r=i+"/"+r,t=x.isAbs(i);}return r=x.normalizeArray(r.split("/").filter(a=>!!a),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=se.resolve(e).substr(1),r=se.resolve(r).substr(1);function t(f){for(var m=0;m<f.length&&f[m]==="";m++);for(var w=f.length-1;w>=0&&f[w]==="";w--);return m>w?[]:f.slice(m,w-m+1)}for(var n=t(e.split("/")),i=t(r.split("/")),a=Math.min(n.length,i.length),s=a,l=0;l<a;l++)if(n[l]!==i[l]){s=l;break}for(var d=[],l=s;l<n.length;l++)d.push("..");return d=d.concat(i.slice(s)),d.join("/")}},Ze=[],er=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},rr=(e,r,t,n)=>{if(!(n>0))return 0;for(var i=t,a=t+n-1,s=0;s<e.length;++s){var l=e.charCodeAt(s);if(l>=55296&&l<=57343){var d=e.charCodeAt(++s);l=65536+((l&1023)<<10)|d&1023;}if(l<=127){if(t>=a)break;r[t++]=l;}else if(l<=2047){if(t+1>=a)break;r[t++]=192|l>>6,r[t++]=128|l&63;}else if(l<=65535){if(t+2>=a)break;r[t++]=224|l>>12,r[t++]=128|l>>6&63,r[t++]=128|l&63;}else {if(t+3>=a)break;r[t++]=240|l>>18,r[t++]=128|l>>12&63,r[t++]=128|l>>6&63,r[t++]=128|l&63;}}return r[t]=0,t-i};function xe(e,r,t){var n=er(e)+1,i=new Array(n),a=rr(e,i,0,i.length);return r&&(i.length=a),i}var kt=()=>{if(!Ze.length){var e=null;if(N){var r=256,t=Buffer.alloc(r),n=0,i=process.stdin.fd;try{n=Y.readSync(i,t);}catch(a){if(a.toString().includes("EOF"))n=0;else throw a}n>0?e=t.slice(0,n).toString("utf-8"):e=null;}else typeof window<"u"&&typeof window.prompt=="function"?(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
3
2
|
`)):typeof readline=="function"&&(e=readline(),e!==null&&(e+=`
|
|
4
|
-
`));if(!e)return null;hr=He(e,true);}return hr.shift()},te={ttys:[],init(){},shutdown(){},register(e,r){te.ttys[e]={input:[],output:[],ops:r},a.registerDevice(e,te.stream_ops);},stream_ops:{open(e){var r=te.ttys[e.node.rdev];if(!r)throw new a.ErrnoError(43);e.tty=r,e.seekable=false;},close(e){e.tty.ops.fsync(e.tty);},fsync(e){e.tty.ops.fsync(e.tty);},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new a.ErrnoError(60);for(var i=0,s=0;s<n;s++){var l;try{l=e.tty.ops.get_char(e.tty);}catch{throw new a.ErrnoError(29)}if(l===void 0&&i===0)throw new a.ErrnoError(6);if(l==null)break;i++,r[t+s]=l;}return i&&(e.node.timestamp=Date.now()),i},write(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new a.ErrnoError(60);try{for(var i=0;i<n;i++)e.tty.ops.put_char(e.tty,r[t+i]);}catch{throw new a.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),i}},default_tty_ops:{get_char(e){return qn()},put_char(e,r){r===null||r===10?(Xe(ce(e.output,0)),e.output=[]):r!=0&&e.output.push(r);},fsync(e){e.output&&e.output.length>0&&(Xe(ce(e.output,0)),e.output=[]);},ioctl_tcgets(e){return {c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,r,t){return 0},ioctl_tiocgwinsz(e){return [24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(re(ce(e.output,0)),e.output=[]):r!=0&&e.output.push(r);},fsync(e){e.output&&e.output.length>0&&(re(ce(e.output,0)),e.output=[]);}}},qr=e=>{we();},w={ops_table:null,mount(e){return w.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(a.isBlkdev(t)||a.isFIFO(t))throw new a.ErrnoError(63);w.ops_table||={dir:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr,lookup:w.node_ops.lookup,mknod:w.node_ops.mknod,rename:w.node_ops.rename,unlink:w.node_ops.unlink,rmdir:w.node_ops.rmdir,readdir:w.node_ops.readdir,symlink:w.node_ops.symlink},stream:{llseek:w.stream_ops.llseek}},file:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr},stream:{llseek:w.stream_ops.llseek,read:w.stream_ops.read,write:w.stream_ops.write,allocate:w.stream_ops.allocate,mmap:w.stream_ops.mmap,msync:w.stream_ops.msync}},link:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr,readlink:w.node_ops.readlink},stream:{}},chrdev:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr},stream:a.chrdev_stream_ops}};var o=a.createNode(e,r,t,n);return a.isDir(o.mode)?(o.node_ops=w.ops_table.dir.node,o.stream_ops=w.ops_table.dir.stream,o.contents={}):a.isFile(o.mode)?(o.node_ops=w.ops_table.file.node,o.stream_ops=w.ops_table.file.stream,o.usedBytes=0,o.contents=null):a.isLink(o.mode)?(o.node_ops=w.ops_table.link.node,o.stream_ops=w.ops_table.link.stream):a.isChrdev(o.mode)&&(o.node_ops=w.ops_table.chrdev.node,o.stream_ops=w.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var o=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(o.subarray(0,e.usedBytes),0);}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else {var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r;}},node_ops:{getattr(e){var r={};return r.dev=a.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,a.isDir(e.mode)?r.size=4096:a.isFile(e.mode)?r.size=e.usedBytes:a.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){r.mode!==void 0&&(e.mode=r.mode),r.timestamp!==void 0&&(e.timestamp=r.timestamp),r.size!==void 0&&w.resizeFileStorage(e,r.size);},lookup(e,r){throw a.genericErrors[44]},mknod(e,r,t,n){return w.createNode(e,r,t,n)},rename(e,r,t){if(a.isDir(e.mode)){var n;try{n=a.lookupNode(r,t);}catch{}if(n)for(var o in n.contents)throw new a.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp,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 of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){var n=w.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!a.isLink(e.mode))throw new a.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var i=e.node.contents;if(o>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-o,n);if(s>8&&i.subarray)r.set(i.subarray(o,o+s),t);else for(var l=0;l<s;l++)r[t+l]=i[o+l];return s},write(e,r,t,n,o,i){if(r.buffer===I.buffer&&(i=false),!n)return 0;var s=e.node;if(s.timestamp=Date.now(),r.subarray&&(!s.contents||s.contents.subarray)){if(i)return s.contents=r.subarray(t,t+n),s.usedBytes=n,n;if(s.usedBytes===0&&o===0)return s.contents=r.slice(t,t+n),s.usedBytes=n,n;if(o+n<=s.usedBytes)return s.contents.set(r.subarray(t,t+n),o),n}if(w.expandFileStorage(s,o+n),s.contents.subarray&&r.subarray)s.contents.set(r.subarray(t,t+n),o);else for(var l=0;l<n;l++)s.contents[o+l]=r[t+l];return s.usedBytes=Math.max(s.usedBytes,o+n),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&a.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new a.ErrnoError(28);return n},allocate(e,r,t){w.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t);},mmap(e,r,t,n,o){if(!a.isFile(e.node.mode))throw new a.ErrnoError(43);var i,s,l=e.node.contents;if(!(o&2)&&l.buffer===I.buffer)s=false,i=l.byteOffset;else {if((t>0||t+r<l.length)&&(l.subarray?l=l.subarray(t,t+r):l=Array.prototype.slice.call(l,t,t+r)),s=true,i=qr(),!i)throw new a.ErrnoError(48);I.set(l,i);}return {ptr:i,allocated:s}},msync(e,r,t,n,o){return w.stream_ops.write(e,r,0,n,t,false),0}}},Xn=(e,r,t,n)=>{var o=`al ${e}`;Ve(e,i=>{r(new Uint8Array(i)),o&&Ae();},i=>{if(t)t();else throw `Loading data file "${e}" failed.`}),o&&Ke();},Gn=(e,r,t,n,o,i)=>{a.createDataFile(e,r,t,n,o,i);},Kn=f.preloadPlugins||[],Jn=(e,r,t,n)=>{typeof Browser<"u"&&Browser.init();var o=false;return Kn.forEach(i=>{o||i.canHandle(r)&&(i.handle(e,r,t,n),o=true);}),o},Qn=(e,r,t,n,o,i,s,l,u,d)=>{var v=r?Q.resolve(F.join2(e,r)):e;function p(h){function g(D){d?.(),l||Gn(e,r,D,n,o,u),i?.(),Ae();}Jn(h,v,g,()=>{s?.(),Ae();})||g(h);}Ke(),typeof t=="string"?Xn(t,p,s):p(t);},Zn=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);return t},mr=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},a={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:class{constructor(e){this.name="ErrnoError",this.errno=e;}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={};}get object(){return this.node}set object(e){this.node=e;}get isRead(){return (this.flags&2097155)!==1}get isWrite(){return (this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e;}get position(){return this.shared.position}set position(e){this.shared.position=e;}},FSNode:class{constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=a.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n,this.readMode=365,this.writeMode=146;}get read(){return (this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode;}get write(){return (this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode;}get isFolder(){return a.isDir(this.mode)}get isDevice(){return a.isChrdev(this.mode)}},lookupPath(e,r={}){if(e=Q.resolve(e),!e)return {path:"",node:null};var t={follow_mount:true,recurse_count:0};if(r=Object.assign(t,r),r.recurse_count>8)throw new a.ErrnoError(32);for(var n=e.split("/").filter(y=>!!y),o=a.root,i="/",s=0;s<n.length;s++){var l=s===n.length-1;if(l&&r.parent)break;if(o=a.lookupNode(o,n[s]),i=F.join2(i,n[s]),a.isMountpoint(o)&&(!l||l&&r.follow_mount)&&(o=o.mounted.root),!l||r.follow)for(var u=0;a.isLink(o.mode);){var d=a.readlink(i);i=Q.resolve(F.dirname(i),d);var v=a.lookupPath(i,{recurse_count:r.recurse_count+1});if(o=v.node,u++>40)throw new a.ErrnoError(32)}}return {path:i,node:o}},getPath(e){for(var r;;){if(a.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent;}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return (e+t>>>0)%a.nameTable.length},hashAddNode(e){var r=a.hashName(e.parent.id,e.name);e.name_next=a.nameTable[r],a.nameTable[r]=e;},hashRemoveNode(e){var r=a.hashName(e.parent.id,e.name);if(a.nameTable[r]===e)a.nameTable[r]=e.name_next;else for(var t=a.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next;}},lookupNode(e,r){var t=a.mayLookup(e);if(t)throw new a.ErrnoError(t);for(var n=a.hashName(e.id,r),o=a.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===r)return o}return a.lookup(e,r)},createNode(e,r,t,n){var o=new a.FSNode(e,r,t,n);return a.hashAddNode(o),o},destroyNode(e){a.hashRemoveNode(e);},isRoot(e){return e===e.parent},isMountpoint(e){return !!e.mounted},isFile(e){return (e&61440)===32768},isDir(e){return (e&61440)===16384},isLink(e){return (e&61440)===40960},isChrdev(e){return (e&61440)===8192},isBlkdev(e){return (e&61440)===24576},isFIFO(e){return (e&61440)===4096},isSocket(e){return (e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return a.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!a.isDir(e.mode))return 54;var r=a.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){try{var t=a.lookupNode(e,r);return 20}catch{}return a.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=a.lookupNode(e,r);}catch(i){return i.errno}var o=a.nodePermissions(e,"wx");if(o)return o;if(t){if(!a.isDir(n.mode))return 54;if(a.isRoot(n)||a.getPath(n)===a.cwd())return 10}else if(a.isDir(n.mode))return 31;return 0},mayOpen(e,r){return e?a.isLink(e.mode)?32:a.isDir(e.mode)&&(a.flagsToPermissionString(r)!=="r"||r&512)?31:a.nodePermissions(e,a.flagsToPermissionString(r)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=a.MAX_OPEN_FDS;e++)if(!a.streams[e])return e;throw new a.ErrnoError(33)},getStreamChecked(e){var r=a.getStream(e);if(!r)throw new a.ErrnoError(8);return r},getStream:e=>a.streams[e],createStream(e,r=-1){return e=Object.assign(new a.FSStream,e),r==-1&&(r=a.nextfd()),e.fd=r,a.streams[r]=e,e},closeStream(e){a.streams[e]=null;},dupStream(e,r=-1){var t=a.createStream(e,r);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(e){var r=a.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,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(...n.mounts);}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=false),a.syncFSRequests++,a.syncFSRequests>1&&re(`warning: ${a.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=a.getMounts(a.root.mount),n=0;function o(s){return a.syncFSRequests--,r(s)}function i(s){if(s)return i.errored?void 0:(i.errored=true,o(s));++n>=t.length&&o(null);}t.forEach(s=>{if(!s.type.syncfs)return i(null);s.type.syncfs(s,e,i);});},mount(e,r,t){var n=t==="/",o=!t,i;if(n&&a.root)throw new a.ErrnoError(10);if(!n&&!o){var s=a.lookupPath(t,{follow_mount:false});if(t=s.path,i=s.node,a.isMountpoint(i))throw new a.ErrnoError(10);if(!a.isDir(i.mode))throw new a.ErrnoError(54)}var l={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(l);return u.mount=l,l.root=u,n?a.root=u:i&&(i.mounted=l,i.mount&&i.mount.mounts.push(l)),u},unmount(e){var r=a.lookupPath(e,{follow_mount:false});if(!a.isMountpoint(r.node))throw new a.ErrnoError(28);var t=r.node,n=t.mounted,o=a.getMounts(n);Object.keys(a.nameTable).forEach(s=>{for(var l=a.nameTable[s];l;){var u=l.name_next;o.includes(l.mount)&&a.destroyNode(l),l=u;}}),t.mounted=null;var i=t.mount.mounts.indexOf(n);t.mount.mounts.splice(i,1);},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var n=a.lookupPath(e,{parent:true}),o=n.node,i=F.basename(e);if(!i||i==="."||i==="..")throw new a.ErrnoError(28);var s=a.mayCreate(o,i);if(s)throw new a.ErrnoError(s);if(!o.node_ops.mknod)throw new a.ErrnoError(63);return o.node_ops.mknod(o,i,r,t)},create(e,r){return r=r!==void 0?r:438,r&=4095,r|=32768,a.mknod(e,r,0)},mkdir(e,r){return r=r!==void 0?r:511,r&=1023,r|=16384,a.mknod(e,r,0)},mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{a.mkdir(n,r);}catch(i){if(i.errno!=20)throw i}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,a.mknod(e,r,t)},symlink(e,r){if(!Q.resolve(e))throw new a.ErrnoError(44);var t=a.lookupPath(r,{parent:true}),n=t.node;if(!n)throw new a.ErrnoError(44);var o=F.basename(r),i=a.mayCreate(n,o);if(i)throw new a.ErrnoError(i);if(!n.node_ops.symlink)throw new a.ErrnoError(63);return n.node_ops.symlink(n,o,e)},rename(e,r){var t=F.dirname(e),n=F.dirname(r),o=F.basename(e),i=F.basename(r),s,l,u;if(s=a.lookupPath(e,{parent:true}),l=s.node,s=a.lookupPath(r,{parent:true}),u=s.node,!l||!u)throw new a.ErrnoError(44);if(l.mount!==u.mount)throw new a.ErrnoError(75);var d=a.lookupNode(l,o),v=Q.relative(e,n);if(v.charAt(0)!==".")throw new a.ErrnoError(28);if(v=Q.relative(r,t),v.charAt(0)!==".")throw new a.ErrnoError(55);var y;try{y=a.lookupNode(u,i);}catch{}if(d!==y){var p=a.isDir(d.mode),h=a.mayDelete(l,o,p);if(h)throw new a.ErrnoError(h);if(h=y?a.mayDelete(u,i,p):a.mayCreate(u,i),h)throw new a.ErrnoError(h);if(!l.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(d)||y&&a.isMountpoint(y))throw new a.ErrnoError(10);if(u!==l&&(h=a.nodePermissions(l,"w"),h))throw new a.ErrnoError(h);a.hashRemoveNode(d);try{l.node_ops.rename(d,u,i);}catch(g){throw g}finally{a.hashAddNode(d);}}},rmdir(e){var r=a.lookupPath(e,{parent:true}),t=r.node,n=F.basename(e),o=a.lookupNode(t,n),i=a.mayDelete(t,n,true);if(i)throw new a.ErrnoError(i);if(!t.node_ops.rmdir)throw new a.ErrnoError(63);if(a.isMountpoint(o))throw new a.ErrnoError(10);t.node_ops.rmdir(t,n),a.destroyNode(o);},readdir(e){var r=a.lookupPath(e,{follow:true}),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:true}),t=r.node;if(!t)throw new a.ErrnoError(44);var n=F.basename(e),o=a.lookupNode(t,n),i=a.mayDelete(t,n,false);if(i)throw new a.ErrnoError(i);if(!t.node_ops.unlink)throw new a.ErrnoError(63);if(a.isMountpoint(o))throw new a.ErrnoError(10);t.node_ops.unlink(t,n),a.destroyNode(o);},readlink(e){var r=a.lookupPath(e),t=r.node;if(!t)throw new a.ErrnoError(44);if(!t.node_ops.readlink)throw new a.ErrnoError(28);return Q.resolve(a.getPath(t.parent),t.node_ops.readlink(t))},stat(e,r){var t=a.lookupPath(e,{follow:!r}),n=t.node;if(!n)throw new a.ErrnoError(44);if(!n.node_ops.getattr)throw new a.ErrnoError(63);return n.node_ops.getattr(n)},lstat(e){return a.stat(e,true)},chmod(e,r,t){var n;if(typeof e=="string"){var o=a.lookupPath(e,{follow:!t});n=o.node;}else n=e;if(!n.node_ops.setattr)throw new a.ErrnoError(63);n.node_ops.setattr(n,{mode:r&4095|n.mode&-4096,timestamp:Date.now()});},lchmod(e,r){a.chmod(e,r,true);},fchmod(e,r){var t=a.getStreamChecked(e);a.chmod(t.node,r);},chown(e,r,t,n){var o;if(typeof e=="string"){var i=a.lookupPath(e,{follow:!n});o=i.node;}else o=e;if(!o.node_ops.setattr)throw new a.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()});},lchown(e,r,t){a.chown(e,r,t,true);},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:true});t=n.node;}else t=e;if(!t.node_ops.setattr)throw new a.ErrnoError(63);if(a.isDir(t.mode))throw new a.ErrnoError(31);if(!a.isFile(t.mode))throw new a.ErrnoError(28);var o=a.nodePermissions(t,"w");if(o)throw new a.ErrnoError(o);t.node_ops.setattr(t,{size:r,timestamp:Date.now()});},ftruncate(e,r){var t=a.getStreamChecked(e);if((t.flags&2097155)===0)throw new a.ErrnoError(28);a.truncate(t.node,r);},utime(e,r,t){var n=a.lookupPath(e,{follow:true}),o=n.node;o.node_ops.setattr(o,{timestamp:Math.max(r,t)});},open(e,r,t){if(e==="")throw new a.ErrnoError(44);r=typeof r=="string"?Zn(r):r,t=typeof t>"u"?438:t,r&64?t=t&4095|32768:t=0;var n;if(typeof e=="object")n=e;else {e=F.normalize(e);try{var o=a.lookupPath(e,{follow:!(r&131072)});n=o.node;}catch{}}var i=false;if(r&64)if(n){if(r&128)throw new a.ErrnoError(20)}else n=a.mknod(e,t,0),i=true;if(!n)throw new a.ErrnoError(44);if(a.isChrdev(n.mode)&&(r&=-513),r&65536&&!a.isDir(n.mode))throw new a.ErrnoError(54);if(!i){var s=a.mayOpen(n,r);if(s)throw new a.ErrnoError(s)}r&512&&!i&&a.truncate(n,0),r&=-131713;var l=a.createStream({node:n,path:a.getPath(n),flags:r,seekable:true,position:0,stream_ops:n.stream_ops,ungotten:[],error:false});return l.stream_ops.open&&l.stream_ops.open(l),f.logReadFiles&&!(r&1)&&(a.readFiles||(a.readFiles={}),e in a.readFiles||(a.readFiles[e]=1)),l},close(e){if(a.isClosed(e))throw new a.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e);}catch(r){throw r}finally{a.closeStream(e.fd);}e.fd=null;},isClosed(e){return e.fd===null},llseek(e,r,t){if(a.isClosed(e))throw new a.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new a.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new a.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===1)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.read)throw new a.ErrnoError(28);var i=typeof o<"u";if(!i)o=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var s=e.stream_ops.read(e,r,t,n,o);return i||(e.position+=s),s},write(e,r,t,n,o,i){if(n<0||o<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===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 s=typeof o<"u";if(!s)o=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var l=e.stream_ops.write(e,r,t,n,o,i);return s||(e.position+=l),l},allocate(e,r,t){if(a.isClosed(e))throw new a.ErrnoError(8);if(r<0||t<=0)throw new a.ErrnoError(28);if((e.flags&2097155)===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,o){if((n&2)!==0&&(o&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,o)},msync(e,r,t,n,o){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new a.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=a.open(e,r.flags),o=a.stat(e),i=o.size,s=new Uint8Array(i);return a.read(n,s,0,i,0),r.encoding==="utf8"?t=ce(s,0):r.encoding==="binary"&&(t=s),a.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=a.open(e,t.flags,t.mode);if(typeof r=="string"){var o=new Uint8Array(dr(r)+1),i=fr(r,o,0,o.length);a.write(n,o,0,i,void 0,t.canOwn);}else if(ArrayBuffer.isView(r))a.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");a.close(n);},cwd:()=>a.currentPath,chdir(e){var r=a.lookupPath(e,{follow:true});if(r.node===null)throw new a.ErrnoError(44);if(!a.isDir(r.node.mode))throw new a.ErrnoError(54);var t=a.nodePermissions(r.node,"x");if(t)throw new a.ErrnoError(t);a.currentPath=r.path;},createDefaultDirectories(){a.mkdir("/tmp"),a.mkdir("/home"),a.mkdir("/home/web_user");},createDefaultDevices(){a.mkdir("/dev"),a.registerDevice(a.makedev(1,3),{read:()=>0,write:(n,o,i,s,l)=>s}),a.mkdev("/dev/null",a.makedev(1,3)),te.register(a.makedev(5,0),te.default_tty_ops),te.register(a.makedev(6,0),te.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=Yr(e).byteLength),e[--r]);a.createDevice("/dev","random",t),a.createDevice("/dev","urandom",t),a.mkdir("/dev/shm"),a.mkdir("/dev/shm/tmp");},createSpecialDirectories(){a.mkdir("/proc");var e=a.mkdir("/proc/self");a.mkdir("/proc/self/fd"),a.mount({mount(){var r=a.createNode(e,"fd",16895,73);return r.node_ops={lookup(t,n){var o=+n,i=a.getStreamChecked(o),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return s.parent=s,s}},r}},{},"/proc/self/fd");},createStandardStreams(){f.stdin?a.createDevice("/dev","stdin",f.stdin):a.symlink("/dev/tty","/dev/stdin"),f.stdout?a.createDevice("/dev","stdout",null,f.stdout):a.symlink("/dev/tty","/dev/stdout"),f.stderr?a.createDevice("/dev","stderr",null,f.stderr):a.symlink("/dev/tty1","/dev/stderr");a.open("/dev/stdin",0);a.open("/dev/stdout",1);a.open("/dev/stderr",1);},staticInit(){[44].forEach(e=>{a.genericErrors[e]=new a.ErrnoError(e),a.genericErrors[e].stack="<generic error, no stack>";}),a.nameTable=new Array(4096),a.mount(w,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:w};},init(e,r,t){a.init.initialized=true,f.stdin=e||f.stdin,f.stdout=r||f.stdout,f.stderr=t||f.stderr,a.createStandardStreams();},quit(){a.init.initialized=false;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{}var n={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,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=F.basename(e),t=a.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/";}catch(o){n.error=o.errno;}return n},createPath(e,r,t,n){e=typeof e=="string"?e:a.getPath(e);for(var o=r.split("/").reverse();o.length;){var i=o.pop();if(i){var s=F.join2(e,i);try{a.mkdir(s);}catch{}e=s;}}return s},createFile(e,r,t,n,o){var i=F.join2(typeof e=="string"?e:a.getPath(e),r),s=mr(n,o);return a.create(i,s)},createDataFile(e,r,t,n,o,i){var s=r;e&&(e=typeof e=="string"?e:a.getPath(e),s=r?F.join2(e,r):e);var l=mr(n,o),u=a.create(s,l);if(t){if(typeof t=="string"){for(var d=new Array(t.length),v=0,y=t.length;v<y;++v)d[v]=t.charCodeAt(v);t=d;}a.chmod(u,l|146);var p=a.open(u,577);a.write(p,t,0,t.length,0,i),a.close(p),a.chmod(u,l);}},createDevice(e,r,t,n){var o=F.join2(typeof e=="string"?e:a.getPath(e),r),i=mr(!!t,!!n);a.createDevice.major||(a.createDevice.major=64);var s=a.makedev(a.createDevice.major++,0);return a.registerDevice(s,{open(l){l.seekable=false;},close(l){n?.buffer?.length&&n(10);},read(l,u,d,v,y){for(var p=0,h=0;h<v;h++){var g;try{g=t();}catch{throw new a.ErrnoError(29)}if(g===void 0&&p===0)throw new a.ErrnoError(6);if(g==null)break;p++,u[d+h]=g;}return p&&(l.node.timestamp=Date.now()),p},write(l,u,d,v,y){for(var p=0;p<v;p++)try{n(u[d+p]);}catch{throw new a.ErrnoError(29)}return v&&(l.node.timestamp=Date.now()),p}}),a.mkdev(o,i,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return true;if(typeof XMLHttpRequest<"u")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(me)try{e.contents=He(me(e.url),!0),e.usedBytes=e.contents.length;}catch{throw new a.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(e,r,t,n,o){class i{constructor(){this.lengthKnown=false,this.chunks=[];}get(h){if(!(h>this.length-1||h<0)){var g=h%this.chunkSize,D=h/this.chunkSize|0;return this.getter(D)[g]}}setDataGetter(h){this.getter=h;}cacheLength(){var h=new XMLHttpRequest;if(h.open("HEAD",t,false),h.send(null),!(h.status>=200&&h.status<300||h.status===304))throw new Error("Couldn't load "+t+". Status: "+h.status);var g=Number(h.getResponseHeader("Content-length")),D,A=(D=h.getResponseHeader("Accept-Ranges"))&&D==="bytes",T=(D=h.getResponseHeader("Content-Encoding"))&&D==="gzip",c=1024*1024;A||(c=g);var m=(k,H)=>{if(k>H)throw new Error("invalid range ("+k+", "+H+") or no bytes requested!");if(H>g-1)throw new Error("only "+g+" bytes available! programmer error!");var R=new XMLHttpRequest;if(R.open("GET",t,false),g!==c&&R.setRequestHeader("Range","bytes="+k+"-"+H),R.responseType="arraybuffer",R.overrideMimeType&&R.overrideMimeType("text/plain; charset=x-user-defined"),R.send(null),!(R.status>=200&&R.status<300||R.status===304))throw new Error("Couldn't load "+t+". Status: "+R.status);return R.response!==void 0?new Uint8Array(R.response||[]):He(R.responseText||"",true)},M=this;M.setDataGetter(k=>{var H=k*c,R=(k+1)*c-1;if(R=Math.min(R,g-1),typeof M.chunks[k]>"u"&&(M.chunks[k]=m(H,R)),typeof M.chunks[k]>"u")throw new Error("doXHR failed!");return M.chunks[k]}),(T||!g)&&(c=g=1,g=this.getter(0).length,c=g,Xe("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=g,this._chunkSize=c,this.lengthKnown=true;}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!V)throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new i,l={isDevice:false,contents:s};}else var l={isDevice:false,url:t};var u=a.createFile(e,r,l,n,o);l.contents?u.contents=l.contents:l.url&&(u.contents=null,u.url=l.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var d={},v=Object.keys(u.stream_ops);v.forEach(p=>{var h=u.stream_ops[p];d[p]=(...g)=>(a.forceLoadFile(u),h(...g));});function y(p,h,g,D,A){var T=p.node.contents;if(A>=T.length)return 0;var c=Math.min(T.length-A,D);if(T.slice)for(var m=0;m<c;m++)h[g+m]=T[A+m];else for(var m=0;m<c;m++)h[g+m]=T.get(A+m);return c}return d.read=(p,h,g,D,A)=>(a.forceLoadFile(u),y(p,h,g,D,A)),d.mmap=(p,h,g,D,A)=>{a.forceLoadFile(u);var T=qr();if(!T)throw new a.ErrnoError(48);return y(p,I,T,h,g),{ptr:T,allocated:true}},u.stream_ops=d,u}},ne={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(F.isAbs(r))return r;var n;if(e===-100)n=a.cwd();else {var o=ne.getStreamFromFD(e);n=o.path;}if(r.length==0){if(!t)throw new a.ErrnoError(44);return n}return F.join2(n,r)},doStat(e,r,t){var n=e(r);E[t>>2]=n.dev,E[t+4>>2]=n.mode,$[t+8>>2]=n.nlink,E[t+12>>2]=n.uid,E[t+16>>2]=n.gid,E[t+20>>2]=n.rdev,j=[n.size>>>0,(b=n.size,+Math.abs(b)>=1?b>0?+Math.floor(b/4294967296)>>>0:~~+Math.ceil((b-+(~~b>>>0))/4294967296)>>>0:0)],E[t+24>>2]=j[0],E[t+28>>2]=j[1],E[t+32>>2]=4096,E[t+36>>2]=n.blocks;var o=n.atime.getTime(),i=n.mtime.getTime(),s=n.ctime.getTime();return j=[Math.floor(o/1e3)>>>0,(b=Math.floor(o/1e3),+Math.abs(b)>=1?b>0?+Math.floor(b/4294967296)>>>0:~~+Math.ceil((b-+(~~b>>>0))/4294967296)>>>0:0)],E[t+40>>2]=j[0],E[t+44>>2]=j[1],$[t+48>>2]=o%1e3*1e3,j=[Math.floor(i/1e3)>>>0,(b=Math.floor(i/1e3),+Math.abs(b)>=1?b>0?+Math.floor(b/4294967296)>>>0:~~+Math.ceil((b-+(~~b>>>0))/4294967296)>>>0:0)],E[t+56>>2]=j[0],E[t+60>>2]=j[1],$[t+64>>2]=i%1e3*1e3,j=[Math.floor(s/1e3)>>>0,(b=Math.floor(s/1e3),+Math.abs(b)>=1?b>0?+Math.floor(b/4294967296)>>>0:~~+Math.ceil((b-+(~~b>>>0))/4294967296)>>>0:0)],E[t+72>>2]=j[0],E[t+76>>2]=j[1],$[t+80>>2]=s%1e3*1e3,j=[n.ino>>>0,(b=n.ino,+Math.abs(b)>=1?b>0?+Math.floor(b/4294967296)>>>0:~~+Math.ceil((b-+(~~b>>>0))/4294967296)>>>0:0)],E[t+88>>2]=j[0],E[t+92>>2]=j[1],0},doMsync(e,r,t,n,o){if(!a.isFile(r.node.mode))throw new a.ErrnoError(43);if(n&2)return 0;var i=x.slice(e,e+t);a.msync(r,i,o,t,n);},varargs:void 0,get(){var e=E[+ne.varargs>>2];return ne.varargs+=4,e},getp(){return ne.get()},getStr(e){var r=ie(e);return r},getStreamFromFD(e){var r=a.getStreamChecked(e);return r}};function ea(e){try{var r=ne.getStreamFromFD(e);return a.close(r),0}catch(t){if(typeof a>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var ra=(e,r,t,n)=>{for(var o=0,i=0;i<t;i++){var s=$[r>>2],l=$[r+4>>2];r+=8;var u=a.read(e,I,s,l,n);if(u<0)return -1;if(o+=u,u<l)break;}return o};function ta(e,r,t,n){try{var o=ne.getStreamFromFD(e),i=ra(o,r,t);return $[n>>2]=i,0}catch(s){if(typeof a>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var na=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN;function aa(e,r,t,n,o){var i=na(r,t);try{if(isNaN(i))return 61;var s=ne.getStreamFromFD(e);return a.llseek(s,i,n),j=[s.position>>>0,(b=s.position,+Math.abs(b)>=1?b>0?+Math.floor(b/4294967296)>>>0:~~+Math.ceil((b-+(~~b>>>0))/4294967296)>>>0:0)],E[o>>2]=j[0],E[o+4>>2]=j[1],s.getdents&&i===0&&n===0&&(s.getdents=null),0}catch(l){if(typeof a>"u"||l.name!=="ErrnoError")throw l;return l.errno}}var oa=(e,r,t,n)=>{for(var o=0,i=0;i<t;i++){var s=$[r>>2],l=$[r+4>>2];r+=8;var u=a.write(e,I,s,l,n);if(u<0)return -1;o+=u;}return o};function ia(e,r,t,n){try{var o=ne.getStreamFromFD(e),i=oa(o,r,t);return $[n>>2]=i,0}catch(s){if(typeof a>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var Le=e=>e%4===0&&(e%100!==0||e%400===0),sa=(e,r)=>{for(var t=0,n=0;n<=r;t+=e[n++]);return t},Xr=[31,29,31,30,31,30,31,31,30,31,30,31],Gr=[31,28,31,30,31,30,31,31,30,31,30,31],la=(e,r)=>{for(var t=new Date(e.getTime());r>0;){var n=Le(t.getFullYear()),o=t.getMonth(),i=(n?Xr:Gr)[o];if(r>i-t.getDate())r-=i-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+r),t}return t},ua=(e,r)=>{I.set(e,r);},fa=(e,r,t,n)=>{var o=$[n+40>>2],i={tm_sec:E[n>>2],tm_min:E[n+4>>2],tm_hour:E[n+8>>2],tm_mday:E[n+12>>2],tm_mon:E[n+16>>2],tm_year:E[n+20>>2],tm_wday:E[n+24>>2],tm_yday:E[n+28>>2],tm_isdst:E[n+32>>2],tm_gmtoff:E[n+36>>2],tm_zone:o?ie(o):""},s=ie(t),l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in l)s=s.replace(new RegExp(u,"g"),l[u]);var d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],v=["January","February","March","April","May","June","July","August","September","October","November","December"];function y(c,m,M){for(var k=typeof c=="number"?c.toString():c||"";k.length<m;)k=M[0]+k;return k}function p(c,m){return y(c,m,"0")}function h(c,m){function M(H){return H<0?-1:H>0?1:0}var k;return (k=M(c.getFullYear()-m.getFullYear()))===0&&(k=M(c.getMonth()-m.getMonth()))===0&&(k=M(c.getDate()-m.getDate())),k}function g(c){switch(c.getDay()){case 0:return new Date(c.getFullYear()-1,11,29);case 1:return c;case 2:return new Date(c.getFullYear(),0,3);case 3:return new Date(c.getFullYear(),0,2);case 4:return new Date(c.getFullYear(),0,1);case 5:return new Date(c.getFullYear()-1,11,31);case 6:return new Date(c.getFullYear()-1,11,30)}}function D(c){var m=la(new Date(c.tm_year+1900,0,1),c.tm_yday),M=new Date(m.getFullYear(),0,4),k=new Date(m.getFullYear()+1,0,4),H=g(M),R=g(k);return h(H,m)<=0?h(R,m)<=0?m.getFullYear()+1:m.getFullYear():m.getFullYear()-1}var A={"%a":c=>d[c.tm_wday].substring(0,3),"%A":c=>d[c.tm_wday],"%b":c=>v[c.tm_mon].substring(0,3),"%B":c=>v[c.tm_mon],"%C":c=>{var m=c.tm_year+1900;return p(m/100|0,2)},"%d":c=>p(c.tm_mday,2),"%e":c=>y(c.tm_mday,2," "),"%g":c=>D(c).toString().substring(2),"%G":D,"%H":c=>p(c.tm_hour,2),"%I":c=>{var m=c.tm_hour;return m==0?m=12:m>12&&(m-=12),p(m,2)},"%j":c=>p(c.tm_mday+sa(Le(c.tm_year+1900)?Xr:Gr,c.tm_mon-1),3),"%m":c=>p(c.tm_mon+1,2),"%M":c=>p(c.tm_min,2),"%n":()=>`
|
|
5
|
-
`,"%p":c=>c.tm_hour>=0&&c.tm_hour<12?"AM":"PM","%S":c=>p(c.tm_sec,2),"%t":()=>" ","%u":c=>c.tm_wday||7,"%U":c=>{var m=c.tm_yday+7-c.tm_wday;return p(Math.floor(m/7),2)},"%V":c=>{var m=Math.floor((c.tm_yday+7-(c.tm_wday+6)%7)/7);if((c.tm_wday+371-c.tm_yday-2)%7<=2&&m++,m){if(m==53){var k=(c.tm_wday+371-c.tm_yday)%7;k!=4&&(k!=3||!Le(c.tm_year))&&(m=1);}}else {m=52;var M=(c.tm_wday+7-c.tm_yday-1)%7;(M==4||M==5&&Le(c.tm_year%400-1))&&m++;}return p(m,2)},"%w":c=>c.tm_wday,"%W":c=>{var m=c.tm_yday+7-(c.tm_wday+6)%7;return p(Math.floor(m/7),2)},"%y":c=>(c.tm_year+1900).toString().substring(2),"%Y":c=>c.tm_year+1900,"%z":c=>{var m=c.tm_gmtoff,M=m>=0;return m=Math.abs(m)/60,m=m/60*100+m%60,(M?"+":"-")+("0000"+m).slice(-4)},"%Z":c=>c.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var u in A)s.includes(u)&&(s=s.replace(new RegExp(u,"g"),A[u](i)));s=s.replace(/\0\0/g,"%");var T=He(s,false);return T.length>r?0:(ua(T,e),T.length-1)},da=(e,r,t,n,o)=>fa(e,r,t,n);Ar=f.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError";}},_t(),he=f.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError";}},Rt(),Dt(),Wt(),Hr=f.UnboundTypeError=Nt(Error,"UnboundTypeError"),Kt(),a.createPreloadedFile=Qn,a.staticInit();var ca={a:ht,p:yt,N:gt,C:wt,L:bt,n:Vt,A:qt,y:Xt,K:Qt,j:en,b:rn,w:nn,f:an,i:sn,e:ln,v:fn,r:yn,O:gn,s:wn,M:_n,o:En,z:$n,c:sr,P:kn,l:Fn,q:Sn,x:An,g:Rn,m:Mn,k:On,h:jn,d:In,t:Un,J:Bn,H:Hn,E:Nn,F:Vn,I:ea,G:ta,B:aa,u:ia,D:da},B=vt(),pr=e=>(pr=B.S)(e),Z=e=>(Z=B.U)(e),Kr=e=>(Kr=B.V)(e),Jr=e=>(Jr=B.W)(e);f.dynCall_ji=(e,r)=>(f.dynCall_ji=B.X)(e,r);f.dynCall_iij=(e,r,t,n)=>(f.dynCall_iij=B.Y)(e,r,t,n);f.dynCall_jiji=(e,r,t,n,o)=>(f.dynCall_jiji=B.Z)(e,r,t,n,o);f.dynCall_viijii=(e,r,t,n,o,i,s)=>(f.dynCall_viijii=B._)(e,r,t,n,o,i,s);f.dynCall_iiiiij=(e,r,t,n,o,i,s)=>(f.dynCall_iiiiij=B.$)(e,r,t,n,o,i,s);f.dynCall_iiiiijj=(e,r,t,n,o,i,s,l,u)=>(f.dynCall_iiiiijj=B.aa)(e,r,t,n,o,i,s,l,u);f.dynCall_iiiiiijj=(e,r,t,n,o,i,s,l,u,d)=>(f.dynCall_iiiiiijj=B.ba)(e,r,t,n,o,i,s,l,u,d);var ze;ge=function e(){ze||Qr(),ze||(ge=e);};function Qr(){if(ae>0||(at(),ae>0))return;function e(){ze||(ze=true,f.calledRun=true,!gr&&(ot(),_(f),f.onRuntimeInitialized&&f.onRuntimeInitialized(),it()));}f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("");},1),e();},1)):e();}if(f.preInit)for(typeof f.preInit=="function"&&(f.preInit=[f.preInit]);f.preInit.length>0;)f.preInit.pop()();return Qr(),P.ready})})(),et=Ea;var Te=class{options;module=null;decoderInstance=null;constructor(P){this.options=P;}async initialize(){if(this.module)return;let P={};this.options?.locateFile&&(P.locateFile=this.options.locateFile),this.options?.wasmBinary&&(P.wasmBinary=this.options.wasmBinary),this.module=await et(P),this.decoderInstance=new this.module.HeicDecoder;}async decode(P,f){(!this.module||!this.decoderInstance)&&await this.initialize();let _=this.decoderInstance.decode(P,f||null);if(!_)throw new Error("HEIC decoding failed");if(typeof _=="string")throw new Error(`HEIC decoding failed: ${_}`);let O=_.width,z=_.height,G=new Uint8ClampedArray(_.data.buffer,_.data.byteOffset,_.data.byteLength);return {width:O,height:z,data:G}}free(){this.decoderInstance&&(this.decoderInstance.delete(),this.decoderInstance=null),this.module=null;}};async function ba(S){if(typeof FileReader<"u")return new Promise((P,f)=>{let _=new FileReader;_.onloadend=()=>{typeof _.result=="string"?P(_.result):f(new Error("Failed to convert Blob to base64 string"));},_.onerror=()=>f(_.error),_.readAsDataURL(S);});try{let P=await S.arrayBuffer(),f=Buffer.from(P);return `data:${S.type};base64,${f.toString("base64")}`}catch(P){throw new Error(`Failed to convert Blob to base64 string: ${P instanceof Error?P.message:String(P)}`,{cause:P})}}function yr(S,P,f){return "convertToBlob"in S?S.convertToBlob({type:P,quality:f}):new Promise((_,O)=>{S.toBlob(z=>{z?_(z):O(new Error("Failed to convert canvas to blob"));},P,f);})}async function rt(S,P,f){let{width:_,height:O,data:z}=S,G=_*O*4;if(z.length!==G)throw new Error(`Image data length mismatch. Expected ${G} bytes for ${_}x${O}, got ${z.length}`);let N;if(typeof OffscreenCanvas<"u")N=new OffscreenCanvas(_,O);else if(typeof document<"u")N=document.createElement("canvas"),N.width=_,N.height=O;else throw new Error("Canvas is not supported in the current environment. Conversion requires a browser environment or canvas polyfills.");let ee=N.getContext("2d");if(!ee)throw new Error("Failed to acquire 2D rendering context from canvas");let fe;if(typeof ImageData<"u")fe=new ImageData(z,_,O);else {let K=ee.createImageData(_,O);K.data.set(z),fe=K;}ee.putImageData(fe,0,0);let V=P.toLowerCase();if(V==="png")return yr(N,"image/png");if(V==="jpeg"||V==="jpg")return yr(N,"image/jpeg",f);if(V==="svg"){let K=await yr(N,"image/png"),L=await ba(K),Ne=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${_} ${O}" width="${_}" height="${O}">
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
`));if(!e)return null;Ze=xe(e,true);}return Ze.shift()},fe={ttys:[],init(){},shutdown(){},register(e,r){fe.ttys[e]={input:[],output:[],ops:r},o.registerDevice(e,fe.stream_ops);},stream_ops:{open(e){var r=fe.ttys[e.node.rdev];if(!r)throw new o.ErrnoError(43);e.tty=r,e.seekable=false;},close(e){e.tty.ops.fsync(e.tty);},fsync(e){e.tty.ops.fsync(e.tty);},read(e,r,t,n,i){if(!e.tty||!e.tty.ops.get_char)throw new o.ErrnoError(60);for(var a=0,s=0;s<n;s++){var l;try{l=e.tty.ops.get_char(e.tty);}catch{throw new o.ErrnoError(29)}if(l===void 0&&a===0)throw new o.ErrnoError(6);if(l==null)break;a++,r[t+s]=l;}return a&&(e.node.timestamp=Date.now()),a},write(e,r,t,n,i){if(!e.tty||!e.tty.ops.put_char)throw new o.ErrnoError(60);try{for(var a=0;a<n;a++)e.tty.ops.put_char(e.tty,r[t+a]);}catch{throw new o.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),a}},default_tty_ops:{get_char(e){return kt()},put_char(e,r){r===null||r===10?(Ge(_e(e.output,0)),e.output=[]):r!=0&&e.output.push(r);},fsync(e){e.output&&e.output.length>0&&(Ge(_e(e.output,0)),e.output=[]);},ioctl_tcgets(e){return {c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,r,t){return 0},ioctl_tiocgwinsz(e){return [24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(de(_e(e.output,0)),e.output=[]):r!=0&&e.output.push(r);},fsync(e){e.output&&e.output.length>0&&(de(_e(e.output,0)),e.output=[]);}}},Or=e=>{we();},$={ops_table:null,mount(e){return $.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(o.isBlkdev(t)||o.isFIFO(t))throw new o.ErrnoError(63);$.ops_table||={dir:{node:{getattr:$.node_ops.getattr,setattr:$.node_ops.setattr,lookup:$.node_ops.lookup,mknod:$.node_ops.mknod,rename:$.node_ops.rename,unlink:$.node_ops.unlink,rmdir:$.node_ops.rmdir,readdir:$.node_ops.readdir,symlink:$.node_ops.symlink},stream:{llseek:$.stream_ops.llseek}},file:{node:{getattr:$.node_ops.getattr,setattr:$.node_ops.setattr},stream:{llseek:$.stream_ops.llseek,read:$.stream_ops.read,write:$.stream_ops.write,allocate:$.stream_ops.allocate,mmap:$.stream_ops.mmap,msync:$.stream_ops.msync}},link:{node:{getattr:$.node_ops.getattr,setattr:$.node_ops.setattr,readlink:$.node_ops.readlink},stream:{}},chrdev:{node:{getattr:$.node_ops.getattr,setattr:$.node_ops.setattr},stream:o.chrdev_stream_ops}};var i=o.createNode(e,r,t,n);return o.isDir(i.mode)?(i.node_ops=$.ops_table.dir.node,i.stream_ops=$.ops_table.dir.stream,i.contents={}):o.isFile(i.mode)?(i.node_ops=$.ops_table.file.node,i.stream_ops=$.ops_table.file.stream,i.usedBytes=0,i.contents=null):o.isLink(i.mode)?(i.node_ops=$.ops_table.link.node,i.stream_ops=$.ops_table.link.stream):o.isChrdev(i.mode)&&(i.node_ops=$.ops_table.chrdev.node,i.stream_ops=$.ops_table.chrdev.stream),i.timestamp=Date.now(),e&&(e.contents[r]=i,e.timestamp=i.timestamp),i},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 i=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(i.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=o.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,o.isDir(e.mode)?r.size=4096:o.isFile(e.mode)?r.size=e.usedBytes:o.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&&$.resizeFileStorage(e,r.size);},lookup(e,r){throw o.genericErrors[44]},mknod(e,r,t,n){return $.createNode(e,r,t,n)},rename(e,r,t){if(o.isDir(e.mode)){var n;try{n=o.lookupNode(r,t);}catch{}if(n)for(var i in n.contents)throw new o.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=o.lookupNode(e,r);for(var n in t.contents)throw new o.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now();},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){var n=$.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!o.isLink(e.mode))throw new o.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,i){var a=e.node.contents;if(i>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-i,n);if(s>8&&a.subarray)r.set(a.subarray(i,i+s),t);else for(var l=0;l<s;l++)r[t+l]=a[i+l];return s},write(e,r,t,n,i,a){if(r.buffer===G.buffer&&(a=false),!n)return 0;var s=e.node;if(s.timestamp=Date.now(),r.subarray&&(!s.contents||s.contents.subarray)){if(a)return s.contents=r.subarray(t,t+n),s.usedBytes=n,n;if(s.usedBytes===0&&i===0)return s.contents=r.slice(t,t+n),s.usedBytes=n,n;if(i+n<=s.usedBytes)return s.contents.set(r.subarray(t,t+n),i),n}if($.expandFileStorage(s,i+n),s.contents.subarray&&r.subarray)s.contents.set(r.subarray(t,t+n),i);else for(var l=0;l<n;l++)s.contents[i+l]=r[t+l];return s.usedBytes=Math.max(s.usedBytes,i+n),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&o.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new o.ErrnoError(28);return n},allocate(e,r,t){$.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t);},mmap(e,r,t,n,i){if(!o.isFile(e.node.mode))throw new o.ErrnoError(43);var a,s,l=e.node.contents;if(!(i&2)&&l.buffer===G.buffer)s=false,a=l.byteOffset;else {if((t>0||t+r<l.length)&&(l.subarray?l=l.subarray(t,t+r):l=Array.prototype.slice.call(l,t,t+r)),s=true,a=Or(),!a)throw new o.ErrnoError(48);G.set(l,a);}return {ptr:a,allocated:s}},msync(e,r,t,n,i){return $.stream_ops.write(e,r,0,n,t,false),0}}},Ct=(e,r,t,n)=>{var i=`al ${e}`;te(e,a=>{r(new Uint8Array(a)),i&&Oe();},a=>{if(t)t();else throw `Loading data file "${e}" failed.`}),i&&Qe();},Pt=(e,r,t,n,i,a)=>{o.createDataFile(e,r,t,n,i,a);},Tt=u.preloadPlugins||[],Ft=(e,r,t,n)=>{typeof Browser<"u"&&Browser.init();var i=false;return Tt.forEach(a=>{i||a.canHandle(r)&&(a.handle(e,r,t,n),i=true);}),i},Dt=(e,r,t,n,i,a,s,l,d,f)=>{var m=r?se.resolve(x.join2(e,r)):e;function y(p){function b(R){f?.(),l||Pt(e,r,R,n,i,d),a?.(),Oe();}Ft(p,m,b,()=>{s?.(),Oe();})||b(p);}Qe(),typeof t=="string"?Ct(t,y,s):y(t);},St=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);return t},tr=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},o={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:class{constructor(e){this.name="ErrnoError",this.errno=e;}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={};}get object(){return this.node}set object(e){this.node=e;}get isRead(){return (this.flags&2097155)!==1}get isWrite(){return (this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e;}get position(){return this.shared.position}set position(e){this.shared.position=e;}},FSNode:class{constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=o.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n,this.readMode=365,this.writeMode=146;}get read(){return (this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode;}get write(){return (this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode;}get isFolder(){return o.isDir(this.mode)}get isDevice(){return o.isChrdev(this.mode)}},lookupPath(e,r={}){if(e=se.resolve(e),!e)return {path:"",node:null};var t={follow_mount:true,recurse_count:0};if(r=Object.assign(t,r),r.recurse_count>8)throw new o.ErrnoError(32);for(var n=e.split("/").filter(w=>!!w),i=o.root,a="/",s=0;s<n.length;s++){var l=s===n.length-1;if(l&&r.parent)break;if(i=o.lookupNode(i,n[s]),a=x.join2(a,n[s]),o.isMountpoint(i)&&(!l||l&&r.follow_mount)&&(i=i.mounted.root),!l||r.follow)for(var d=0;o.isLink(i.mode);){var f=o.readlink(a);a=se.resolve(x.dirname(a),f);var m=o.lookupPath(a,{recurse_count:r.recurse_count+1});if(i=m.node,d++>40)throw new o.ErrnoError(32)}}return {path:a,node:i}},getPath(e){for(var r;;){if(o.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)%o.nameTable.length},hashAddNode(e){var r=o.hashName(e.parent.id,e.name);e.name_next=o.nameTable[r],o.nameTable[r]=e;},hashRemoveNode(e){var r=o.hashName(e.parent.id,e.name);if(o.nameTable[r]===e)o.nameTable[r]=e.name_next;else for(var t=o.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next;}},lookupNode(e,r){var t=o.mayLookup(e);if(t)throw new o.ErrnoError(t);for(var n=o.hashName(e.id,r),i=o.nameTable[n];i;i=i.name_next){var a=i.name;if(i.parent.id===e.id&&a===r)return i}return o.lookup(e,r)},createNode(e,r,t,n){var i=new o.FSNode(e,r,t,n);return o.hashAddNode(i),i},destroyNode(e){o.hashRemoveNode(e);},isRoot(e){return e===e.parent},isMountpoint(e){return !!e.mounted},isFile(e){return (e&61440)===32768},isDir(e){return (e&61440)===16384},isLink(e){return (e&61440)===40960},isChrdev(e){return (e&61440)===8192},isBlkdev(e){return (e&61440)===24576},isFIFO(e){return (e&61440)===4096},isSocket(e){return (e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return o.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!o.isDir(e.mode))return 54;var r=o.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){try{var t=o.lookupNode(e,r);return 20}catch{}return o.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=o.lookupNode(e,r);}catch(a){return a.errno}var i=o.nodePermissions(e,"wx");if(i)return i;if(t){if(!o.isDir(n.mode))return 54;if(o.isRoot(n)||o.getPath(n)===o.cwd())return 10}else if(o.isDir(n.mode))return 31;return 0},mayOpen(e,r){return e?o.isLink(e.mode)?32:o.isDir(e.mode)&&(o.flagsToPermissionString(r)!=="r"||r&512)?31:o.nodePermissions(e,o.flagsToPermissionString(r)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=o.MAX_OPEN_FDS;e++)if(!o.streams[e])return e;throw new o.ErrnoError(33)},getStreamChecked(e){var r=o.getStream(e);if(!r)throw new o.ErrnoError(8);return r},getStream:e=>o.streams[e],createStream(e,r=-1){return e=Object.assign(new o.FSStream,e),r==-1&&(r=o.nextfd()),e.fd=r,o.streams[r]=e,e},closeStream(e){o.streams[e]=null;},dupStream(e,r=-1){var t=o.createStream(e,r);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(e){var r=o.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e);},llseek(){throw new o.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){o.devices[e]={stream_ops:r};},getDevice:e=>o.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts);}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=false),o.syncFSRequests++,o.syncFSRequests>1&&de(`warning: ${o.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=o.getMounts(o.root.mount),n=0;function i(s){return o.syncFSRequests--,r(s)}function a(s){if(s)return a.errored?void 0:(a.errored=true,i(s));++n>=t.length&&i(null);}t.forEach(s=>{if(!s.type.syncfs)return a(null);s.type.syncfs(s,e,a);});},mount(e,r,t){var n=t==="/",i=!t,a;if(n&&o.root)throw new o.ErrnoError(10);if(!n&&!i){var s=o.lookupPath(t,{follow_mount:false});if(t=s.path,a=s.node,o.isMountpoint(a))throw new o.ErrnoError(10);if(!o.isDir(a.mode))throw new o.ErrnoError(54)}var l={type:e,opts:r,mountpoint:t,mounts:[]},d=e.mount(l);return d.mount=l,l.root=d,n?o.root=d:a&&(a.mounted=l,a.mount&&a.mount.mounts.push(l)),d},unmount(e){var r=o.lookupPath(e,{follow_mount:false});if(!o.isMountpoint(r.node))throw new o.ErrnoError(28);var t=r.node,n=t.mounted,i=o.getMounts(n);Object.keys(o.nameTable).forEach(s=>{for(var l=o.nameTable[s];l;){var d=l.name_next;i.includes(l.mount)&&o.destroyNode(l),l=d;}}),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1);},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var n=o.lookupPath(e,{parent:true}),i=n.node,a=x.basename(e);if(!a||a==="."||a==="..")throw new o.ErrnoError(28);var s=o.mayCreate(i,a);if(s)throw new o.ErrnoError(s);if(!i.node_ops.mknod)throw new o.ErrnoError(63);return i.node_ops.mknod(i,a,r,t)},create(e,r){return r=r!==void 0?r:438,r&=4095,r|=32768,o.mknod(e,r,0)},mkdir(e,r){return r=r!==void 0?r:511,r&=1023,r|=16384,o.mknod(e,r,0)},mkdirTree(e,r){for(var t=e.split("/"),n="",i=0;i<t.length;++i)if(t[i]){n+="/"+t[i];try{o.mkdir(n,r);}catch(a){if(a.errno!=20)throw a}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,o.mknod(e,r,t)},symlink(e,r){if(!se.resolve(e))throw new o.ErrnoError(44);var t=o.lookupPath(r,{parent:true}),n=t.node;if(!n)throw new o.ErrnoError(44);var i=x.basename(r),a=o.mayCreate(n,i);if(a)throw new o.ErrnoError(a);if(!n.node_ops.symlink)throw new o.ErrnoError(63);return n.node_ops.symlink(n,i,e)},rename(e,r){var t=x.dirname(e),n=x.dirname(r),i=x.basename(e),a=x.basename(r),s,l,d;if(s=o.lookupPath(e,{parent:true}),l=s.node,s=o.lookupPath(r,{parent:true}),d=s.node,!l||!d)throw new o.ErrnoError(44);if(l.mount!==d.mount)throw new o.ErrnoError(75);var f=o.lookupNode(l,i),m=se.relative(e,n);if(m.charAt(0)!==".")throw new o.ErrnoError(28);if(m=se.relative(r,t),m.charAt(0)!==".")throw new o.ErrnoError(55);var w;try{w=o.lookupNode(d,a);}catch{}if(f!==w){var y=o.isDir(f.mode),p=o.mayDelete(l,i,y);if(p)throw new o.ErrnoError(p);if(p=w?o.mayDelete(d,a,y):o.mayCreate(d,a),p)throw new o.ErrnoError(p);if(!l.node_ops.rename)throw new o.ErrnoError(63);if(o.isMountpoint(f)||w&&o.isMountpoint(w))throw new o.ErrnoError(10);if(d!==l&&(p=o.nodePermissions(l,"w"),p))throw new o.ErrnoError(p);o.hashRemoveNode(f);try{l.node_ops.rename(f,d,a);}catch(b){throw b}finally{o.hashAddNode(f);}}},rmdir(e){var r=o.lookupPath(e,{parent:true}),t=r.node,n=x.basename(e),i=o.lookupNode(t,n),a=o.mayDelete(t,n,true);if(a)throw new o.ErrnoError(a);if(!t.node_ops.rmdir)throw new o.ErrnoError(63);if(o.isMountpoint(i))throw new o.ErrnoError(10);t.node_ops.rmdir(t,n),o.destroyNode(i);},readdir(e){var r=o.lookupPath(e,{follow:true}),t=r.node;if(!t.node_ops.readdir)throw new o.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var r=o.lookupPath(e,{parent:true}),t=r.node;if(!t)throw new o.ErrnoError(44);var n=x.basename(e),i=o.lookupNode(t,n),a=o.mayDelete(t,n,false);if(a)throw new o.ErrnoError(a);if(!t.node_ops.unlink)throw new o.ErrnoError(63);if(o.isMountpoint(i))throw new o.ErrnoError(10);t.node_ops.unlink(t,n),o.destroyNode(i);},readlink(e){var r=o.lookupPath(e),t=r.node;if(!t)throw new o.ErrnoError(44);if(!t.node_ops.readlink)throw new o.ErrnoError(28);return se.resolve(o.getPath(t.parent),t.node_ops.readlink(t))},stat(e,r){var t=o.lookupPath(e,{follow:!r}),n=t.node;if(!n)throw new o.ErrnoError(44);if(!n.node_ops.getattr)throw new o.ErrnoError(63);return n.node_ops.getattr(n)},lstat(e){return o.stat(e,true)},chmod(e,r,t){var n;if(typeof e=="string"){var i=o.lookupPath(e,{follow:!t});n=i.node;}else n=e;if(!n.node_ops.setattr)throw new o.ErrnoError(63);n.node_ops.setattr(n,{mode:r&4095|n.mode&-4096,timestamp:Date.now()});},lchmod(e,r){o.chmod(e,r,true);},fchmod(e,r){var t=o.getStreamChecked(e);o.chmod(t.node,r);},chown(e,r,t,n){var i;if(typeof e=="string"){var a=o.lookupPath(e,{follow:!n});i=a.node;}else i=e;if(!i.node_ops.setattr)throw new o.ErrnoError(63);i.node_ops.setattr(i,{timestamp:Date.now()});},lchown(e,r,t){o.chown(e,r,t,true);},fchown(e,r,t){var n=o.getStreamChecked(e);o.chown(n.node,r,t);},truncate(e,r){if(r<0)throw new o.ErrnoError(28);var t;if(typeof e=="string"){var n=o.lookupPath(e,{follow:true});t=n.node;}else t=e;if(!t.node_ops.setattr)throw new o.ErrnoError(63);if(o.isDir(t.mode))throw new o.ErrnoError(31);if(!o.isFile(t.mode))throw new o.ErrnoError(28);var i=o.nodePermissions(t,"w");if(i)throw new o.ErrnoError(i);t.node_ops.setattr(t,{size:r,timestamp:Date.now()});},ftruncate(e,r){var t=o.getStreamChecked(e);if((t.flags&2097155)===0)throw new o.ErrnoError(28);o.truncate(t.node,r);},utime(e,r,t){var n=o.lookupPath(e,{follow:true}),i=n.node;i.node_ops.setattr(i,{timestamp:Math.max(r,t)});},open(e,r,t){if(e==="")throw new o.ErrnoError(44);r=typeof r=="string"?St(r):r,t=typeof t>"u"?438:t,r&64?t=t&4095|32768:t=0;var n;if(typeof e=="object")n=e;else {e=x.normalize(e);try{var i=o.lookupPath(e,{follow:!(r&131072)});n=i.node;}catch{}}var a=false;if(r&64)if(n){if(r&128)throw new o.ErrnoError(20)}else n=o.mknod(e,t,0),a=true;if(!n)throw new o.ErrnoError(44);if(o.isChrdev(n.mode)&&(r&=-513),r&65536&&!o.isDir(n.mode))throw new o.ErrnoError(54);if(!a){var s=o.mayOpen(n,r);if(s)throw new o.ErrnoError(s)}r&512&&!a&&o.truncate(n,0),r&=-131713;var l=o.createStream({node:n,path:o.getPath(n),flags:r,seekable:true,position:0,stream_ops:n.stream_ops,ungotten:[],error:false});return l.stream_ops.open&&l.stream_ops.open(l),u.logReadFiles&&!(r&1)&&(o.readFiles||(o.readFiles={}),e in o.readFiles||(o.readFiles[e]=1)),l},close(e){if(o.isClosed(e))throw new o.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e);}catch(r){throw r}finally{o.closeStream(e.fd);}e.fd=null;},isClosed(e){return e.fd===null},llseek(e,r,t){if(o.isClosed(e))throw new o.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new o.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new o.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,i){if(n<0||i<0)throw new o.ErrnoError(28);if(o.isClosed(e))throw new o.ErrnoError(8);if((e.flags&2097155)===1)throw new o.ErrnoError(8);if(o.isDir(e.node.mode))throw new o.ErrnoError(31);if(!e.stream_ops.read)throw new o.ErrnoError(28);var a=typeof i<"u";if(!a)i=e.position;else if(!e.seekable)throw new o.ErrnoError(70);var s=e.stream_ops.read(e,r,t,n,i);return a||(e.position+=s),s},write(e,r,t,n,i,a){if(n<0||i<0)throw new o.ErrnoError(28);if(o.isClosed(e))throw new o.ErrnoError(8);if((e.flags&2097155)===0)throw new o.ErrnoError(8);if(o.isDir(e.node.mode))throw new o.ErrnoError(31);if(!e.stream_ops.write)throw new o.ErrnoError(28);e.seekable&&e.flags&1024&&o.llseek(e,0,2);var s=typeof i<"u";if(!s)i=e.position;else if(!e.seekable)throw new o.ErrnoError(70);var l=e.stream_ops.write(e,r,t,n,i,a);return s||(e.position+=l),l},allocate(e,r,t){if(o.isClosed(e))throw new o.ErrnoError(8);if(r<0||t<=0)throw new o.ErrnoError(28);if((e.flags&2097155)===0)throw new o.ErrnoError(8);if(!o.isFile(e.node.mode)&&!o.isDir(e.node.mode))throw new o.ErrnoError(43);if(!e.stream_ops.allocate)throw new o.ErrnoError(138);e.stream_ops.allocate(e,r,t);},mmap(e,r,t,n,i){if((n&2)!==0&&(i&2)===0&&(e.flags&2097155)!==2)throw new o.ErrnoError(2);if((e.flags&2097155)===1)throw new o.ErrnoError(2);if(!e.stream_ops.mmap)throw new o.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,i)},msync(e,r,t,n,i){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,i):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new o.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=o.open(e,r.flags),i=o.stat(e),a=i.size,s=new Uint8Array(a);return o.read(n,s,0,a,0),r.encoding==="utf8"?t=_e(s,0):r.encoding==="binary"&&(t=s),o.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=o.open(e,t.flags,t.mode);if(typeof r=="string"){var i=new Uint8Array(er(r)+1),a=rr(r,i,0,i.length);o.write(n,i,0,a,void 0,t.canOwn);}else if(ArrayBuffer.isView(r))o.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");o.close(n);},cwd:()=>o.currentPath,chdir(e){var r=o.lookupPath(e,{follow:true});if(r.node===null)throw new o.ErrnoError(44);if(!o.isDir(r.node.mode))throw new o.ErrnoError(54);var t=o.nodePermissions(r.node,"x");if(t)throw new o.ErrnoError(t);o.currentPath=r.path;},createDefaultDirectories(){o.mkdir("/tmp"),o.mkdir("/home"),o.mkdir("/home/web_user");},createDefaultDevices(){o.mkdir("/dev"),o.registerDevice(o.makedev(1,3),{read:()=>0,write:(n,i,a,s,l)=>s}),o.mkdev("/dev/null",o.makedev(1,3)),fe.register(o.makedev(5,0),fe.default_tty_ops),fe.register(o.makedev(6,0),fe.default_tty1_ops),o.mkdev("/dev/tty",o.makedev(5,0)),o.mkdev("/dev/tty1",o.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(r=Rr(e).byteLength),e[--r]);o.createDevice("/dev","random",t),o.createDevice("/dev","urandom",t),o.mkdir("/dev/shm"),o.mkdir("/dev/shm/tmp");},createSpecialDirectories(){o.mkdir("/proc");var e=o.mkdir("/proc/self");o.mkdir("/proc/self/fd"),o.mount({mount(){var r=o.createNode(e,"fd",16895,73);return r.node_ops={lookup(t,n){var i=+n,a=o.getStreamChecked(i),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>a.path}};return s.parent=s,s}},r}},{},"/proc/self/fd");},createStandardStreams(){u.stdin?o.createDevice("/dev","stdin",u.stdin):o.symlink("/dev/tty","/dev/stdin"),u.stdout?o.createDevice("/dev","stdout",null,u.stdout):o.symlink("/dev/tty","/dev/stdout"),u.stderr?o.createDevice("/dev","stderr",null,u.stderr):o.symlink("/dev/tty1","/dev/stderr");o.open("/dev/stdin",0);o.open("/dev/stdout",1);o.open("/dev/stderr",1);},staticInit(){[44].forEach(e=>{o.genericErrors[e]=new o.ErrnoError(e),o.genericErrors[e].stack="<generic error, no stack>";}),o.nameTable=new Array(4096),o.mount($,{},"/"),o.createDefaultDirectories(),o.createDefaultDevices(),o.createSpecialDirectories(),o.filesystems={MEMFS:$};},init(e,r,t){o.init.initialized=true,u.stdin=e||u.stdin,u.stdout=r||u.stdout,u.stderr=t||u.stderr,o.createStandardStreams();},quit(){o.init.initialized=false;for(var e=0;e<o.streams.length;e++){var r=o.streams[e];r&&o.close(r);}},findObject(e,r){var t=o.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=o.lookupPath(e,{follow:!r});e=t.path;}catch{}var n={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var t=o.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=x.basename(e),t=o.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(i){n.error=i.errno;}return n},createPath(e,r,t,n){e=typeof e=="string"?e:o.getPath(e);for(var i=r.split("/").reverse();i.length;){var a=i.pop();if(a){var s=x.join2(e,a);try{o.mkdir(s);}catch{}e=s;}}return s},createFile(e,r,t,n,i){var a=x.join2(typeof e=="string"?e:o.getPath(e),r),s=tr(n,i);return o.create(a,s)},createDataFile(e,r,t,n,i,a){var s=r;e&&(e=typeof e=="string"?e:o.getPath(e),s=r?x.join2(e,r):e);var l=tr(n,i),d=o.create(s,l);if(t){if(typeof t=="string"){for(var f=new Array(t.length),m=0,w=t.length;m<w;++m)f[m]=t.charCodeAt(m);t=f;}o.chmod(d,l|146);var y=o.open(d,577);o.write(y,t,0,t.length,0,a),o.close(y),o.chmod(d,l);}},createDevice(e,r,t,n){var i=x.join2(typeof e=="string"?e:o.getPath(e),r),a=tr(!!t,!!n);o.createDevice.major||(o.createDevice.major=64);var s=o.makedev(o.createDevice.major++,0);return o.registerDevice(s,{open(l){l.seekable=false;},close(l){n?.buffer?.length&&n(10);},read(l,d,f,m,w){for(var y=0,p=0;p<m;p++){var b;try{b=t();}catch{throw new o.ErrnoError(29)}if(b===void 0&&y===0)throw new o.ErrnoError(6);if(b==null)break;y++,d[f+p]=b;}return y&&(l.node.timestamp=Date.now()),y},write(l,d,f,m,w){for(var y=0;y<m;y++)try{n(d[f+y]);}catch{throw new o.ErrnoError(29)}return m&&(l.node.timestamp=Date.now()),y}}),o.mkdev(i,a,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return true;if(typeof XMLHttpRequest<"u")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(z)try{e.contents=xe(z(e.url),!0),e.usedBytes=e.contents.length;}catch{throw new o.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(e,r,t,n,i){class a{constructor(){this.lengthKnown=false,this.chunks=[];}get(p){if(!(p>this.length-1||p<0)){var b=p%this.chunkSize,R=p/this.chunkSize|0;return this.getter(R)[b]}}setDataGetter(p){this.getter=p;}cacheLength(){var p=new XMLHttpRequest;if(p.open("HEAD",t,false),p.send(null),!(p.status>=200&&p.status<300||p.status===304))throw new Error("Couldn't load "+t+". Status: "+p.status);var b=Number(p.getResponseHeader("Content-length")),R,W=(R=p.getResponseHeader("Accept-Ranges"))&&R==="bytes",A=(R=p.getResponseHeader("Content-Encoding"))&&R==="gzip",c=1024*1024;W||(c=b);var g=(T,Z)=>{if(T>Z)throw new Error("invalid range ("+T+", "+Z+") or no bytes requested!");if(Z>b-1)throw new Error("only "+b+" bytes available! programmer error!");var j=new XMLHttpRequest;if(j.open("GET",t,false),b!==c&&j.setRequestHeader("Range","bytes="+T+"-"+Z),j.responseType="arraybuffer",j.overrideMimeType&&j.overrideMimeType("text/plain; charset=x-user-defined"),j.send(null),!(j.status>=200&&j.status<300||j.status===304))throw new Error("Couldn't load "+t+". Status: "+j.status);return j.response!==void 0?new Uint8Array(j.response||[]):xe(j.responseText||"",true)},B=this;B.setDataGetter(T=>{var Z=T*c,j=(T+1)*c-1;if(j=Math.min(j,b-1),typeof B.chunks[T]>"u"&&(B.chunks[T]=g(Z,j)),typeof B.chunks[T]>"u")throw new Error("doXHR failed!");return B.chunks[T]}),(A||!b)&&(c=b=1,b=this.getter(0).length,c=b,Ge("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=b,this._chunkSize=c,this.lengthKnown=true;}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!O)throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new a,l={isDevice:false,contents:s};}else var l={isDevice:false,url:t};var d=o.createFile(e,r,l,n,i);l.contents?d.contents=l.contents:l.url&&(d.contents=null,d.url=l.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var f={},m=Object.keys(d.stream_ops);m.forEach(y=>{var p=d.stream_ops[y];f[y]=(...b)=>(o.forceLoadFile(d),p(...b));});function w(y,p,b,R,W){var A=y.node.contents;if(W>=A.length)return 0;var c=Math.min(A.length-W,R);if(A.slice)for(var g=0;g<c;g++)p[b+g]=A[W+g];else for(var g=0;g<c;g++)p[b+g]=A.get(W+g);return c}return f.read=(y,p,b,R,W)=>(o.forceLoadFile(d),w(y,p,b,R,W)),f.mmap=(y,p,b,R,W)=>{o.forceLoadFile(d);var A=Or();if(!A)throw new o.ErrnoError(48);return w(y,G,A,p,b),{ptr:A,allocated:true}},d.stream_ops=f,d}},oe={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(x.isAbs(r))return r;var n;if(e===-100)n=o.cwd();else {var i=oe.getStreamFromFD(e);n=i.path;}if(r.length==0){if(!t)throw new o.ErrnoError(44);return n}return x.join2(n,r)},doStat(e,r,t){var n=e(r);k[t>>2]=n.dev,k[t+4>>2]=n.mode,P[t+8>>2]=n.nlink,k[t+12>>2]=n.uid,k[t+16>>2]=n.gid,k[t+20>>2]=n.rdev,q=[n.size>>>0,(C=n.size,+Math.abs(C)>=1?C>0?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)],k[t+24>>2]=q[0],k[t+28>>2]=q[1],k[t+32>>2]=4096,k[t+36>>2]=n.blocks;var i=n.atime.getTime(),a=n.mtime.getTime(),s=n.ctime.getTime();return q=[Math.floor(i/1e3)>>>0,(C=Math.floor(i/1e3),+Math.abs(C)>=1?C>0?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)],k[t+40>>2]=q[0],k[t+44>>2]=q[1],P[t+48>>2]=i%1e3*1e3,q=[Math.floor(a/1e3)>>>0,(C=Math.floor(a/1e3),+Math.abs(C)>=1?C>0?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)],k[t+56>>2]=q[0],k[t+60>>2]=q[1],P[t+64>>2]=a%1e3*1e3,q=[Math.floor(s/1e3)>>>0,(C=Math.floor(s/1e3),+Math.abs(C)>=1?C>0?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)],k[t+72>>2]=q[0],k[t+76>>2]=q[1],P[t+80>>2]=s%1e3*1e3,q=[n.ino>>>0,(C=n.ino,+Math.abs(C)>=1?C>0?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)],k[t+88>>2]=q[0],k[t+92>>2]=q[1],0},doMsync(e,r,t,n,i){if(!o.isFile(r.node.mode))throw new o.ErrnoError(43);if(n&2)return 0;var a=Q.slice(e,e+t);o.msync(r,a,i,t,n);},varargs:void 0,get(){var e=k[+oe.varargs>>2];return oe.varargs+=4,e},getp(){return oe.get()},getStr(e){var r=me(e);return r},getStreamFromFD(e){var r=o.getStreamChecked(e);return r}};function At(e,r,t){try{return r=oe.getStr(r),r=oe.calculateAt(e,r),t===0?o.unlink(r):t===512?o.rmdir(r):we("Invalid flags passed to unlinkat"),0}catch(n){if(typeof o>"u"||n.name!=="ErrnoError")throw n;return -n.errno}}var We={},nr=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r);}};function Pe(e){return this.fromWireType(P[e>>2])}var be={},he={},Ue={},xr,je=e=>{throw new xr(e)},pe=(e,r,t)=>{e.forEach(function(l){Ue[l]=r;});function n(l){var d=t(l);d.length!==e.length&&je("Mismatched type converter count");for(var f=0;f<e.length;++f)ie(e[f],d[f]);}var i=new Array(r.length),a=[],s=0;r.forEach((l,d)=>{he.hasOwnProperty(l)?i[d]=he[l]:(a.push(l),be.hasOwnProperty(l)||(be[l]=[]),be[l].push(()=>{i[d]=he[l],++s,s===a.length&&n(i);}));}),a.length===0&&n(i);},Mt=e=>{var r=We[e];delete We[e];var t=r.rawConstructor,n=r.rawDestructor,i=r.fields,a=i.map(s=>s.getterReturnType).concat(i.map(s=>s.setterArgumentType));pe([e],a,s=>{var l={};return i.forEach((d,f)=>{var m=d.fieldName,w=s[f],y=d.getter,p=d.getterContext,b=s[f+i.length],R=d.setter,W=d.setterContext;l[m]={read:A=>w.fromWireType(y(p,A)),write:(A,c)=>{var g=[];R(W,A,b.toWireType(g,c)),nr(g);}};}),[{name:r.name,fromWireType:d=>{var f={};for(var m in l)f[m]=l[m].read(d);return n(d),f},toWireType:(d,f)=>{for(var m in l)if(!(m in f))throw new TypeError(`Missing field: "${m}"`);var w=t();for(m in l)l[m].write(w,f[m]);return d!==null&&d.push(n,w),w},argPackAdvance:ae,readValueFromPointer:Pe,destructorFunction:n}]});},It=(e,r,t,n,i)=>{},Rt=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);Wr=e;},Wr,K=e=>{for(var r="",t=e;Q[t];)r+=Wr[Q[t++]];return r},Ee,S=e=>{throw new Ee(e)};function Ot(e,r,t={}){var n=r.name;if(e||S(`type "${n}" must have a positive integer typeid pointer`),he.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;S(`Cannot register type '${n}' twice`);}if(he[e]=r,delete Ue[e],be.hasOwnProperty(e)){var i=be[e];delete be[e],i.forEach(a=>a());}}function ie(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return Ot(e,r,t)}var ae=8,xt=(e,r,t,n)=>{r=K(r),ie(e,{name:r,fromWireType:function(i){return !!i},toWireType:function(i,a){return a?t:n},argPackAdvance:ae,readValueFromPointer:function(i){return this.fromWireType(Q[i])},destructorFunction:null});},Wt=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),or=e=>{function r(t){return t.$$.ptrType.registeredClass.name}S(r(e)+" instance already deleted");},ir=false,Ur=e=>{},Ut=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr);},jr=e=>{e.count.value-=1;var r=e.count.value===0;r&&Ut(e);},Hr=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=Hr(e,r,t.baseClass);return n===null?null:t.downcast(n)},Br={},jt=()=>Object.keys(De).length,Ht=()=>{var e=[];for(var r in De)De.hasOwnProperty(r)&&e.push(De[r]);return e},Te=[],ar=()=>{for(;Te.length;){var e=Te.pop();e.$$.deleteScheduled=false,e.delete();}},Fe,Bt=e=>{Fe=e,Te.length&&Fe&&Fe(ar);},Lt=()=>{u.getInheritedInstanceCount=jt,u.getLiveInheritedInstances=Ht,u.flushPendingDeletes=ar,u.setDelayFunction=Bt;},De={},Nt=(e,r)=>{for(r===void 0&&S("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},zt=(e,r)=>(r=Nt(e,r),De[r]),He=(e,r)=>{(!r.ptrType||!r.ptr)&&je("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&je("Both smartPtrType and smartPtr must be specified"),r.count={value:1},Se(Object.create(e,{$$:{value:r,writable:true}}))};function Vt(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=zt(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 i(){return this.isSmartPointer?He(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):He(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a=this.registeredClass.getActualType(r),s=Br[a];if(!s)return i.call(this);var l;this.isConst?l=s.constPointerType:l=s.pointerType;var d=Hr(r,this.registeredClass,l.registeredClass);return d===null?i.call(this):this.isSmartPointer?He(l.registeredClass.instancePrototype,{ptrType:l,ptr:d,smartPtrType:this,smartPtr:e}):He(l.registeredClass.instancePrototype,{ptrType:l,ptr:d})}var Se=e=>typeof FinalizationRegistry>"u"?(Se=r=>r,e):(ir=new FinalizationRegistry(r=>{jr(r.$$);}),Se=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var i={$$:t};ir.register(r,i,r);}return r},Ur=r=>ir.unregister(r),Se(e)),Yt=()=>{Object.assign(Be.prototype,{isAliasOf(e){if(!(this instanceof Be)||!(e instanceof Be))return false;var r=this.$$.ptrType.registeredClass,t=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,i=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)i=n.upcast(i),n=n.baseClass;return r===n&&t===i},clone(){if(this.$$.ptr||or(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Se(Object.create(Object.getPrototypeOf(this),{$$:{value:Wt(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=false,e},delete(){this.$$.ptr||or(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&S("Object already scheduled for deletion"),Ur(this),jr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0);},isDeleted(){return !this.$$.ptr},deleteLater(){return this.$$.ptr||or(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&S("Object already scheduled for deletion"),Te.push(this),Te.length===1&&Fe&&Fe(ar),this.$$.deleteScheduled=true,this}});};function Be(){}var Ae=(e,r)=>Object.defineProperty(r,"name",{value:e}),Lr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...i){return e[r].overloadTable.hasOwnProperty(i.length)||S(`Function '${t}' called with an invalid number of arguments (${i.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[i.length].apply(this,i)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n;}},sr=(e,r,t)=>{u.hasOwnProperty(e)?((t===void 0||u[e].overloadTable!==void 0&&u[e].overloadTable[t]!==void 0)&&S(`Cannot register public name '${e}' twice`),Lr(u,e,e),u.hasOwnProperty(t)&&S(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),u[e].overloadTable[t]=r):(u[e]=r,t!==void 0&&(u[e].numArguments=t));},qt=48,Xt=57,Gt=e=>{if(e===void 0)return "_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=qt&&r<=Xt?`_${e}`:e};function Kt(e,r,t,n,i,a,s,l){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=i,this.getActualType=a,this.upcast=s,this.downcast=l,this.pureVirtualFunctions=[];}var lr=(e,r,t)=>{for(;r!==t;)r.upcast||S(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function Qt(e,r){if(r===null)return this.isReference&&S(`null is not a valid ${this.name}`),0;r.$$||S(`Cannot pass "${mr(r)}" as a ${this.name}`),r.$$.ptr||S(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=lr(r.$$.ptr,t,this.registeredClass);return n}function Jt(e,r){var t;if(r===null)return this.isReference&&S(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&S(`Cannot pass "${mr(r)}" as a ${this.name}`),r.$$.ptr||S(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&S(`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=lr(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&S("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:S(`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 i=r.clone();t=this.rawShare(t,J.toHandle(()=>i.delete())),e!==null&&e.push(this.rawDestructor,t);}break;default:S("Unsupporting sharing policy");}return t}function Zt(e,r){if(r===null)return this.isReference&&S(`null is not a valid ${this.name}`),0;r.$$||S(`Cannot pass "${mr(r)}" as a ${this.name}`),r.$$.ptr||S(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&S(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=lr(r.$$.ptr,t,this.registeredClass);return n}var en=()=>{Object.assign(Le.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e);},argPackAdvance:ae,readValueFromPointer:Pe,fromWireType:Vt});};function Le(e,r,t,n,i,a,s,l,d,f,m){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=i,this.pointeeType=a,this.sharingPolicy=s,this.rawGetPointee=l,this.rawConstructor=d,this.rawShare=f,this.rawDestructor=m,!i&&r.baseClass===void 0?n?(this.toWireType=Qt,this.destructorFunction=null):(this.toWireType=Zt,this.destructorFunction=null):this.toWireType=Jt;}var Nr=(e,r,t)=>{u.hasOwnProperty(e)||je("Replacing nonexistent public symbol"),u[e].overloadTable!==void 0&&t!==void 0?u[e].overloadTable[t]=r:(u[e]=r,u[e].argCount=t);},rn=(e,r,t)=>{var n=u["dynCall_"+e];return n(r,...t)},Ne=[],zr,Vr=e=>{var r=Ne[e];return r||(e>=Ne.length&&(Ne.length=e+1),Ne[e]=r=zr.get(e)),r},tn=(e,r,t=[])=>{if(e.includes("j"))return rn(e,r,t);var n=Vr(r)(...t);return n},nn=(e,r)=>(...t)=>tn(e,r,t),ee=(e,r)=>{e=K(e);function t(){return e.includes("j")?nn(e,r):Vr(r)}var n=t();return typeof n!="function"&&S(`unknown function pointer with signature ${e}: ${r}`),n},on=(e,r)=>{var t=Ae(r,function(n){this.name=r,this.message=n;var i=new Error(n).stack;i!==void 0&&(this.stack=this.toString()+`
|
|
4
|
+
`+i.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},Yr,qr=e=>{var r=Zr(e),t=K(r);return ue(r),t},ze=(e,r)=>{var t=[],n={};function i(a){if(!n[a]&&!he[a]){if(Ue[a]){Ue[a].forEach(i);return}t.push(a),n[a]=true;}}throw r.forEach(i),new Yr(`${e}: `+t.map(qr).join([", "]))},an=(e,r,t,n,i,a,s,l,d,f,m,w,y)=>{m=K(m),a=ee(i,a),l&&=ee(s,l),f&&=ee(d,f),y=ee(w,y);var p=Gt(m);sr(p,function(){ze(`Cannot construct ${m} due to unbound types`,[n]);}),pe([e,r,t],n?[n]:[],b=>{b=b[0];var R,W;n?(R=b.registeredClass,W=R.instancePrototype):W=Be.prototype;var A=Ae(m,function(...j){if(Object.getPrototypeOf(this)!==c)throw new Ee("Use 'new' to construct "+m);if(g.constructor_body===void 0)throw new Ee(m+" has no accessible constructor");var tt=g.constructor_body[j.length];if(tt===void 0)throw new Ee(`Tried to invoke ctor of ${m} with invalid number of parameters (${j.length}) - expected (${Object.keys(g.constructor_body).toString()}) parameters instead!`);return tt.apply(this,j)}),c=Object.create(W,{constructor:{value:A}});A.prototype=c;var g=new Kt(m,A,c,y,R,a,l,f);g.baseClass&&(g.baseClass.__derivedClasses??=[],g.baseClass.__derivedClasses.push(g));var B=new Le(m,g,true,false,false),T=new Le(m+"*",g,false,false,false),Z=new Le(m+" const*",g,false,true,false);return Br[e]={pointerType:T,constPointerType:Z},Nr(p,A),[B,T,Z]});},ur=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(P[r+n*4>>2]);return t};function sn(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return true;return false}function dr(e,r,t,n,i,a){var s=r.length;s<2&&S("argTypes array size mismatch! Must at least get return value and 'this' types!");var l=r[1]!==null&&t!==null,d=sn(r),f=r[0].name!=="void",m=s-2,w=new Array(m),y=[],p=[],b=function(...R){R.length!==m&&S(`function ${e} called with ${R.length} arguments, expected ${m}`),p.length=0;var W;y.length=l?2:1,y[0]=i,l&&(W=r[1].toWireType(p,this),y[1]=W);for(var A=0;A<m;++A)w[A]=r[A+2].toWireType(p,R[A]),y.push(w[A]);var c=n(...y);function g(B){if(d)nr(p);else for(var T=l?1:2;T<r.length;T++){var Z=T===1?W:w[T-2];r[T].destructorFunction!==null&&r[T].destructorFunction(Z);}if(f)return r[0].fromWireType(B)}return g(c)};return Ae(e,b)}var ln=(e,r,t,n,i,a)=>{var s=ur(r,t);i=ee(n,i),pe([],[e],l=>{l=l[0];var d=`constructor ${l.name}`;if(l.registeredClass.constructor_body===void 0&&(l.registeredClass.constructor_body=[]),l.registeredClass.constructor_body[r-1]!==void 0)throw new Ee(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${l.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return l.registeredClass.constructor_body[r-1]=()=>{ze(`Cannot construct ${l.name} due to unbound types`,s);},pe([],s,f=>(f.splice(1,0,null),l.registeredClass.constructor_body[r-1]=dr(d,f,null,i,a),[])),[]});},Xr=e=>{e=e.trim();let r=e.indexOf("(");return r!==-1?e.substr(0,r):e},un=(e,r,t,n,i,a,s,l,d)=>{var f=ur(t,n);r=K(r),r=Xr(r),a=ee(i,a),pe([],[e],m=>{m=m[0];var w=`${m.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),l&&m.registeredClass.pureVirtualFunctions.push(r);function y(){ze(`Cannot call ${w} due to unbound types`,f);}var p=m.registeredClass.instancePrototype,b=p[r];return b===void 0||b.overloadTable===void 0&&b.className!==m.name&&b.argCount===t-2?(y.argCount=t-2,y.className=m.name,p[r]=y):(Lr(p,r,w),p[r].overloadTable[t-2]=y),pe([],f,R=>{var W=dr(w,R,m,a,s);return p[r].overloadTable===void 0?(W.argCount=t-2,p[r]=W):p[r].overloadTable[t-2]=W,[]}),[]});},fr=[],le=[],cr=e=>{e>9&&--le[e+1]===0&&(le[e]=void 0,fr.push(e));},dn=()=>le.length/2-5-fr.length,fn=()=>{le.push(0,1,void 0,1,null,1,true,1,false,1),u.count_emval_handles=dn;},J={toValue:e=>(e||S("Cannot use deleted val. handle = "+e),le[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case true:return 6;case false:return 8;default:{let r=fr.pop()||le.length;return le[r]=e,le[r+1]=1,r}}}},cn={name:"emscripten::val",fromWireType:e=>{var r=J.toValue(e);return cr(e),r},toWireType:(e,r)=>J.toHandle(r),argPackAdvance:ae,readValueFromPointer:Pe,destructorFunction:null},vn=e=>ie(e,cn),mn=(e,r,t)=>{switch(r){case 1:return t?function(n){return this.fromWireType(G[n])}:function(n){return this.fromWireType(Q[n])};case 2:return t?function(n){return this.fromWireType(ye[n>>1])}:function(n){return this.fromWireType(ke[n>>1])};case 4:return t?function(n){return this.fromWireType(k[n>>2])}:function(n){return this.fromWireType(P[n>>2])};default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},hn=(e,r,t,n)=>{r=K(r);function i(){}i.values={},ie(e,{name:r,constructor:i,fromWireType:function(a){return this.constructor.values[a]},toWireType:(a,s)=>s.value,argPackAdvance:ae,readValueFromPointer:mn(r,t,n),destructorFunction:null}),sr(r,i);},vr=(e,r)=>{var t=he[e];return t===void 0&&S(`${r} has unknown type ${qr(e)}`),t},pn=(e,r,t)=>{var n=vr(e,"enum");r=K(r);var i=n.constructor,a=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:Ae(`${n.name}_${r}`,function(){})}});i.values[t]=a,i[r]=a;},mr=e=>{if(e===null)return "null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},gn=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(Er[t>>2])};case 8:return function(t){return this.fromWireType($r[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},yn=(e,r,t)=>{r=K(r),ie(e,{name:r,fromWireType:n=>n,toWireType:(n,i)=>i,argPackAdvance:ae,readValueFromPointer:gn(r,t),destructorFunction:null});},wn=(e,r,t,n,i,a,s)=>{var l=ur(r,t);e=K(e),e=Xr(e),i=ee(n,i),sr(e,function(){ze(`Cannot call ${e} due to unbound types`,l);},r-1),pe([],l,d=>{var f=[d[0],null].concat(d.slice(1));return Nr(e,dr(e,f,null,i,a),r-1),[]});},_n=(e,r,t)=>{switch(r){case 1:return t?n=>G[n]:n=>Q[n];case 2:return t?n=>ye[n>>1]:n=>ke[n>>1];case 4:return t?n=>k[n>>2]:n=>P[n>>2];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},bn=(e,r,t,n,i)=>{r=K(r);var a=m=>m;if(n===0){var s=32-8*t;a=m=>m<<s>>>s;}var l=r.includes("unsigned"),d=(m,w)=>{},f;l?f=function(m,w){return d(w,this.name),w>>>0}:f=function(m,w){return d(w,this.name),w},ie(e,{name:r,fromWireType:a,toWireType:f,argPackAdvance:ae,readValueFromPointer:_n(r,t,n!==0),destructorFunction:null});},En=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],i=n[r];function a(s){var l=P[s>>2],d=P[s+4>>2];return new i(G.buffer,d,l)}t=K(t),ie(e,{name:t,fromWireType:a,argPackAdvance:ae,readValueFromPointer:a},{ignoreDuplicateRegistrations:true});},$n=(e,r,t)=>rr(e,Q,r,t),kn=(e,r)=>{r=K(r);var t=r==="std::string";ie(e,{name:r,fromWireType(n){var i=P[n>>2],a=n+4,s;if(t)for(var l=a,d=0;d<=i;++d){var f=a+d;if(d==i||Q[f]==0){var m=f-l,w=me(l,m);s===void 0?s=w:(s+="\0",s+=w),l=f+1;}}else {for(var y=new Array(i),d=0;d<i;++d)y[d]=String.fromCharCode(Q[a+d]);s=y.join("");}return ue(n),s},toWireType(n,i){i instanceof ArrayBuffer&&(i=new Uint8Array(i));var a,s=typeof i=="string";s||i instanceof Uint8Array||i instanceof Uint8ClampedArray||i instanceof Int8Array||S("Cannot pass non-string to std::string"),t&&s?a=er(i):a=i.length;var l=gr(4+a+1),d=l+4;if(P[l>>2]=a,t&&s)$n(i,d,a+1);else if(s)for(var f=0;f<a;++f){var m=i.charCodeAt(f);m>255&&(ue(d),S("String has UTF-16 code units that do not fit in 8 bits")),Q[d+f]=m;}else for(var f=0;f<a;++f)Q[d+f]=i[f];return n!==null&&n.push(ue,l),l},argPackAdvance:ae,readValueFromPointer:Pe,destructorFunction(n){ue(n);}});},Gr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,Cn=(e,r)=>{for(var t=e,n=t>>1,i=n+r/2;!(n>=i)&&ke[n];)++n;if(t=n<<1,t-e>32&&Gr)return Gr.decode(Q.subarray(e,t));for(var a="",s=0;!(s>=r/2);++s){var l=ye[e+s*2>>1];if(l==0)break;a+=String.fromCharCode(l);}return a},Pn=(e,r,t)=>{if(t??=2147483647,t<2)return 0;t-=2;for(var n=r,i=t<e.length*2?t/2:e.length,a=0;a<i;++a){var s=e.charCodeAt(a);ye[r>>1]=s,r+=2;}return ye[r>>1]=0,r-n},Tn=e=>e.length*2,Fn=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var i=k[e+t*4>>2];if(i==0)break;if(++t,i>=65536){var a=i-65536;n+=String.fromCharCode(55296|a>>10,56320|a&1023);}else n+=String.fromCharCode(i);}return n},Dn=(e,r,t)=>{if(t??=2147483647,t<4)return 0;for(var n=r,i=n+t-4,a=0;a<e.length;++a){var s=e.charCodeAt(a);if(s>=55296&&s<=57343){var l=e.charCodeAt(++a);s=65536+((s&1023)<<10)|l&1023;}if(k[r>>2]=s,r+=4,r+4>i)break}return k[r>>2]=0,r-n},Sn=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},An=(e,r,t)=>{t=K(t);var n,i,a,s;r===2?(n=Cn,i=Pn,s=Tn,a=l=>ke[l>>1]):r===4&&(n=Fn,i=Dn,s=Sn,a=l=>P[l>>2]),ie(e,{name:t,fromWireType:l=>{for(var d=P[l>>2],f,m=l+4,w=0;w<=d;++w){var y=l+4+w*r;if(w==d||a(y)==0){var p=y-m,b=n(m,p);f===void 0?f=b:(f+="\0",f+=b),m=y+r;}}return ue(l),f},toWireType:(l,d)=>{typeof d!="string"&&S(`Cannot pass non-string to C++ string type ${t}`);var f=s(d),m=gr(4+f+r);return P[m>>2]=f/r,i(d,m+4,f+r),l!==null&&l.push(ue,m),m},argPackAdvance:ae,readValueFromPointer:Pe,destructorFunction(l){ue(l);}});},Mn=(e,r,t,n,i,a)=>{We[e]={name:K(r),rawConstructor:ee(t,n),rawDestructor:ee(i,a),fields:[]};},In=(e,r,t,n,i,a,s,l,d,f)=>{We[e].fields.push({fieldName:K(r),getterReturnType:t,getter:ee(n,i),getterContext:a,setterArgumentType:s,setter:ee(l,d),setterContext:f});},Rn=(e,r)=>{r=K(r),ie(e,{isVoid:true,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}});},Ve=[],On=(e,r,t,n)=>(e=Ve[e],r=J.toValue(r),e(null,r,t,n)),xn={},hr=e=>{var r=xn[e];return r===void 0?K(e):r},Wn=(e,r,t,n,i)=>(e=Ve[e],r=J.toValue(r),t=hr(t),e(r,r[t],n,i)),Kr=()=>{if(typeof globalThis=="object")return globalThis;function e(r){r.$$$embind_global$$$=r;var t=typeof $$$embind_global$$$=="object"&&r.$$$embind_global$$$==r;return t||delete r.$$$embind_global$$$,t}if(typeof $$$embind_global$$$=="object"||(typeof global=="object"&&e(global)?$$$embind_global$$$=global:typeof self=="object"&&e(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},Un=e=>e===0?J.toHandle(Kr()):(e=hr(e),J.toHandle(Kr()[e])),jn=e=>{var r=Ve.length;return Ve.push(e),r},Hn=(e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=vr(P[r+n*4>>2],"parameter "+n);return t},Bn=Reflect.construct,Ln=(e,r,t)=>{var n=[],i=e.toWireType(n,t);return n.length&&(P[r>>2]=J.toHandle(n)),i},Nn=(e,r,t)=>{var n=Hn(e,r),i=n.shift();e--;var a=new Array(e),s=(d,f,m,w)=>{for(var y=0,p=0;p<e;++p)a[p]=n[p].readValueFromPointer(w+y),y+=n[p].argPackAdvance;var b=t===1?Bn(f,a):f.apply(d,a);return Ln(i,m,b)},l=`methodCaller<(${n.map(d=>d.name).join(", ")}) => ${i.name}>`;return jn(Ae(l,s))},zn=e=>{e>9&&(le[e+1]+=1);},Vn=()=>J.toHandle([]),Yn=e=>J.toHandle(hr(e)),qn=()=>J.toHandle({}),Xn=e=>{var r=J.toValue(e);nr(r),cr(e);},Gn=(e,r,t)=>{e=J.toValue(e),r=J.toValue(r),t=J.toValue(t),e[r]=t;},Kn=(e,r)=>{e=vr(e,"_emval_take_value");var t=e.readValueFromPointer(r);return J.toHandle(t)},Qn=()=>{we("");},Jn=(e,r,t)=>Q.copyWithin(e,r,r+t),Zn=()=>2147483648,eo=e=>{var r=Re.buffer,t=(e-r.byteLength+65535)/65536;try{return Re.grow(t),kr(),1}catch{}},ro=e=>{var r=Q.length;e>>>=0;var t=Zn();if(e>t)return false;for(var n=(d,f)=>d+(f-d%f)%f,i=1;i<=4;i*=2){var a=r*(1+.2/i);a=Math.min(a,e+100663296);var s=Math.min(t,n(Math.max(e,a),65536)),l=eo(s);if(l)return true}return false},pr={},to=()=>L||"./this.program",Me=()=>{if(!Me.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,_:to()};for(var t in pr)pr[t]===void 0?delete r[t]:r[t]=pr[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);Me.strings=n;}return Me.strings},no=(e,r)=>{for(var t=0;t<e.length;++t)G[r++]=e.charCodeAt(t);G[r]=0;},oo=(e,r)=>{var t=0;return Me().forEach((n,i)=>{var a=r+t;P[e+i*4>>2]=a,no(n,a),t+=n.length+1;}),0},io=(e,r)=>{var t=Me();P[e>>2]=t.length;var n=0;return t.forEach(i=>n+=i.length+1),P[r>>2]=n,0};function ao(e){try{var r=oe.getStreamFromFD(e);return o.close(r),0}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var so=(e,r,t,n)=>{for(var i=0,a=0;a<t;a++){var s=P[r>>2],l=P[r+4>>2];r+=8;var d=o.read(e,G,s,l,n);if(d<0)return -1;if(i+=d,d<l)break;}return i};function lo(e,r,t,n){try{var i=oe.getStreamFromFD(e),a=so(i,r,t);return P[n>>2]=a,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var uo=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN;function fo(e,r,t,n,i){var a=uo(r,t);try{if(isNaN(a))return 61;var s=oe.getStreamFromFD(e);return o.llseek(s,a,n),q=[s.position>>>0,(C=s.position,+Math.abs(C)>=1?C>0?+Math.floor(C/4294967296)>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)],k[i>>2]=q[0],k[i+4>>2]=q[1],s.getdents&&a===0&&n===0&&(s.getdents=null),0}catch(l){if(typeof o>"u"||l.name!=="ErrnoError")throw l;return l.errno}}var co=(e,r,t,n)=>{for(var i=0,a=0;a<t;a++){var s=P[r>>2],l=P[r+4>>2];r+=8;var d=o.write(e,G,s,l,n);if(d<0)return -1;i+=d;}return i};function vo(e,r,t,n){try{var i=oe.getStreamFromFD(e),a=co(i,r,t);return P[n>>2]=a,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var Ye=e=>e%4===0&&(e%100!==0||e%400===0),mo=(e,r)=>{for(var t=0,n=0;n<=r;t+=e[n++]);return t},Qr=[31,29,31,30,31,30,31,31,30,31,30,31],Jr=[31,28,31,30,31,30,31,31,30,31,30,31],ho=(e,r)=>{for(var t=new Date(e.getTime());r>0;){var n=Ye(t.getFullYear()),i=t.getMonth(),a=(n?Qr:Jr)[i];if(r>a-t.getDate())r-=a-t.getDate()+1,t.setDate(1),i<11?t.setMonth(i+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+r),t}return t},po=(e,r)=>{G.set(e,r);},go=(e,r,t,n)=>{var i=P[n+40>>2],a={tm_sec:k[n>>2],tm_min:k[n+4>>2],tm_hour:k[n+8>>2],tm_mday:k[n+12>>2],tm_mon:k[n+16>>2],tm_year:k[n+20>>2],tm_wday:k[n+24>>2],tm_yday:k[n+28>>2],tm_isdst:k[n+32>>2],tm_gmtoff:k[n+36>>2],tm_zone:i?me(i):""},s=me(t),l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var d in l)s=s.replace(new RegExp(d,"g"),l[d]);var f=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],m=["January","February","March","April","May","June","July","August","September","October","November","December"];function w(c,g,B){for(var T=typeof c=="number"?c.toString():c||"";T.length<g;)T=B[0]+T;return T}function y(c,g){return w(c,g,"0")}function p(c,g){function B(Z){return Z<0?-1:Z>0?1:0}var T;return (T=B(c.getFullYear()-g.getFullYear()))===0&&(T=B(c.getMonth()-g.getMonth()))===0&&(T=B(c.getDate()-g.getDate())),T}function b(c){switch(c.getDay()){case 0:return new Date(c.getFullYear()-1,11,29);case 1:return c;case 2:return new Date(c.getFullYear(),0,3);case 3:return new Date(c.getFullYear(),0,2);case 4:return new Date(c.getFullYear(),0,1);case 5:return new Date(c.getFullYear()-1,11,31);case 6:return new Date(c.getFullYear()-1,11,30)}}function R(c){var g=ho(new Date(c.tm_year+1900,0,1),c.tm_yday),B=new Date(g.getFullYear(),0,4),T=new Date(g.getFullYear()+1,0,4),Z=b(B),j=b(T);return p(Z,g)<=0?p(j,g)<=0?g.getFullYear()+1:g.getFullYear():g.getFullYear()-1}var W={"%a":c=>f[c.tm_wday].substring(0,3),"%A":c=>f[c.tm_wday],"%b":c=>m[c.tm_mon].substring(0,3),"%B":c=>m[c.tm_mon],"%C":c=>{var g=c.tm_year+1900;return y(g/100|0,2)},"%d":c=>y(c.tm_mday,2),"%e":c=>w(c.tm_mday,2," "),"%g":c=>R(c).toString().substring(2),"%G":R,"%H":c=>y(c.tm_hour,2),"%I":c=>{var g=c.tm_hour;return g==0?g=12:g>12&&(g-=12),y(g,2)},"%j":c=>y(c.tm_mday+mo(Ye(c.tm_year+1900)?Qr:Jr,c.tm_mon-1),3),"%m":c=>y(c.tm_mon+1,2),"%M":c=>y(c.tm_min,2),"%n":()=>`
|
|
5
|
+
`,"%p":c=>c.tm_hour>=0&&c.tm_hour<12?"AM":"PM","%S":c=>y(c.tm_sec,2),"%t":()=>" ","%u":c=>c.tm_wday||7,"%U":c=>{var g=c.tm_yday+7-c.tm_wday;return y(Math.floor(g/7),2)},"%V":c=>{var g=Math.floor((c.tm_yday+7-(c.tm_wday+6)%7)/7);if((c.tm_wday+371-c.tm_yday-2)%7<=2&&g++,g){if(g==53){var T=(c.tm_wday+371-c.tm_yday)%7;T!=4&&(T!=3||!Ye(c.tm_year))&&(g=1);}}else {g=52;var B=(c.tm_wday+7-c.tm_yday-1)%7;(B==4||B==5&&Ye(c.tm_year%400-1))&&g++;}return y(g,2)},"%w":c=>c.tm_wday,"%W":c=>{var g=c.tm_yday+7-(c.tm_wday+6)%7;return y(Math.floor(g/7),2)},"%y":c=>(c.tm_year+1900).toString().substring(2),"%Y":c=>c.tm_year+1900,"%z":c=>{var g=c.tm_gmtoff,B=g>=0;return g=Math.abs(g)/60,g=g/60*100+g%60,(B?"+":"-")+("0000"+g).slice(-4)},"%Z":c=>c.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var d in W)s.includes(d)&&(s=s.replace(new RegExp(d,"g"),W[d](a)));s=s.replace(/\0\0/g,"%");var A=xe(s,false);return A.length>r?0:(po(A,e),A.length-1)},yo=(e,r,t,n,i)=>go(e,r,t,n);o.createPreloadedFile=Dt,o.staticInit(),xr=u.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError";}},Rt(),Ee=u.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError";}},Yt(),Lt(),en(),Yr=u.UnboundTypeError=on(Error,"UnboundTypeError"),fn();var wo={a:wt,m:Et,F:At,O:Mt,C:It,M:xt,o:an,A:ln,y:un,L:vn,j:hn,b:pn,x:yn,e:wn,i:bn,f:En,w:kn,r:An,P:Mn,t:In,N:Rn,p:On,z:Wn,c:cr,Q:Un,l:Nn,q:zn,s:Vn,h:Yn,n:qn,k:Xn,g:Gn,d:Kn,u:Qn,K:Jn,E:ro,I:oo,J:io,G:ao,H:lo,B:fo,v:vo,D:yo},V=yt(),gr=e=>(gr=V.T)(e),ue=e=>(ue=V.V)(e),Zr=e=>(Zr=V.W)(e),et=e=>(et=V.X)(e);u.dynCall_ji=(e,r)=>(u.dynCall_ji=V.Y)(e,r);u.dynCall_iij=(e,r,t,n)=>(u.dynCall_iij=V.Z)(e,r,t,n);u.dynCall_jijj=(e,r,t,n,i,a)=>(u.dynCall_jijj=V._)(e,r,t,n,i,a);u.dynCall_vijj=(e,r,t,n,i,a)=>(u.dynCall_vijj=V.$)(e,r,t,n,i,a);u.dynCall_jiji=(e,r,t,n,i)=>(u.dynCall_jiji=V.aa)(e,r,t,n,i);u.dynCall_viijii=(e,r,t,n,i,a,s)=>(u.dynCall_viijii=V.ba)(e,r,t,n,i,a,s);u.dynCall_iiiiij=(e,r,t,n,i,a,s)=>(u.dynCall_iiiiij=V.ca)(e,r,t,n,i,a,s);u.dynCall_iiiiijj=(e,r,t,n,i,a,s,l,d)=>(u.dynCall_iiiiijj=V.da)(e,r,t,n,i,a,s,l,d);u.dynCall_iiiiiijj=(e,r,t,n,i,a,s,l,d,f)=>(u.dynCall_iiiiiijj=V.ea)(e,r,t,n,i,a,s,l,d,f);var qe;Ce=function e(){qe||rt(),qe||(Ce=e);};function rt(){if(ce>0||(ut(),ce>0))return;function e(){qe||(qe=true,u.calledRun=true,!br&&(dt(),_(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),ft()));}u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("");},1),e();},1)):e();}if(u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();return rt(),h.ready})})(),nt=So;var Ie=class{options;module=null;decoderInstance=null;initPromise=null;constructor(h){this.options=h;}async initialize(){if(!this.initPromise){let h={};this.options?.locateFile&&(h.locateFile=this.options.locateFile),this.options?.wasmBinary&&(h.wasmBinary=this.options.wasmBinary),this.initPromise=nt(h).then(u=>(this.module=u,this.decoderInstance=new u.HeicDecoder,u)).catch(u=>{throw this.initPromise=null,u});}await this.initPromise;}async decode(h,u){(!this.module||!this.decoderInstance)&&await this.initialize();let _=this.decoderInstance.decode(h,u??null);if(!_)throw new Error(F.DecodeFailed);if(typeof _=="string")throw new Error(F.DecodeFailedWithDetail(_));let E=_.width,D=_.height,M=new Uint8ClampedArray(_.data);return {width:E,height:D,data:M}}free(){this.decoderInstance&&(this.decoderInstance.delete(),this.decoderInstance=null),this.module=null,this.initPromise=null;}};var yr=16384;function wr(v){if(!v)return;let{maxWidth:h,maxHeight:u,scale:_}=v;if(_!==void 0&&(typeof _!="number"||!Number.isFinite(_)||_<=0))throw new Error(F.ScaleInvalid(_));if(h!==void 0&&(typeof h!="number"||!Number.isFinite(h)||h<=0))throw new Error(F.MaxWidthInvalid(h));if(u!==void 0&&(typeof u!="number"||!Number.isFinite(u)||u<=0))throw new Error(F.MaxHeightInvalid(u))}function Ao(v,h,u){if(wr(u),!u)return {width:v,height:h};let{maxWidth:_,maxHeight:E,scale:D}=u;if(D!==void 0){let X=Math.max(1,Math.round(v*D)),O=Math.max(1,Math.round(h*D));return ot(X,O),{width:X,height:O}}if(_===void 0&&E===void 0)return {width:v,height:h};let M=Math.min(_!==void 0?_/v:Number.POSITIVE_INFINITY,E!==void 0?E/h:Number.POSITIVE_INFINITY);if(M>=1)return {width:v,height:h};let L=Math.min(Math.max(1,Math.round(v*M)),_!==void 0?Math.floor(_):Number.POSITIVE_INFINITY),I=Math.min(Math.max(1,Math.round(h*M)),E!==void 0?Math.floor(E):Number.POSITIVE_INFINITY);return ot(L,I),{width:L,height:I}}function ot(v,h){if(!Number.isFinite(v)||!Number.isFinite(h)||v>yr||h>yr)throw new Error(F.TargetSizeTooLarge(v,h,yr))}async function Mo(v){if(typeof FileReader<"u")return new Promise((h,u)=>{let _=new FileReader;_.onloadend=()=>{typeof _.result=="string"?h(_.result):u(new Error(F.BlobToBase64Failed));},_.onerror=()=>u(_.error),_.readAsDataURL(v);});try{let h=await v.arrayBuffer(),u=new Uint8Array(h),_="",E=32768;for(let M=0;M<u.length;M+=E)_+=String.fromCharCode(...u.subarray(M,M+E));let D=btoa(_);return `data:${v.type};base64,${D}`}catch(h){throw new Error(F.BlobToBase64FailedWithCause(h instanceof Error?h.message:String(h)),{cause:h})}}function Xe(v,h,u){return "convertToBlob"in v?v.convertToBlob({type:h,quality:u}):new Promise((_,E)=>{v.toBlob(D=>{D?_(D):E(new Error(F.CanvasToBlobFailed(h)));},h,u);})}function it(v,h){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(v,h);if(typeof document<"u"){let u=document.createElement("canvas");return u.width=v,u.height=h,u}throw new Error(F.CanvasUnsupported)}function Io(v){typeof v.close=="function"?v.close():v.width=0;}function at(v,h,u,_){if(typeof ImageData<"u")v.putImageData(new ImageData(h,u,_),0,0);else {let E=v.createImageData(u,_);E.data.set(h),v.putImageData(E,0,0);}}async function _r(v,h,u,_){let{width:E,height:D,data:M}=v;if(!Number.isInteger(E)||E<=0||!Number.isInteger(D)||D<=0)throw new Error(F.InvalidDimensions(E,D));let L=E*D*4;if(M.length!==L)throw new Error(F.DataLengthMismatch(L,E,D,M.length));let I=Ao(E,D,_),X=I.width!==E||I.height!==D,O=it(I.width,I.height),N=O.getContext("2d");if(!N)throw new Error(F.ContextUnavailable);if(X){let re=it(E,D),z=re.getContext("2d");if(!z)throw new Error(F.ContextUnavailable);at(z,M,E,D),N.drawImage(re,0,0,I.width,I.height),Io(re);}else at(N,M,E,D);let H=h.toLowerCase();if(H==="png")return Xe(O,"image/png");if(H==="jpeg"||H==="jpg")return Xe(O,"image/jpeg",u);if(H==="webp")return Xe(O,"image/webp",u);if(H==="svg"){let re=await Xe(O,"image/png"),z=await Mo(re),te=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${I.width} ${I.height}" width="${I.width}" height="${I.height}">
|
|
6
|
+
<image width="${I.width}" height="${I.height}" href="${z}" />
|
|
7
|
+
</svg>`;return new Blob([te],{type:"image/svg+xml"})}else throw new Error(F.UnsupportedFormat(h))}function Ro(v,h){return new Promise((u,_)=>{if(typeof Worker>"u"){_(new Error(F.WorkerUnsupported));return}let E;try{E=new Worker(h.workerUrl,h.workerType==="module"?{type:"module"}:void 0);}catch(U){_(new Error(F.WorkerCreateFailed(U instanceof Error?U.message:String(U)),{cause:U}));return}let D=h.timeoutMs??6e4,M;D>0&&(M=setTimeout(()=>{O(),_(new Error(F.WorkerTimeout));},D));let L=U=>{let Y=U.data;if(Y?.type==="progress"){try{let ne=Number(Y.percent);h.onProgress?.(Number.isFinite(ne)?Math.min(100,Math.max(0,ne)):0);}catch(ne){O(),_(ne instanceof Error?ne:new Error(String(ne)));}return}Y?.type==="result"&&(O(),Y.ok&&Y.blob?u(Y.blob):_(new Error(Y.error??F.WorkerConversionFailed)));},I=U=>{O();let Y=U.filename?` (${U.filename}:${U.lineno})`:"";_(new Error(`${U.message||F.WorkerFailed}${Y}`));},X=U=>{O();let Y=U.data;_(Y instanceof Error?Y:new Error(Y!==void 0?String(Y):F.WorkerFailed));},O=()=>{M!==void 0&&clearTimeout(M),E.removeEventListener("message",L),E.removeEventListener("messageerror",X),E.removeEventListener("error",I),E.terminate();};E.addEventListener("message",L),E.addEventListener("messageerror",X),E.addEventListener("error",I);let{workerUrl:N,decoder:H,onProgress:re,timeoutMs:z,workerType:te,...ge}=h;try{E.postMessage({input:v,options:ge});}catch(U){O(),_(new Error(F.WorkerPostFailed(U instanceof Error?U.message:String(U)),{cause:U}));}})}function ti(){}function Oo(v){if(typeof v!="number"||Number.isNaN(v)||v<0||v>1)throw new Error(F.QualityInvalid(v))}async function xo(v,h){h?.quality!==void 0&&Oo(h.quality);let u=h?.maxWidth!==void 0||h?.maxHeight!==void 0||h?.scale!==void 0?h:void 0;wr(u);let _;if(v instanceof Uint8Array)_=v;else if(v instanceof ArrayBuffer)_=new Uint8Array(v);else if(typeof Blob<"u"&&v instanceof Blob){let I=await v.arrayBuffer();_=new Uint8Array(I);}else throw new Error(F.UnsupportedInputType(Object.prototype.toString.call(v)));let E=h?.decoder??new Ie,D=!h?.decoder,M=false,L=()=>{if(!(!D||M)){M=true;try{E.free();}catch{}}};try{try{await E.initialize();}catch(N){throw new Error(F.DecoderInitFailed(N instanceof Error?N.message:String(N)),{cause:N})}let I=await E.decode(_,h?.onProgress);L();let X=h?.to||"jpeg",O=h?.quality!==void 0?h.quality:.92;try{return u?await _r(I,X,O,u):await _r(I,X,O)}catch(N){throw new Error(F.RenderEncodeFailed(X,N instanceof Error?N.message:String(N)),{cause:N})}}finally{L();}}async function ni(v,h){if(!Array.isArray(v))throw new Error(F.InputsMustBeArray);let u=h?.concurrency??4;if(!Number.isInteger(u)||u<1)throw new Error(F.ConcurrencyInvalid(u));let _=new Array(v.length),E=h?.onProgress,D=0,M=false,L=null,I=-1,X,O=new Promise(z=>{X=z;}),N=async()=>{for(;!M;){let z=D;if(D+=1,z>=v.length)return;try{_[z]=await xo(v[z],{...h,onProgress:E!==void 0?te=>E(z,te):void 0});}catch(te){M||(M=true,L=te,I=z,X?.());}}},H=Math.min(u,v.length),re=Array.from({length:H},()=>N());if(await Promise.race([Promise.all(re),O]),M){let z=L instanceof Error?L.message:String(L);throw new Error(F.ConvertManyItemFailed(I+1,v.length,z),{cause:L})}return _}exports.LibheifDecoder=Ie;exports.convertHeic=xo;exports.convertHeicInWorker=Ro;exports.convertMany=ni;exports.freeSharedDecoder=ti;
|