@areb0s/scip.js 1.1.5 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/scip.min.js CHANGED
@@ -1,16 +1,10 @@
1
- (function(ze){"use strict";var Le=function(){if(typeof SCIP_BASE_URL<"u"&&SCIP_BASE_URL)return SCIP_BASE_URL+(SCIP_BASE_URL.endsWith("/")?"":"/");if(typeof document<"u"&&document.currentScript&&document.currentScript.src){var _=document.currentScript.src;return _.substring(0,_.lastIndexOf("/")+1)}return"https://cdn.jsdelivr.net/npm/@areb0s/scip.js@latest/dist/"}();(function(_){"use strict";var M=function(){if(typeof SCIP_BASE_URL<"u"&&SCIP_BASE_URL)return SCIP_BASE_URL+(SCIP_BASE_URL.endsWith("/")?"":"/");if(typeof document<"u"&&document.currentScript&&document.currentScript.src){var p=document.currentScript.src;return p.substring(0,p.lastIndexOf("/")+1)}return"https://cdn.jsdelivr.net/npm/@areb0s/scip.js@latest/dist/"}(),W=(()=>{var p=M;return function(F={}){var l=F,H,g;l.ready=new Promise((r,e)=>{H=r,g=e});var U=Object.assign({},l),lr=[],er="./this.program",q=(r,e)=>{throw e},fr=typeof window=="object",mr=typeof importScripts=="function",ae=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",K="";function zr(r){return l.locateFile?l.locateFile(r,K):K+r}var X,gr,Pr;(fr||mr)&&(mr?K=self.location.href:typeof document<"u"&&document.currentScript&&(K=document.currentScript.src),p&&(K=p),K.startsWith("blob:")?K="":K=K.substr(0,K.replace(/[?#].*/,"").lastIndexOf("/")+1),X=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},mr&&(Pr=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),gr=(r,e,t)=>{var o=new XMLHttpRequest;o.open("GET",r,!0),o.responseType="arraybuffer",o.onload=()=>{if(o.status==200||o.status==0&&o.response){e(o.response);return}t()},o.onerror=t,o.send(null)});var Mr=l.print||console.log.bind(console),Z=l.printErr||console.error.bind(console);Object.assign(l,U),U=null,l.arguments&&(lr=l.arguments),l.thisProgram&&(er=l.thisProgram),l.quit&&(q=l.quit);var hr;l.wasmBinary&&(hr=l.wasmBinary);var pr,Dr=!1,wr,C,B,Lr,qe,y,T,Xe,Ve;function se(){var r=pr.buffer;l.HEAP8=C=new Int8Array(r),l.HEAP16=Lr=new Int16Array(r),l.HEAPU8=B=new Uint8Array(r),l.HEAPU16=qe=new Uint16Array(r),l.HEAP32=y=new Int32Array(r),l.HEAPU32=T=new Uint32Array(r),l.HEAPF32=Xe=new Float32Array(r),l.HEAPF64=Ve=new Float64Array(r)}var ue=[],le=[],Ge=[],fe=[],Ke=!1;function Je(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)et(l.preRun.shift());xr(ue)}function Qe(){Ke=!0,!l.noFSInit&&!n.init.initialized&&n.init(),n.ignorePermissions=!1,cr.init(),xr(le)}function Ze(){xr(Ge)}function rt(){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)nt(l.postRun.shift());xr(fe)}function et(r){ue.unshift(r)}function tt(r){le.unshift(r)}function nt(r){fe.unshift(r)}var yr=0,Jr=null,Rr=null;function gn(r){return r}function Or(r){yr++,l.monitorRunDependencies?.(yr)}function Ar(r){if(yr--,l.monitorRunDependencies?.(yr),yr==0&&(Jr!==null&&(clearInterval(Jr),Jr=null),Rr)){var e=Rr;Rr=null,e()}}function Qr(r){l.onAbort?.(r),r="Aborted("+r+")",Z(r),Dr=!0,wr=1,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw g(e),e}var ot="data:application/octet-stream;base64,",ce=r=>r.startsWith(ot),_r;l.locateFile?(_r="scip.wasm",ce(_r)||(_r=zr(_r))):_r=new URL("scip.wasm",M).href;function de(r){if(r==_r&&hr)return new Uint8Array(hr);if(Pr)return Pr(r);throw"both async and sync fetching of the wasm failed"}function it(r){return!hr&&(fr||mr)&&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(()=>de(r)):Promise.resolve().then(()=>de(r))}function ve(r,e,t){return it(r).then(o=>WebAssembly.instantiate(o,e)).then(t,o=>{Z(`failed to asynchronously prepare wasm: ${o}`),Qr(o)})}function at(r,e,t,o){return!r&&typeof WebAssembly.instantiateStreaming=="function"&&!ce(e)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(i=>{var a=WebAssembly.instantiateStreaming(i,t);return a.then(o,function(s){return Z(`wasm streaming compile failed: ${s}`),Z("falling back to ArrayBuffer instantiation"),ve(e,t,o)})}):ve(e,t,o)}function st(){var r={a:ln};function e(o,i){return J=o.exports,pr=J.O,se(),pe=J.R,tt(J.P),Ar("wasm-instantiate"),J}Or("wasm-instantiate");function t(o){e(o.instance)}if(l.instantiateWasm)try{return l.instantiateWasm(r,e)}catch(o){Z(`Module.instantiateWasm callback failed with error: ${o}`),g(o)}return at(hr,_r,r,t).catch(g),{}}var S,O;function me(r){this.name="ExitStatus",this.message=`Program terminated with exit(${r})`,this.status=r}var xr=r=>{for(;r.length>0;)r.shift()(l)},he=l.noExitRuntime||!0,Ur=[],pe,nr=r=>{var e=Ur[r];return e||(r>=Ur.length&&(Ur.length=r+1),Ur[r]=e=pe.get(r)),e},ut=(r,e)=>nr(r)(e);class lt{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){T[this.ptr+4>>2]=e}get_type(){return T[this.ptr+4>>2]}set_destructor(e){T[this.ptr+8>>2]=e}get_destructor(){return T[this.ptr+8>>2]}set_caught(e){e=e?1:0,C[this.ptr+12]=e}get_caught(){return C[this.ptr+12]!=0}set_rethrown(e){e=e?1:0,C[this.ptr+13]=e}get_rethrown(){return C[this.ptr+13]!=0}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){T[this.ptr+16>>2]=e}get_adjusted_ptr(){return T[this.ptr+16>>2]}get_exception_ptr(){var e=Te(this.get_type());if(e)return T[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var we=0,ft=0,ct=(r,e,t)=>{var o=new lt(r);throw o.init(e,t),we=r,ft++,we},A={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,o=r.length-1;o>=0;o--){var i=r[o];i==="."?r.splice(o,1):i===".."?(r.splice(o,1),t++):t&&(r.splice(o,1),t--)}if(e)for(;t;t--)r.unshift("..");return r},normalize:r=>{var e=A.isAbs(r),t=r.substr(-1)==="/";return r=A.normalizeArray(r.split("/").filter(o=>!!o),!e).join("/"),!r&&!e&&(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=A.splitPath(r),t=e[0],o=e[1];return!t&&!o?".":(o&&(o=o.substr(0,o.length-1)),t+o)},basename:r=>{if(r==="/")return"/";r=A.normalize(r),r=r.replace(/\/$/,"");var e=r.lastIndexOf("/");return e===-1?r:r.substr(e+1)},join:(...r)=>A.normalize(r.join("/")),join2:(r,e)=>A.normalize(r+"/"+e)},dt=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return r=>crypto.getRandomValues(r);Qr("initRandomDevice")},ye=r=>(ye=dt())(r),ur={resolve:(...r)=>{for(var e="",t=!1,o=r.length-1;o>=-1&&!t;o--){var i=o>=0?r[o]:n.cwd();if(typeof i!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=A.isAbs(i)}return e=A.normalizeArray(e.split("/").filter(a=>!!a),!t).join("/"),(t?"/":"")+e||"."},relative:(r,e)=>{r=ur.resolve(r).substr(1),e=ur.resolve(e).substr(1);function t(h){for(var b=0;b<h.length&&h[b]==="";b++);for(var P=h.length-1;P>=0&&h[P]==="";P--);return b>P?[]:h.slice(b,P-b+1)}for(var o=t(r.split("/")),i=t(e.split("/")),a=Math.min(o.length,i.length),s=a,u=0;u<a;u++)if(o[u]!==i[u]){s=u;break}for(var c=[],u=s;u<o.length;u++)c.push("..");return c=c.concat(i.slice(s)),c.join("/")}},_e=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Er=(r,e,t)=>{for(var o=e+t,i=e;r[i]&&!(i>=o);)++i;if(i-e>16&&r.buffer&&_e)return _e.decode(r.subarray(e,i));for(var a="";e<i;){var s=r[e++];if(!(s&128)){a+=String.fromCharCode(s);continue}var u=r[e++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|u);continue}var c=r[e++]&63;if((s&240)==224?s=(s&15)<<12|u<<6|c:s=(s&7)<<18|u<<12|c<<6|r[e++]&63,s<65536)a+=String.fromCharCode(s);else{var h=s-65536;a+=String.fromCharCode(55296|h>>10,56320|h&1023)}}return a},Zr=[],Br=r=>{for(var e=0,t=0;t<r.length;++t){var o=r.charCodeAt(t);o<=127?e++:o<=2047?e+=2:o>=55296&&o<=57343?(e+=4,++t):e+=3}return e},re=(r,e,t,o)=>{if(!(o>0))return 0;for(var i=t,a=t+o-1,s=0;s<r.length;++s){var u=r.charCodeAt(s);if(u>=55296&&u<=57343){var c=r.charCodeAt(++s);u=65536+((u&1023)<<10)|c&1023}if(u<=127){if(t>=a)break;e[t++]=u}else if(u<=2047){if(t+1>=a)break;e[t++]=192|u>>6,e[t++]=128|u&63}else if(u<=65535){if(t+2>=a)break;e[t++]=224|u>>12,e[t++]=128|u>>6&63,e[t++]=128|u&63}else{if(t+3>=a)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-i};function jr(r,e,t){var o=t>0?t:Br(r)+1,i=new Array(o),a=re(r,i,0,i.length);return e&&(i.length=a),i}var vt=()=>{if(!Zr.length){var r=null;if(typeof window<"u"&&typeof window.prompt=="function"?(r=window.prompt("Input: "),r!==null&&(r+=`
1
+ (function(pe){"use strict";var Ar=function(){if(typeof SCIP_BASE_URL<"u"&&SCIP_BASE_URL)return SCIP_BASE_URL+(SCIP_BASE_URL.endsWith("/")?"":"/");if(typeof document<"u"&&document.currentScript&&document.currentScript.src){var y=document.currentScript.src;return y.substring(0,y.lastIndexOf("/")+1)}return"https://cdn.jsdelivr.net/npm/@areb0s/scip.js@latest/dist/"}(),we=(()=>{var y=Ar;return function(b={}){var l=b,H,F;l.ready=new Promise((r,e)=>{H=r,F=e});var I=Object.assign({},l),Q=[],X="./this.program",x=(r,e)=>{throw e},Z=typeof window=="object",tr=typeof importScripts=="function",jr=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",B="";function gr(r){return l.locateFile?l.locateFile(r,B):B+r}var U,ur,dr;(Z||tr)&&(tr?B=self.location.href:typeof document<"u"&&document.currentScript&&(B=document.currentScript.src),y&&(B=y),B.startsWith("blob:")?B="":B=B.substr(0,B.replace(/[?#].*/,"").lastIndexOf("/")+1),U=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},tr&&(dr=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),ur=(r,e,t)=>{var o=new XMLHttpRequest;o.open("GET",r,!0),o.responseType="arraybuffer",o.onload=()=>{if(o.status==200||o.status==0&&o.response){e(o.response);return}t()},o.onerror=t,o.send(null)});var vr=l.print||console.log.bind(console),W=l.printErr||console.error.bind(console);Object.assign(l,I),I=null,l.arguments&&(Q=l.arguments),l.thisProgram&&(X=l.thisProgram),l.quit&&(x=l.quit);var nr;l.wasmBinary&&(nr=l.wasmBinary);var or,mr=!1,ar,R,z,Er,Pe,w,P,Me,Ae;function Hr(){var r=or.buffer;l.HEAP8=R=new Int8Array(r),l.HEAP16=Er=new Int16Array(r),l.HEAPU8=z=new Uint8Array(r),l.HEAPU16=Pe=new Uint16Array(r),l.HEAP32=w=new Int32Array(r),l.HEAPU32=P=new Uint32Array(r),l.HEAPF32=Me=new Float32Array(r),l.HEAPF64=Ae=new Float64Array(r)}var Wr=[],Yr=[],Re=[],Xr=[],Te=!1;function Ne(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)Le(l.preRun.shift());Sr(Wr)}function Ce(){Te=!0,!l.noFSInit&&!n.init.initialized&&n.init(),n.ignorePermissions=!1,rr.init(),Sr(Yr)}function Ie(){Sr(Re)}function ze(){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)xe(l.postRun.shift());Sr(Xr)}function Le(r){Wr.unshift(r)}function Oe(r){Yr.unshift(r)}function xe(r){Xr.unshift(r)}var ir=0,Nr=null,hr=null;function rn(r){return r}function kr(r){ir++,l.monitorRunDependencies?.(ir)}function pr(r){if(ir--,l.monitorRunDependencies?.(ir),ir==0&&(Nr!==null&&(clearInterval(Nr),Nr=null),hr)){var e=hr;hr=null,e()}}function Cr(r){l.onAbort?.(r),r="Aborted("+r+")",W(r),mr=!0,ar=1,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw F(e),e}var Ue="data:application/octet-stream;base64,",$r=r=>r.startsWith(Ue),sr;l.locateFile?(sr="scip.wasm",$r(sr)||(sr=gr(sr))):sr=new URL("scip.wasm",Ar).href;function qr(r){if(r==sr&&nr)return new Uint8Array(nr);if(dr)return dr(r);throw"both async and sync fetching of the wasm failed"}function Be(r){return!nr&&(Z||tr)&&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(()=>qr(r)):Promise.resolve().then(()=>qr(r))}function Vr(r,e,t){return Be(r).then(o=>WebAssembly.instantiate(o,e)).then(t,o=>{W(`failed to asynchronously prepare wasm: ${o}`),Cr(o)})}function je(r,e,t,o){return!r&&typeof WebAssembly.instantiateStreaming=="function"&&!$r(e)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(a=>{var i=WebAssembly.instantiateStreaming(a,t);return i.then(o,function(s){return W(`wasm streaming compile failed: ${s}`),W("falling back to ArrayBuffer instantiation"),Vr(e,t,o)})}):Vr(e,t,o)}function He(){var r={a:Wt};function e(o,a){return j=o.exports,or=j.O,Hr(),Jr=j.R,Oe(j.P),pr("wasm-instantiate"),j}kr("wasm-instantiate");function t(o){e(o.instance)}if(l.instantiateWasm)try{return l.instantiateWasm(r,e)}catch(o){W(`Module.instantiateWasm callback failed with error: ${o}`),F(o)}return je(nr,sr,r,t).catch(F),{}}var g,N;function Gr(r){this.name="ExitStatus",this.message=`Program terminated with exit(${r})`,this.status=r}var Sr=r=>{for(;r.length>0;)r.shift()(l)},Kr=l.noExitRuntime||!0,br=[],Jr,q=r=>{var e=br[r];return e||(r>=br.length&&(br.length=r+1),br[r]=e=Jr.get(r)),e},We=(r,e)=>q(r)(e);class Ye{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){P[this.ptr+4>>2]=e}get_type(){return P[this.ptr+4>>2]}set_destructor(e){P[this.ptr+8>>2]=e}get_destructor(){return P[this.ptr+8>>2]}set_caught(e){e=e?1:0,R[this.ptr+12]=e}get_caught(){return R[this.ptr+12]!=0}set_rethrown(e){e=e?1:0,R[this.ptr+13]=e}get_rethrown(){return R[this.ptr+13]!=0}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){P[this.ptr+16>>2]=e}get_adjusted_ptr(){return P[this.ptr+16>>2]}get_exception_ptr(){var e=de(this.get_type());if(e)return P[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var Qr=0,Xe=0,$e=(r,e,t)=>{var o=new Ye(r);throw o.init(e,t),Qr=r,Xe++,Qr},D={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,o=r.length-1;o>=0;o--){var a=r[o];a==="."?r.splice(o,1):a===".."?(r.splice(o,1),t++):t&&(r.splice(o,1),t--)}if(e)for(;t;t--)r.unshift("..");return r},normalize:r=>{var e=D.isAbs(r),t=r.substr(-1)==="/";return r=D.normalizeArray(r.split("/").filter(o=>!!o),!e).join("/"),!r&&!e&&(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=D.splitPath(r),t=e[0],o=e[1];return!t&&!o?".":(o&&(o=o.substr(0,o.length-1)),t+o)},basename:r=>{if(r==="/")return"/";r=D.normalize(r),r=r.replace(/\/$/,"");var e=r.lastIndexOf("/");return e===-1?r:r.substr(e+1)},join:(...r)=>D.normalize(r.join("/")),join2:(r,e)=>D.normalize(r+"/"+e)},qe=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return r=>crypto.getRandomValues(r);Cr("initRandomDevice")},Zr=r=>(Zr=qe())(r),J={resolve:(...r)=>{for(var e="",t=!1,o=r.length-1;o>=-1&&!t;o--){var a=o>=0?r[o]:n.cwd();if(typeof a!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!a)return"";e=a+"/"+e,t=D.isAbs(a)}return e=D.normalizeArray(e.split("/").filter(i=>!!i),!t).join("/"),(t?"/":"")+e||"."},relative:(r,e)=>{r=J.resolve(r).substr(1),e=J.resolve(e).substr(1);function t(h){for(var k=0;k<h.length&&h[k]==="";k++);for(var S=h.length-1;S>=0&&h[S]==="";S--);return k>S?[]:h.slice(k,S-k+1)}for(var o=t(r.split("/")),a=t(e.split("/")),i=Math.min(o.length,a.length),s=i,u=0;u<i;u++)if(o[u]!==a[u]){s=u;break}for(var c=[],u=s;u<o.length;u++)c.push("..");return c=c.concat(a.slice(s)),c.join("/")}},re=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,lr=(r,e,t)=>{for(var o=e+t,a=e;r[a]&&!(a>=o);)++a;if(a-e>16&&r.buffer&&re)return re.decode(r.subarray(e,a));for(var i="";e<a;){var s=r[e++];if(!(s&128)){i+=String.fromCharCode(s);continue}var u=r[e++]&63;if((s&224)==192){i+=String.fromCharCode((s&31)<<6|u);continue}var c=r[e++]&63;if((s&240)==224?s=(s&15)<<12|u<<6|c:s=(s&7)<<18|u<<12|c<<6|r[e++]&63,s<65536)i+=String.fromCharCode(s);else{var h=s-65536;i+=String.fromCharCode(55296|h>>10,56320|h&1023)}}return i},Ir=[],Fr=r=>{for(var e=0,t=0;t<r.length;++t){var o=r.charCodeAt(t);o<=127?e++:o<=2047?e+=2:o>=55296&&o<=57343?(e+=4,++t):e+=3}return e},zr=(r,e,t,o)=>{if(!(o>0))return 0;for(var a=t,i=t+o-1,s=0;s<r.length;++s){var u=r.charCodeAt(s);if(u>=55296&&u<=57343){var c=r.charCodeAt(++s);u=65536+((u&1023)<<10)|c&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};function Dr(r,e,t){var o=t>0?t:Fr(r)+1,a=new Array(o),i=zr(r,a,0,a.length);return e&&(a.length=i),a}var Ve=()=>{if(!Ir.length){var r=null;if(typeof window<"u"&&typeof window.prompt=="function"?(r=window.prompt("Input: "),r!==null&&(r+=`
2
2
  `)):typeof readline=="function"&&(r=readline(),r!==null&&(r+=`
3
- `)),!r)return null;Zr=jr(r,!0)}return Zr.shift()},cr={ttys:[],init(){},shutdown(){},register(r,e){cr.ttys[r]={input:[],output:[],ops:e},n.registerDevice(r,cr.stream_ops)},stream_ops:{open(r){var e=cr.ttys[r.node.rdev];if(!e)throw new n.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,o,i){if(!r.tty||!r.tty.ops.get_char)throw new n.ErrnoError(60);for(var a=0,s=0;s<o;s++){var u;try{u=r.tty.ops.get_char(r.tty)}catch{throw new n.ErrnoError(29)}if(u===void 0&&a===0)throw new n.ErrnoError(6);if(u==null)break;a++,e[t+s]=u}return a&&(r.node.timestamp=Date.now()),a},write(r,e,t,o,i){if(!r.tty||!r.tty.ops.put_char)throw new n.ErrnoError(60);try{for(var a=0;a<o;a++)r.tty.ops.put_char(r.tty,e[t+a])}catch{throw new n.ErrnoError(29)}return o&&(r.node.timestamp=Date.now()),a}},default_tty_ops:{get_char(r){return vt()},put_char(r,e){e===null||e===10?(Mr(Er(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(Mr(Er(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(Er(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(Z(Er(r.output,0)),r.output=[])}}},mt=(r,e)=>(B.fill(0,r,r+e),r),ht=(r,e)=>Math.ceil(r/e)*e,ge=r=>{r=ht(r,65536);var e=Ae(65536,r);return e?mt(e,r):0},w={ops_table:null,mount(r){return w.createNode(null,"/",16895,0)},createNode(r,e,t,o){if(n.isBlkdev(t)||n.isFIFO(t))throw new n.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:n.chrdev_stream_ops}});var i=n.createNode(r,e,t,o);return n.isDir(i.mode)?(i.node_ops=w.ops_table.dir.node,i.stream_ops=w.ops_table.dir.stream,i.contents={}):n.isFile(i.mode)?(i.node_ops=w.ops_table.file.node,i.stream_ops=w.ops_table.file.stream,i.usedBytes=0,i.contents=null):n.isLink(i.mode)?(i.node_ops=w.ops_table.link.node,i.stream_ops=w.ops_table.link.stream):n.isChrdev(i.mode)&&(i.node_ops=w.ops_table.chrdev.node,i.stream_ops=w.ops_table.chrdev.stream),i.timestamp=Date.now(),r&&(r.contents[e]=i,r.timestamp=i.timestamp),i},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 o=1024*1024;e=Math.max(e,t*(t<o?2:1.125)>>>0),t!=0&&(e=Math.max(e,256));var i=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(i.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=n.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,n.isDir(r.mode)?e.size=4096:n.isFile(r.mode)?e.size=r.usedBytes:n.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 n.genericErrors[44]},mknod(r,e,t,o){return w.createNode(r,e,t,o)},rename(r,e,t){if(n.isDir(r.mode)){var o;try{o=n.lookupNode(e,t)}catch{}if(o)for(var i in o.contents)throw new n.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=n.lookupNode(r,e);for(var o in t.contents)throw new n.ErrnoError(55);delete r.contents[e],r.timestamp=Date.now()},readdir(r){var e=[".",".."];for(var t of Object.keys(r.contents))e.push(t);return e},symlink(r,e,t){var o=w.createNode(r,e,41471,0);return o.link=t,o},readlink(r){if(!n.isLink(r.mode))throw new n.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,o,i){var a=r.node.contents;if(i>=r.node.usedBytes)return 0;var s=Math.min(r.node.usedBytes-i,o);if(s>8&&a.subarray)e.set(a.subarray(i,i+s),t);else for(var u=0;u<s;u++)e[t+u]=a[i+u];return s},write(r,e,t,o,i,a){if(e.buffer===C.buffer&&(a=!1),!o)return 0;var s=r.node;if(s.timestamp=Date.now(),e.subarray&&(!s.contents||s.contents.subarray)){if(a)return s.contents=e.subarray(t,t+o),s.usedBytes=o,o;if(s.usedBytes===0&&i===0)return s.contents=e.slice(t,t+o),s.usedBytes=o,o;if(i+o<=s.usedBytes)return s.contents.set(e.subarray(t,t+o),i),o}if(w.expandFileStorage(s,i+o),s.contents.subarray&&e.subarray)s.contents.set(e.subarray(t,t+o),i);else for(var u=0;u<o;u++)s.contents[i+u]=e[t+u];return s.usedBytes=Math.max(s.usedBytes,i+o),o},llseek(r,e,t){var o=e;if(t===1?o+=r.position:t===2&&n.isFile(r.node.mode)&&(o+=r.node.usedBytes),o<0)throw new n.ErrnoError(28);return o},allocate(r,e,t){w.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,o,i){if(!n.isFile(r.node.mode))throw new n.ErrnoError(43);var a,s,u=r.node.contents;if(!(i&2)&&u.buffer===C.buffer)s=!1,a=u.byteOffset;else{if((t>0||t+e<u.length)&&(u.subarray?u=u.subarray(t,t+e):u=Array.prototype.slice.call(u,t,t+e)),s=!0,a=ge(e),!a)throw new n.ErrnoError(48);C.set(u,a)}return{ptr:a,allocated:s}},msync(r,e,t,o,i){return w.stream_ops.write(r,e,0,o,t,!1),0}}},pt=(r,e,t,o)=>{var i=o?"":`al ${r}`;gr(r,a=>{e(new Uint8Array(a)),i&&Ar(i)},a=>{if(t)t();else throw`Loading data file "${r}" failed.`}),i&&Or(i)},wt=(r,e,t,o,i,a)=>{n.createDataFile(r,e,t,o,i,a)},yt=l.preloadPlugins||[],_t=(r,e,t,o)=>{typeof Browser<"u"&&Browser.init();var i=!1;return yt.forEach(a=>{i||a.canHandle(e)&&(a.handle(r,e,t,o),i=!0)}),i},gt=(r,e,t,o,i,a,s,u,c,h)=>{var b=e?ur.resolve(A.join2(r,e)):r,P=`cp ${b}`;function m(v){function k(j){h?.(),u||wt(r,e,j,o,i,c),a?.(),Ar(P)}_t(v,b,k,()=>{s?.(),Ar(P)})||k(v)}Or(P),typeof t=="string"?pt(t,m,s):m(t)},Et=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},ee=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},n={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(r){this.name="ErrnoError",this.errno=r}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(r){this.node=r}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{constructor(r,e,t,o){r||(r=this),this.parent=r,this.mount=r.mount,this.mounted=null,this.id=n.nextInode++,this.name=e,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=o,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(r){r?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(r){r?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return n.isDir(this.mode)}get isDevice(){return n.isChrdev(this.mode)}},lookupPath(r,e={}){if(r=ur.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 n.ErrnoError(32);for(var o=r.split("/").filter(P=>!!P),i=n.root,a="/",s=0;s<o.length;s++){var u=s===o.length-1;if(u&&e.parent)break;if(i=n.lookupNode(i,o[s]),a=A.join2(a,o[s]),n.isMountpoint(i)&&(!u||u&&e.follow_mount)&&(i=i.mounted.root),!u||e.follow)for(var c=0;n.isLink(i.mode);){var h=n.readlink(a);a=ur.resolve(A.dirname(a),h);var b=n.lookupPath(a,{recurse_count:e.recurse_count+1});if(i=b.node,c++>40)throw new n.ErrnoError(32)}}return{path:a,node:i}},getPath(r){for(var e;;){if(n.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,o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return(r+t>>>0)%n.nameTable.length},hashAddNode(r){var e=n.hashName(r.parent.id,r.name);r.name_next=n.nameTable[e],n.nameTable[e]=r},hashRemoveNode(r){var e=n.hashName(r.parent.id,r.name);if(n.nameTable[e]===r)n.nameTable[e]=r.name_next;else for(var t=n.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=n.mayLookup(r);if(t)throw new n.ErrnoError(t);for(var o=n.hashName(r.id,e),i=n.nameTable[o];i;i=i.name_next){var a=i.name;if(i.parent.id===r.id&&a===e)return i}return n.lookup(r,e)},createNode(r,e,t,o){var i=new n.FSNode(r,e,t,o);return n.hashAddNode(i),i},destroyNode(r){n.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 n.ignorePermissions?0:e.includes("r")&&!(r.mode&292)||e.includes("w")&&!(r.mode&146)||e.includes("x")&&!(r.mode&73)?2:0},mayLookup(r){if(!n.isDir(r.mode))return 54;var e=n.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){try{var t=n.lookupNode(r,e);return 20}catch{}return n.nodePermissions(r,"wx")},mayDelete(r,e,t){var o;try{o=n.lookupNode(r,e)}catch(a){return a.errno}var i=n.nodePermissions(r,"wx");if(i)return i;if(t){if(!n.isDir(o.mode))return 54;if(n.isRoot(o)||n.getPath(o)===n.cwd())return 10}else if(n.isDir(o.mode))return 31;return 0},mayOpen(r,e){return r?n.isLink(r.mode)?32:n.isDir(r.mode)&&(n.flagsToPermissionString(e)!=="r"||e&512)?31:n.nodePermissions(r,n.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=n.MAX_OPEN_FDS;r++)if(!n.streams[r])return r;throw new n.ErrnoError(33)},getStreamChecked(r){var e=n.getStream(r);if(!e)throw new n.ErrnoError(8);return e},getStream:r=>n.streams[r],createStream(r,e=-1){return r=Object.assign(new n.FSStream,r),e==-1&&(e=n.nextfd()),r.fd=e,n.streams[e]=r,r},closeStream(r){n.streams[r]=null},dupStream(r,e=-1){var t=n.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=n.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new n.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,e)=>r<<8|e,registerDevice(r,e){n.devices[r]={stream_ops:e}},getDevice:r=>n.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var o=t.pop();e.push(o),t.push(...o.mounts)}return e},syncfs(r,e){typeof r=="function"&&(e=r,r=!1),n.syncFSRequests++,n.syncFSRequests>1&&Z(`warning: ${n.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=n.getMounts(n.root.mount),o=0;function i(s){return n.syncFSRequests--,e(s)}function a(s){if(s)return a.errored?void 0:(a.errored=!0,i(s));++o>=t.length&&i(null)}t.forEach(s=>{if(!s.type.syncfs)return a(null);s.type.syncfs(s,r,a)})},mount(r,e,t){var o=t==="/",i=!t,a;if(o&&n.root)throw new n.ErrnoError(10);if(!o&&!i){var s=n.lookupPath(t,{follow_mount:!1});if(t=s.path,a=s.node,n.isMountpoint(a))throw new n.ErrnoError(10);if(!n.isDir(a.mode))throw new n.ErrnoError(54)}var u={type:r,opts:e,mountpoint:t,mounts:[]},c=r.mount(u);return c.mount=u,u.root=c,o?n.root=c:a&&(a.mounted=u,a.mount&&a.mount.mounts.push(u)),c},unmount(r){var e=n.lookupPath(r,{follow_mount:!1});if(!n.isMountpoint(e.node))throw new n.ErrnoError(28);var t=e.node,o=t.mounted,i=n.getMounts(o);Object.keys(n.nameTable).forEach(s=>{for(var u=n.nameTable[s];u;){var c=u.name_next;i.includes(u.mount)&&n.destroyNode(u),u=c}}),t.mounted=null;var a=t.mount.mounts.indexOf(o);t.mount.mounts.splice(a,1)},lookup(r,e){return r.node_ops.lookup(r,e)},mknod(r,e,t){var o=n.lookupPath(r,{parent:!0}),i=o.node,a=A.basename(r);if(!a||a==="."||a==="..")throw new n.ErrnoError(28);var s=n.mayCreate(i,a);if(s)throw new n.ErrnoError(s);if(!i.node_ops.mknod)throw new n.ErrnoError(63);return i.node_ops.mknod(i,a,e,t)},create(r,e){return e=e!==void 0?e:438,e&=4095,e|=32768,n.mknod(r,e,0)},mkdir(r,e){return e=e!==void 0?e:511,e&=1023,e|=16384,n.mknod(r,e,0)},mkdirTree(r,e){for(var t=r.split("/"),o="",i=0;i<t.length;++i)if(t[i]){o+="/"+t[i];try{n.mkdir(o,e)}catch(a){if(a.errno!=20)throw a}}},mkdev(r,e,t){return typeof t>"u"&&(t=e,e=438),e|=8192,n.mknod(r,e,t)},symlink(r,e){if(!ur.resolve(r))throw new n.ErrnoError(44);var t=n.lookupPath(e,{parent:!0}),o=t.node;if(!o)throw new n.ErrnoError(44);var i=A.basename(e),a=n.mayCreate(o,i);if(a)throw new n.ErrnoError(a);if(!o.node_ops.symlink)throw new n.ErrnoError(63);return o.node_ops.symlink(o,i,r)},rename(r,e){var t=A.dirname(r),o=A.dirname(e),i=A.basename(r),a=A.basename(e),s,u,c;if(s=n.lookupPath(r,{parent:!0}),u=s.node,s=n.lookupPath(e,{parent:!0}),c=s.node,!u||!c)throw new n.ErrnoError(44);if(u.mount!==c.mount)throw new n.ErrnoError(75);var h=n.lookupNode(u,i),b=ur.relative(r,o);if(b.charAt(0)!==".")throw new n.ErrnoError(28);if(b=ur.relative(e,t),b.charAt(0)!==".")throw new n.ErrnoError(55);var P;try{P=n.lookupNode(c,a)}catch{}if(h!==P){var m=n.isDir(h.mode),v=n.mayDelete(u,i,m);if(v)throw new n.ErrnoError(v);if(v=P?n.mayDelete(c,a,m):n.mayCreate(c,a),v)throw new n.ErrnoError(v);if(!u.node_ops.rename)throw new n.ErrnoError(63);if(n.isMountpoint(h)||P&&n.isMountpoint(P))throw new n.ErrnoError(10);if(c!==u&&(v=n.nodePermissions(u,"w"),v))throw new n.ErrnoError(v);n.hashRemoveNode(h);try{u.node_ops.rename(h,c,a)}catch(k){throw k}finally{n.hashAddNode(h)}}},rmdir(r){var e=n.lookupPath(r,{parent:!0}),t=e.node,o=A.basename(r),i=n.lookupNode(t,o),a=n.mayDelete(t,o,!0);if(a)throw new n.ErrnoError(a);if(!t.node_ops.rmdir)throw new n.ErrnoError(63);if(n.isMountpoint(i))throw new n.ErrnoError(10);t.node_ops.rmdir(t,o),n.destroyNode(i)},readdir(r){var e=n.lookupPath(r,{follow:!0}),t=e.node;if(!t.node_ops.readdir)throw new n.ErrnoError(54);return t.node_ops.readdir(t)},unlink(r){var e=n.lookupPath(r,{parent:!0}),t=e.node;if(!t)throw new n.ErrnoError(44);var o=A.basename(r),i=n.lookupNode(t,o),a=n.mayDelete(t,o,!1);if(a)throw new n.ErrnoError(a);if(!t.node_ops.unlink)throw new n.ErrnoError(63);if(n.isMountpoint(i))throw new n.ErrnoError(10);t.node_ops.unlink(t,o),n.destroyNode(i)},readlink(r){var e=n.lookupPath(r),t=e.node;if(!t)throw new n.ErrnoError(44);if(!t.node_ops.readlink)throw new n.ErrnoError(28);return ur.resolve(n.getPath(t.parent),t.node_ops.readlink(t))},stat(r,e){var t=n.lookupPath(r,{follow:!e}),o=t.node;if(!o)throw new n.ErrnoError(44);if(!o.node_ops.getattr)throw new n.ErrnoError(63);return o.node_ops.getattr(o)},lstat(r){return n.stat(r,!0)},chmod(r,e,t){var o;if(typeof r=="string"){var i=n.lookupPath(r,{follow:!t});o=i.node}else o=r;if(!o.node_ops.setattr)throw new n.ErrnoError(63);o.node_ops.setattr(o,{mode:e&4095|o.mode&-4096,timestamp:Date.now()})},lchmod(r,e){n.chmod(r,e,!0)},fchmod(r,e){var t=n.getStreamChecked(r);n.chmod(t.node,e)},chown(r,e,t,o){var i;if(typeof r=="string"){var a=n.lookupPath(r,{follow:!o});i=a.node}else i=r;if(!i.node_ops.setattr)throw new n.ErrnoError(63);i.node_ops.setattr(i,{timestamp:Date.now()})},lchown(r,e,t){n.chown(r,e,t,!0)},fchown(r,e,t){var o=n.getStreamChecked(r);n.chown(o.node,e,t)},truncate(r,e){if(e<0)throw new n.ErrnoError(28);var t;if(typeof r=="string"){var o=n.lookupPath(r,{follow:!0});t=o.node}else t=r;if(!t.node_ops.setattr)throw new n.ErrnoError(63);if(n.isDir(t.mode))throw new n.ErrnoError(31);if(!n.isFile(t.mode))throw new n.ErrnoError(28);var i=n.nodePermissions(t,"w");if(i)throw new n.ErrnoError(i);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=n.getStreamChecked(r);if(!(t.flags&2097155))throw new n.ErrnoError(28);n.truncate(t.node,e)},utime(r,e,t){var o=n.lookupPath(r,{follow:!0}),i=o.node;i.node_ops.setattr(i,{timestamp:Math.max(e,t)})},open(r,e,t){if(r==="")throw new n.ErrnoError(44);e=typeof e=="string"?Et(e):e,t=typeof t>"u"?438:t,e&64?t=t&4095|32768:t=0;var o;if(typeof r=="object")o=r;else{r=A.normalize(r);try{var i=n.lookupPath(r,{follow:!(e&131072)});o=i.node}catch{}}var a=!1;if(e&64)if(o){if(e&128)throw new n.ErrnoError(20)}else o=n.mknod(r,t,0),a=!0;if(!o)throw new n.ErrnoError(44);if(n.isChrdev(o.mode)&&(e&=-513),e&65536&&!n.isDir(o.mode))throw new n.ErrnoError(54);if(!a){var s=n.mayOpen(o,e);if(s)throw new n.ErrnoError(s)}e&512&&!a&&n.truncate(o,0),e&=-131713;var u=n.createStream({node:o,path:n.getPath(o),flags:e,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),l.logReadFiles&&!(e&1)&&(n.readFiles||(n.readFiles={}),r in n.readFiles||(n.readFiles[r]=1)),u},close(r){if(n.isClosed(r))throw new n.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{n.closeStream(r.fd)}r.fd=null},isClosed(r){return r.fd===null},llseek(r,e,t){if(n.isClosed(r))throw new n.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new n.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new n.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,o,i){if(o<0||i<0)throw new n.ErrnoError(28);if(n.isClosed(r))throw new n.ErrnoError(8);if((r.flags&2097155)===1)throw new n.ErrnoError(8);if(n.isDir(r.node.mode))throw new n.ErrnoError(31);if(!r.stream_ops.read)throw new n.ErrnoError(28);var a=typeof i<"u";if(!a)i=r.position;else if(!r.seekable)throw new n.ErrnoError(70);var s=r.stream_ops.read(r,e,t,o,i);return a||(r.position+=s),s},write(r,e,t,o,i,a){if(o<0||i<0)throw new n.ErrnoError(28);if(n.isClosed(r))throw new n.ErrnoError(8);if(!(r.flags&2097155))throw new n.ErrnoError(8);if(n.isDir(r.node.mode))throw new n.ErrnoError(31);if(!r.stream_ops.write)throw new n.ErrnoError(28);r.seekable&&r.flags&1024&&n.llseek(r,0,2);var s=typeof i<"u";if(!s)i=r.position;else if(!r.seekable)throw new n.ErrnoError(70);var u=r.stream_ops.write(r,e,t,o,i,a);return s||(r.position+=u),u},allocate(r,e,t){if(n.isClosed(r))throw new n.ErrnoError(8);if(e<0||t<=0)throw new n.ErrnoError(28);if(!(r.flags&2097155))throw new n.ErrnoError(8);if(!n.isFile(r.node.mode)&&!n.isDir(r.node.mode))throw new n.ErrnoError(43);if(!r.stream_ops.allocate)throw new n.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,o,i){if(o&2&&!(i&2)&&(r.flags&2097155)!==2)throw new n.ErrnoError(2);if((r.flags&2097155)===1)throw new n.ErrnoError(2);if(!r.stream_ops.mmap)throw new n.ErrnoError(43);return r.stream_ops.mmap(r,e,t,o,i)},msync(r,e,t,o,i){return r.stream_ops.msync?r.stream_ops.msync(r,e,t,o,i):0},ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new n.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,o=n.open(r,e.flags),i=n.stat(r),a=i.size,s=new Uint8Array(a);return n.read(o,s,0,a,0),e.encoding==="utf8"?t=Er(s,0):e.encoding==="binary"&&(t=s),n.close(o),t},writeFile(r,e,t={}){t.flags=t.flags||577;var o=n.open(r,t.flags,t.mode);if(typeof e=="string"){var i=new Uint8Array(Br(e)+1),a=re(e,i,0,i.length);n.write(o,i,0,a,void 0,t.canOwn)}else if(ArrayBuffer.isView(e))n.write(o,e,0,e.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");n.close(o)},cwd:()=>n.currentPath,chdir(r){var e=n.lookupPath(r,{follow:!0});if(e.node===null)throw new n.ErrnoError(44);if(!n.isDir(e.node.mode))throw new n.ErrnoError(54);var t=n.nodePermissions(e.node,"x");if(t)throw new n.ErrnoError(t);n.currentPath=e.path},createDefaultDirectories(){n.mkdir("/tmp"),n.mkdir("/home"),n.mkdir("/home/web_user")},createDefaultDevices(){n.mkdir("/dev"),n.registerDevice(n.makedev(1,3),{read:()=>0,write:(o,i,a,s,u)=>s}),n.mkdev("/dev/null",n.makedev(1,3)),cr.register(n.makedev(5,0),cr.default_tty_ops),cr.register(n.makedev(6,0),cr.default_tty1_ops),n.mkdev("/dev/tty",n.makedev(5,0)),n.mkdev("/dev/tty1",n.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(e===0&&(e=ye(r).byteLength),r[--e]);n.createDevice("/dev","random",t),n.createDevice("/dev","urandom",t),n.mkdir("/dev/shm"),n.mkdir("/dev/shm/tmp")},createSpecialDirectories(){n.mkdir("/proc");var r=n.mkdir("/proc/self");n.mkdir("/proc/self/fd"),n.mount({mount(){var e=n.createNode(r,"fd",16895,73);return e.node_ops={lookup(t,o){var i=+o,a=n.getStreamChecked(i),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>a.path}};return s.parent=s,s}},e}},{},"/proc/self/fd")},createStandardStreams(){l.stdin?n.createDevice("/dev","stdin",l.stdin):n.symlink("/dev/tty","/dev/stdin"),l.stdout?n.createDevice("/dev","stdout",null,l.stdout):n.symlink("/dev/tty","/dev/stdout"),l.stderr?n.createDevice("/dev","stderr",null,l.stderr):n.symlink("/dev/tty1","/dev/stderr");var r=n.open("/dev/stdin",0),e=n.open("/dev/stdout",1),t=n.open("/dev/stderr",1)},staticInit(){[44].forEach(r=>{n.genericErrors[r]=new n.ErrnoError(r),n.genericErrors[r].stack="<generic error, no stack>"}),n.nameTable=new Array(4096),n.mount(w,{},"/"),n.createDefaultDirectories(),n.createDefaultDevices(),n.createSpecialDirectories(),n.filesystems={MEMFS:w}},init(r,e,t){n.init.initialized=!0,l.stdin=r||l.stdin,l.stdout=e||l.stdout,l.stderr=t||l.stderr,n.createStandardStreams()},quit(){n.init.initialized=!1;for(var r=0;r<n.streams.length;r++){var e=n.streams[r];e&&n.close(e)}},findObject(r,e){var t=n.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{var t=n.lookupPath(r,{follow:!e});r=t.path}catch{}var o={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=n.lookupPath(r,{parent:!0});o.parentExists=!0,o.parentPath=t.path,o.parentObject=t.node,o.name=A.basename(r),t=n.lookupPath(r,{follow:!e}),o.exists=!0,o.path=t.path,o.object=t.node,o.name=t.node.name,o.isRoot=t.path==="/"}catch(i){o.error=i.errno}return o},createPath(r,e,t,o){r=typeof r=="string"?r:n.getPath(r);for(var i=e.split("/").reverse();i.length;){var a=i.pop();if(a){var s=A.join2(r,a);try{n.mkdir(s)}catch{}r=s}}return s},createFile(r,e,t,o,i){var a=A.join2(typeof r=="string"?r:n.getPath(r),e),s=ee(o,i);return n.create(a,s)},createDataFile(r,e,t,o,i,a){var s=e;r&&(r=typeof r=="string"?r:n.getPath(r),s=e?A.join2(r,e):r);var u=ee(o,i),c=n.create(s,u);if(t){if(typeof t=="string"){for(var h=new Array(t.length),b=0,P=t.length;b<P;++b)h[b]=t.charCodeAt(b);t=h}n.chmod(c,u|146);var m=n.open(c,577);n.write(m,t,0,t.length,0,a),n.close(m),n.chmod(c,u)}},createDevice(r,e,t,o){var i=A.join2(typeof r=="string"?r:n.getPath(r),e),a=ee(!!t,!!o);n.createDevice.major||(n.createDevice.major=64);var s=n.makedev(n.createDevice.major++,0);return n.registerDevice(s,{open(u){u.seekable=!1},close(u){o?.buffer?.length&&o(10)},read(u,c,h,b,P){for(var m=0,v=0;v<b;v++){var k;try{k=t()}catch{throw new n.ErrnoError(29)}if(k===void 0&&m===0)throw new n.ErrnoError(6);if(k==null)break;m++,c[h+v]=k}return m&&(u.node.timestamp=Date.now()),m},write(u,c,h,b,P){for(var m=0;m<b;m++)try{o(c[h+m])}catch{throw new n.ErrnoError(29)}return b&&(u.node.timestamp=Date.now()),m}}),n.mkdev(i,a,s)},forceLoadFile(r){if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(X)try{r.contents=jr(X(r.url),!0),r.usedBytes=r.contents.length}catch{throw new n.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(r,e,t,o,i){class a{constructor(){this.lengthKnown=!1,this.chunks=[]}get(v){if(!(v>this.length-1||v<0)){var k=v%this.chunkSize,j=v/this.chunkSize|0;return this.getter(j)[k]}}setDataGetter(v){this.getter=v}cacheLength(){var v=new XMLHttpRequest;if(v.open("HEAD",t,!1),v.send(null),!(v.status>=200&&v.status<300||v.status===304))throw new Error("Couldn't load "+t+". Status: "+v.status);var k=Number(v.getResponseHeader("Content-length")),j,rr=(j=v.getResponseHeader("Accept-Ranges"))&&j==="bytes",Y=(j=v.getResponseHeader("Content-Encoding"))&&j==="gzip",f=1024*1024;rr||(f=k);var d=(I,tr)=>{if(I>tr)throw new Error("invalid range ("+I+", "+tr+") or no bytes requested!");if(tr>k-1)throw new Error("only "+k+" bytes available! programmer error!");var L=new XMLHttpRequest;if(L.open("GET",t,!1),k!==f&&L.setRequestHeader("Range","bytes="+I+"-"+tr),L.responseType="arraybuffer",L.overrideMimeType&&L.overrideMimeType("text/plain; charset=x-user-defined"),L.send(null),!(L.status>=200&&L.status<300||L.status===304))throw new Error("Couldn't load "+t+". Status: "+L.status);return L.response!==void 0?new Uint8Array(L.response||[]):jr(L.responseText||"",!0)},x=this;x.setDataGetter(I=>{var tr=I*f,L=(I+1)*f-1;if(L=Math.min(L,k-1),typeof x.chunks[I]>"u"&&(x.chunks[I]=d(tr,L)),typeof x.chunks[I]>"u")throw new Error("doXHR failed!");return x.chunks[I]}),(Y||!k)&&(f=k=1,k=this.getter(0).length,f=k,Mr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=k,this._chunkSize=f,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!mr)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new a,u={isDevice:!1,contents:s}}else var u={isDevice:!1,url:t};var c=n.createFile(r,e,u,o,i);u.contents?c.contents=u.contents:u.url&&(c.contents=null,c.url=u.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var h={},b=Object.keys(c.stream_ops);b.forEach(m=>{var v=c.stream_ops[m];h[m]=(...k)=>(n.forceLoadFile(c),v(...k))});function P(m,v,k,j,rr){var Y=m.node.contents;if(rr>=Y.length)return 0;var f=Math.min(Y.length-rr,j);if(Y.slice)for(var d=0;d<f;d++)v[k+d]=Y[rr+d];else for(var d=0;d<f;d++)v[k+d]=Y.get(rr+d);return f}return h.read=(m,v,k,j,rr)=>(n.forceLoadFile(c),P(m,v,k,j,rr)),h.mmap=(m,v,k,j,rr)=>{n.forceLoadFile(c);var Y=ge(v);if(!Y)throw new n.ErrnoError(48);return P(m,C,Y,v,k),{ptr:Y,allocated:!0}},c.stream_ops=h,c}},te=(r,e)=>r?Er(B,r,e):"",E={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(A.isAbs(e))return e;var o;if(r===-100)o=n.cwd();else{var i=E.getStreamFromFD(r);o=i.path}if(e.length==0){if(!t)throw new n.ErrnoError(44);return o}return A.join2(o,e)},doStat(r,e,t){var o=r(e);y[t>>2]=o.dev,y[t+4>>2]=o.mode,T[t+8>>2]=o.nlink,y[t+12>>2]=o.uid,y[t+16>>2]=o.gid,y[t+20>>2]=o.rdev,O=[o.size>>>0,(S=o.size,+Math.abs(S)>=1?S>0?+Math.floor(S/4294967296)>>>0:~~+Math.ceil((S-+(~~S>>>0))/4294967296)>>>0:0)],y[t+24>>2]=O[0],y[t+28>>2]=O[1],y[t+32>>2]=4096,y[t+36>>2]=o.blocks;var i=o.atime.getTime(),a=o.mtime.getTime(),s=o.ctime.getTime();return O=[Math.floor(i/1e3)>>>0,(S=Math.floor(i/1e3),+Math.abs(S)>=1?S>0?+Math.floor(S/4294967296)>>>0:~~+Math.ceil((S-+(~~S>>>0))/4294967296)>>>0:0)],y[t+40>>2]=O[0],y[t+44>>2]=O[1],T[t+48>>2]=i%1e3*1e3,O=[Math.floor(a/1e3)>>>0,(S=Math.floor(a/1e3),+Math.abs(S)>=1?S>0?+Math.floor(S/4294967296)>>>0:~~+Math.ceil((S-+(~~S>>>0))/4294967296)>>>0:0)],y[t+56>>2]=O[0],y[t+60>>2]=O[1],T[t+64>>2]=a%1e3*1e3,O=[Math.floor(s/1e3)>>>0,(S=Math.floor(s/1e3),+Math.abs(S)>=1?S>0?+Math.floor(S/4294967296)>>>0:~~+Math.ceil((S-+(~~S>>>0))/4294967296)>>>0:0)],y[t+72>>2]=O[0],y[t+76>>2]=O[1],T[t+80>>2]=s%1e3*1e3,O=[o.ino>>>0,(S=o.ino,+Math.abs(S)>=1?S>0?+Math.floor(S/4294967296)>>>0:~~+Math.ceil((S-+(~~S>>>0))/4294967296)>>>0:0)],y[t+88>>2]=O[0],y[t+92>>2]=O[1],0},doMsync(r,e,t,o,i){if(!n.isFile(e.node.mode))throw new n.ErrnoError(43);if(o&2)return 0;var a=B.slice(r,r+t);n.msync(e,a,i,t,o)},varargs:void 0,get(){var r=y[+E.varargs>>2];return E.varargs+=4,r},getp(){return E.get()},getStr(r){var e=te(r);return e},getStreamFromFD(r){var e=n.getStreamChecked(r);return e}};function St(r){try{return r=E.getStr(r),n.chdir(r),0}catch(e){if(typeof n>"u"||e.name!=="ErrnoError")throw e;return-e.errno}}function kt(r,e,t,o){try{if(e=E.getStr(e),e=E.calculateAt(r,e),t&-8)return-28;var i=n.lookupPath(e,{follow:!0}),a=i.node;if(!a)return-44;var s="";return t&4&&(s+="r"),t&2&&(s+="w"),t&1&&(s+="x"),s&&n.nodePermissions(a,s)?-2:0}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function bt(r,e,t){E.varargs=t;try{var o=E.getStreamFromFD(r);switch(e){case 0:{var i=E.get();if(i<0)return-28;for(;n.streams[i];)i++;var a;return a=n.dupStream(o,i),a.fd}case 1:case 2:return 0;case 3:return o.flags;case 4:{var i=E.get();return o.flags|=i,0}case 12:{var i=E.getp(),s=0;return Lr[i+s>>1]=2,0}case 13:case 14:return 0}return-28}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Ft(r,e){try{var t=E.getStreamFromFD(r);return E.doStat(n.stat,t.path,e)}catch(o){if(typeof n>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var Ee=(r,e,t)=>re(r,B,e,t);function Pt(r,e){try{if(e===0)return-28;var t=n.cwd(),o=Br(t)+1;return e<o?-68:(Ee(t,r,e),o)}catch(i){if(typeof n>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function Mt(r,e,t){E.varargs=t;try{var o=E.getStreamFromFD(r);switch(e){case 21509:return o.tty?0:-59;case 21505:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var i=o.tty.ops.ioctl_tcgets(o),a=E.getp();y[a>>2]=i.c_iflag||0,y[a+4>>2]=i.c_oflag||0,y[a+8>>2]=i.c_cflag||0,y[a+12>>2]=i.c_lflag||0;for(var s=0;s<32;s++)C[a+s+17]=i.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return o.tty?0:-59;case 21506:case 21507:case 21508:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){for(var a=E.getp(),u=y[a>>2],c=y[a+4>>2],h=y[a+8>>2],b=y[a+12>>2],P=[],s=0;s<32;s++)P.push(C[a+s+17]);return o.tty.ops.ioctl_tcsets(o.tty,e,{c_iflag:u,c_oflag:c,c_cflag:h,c_lflag:b,c_cc:P})}return 0}case 21519:{if(!o.tty)return-59;var a=E.getp();return y[a>>2]=0,0}case 21520:return o.tty?-28:-59;case 21531:{var a=E.getp();return n.ioctl(o,e,a)}case 21523:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var m=o.tty.ops.ioctl_tiocgwinsz(o.tty),a=E.getp();Lr[a>>1]=m[0],Lr[a+2>>1]=m[1]}return 0}case 21524:return o.tty?0:-59;case 21515:return o.tty?0:-59;default:return-28}}catch(v){if(typeof n>"u"||v.name!=="ErrnoError")throw v;return-v.errno}}function Dt(r,e,t,o){try{e=E.getStr(e);var i=o&256,a=o&4096;return o=o&-6401,e=E.calculateAt(r,e,a),E.doStat(i?n.lstat:n.stat,e,t)}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function Rt(r,e,t,o){E.varargs=o;try{e=E.getStr(e),e=E.calculateAt(r,e);var i=o?E.get():0;return n.open(e,t,i).fd}catch(a){if(typeof n>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function At(r,e){try{return r=E.getStr(r),E.doStat(n.stat,r,e)}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var Tt=1,It=()=>Tt,Nt=()=>{he=!1,be=0},Ct=()=>{throw 1/0},ne=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+e*4294967296:NaN;function zt(r,e,t,o,i,a,s,u){var c=ne(i,a);try{if(isNaN(c))return 61;var h=E.getStreamFromFD(o),b=n.mmap(h,r,c,e,t),P=b.ptr;return y[s>>2]=b.allocated,T[u>>2]=P,0}catch(m){if(typeof n>"u"||m.name!=="ErrnoError")throw m;return-m.errno}}function Lt(r,e,t,o,i,a,s){var u=ne(a,s);try{var c=E.getStreamFromFD(i);t&2&&E.doMsync(r,c,e,o,u)}catch(h){if(typeof n>"u"||h.name!=="ErrnoError")throw h;return-h.errno}}var Ot=()=>{Qr("")},xt=()=>Date.now(),Se=()=>2147483648,Ut=()=>Se(),ke;ke=()=>performance.now();var Bt=(r,e,t)=>B.copyWithin(r,e,e+t),jt=r=>{var e=pr.buffer,t=(r-e.byteLength+65535)/65536;try{return pr.grow(t),se(),1}catch{}},Ht=r=>{var e=B.length;r>>>=0;var t=Se();if(r>t)return!1;for(var o=(c,h)=>c+(h-c%h)%h,i=1;i<=4;i*=2){var a=e*(1+.2/i);a=Math.min(a,r+100663296);var s=Math.min(t,o(Math.max(r,a),65536)),u=jt(s);if(u)return!0}return!1},oe={},Wt=()=>er||"./this.program",Tr=()=>{if(!Tr.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,_:Wt()};for(var t in oe)oe[t]===void 0?delete e[t]:e[t]=oe[t];var o=[];for(var t in e)o.push(`${t}=${e[t]}`);Tr.strings=o}return Tr.strings},Yt=(r,e)=>{for(var t=0;t<r.length;++t)C[e++]=r.charCodeAt(t);C[e]=0},$t=(r,e)=>{var t=0;return Tr().forEach((o,i)=>{var a=e+t;T[r+i*4>>2]=a,Yt(o,a),t+=o.length+1}),0},qt=(r,e)=>{var t=Tr();T[r>>2]=t.length;var o=0;return t.forEach(i=>o+=i.length+1),T[e>>2]=o,0},be=0,Xt=()=>he||be>0,Fe=r=>{wr=r,Xt()||(l.onExit?.(r),Dr=!0),q(r,new me(r))},Pe=(r,e)=>{wr=r,Fe(r)},Vt=Pe;function Gt(r){try{var e=E.getStreamFromFD(r);return n.close(e),0}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var Kt=(r,e,t,o)=>{for(var i=0,a=0;a<t;a++){var s=T[e>>2],u=T[e+4>>2];e+=8;var c=n.read(r,C,s,u,o);if(c<0)return-1;if(i+=c,c<u)break;typeof o<"u"&&(o+=c)}return i};function Jt(r,e,t,o){try{var i=E.getStreamFromFD(r),a=Kt(i,e,t);return T[o>>2]=a,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function Qt(r,e,t,o,i){var a=ne(e,t);try{if(isNaN(a))return 61;var s=E.getStreamFromFD(r);return n.llseek(s,a,o),O=[s.position>>>0,(S=s.position,+Math.abs(S)>=1?S>0?+Math.floor(S/4294967296)>>>0:~~+Math.ceil((S-+(~~S>>>0))/4294967296)>>>0:0)],y[i>>2]=O[0],y[i+4>>2]=O[1],s.getdents&&a===0&&o===0&&(s.getdents=null),0}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return u.errno}}var Zt=(r,e,t,o)=>{for(var i=0,a=0;a<t;a++){var s=T[e>>2],u=T[e+4>>2];e+=8;var c=n.write(r,C,s,u,o);if(c<0)return-1;i+=c,typeof o<"u"&&(o+=c)}return i};function rn(r,e,t,o){try{var i=E.getStreamFromFD(r),a=Zt(i,e,t);return T[o>>2]=a,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var Hr=r=>r%4===0&&(r%100!==0||r%400===0),en=(r,e)=>{for(var t=0,o=0;o<=e;t+=r[o++]);return t},Me=[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],tn=(r,e)=>{for(var t=new Date(r.getTime());e>0;){var o=Hr(t.getFullYear()),i=t.getMonth(),a=(o?Me:De)[i];if(e>a-t.getDate())e-=a-t.getDate()+1,t.setDate(1),i<11?t.setMonth(i+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+e),t}return t},nn=(r,e)=>{C.set(r,e)},on=(r,e,t,o)=>{var i=T[o+40>>2],a={tm_sec:y[o>>2],tm_min:y[o+4>>2],tm_hour:y[o+8>>2],tm_mday:y[o+12>>2],tm_mon:y[o+16>>2],tm_year:y[o+20>>2],tm_wday:y[o+24>>2],tm_yday:y[o+28>>2],tm_isdst:y[o+32>>2],tm_gmtoff:y[o+36>>2],tm_zone:i?te(i):""},s=te(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 c in u)s=s.replace(new RegExp(c,"g"),u[c]);var h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b=["January","February","March","April","May","June","July","August","September","October","November","December"];function P(f,d,x){for(var I=typeof f=="number"?f.toString():f||"";I.length<d;)I=x[0]+I;return I}function m(f,d){return P(f,d,"0")}function v(f,d){function x(tr){return tr<0?-1:tr>0?1:0}var I;return(I=x(f.getFullYear()-d.getFullYear()))===0&&(I=x(f.getMonth()-d.getMonth()))===0&&(I=x(f.getDate()-d.getDate())),I}function k(f){switch(f.getDay()){case 0:return new Date(f.getFullYear()-1,11,29);case 1:return f;case 2:return new Date(f.getFullYear(),0,3);case 3:return new Date(f.getFullYear(),0,2);case 4:return new Date(f.getFullYear(),0,1);case 5:return new Date(f.getFullYear()-1,11,31);case 6:return new Date(f.getFullYear()-1,11,30)}}function j(f){var d=tn(new Date(f.tm_year+1900,0,1),f.tm_yday),x=new Date(d.getFullYear(),0,4),I=new Date(d.getFullYear()+1,0,4),tr=k(x),L=k(I);return v(tr,d)<=0?v(L,d)<=0?d.getFullYear()+1:d.getFullYear():d.getFullYear()-1}var rr={"%a":f=>h[f.tm_wday].substring(0,3),"%A":f=>h[f.tm_wday],"%b":f=>b[f.tm_mon].substring(0,3),"%B":f=>b[f.tm_mon],"%C":f=>{var d=f.tm_year+1900;return m(d/100|0,2)},"%d":f=>m(f.tm_mday,2),"%e":f=>P(f.tm_mday,2," "),"%g":f=>j(f).toString().substring(2),"%G":j,"%H":f=>m(f.tm_hour,2),"%I":f=>{var d=f.tm_hour;return d==0?d=12:d>12&&(d-=12),m(d,2)},"%j":f=>m(f.tm_mday+en(Hr(f.tm_year+1900)?Me:De,f.tm_mon-1),3),"%m":f=>m(f.tm_mon+1,2),"%M":f=>m(f.tm_min,2),"%n":()=>`
4
- `,"%p":f=>f.tm_hour>=0&&f.tm_hour<12?"AM":"PM","%S":f=>m(f.tm_sec,2),"%t":()=>" ","%u":f=>f.tm_wday||7,"%U":f=>{var d=f.tm_yday+7-f.tm_wday;return m(Math.floor(d/7),2)},"%V":f=>{var d=Math.floor((f.tm_yday+7-(f.tm_wday+6)%7)/7);if((f.tm_wday+371-f.tm_yday-2)%7<=2&&d++,d){if(d==53){var I=(f.tm_wday+371-f.tm_yday)%7;I!=4&&(I!=3||!Hr(f.tm_year))&&(d=1)}}else{d=52;var x=(f.tm_wday+7-f.tm_yday-1)%7;(x==4||x==5&&Hr(f.tm_year%400-1))&&d++}return m(d,2)},"%w":f=>f.tm_wday,"%W":f=>{var d=f.tm_yday+7-(f.tm_wday+6)%7;return m(Math.floor(d/7),2)},"%y":f=>(f.tm_year+1900).toString().substring(2),"%Y":f=>f.tm_year+1900,"%z":f=>{var d=f.tm_gmtoff,x=d>=0;return d=Math.abs(d)/60,d=d/60*100+d%60,(x?"+":"-")+("0000"+d).slice(-4)},"%Z":f=>f.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var c in rr)s.includes(c)&&(s=s.replace(new RegExp(c,"g"),rr[c](a)));s=s.replace(/\0\0/g,"%");var Y=jr(s,!1);return Y.length>e?0:(nn(Y,r),Y.length-1)},an=(r,e,t,o,i)=>on(r,e,t,o),sn=r=>{if(r instanceof me||r=="unwind")return wr;q(1,r)},un=r=>{var e=Br(r)+1,t=ie(e);return Ee(r,t,e),t};n.createPreloadedFile=gt,n.staticInit(),l.FS_createPath=n.createPath,l.FS_createDataFile=n.createDataFile,l.FS_createPreloadedFile=n.createPreloadedFile,l.FS_unlink=n.unlink,l.FS_createLazyFile=n.createLazyFile,l.FS_createDevice=n.createDevice;var ln={y:ut,a:ct,L:St,M:kt,q:bt,G:Ft,D:Pt,N:Mt,E:Dt,n:Rt,F:At,I:It,A:Nt,v:Ct,r:zt,s:Lt,b:Ot,J:xt,x:Ut,H:ke,K:Bt,w:Ht,B:$t,C:qt,j:Vt,l:Gt,p:Jt,t:Qt,o:rn,h:pn,k:vn,d:cn,e:dn,m:wn,c:mn,f:hn,i:_n,g:yn,z:Fe,u:an},J=st(),fn=()=>(fn=J.P)(),Re=l._main=(r,e)=>(Re=l._main=J.Q)(r,e),Ae=(r,e)=>(Ae=J.S)(r,e),or=(r,e)=>(or=J.T)(r,e),ir=()=>(ir=J.U)(),ar=r=>(ar=J.V)(r),ie=r=>(ie=J.W)(r),Te=r=>(Te=J.X)(r);function cn(r,e,t,o){var i=ir();try{return nr(r)(e,t,o)}catch(a){if(ar(i),a!==a+0)throw a;or(1,0)}}function dn(r,e,t,o,i){var a=ir();try{return nr(r)(e,t,o,i)}catch(s){if(ar(a),s!==s+0)throw s;or(1,0)}}function vn(r,e,t){var o=ir();try{return nr(r)(e,t)}catch(i){if(ar(o),i!==i+0)throw i;or(1,0)}}function mn(r){var e=ir();try{nr(r)()}catch(t){if(ar(e),t!==t+0)throw t;or(1,0)}}function hn(r,e){var t=ir();try{nr(r)(e)}catch(o){if(ar(t),o!==o+0)throw o;or(1,0)}}function pn(r){var e=ir();try{return nr(r)()}catch(t){if(ar(e),t!==t+0)throw t;or(1,0)}}function wn(r,e,t,o,i,a){var s=ir();try{return nr(r)(e,t,o,i,a)}catch(u){if(ar(s),u!==u+0)throw u;or(1,0)}}function yn(r,e,t,o){var i=ir();try{nr(r)(e,t,o)}catch(a){if(ar(i),a!==a+0)throw a;or(1,0)}}function _n(r,e,t){var o=ir();try{nr(r)(e,t)}catch(i){if(ar(o),i!==i+0)throw i;or(1,0)}}l.addRunDependency=Or,l.removeRunDependency=Ar,l.FS_createPath=n.createPath,l.FS_createLazyFile=n.createLazyFile,l.FS_createDevice=n.createDevice,l.callMain=Ie,l.FS_createPreloadedFile=n.createPreloadedFile,l.FS=n,l.FS_createDataFile=n.createDataFile,l.FS_unlink=n.unlink;var Wr;Rr=function r(){Wr||Ne(),Wr||(Rr=r)};function Ie(r=[]){var e=Re;r.unshift(er);var t=r.length,o=ie((t+1)*4),i=o;r.forEach(s=>{T[i>>2]=un(s),i+=4}),T[i>>2]=0;try{var a=e(t,o);return Pe(a,!0),a}catch(s){return sn(s)}}function Ne(r=lr){if(yr>0||(Je(),yr>0))return;function e(){Wr||(Wr=!0,l.calledRun=!0,!Dr&&(Qe(),Ze(),H(l),l.onRuntimeInitialized&&l.onRuntimeInitialized(),Ce&&Ie(r),rt()))}l.setStatus?(l.setStatus("Running..."),setTimeout(function(){setTimeout(function(){l.setStatus("")},1),e()},1)):e()}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();var Ce=!1;return l.noInitialRun&&(Ce=!1),Ne(),F.ready}})(),D=null,R=!1,z=null,sr=null,V=null,Q=new Promise(function(p,F){sr=p,V=F}),G={OPTIMAL:"optimal",INFEASIBLE:"infeasible",UNBOUNDED:"unbounded",TIME_LIMIT:"timelimit",UNKNOWN:"unknown",ERROR:"error"};function qr(p){return p.includes("optimal solution found")?G.OPTIMAL:p.includes("problem is infeasible")?G.INFEASIBLE:p.includes("problem is unbounded")?G.UNBOUNDED:p.includes("time limit reached")?G.TIME_LIMIT:G.UNKNOWN}function Xr(p,F){var l={},H={value:null},g=F||p,U=g.match(/objective value:\s*([\d.e+-]+)/i);U&&(H.value=parseFloat(U[1]));for(var lr=/^([\w$#]+)\s+([\d.e+-]+)/gm,er;(er=lr.exec(g))!==null;){var q=er[1],fr=parseFloat(er[2]);!isNaN(fr)&&q!=="objective"&&q!=="solution"&&(l[q]=fr)}return{variables:l,objective:H}}function Cr(p){var F={solvingTime:null,nodes:null,iterations:null,gap:null},l=p.match(/Solving Time \(sec\)\s*:\s*([\d.]+)/);l&&(F.solvingTime=parseFloat(l[1]));var H=p.match(/Nodes\s*:\s*(\d+)/);H&&(F.nodes=parseInt(H[1]));var g=p.match(/LP Iterations\s*:\s*(\d+)/);g&&(F.iterations=parseInt(g[1]));var U=p.match(/Gap\s*:\s*([\d.]+)\s*%/);return U&&(F.gap=parseFloat(U[1])),F}function vr(p){return p=p||{},R?Promise.resolve():z||(z=new Promise(function(F,l){try{var H=p.wasmPath||M+"scip.wasm";W({locateFile:function(g){return g.endsWith(".wasm")?H:g},print:function(g){D&&D.onStdout&&D.onStdout(g)},printErr:function(g){D&&D.onStderr&&D.onStderr(g)}}).then(function(g){if(D=g,D.FS){try{D.FS.mkdir("/problems")}catch{}try{D.FS.mkdir("/solutions")}catch{}try{D.FS.mkdir("/settings")}catch{}}R=!0,sr&&sr(),F()}).catch(function(g){var U=new Error("SCIP WASM loading failed: "+(g.message||g));V&&V(U),l(U)})}catch(g){V&&V(g),l(g)}}),z)}function $(p,F){F=F||{};var l=function(){var H=F.format||"lp",g=F.timeLimit||3600,U=F.gap||null,lr=F.verbose||!1,er=F.parameters||{},q="",fr="";D.onStdout=function(B){q+=B+`
5
- `,lr&&console.log("[SCIP]",B)},D.onStderr=function(B){fr+=B+`
6
- `,lr&&console.error("[SCIP Error]",B)};try{var mr={mps:"mps",zpl:"zpl",cip:"cip",lp:"lp"},ae=mr[H]||"lp",K="/problems/problem."+ae,zr="/solutions/solution.sol";D.FS.writeFile(K,p);var X=[];X.push("set limits time "+g),U!==null&&X.push("set limits gap "+U);for(var gr in er)er.hasOwnProperty(gr)&&X.push("set "+gr+" "+er[gr]);X.push("read "+K),X.push("optimize"),X.push("display solution"),X.push("write solution "+zr),X.push("display statistics"),X.push("quit");var Pr=X.join(`
7
- `);D.FS.writeFile("/settings/commands.txt",Pr);var Mr=D.callMain(["-b","/settings/commands.txt"]),Z=null;try{Z=D.FS.readFile(zr,{encoding:"utf8"})}catch{}for(var hr=qr(q),pr=Xr(q,Z),Dr=Cr(q),wr=["/problems/problem.lp","/problems/problem.mps","/problems/problem.zpl","/problems/problem.cip","/solutions/solution.sol","/settings/commands.txt"],C=0;C<wr.length;C++)try{D.FS.unlink(wr[C])}catch{}return{status:hr,objective:pr.objective.value,variables:pr.variables,statistics:Dr,exitCode:Mr,output:lr?q:void 0,rawSolution:Z}}catch(B){return{status:G.ERROR,error:B.message,output:q+fr}}};return R?Promise.resolve(l()):vr(F).then(l)}function br(p,F){return p.toLowerCase().includes("minimize")||(p=`Minimize
8
- `+p),$(p,F)}function Vr(p,F){return p.toLowerCase().includes("maximize")||(p=`Maximize
9
- `+p),$(p,F)}function Gr(){var p=function(){var F="";return D.onStdout=function(l){F+=l+`
10
- `},D.callMain(["--version"]),F.trim()};return R?Promise.resolve(p()):vr().then(p)}function Fr(){return R}var Kr={init:vr,ready:Q,isReady:Fr,solve:$,minimize:br,maximize:Vr,version:Gr,Status:G};_.SCIP=Kr,vr().catch(function(p){console.error("[SCIP.js] Auto-initialization failed:",p.message)})})(typeof self<"u"?self:typeof window<"u"?window:globalThis);var N=null,Sr=!1,Ir=null,Yr=null,kr=null,Oe=new Promise(function(_,M){Yr=_,kr=M}),dr={OPTIMAL:"optimal",INFEASIBLE:"infeasible",UNBOUNDED:"unbounded",TIME_LIMIT:"timelimit",UNKNOWN:"unknown",ERROR:"error"};function xe(_){return _.includes("optimal solution found")?dr.OPTIMAL:_.includes("problem is infeasible")?dr.INFEASIBLE:_.includes("problem is unbounded")?dr.UNBOUNDED:_.includes("time limit reached")?dr.TIME_LIMIT:dr.UNKNOWN}function Ue(_,M){var W={},D={value:null},R=M||_,z=R.match(/objective value:\s*([\d.e+-]+)/i);z&&(D.value=parseFloat(z[1]));for(var sr=/^([\w$#]+)\s+([\d.e+-]+)/gm,V;(V=sr.exec(R))!==null;){var Q=V[1],G=parseFloat(V[2]);!isNaN(G)&&Q!=="objective"&&Q!=="solution"&&(W[Q]=G)}return{variables:W,objective:D}}function Be(_){var M={solvingTime:null,nodes:null,iterations:null,gap:null},W=_.match(/Solving Time \(sec\)\s*:\s*([\d.]+)/);W&&(M.solvingTime=parseFloat(W[1]));var D=_.match(/Nodes\s*:\s*(\d+)/);D&&(M.nodes=parseInt(D[1]));var R=_.match(/LP Iterations\s*:\s*(\d+)/);R&&(M.iterations=parseInt(R[1]));var z=_.match(/Gap\s*:\s*([\d.]+)\s*%/);return z&&(M.gap=parseFloat(z[1])),M}function Nr(_){return _=_||{},Sr?Promise.resolve():Ir||(Ir=new Promise(function(M,W){try{var D=_.wasmPath||Le+"scip.wasm";createSCIP({locateFile:function(R){return R.endsWith(".wasm")?D:R},print:function(R){N&&N.onStdout&&N.onStdout(R)},printErr:function(R){N&&N.onStderr&&N.onStderr(R)}}).then(function(R){if(N=R,N.FS){try{N.FS.mkdir("/problems")}catch{}try{N.FS.mkdir("/solutions")}catch{}try{N.FS.mkdir("/settings")}catch{}}Sr=!0,Yr&&Yr(),M()}).catch(function(R){var z=new Error("SCIP WASM loading failed: "+(R.message||R));kr&&kr(z),W(z)})}catch(R){kr&&kr(R),W(R)}}),Ir)}function $r(_,M){M=M||{};var W=function(){var D=M.format||"lp",R=M.timeLimit||3600,z=M.gap||null,sr=M.verbose||!1,V=M.parameters||{},Q="",G="";N.onStdout=function(g){Q+=g+`
11
- `,sr&&console.log("[SCIP]",g)},N.onStderr=function(g){G+=g+`
12
- `,sr&&console.error("[SCIP Error]",g)};try{var qr={mps:"mps",zpl:"zpl",cip:"cip",lp:"lp"},Xr=qr[D]||"lp",Cr="/problems/problem."+Xr,vr="/solutions/solution.sol";N.FS.writeFile(Cr,_);var $=[];$.push("set limits time "+R),z!==null&&$.push("set limits gap "+z);for(var br in V)V.hasOwnProperty(br)&&$.push("set "+br+" "+V[br]);$.push("read "+Cr),$.push("optimize"),$.push("display solution"),$.push("write solution "+vr),$.push("display statistics"),$.push("quit");var Vr=$.join(`
13
- `);N.FS.writeFile("/settings/commands.txt",Vr);var Gr=N.callMain(["-b","/settings/commands.txt"]),Fr=null;try{Fr=N.FS.readFile(vr,{encoding:"utf8"})}catch{}for(var Kr=xe(Q),p=Ue(Q,Fr),F=Be(Q),l=["/problems/problem.lp","/problems/problem.mps","/problems/problem.zpl","/problems/problem.cip","/solutions/solution.sol","/settings/commands.txt"],H=0;H<l.length;H++)try{N.FS.unlink(l[H])}catch{}return{status:Kr,objective:p.objective.value,variables:p.variables,statistics:F,exitCode:Gr,output:sr?Q:void 0,rawSolution:Fr}}catch(g){return{status:dr.ERROR,error:g.message,output:Q+G}}};return Sr?Promise.resolve(W()):Nr(M).then(W)}function je(_,M){return _.toLowerCase().includes("minimize")||(_=`Minimize
14
- `+_),$r(_,M)}function He(_,M){return _.toLowerCase().includes("maximize")||(_=`Maximize
15
- `+_),$r(_,M)}function We(){var _=function(){var M="";return N.onStdout=function(W){M+=W+`
16
- `},N.callMain(["--version"]),M.trim()};return Sr?Promise.resolve(_()):Nr().then(_)}function Ye(){return Sr}var $e={init:Nr,ready:Oe,isReady:Ye,solve:$r,minimize:je,maximize:He,version:We,Status:dr};ze.SCIP=$e,Nr().catch(function(_){console.error("[SCIP.js] Auto-initialization failed:",_.message)})})(typeof self<"u"?self:typeof window<"u"?window:globalThis);
3
+ `)),!r)return null;Ir=Dr(r,!0)}return Ir.shift()},rr={ttys:[],init(){},shutdown(){},register(r,e){rr.ttys[r]={input:[],output:[],ops:e},n.registerDevice(r,rr.stream_ops)},stream_ops:{open(r){var e=rr.ttys[r.node.rdev];if(!e)throw new n.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,o,a){if(!r.tty||!r.tty.ops.get_char)throw new n.ErrnoError(60);for(var i=0,s=0;s<o;s++){var u;try{u=r.tty.ops.get_char(r.tty)}catch{throw new n.ErrnoError(29)}if(u===void 0&&i===0)throw new n.ErrnoError(6);if(u==null)break;i++,e[t+s]=u}return i&&(r.node.timestamp=Date.now()),i},write(r,e,t,o,a){if(!r.tty||!r.tty.ops.put_char)throw new n.ErrnoError(60);try{for(var i=0;i<o;i++)r.tty.ops.put_char(r.tty,e[t+i])}catch{throw new n.ErrnoError(29)}return o&&(r.node.timestamp=Date.now()),i}},default_tty_ops:{get_char(r){return Ve()},put_char(r,e){e===null||e===10?(vr(lr(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(vr(lr(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?(W(lr(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(W(lr(r.output,0)),r.output=[])}}},Ge=(r,e)=>(z.fill(0,r,r+e),r),Ke=(r,e)=>Math.ceil(r/e)*e,ee=r=>{r=Ke(r,65536);var e=ce(65536,r);return e?Ge(e,r):0},p={ops_table:null,mount(r){return p.createNode(null,"/",16895,0)},createNode(r,e,t,o){if(n.isBlkdev(t)||n.isFIFO(t))throw new n.ErrnoError(63);p.ops_table||(p.ops_table={dir:{node:{getattr:p.node_ops.getattr,setattr:p.node_ops.setattr,lookup:p.node_ops.lookup,mknod:p.node_ops.mknod,rename:p.node_ops.rename,unlink:p.node_ops.unlink,rmdir:p.node_ops.rmdir,readdir:p.node_ops.readdir,symlink:p.node_ops.symlink},stream:{llseek:p.stream_ops.llseek}},file:{node:{getattr:p.node_ops.getattr,setattr:p.node_ops.setattr},stream:{llseek:p.stream_ops.llseek,read:p.stream_ops.read,write:p.stream_ops.write,allocate:p.stream_ops.allocate,mmap:p.stream_ops.mmap,msync:p.stream_ops.msync}},link:{node:{getattr:p.node_ops.getattr,setattr:p.node_ops.setattr,readlink:p.node_ops.readlink},stream:{}},chrdev:{node:{getattr:p.node_ops.getattr,setattr:p.node_ops.setattr},stream:n.chrdev_stream_ops}});var a=n.createNode(r,e,t,o);return n.isDir(a.mode)?(a.node_ops=p.ops_table.dir.node,a.stream_ops=p.ops_table.dir.stream,a.contents={}):n.isFile(a.mode)?(a.node_ops=p.ops_table.file.node,a.stream_ops=p.ops_table.file.stream,a.usedBytes=0,a.contents=null):n.isLink(a.mode)?(a.node_ops=p.ops_table.link.node,a.stream_ops=p.ops_table.link.stream):n.isChrdev(a.mode)&&(a.node_ops=p.ops_table.chrdev.node,a.stream_ops=p.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 o=1024*1024;e=Math.max(e,t*(t<o?2:1.125)>>>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=n.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,n.isDir(r.mode)?e.size=4096:n.isFile(r.mode)?e.size=r.usedBytes:n.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&&p.resizeFileStorage(r,e.size)},lookup(r,e){throw n.genericErrors[44]},mknod(r,e,t,o){return p.createNode(r,e,t,o)},rename(r,e,t){if(n.isDir(r.mode)){var o;try{o=n.lookupNode(e,t)}catch{}if(o)for(var a in o.contents)throw new n.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=n.lookupNode(r,e);for(var o in t.contents)throw new n.ErrnoError(55);delete r.contents[e],r.timestamp=Date.now()},readdir(r){var e=[".",".."];for(var t of Object.keys(r.contents))e.push(t);return e},symlink(r,e,t){var o=p.createNode(r,e,41471,0);return o.link=t,o},readlink(r){if(!n.isLink(r.mode))throw new n.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,o,a){var i=r.node.contents;if(a>=r.node.usedBytes)return 0;var s=Math.min(r.node.usedBytes-a,o);if(s>8&&i.subarray)e.set(i.subarray(a,a+s),t);else for(var u=0;u<s;u++)e[t+u]=i[a+u];return s},write(r,e,t,o,a,i){if(e.buffer===R.buffer&&(i=!1),!o)return 0;var s=r.node;if(s.timestamp=Date.now(),e.subarray&&(!s.contents||s.contents.subarray)){if(i)return s.contents=e.subarray(t,t+o),s.usedBytes=o,o;if(s.usedBytes===0&&a===0)return s.contents=e.slice(t,t+o),s.usedBytes=o,o;if(a+o<=s.usedBytes)return s.contents.set(e.subarray(t,t+o),a),o}if(p.expandFileStorage(s,a+o),s.contents.subarray&&e.subarray)s.contents.set(e.subarray(t,t+o),a);else for(var u=0;u<o;u++)s.contents[a+u]=e[t+u];return s.usedBytes=Math.max(s.usedBytes,a+o),o},llseek(r,e,t){var o=e;if(t===1?o+=r.position:t===2&&n.isFile(r.node.mode)&&(o+=r.node.usedBytes),o<0)throw new n.ErrnoError(28);return o},allocate(r,e,t){p.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,o,a){if(!n.isFile(r.node.mode))throw new n.ErrnoError(43);var i,s,u=r.node.contents;if(!(a&2)&&u.buffer===R.buffer)s=!1,i=u.byteOffset;else{if((t>0||t+e<u.length)&&(u.subarray?u=u.subarray(t,t+e):u=Array.prototype.slice.call(u,t,t+e)),s=!0,i=ee(e),!i)throw new n.ErrnoError(48);R.set(u,i)}return{ptr:i,allocated:s}},msync(r,e,t,o,a){return p.stream_ops.write(r,e,0,o,t,!1),0}}},Je=(r,e,t,o)=>{var a=o?"":`al ${r}`;ur(r,i=>{e(new Uint8Array(i)),a&&pr(a)},i=>{if(t)t();else throw`Loading data file "${r}" failed.`}),a&&kr(a)},Qe=(r,e,t,o,a,i)=>{n.createDataFile(r,e,t,o,a,i)},Ze=l.preloadPlugins||[],rt=(r,e,t,o)=>{typeof Browser<"u"&&Browser.init();var a=!1;return Ze.forEach(i=>{a||i.canHandle(e)&&(i.handle(r,e,t,o),a=!0)}),a},et=(r,e,t,o,a,i,s,u,c,h)=>{var k=e?J.resolve(D.join2(r,e)):r,S=`cp ${k}`;function m(v){function E(L){h?.(),u||Qe(r,e,L,o,a,c),i?.(),pr(S)}rt(v,k,E,()=>{s?.(),pr(S)})||E(v)}kr(S),typeof t=="string"?Je(t,m,s):m(t)},tt=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},Lr=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},n={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(r){this.name="ErrnoError",this.errno=r}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(r){this.node=r}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{constructor(r,e,t,o){r||(r=this),this.parent=r,this.mount=r.mount,this.mounted=null,this.id=n.nextInode++,this.name=e,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=o,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(r){r?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(r){r?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return n.isDir(this.mode)}get isDevice(){return n.isChrdev(this.mode)}},lookupPath(r,e={}){if(r=J.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 n.ErrnoError(32);for(var o=r.split("/").filter(S=>!!S),a=n.root,i="/",s=0;s<o.length;s++){var u=s===o.length-1;if(u&&e.parent)break;if(a=n.lookupNode(a,o[s]),i=D.join2(i,o[s]),n.isMountpoint(a)&&(!u||u&&e.follow_mount)&&(a=a.mounted.root),!u||e.follow)for(var c=0;n.isLink(a.mode);){var h=n.readlink(i);i=J.resolve(D.dirname(i),h);var k=n.lookupPath(i,{recurse_count:e.recurse_count+1});if(a=k.node,c++>40)throw new n.ErrnoError(32)}}return{path:i,node:a}},getPath(r){for(var e;;){if(n.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,o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return(r+t>>>0)%n.nameTable.length},hashAddNode(r){var e=n.hashName(r.parent.id,r.name);r.name_next=n.nameTable[e],n.nameTable[e]=r},hashRemoveNode(r){var e=n.hashName(r.parent.id,r.name);if(n.nameTable[e]===r)n.nameTable[e]=r.name_next;else for(var t=n.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=n.mayLookup(r);if(t)throw new n.ErrnoError(t);for(var o=n.hashName(r.id,e),a=n.nameTable[o];a;a=a.name_next){var i=a.name;if(a.parent.id===r.id&&i===e)return a}return n.lookup(r,e)},createNode(r,e,t,o){var a=new n.FSNode(r,e,t,o);return n.hashAddNode(a),a},destroyNode(r){n.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 n.ignorePermissions?0:e.includes("r")&&!(r.mode&292)||e.includes("w")&&!(r.mode&146)||e.includes("x")&&!(r.mode&73)?2:0},mayLookup(r){if(!n.isDir(r.mode))return 54;var e=n.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){try{var t=n.lookupNode(r,e);return 20}catch{}return n.nodePermissions(r,"wx")},mayDelete(r,e,t){var o;try{o=n.lookupNode(r,e)}catch(i){return i.errno}var a=n.nodePermissions(r,"wx");if(a)return a;if(t){if(!n.isDir(o.mode))return 54;if(n.isRoot(o)||n.getPath(o)===n.cwd())return 10}else if(n.isDir(o.mode))return 31;return 0},mayOpen(r,e){return r?n.isLink(r.mode)?32:n.isDir(r.mode)&&(n.flagsToPermissionString(e)!=="r"||e&512)?31:n.nodePermissions(r,n.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=n.MAX_OPEN_FDS;r++)if(!n.streams[r])return r;throw new n.ErrnoError(33)},getStreamChecked(r){var e=n.getStream(r);if(!e)throw new n.ErrnoError(8);return e},getStream:r=>n.streams[r],createStream(r,e=-1){return r=Object.assign(new n.FSStream,r),e==-1&&(e=n.nextfd()),r.fd=e,n.streams[e]=r,r},closeStream(r){n.streams[r]=null},dupStream(r,e=-1){var t=n.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=n.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new n.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,e)=>r<<8|e,registerDevice(r,e){n.devices[r]={stream_ops:e}},getDevice:r=>n.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var o=t.pop();e.push(o),t.push(...o.mounts)}return e},syncfs(r,e){typeof r=="function"&&(e=r,r=!1),n.syncFSRequests++,n.syncFSRequests>1&&W(`warning: ${n.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=n.getMounts(n.root.mount),o=0;function a(s){return n.syncFSRequests--,e(s)}function i(s){if(s)return i.errored?void 0:(i.errored=!0,a(s));++o>=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 o=t==="/",a=!t,i;if(o&&n.root)throw new n.ErrnoError(10);if(!o&&!a){var s=n.lookupPath(t,{follow_mount:!1});if(t=s.path,i=s.node,n.isMountpoint(i))throw new n.ErrnoError(10);if(!n.isDir(i.mode))throw new n.ErrnoError(54)}var u={type:r,opts:e,mountpoint:t,mounts:[]},c=r.mount(u);return c.mount=u,u.root=c,o?n.root=c:i&&(i.mounted=u,i.mount&&i.mount.mounts.push(u)),c},unmount(r){var e=n.lookupPath(r,{follow_mount:!1});if(!n.isMountpoint(e.node))throw new n.ErrnoError(28);var t=e.node,o=t.mounted,a=n.getMounts(o);Object.keys(n.nameTable).forEach(s=>{for(var u=n.nameTable[s];u;){var c=u.name_next;a.includes(u.mount)&&n.destroyNode(u),u=c}}),t.mounted=null;var i=t.mount.mounts.indexOf(o);t.mount.mounts.splice(i,1)},lookup(r,e){return r.node_ops.lookup(r,e)},mknod(r,e,t){var o=n.lookupPath(r,{parent:!0}),a=o.node,i=D.basename(r);if(!i||i==="."||i==="..")throw new n.ErrnoError(28);var s=n.mayCreate(a,i);if(s)throw new n.ErrnoError(s);if(!a.node_ops.mknod)throw new n.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,n.mknod(r,e,0)},mkdir(r,e){return e=e!==void 0?e:511,e&=1023,e|=16384,n.mknod(r,e,0)},mkdirTree(r,e){for(var t=r.split("/"),o="",a=0;a<t.length;++a)if(t[a]){o+="/"+t[a];try{n.mkdir(o,e)}catch(i){if(i.errno!=20)throw i}}},mkdev(r,e,t){return typeof t>"u"&&(t=e,e=438),e|=8192,n.mknod(r,e,t)},symlink(r,e){if(!J.resolve(r))throw new n.ErrnoError(44);var t=n.lookupPath(e,{parent:!0}),o=t.node;if(!o)throw new n.ErrnoError(44);var a=D.basename(e),i=n.mayCreate(o,a);if(i)throw new n.ErrnoError(i);if(!o.node_ops.symlink)throw new n.ErrnoError(63);return o.node_ops.symlink(o,a,r)},rename(r,e){var t=D.dirname(r),o=D.dirname(e),a=D.basename(r),i=D.basename(e),s,u,c;if(s=n.lookupPath(r,{parent:!0}),u=s.node,s=n.lookupPath(e,{parent:!0}),c=s.node,!u||!c)throw new n.ErrnoError(44);if(u.mount!==c.mount)throw new n.ErrnoError(75);var h=n.lookupNode(u,a),k=J.relative(r,o);if(k.charAt(0)!==".")throw new n.ErrnoError(28);if(k=J.relative(e,t),k.charAt(0)!==".")throw new n.ErrnoError(55);var S;try{S=n.lookupNode(c,i)}catch{}if(h!==S){var m=n.isDir(h.mode),v=n.mayDelete(u,a,m);if(v)throw new n.ErrnoError(v);if(v=S?n.mayDelete(c,i,m):n.mayCreate(c,i),v)throw new n.ErrnoError(v);if(!u.node_ops.rename)throw new n.ErrnoError(63);if(n.isMountpoint(h)||S&&n.isMountpoint(S))throw new n.ErrnoError(10);if(c!==u&&(v=n.nodePermissions(u,"w"),v))throw new n.ErrnoError(v);n.hashRemoveNode(h);try{u.node_ops.rename(h,c,i)}catch(E){throw E}finally{n.hashAddNode(h)}}},rmdir(r){var e=n.lookupPath(r,{parent:!0}),t=e.node,o=D.basename(r),a=n.lookupNode(t,o),i=n.mayDelete(t,o,!0);if(i)throw new n.ErrnoError(i);if(!t.node_ops.rmdir)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);t.node_ops.rmdir(t,o),n.destroyNode(a)},readdir(r){var e=n.lookupPath(r,{follow:!0}),t=e.node;if(!t.node_ops.readdir)throw new n.ErrnoError(54);return t.node_ops.readdir(t)},unlink(r){var e=n.lookupPath(r,{parent:!0}),t=e.node;if(!t)throw new n.ErrnoError(44);var o=D.basename(r),a=n.lookupNode(t,o),i=n.mayDelete(t,o,!1);if(i)throw new n.ErrnoError(i);if(!t.node_ops.unlink)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);t.node_ops.unlink(t,o),n.destroyNode(a)},readlink(r){var e=n.lookupPath(r),t=e.node;if(!t)throw new n.ErrnoError(44);if(!t.node_ops.readlink)throw new n.ErrnoError(28);return J.resolve(n.getPath(t.parent),t.node_ops.readlink(t))},stat(r,e){var t=n.lookupPath(r,{follow:!e}),o=t.node;if(!o)throw new n.ErrnoError(44);if(!o.node_ops.getattr)throw new n.ErrnoError(63);return o.node_ops.getattr(o)},lstat(r){return n.stat(r,!0)},chmod(r,e,t){var o;if(typeof r=="string"){var a=n.lookupPath(r,{follow:!t});o=a.node}else o=r;if(!o.node_ops.setattr)throw new n.ErrnoError(63);o.node_ops.setattr(o,{mode:e&4095|o.mode&-4096,timestamp:Date.now()})},lchmod(r,e){n.chmod(r,e,!0)},fchmod(r,e){var t=n.getStreamChecked(r);n.chmod(t.node,e)},chown(r,e,t,o){var a;if(typeof r=="string"){var i=n.lookupPath(r,{follow:!o});a=i.node}else a=r;if(!a.node_ops.setattr)throw new n.ErrnoError(63);a.node_ops.setattr(a,{timestamp:Date.now()})},lchown(r,e,t){n.chown(r,e,t,!0)},fchown(r,e,t){var o=n.getStreamChecked(r);n.chown(o.node,e,t)},truncate(r,e){if(e<0)throw new n.ErrnoError(28);var t;if(typeof r=="string"){var o=n.lookupPath(r,{follow:!0});t=o.node}else t=r;if(!t.node_ops.setattr)throw new n.ErrnoError(63);if(n.isDir(t.mode))throw new n.ErrnoError(31);if(!n.isFile(t.mode))throw new n.ErrnoError(28);var a=n.nodePermissions(t,"w");if(a)throw new n.ErrnoError(a);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=n.getStreamChecked(r);if(!(t.flags&2097155))throw new n.ErrnoError(28);n.truncate(t.node,e)},utime(r,e,t){var o=n.lookupPath(r,{follow:!0}),a=o.node;a.node_ops.setattr(a,{timestamp:Math.max(e,t)})},open(r,e,t){if(r==="")throw new n.ErrnoError(44);e=typeof e=="string"?tt(e):e,t=typeof t>"u"?438:t,e&64?t=t&4095|32768:t=0;var o;if(typeof r=="object")o=r;else{r=D.normalize(r);try{var a=n.lookupPath(r,{follow:!(e&131072)});o=a.node}catch{}}var i=!1;if(e&64)if(o){if(e&128)throw new n.ErrnoError(20)}else o=n.mknod(r,t,0),i=!0;if(!o)throw new n.ErrnoError(44);if(n.isChrdev(o.mode)&&(e&=-513),e&65536&&!n.isDir(o.mode))throw new n.ErrnoError(54);if(!i){var s=n.mayOpen(o,e);if(s)throw new n.ErrnoError(s)}e&512&&!i&&n.truncate(o,0),e&=-131713;var u=n.createStream({node:o,path:n.getPath(o),flags:e,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),l.logReadFiles&&!(e&1)&&(n.readFiles||(n.readFiles={}),r in n.readFiles||(n.readFiles[r]=1)),u},close(r){if(n.isClosed(r))throw new n.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{n.closeStream(r.fd)}r.fd=null},isClosed(r){return r.fd===null},llseek(r,e,t){if(n.isClosed(r))throw new n.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new n.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new n.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,o,a){if(o<0||a<0)throw new n.ErrnoError(28);if(n.isClosed(r))throw new n.ErrnoError(8);if((r.flags&2097155)===1)throw new n.ErrnoError(8);if(n.isDir(r.node.mode))throw new n.ErrnoError(31);if(!r.stream_ops.read)throw new n.ErrnoError(28);var i=typeof a<"u";if(!i)a=r.position;else if(!r.seekable)throw new n.ErrnoError(70);var s=r.stream_ops.read(r,e,t,o,a);return i||(r.position+=s),s},write(r,e,t,o,a,i){if(o<0||a<0)throw new n.ErrnoError(28);if(n.isClosed(r))throw new n.ErrnoError(8);if(!(r.flags&2097155))throw new n.ErrnoError(8);if(n.isDir(r.node.mode))throw new n.ErrnoError(31);if(!r.stream_ops.write)throw new n.ErrnoError(28);r.seekable&&r.flags&1024&&n.llseek(r,0,2);var s=typeof a<"u";if(!s)a=r.position;else if(!r.seekable)throw new n.ErrnoError(70);var u=r.stream_ops.write(r,e,t,o,a,i);return s||(r.position+=u),u},allocate(r,e,t){if(n.isClosed(r))throw new n.ErrnoError(8);if(e<0||t<=0)throw new n.ErrnoError(28);if(!(r.flags&2097155))throw new n.ErrnoError(8);if(!n.isFile(r.node.mode)&&!n.isDir(r.node.mode))throw new n.ErrnoError(43);if(!r.stream_ops.allocate)throw new n.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,o,a){if(o&2&&!(a&2)&&(r.flags&2097155)!==2)throw new n.ErrnoError(2);if((r.flags&2097155)===1)throw new n.ErrnoError(2);if(!r.stream_ops.mmap)throw new n.ErrnoError(43);return r.stream_ops.mmap(r,e,t,o,a)},msync(r,e,t,o,a){return r.stream_ops.msync?r.stream_ops.msync(r,e,t,o,a):0},ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new n.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,o=n.open(r,e.flags),a=n.stat(r),i=a.size,s=new Uint8Array(i);return n.read(o,s,0,i,0),e.encoding==="utf8"?t=lr(s,0):e.encoding==="binary"&&(t=s),n.close(o),t},writeFile(r,e,t={}){t.flags=t.flags||577;var o=n.open(r,t.flags,t.mode);if(typeof e=="string"){var a=new Uint8Array(Fr(e)+1),i=zr(e,a,0,a.length);n.write(o,a,0,i,void 0,t.canOwn)}else if(ArrayBuffer.isView(e))n.write(o,e,0,e.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");n.close(o)},cwd:()=>n.currentPath,chdir(r){var e=n.lookupPath(r,{follow:!0});if(e.node===null)throw new n.ErrnoError(44);if(!n.isDir(e.node.mode))throw new n.ErrnoError(54);var t=n.nodePermissions(e.node,"x");if(t)throw new n.ErrnoError(t);n.currentPath=e.path},createDefaultDirectories(){n.mkdir("/tmp"),n.mkdir("/home"),n.mkdir("/home/web_user")},createDefaultDevices(){n.mkdir("/dev"),n.registerDevice(n.makedev(1,3),{read:()=>0,write:(o,a,i,s,u)=>s}),n.mkdev("/dev/null",n.makedev(1,3)),rr.register(n.makedev(5,0),rr.default_tty_ops),rr.register(n.makedev(6,0),rr.default_tty1_ops),n.mkdev("/dev/tty",n.makedev(5,0)),n.mkdev("/dev/tty1",n.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(e===0&&(e=Zr(r).byteLength),r[--e]);n.createDevice("/dev","random",t),n.createDevice("/dev","urandom",t),n.mkdir("/dev/shm"),n.mkdir("/dev/shm/tmp")},createSpecialDirectories(){n.mkdir("/proc");var r=n.mkdir("/proc/self");n.mkdir("/proc/self/fd"),n.mount({mount(){var e=n.createNode(r,"fd",16895,73);return e.node_ops={lookup(t,o){var a=+o,i=n.getStreamChecked(a),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return s.parent=s,s}},e}},{},"/proc/self/fd")},createStandardStreams(){l.stdin?n.createDevice("/dev","stdin",l.stdin):n.symlink("/dev/tty","/dev/stdin"),l.stdout?n.createDevice("/dev","stdout",null,l.stdout):n.symlink("/dev/tty","/dev/stdout"),l.stderr?n.createDevice("/dev","stderr",null,l.stderr):n.symlink("/dev/tty1","/dev/stderr");var r=n.open("/dev/stdin",0),e=n.open("/dev/stdout",1),t=n.open("/dev/stderr",1)},staticInit(){[44].forEach(r=>{n.genericErrors[r]=new n.ErrnoError(r),n.genericErrors[r].stack="<generic error, no stack>"}),n.nameTable=new Array(4096),n.mount(p,{},"/"),n.createDefaultDirectories(),n.createDefaultDevices(),n.createSpecialDirectories(),n.filesystems={MEMFS:p}},init(r,e,t){n.init.initialized=!0,l.stdin=r||l.stdin,l.stdout=e||l.stdout,l.stderr=t||l.stderr,n.createStandardStreams()},quit(){n.init.initialized=!1;for(var r=0;r<n.streams.length;r++){var e=n.streams[r];e&&n.close(e)}},findObject(r,e){var t=n.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{var t=n.lookupPath(r,{follow:!e});r=t.path}catch{}var o={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=n.lookupPath(r,{parent:!0});o.parentExists=!0,o.parentPath=t.path,o.parentObject=t.node,o.name=D.basename(r),t=n.lookupPath(r,{follow:!e}),o.exists=!0,o.path=t.path,o.object=t.node,o.name=t.node.name,o.isRoot=t.path==="/"}catch(a){o.error=a.errno}return o},createPath(r,e,t,o){r=typeof r=="string"?r:n.getPath(r);for(var a=e.split("/").reverse();a.length;){var i=a.pop();if(i){var s=D.join2(r,i);try{n.mkdir(s)}catch{}r=s}}return s},createFile(r,e,t,o,a){var i=D.join2(typeof r=="string"?r:n.getPath(r),e),s=Lr(o,a);return n.create(i,s)},createDataFile(r,e,t,o,a,i){var s=e;r&&(r=typeof r=="string"?r:n.getPath(r),s=e?D.join2(r,e):r);var u=Lr(o,a),c=n.create(s,u);if(t){if(typeof t=="string"){for(var h=new Array(t.length),k=0,S=t.length;k<S;++k)h[k]=t.charCodeAt(k);t=h}n.chmod(c,u|146);var m=n.open(c,577);n.write(m,t,0,t.length,0,i),n.close(m),n.chmod(c,u)}},createDevice(r,e,t,o){var a=D.join2(typeof r=="string"?r:n.getPath(r),e),i=Lr(!!t,!!o);n.createDevice.major||(n.createDevice.major=64);var s=n.makedev(n.createDevice.major++,0);return n.registerDevice(s,{open(u){u.seekable=!1},close(u){o?.buffer?.length&&o(10)},read(u,c,h,k,S){for(var m=0,v=0;v<k;v++){var E;try{E=t()}catch{throw new n.ErrnoError(29)}if(E===void 0&&m===0)throw new n.ErrnoError(6);if(E==null)break;m++,c[h+v]=E}return m&&(u.node.timestamp=Date.now()),m},write(u,c,h,k,S){for(var m=0;m<k;m++)try{o(c[h+m])}catch{throw new n.ErrnoError(29)}return k&&(u.node.timestamp=Date.now()),m}}),n.mkdev(a,i,s)},forceLoadFile(r){if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(U)try{r.contents=Dr(U(r.url),!0),r.usedBytes=r.contents.length}catch{throw new n.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(r,e,t,o,a){class i{constructor(){this.lengthKnown=!1,this.chunks=[]}get(v){if(!(v>this.length-1||v<0)){var E=v%this.chunkSize,L=v/this.chunkSize|0;return this.getter(L)[E]}}setDataGetter(v){this.getter=v}cacheLength(){var v=new XMLHttpRequest;if(v.open("HEAD",t,!1),v.send(null),!(v.status>=200&&v.status<300||v.status===304))throw new Error("Couldn't load "+t+". Status: "+v.status);var E=Number(v.getResponseHeader("Content-length")),L,Y=(L=v.getResponseHeader("Accept-Ranges"))&&L==="bytes",O=(L=v.getResponseHeader("Content-Encoding"))&&L==="gzip",f=1024*1024;Y||(f=E);var d=(M,$)=>{if(M>$)throw new Error("invalid range ("+M+", "+$+") or no bytes requested!");if($>E-1)throw new Error("only "+E+" bytes available! programmer error!");var T=new XMLHttpRequest;if(T.open("GET",t,!1),E!==f&&T.setRequestHeader("Range","bytes="+M+"-"+$),T.responseType="arraybuffer",T.overrideMimeType&&T.overrideMimeType("text/plain; charset=x-user-defined"),T.send(null),!(T.status>=200&&T.status<300||T.status===304))throw new Error("Couldn't load "+t+". Status: "+T.status);return T.response!==void 0?new Uint8Array(T.response||[]):Dr(T.responseText||"",!0)},C=this;C.setDataGetter(M=>{var $=M*f,T=(M+1)*f-1;if(T=Math.min(T,E-1),typeof C.chunks[M]>"u"&&(C.chunks[M]=d($,T)),typeof C.chunks[M]>"u")throw new Error("doXHR failed!");return C.chunks[M]}),(O||!E)&&(f=E=1,E=this.getter(0).length,f=E,vr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=E,this._chunkSize=f,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!tr)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new i,u={isDevice:!1,contents:s}}else var u={isDevice:!1,url:t};var c=n.createFile(r,e,u,o,a);u.contents?c.contents=u.contents:u.url&&(c.contents=null,c.url=u.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var h={},k=Object.keys(c.stream_ops);k.forEach(m=>{var v=c.stream_ops[m];h[m]=(...E)=>(n.forceLoadFile(c),v(...E))});function S(m,v,E,L,Y){var O=m.node.contents;if(Y>=O.length)return 0;var f=Math.min(O.length-Y,L);if(O.slice)for(var d=0;d<f;d++)v[E+d]=O[Y+d];else for(var d=0;d<f;d++)v[E+d]=O.get(Y+d);return f}return h.read=(m,v,E,L,Y)=>(n.forceLoadFile(c),S(m,v,E,L,Y)),h.mmap=(m,v,E,L,Y)=>{n.forceLoadFile(c);var O=ee(v);if(!O)throw new n.ErrnoError(48);return S(m,R,O,v,E),{ptr:O,allocated:!0}},c.stream_ops=h,c}},Or=(r,e)=>r?lr(z,r,e):"",_={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(D.isAbs(e))return e;var o;if(r===-100)o=n.cwd();else{var a=_.getStreamFromFD(r);o=a.path}if(e.length==0){if(!t)throw new n.ErrnoError(44);return o}return D.join2(o,e)},doStat(r,e,t){var o=r(e);w[t>>2]=o.dev,w[t+4>>2]=o.mode,P[t+8>>2]=o.nlink,w[t+12>>2]=o.uid,w[t+16>>2]=o.gid,w[t+20>>2]=o.rdev,N=[o.size>>>0,(g=o.size,+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],w[t+24>>2]=N[0],w[t+28>>2]=N[1],w[t+32>>2]=4096,w[t+36>>2]=o.blocks;var a=o.atime.getTime(),i=o.mtime.getTime(),s=o.ctime.getTime();return N=[Math.floor(a/1e3)>>>0,(g=Math.floor(a/1e3),+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],w[t+40>>2]=N[0],w[t+44>>2]=N[1],P[t+48>>2]=a%1e3*1e3,N=[Math.floor(i/1e3)>>>0,(g=Math.floor(i/1e3),+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],w[t+56>>2]=N[0],w[t+60>>2]=N[1],P[t+64>>2]=i%1e3*1e3,N=[Math.floor(s/1e3)>>>0,(g=Math.floor(s/1e3),+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],w[t+72>>2]=N[0],w[t+76>>2]=N[1],P[t+80>>2]=s%1e3*1e3,N=[o.ino>>>0,(g=o.ino,+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],w[t+88>>2]=N[0],w[t+92>>2]=N[1],0},doMsync(r,e,t,o,a){if(!n.isFile(e.node.mode))throw new n.ErrnoError(43);if(o&2)return 0;var i=z.slice(r,r+t);n.msync(e,i,a,t,o)},varargs:void 0,get(){var r=w[+_.varargs>>2];return _.varargs+=4,r},getp(){return _.get()},getStr(r){var e=Or(r);return e},getStreamFromFD(r){var e=n.getStreamChecked(r);return e}};function nt(r){try{return r=_.getStr(r),n.chdir(r),0}catch(e){if(typeof n>"u"||e.name!=="ErrnoError")throw e;return-e.errno}}function ot(r,e,t,o){try{if(e=_.getStr(e),e=_.calculateAt(r,e),t&-8)return-28;var a=n.lookupPath(e,{follow:!0}),i=a.node;if(!i)return-44;var s="";return t&4&&(s+="r"),t&2&&(s+="w"),t&1&&(s+="x"),s&&n.nodePermissions(i,s)?-2:0}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function at(r,e,t){_.varargs=t;try{var o=_.getStreamFromFD(r);switch(e){case 0:{var a=_.get();if(a<0)return-28;for(;n.streams[a];)a++;var i;return i=n.dupStream(o,a),i.fd}case 1:case 2:return 0;case 3:return o.flags;case 4:{var a=_.get();return o.flags|=a,0}case 12:{var a=_.getp(),s=0;return Er[a+s>>1]=2,0}case 13:case 14:return 0}return-28}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function it(r,e){try{var t=_.getStreamFromFD(r);return _.doStat(n.stat,t.path,e)}catch(o){if(typeof n>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var te=(r,e,t)=>zr(r,z,e,t);function st(r,e){try{if(e===0)return-28;var t=n.cwd(),o=Fr(t)+1;return e<o?-68:(te(t,r,e),o)}catch(a){if(typeof n>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function ut(r,e,t){_.varargs=t;try{var o=_.getStreamFromFD(r);switch(e){case 21509:return o.tty?0:-59;case 21505:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var a=o.tty.ops.ioctl_tcgets(o),i=_.getp();w[i>>2]=a.c_iflag||0,w[i+4>>2]=a.c_oflag||0,w[i+8>>2]=a.c_cflag||0,w[i+12>>2]=a.c_lflag||0;for(var s=0;s<32;s++)R[i+s+17]=a.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return o.tty?0:-59;case 21506:case 21507:case 21508:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){for(var i=_.getp(),u=w[i>>2],c=w[i+4>>2],h=w[i+8>>2],k=w[i+12>>2],S=[],s=0;s<32;s++)S.push(R[i+s+17]);return o.tty.ops.ioctl_tcsets(o.tty,e,{c_iflag:u,c_oflag:c,c_cflag:h,c_lflag:k,c_cc:S})}return 0}case 21519:{if(!o.tty)return-59;var i=_.getp();return w[i>>2]=0,0}case 21520:return o.tty?-28:-59;case 21531:{var i=_.getp();return n.ioctl(o,e,i)}case 21523:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var m=o.tty.ops.ioctl_tiocgwinsz(o.tty),i=_.getp();Er[i>>1]=m[0],Er[i+2>>1]=m[1]}return 0}case 21524:return o.tty?0:-59;case 21515:return o.tty?0:-59;default:return-28}}catch(v){if(typeof n>"u"||v.name!=="ErrnoError")throw v;return-v.errno}}function lt(r,e,t,o){try{e=_.getStr(e);var a=o&256,i=o&4096;return o=o&-6401,e=_.calculateAt(r,e,i),_.doStat(a?n.lstat:n.stat,e,t)}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function ft(r,e,t,o){_.varargs=o;try{e=_.getStr(e),e=_.calculateAt(r,e);var a=o?_.get():0;return n.open(e,t,a).fd}catch(i){if(typeof n>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function ct(r,e){try{return r=_.getStr(r),_.doStat(n.stat,r,e)}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var dt=1,vt=()=>dt,mt=()=>{Kr=!1,ae=0},ht=()=>{throw 1/0},xr=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+e*4294967296:NaN;function pt(r,e,t,o,a,i,s,u){var c=xr(a,i);try{if(isNaN(c))return 61;var h=_.getStreamFromFD(o),k=n.mmap(h,r,c,e,t),S=k.ptr;return w[s>>2]=k.allocated,P[u>>2]=S,0}catch(m){if(typeof n>"u"||m.name!=="ErrnoError")throw m;return-m.errno}}function wt(r,e,t,o,a,i,s){var u=xr(i,s);try{var c=_.getStreamFromFD(a);t&2&&_.doMsync(r,c,e,o,u)}catch(h){if(typeof n>"u"||h.name!=="ErrnoError")throw h;return-h.errno}}var yt=()=>{Cr("")},_t=()=>Date.now(),ne=()=>2147483648,gt=()=>ne(),oe;oe=()=>performance.now();var Et=(r,e,t)=>z.copyWithin(r,e,e+t),kt=r=>{var e=or.buffer,t=(r-e.byteLength+65535)/65536;try{return or.grow(t),Hr(),1}catch{}},St=r=>{var e=z.length;r>>>=0;var t=ne();if(r>t)return!1;for(var o=(c,h)=>c+(h-c%h)%h,a=1;a<=4;a*=2){var i=e*(1+.2/a);i=Math.min(i,r+100663296);var s=Math.min(t,o(Math.max(r,i),65536)),u=kt(s);if(u)return!0}return!1},Ur={},bt=()=>X||"./this.program",wr=()=>{if(!wr.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,_:bt()};for(var t in Ur)Ur[t]===void 0?delete e[t]:e[t]=Ur[t];var o=[];for(var t in e)o.push(`${t}=${e[t]}`);wr.strings=o}return wr.strings},Ft=(r,e)=>{for(var t=0;t<r.length;++t)R[e++]=r.charCodeAt(t);R[e]=0},Dt=(r,e)=>{var t=0;return wr().forEach((o,a)=>{var i=e+t;P[r+a*4>>2]=i,Ft(o,i),t+=o.length+1}),0},Pt=(r,e)=>{var t=wr();P[r>>2]=t.length;var o=0;return t.forEach(a=>o+=a.length+1),P[e>>2]=o,0},ae=0,Mt=()=>Kr||ae>0,ie=r=>{ar=r,Mt()||(l.onExit?.(r),mr=!0),x(r,new Gr(r))},se=(r,e)=>{ar=r,ie(r)},At=se;function Rt(r){try{var e=_.getStreamFromFD(r);return n.close(e),0}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var Tt=(r,e,t,o)=>{for(var a=0,i=0;i<t;i++){var s=P[e>>2],u=P[e+4>>2];e+=8;var c=n.read(r,R,s,u,o);if(c<0)return-1;if(a+=c,c<u)break;typeof o<"u"&&(o+=c)}return a};function Nt(r,e,t,o){try{var a=_.getStreamFromFD(r),i=Tt(a,e,t);return P[o>>2]=i,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function Ct(r,e,t,o,a){var i=xr(e,t);try{if(isNaN(i))return 61;var s=_.getStreamFromFD(r);return n.llseek(s,i,o),N=[s.position>>>0,(g=s.position,+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],w[a>>2]=N[0],w[a+4>>2]=N[1],s.getdents&&i===0&&o===0&&(s.getdents=null),0}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return u.errno}}var It=(r,e,t,o)=>{for(var a=0,i=0;i<t;i++){var s=P[e>>2],u=P[e+4>>2];e+=8;var c=n.write(r,R,s,u,o);if(c<0)return-1;a+=c,typeof o<"u"&&(o+=c)}return a};function zt(r,e,t,o){try{var a=_.getStreamFromFD(r),i=It(a,e,t);return P[o>>2]=i,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var Pr=r=>r%4===0&&(r%100!==0||r%400===0),Lt=(r,e)=>{for(var t=0,o=0;o<=e;t+=r[o++]);return t},ue=[31,29,31,30,31,30,31,31,30,31,30,31],le=[31,28,31,30,31,30,31,31,30,31,30,31],Ot=(r,e)=>{for(var t=new Date(r.getTime());e>0;){var o=Pr(t.getFullYear()),a=t.getMonth(),i=(o?ue:le)[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},xt=(r,e)=>{R.set(r,e)},Ut=(r,e,t,o)=>{var a=P[o+40>>2],i={tm_sec:w[o>>2],tm_min:w[o+4>>2],tm_hour:w[o+8>>2],tm_mday:w[o+12>>2],tm_mon:w[o+16>>2],tm_year:w[o+20>>2],tm_wday:w[o+24>>2],tm_yday:w[o+28>>2],tm_isdst:w[o+32>>2],tm_gmtoff:w[o+36>>2],tm_zone:a?Or(a):""},s=Or(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 c in u)s=s.replace(new RegExp(c,"g"),u[c]);var h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],k=["January","February","March","April","May","June","July","August","September","October","November","December"];function S(f,d,C){for(var M=typeof f=="number"?f.toString():f||"";M.length<d;)M=C[0]+M;return M}function m(f,d){return S(f,d,"0")}function v(f,d){function C($){return $<0?-1:$>0?1:0}var M;return(M=C(f.getFullYear()-d.getFullYear()))===0&&(M=C(f.getMonth()-d.getMonth()))===0&&(M=C(f.getDate()-d.getDate())),M}function E(f){switch(f.getDay()){case 0:return new Date(f.getFullYear()-1,11,29);case 1:return f;case 2:return new Date(f.getFullYear(),0,3);case 3:return new Date(f.getFullYear(),0,2);case 4:return new Date(f.getFullYear(),0,1);case 5:return new Date(f.getFullYear()-1,11,31);case 6:return new Date(f.getFullYear()-1,11,30)}}function L(f){var d=Ot(new Date(f.tm_year+1900,0,1),f.tm_yday),C=new Date(d.getFullYear(),0,4),M=new Date(d.getFullYear()+1,0,4),$=E(C),T=E(M);return v($,d)<=0?v(T,d)<=0?d.getFullYear()+1:d.getFullYear():d.getFullYear()-1}var Y={"%a":f=>h[f.tm_wday].substring(0,3),"%A":f=>h[f.tm_wday],"%b":f=>k[f.tm_mon].substring(0,3),"%B":f=>k[f.tm_mon],"%C":f=>{var d=f.tm_year+1900;return m(d/100|0,2)},"%d":f=>m(f.tm_mday,2),"%e":f=>S(f.tm_mday,2," "),"%g":f=>L(f).toString().substring(2),"%G":L,"%H":f=>m(f.tm_hour,2),"%I":f=>{var d=f.tm_hour;return d==0?d=12:d>12&&(d-=12),m(d,2)},"%j":f=>m(f.tm_mday+Lt(Pr(f.tm_year+1900)?ue:le,f.tm_mon-1),3),"%m":f=>m(f.tm_mon+1,2),"%M":f=>m(f.tm_min,2),"%n":()=>`
4
+ `,"%p":f=>f.tm_hour>=0&&f.tm_hour<12?"AM":"PM","%S":f=>m(f.tm_sec,2),"%t":()=>" ","%u":f=>f.tm_wday||7,"%U":f=>{var d=f.tm_yday+7-f.tm_wday;return m(Math.floor(d/7),2)},"%V":f=>{var d=Math.floor((f.tm_yday+7-(f.tm_wday+6)%7)/7);if((f.tm_wday+371-f.tm_yday-2)%7<=2&&d++,d){if(d==53){var M=(f.tm_wday+371-f.tm_yday)%7;M!=4&&(M!=3||!Pr(f.tm_year))&&(d=1)}}else{d=52;var C=(f.tm_wday+7-f.tm_yday-1)%7;(C==4||C==5&&Pr(f.tm_year%400-1))&&d++}return m(d,2)},"%w":f=>f.tm_wday,"%W":f=>{var d=f.tm_yday+7-(f.tm_wday+6)%7;return m(Math.floor(d/7),2)},"%y":f=>(f.tm_year+1900).toString().substring(2),"%Y":f=>f.tm_year+1900,"%z":f=>{var d=f.tm_gmtoff,C=d>=0;return d=Math.abs(d)/60,d=d/60*100+d%60,(C?"+":"-")+("0000"+d).slice(-4)},"%Z":f=>f.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var c in Y)s.includes(c)&&(s=s.replace(new RegExp(c,"g"),Y[c](i)));s=s.replace(/\0\0/g,"%");var O=Dr(s,!1);return O.length>e?0:(xt(O,r),O.length-1)},Bt=(r,e,t,o,a)=>Ut(r,e,t,o),jt=r=>{if(r instanceof Gr||r=="unwind")return ar;x(1,r)},Ht=r=>{var e=Fr(r)+1,t=Br(e);return te(r,t,e),t};n.createPreloadedFile=et,n.staticInit(),l.FS_createPath=n.createPath,l.FS_createDataFile=n.createDataFile,l.FS_createPreloadedFile=n.createPreloadedFile,l.FS_unlink=n.unlink,l.FS_createLazyFile=n.createLazyFile,l.FS_createDevice=n.createDevice;var Wt={y:We,a:$e,L:nt,M:ot,q:at,G:it,D:st,N:ut,E:lt,n:ft,F:ct,I:vt,A:mt,v:ht,r:pt,s:wt,b:yt,J:_t,x:gt,H:oe,K:Et,w:St,B:Dt,C:Pt,j:At,l:Rt,p:Nt,t:Ct,o:zt,h:Kt,k:qt,d:Xt,e:$t,m:Jt,c:Vt,f:Gt,i:Zt,g:Qt,z:ie,u:Bt},j=He(),Yt=()=>(Yt=j.P)(),fe=l._main=(r,e)=>(fe=l._main=j.Q)(r,e),ce=(r,e)=>(ce=j.S)(r,e),V=(r,e)=>(V=j.T)(r,e),G=()=>(G=j.U)(),K=r=>(K=j.V)(r),Br=r=>(Br=j.W)(r),de=r=>(de=j.X)(r);function Xt(r,e,t,o){var a=G();try{return q(r)(e,t,o)}catch(i){if(K(a),i!==i+0)throw i;V(1,0)}}function $t(r,e,t,o,a){var i=G();try{return q(r)(e,t,o,a)}catch(s){if(K(i),s!==s+0)throw s;V(1,0)}}function qt(r,e,t){var o=G();try{return q(r)(e,t)}catch(a){if(K(o),a!==a+0)throw a;V(1,0)}}function Vt(r){var e=G();try{q(r)()}catch(t){if(K(e),t!==t+0)throw t;V(1,0)}}function Gt(r,e){var t=G();try{q(r)(e)}catch(o){if(K(t),o!==o+0)throw o;V(1,0)}}function Kt(r){var e=G();try{return q(r)()}catch(t){if(K(e),t!==t+0)throw t;V(1,0)}}function Jt(r,e,t,o,a,i){var s=G();try{return q(r)(e,t,o,a,i)}catch(u){if(K(s),u!==u+0)throw u;V(1,0)}}function Qt(r,e,t,o){var a=G();try{q(r)(e,t,o)}catch(i){if(K(a),i!==i+0)throw i;V(1,0)}}function Zt(r,e,t){var o=G();try{q(r)(e,t)}catch(a){if(K(o),a!==a+0)throw a;V(1,0)}}l.addRunDependency=kr,l.removeRunDependency=pr,l.FS_createPath=n.createPath,l.FS_createLazyFile=n.createLazyFile,l.FS_createDevice=n.createDevice,l.callMain=ve,l.FS_createPreloadedFile=n.createPreloadedFile,l.FS=n,l.FS_createDataFile=n.createDataFile,l.FS_unlink=n.unlink;var Mr;hr=function r(){Mr||me(),Mr||(hr=r)};function ve(r=[]){var e=fe;r.unshift(X);var t=r.length,o=Br((t+1)*4),a=o;r.forEach(s=>{P[a>>2]=Ht(s),a+=4}),P[a>>2]=0;try{var i=e(t,o);return se(i,!0),i}catch(s){return jt(s)}}function me(r=Q){if(ir>0||(Ne(),ir>0))return;function e(){Mr||(Mr=!0,l.calledRun=!0,!mr&&(Ce(),Ie(),H(l),l.onRuntimeInitialized&&l.onRuntimeInitialized(),he&&ve(r),ze()))}l.setStatus?(l.setStatus("Running..."),setTimeout(function(){setTimeout(function(){l.setStatus("")},1),e()},1)):e()}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();var he=!1;return l.noInitialRun&&(he=!1),me(),b.ready}})(),A=null,fr=!1,yr=null,Rr=null,cr=null,ye=new Promise(function(y,b){Rr=y,cr=b}),er={OPTIMAL:"optimal",INFEASIBLE:"infeasible",UNBOUNDED:"unbounded",TIME_LIMIT:"timelimit",UNKNOWN:"unknown",ERROR:"error"};function _e(y){return y.includes("optimal solution found")?er.OPTIMAL:y.includes("problem is infeasible")?er.INFEASIBLE:y.includes("problem is unbounded")?er.UNBOUNDED:y.includes("time limit reached")?er.TIME_LIMIT:er.UNKNOWN}function ge(y,b){var l={},H={value:null},F=b||y,I=F.match(/objective value:\s*([\d.e+-]+)/i);I&&(H.value=parseFloat(I[1]));for(var Q=/^([\w$#]+)\s+([\d.e+-]+)/gm,X;(X=Q.exec(F))!==null;){var x=X[1],Z=parseFloat(X[2]);!isNaN(Z)&&x!=="objective"&&x!=="solution"&&(l[x]=Z)}return{variables:l,objective:H}}function Ee(y){var b={solvingTime:null,nodes:null,iterations:null,gap:null},l=y.match(/Solving Time \(sec\)\s*:\s*([\d.]+)/);l&&(b.solvingTime=parseFloat(l[1]));var H=y.match(/Nodes\s*:\s*(\d+)/);H&&(b.nodes=parseInt(H[1]));var F=y.match(/LP Iterations\s*:\s*(\d+)/);F&&(b.iterations=parseInt(F[1]));var I=y.match(/Gap\s*:\s*([\d.]+)\s*%/);return I&&(b.gap=parseFloat(I[1])),b}function _r(y){return y=y||{},fr?Promise.resolve():yr||(yr=new Promise(function(b,l){try{var H=y.wasmPath||Ar+"scip.wasm";we({locateFile:function(F){return F.endsWith(".wasm")?H:F},print:function(F){A&&A.onStdout&&A.onStdout(F)},printErr:function(F){A&&A.onStderr&&A.onStderr(F)}}).then(function(F){if(A=F,A.FS){try{A.FS.mkdir("/problems")}catch{}try{A.FS.mkdir("/solutions")}catch{}try{A.FS.mkdir("/settings")}catch{}}fr=!0,Rr&&Rr(),b()}).catch(function(F){var I=new Error("SCIP WASM loading failed: "+(F.message||F));cr&&cr(I),l(I)})}catch(F){cr&&cr(F),l(F)}}),yr)}function Tr(y,b){b=b||{};var l=function(){var H=b.format||"lp",F=b.timeLimit||3600,I=b.gap||null,Q=b.verbose||!1,X=b.parameters||{},x="",Z="";A.onStdout=function(z){x+=z+`
5
+ `,Q&&console.log("[SCIP]",z)},A.onStderr=function(z){Z+=z+`
6
+ `,Q&&console.error("[SCIP Error]",z)};try{var tr={mps:"mps",zpl:"zpl",cip:"cip",lp:"lp"},jr=tr[H]||"lp",B="/problems/problem."+jr,gr="/solutions/solution.sol";A.FS.writeFile(B,y);var U=[];U.push("set limits time "+F),I!==null&&U.push("set limits gap "+I);for(var ur in X)X.hasOwnProperty(ur)&&U.push("set "+ur+" "+X[ur]);U.push("read "+B),U.push("optimize"),U.push("display solution"),U.push("write solution "+gr),U.push("display statistics"),U.push("quit");var dr=U.join(`
7
+ `);A.FS.writeFile("/settings/commands.txt",dr);var vr=A.callMain(["-b","/settings/commands.txt"]),W=null;try{W=A.FS.readFile(gr,{encoding:"utf8"})}catch{}for(var nr=_e(x),or=ge(x,W),mr=Ee(x),ar=["/problems/problem.lp","/problems/problem.mps","/problems/problem.zpl","/problems/problem.cip","/solutions/solution.sol","/settings/commands.txt"],R=0;R<ar.length;R++)try{A.FS.unlink(ar[R])}catch{}return{status:nr,objective:or.objective.value,variables:or.variables,statistics:mr,exitCode:vr,output:Q?x:void 0,rawSolution:W}}catch(z){return{status:er.ERROR,error:z.message,output:x+Z}}};return fr?Promise.resolve(l()):_r(b).then(l)}function ke(y,b){return y.toLowerCase().includes("minimize")||(y=`Minimize
8
+ `+y),Tr(y,b)}function Se(y,b){return y.toLowerCase().includes("maximize")||(y=`Maximize
9
+ `+y),Tr(y,b)}function be(){var y=function(){var b="";return A.onStdout=function(l){b+=l+`
10
+ `},A.callMain(["--version"]),b.trim()};return fr?Promise.resolve(y()):_r().then(y)}function Fe(){return fr}var De={init:_r,ready:ye,isReady:Fe,solve:Tr,minimize:ke,maximize:Se,version:be,Status:er};pe.SCIP=De,_r().catch(function(y){console.error("[SCIP.js] Auto-initialization failed:",y.message)})})(typeof self<"u"?self:typeof window<"u"?window:globalThis);
package/dist/scip.wasm CHANGED
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@areb0s/scip.js",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "SCIP Optimization Solver compiled to WebAssembly - LP, MIP, and MINLP support",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",