var tn=(()=>{var Tr=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(Cr={}){var d=Cr,Mr,ar;d.ready=new Promise((r,e)=>{Mr=r,ar=e});var Rr=Object.assign({},d),Or="./this.program",we=!0,N="";function _e(r){return d.locateFile?d.locateFile(r,N):N+r}var gr,Ur;typeof document<"u"&&document.currentScript&&(N=document.currentScript.src),Tr&&(N=Tr),N.indexOf("blob:")!==0?N=N.substr(0,N.replace(/[?#].*/,"").lastIndexOf("/")+1):N="",gr=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},Ur=(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 wr=d.print||console.log.bind(console),$=d.printErr||console.error.bind(console);Object.assign(d,Rr),Rr=null,d.arguments&&d.arguments,d.thisProgram&&(Or=d.thisProgram),d.quit&&d.quit;var Q;d.wasmBinary&&(Q=d.wasmBinary),typeof WebAssembly!="object"&&G("no native wasm support detected");var ir,Wr=!1;function Ee(r,e){r||G(e)}var M,O,X,rr,_,k,jr,Lr;function zr(){var r=ir.buffer;d.HEAP8=M=new Int8Array(r),d.HEAP16=X=new Int16Array(r),d.HEAPU8=O=new Uint8Array(r),d.HEAPU16=rr=new Uint16Array(r),d.HEAP32=_=new Int32Array(r),d.HEAPU32=k=new Uint32Array(r),d.HEAPF32=jr=new Float32Array(r),d.HEAPF64=Lr=new Float64Array(r)}var Nr=[],xr=[],Hr=[];function ke(){if(d.preRun)for(typeof d.preRun=="function"&&(d.preRun=[d.preRun]);d.preRun.length;)Ae(d.preRun.shift());Er(Nr)}function be(){!d.noFSInit&&!o.init.initialized&&o.init(),o.ignorePermissions=!1,Er(xr)}function Fe(){if(d.postRun)for(typeof d.postRun=="function"&&(d.postRun=[d.postRun]);d.postRun.length;)De(d.postRun.shift());Er(Hr)}function Ae(r){Nr.unshift(r)}function Se(r){xr.unshift(r)}function De(r){Hr.unshift(r)}var Y=0,er=null;function en(r){return r}function _r(r){Y++,d.monitorRunDependencies&&d.monitorRunDependencies(Y)}function sr(r){if(Y--,d.monitorRunDependencies&&d.monitorRunDependencies(Y),Y==0&&er){var e=er;er=null,e()}}function G(r){d.onAbort&&d.onAbort(r),r="Aborted("+r+")",$(r),Wr=!0,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw ar(e),e}var Pe="data:application/octet-stream;base64,",Br=r=>r.startsWith(Pe),K;K="boolean.wasm",Br(K)||(K=_e(K));function $r(r){if(r==K&&Q)return new Uint8Array(Q);throw"both async and sync fetching of the wasm failed"}function Te(r){return!Q&&we&&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(()=>$r(r)):Promise.resolve().then(()=>$r(r))}function Ir(r,e,t){return Te(r).then(n=>WebAssembly.instantiate(n,e)).then(n=>n).then(t,n=>{$(`failed to asynchronously prepare wasm: ${n}`),G(n)})}function Ce(r,e,t,n){return!r&&typeof WebAssembly.instantiateStreaming=="function"&&!Br(e)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(a=>{var i=WebAssembly.instantiateStreaming(a,t);return i.then(n,function(s){return $(`wasm streaming compile failed: ${s}`),$("falling back to ArrayBuffer instantiation"),Ir(e,t,n)})}):Ir(e,t,n)}function Me(){var r={a:rn};function e(n,a){return R=n.exports,ir=R.A,zr(),te=R.C,Se(R.B),sr(),R}_r();function t(n){e(n.instance)}if(d.instantiateWasm)try{return d.instantiateWasm(r,e)}catch(n){$(`Module.instantiateWasm callback failed with error: ${n}`),ar(n)}return Ce(Q,K,r,t).catch(ar),{}}var E,T,Er=r=>{for(;r.length>0;)r.shift()(d)};d.noExitRuntime;function Re(r){this.excPtr=r,this.ptr=r-24,this.set_type=function(e){k[this.ptr+4>>2]=e},this.get_type=function(){return k[this.ptr+4>>2]},this.set_destructor=function(e){k[this.ptr+8>>2]=e},this.get_destructor=function(){return k[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,M[this.ptr+12>>0]=e},this.get_caught=function(){return M[this.ptr+12>>0]!=0},this.set_rethrown=function(e){e=e?1:0,M[this.ptr+13>>0]=e},this.get_rethrown=function(){return M[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){k[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return k[this.ptr+16>>2]},this.get_exception_ptr=function(){var e=ye(this.get_type());if(e)return k[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var Yr=0,Oe=(r,e,t)=>{var n=new Re(r);throw n.init(e,t),Yr=r,Yr},ur={},Vr=r=>{for(;r.length;){var e=r.pop(),t=r.pop();t(e)}};function kr(r){return this.fromWireType(_[r>>2])}var J={},V={},lr={},qr,Xr=r=>{throw new qr(r)},Gr=(r,e,t)=>{r.forEach(function(u){lr[u]=e});function n(u){var l=t(u);l.length!==r.length&&Xr("Mismatched type converter count");for(var f=0;f{V.hasOwnProperty(u)?a[l]=V[u]:(i.push(u),J.hasOwnProperty(u)||(J[u]=[]),J[u].push(()=>{a[l]=V[u],++s,s===i.length&&n(a)}))}),i.length===0&&n(a)},Ue=r=>{var e=ur[r];delete ur[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;Gr([r],a,function(u){return t.forEach((l,f)=>{var v=u[f],p=l.getter,h=l.getterContext,m=u[f+n],y=l.setter,b=l.setterContext;l.read=S=>v.fromWireType(p(h,S)),l.write=(S,D)=>{var c=[];y(b,S,m.toWireType(c,D)),Vr(c)}}),[{name:e.name,fromWireType:l=>{for(var f=new Array(n),v=0;v{if(n!==f.length)throw new TypeError(`Incorrect number of tuple elements for ${e.name}: expected=${n}, actual=${f.length}`);for(var v=i(),p=0;p{},je=()=>{for(var r=new Array(256),e=0;e<256;++e)r[e]=String.fromCharCode(e);Kr=r},Kr,U=r=>{for(var e="",t=r;O[t];)e+=Kr[O[t++]];return e},Jr,W=r=>{throw new Jr(r)};function Le(r,e,t={}){var n=e.name;if(r||W(`type "${n}" must have a positive integer typeid pointer`),V.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;W(`Cannot register type '${n}' twice`)}if(V[r]=e,delete lr[r],J.hasOwnProperty(r)){var a=J[r];delete J[r],a.forEach(i=>i())}}function z(r,e,t={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");return Le(r,e,t)}var x=8,ze=(r,e,t,n)=>{e=U(e),z(r,{name:e,fromWireType:function(a){return!!a},toWireType:function(a,i){return i?t:n},argPackAdvance:x,readValueFromPointer:function(a){return this.fromWireType(O[a])},destructorFunction:null})};function Ne(){Object.assign(Zr.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 Zr(){this.allocated=[void 0],this.freelist=[]}var j=new Zr,xe=r=>{r>=j.reserved&&--j.get(r).refcount===0&&j.free(r)},He=()=>{for(var r=0,e=j.reserved;e{j.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),j.reserved=j.allocated.length,d.count_emval_handles=He},Qr={toValue:r=>(r||W("Cannot use deleted val. handle = "+r),j.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 j.allocate({refcount:1,value:r})}}},$e=(r,e)=>{e=U(e),z(r,{name:e,fromWireType:t=>{var n=Qr.toValue(t);return xe(t),n},toWireType:(t,n)=>Qr.toHandle(n),argPackAdvance:x,readValueFromPointer:kr,destructorFunction:null})},Ie=(r,e,t)=>{if(r[e].overloadTable===void 0){var n=r[e];r[e]=function(){return r[e].overloadTable.hasOwnProperty(arguments.length)||W(`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}},re=(r,e,t)=>{d.hasOwnProperty(r)?((t===void 0||d[r].overloadTable!==void 0&&d[r].overloadTable[t]!==void 0)&&W(`Cannot register public name '${r}' twice`),Ie(d,r,r),d.hasOwnProperty(t)&&W(`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))},Ye=(r,e,t)=>{switch(e){case 1:return t?function(n){return this.fromWireType(M[n>>0])}:function(n){return this.fromWireType(O[n>>0])};case 2:return t?function(n){return this.fromWireType(X[n>>1])}:function(n){return this.fromWireType(rr[n>>1])};case 4:return t?function(n){return this.fromWireType(_[n>>2])}:function(n){return this.fromWireType(k[n>>2])};default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},Ve=(r,e,t,n)=>{e=U(e);function a(){}a.values={},z(r,{name:e,constructor:a,fromWireType:function(i){return this.constructor.values[i]},toWireType:(i,s)=>s.value,argPackAdvance:x,readValueFromPointer:Ye(e,t,n),destructorFunction:null}),re(e,a)},fr=(r,e)=>Object.defineProperty(e,"name",{value:r}),ee=r=>{var e=he(r),t=U(e);return B(e),t},qe=(r,e)=>{var t=V[r];return t===void 0&&W(e+" has unknown type "+ee(r)),t},Xe=(r,e,t)=>{var n=qe(r,"enum");e=U(e);var a=n.constructor,i=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:fr(`${n.name}_${e}`,function(){})}});a.values[t]=i,a[e]=i},Ge=(r,e)=>{switch(e){case 4:return function(t){return this.fromWireType(jr[t>>2])};case 8:return function(t){return this.fromWireType(Lr[t>>3])};default:throw new TypeError(`invalid float width (${e}): ${r}`)}},Ke=(r,e,t)=>{e=U(e),z(r,{name:e,fromWireType:n=>n,toWireType:(n,a)=>a,argPackAdvance:x,readValueFromPointer:Ge(e,t),destructorFunction:null})};function Je(r,e){if(!(r instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof r} which is not a function`);var t=fr(r.name||"unknownFunctionName",function(){});t.prototype=r.prototype;var n=new t,a=r.apply(n,e);return a instanceof Object?a:n}function Ze(r,e,t,n,a,i){var s=e.length;s<2&&W("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?", ":"")+h),m+=(v||i?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+`); `,l)m+=`runDestructors(destructors); `;else for(var f=u?1:2;f{for(var t=[],n=0;n>2]);return t},rt=(r,e,t)=>{d.hasOwnProperty(r)||Xr("Replacing nonexistant public symbol"),d[r].overloadTable!==void 0&&t!==void 0?d[r].overloadTable[t]=e:(d[r]=e,d[r].argCount=t)},et=(r,e,t)=>{var n=d["dynCall_"+r];return t&&t.length?n.apply(null,[e].concat(t)):n.call(null,e)},dr=[],te,ne=r=>{var e=dr[r];return e||(r>=dr.length&&(dr.length=r+1),dr[r]=e=te.get(r)),e},tt=(r,e,t)=>{if(r.includes("j"))return et(r,e,t);var n=ne(e).apply(null,t);return n},nt=(r,e)=>{var t=[];return function(){return t.length=0,Object.assign(t,arguments),tt(r,e,t)}},tr=(r,e)=>{r=U(r);function t(){return r.includes("j")?nt(r,e):ne(e)}var n=t();return typeof n!="function"&&W(`unknown function pointer with signature ${r}: ${e}`),n},ot=(r,e)=>{var t=fr(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},oe,at=(r,e)=>{var t=[],n={};function a(i){if(!n[i]&&!V[i]){if(lr[i]){lr[i].forEach(a);return}t.push(i),n[i]=!0}}throw e.forEach(a),new oe(`${r}: `+t.map(ee).join([", "]))},it=r=>{r=r.trim();const e=r.indexOf("(");return e!==-1?r.substr(0,e):r},st=(r,e,t,n,a,i,s)=>{var u=Qe(e,t);r=U(r),r=it(r),a=tr(n,a),re(r,function(){at(`Cannot call ${r} due to unbound types`,u)},e-1),Gr([],u,function(l){var f=[l[0],null].concat(l.slice(1));return rt(r,Ze(r,f,null,a,i,s),e-1),[]})},ut=(r,e,t)=>{switch(e){case 1:return t?n=>M[n>>0]:n=>O[n>>0];case 2:return t?n=>X[n>>1]:n=>rr[n>>1];case 4:return t?n=>_[n>>2]:n=>k[n>>2];default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},lt=(r,e,t,n,a)=>{e=U(e);var i=v=>v;if(n===0){var s=32-8*t;i=v=>v<>>s}var u=e.includes("unsigned"),l=(v,p)=>{},f;u?f=function(v,p){return l(p,this.name),p>>>0}:f=function(v,p){return l(p,this.name),p},z(r,{name:e,fromWireType:i,toWireType:f,argPackAdvance:x,readValueFromPointer:ut(e,t,n!==0),destructorFunction:null})},ft=(r,e,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],a=n[e];function i(s){var u=k[s>>2],l=k[s+4>>2];return new a(M.buffer,l,u)}t=U(t),z(r,{name:t,fromWireType:i,argPackAdvance:x,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})};function dt(r){return this.fromWireType(k[r>>2])}var br=(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},ae=(r,e,t)=>br(r,O,e,t),cr=r=>{for(var e=0,t=0;t=55296&&n<=57343?(e+=4,++t):e+=3}return e},ie=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Z=(r,e,t)=>{for(var n=e+t,a=e;r[a]&&!(a>=n);)++a;if(a-e>16&&r.buffer&&ie)return ie.decode(r.subarray(e,a));for(var i="";e>10,56320|f&1023)}}return i},nr=(r,e)=>r?Z(O,r,e):"",ct=(r,e)=>{e=U(e);var t=e==="std::string";z(r,{name:e,fromWireType(n){var a=k[n>>2],i=n+4,s;if(t)for(var u=i,l=0;l<=a;++l){var f=i+l;if(l==a||O[f]==0){var v=f-u,p=nr(u,v);s===void 0?s=p:(s+="\0",s+=p),u=f+1}}else{for(var h=new Array(a),l=0;l>2]=i,t&&s)ae(a,l,i+1);else if(s)for(var f=0;f255&&(B(l),W("String has UTF-16 code units that do not fit in 8 bits")),O[l+f]=v}else for(var f=0;f{for(var t=r,n=t>>1,a=n+e/2;!(n>=a)&&rr[n];)++n;if(t=n<<1,t-r>32&&se)return se.decode(O.subarray(r,t));for(var i="",s=0;!(s>=e/2);++s){var u=X[r+s*2>>1];if(u==0)break;i+=String.fromCharCode(u)}return i},ht=(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 X[e>>1]=0,e-n},mt=r=>r.length*2,pt=(r,e)=>{for(var t=0,n="";!(t>=e/4);){var a=_[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},yt=(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>>2]=s,e+=4,e+4>a)break}return _[e>>2]=0,e-n},gt=r=>{for(var e=0,t=0;t=55296&&n<=57343&&++t,e+=4}return e},wt=(r,e,t)=>{t=U(t);var n,a,i,s,u;e===2?(n=vt,a=ht,s=mt,i=()=>rr,u=1):e===4&&(n=pt,a=yt,s=gt,i=()=>k,u=2),z(r,{name:t,fromWireType:l=>{for(var f=k[l>>2],v=i(),p,h=l+4,m=0;m<=f;++m){var y=l+4+m*e;if(m==f||v[y>>u]==0){var b=y-h,S=n(h,b);p===void 0?p=S:(p+="\0",p+=S),h=y+e}}return B(l),p},toWireType:(l,f)=>{typeof f!="string"&&W(`Cannot pass non-string to C++ string type ${t}`);var v=s(f),p=Dr(4+v+e);return k[p>>2]=v>>u,a(f,p+4,v+e),l!==null&&l.push(B,p),p},argPackAdvance:x,readValueFromPointer:kr,destructorFunction(l){B(l)}})},_t=(r,e,t,n,a,i)=>{ur[r]={name:U(e),rawConstructor:tr(t,n),rawDestructor:tr(a,i),elements:[]}},Et=(r,e,t,n,a,i,s,u,l)=>{ur[r].elements.push({getterReturnType:e,getter:tr(t,n),getterContext:a,setterArgumentType:i,setter:tr(s,u),setterContext:l})},kt=(r,e)=>{e=U(e),z(r,{isVoid:!0,name:e,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}})},bt=()=>{G("")},Ft=(r,e,t)=>O.copyWithin(r,e,e+t),At=()=>2147483648,St=r=>{var e=ir.buffer,t=(r-e.byteLength+65535)/65536;try{return ir.grow(t),zr(),1}catch{}},Dt=r=>{var e=O.length;r>>>=0;var t=At();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=St(s);if(u)return!0}return!1},Fr={},Pt=()=>Or||"./this.program",or=()=>{if(!or.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,_:Pt()};for(var t in Fr)Fr[t]===void 0?delete e[t]:e[t]=Fr[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);or.strings=n}return or.strings},Tt=(r,e)=>{for(var t=0;t>0]=r.charCodeAt(t);M[e>>0]=0},F={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=F.isAbs(r),t=r.substr(-1)==="/";return r=F.normalizeArray(r.split("/").filter(n=>!!n),!e).join("/"),!r&&!e&&(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=F.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=F.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 F.normalize(r.join("/"))},join2:(r,e)=>F.normalize(r+"/"+e)},Ct=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return r=>crypto.getRandomValues(r);G("initRandomDevice")},ue=r=>(ue=Ct())(r),H={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=F.isAbs(n)}return r=F.normalizeArray(r.split("/").filter(a=>!!a),!e).join("/"),(e?"/":"")+r||"."},relative:(r,e)=>{r=H.resolve(r).substr(1),e=H.resolve(e).substr(1);function t(f){for(var v=0;v=0&&f[p]==="";p--);return v>p?[]:f.slice(v,p-v+1)}for(var n=t(r.split("/")),a=t(e.split("/")),i=Math.min(n.length,a.length),s=i,u=0;u0?t:cr(r)+1,a=new Array(n),i=br(r,a,0,a.length);return e&&(a.length=i),a}var Mt=()=>{if(!Ar.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;Ar=vr(r,!0)}return Ar.shift()},q={ttys:[],init(){},shutdown(){},register(r,e){q.ttys[r]={input:[],output:[],ops:e},o.registerDevice(r,q.stream_ops)},stream_ops:{open(r){var e=q.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&&(wr(Z(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?($(Z(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&($(Z(r.output,0)),r.output=[])}}},le=r=>{G()},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}`;Ur(r,i=>{Ee(i,`Loading data file "${r}" failed (no arrayBuffer).`),e(new Uint8Array(i)),a&&sr()},i=>{if(t)t();else throw`Loading data file "${r}" failed.`}),a&&_r()},Ot=(r,e,t,n,a,i)=>{o.createDataFile(r,e,t,n,a,i)},Ut=d.preloadPlugins||[],Wt=(r,e,t,n)=>{typeof Browser<"u"&&Browser.init();var a=!1;return Ut.forEach(i=>{a||i.canHandle(e)&&(i.handle(r,e,t,n),a=!0)}),a},jt=(r,e,t,n,a,i,s,u,l,f)=>{var v=e?H.resolve(F.join2(r,e)):r;function p(h){function m(y){f&&f(),u||Ot(r,e,y,n,a,l),i&&i(),sr()}Wt(h,v,m,()=>{s&&s(),sr()})||m(h)}_r(),typeof t=="string"?Rt(t,h=>p(h),s):p(t)},Lt=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},Sr=(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=H.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(p=>!!p),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&&$(`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=F.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(!H.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=F.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=F.dirname(r),n=F.dirname(e),a=F.basename(r),i=F.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),v=H.relative(r,n);if(v.charAt(0)!==".")throw new o.ErrnoError(28);if(v=H.relative(e,t),v.charAt(0)!==".")throw new o.ErrnoError(55);var p;try{p=o.lookupNode(l,i)}catch{}if(f!==p){var h=o.isDir(f.mode),m=o.mayDelete(u,a,h);if(m)throw new o.ErrnoError(m);if(m=p?o.mayDelete(l,i,h):o.mayCreate(l,i),m)throw new o.ErrnoError(m);if(!u.node_ops.rename)throw new o.ErrnoError(63);if(o.isMountpoint(f)||p&&o.isMountpoint(p))throw new o.ErrnoError(10);if(l!==u&&(m=o.nodePermissions(u,"w"),m))throw new o.ErrnoError(m);o.hashRemoveNode(f);try{u.node_ops.rename(f,l,i)}catch(y){throw y}finally{o.hashAddNode(f)}}},rmdir(r){var e=o.lookupPath(r,{parent:!0}),t=e.node,n=F.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=F.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 H.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"?Lt(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=F.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=Z(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(cr(e)+1),i=br(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)),q.register(o.makedev(5,0),q.default_tty_ops),q.register(o.makedev(6,0),q.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=ue(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||m<0)){var y=m%this.chunkSize,b=m/this.chunkSize|0;return this.getter(b)[y]}},i.prototype.setDataGetter=function(m){this.getter=m},i.prototype.cacheLength=function(){var m=new XMLHttpRequest;if(m.open("HEAD",t,!1),m.send(null),!(m.status>=200&&m.status<300||m.status===304))throw new Error("Couldn't load "+t+". Status: "+m.status);var y=Number(m.getResponseHeader("Content-length")),b,S=(b=m.getResponseHeader("Accept-Ranges"))&&b==="bytes",D=(b=m.getResponseHeader("Content-Encoding"))&&b==="gzip",c=1024*1024;S||(c=y);var g=(A,L)=>{if(A>L)throw new Error("invalid range ("+A+", "+L+") or no bytes requested!");if(L>y-1)throw new Error("only "+y+" bytes available! programmer error!");var P=new XMLHttpRequest;if(P.open("GET",t,!1),y!==c&&P.setRequestHeader("Range","bytes="+A+"-"+L),P.responseType="arraybuffer",P.overrideMimeType&&P.overrideMimeType("text/plain; charset=x-user-defined"),P.send(null),!(P.status>=200&&P.status<300||P.status===304))throw new Error("Couldn't load "+t+". Status: "+P.status);return P.response!==void 0?new Uint8Array(P.response||[]):vr(P.responseText||"",!0)},C=this;C.setDataGetter(A=>{var L=A*c,P=(A+1)*c-1;if(P=Math.min(P,y-1),typeof C.chunks[A]>"u"&&(C.chunks[A]=g(L,P)),typeof C.chunks[A]>"u")throw new Error("doXHR failed!");return C.chunks[A]}),(D||!y)&&(c=y=1,y=this.getter(0).length,c=y,wr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=y,this._chunkSize=c,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={},v=Object.keys(l.stream_ops);v.forEach(h=>{var m=l.stream_ops[h];f[h]=function(){return o.forceLoadFile(l),m.apply(null,arguments)}});function p(h,m,y,b,S){var D=h.node.contents;if(S>=D.length)return 0;var c=Math.min(D.length-S,b);if(D.slice)for(var g=0;g(o.forceLoadFile(l),p(h,m,y,b,S)),f.mmap=(h,m,y,b,S)=>{o.forceLoadFile(l);var D=le();if(!D)throw new o.ErrnoError(48);return p(h,M,D,m,y),{ptr:D,allocated:!0}},l.stream_ops=f,l}},I={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(F.isAbs(e))return e;var n;if(r===-100)n=o.cwd();else{var a=I.getStreamFromFD(r);n=a.path}if(e.length==0){if(!t)throw new o.ErrnoError(44);return n}return F.join2(n,e)},doStat(r,e,t){try{var n=r(e)}catch(u){if(u&&u.node&&F.normalize(e)!==F.normalize(o.getPath(u.node)))return-54;throw u}_[t>>2]=n.dev,_[t+4>>2]=n.mode,k[t+8>>2]=n.nlink,_[t+12>>2]=n.uid,_[t+16>>2]=n.gid,_[t+20>>2]=n.rdev,T=[n.size>>>0,(E=n.size,+Math.abs(E)>=1?E>0?+Math.floor(E/4294967296)>>>0:~~+Math.ceil((E-+(~~E>>>0))/4294967296)>>>0:0)],_[t+24>>2]=T[0],_[t+28>>2]=T[1],_[t+32>>2]=4096,_[t+36>>2]=n.blocks;var a=n.atime.getTime(),i=n.mtime.getTime(),s=n.ctime.getTime();return T=[Math.floor(a/1e3)>>>0,(E=Math.floor(a/1e3),+Math.abs(E)>=1?E>0?+Math.floor(E/4294967296)>>>0:~~+Math.ceil((E-+(~~E>>>0))/4294967296)>>>0:0)],_[t+40>>2]=T[0],_[t+44>>2]=T[1],k[t+48>>2]=a%1e3*1e3,T=[Math.floor(i/1e3)>>>0,(E=Math.floor(i/1e3),+Math.abs(E)>=1?E>0?+Math.floor(E/4294967296)>>>0:~~+Math.ceil((E-+(~~E>>>0))/4294967296)>>>0:0)],_[t+56>>2]=T[0],_[t+60>>2]=T[1],k[t+64>>2]=i%1e3*1e3,T=[Math.floor(s/1e3)>>>0,(E=Math.floor(s/1e3),+Math.abs(E)>=1?E>0?+Math.floor(E/4294967296)>>>0:~~+Math.ceil((E-+(~~E>>>0))/4294967296)>>>0:0)],_[t+72>>2]=T[0],_[t+76>>2]=T[1],k[t+80>>2]=s%1e3*1e3,T=[n.ino>>>0,(E=n.ino,+Math.abs(E)>=1?E>0?+Math.floor(E/4294967296)>>>0:~~+Math.ceil((E-+(~~E>>>0))/4294967296)>>>0:0)],_[t+88>>2]=T[0],_[t+92>>2]=T[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=O.slice(r,r+t);o.msync(e,i,a,t,n)},varargs:void 0,get(){var r=_[+I.varargs>>2];return I.varargs+=4,r},getp(){return I.get()},getStr(r){var e=nr(r);return e},getStreamFromFD(r){var e=o.getStreamChecked(r);return e}},zt=(r,e)=>{var t=0;return or().forEach((n,a)=>{var i=e+t;k[r+a*4>>2]=i,Tt(n,i),t+=n.length+1}),0},Nt=(r,e)=>{var t=or();k[r>>2]=t.length;var n=0;return t.forEach(a=>n+=a.length+1),k[e>>2]=n,0};function xt(r){try{var e=I.getStreamFromFD(r);return o.close(e),0}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var Ht=(r,e,t,n)=>{for(var a=0,i=0;i>2],u=k[e+4>>2];e+=8;var l=o.read(r,M,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 $t=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+e*4294967296:NaN;function It(r,e,t,n,a){var i=$t(e,t);try{if(isNaN(i))return 61;var s=I.getStreamFromFD(r);return o.llseek(s,i,n),T=[s.position>>>0,(E=s.position,+Math.abs(E)>=1?E>0?+Math.floor(E/4294967296)>>>0:~~+Math.ceil((E-+(~~E>>>0))/4294967296)>>>0:0)],_[a>>2]=T[0],_[a+4>>2]=T[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 Yt=(r,e,t,n)=>{for(var a=0,i=0;i>2],u=k[e+4>>2];e+=8;var l=o.write(r,M,s,u,n);if(l<0)return-1;a+=l,typeof n<"u"&&(n+=l)}return a};function Vt(r,e,t,n){try{var a=I.getStreamFromFD(r),i=Yt(a,e,t);return k[n>>2]=i,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var hr=r=>r%4===0&&(r%100!==0||r%400===0),qt=(r,e)=>{for(var t=0,n=0;n<=e;t+=r[n++]);return t},fe=[31,29,31,30,31,30,31,31,30,31,30,31],de=[31,28,31,30,31,30,31,31,30,31,30,31],Xt=(r,e)=>{for(var t=new Date(r.getTime());e>0;){var n=hr(t.getFullYear()),a=t.getMonth(),i=(n?fe:de)[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},ce=(r,e)=>{M.set(r,e)},Gt=(r,e,t,n)=>{var a=k[n+40>>2],i={tm_sec:_[n>>2],tm_min:_[n+4>>2],tm_hour:_[n+8>>2],tm_mday:_[n+12>>2],tm_mon:_[n+16>>2],tm_year:_[n+20>>2],tm_wday:_[n+24>>2],tm_yday:_[n+28>>2],tm_isdst:_[n+32>>2],tm_gmtoff:_[n+36>>2],tm_zone:a?nr(a):""},s=nr(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"],v=["January","February","March","April","May","June","July","August","September","October","November","December"];function p(c,g,C){for(var A=typeof c=="number"?c.toString():c||"";A.length0?1:0}var A;return(A=C(c.getFullYear()-g.getFullYear()))===0&&(A=C(c.getMonth()-g.getMonth()))===0&&(A=C(c.getDate()-g.getDate())),A}function y(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 b(c){var g=Xt(new Date(c.tm_year+1900,0,1),c.tm_yday),C=new Date(g.getFullYear(),0,4),A=new Date(g.getFullYear()+1,0,4),L=y(C),P=y(A);return m(L,g)<=0?m(P,g)<=0?g.getFullYear()+1:g.getFullYear():g.getFullYear()-1}var S={"%a":c=>f[c.tm_wday].substring(0,3),"%A":c=>f[c.tm_wday],"%b":c=>v[c.tm_mon].substring(0,3),"%B":c=>v[c.tm_mon],"%C":c=>{var g=c.tm_year+1900;return h(g/100|0,2)},"%d":c=>h(c.tm_mday,2),"%e":c=>p(c.tm_mday,2," "),"%g":c=>b(c).toString().substring(2),"%G":c=>b(c),"%H":c=>h(c.tm_hour,2),"%I":c=>{var g=c.tm_hour;return g==0?g=12:g>12&&(g-=12),h(g,2)},"%j":c=>h(c.tm_mday+qt(hr(c.tm_year+1900)?fe:de,c.tm_mon-1),3),"%m":c=>h(c.tm_mon+1,2),"%M":c=>h(c.tm_min,2),"%n":()=>` `,"%p":c=>c.tm_hour>=0&&c.tm_hour<12?"AM":"PM","%S":c=>h(c.tm_sec,2),"%t":()=>" ","%u":c=>c.tm_wday||7,"%U":c=>{var g=c.tm_yday+7-c.tm_wday;return h(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 A=(c.tm_wday+371-c.tm_yday)%7;A!=4&&(A!=3||!hr(c.tm_year))&&(g=1)}}else{g=52;var C=(c.tm_wday+7-c.tm_yday-1)%7;(C==4||C==5&&hr(c.tm_year%400-1))&&g++}return h(g,2)},"%w":c=>c.tm_wday,"%W":c=>{var g=c.tm_yday+7-(c.tm_wday+6)%7;return h(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,C=g>=0;return g=Math.abs(g)/60,g=g/60*100+g%60,(C?"+":"-")+("0000"+g).slice(-4)},"%Z":c=>c.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var l in S)s.includes(l)&&(s=s.replace(new RegExp(l,"g"),S[l](i)));s=s.replace(/\0\0/g,"%");var D=vr(s,!1);return D.length>e?0:(ce(D,r),D.length-1)},Kt=(r,e,t,n,a)=>Gt(r,e,t,n),Jt=r=>{var e=d["_"+r];return e},Zt=r=>{var e=cr(r)+1,t=Pr(e);return ae(r,t,e),t},Qt=(r,e,t,n,a)=>{var i={string:y=>{var b=0;return y!=null&&y!==0&&(b=Zt(y)),b},array:y=>{var b=Pr(y.length);return ce(y,b),b}};function s(y){return e==="string"?nr(y):e==="boolean"?!!y:y}var u=Jt(r),l=[],f=0;if(n)for(var v=0;v(he=R.D)(r),Dr=d._malloc=r=>(Dr=d._malloc=R.E)(r),B=d._free=r=>(B=d._free=R.F)(r),me=()=>(me=R.G)(),pe=r=>(pe=R.H)(r),Pr=r=>(Pr=R.I)(r),ye=r=>(ye=R.J)(r);d.dynCall_jiji=(r,e,t,n,a)=>(d.dynCall_jiji=R.K)(r,e,t,n,a),d.dynCall_viijii=(r,e,t,n,a,i,s)=>(d.dynCall_viijii=R.L)(r,e,t,n,a,i,s),d.dynCall_iiiiij=(r,e,t,n,a,i,s)=>(d.dynCall_iiiiij=R.M)(r,e,t,n,a,i,s),d.dynCall_iiiiijj=(r,e,t,n,a,i,s,u,l)=>(d.dynCall_iiiiijj=R.N)(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=R.O)(r,e,t,n,a,i,s,u,l,f),d.ccall=Qt;var yr;er=function r(){yr||ge(),yr||(er=r)};function ge(){if(Y>0||(ke(),Y>0))return;function r(){yr||(yr=!0,d.calledRun=!0,!Wr&&(be(),Mr(d),d.onRuntimeInitialized&&d.onRuntimeInitialized(),Fe()))}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 ge(),Cr.ready}})();export{tn as default};