var qn=(()=>{var Zr=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(Qr={}){var d=Qr,re,cr;d.ready=new Promise((r,e)=>{re=r,cr=e});var ee=Object.assign({},d),te="./this.program",Ye=!0,I="";function qe(r){return d.locateFile?d.locateFile(r,I):I+r}var Or,ne;typeof document<"u"&&document.currentScript&&(I=document.currentScript.src),Zr&&(I=Zr),I.indexOf("blob:")!==0?I=I.substr(0,I.replace(/[?#].*/,"").lastIndexOf("/")+1):I="",Or=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},ne=(r,e,t)=>{var n=new XMLHttpRequest;n.open("GET",r,!0),n.responseType="arraybuffer",n.onload=()=>{if(n.status==200||n.status==0&&n.response){e(n.response);return}t()},n.onerror=t,n.send(null)};var jr=d.print||console.log.bind(console),V=d.printErr||console.error.bind(console);Object.assign(d,ee),ee=null,d.arguments&&d.arguments,d.thisProgram&&(te=d.thisProgram),d.quit&&d.quit;var nr;d.wasmBinary&&(nr=d.wasmBinary),d.noExitRuntime,typeof WebAssembly!="object"&&J("no native wasm support detected");var vr,oe=!1;function Xe(r,e){r||J(e)}var O,W,K,or,E,C,ae,ie;function se(){var r=vr.buffer;d.HEAP8=O=new Int8Array(r),d.HEAP16=K=new Int16Array(r),d.HEAPU8=W=new Uint8Array(r),d.HEAPU16=or=new Uint16Array(r),d.HEAP32=E=new Int32Array(r),d.HEAPU32=C=new Uint32Array(r),d.HEAPF32=ae=new Float32Array(r),d.HEAPF64=ie=new Float64Array(r)}var ue=[],le=[],fe=[];function Ge(){if(d.preRun)for(typeof d.preRun=="function"&&(d.preRun=[d.preRun]);d.preRun.length;)Ze(d.preRun.shift());Ur(ue)}function Ke(){!d.noFSInit&&!o.init.initialized&&o.init(),o.ignorePermissions=!1,Ur(le)}function Je(){if(d.postRun)for(typeof d.postRun=="function"&&(d.postRun=[d.postRun]);d.postRun.length;)rt(d.postRun.shift());Ur(fe)}function Ze(r){ue.unshift(r)}function Qe(r){le.unshift(r)}function rt(r){fe.unshift(r)}var q=0,ar=null;function Yn(r){return r}function Wr(r){q++,d.monitorRunDependencies&&d.monitorRunDependencies(q)}function hr(r){if(q--,d.monitorRunDependencies&&d.monitorRunDependencies(q),q==0&&ar){var e=ar;ar=null,e()}}function J(r){d.onAbort&&d.onAbort(r),r="Aborted("+r+")",V(r),oe=!0,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw cr(e),e}var et="data:application/octet-stream;base64,";function de(r){return r.startsWith(et)}var Z;Z="process.wasm",de(Z)||(Z=qe(Z));function ce(r){if(r==Z&&nr)return new Uint8Array(nr);throw"both async and sync fetching of the wasm failed"}function tt(r){return!nr&&Ye&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(e=>{if(!e.ok)throw"failed to load wasm binary file at '"+r+"'";return e.arrayBuffer()}).catch(()=>ce(r)):Promise.resolve().then(()=>ce(r))}function ve(r,e,t){return tt(r).then(n=>WebAssembly.instantiate(n,e)).then(n=>n).then(t,n=>{V(`failed to asynchronously prepare wasm: ${n}`),J(n)})}function nt(r,e,t,n){return!r&&typeof WebAssembly.instantiateStreaming=="function"&&!de(e)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(a=>{var i=WebAssembly.instantiateStreaming(a,t);return i.then(n,function(s){return V(`wasm streaming compile failed: ${s}`),V("falling back to ArrayBuffer instantiation"),ve(e,t,n)})}):ve(e,t,n)}function ot(){var r={a:Vn};function e(n,a){return M=n.exports,vr=M.K,se(),Pe=M.O,Qe(M.L),hr(),M}Wr();function t(n){e(n.instance)}if(d.instantiateWasm)try{return d.instantiateWasm(r,e)}catch(n){V(`Module.instantiateWasm callback failed with error: ${n}`),cr(n)}return nt(nr,Z,r,t).catch(cr),{}}var b,R,Ur=r=>{for(;r.length>0;)r.shift()(d)};function at(r){this.excPtr=r,this.ptr=r-24,this.set_type=function(e){C[this.ptr+4>>2]=e},this.get_type=function(){return C[this.ptr+4>>2]},this.set_destructor=function(e){C[this.ptr+8>>2]=e},this.get_destructor=function(){return C[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,O[this.ptr+12>>0]=e},this.get_caught=function(){return O[this.ptr+12>>0]!=0},this.set_rethrown=function(e){e=e?1:0,O[this.ptr+13>>0]=e},this.get_rethrown=function(){return O[this.ptr+13>>0]!=0},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){C[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return C[this.ptr+16>>2]},this.get_exception_ptr=function(){var e=Ne(this.get_type());if(e)return C[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var he=0,it=(r,e,t)=>{var n=new at(r);throw n.init(e,t),he=r,he},pr={},mr=r=>{for(;r.length;){var e=r.pop(),t=r.pop();t(e)}};function yr(r){return this.fromWireType(E[r>>2])}var Q={},X={},gr={},pe,wr=r=>{throw new pe(r)},L=(r,e,t)=>{r.forEach(function(u){gr[u]=e});function n(u){var l=t(u);l.length!==r.length&&wr("Mismatched type converter count");for(var f=0;f{X.hasOwnProperty(u)?a[l]=X[u]:(i.push(u),Q.hasOwnProperty(u)||(Q[u]=[]),Q[u].push(()=>{a[l]=X[u],++s,s===i.length&&n(a)}))}),i.length===0&&n(a)},st=r=>{var e=pr[r];delete pr[r];var t=e.elements,n=t.length,a=t.map(u=>u.getterReturnType).concat(t.map(u=>u.setterArgumentType)),i=e.rawConstructor,s=e.rawDestructor;L([r],a,function(u){return t.forEach((l,f)=>{var c=u[f],m=l.getter,p=l.getterContext,h=u[f+n],g=l.setter,_=l.setterContext;l.read=P=>c.fromWireType(m(p,P)),l.write=(P,$)=>{var v=[];g(_,P,h.toWireType(v,$)),mr(v)}}),[{name:e.name,fromWireType:l=>{for(var f=new Array(n),c=0;c{if(n!==f.length)throw new TypeError(`Incorrect number of tuple elements for ${e.name}: expected=${n}, actual=${f.length}`);for(var c=i(),m=0;m{var e=_r[r];delete _r[r];var t=e.rawConstructor,n=e.rawDestructor,a=e.fields,i=a.map(s=>s.getterReturnType).concat(a.map(s=>s.setterArgumentType));L([r],i,s=>{var u={};return a.forEach((l,f)=>{var c=l.fieldName,m=s[f],p=l.getter,h=l.getterContext,g=s[f+a.length],_=l.setter,P=l.setterContext;u[c]={read:$=>m.fromWireType(p(h,$)),write:($,v)=>{var y=[];_(P,$,g.toWireType(y,v)),mr(y)}}}),[{name:e.name,fromWireType:l=>{var f={};for(var c in u)f[c]=u[c].read(l);return n(l),f},toWireType:(l,f)=>{for(var c in u)if(!(c in f))throw new TypeError(`Missing field: "${c}"`);var m=t();for(c in u)u[c].write(m,f[c]);return l!==null&&l.push(n,m),m},argPackAdvance:H,readValueFromPointer:yr,destructorFunction:n}]})},lt=(r,e,t,n,a)=>{},ft=()=>{for(var r=new Array(256),e=0;e<256;++e)r[e]=String.fromCharCode(e);me=r},me,A=r=>{for(var e="",t=r;W[t];)e+=me[W[t++]];return e},rr,k=r=>{throw new rr(r)};function dt(r,e,t={}){var n=e.name;if(r||k(`type "${n}" must have a positive integer typeid pointer`),X.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;k(`Cannot register type '${n}' twice`)}if(X[r]=e,delete gr[r],Q.hasOwnProperty(r)){var a=Q[r];delete Q[r],a.forEach(i=>i())}}function x(r,e,t={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");return dt(r,e,t)}var H=8,ct=(r,e,t,n)=>{e=A(e),x(r,{name:e,fromWireType:function(a){return!!a},toWireType:function(a,i){return i?t:n},argPackAdvance:H,readValueFromPointer:function(a){return this.fromWireType(W[a])},destructorFunction:null})},vt=r=>({count:r.count,deleteScheduled:r.deleteScheduled,preservePointerOnDelete:r.preservePointerOnDelete,ptr:r.ptr,ptrType:r.ptrType,smartPtr:r.smartPtr,smartPtrType:r.smartPtrType}),zr=r=>{function e(t){return t.$$.ptrType.registeredClass.name}k(e(r)+" instance already deleted")},Hr=!1,ye=r=>{},ht=r=>{r.smartPtr?r.smartPtrType.rawDestructor(r.smartPtr):r.ptrType.registeredClass.rawDestructor(r.ptr)},ge=r=>{r.count.value-=1;var e=r.count.value===0;e&&ht(r)},we=(r,e,t)=>{if(e===t)return r;if(t.baseClass===void 0)return null;var n=we(r,e,t.baseClass);return n===null?null:t.downcast(n)},_e={},pt=()=>Object.keys(ur).length,mt=()=>{var r=[];for(var e in ur)ur.hasOwnProperty(e)&&r.push(ur[e]);return r},ir=[],Lr=()=>{for(;ir.length;){var r=ir.pop();r.$$.deleteScheduled=!1,r.delete()}},sr,yt=r=>{sr=r,ir.length&&sr&&sr(Lr)},gt=()=>{d.getInheritedInstanceCount=pt,d.getLiveInheritedInstances=mt,d.flushPendingDeletes=Lr,d.setDelayFunction=yt},ur={},wt=(r,e)=>{for(e===void 0&&k("ptr should not be undefined");r.baseClass;)e=r.upcast(e),r=r.baseClass;return e},_t=(r,e)=>(e=wt(r,e),ur[e]),Er=(r,e)=>{(!e.ptrType||!e.ptr)&&wr("makeClassHandle requires ptr and ptrType");var t=!!e.smartPtrType,n=!!e.smartPtr;return t!==n&&wr("Both smartPtrType and smartPtr must be specified"),e.count={value:1},lr(Object.create(r,{$$:{value:e}}))};function Et(r){var e=this.getPointee(r);if(!e)return this.destructor(r),null;var t=_t(this.registeredClass,e);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=e,t.$$.smartPtr=r,t.clone();var n=t.clone();return this.destructor(r),n}function a(){return this.isSmartPointer?Er(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:r}):Er(this.registeredClass.instancePrototype,{ptrType:this,ptr:r})}var i=this.registeredClass.getActualType(e),s=_e[i];if(!s)return a.call(this);var u;this.isConst?u=s.constPointerType:u=s.pointerType;var l=we(e,this.registeredClass,u.registeredClass);return l===null?a.call(this):this.isSmartPointer?Er(u.registeredClass.instancePrototype,{ptrType:u,ptr:l,smartPtrType:this,smartPtr:r}):Er(u.registeredClass.instancePrototype,{ptrType:u,ptr:l})}var lr=r=>typeof FinalizationRegistry>"u"?(lr=e=>e,r):(Hr=new FinalizationRegistry(e=>{ge(e.$$)}),lr=e=>{var t=e.$$,n=!!t.smartPtr;if(n){var a={$$:t};Hr.register(e,a,e)}return e},ye=e=>Hr.unregister(e),lr(r)),bt=()=>{Object.assign(br.prototype,{isAliasOf(r){if(!(this instanceof br)||!(r instanceof br))return!1;var e=this.$$.ptrType.registeredClass,t=this.$$.ptr;r.$$=r.$$;for(var n=r.$$.ptrType.registeredClass,a=r.$$.ptr;e.baseClass;)t=e.upcast(t),e=e.baseClass;for(;n.baseClass;)a=n.upcast(a),n=n.baseClass;return e===n&&t===a},clone(){if(this.$$.ptr||zr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var r=lr(Object.create(Object.getPrototypeOf(this),{$$:{value:vt(this.$$)}}));return r.$$.count.value+=1,r.$$.deleteScheduled=!1,r},delete(){this.$$.ptr||zr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&k("Object already scheduled for deletion"),ye(this),ge(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||zr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&k("Object already scheduled for deletion"),ir.push(this),ir.length===1&&sr&&sr(Lr),this.$$.deleteScheduled=!0,this}})};function br(){}var kt=48,Pt=57,xr=r=>{if(r===void 0)return"_unknown";r=r.replace(/[^a-zA-Z0-9_]/g,"$");var e=r.charCodeAt(0);return e>=kt&&e<=Pt?`_${r}`:r};function kr(r,e){return r=xr(r),{[r]:function(){return e.apply(this,arguments)}}[r]}var Ee=(r,e,t)=>{if(r[e].overloadTable===void 0){var n=r[e];r[e]=function(){return r[e].overloadTable.hasOwnProperty(arguments.length)||k(`Function '${t}' called with an invalid number of arguments (${arguments.length}) - expects one of (${r[e].overloadTable})!`),r[e].overloadTable[arguments.length].apply(this,arguments)},r[e].overloadTable=[],r[e].overloadTable[n.argCount]=n}},Ir=(r,e,t)=>{d.hasOwnProperty(r)?((t===void 0||d[r].overloadTable!==void 0&&d[r].overloadTable[t]!==void 0)&&k(`Cannot register public name '${r}' twice`),Ee(d,r,r),d.hasOwnProperty(t)&&k(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),d[r].overloadTable[t]=e):(d[r]=e,t!==void 0&&(d[r].numArguments=t))};function $t(r,e,t,n,a,i,s,u){this.name=r,this.constructor=e,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=a,this.getActualType=i,this.upcast=s,this.downcast=u,this.pureVirtualFunctions=[]}var Pr=(r,e,t)=>{for(;e!==t;)e.upcast||k(`Expected null or instance of ${t.name}, got an instance of ${e.name}`),r=e.upcast(r),e=e.baseClass;return r};function Ct(r,e){if(e===null)return this.isReference&&k(`null is not a valid ${this.name}`),0;e.$$||k(`Cannot pass "${Vr(e)}" as a ${this.name}`),e.$$.ptr||k(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=e.$$.ptrType.registeredClass,n=Pr(e.$$.ptr,t,this.registeredClass);return n}function Tt(r,e){var t;if(e===null)return this.isReference&&k(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),r!==null&&r.push(this.rawDestructor,t),t):0;e.$$||k(`Cannot pass "${Vr(e)}" as a ${this.name}`),e.$$.ptr||k(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&e.$$.ptrType.isConst&&k(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);var n=e.$$.ptrType.registeredClass;if(t=Pr(e.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(e.$$.smartPtr===void 0&&k("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?t=e.$$.smartPtr:k(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)t=e.$$.smartPtr;else{var a=e.clone();t=this.rawShare(t,Tr.toHandle(()=>a.delete())),r!==null&&r.push(this.rawDestructor,t)}break;default:k("Unsupporting sharing policy")}return t}function Ft(r,e){if(e===null)return this.isReference&&k(`null is not a valid ${this.name}`),0;e.$$||k(`Cannot pass "${Vr(e)}" as a ${this.name}`),e.$$.ptr||k(`Cannot pass deleted object as a pointer of type ${this.name}`),e.$$.ptrType.isConst&&k(`Cannot convert argument of type ${e.$$.ptrType.name} to parameter type ${this.name}`);var t=e.$$.ptrType.registeredClass,n=Pr(e.$$.ptr,t,this.registeredClass);return n}function be(r){return this.fromWireType(C[r>>2])}var Dt=()=>{Object.assign($r.prototype,{getPointee(r){return this.rawGetPointee&&(r=this.rawGetPointee(r)),r},destructor(r){this.rawDestructor&&this.rawDestructor(r)},argPackAdvance:H,readValueFromPointer:be,deleteObject(r){r!==null&&r.delete()},fromWireType:Et})};function $r(r,e,t,n,a,i,s,u,l,f,c){this.name=r,this.registeredClass=e,this.isReference=t,this.isConst=n,this.isSmartPointer=a,this.pointeeType=i,this.sharingPolicy=s,this.rawGetPointee=u,this.rawConstructor=l,this.rawShare=f,this.rawDestructor=c,!a&&e.baseClass===void 0?n?(this.toWireType=Ct,this.destructorFunction=null):(this.toWireType=Ft,this.destructorFunction=null):this.toWireType=Tt}var ke=(r,e,t)=>{d.hasOwnProperty(r)||wr("Replacing nonexistant public symbol"),d[r].overloadTable!==void 0&&t!==void 0?d[r].overloadTable[t]=e:(d[r]=e,d[r].argCount=t)},St=(r,e,t)=>{var n=d["dynCall_"+r];return t&&t.length?n.apply(null,[e].concat(t)):n.call(null,e)},Cr=[],Pe,$e=r=>{var e=Cr[r];return e||(r>=Cr.length&&(Cr.length=r+1),Cr[r]=e=Pe.get(r)),e},At=(r,e,t)=>{if(r.includes("j"))return St(r,e,t);var n=$e(e).apply(null,t);return n},Rt=(r,e)=>{var t=[];return function(){return t.length=0,Object.assign(t,arguments),At(r,e,t)}},j=(r,e)=>{r=A(r);function t(){return r.includes("j")?Rt(r,e):$e(e)}var n=t();return typeof n!="function"&&k(`unknown function pointer with signature ${r}: ${e}`),n},Mt=(r,e)=>{var t=kr(e,function(n){this.name=e,this.message=n;var a=new Error(n).stack;a!==void 0&&(this.stack=this.toString()+` `+a.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t},Ce,Te=r=>{var e=xe(r),t=A(e);return N(e),t},er=(r,e)=>{var t=[],n={};function a(i){if(!n[i]&&!X[i]){if(gr[i]){gr[i].forEach(a);return}t.push(i),n[i]=!0}}throw e.forEach(a),new Ce(`${r}: `+t.map(Te).join([", "]))},Ot=(r,e,t,n,a,i,s,u,l,f,c,m,p)=>{c=A(c),i=j(a,i),u&&(u=j(s,u)),f&&(f=j(l,f)),p=j(m,p);var h=xr(c);Ir(h,function(){er(`Cannot construct ${c} due to unbound types`,[n])}),L([r,e,t],n?[n]:[],function(g){g=g[0];var _,P;n?(_=g.registeredClass,P=_.instancePrototype):P=br.prototype;var $=kr(h,function(){if(Object.getPrototypeOf(this)!==v)throw new rr("Use 'new' to construct "+c);if(y.constructor_body===void 0)throw new rr(c+" has no accessible constructor");var D=y.constructor_body[arguments.length];if(D===void 0)throw new rr(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(y.constructor_body).toString()}) parameters instead!`);return D.apply(this,arguments)}),v=Object.create(P,{constructor:{value:$}});$.prototype=v;var y=new $t(c,$,v,p,_,i,u,f);y.baseClass&&(y.baseClass.__derivedClasses===void 0&&(y.baseClass.__derivedClasses=[]),y.baseClass.__derivedClasses.push(y));var S=new $r(c,y,!0,!1,!1),F=new $r(c+"*",y,!1,!1,!1),U=new $r(c+" const*",y,!1,!0,!1);return _e[r]={pointerType:F,constPointerType:U},ke(h,$),[S,F,U]})},Br=(r,e)=>{for(var t=[],n=0;n>2]);return t};function jt(r,e){if(!(r instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof r} which is not a function`);var t=kr(r.name||"unknownFunctionName",function(){});t.prototype=r.prototype;var n=new t,a=r.apply(n,e);return a instanceof Object?a:n}function Nr(r,e,t,n,a,i){var s=e.length;s<2&&k("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=e[1]!==null&&t!==null,l=!1,f=1;f0?", ":"")+p),h+=(c||i?"var rv = ":"")+"invoker(fn"+(p.length>0?", ":"")+p+`); `,l)h+=`runDestructors(destructors); `;else for(var f=u?1:2;f{var s=Br(e,t);a=j(n,a),L([],[r],function(u){u=u[0];var l=`constructor ${u.name}`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[e-1]!==void 0)throw new rr(`Cannot register multiple constructors with identical number of parameters (${e-1}) for class '${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return u.registeredClass.constructor_body[e-1]=()=>{er(`Cannot construct ${u.name} due to unbound types`,s)},L([],s,f=>(f.splice(1,0,null),u.registeredClass.constructor_body[e-1]=Nr(l,f,null,a,i),[])),[]})},Ut=(r,e,t,n,a,i,s,u,l)=>{var f=Br(t,n);e=A(e),i=j(a,i),L([],[r],function(c){c=c[0];var m=`${c.name}.${e}`;e.startsWith("@@")&&(e=Symbol[e.substring(2)]),u&&c.registeredClass.pureVirtualFunctions.push(e);function p(){er(`Cannot call ${m} due to unbound types`,f)}var h=c.registeredClass.instancePrototype,g=h[e];return g===void 0||g.overloadTable===void 0&&g.className!==c.name&&g.argCount===t-2?(p.argCount=t-2,p.className=c.name,h[e]=p):(Ee(h,e,m),h[e].overloadTable[t-2]=p),L([],f,function(_){var P=Nr(m,_,c,i,s,l);return h[e].overloadTable===void 0?(P.argCount=t-2,h[e]=P):h[e].overloadTable[t-2]=P,[]}),[]})},Fe=(r,e,t)=>(r instanceof Object||k(`${t} with invalid "this": ${r}`),r instanceof e.registeredClass.constructor||k(`${t} incompatible with "this" of type ${r.constructor.name}`),r.$$.ptr||k(`cannot call emscripten binding method ${t} on deleted object`),Pr(r.$$.ptr,r.$$.ptrType.registeredClass,e.registeredClass)),zt=(r,e,t,n,a,i,s,u,l,f)=>{e=A(e),a=j(n,a),L([],[r],function(c){c=c[0];var m=`${c.name}.${e}`,p={get(){er(`Cannot access ${m} due to unbound types`,[t,s])},enumerable:!0,configurable:!0};return l?p.set=()=>er(`Cannot access ${m} due to unbound types`,[t,s]):p.set=h=>k(m+" is a read-only property"),Object.defineProperty(c.registeredClass.instancePrototype,e,p),L([],l?[t,s]:[t],function(h){var g=h[0],_={get(){var $=Fe(this,c,m+" getter");return g.fromWireType(a(i,$))},enumerable:!0};if(l){l=j(u,l);var P=h[1];_.set=function($){var v=Fe(this,c,m+" setter"),y=[];l(f,v,P.toWireType(y,$)),mr(y)}}return Object.defineProperty(c.registeredClass.instancePrototype,e,_),[]}),[]})};function Ht(){Object.assign(De.prototype,{get(r){return this.allocated[r]},has(r){return this.allocated[r]!==void 0},allocate(r){var e=this.freelist.pop()||this.allocated.length;return this.allocated[e]=r,e},free(r){this.allocated[r]=void 0,this.freelist.push(r)}})}function De(){this.allocated=[void 0],this.freelist=[]}var z=new De,Se=r=>{r>=z.reserved&&--z.get(r).refcount===0&&z.free(r)},Lt=()=>{for(var r=0,e=z.reserved;e{z.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),z.reserved=z.allocated.length,d.count_emval_handles=Lt},Tr={toValue:r=>(r||k("Cannot use deleted val. handle = "+r),z.get(r).value),toHandle:r=>{switch(r){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return z.allocate({refcount:1,value:r})}}},It=(r,e)=>{e=A(e),x(r,{name:e,fromWireType:t=>{var n=Tr.toValue(t);return Se(t),n},toWireType:(t,n)=>Tr.toHandle(n),argPackAdvance:H,readValueFromPointer:yr,destructorFunction:null})},Bt=(r,e,t)=>{switch(e){case 1:return t?function(n){return this.fromWireType(O[n>>0])}:function(n){return this.fromWireType(W[n>>0])};case 2:return t?function(n){return this.fromWireType(K[n>>1])}:function(n){return this.fromWireType(or[n>>1])};case 4:return t?function(n){return this.fromWireType(E[n>>2])}:function(n){return this.fromWireType(C[n>>2])};default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},Nt=(r,e,t,n)=>{e=A(e);function a(){}a.values={},x(r,{name:e,constructor:a,fromWireType:function(i){return this.constructor.values[i]},toWireType:(i,s)=>s.value,argPackAdvance:H,readValueFromPointer:Bt(e,t,n),destructorFunction:null}),Ir(e,a)},Ae=(r,e)=>{var t=X[r];return t===void 0&&k(e+" has unknown type "+Te(r)),t},Vt=(r,e,t)=>{var n=Ae(r,"enum");e=A(e);var a=n.constructor,i=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:kr(`${n.name}_${e}`,function(){})}});a.values[t]=i,a[e]=i},Vr=r=>{if(r===null)return"null";var e=typeof r;return e==="object"||e==="array"||e==="function"?r.toString():""+r},Yt=(r,e)=>{switch(e){case 4:return function(t){return this.fromWireType(ae[t>>2])};case 8:return function(t){return this.fromWireType(ie[t>>3])};default:throw new TypeError(`invalid float width (${e}): ${r}`)}},qt=(r,e,t)=>{e=A(e),x(r,{name:e,fromWireType:n=>n,toWireType:(n,a)=>a,argPackAdvance:H,readValueFromPointer:Yt(e,t),destructorFunction:null})},Xt=(r,e,t,n,a,i,s)=>{var u=Br(e,t);r=A(r),a=j(n,a),Ir(r,function(){er(`Cannot call ${r} due to unbound types`,u)},e-1),L([],u,function(l){var f=[l[0],null].concat(l.slice(1));return ke(r,Nr(r,f,null,a,i,s),e-1),[]})},Gt=(r,e,t)=>{switch(e){case 1:return t?n=>O[n>>0]:n=>W[n>>0];case 2:return t?n=>K[n>>1]:n=>or[n>>1];case 4:return t?n=>E[n>>2]:n=>C[n>>2];default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},Kt=(r,e,t,n,a)=>{e=A(e);var i=c=>c;if(n===0){var s=32-8*t;i=c=>c<>>s}var u=e.includes("unsigned"),l=(c,m)=>{},f;u?f=function(c,m){return l(m,this.name),m>>>0}:f=function(c,m){return l(m,this.name),m},x(r,{name:e,fromWireType:i,toWireType:f,argPackAdvance:H,readValueFromPointer:Gt(e,t,n!==0),destructorFunction:null})},Jt=(r,e,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],a=n[e];function i(s){var u=C[s>>2],l=C[s+4>>2];return new a(O.buffer,l,u)}t=A(t),x(r,{name:t,fromWireType:i,argPackAdvance:H,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},Yr=(r,e,t,n)=>{if(!(n>0))return 0;for(var a=t,i=t+n-1,s=0;s=55296&&u<=57343){var l=r.charCodeAt(++s);u=65536+((u&1023)<<10)|l&1023}if(u<=127){if(t>=i)break;e[t++]=u}else if(u<=2047){if(t+1>=i)break;e[t++]=192|u>>6,e[t++]=128|u&63}else if(u<=65535){if(t+2>=i)break;e[t++]=224|u>>12,e[t++]=128|u>>6&63,e[t++]=128|u&63}else{if(t+3>=i)break;e[t++]=240|u>>18,e[t++]=128|u>>12&63,e[t++]=128|u>>6&63,e[t++]=128|u&63}}return e[t]=0,t-a},Re=(r,e,t)=>Yr(r,W,e,t),Fr=r=>{for(var e=0,t=0;t=55296&&n<=57343?(e+=4,++t):e+=3}return e},Me=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,tr=(r,e,t)=>{for(var n=e+t,a=e;r[a]&&!(a>=n);)++a;if(a-e>16&&r.buffer&&Me)return Me.decode(r.subarray(e,a));for(var i="";e>10,56320|f&1023)}}return i},fr=(r,e)=>r?tr(W,r,e):"",Zt=(r,e)=>{e=A(e);var t=e==="std::string";x(r,{name:e,fromWireType(n){var a=C[n>>2],i=n+4,s;if(t)for(var u=i,l=0;l<=a;++l){var f=i+l;if(l==a||W[f]==0){var c=f-u,m=fr(u,c);s===void 0?s=m:(s+="\0",s+=m),u=f+1}}else{for(var p=new Array(a),l=0;l>2]=i,t&&s)Re(a,l,i+1);else if(s)for(var f=0;f255&&(N(l),k("String has UTF-16 code units that do not fit in 8 bits")),W[l+f]=c}else for(var f=0;f{for(var t=r,n=t>>1,a=n+e/2;!(n>=a)&&or[n];)++n;if(t=n<<1,t-r>32&&Oe)return Oe.decode(W.subarray(r,t));for(var i="",s=0;!(s>=e/2);++s){var u=K[r+s*2>>1];if(u==0)break;i+=String.fromCharCode(u)}return i},rn=(r,e,t)=>{if(t===void 0&&(t=2147483647),t<2)return 0;t-=2;for(var n=e,a=t>1]=s,e+=2}return K[e>>1]=0,e-n},en=r=>r.length*2,tn=(r,e)=>{for(var t=0,n="";!(t>=e/4);){var a=E[r+t*4>>2];if(a==0)break;if(++t,a>=65536){var i=a-65536;n+=String.fromCharCode(55296|i>>10,56320|i&1023)}else n+=String.fromCharCode(a)}return n},nn=(r,e,t)=>{if(t===void 0&&(t=2147483647),t<4)return 0;for(var n=e,a=n+t-4,i=0;i=55296&&s<=57343){var u=r.charCodeAt(++i);s=65536+((s&1023)<<10)|u&1023}if(E[e>>2]=s,e+=4,e+4>a)break}return E[e>>2]=0,e-n},on=r=>{for(var e=0,t=0;t=55296&&n<=57343&&++t,e+=4}return e},an=(r,e,t)=>{t=A(t);var n,a,i,s,u;e===2?(n=Qt,a=rn,s=en,i=()=>or,u=1):e===4&&(n=tn,a=nn,s=on,i=()=>C,u=2),x(r,{name:t,fromWireType:l=>{for(var f=C[l>>2],c=i(),m,p=l+4,h=0;h<=f;++h){var g=l+4+h*e;if(h==f||c[g>>u]==0){var _=g-p,P=n(p,_);m===void 0?m=P:(m+="\0",m+=P),p=g+e}}return N(l),m},toWireType:(l,f)=>{typeof f!="string"&&k(`Cannot pass non-string to C++ string type ${t}`);var c=s(f),m=Kr(4+c+e);return C[m>>2]=c>>u,a(f,m+4,c+e),l!==null&&l.push(N,m),m},argPackAdvance:H,readValueFromPointer:yr,destructorFunction(l){N(l)}})},sn=(r,e,t,n,a,i)=>{pr[r]={name:A(e),rawConstructor:j(t,n),rawDestructor:j(a,i),elements:[]}},un=(r,e,t,n,a,i,s,u,l)=>{pr[r].elements.push({getterReturnType:e,getter:j(t,n),getterContext:a,setterArgumentType:i,setter:j(s,u),setterContext:l})},ln=(r,e,t,n,a,i)=>{_r[r]={name:A(e),rawConstructor:j(t,n),rawDestructor:j(a,i),fields:[]}},fn=(r,e,t,n,a,i,s,u,l,f)=>{_r[r].fields.push({fieldName:A(e),getterReturnType:t,getter:j(n,a),getterContext:i,setterArgumentType:s,setter:j(u,l),setterContext:f})},dn=(r,e)=>{e=A(e),x(r,{isVoid:!0,name:e,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}})},cn=r=>{r>4&&(z.get(r).refcount+=1)},vn=(r,e)=>{r=Ae(r,"_emval_take_value");var t=r.readValueFromPointer(e);return Tr.toHandle(t)},hn=()=>{J("")},pn=(r,e,t)=>W.copyWithin(r,e,e+t),mn=()=>2147483648,yn=r=>{var e=vr.buffer,t=(r-e.byteLength+65535)/65536;try{return vr.grow(t),se(),1}catch{}},gn=r=>{var e=W.length;r>>>=0;var t=mn();if(r>t)return!1;for(var n=(l,f)=>l+(f-l%f)%f,a=1;a<=4;a*=2){var i=e*(1+.2/a);i=Math.min(i,r+100663296);var s=Math.min(t,n(Math.max(r,i),65536)),u=yn(s);if(u)return!0}return!1},qr={},wn=()=>te||"./this.program",dr=()=>{if(!dr.strings){var r=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:r,_:wn()};for(var t in qr)qr[t]===void 0?delete e[t]:e[t]=qr[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);dr.strings=n}return dr.strings},_n=(r,e)=>{for(var t=0;t>0]=r.charCodeAt(t);O[e>>0]=0},T={isAbs:r=>r.charAt(0)==="/",splitPath:r=>{var e=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return e.exec(r).slice(1)},normalizeArray:(r,e)=>{for(var t=0,n=r.length-1;n>=0;n--){var a=r[n];a==="."?r.splice(n,1):a===".."?(r.splice(n,1),t++):t&&(r.splice(n,1),t--)}if(e)for(;t;t--)r.unshift("..");return r},normalize:r=>{var e=T.isAbs(r),t=r.substr(-1)==="/";return r=T.normalizeArray(r.split("/").filter(n=>!!n),!e).join("/"),!r&&!e&&(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=T.splitPath(r),t=e[0],n=e[1];return!t&&!n?".":(n&&(n=n.substr(0,n.length-1)),t+n)},basename:r=>{if(r==="/")return"/";r=T.normalize(r),r=r.replace(/\/$/,"");var e=r.lastIndexOf("/");return e===-1?r:r.substr(e+1)},join:function(){var r=Array.prototype.slice.call(arguments);return T.normalize(r.join("/"))},join2:(r,e)=>T.normalize(r+"/"+e)},En=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return r=>crypto.getRandomValues(r);J("initRandomDevice")},je=r=>(je=En())(r),B={resolve:function(){for(var r="",e=!1,t=arguments.length-1;t>=-1&&!e;t--){var n=t>=0?arguments[t]:o.cwd();if(typeof n!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";r=n+"/"+r,e=T.isAbs(n)}return r=T.normalizeArray(r.split("/").filter(a=>!!a),!e).join("/"),(e?"/":"")+r||"."},relative:(r,e)=>{r=B.resolve(r).substr(1),e=B.resolve(e).substr(1);function t(f){for(var c=0;c=0&&f[m]==="";m--);return c>m?[]:f.slice(c,m-c+1)}for(var n=t(r.split("/")),a=t(e.split("/")),i=Math.min(n.length,a.length),s=i,u=0;u0?t:Fr(r)+1,a=new Array(n),i=Yr(r,a,0,a.length);return e&&(a.length=i),a}var bn=()=>{if(!Xr.length){var r=null;if(typeof window<"u"&&typeof window.prompt=="function"?(r=window.prompt("Input: "),r!==null&&(r+=` `)):typeof readline=="function"&&(r=readline(),r!==null&&(r+=` `)),!r)return null;Xr=Dr(r,!0)}return Xr.shift()},G={ttys:[],init(){},shutdown(){},register(r,e){G.ttys[r]={input:[],output:[],ops:e},o.registerDevice(r,G.stream_ops)},stream_ops:{open(r){var e=G.ttys[r.node.rdev];if(!e)throw new o.ErrnoError(43);r.tty=e,r.seekable=!1},close(r){r.tty.ops.fsync(r.tty)},fsync(r){r.tty.ops.fsync(r.tty)},read(r,e,t,n,a){if(!r.tty||!r.tty.ops.get_char)throw new o.ErrnoError(60);for(var i=0,s=0;s0&&(jr(tr(r.output,0)),r.output=[])},ioctl_tcgets(r){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(r,e,t){return 0},ioctl_tiocgwinsz(r){return[24,80]}},default_tty1_ops:{put_char(r,e){e===null||e===10?(V(tr(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(V(tr(r.output,0)),r.output=[])}}},We=r=>{J()},w={ops_table:null,mount(r){return w.createNode(null,"/",16895,0)},createNode(r,e,t,n){if(o.isBlkdev(t)||o.isFIFO(t))throw new o.ErrnoError(63);w.ops_table||(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:o.chrdev_stream_ops}});var a=o.createNode(r,e,t,n);return o.isDir(a.mode)?(a.node_ops=w.ops_table.dir.node,a.stream_ops=w.ops_table.dir.stream,a.contents={}):o.isFile(a.mode)?(a.node_ops=w.ops_table.file.node,a.stream_ops=w.ops_table.file.stream,a.usedBytes=0,a.contents=null):o.isLink(a.mode)?(a.node_ops=w.ops_table.link.node,a.stream_ops=w.ops_table.link.stream):o.isChrdev(a.mode)&&(a.node_ops=w.ops_table.chrdev.node,a.stream_ops=w.ops_table.chrdev.stream),a.timestamp=Date.now(),r&&(r.contents[e]=a,r.timestamp=a.timestamp),a},getFileDataAsTypedArray(r){return r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0)},expandFileStorage(r,e){var t=r.contents?r.contents.length:0;if(!(t>=e)){var n=1024*1024;e=Math.max(e,t*(t>>0),t!=0&&(e=Math.max(e,256));var a=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(a.subarray(0,r.usedBytes),0)}},resizeFileStorage(r,e){if(r.usedBytes!=e)if(e==0)r.contents=null,r.usedBytes=0;else{var t=r.contents;r.contents=new Uint8Array(e),t&&r.contents.set(t.subarray(0,Math.min(e,r.usedBytes))),r.usedBytes=e}},node_ops:{getattr(r){var e={};return e.dev=o.isChrdev(r.mode)?r.id:1,e.ino=r.id,e.mode=r.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=r.rdev,o.isDir(r.mode)?e.size=4096:o.isFile(r.mode)?e.size=r.usedBytes:o.isLink(r.mode)?e.size=r.link.length:e.size=0,e.atime=new Date(r.timestamp),e.mtime=new Date(r.timestamp),e.ctime=new Date(r.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr(r,e){e.mode!==void 0&&(r.mode=e.mode),e.timestamp!==void 0&&(r.timestamp=e.timestamp),e.size!==void 0&&w.resizeFileStorage(r,e.size)},lookup(r,e){throw o.genericErrors[44]},mknod(r,e,t,n){return w.createNode(r,e,t,n)},rename(r,e,t){if(o.isDir(r.mode)){var n;try{n=o.lookupNode(e,t)}catch{}if(n)for(var a in n.contents)throw new o.ErrnoError(55)}delete r.parent.contents[r.name],r.parent.timestamp=Date.now(),r.name=t,e.contents[t]=r,e.timestamp=r.parent.timestamp,r.parent=e},unlink(r,e){delete r.contents[e],r.timestamp=Date.now()},rmdir(r,e){var t=o.lookupNode(r,e);for(var n in t.contents)throw new o.ErrnoError(55);delete r.contents[e],r.timestamp=Date.now()},readdir(r){var e=[".",".."];for(var t in r.contents)r.contents.hasOwnProperty(t)&&e.push(t);return e},symlink(r,e,t){var n=w.createNode(r,e,41471,0);return n.link=t,n},readlink(r){if(!o.isLink(r.mode))throw new o.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,n,a){var i=r.node.contents;if(a>=r.node.usedBytes)return 0;var s=Math.min(r.node.usedBytes-a,n);if(s>8&&i.subarray)e.set(i.subarray(a,a+s),t);else for(var u=0;u0||t+e{var a=n?"":`al ${r}`;ne(r,i=>{Xe(i,`Loading data file "${r}" failed (no arrayBuffer).`),e(new Uint8Array(i)),a&&hr()},i=>{if(t)t();else throw`Loading data file "${r}" failed.`}),a&&Wr()},Pn=(r,e,t,n,a,i)=>o.createDataFile(r,e,t,n,a,i),$n=d.preloadPlugins||[],Cn=(r,e,t,n)=>{typeof Browser<"u"&&Browser.init();var a=!1;return $n.forEach(i=>{a||i.canHandle(e)&&(i.handle(r,e,t,n),a=!0)}),a},Tn=(r,e,t,n,a,i,s,u,l,f)=>{var c=e?B.resolve(T.join2(r,e)):r;function m(p){function h(g){f&&f(),u||Pn(r,e,g,n,a,l),i&&i(),hr()}Cn(p,c,h,()=>{s&&s(),hr()})||h(p)}Wr(),typeof t=="string"?kn(t,p=>m(p),s):m(t)},Fn=r=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=e[r];if(typeof t>"u")throw new Error(`Unknown file open mode: ${r}`);return t},Gr=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},o={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(r,e={}){if(r=B.resolve(r),!r)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(e=Object.assign(t,e),e.recurse_count>8)throw new o.ErrnoError(32);for(var n=r.split("/").filter(m=>!!m),a=o.root,i="/",s=0;s40)throw new o.ErrnoError(32)}}return{path:i,node:a}},getPath(r){for(var e;;){if(o.isRoot(r)){var t=r.mount.mountpoint;return e?t[t.length-1]!=="/"?`${t}/${e}`:t+e:t}e=e?`${r.name}/${e}`:r.name,r=r.parent}},hashName(r,e){for(var t=0,n=0;n>>0)%o.nameTable.length},hashAddNode(r){var e=o.hashName(r.parent.id,r.name);r.name_next=o.nameTable[e],o.nameTable[e]=r},hashRemoveNode(r){var e=o.hashName(r.parent.id,r.name);if(o.nameTable[e]===r)o.nameTable[e]=r.name_next;else for(var t=o.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=o.mayLookup(r);if(t)throw new o.ErrnoError(t,r);for(var n=o.hashName(r.id,e),a=o.nameTable[n];a;a=a.name_next){var i=a.name;if(a.parent.id===r.id&&i===e)return a}return o.lookup(r,e)},createNode(r,e,t,n){var a=new o.FSNode(r,e,t,n);return o.hashAddNode(a),a},destroyNode(r){o.hashRemoveNode(r)},isRoot(r){return r===r.parent},isMountpoint(r){return!!r.mounted},isFile(r){return(r&61440)===32768},isDir(r){return(r&61440)===16384},isLink(r){return(r&61440)===40960},isChrdev(r){return(r&61440)===8192},isBlkdev(r){return(r&61440)===24576},isFIFO(r){return(r&61440)===4096},isSocket(r){return(r&49152)===49152},flagsToPermissionString(r){var e=["r","w","rw"][r&3];return r&512&&(e+="w"),e},nodePermissions(r,e){return o.ignorePermissions?0:e.includes("r")&&!(r.mode&292)||e.includes("w")&&!(r.mode&146)||e.includes("x")&&!(r.mode&73)?2:0},mayLookup(r){var e=o.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){try{var t=o.lookupNode(r,e);return 20}catch{}return o.nodePermissions(r,"wx")},mayDelete(r,e,t){var n;try{n=o.lookupNode(r,e)}catch(i){return i.errno}var a=o.nodePermissions(r,"wx");if(a)return a;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(r,e){return r?o.isLink(r.mode)?32:o.isDir(r.mode)&&(o.flagsToPermissionString(e)!=="r"||e&512)?31:o.nodePermissions(r,o.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=o.MAX_OPEN_FDS;r++)if(!o.streams[r])return r;throw new o.ErrnoError(33)},getStreamChecked(r){var e=o.getStream(r);if(!e)throw new o.ErrnoError(8);return e},getStream:r=>o.streams[r],createStream(r,e=-1){return o.FSStream||(o.FSStream=function(){this.shared={}},o.FSStream.prototype={},Object.defineProperties(o.FSStream.prototype,{object:{get(){return this.node},set(t){this.node=t}},isRead:{get(){return(this.flags&2097155)!==1}},isWrite:{get(){return(this.flags&2097155)!==0}},isAppend:{get(){return this.flags&1024}},flags:{get(){return this.shared.flags},set(t){this.shared.flags=t}},position:{get(){return this.shared.position},set(t){this.shared.position=t}}})),r=Object.assign(new o.FSStream,r),e==-1&&(e=o.nextfd()),r.fd=e,o.streams[e]=r,r},closeStream(r){o.streams[r]=null},chrdev_stream_ops:{open(r){var e=o.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open&&r.stream_ops.open(r)},llseek(){throw new o.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,e)=>r<<8|e,registerDevice(r,e){o.devices[r]={stream_ops:e}},getDevice:r=>o.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var n=t.pop();e.push(n),t.push.apply(t,n.mounts)}return e},syncfs(r,e){typeof r=="function"&&(e=r,r=!1),o.syncFSRequests++,o.syncFSRequests>1&&V(`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 a(s){return o.syncFSRequests--,e(s)}function i(s){if(s)return i.errored?void 0:(i.errored=!0,a(s));++n>=t.length&&a(null)}t.forEach(s=>{if(!s.type.syncfs)return i(null);s.type.syncfs(s,r,i)})},mount(r,e,t){var n=t==="/",a=!t,i;if(n&&o.root)throw new o.ErrnoError(10);if(!n&&!a){var s=o.lookupPath(t,{follow_mount:!1});if(t=s.path,i=s.node,o.isMountpoint(i))throw new o.ErrnoError(10);if(!o.isDir(i.mode))throw new o.ErrnoError(54)}var u={type:r,opts:e,mountpoint:t,mounts:[]},l=r.mount(u);return l.mount=u,u.root=l,n?o.root=l:i&&(i.mounted=u,i.mount&&i.mount.mounts.push(u)),l},unmount(r){var e=o.lookupPath(r,{follow_mount:!1});if(!o.isMountpoint(e.node))throw new o.ErrnoError(28);var t=e.node,n=t.mounted,a=o.getMounts(n);Object.keys(o.nameTable).forEach(s=>{for(var u=o.nameTable[s];u;){var l=u.name_next;a.includes(u.mount)&&o.destroyNode(u),u=l}}),t.mounted=null;var i=t.mount.mounts.indexOf(n);t.mount.mounts.splice(i,1)},lookup(r,e){return r.node_ops.lookup(r,e)},mknod(r,e,t){var n=o.lookupPath(r,{parent:!0}),a=n.node,i=T.basename(r);if(!i||i==="."||i==="..")throw new o.ErrnoError(28);var s=o.mayCreate(a,i);if(s)throw new o.ErrnoError(s);if(!a.node_ops.mknod)throw new o.ErrnoError(63);return a.node_ops.mknod(a,i,e,t)},create(r,e){return e=e!==void 0?e:438,e&=4095,e|=32768,o.mknod(r,e,0)},mkdir(r,e){return e=e!==void 0?e:511,e&=1023,e|=16384,o.mknod(r,e,0)},mkdirTree(r,e){for(var t=r.split("/"),n="",a=0;a"u"&&(t=e,e=438),e|=8192,o.mknod(r,e,t)},symlink(r,e){if(!B.resolve(r))throw new o.ErrnoError(44);var t=o.lookupPath(e,{parent:!0}),n=t.node;if(!n)throw new o.ErrnoError(44);var a=T.basename(e),i=o.mayCreate(n,a);if(i)throw new o.ErrnoError(i);if(!n.node_ops.symlink)throw new o.ErrnoError(63);return n.node_ops.symlink(n,a,r)},rename(r,e){var t=T.dirname(r),n=T.dirname(e),a=T.basename(r),i=T.basename(e),s,u,l;if(s=o.lookupPath(r,{parent:!0}),u=s.node,s=o.lookupPath(e,{parent:!0}),l=s.node,!u||!l)throw new o.ErrnoError(44);if(u.mount!==l.mount)throw new o.ErrnoError(75);var f=o.lookupNode(u,a),c=B.relative(r,n);if(c.charAt(0)!==".")throw new o.ErrnoError(28);if(c=B.relative(e,t),c.charAt(0)!==".")throw new o.ErrnoError(55);var m;try{m=o.lookupNode(l,i)}catch{}if(f!==m){var p=o.isDir(f.mode),h=o.mayDelete(u,a,p);if(h)throw new o.ErrnoError(h);if(h=m?o.mayDelete(l,i,p):o.mayCreate(l,i),h)throw new o.ErrnoError(h);if(!u.node_ops.rename)throw new o.ErrnoError(63);if(o.isMountpoint(f)||m&&o.isMountpoint(m))throw new o.ErrnoError(10);if(l!==u&&(h=o.nodePermissions(u,"w"),h))throw new o.ErrnoError(h);o.hashRemoveNode(f);try{u.node_ops.rename(f,l,i)}catch(g){throw g}finally{o.hashAddNode(f)}}},rmdir(r){var e=o.lookupPath(r,{parent:!0}),t=e.node,n=T.basename(r),a=o.lookupNode(t,n),i=o.mayDelete(t,n,!0);if(i)throw new o.ErrnoError(i);if(!t.node_ops.rmdir)throw new o.ErrnoError(63);if(o.isMountpoint(a))throw new o.ErrnoError(10);t.node_ops.rmdir(t,n),o.destroyNode(a)},readdir(r){var e=o.lookupPath(r,{follow:!0}),t=e.node;if(!t.node_ops.readdir)throw new o.ErrnoError(54);return t.node_ops.readdir(t)},unlink(r){var e=o.lookupPath(r,{parent:!0}),t=e.node;if(!t)throw new o.ErrnoError(44);var n=T.basename(r),a=o.lookupNode(t,n),i=o.mayDelete(t,n,!1);if(i)throw new o.ErrnoError(i);if(!t.node_ops.unlink)throw new o.ErrnoError(63);if(o.isMountpoint(a))throw new o.ErrnoError(10);t.node_ops.unlink(t,n),o.destroyNode(a)},readlink(r){var e=o.lookupPath(r),t=e.node;if(!t)throw new o.ErrnoError(44);if(!t.node_ops.readlink)throw new o.ErrnoError(28);return B.resolve(o.getPath(t.parent),t.node_ops.readlink(t))},stat(r,e){var t=o.lookupPath(r,{follow:!e}),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(r){return o.stat(r,!0)},chmod(r,e,t){var n;if(typeof r=="string"){var a=o.lookupPath(r,{follow:!t});n=a.node}else n=r;if(!n.node_ops.setattr)throw new o.ErrnoError(63);n.node_ops.setattr(n,{mode:e&4095|n.mode&-4096,timestamp:Date.now()})},lchmod(r,e){o.chmod(r,e,!0)},fchmod(r,e){var t=o.getStreamChecked(r);o.chmod(t.node,e)},chown(r,e,t,n){var a;if(typeof r=="string"){var i=o.lookupPath(r,{follow:!n});a=i.node}else a=r;if(!a.node_ops.setattr)throw new o.ErrnoError(63);a.node_ops.setattr(a,{timestamp:Date.now()})},lchown(r,e,t){o.chown(r,e,t,!0)},fchown(r,e,t){var n=o.getStreamChecked(r);o.chown(n.node,e,t)},truncate(r,e){if(e<0)throw new o.ErrnoError(28);var t;if(typeof r=="string"){var n=o.lookupPath(r,{follow:!0});t=n.node}else t=r;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 a=o.nodePermissions(t,"w");if(a)throw new o.ErrnoError(a);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=o.getStreamChecked(r);if(!(t.flags&2097155))throw new o.ErrnoError(28);o.truncate(t.node,e)},utime(r,e,t){var n=o.lookupPath(r,{follow:!0}),a=n.node;a.node_ops.setattr(a,{timestamp:Math.max(e,t)})},open(r,e,t){if(r==="")throw new o.ErrnoError(44);e=typeof e=="string"?Fn(e):e,t=typeof t>"u"?438:t,e&64?t=t&4095|32768:t=0;var n;if(typeof r=="object")n=r;else{r=T.normalize(r);try{var a=o.lookupPath(r,{follow:!(e&131072)});n=a.node}catch{}}var i=!1;if(e&64)if(n){if(e&128)throw new o.ErrnoError(20)}else n=o.mknod(r,t,0),i=!0;if(!n)throw new o.ErrnoError(44);if(o.isChrdev(n.mode)&&(e&=-513),e&65536&&!o.isDir(n.mode))throw new o.ErrnoError(54);if(!i){var s=o.mayOpen(n,e);if(s)throw new o.ErrnoError(s)}e&512&&!i&&o.truncate(n,0),e&=-131713;var u=o.createStream({node:n,path:o.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),d.logReadFiles&&!(e&1)&&(o.readFiles||(o.readFiles={}),r in o.readFiles||(o.readFiles[r]=1)),u},close(r){if(o.isClosed(r))throw new o.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{o.closeStream(r.fd)}r.fd=null},isClosed(r){return r.fd===null},llseek(r,e,t){if(o.isClosed(r))throw new o.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new o.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new o.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,n,a){if(n<0||a<0)throw new o.ErrnoError(28);if(o.isClosed(r))throw new o.ErrnoError(8);if((r.flags&2097155)===1)throw new o.ErrnoError(8);if(o.isDir(r.node.mode))throw new o.ErrnoError(31);if(!r.stream_ops.read)throw new o.ErrnoError(28);var i=typeof a<"u";if(!i)a=r.position;else if(!r.seekable)throw new o.ErrnoError(70);var s=r.stream_ops.read(r,e,t,n,a);return i||(r.position+=s),s},write(r,e,t,n,a,i){if(n<0||a<0)throw new o.ErrnoError(28);if(o.isClosed(r))throw new o.ErrnoError(8);if(!(r.flags&2097155))throw new o.ErrnoError(8);if(o.isDir(r.node.mode))throw new o.ErrnoError(31);if(!r.stream_ops.write)throw new o.ErrnoError(28);r.seekable&&r.flags&1024&&o.llseek(r,0,2);var s=typeof a<"u";if(!s)a=r.position;else if(!r.seekable)throw new o.ErrnoError(70);var u=r.stream_ops.write(r,e,t,n,a,i);return s||(r.position+=u),u},allocate(r,e,t){if(o.isClosed(r))throw new o.ErrnoError(8);if(e<0||t<=0)throw new o.ErrnoError(28);if(!(r.flags&2097155))throw new o.ErrnoError(8);if(!o.isFile(r.node.mode)&&!o.isDir(r.node.mode))throw new o.ErrnoError(43);if(!r.stream_ops.allocate)throw new o.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,n,a){if(n&2&&!(a&2)&&(r.flags&2097155)!==2)throw new o.ErrnoError(2);if((r.flags&2097155)===1)throw new o.ErrnoError(2);if(!r.stream_ops.mmap)throw new o.ErrnoError(43);return r.stream_ops.mmap(r,e,t,n,a)},msync(r,e,t,n,a){return r.stream_ops.msync?r.stream_ops.msync(r,e,t,n,a):0},munmap:r=>0,ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new o.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary",e.encoding!=="utf8"&&e.encoding!=="binary")throw new Error(`Invalid encoding type "${e.encoding}"`);var t,n=o.open(r,e.flags),a=o.stat(r),i=a.size,s=new Uint8Array(i);return o.read(n,s,0,i,0),e.encoding==="utf8"?t=tr(s,0):e.encoding==="binary"&&(t=s),o.close(n),t},writeFile(r,e,t={}){t.flags=t.flags||577;var n=o.open(r,t.flags,t.mode);if(typeof e=="string"){var a=new Uint8Array(Fr(e)+1),i=Yr(e,a,0,a.length);o.write(n,a,0,i,void 0,t.canOwn)}else if(ArrayBuffer.isView(e))o.write(n,e,0,e.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");o.close(n)},cwd:()=>o.currentPath,chdir(r){var e=o.lookupPath(r,{follow:!0});if(e.node===null)throw new o.ErrnoError(44);if(!o.isDir(e.node.mode))throw new o.ErrnoError(54);var t=o.nodePermissions(e.node,"x");if(t)throw new o.ErrnoError(t);o.currentPath=e.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,a,i,s,u)=>s}),o.mkdev("/dev/null",o.makedev(1,3)),G.register(o.makedev(5,0),G.default_tty_ops),G.register(o.makedev(6,0),G.default_tty1_ops),o.mkdev("/dev/tty",o.makedev(5,0)),o.mkdev("/dev/tty1",o.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(e===0&&(e=je(r).byteLength),r[--e]);o.createDevice("/dev","random",t),o.createDevice("/dev","urandom",t),o.mkdir("/dev/shm"),o.mkdir("/dev/shm/tmp")},createSpecialDirectories(){o.mkdir("/proc");var r=o.mkdir("/proc/self");o.mkdir("/proc/self/fd"),o.mount({mount(){var e=o.createNode(r,"fd",16895,73);return e.node_ops={lookup(t,n){var a=+n,i=o.getStreamChecked(a),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return s.parent=s,s}},e}},{},"/proc/self/fd")},createStandardStreams(){d.stdin?o.createDevice("/dev","stdin",d.stdin):o.symlink("/dev/tty","/dev/stdin"),d.stdout?o.createDevice("/dev","stdout",null,d.stdout):o.symlink("/dev/tty","/dev/stdout"),d.stderr?o.createDevice("/dev","stderr",null,d.stderr):o.symlink("/dev/tty1","/dev/stderr"),o.open("/dev/stdin",0),o.open("/dev/stdout",1),o.open("/dev/stderr",1)},ensureErrnoError(){o.ErrnoError||(o.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(n){this.errno=n},this.setErrno(e),this.message="FS error"},o.ErrnoError.prototype=new Error,o.ErrnoError.prototype.constructor=o.ErrnoError,[44].forEach(r=>{o.genericErrors[r]=new o.ErrnoError(r),o.genericErrors[r].stack=""}))},staticInit(){o.ensureErrnoError(),o.nameTable=new Array(4096),o.mount(w,{},"/"),o.createDefaultDirectories(),o.createDefaultDevices(),o.createSpecialDirectories(),o.filesystems={MEMFS:w}},init(r,e,t){o.init.initialized=!0,o.ensureErrnoError(),d.stdin=r||d.stdin,d.stdout=e||d.stdout,d.stderr=t||d.stderr,o.createStandardStreams()},quit(){o.init.initialized=!1;for(var r=0;rthis.length-1||h<0)){var g=h%this.chunkSize,_=h/this.chunkSize|0;return this.getter(_)[g]}},i.prototype.setDataGetter=function(h){this.getter=h},i.prototype.cacheLength=function(){var h=new XMLHttpRequest;if(h.open("HEAD",t,!1),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")),_,P=(_=h.getResponseHeader("Accept-Ranges"))&&_==="bytes",$=(_=h.getResponseHeader("Content-Encoding"))&&_==="gzip",v=1024*1024;P||(v=g);var y=(F,U)=>{if(F>U)throw new Error("invalid range ("+F+", "+U+") or no bytes requested!");if(U>g-1)throw new Error("only "+g+" bytes available! programmer error!");var D=new XMLHttpRequest;if(D.open("GET",t,!1),g!==v&&D.setRequestHeader("Range","bytes="+F+"-"+U),D.responseType="arraybuffer",D.overrideMimeType&&D.overrideMimeType("text/plain; charset=x-user-defined"),D.send(null),!(D.status>=200&&D.status<300||D.status===304))throw new Error("Couldn't load "+t+". Status: "+D.status);return D.response!==void 0?new Uint8Array(D.response||[]):Dr(D.responseText||"",!0)},S=this;S.setDataGetter(F=>{var U=F*v,D=(F+1)*v-1;if(D=Math.min(D,g-1),typeof S.chunks[F]>"u"&&(S.chunks[F]=y(U,D)),typeof S.chunks[F]>"u")throw new Error("doXHR failed!");return S.chunks[F]}),($||!g)&&(v=g=1,g=this.getter(0).length,v=g,jr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=g,this._chunkSize=v,this.lengthKnown=!0},typeof XMLHttpRequest<"u"){throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s,u}else var u={isDevice:!1,url:t};var l=o.createFile(r,e,u,n,a);u.contents?l.contents=u.contents:u.url&&(l.contents=null,l.url=u.url),Object.defineProperties(l,{usedBytes:{get:function(){return this.contents.length}}});var f={},c=Object.keys(l.stream_ops);c.forEach(p=>{var h=l.stream_ops[p];f[p]=function(){return o.forceLoadFile(l),h.apply(null,arguments)}});function m(p,h,g,_,P){var $=p.node.contents;if(P>=$.length)return 0;var v=Math.min($.length-P,_);if($.slice)for(var y=0;y(o.forceLoadFile(l),m(p,h,g,_,P)),f.mmap=(p,h,g,_,P)=>{o.forceLoadFile(l);var $=We();if(!$)throw new o.ErrnoError(48);return m(p,O,$,h,g),{ptr:$,allocated:!0}},l.stream_ops=f,l}},Y={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(T.isAbs(e))return e;var n;if(r===-100)n=o.cwd();else{var a=Y.getStreamFromFD(r);n=a.path}if(e.length==0){if(!t)throw new o.ErrnoError(44);return n}return T.join2(n,e)},doStat(r,e,t){try{var n=r(e)}catch(u){if(u&&u.node&&T.normalize(e)!==T.normalize(o.getPath(u.node)))return-54;throw u}E[t>>2]=n.dev,E[t+4>>2]=n.mode,C[t+8>>2]=n.nlink,E[t+12>>2]=n.uid,E[t+16>>2]=n.gid,E[t+20>>2]=n.rdev,R=[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]=R[0],E[t+28>>2]=R[1],E[t+32>>2]=4096,E[t+36>>2]=n.blocks;var a=n.atime.getTime(),i=n.mtime.getTime(),s=n.ctime.getTime();return R=[Math.floor(a/1e3)>>>0,(b=Math.floor(a/1e3),+Math.abs(b)>=1?b>0?+Math.floor(b/4294967296)>>>0:~~+Math.ceil((b-+(~~b>>>0))/4294967296)>>>0:0)],E[t+40>>2]=R[0],E[t+44>>2]=R[1],C[t+48>>2]=a%1e3*1e3,R=[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]=R[0],E[t+60>>2]=R[1],C[t+64>>2]=i%1e3*1e3,R=[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]=R[0],E[t+76>>2]=R[1],C[t+80>>2]=s%1e3*1e3,R=[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]=R[0],E[t+92>>2]=R[1],0},doMsync(r,e,t,n,a){if(!o.isFile(e.node.mode))throw new o.ErrnoError(43);if(n&2)return 0;var i=W.slice(r,r+t);o.msync(e,i,a,t,n)},varargs:void 0,get(){var r=E[+Y.varargs>>2];return Y.varargs+=4,r},getp(){return Y.get()},getStr(r){var e=fr(r);return e},getStreamFromFD(r){var e=o.getStreamChecked(r);return e}},Dn=(r,e)=>{var t=0;return dr().forEach((n,a)=>{var i=e+t;C[r+a*4>>2]=i,_n(n,i),t+=n.length+1}),0},Sn=(r,e)=>{var t=dr();C[r>>2]=t.length;var n=0;return t.forEach(a=>n+=a.length+1),C[e>>2]=n,0};function An(r){try{var e=Y.getStreamFromFD(r);return o.close(e),0}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var Rn=(r,e,t,n)=>{for(var a=0,i=0;i>2],u=C[e+4>>2];e+=8;var l=o.read(r,O,s,u,n);if(l<0)return-1;if(a+=l,l>2]=i,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var On=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+e*4294967296:NaN;function jn(r,e,t,n,a){var i=On(e,t);try{if(isNaN(i))return 61;var s=Y.getStreamFromFD(r);return o.llseek(s,i,n),R=[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[a>>2]=R[0],E[a+4>>2]=R[1],s.getdents&&i===0&&n===0&&(s.getdents=null),0}catch(u){if(typeof o>"u"||u.name!=="ErrnoError")throw u;return u.errno}}var Wn=(r,e,t,n)=>{for(var a=0,i=0;i>2],u=C[e+4>>2];e+=8;var l=o.write(r,O,s,u,n);if(l<0)return-1;a+=l,typeof n<"u"&&(n+=l)}return a};function Un(r,e,t,n){try{var a=Y.getStreamFromFD(r),i=Wn(a,e,t);return C[n>>2]=i,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var Sr=r=>r%4===0&&(r%100!==0||r%400===0),zn=(r,e)=>{for(var t=0,n=0;n<=e;t+=r[n++]);return t},Ue=[31,29,31,30,31,30,31,31,30,31,30,31],ze=[31,28,31,30,31,30,31,31,30,31,30,31],Hn=(r,e)=>{for(var t=new Date(r.getTime());e>0;){var n=Sr(t.getFullYear()),a=t.getMonth(),i=(n?Ue:ze)[a];if(e>i-t.getDate())e-=i-t.getDate()+1,t.setDate(1),a<11?t.setMonth(a+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+e),t}return t},He=(r,e)=>{O.set(r,e)},Ln=(r,e,t,n)=>{var a=C[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:a?fr(a):""},s=fr(t),u={"%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 l in u)s=s.replace(new RegExp(l,"g"),u[l]);var f=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function m(v,y,S){for(var F=typeof v=="number"?v.toString():v||"";F.length0?1:0}var F;return(F=S(v.getFullYear()-y.getFullYear()))===0&&(F=S(v.getMonth()-y.getMonth()))===0&&(F=S(v.getDate()-y.getDate())),F}function g(v){switch(v.getDay()){case 0:return new Date(v.getFullYear()-1,11,29);case 1:return v;case 2:return new Date(v.getFullYear(),0,3);case 3:return new Date(v.getFullYear(),0,2);case 4:return new Date(v.getFullYear(),0,1);case 5:return new Date(v.getFullYear()-1,11,31);case 6:return new Date(v.getFullYear()-1,11,30)}}function _(v){var y=Hn(new Date(v.tm_year+1900,0,1),v.tm_yday),S=new Date(y.getFullYear(),0,4),F=new Date(y.getFullYear()+1,0,4),U=g(S),D=g(F);return h(U,y)<=0?h(D,y)<=0?y.getFullYear()+1:y.getFullYear():y.getFullYear()-1}var P={"%a":v=>f[v.tm_wday].substring(0,3),"%A":v=>f[v.tm_wday],"%b":v=>c[v.tm_mon].substring(0,3),"%B":v=>c[v.tm_mon],"%C":v=>{var y=v.tm_year+1900;return p(y/100|0,2)},"%d":v=>p(v.tm_mday,2),"%e":v=>m(v.tm_mday,2," "),"%g":v=>_(v).toString().substring(2),"%G":v=>_(v),"%H":v=>p(v.tm_hour,2),"%I":v=>{var y=v.tm_hour;return y==0?y=12:y>12&&(y-=12),p(y,2)},"%j":v=>p(v.tm_mday+zn(Sr(v.tm_year+1900)?Ue:ze,v.tm_mon-1),3),"%m":v=>p(v.tm_mon+1,2),"%M":v=>p(v.tm_min,2),"%n":()=>` `,"%p":v=>v.tm_hour>=0&&v.tm_hour<12?"AM":"PM","%S":v=>p(v.tm_sec,2),"%t":()=>" ","%u":v=>v.tm_wday||7,"%U":v=>{var y=v.tm_yday+7-v.tm_wday;return p(Math.floor(y/7),2)},"%V":v=>{var y=Math.floor((v.tm_yday+7-(v.tm_wday+6)%7)/7);if((v.tm_wday+371-v.tm_yday-2)%7<=2&&y++,y){if(y==53){var F=(v.tm_wday+371-v.tm_yday)%7;F!=4&&(F!=3||!Sr(v.tm_year))&&(y=1)}}else{y=52;var S=(v.tm_wday+7-v.tm_yday-1)%7;(S==4||S==5&&Sr(v.tm_year%400-1))&&y++}return p(y,2)},"%w":v=>v.tm_wday,"%W":v=>{var y=v.tm_yday+7-(v.tm_wday+6)%7;return p(Math.floor(y/7),2)},"%y":v=>(v.tm_year+1900).toString().substring(2),"%Y":v=>v.tm_year+1900,"%z":v=>{var y=v.tm_gmtoff,S=y>=0;return y=Math.abs(y)/60,y=y/60*100+y%60,(S?"+":"-")+("0000"+y).slice(-4)},"%Z":v=>v.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var l in P)s.includes(l)&&(s=s.replace(new RegExp(l,"g"),P[l](i)));s=s.replace(/\0\0/g,"%");var $=Dr(s,!1);return $.length>e?0:(He($,r),$.length-1)},xn=(r,e,t,n,a)=>Ln(r,e,t,n),In=r=>{var e=d["_"+r];return e},Bn=r=>{var e=Fr(r)+1,t=Jr(e);return Re(r,t,e),t},Nn=(r,e,t,n,a)=>{var i={string:g=>{var _=0;return g!=null&&g!==0&&(_=Bn(g)),_},array:g=>{var _=Jr(g.length);return He(g,_),_}};function s(g){return e==="string"?fr(g):e==="boolean"?!!g:g}var u=In(r),l=[],f=0;if(n)for(var c=0;c(Kr=d._malloc=M.M)(r),N=d._free=r=>(N=d._free=M.N)(r),xe=r=>(xe=M.P)(r);d.__embind_initialize_bindings=()=>(d.__embind_initialize_bindings=M.Q)();var Ie=()=>(Ie=M.R)(),Be=r=>(Be=M.S)(r),Jr=r=>(Jr=M.T)(r),Ne=r=>(Ne=M.U)(r);d.dynCall_jiji=(r,e,t,n,a)=>(d.dynCall_jiji=M.V)(r,e,t,n,a),d.dynCall_viijii=(r,e,t,n,a,i,s)=>(d.dynCall_viijii=M.W)(r,e,t,n,a,i,s),d.dynCall_iiiiij=(r,e,t,n,a,i,s)=>(d.dynCall_iiiiij=M.X)(r,e,t,n,a,i,s),d.dynCall_iiiiijj=(r,e,t,n,a,i,s,u,l)=>(d.dynCall_iiiiijj=M.Y)(r,e,t,n,a,i,s,u,l),d.dynCall_iiiiiijj=(r,e,t,n,a,i,s,u,l,f)=>(d.dynCall_iiiiiijj=M.Z)(r,e,t,n,a,i,s,u,l,f),d.ccall=Nn;var Mr;ar=function r(){Mr||Ve(),Mr||(ar=r)};function Ve(){if(q>0||(Ge(),q>0))return;function r(){Mr||(Mr=!0,d.calledRun=!0,!oe&&(Ke(),re(d),d.onRuntimeInitialized&&d.onRuntimeInitialized(),Je()))}d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1),r()},1)):r()}if(d.preInit)for(typeof d.preInit=="function"&&(d.preInit=[d.preInit]);d.preInit.length>0;)d.preInit.pop()();return Ve(),Qr.ready}})();export{qn as default};