@areb0s/scip.js 1.2.8 → 1.2.9
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/pre.js +36 -0
- package/dist/scip-wrapper.js +43 -43
- package/dist/scip.js +19 -1
- package/dist/scip.min.js +10 -9
- package/package.json +1 -1
package/dist/pre.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Pre-initialization script for SCIP WASM
|
|
2
|
+
// This runs before the main SCIP module initializes
|
|
3
|
+
|
|
4
|
+
Module['preRun'] = Module['preRun'] || [];
|
|
5
|
+
Module['postRun'] = Module['postRun'] || [];
|
|
6
|
+
|
|
7
|
+
// Create virtual filesystem directories
|
|
8
|
+
Module['preRun'].push(function() {
|
|
9
|
+
FS.mkdir('/problems');
|
|
10
|
+
FS.mkdir('/solutions');
|
|
11
|
+
FS.mkdir('/settings');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Capture stdout/stderr
|
|
15
|
+
Module['print'] = function(text) {
|
|
16
|
+
if (Module['onStdout']) {
|
|
17
|
+
Module['onStdout'](text);
|
|
18
|
+
} else {
|
|
19
|
+
console.log('[SCIP]', text);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
Module['printErr'] = function(text) {
|
|
24
|
+
if (Module['onStderr']) {
|
|
25
|
+
Module['onStderr'](text);
|
|
26
|
+
} else {
|
|
27
|
+
console.error('[SCIP Error]', text);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Exit handler
|
|
32
|
+
Module['onExit'] = function(code) {
|
|
33
|
+
if (Module['onExitCallback']) {
|
|
34
|
+
Module['onExitCallback'](code);
|
|
35
|
+
}
|
|
36
|
+
};
|
package/dist/scip-wrapper.js
CHANGED
|
@@ -44,13 +44,13 @@ const DEFAULT_CDN_BASE =
|
|
|
44
44
|
/**
|
|
45
45
|
* Get base URL from global SCIP_BASE_URL or default CDN
|
|
46
46
|
*/
|
|
47
|
-
function getBaseUrl() {
|
|
48
|
-
// Safe check for global scope (works in browser, worker, and SSR)
|
|
49
|
-
const globalScope =
|
|
50
|
-
(typeof globalThis !== "undefined" && globalThis) ||
|
|
51
|
-
(typeof self !== "undefined" && self) ||
|
|
52
|
-
(typeof window !== "undefined" && window) ||
|
|
53
|
-
{};
|
|
47
|
+
function getBaseUrl() {
|
|
48
|
+
// Safe check for global scope (works in browser, worker, and SSR)
|
|
49
|
+
const globalScope =
|
|
50
|
+
(typeof globalThis !== "undefined" && globalThis) ||
|
|
51
|
+
(typeof self !== "undefined" && self) ||
|
|
52
|
+
(typeof window !== "undefined" && window) ||
|
|
53
|
+
{};
|
|
54
54
|
|
|
55
55
|
// Check for explicit SCIP_BASE_URL
|
|
56
56
|
if (globalScope.SCIP_BASE_URL) {
|
|
@@ -66,9 +66,9 @@ function getBaseUrl() {
|
|
|
66
66
|
return __importMetaUrl.substring(0, __importMetaUrl.lastIndexOf("/") + 1);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
// Default to CDN
|
|
70
|
-
return DEFAULT_CDN_BASE;
|
|
71
|
-
}
|
|
69
|
+
// Default to CDN
|
|
70
|
+
return DEFAULT_CDN_BASE;
|
|
71
|
+
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* Solution status enum
|
|
@@ -171,28 +171,28 @@ export async function init(options = {}) {
|
|
|
171
171
|
const baseUrl = getBaseUrl();
|
|
172
172
|
const wasmPath = options.wasmPath || baseUrl + "scip.wasm";
|
|
173
173
|
|
|
174
|
-
// Dynamic import of the Emscripten-generated module
|
|
175
|
-
const createSCIP = (await import("./scip-core.js")).default;
|
|
176
|
-
|
|
177
|
-
scipModule = await createSCIP({
|
|
178
|
-
locateFile: (path) => {
|
|
179
|
-
if (path.endsWith(".wasm")) {
|
|
180
|
-
return wasmPath;
|
|
181
|
-
}
|
|
182
|
-
return path;
|
|
183
|
-
},
|
|
184
|
-
// Capture stdout/stderr from Emscripten
|
|
185
|
-
print: (text) => {
|
|
186
|
-
if (scipModule && scipModule.onStdout) {
|
|
187
|
-
scipModule.onStdout(text);
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
printErr: (text) => {
|
|
191
|
-
if (scipModule && scipModule.onStderr) {
|
|
192
|
-
scipModule.onStderr(text);
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
});
|
|
174
|
+
// Dynamic import of the Emscripten-generated module
|
|
175
|
+
const createSCIP = (await import("./scip-core.js")).default;
|
|
176
|
+
|
|
177
|
+
scipModule = await createSCIP({
|
|
178
|
+
locateFile: (path) => {
|
|
179
|
+
if (path.endsWith(".wasm")) {
|
|
180
|
+
return wasmPath;
|
|
181
|
+
}
|
|
182
|
+
return path;
|
|
183
|
+
},
|
|
184
|
+
// Capture stdout/stderr from Emscripten
|
|
185
|
+
print: (text) => {
|
|
186
|
+
if (scipModule && scipModule.onStdout) {
|
|
187
|
+
scipModule.onStdout(text);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
printErr: (text) => {
|
|
191
|
+
if (scipModule && scipModule.onStderr) {
|
|
192
|
+
scipModule.onStderr(text);
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
196
|
|
|
197
197
|
// Create directories for problems, solutions, settings
|
|
198
198
|
if (scipModule.FS) {
|
|
@@ -286,14 +286,14 @@ export async function solve(problem, options = {}) {
|
|
|
286
286
|
await init(options);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
289
|
+
const {
|
|
290
|
+
format = "lp",
|
|
291
|
+
timeLimit = 3600,
|
|
292
|
+
gap = null,
|
|
293
|
+
verbose = false,
|
|
294
|
+
parameters = {},
|
|
295
|
+
initialSolution = null, // Warm start: { varName: value, ... }
|
|
296
|
+
} = options;
|
|
297
297
|
|
|
298
298
|
// Capture output
|
|
299
299
|
let stdout = "";
|
|
@@ -342,14 +342,14 @@ export async function solve(problem, options = {}) {
|
|
|
342
342
|
|
|
343
343
|
// Warm start: write and read initial solution
|
|
344
344
|
if (initialSolution && Object.keys(initialSolution).length > 0) {
|
|
345
|
-
const solLines = [
|
|
345
|
+
const solLines = ["solution status: unknown"];
|
|
346
346
|
for (const [varName, value] of Object.entries(initialSolution)) {
|
|
347
347
|
if (value !== 0) {
|
|
348
348
|
solLines.push(`${varName} ${value}`);
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
const initialSolutionFile =
|
|
352
|
-
scipModule.FS.writeFile(initialSolutionFile, solLines.join(
|
|
351
|
+
const initialSolutionFile = "/solutions/initial.sol";
|
|
352
|
+
scipModule.FS.writeFile(initialSolutionFile, solLines.join("\n"));
|
|
353
353
|
commands.push(`read solution ${initialSolutionFile}`);
|
|
354
354
|
}
|
|
355
355
|
commands.push("optimize");
|
package/dist/scip.js
CHANGED
|
@@ -197,6 +197,7 @@ var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;Module["ready"]=
|
|
|
197
197
|
var gap = options.gap || null;
|
|
198
198
|
var verbose = options.verbose || false;
|
|
199
199
|
var parameters = options.parameters || {};
|
|
200
|
+
var initialSolution = options.initialSolution || null;
|
|
200
201
|
|
|
201
202
|
var stdout = '';
|
|
202
203
|
var stderr = '';
|
|
@@ -228,11 +229,28 @@ var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;Module["ready"]=
|
|
|
228
229
|
|
|
229
230
|
for (var key in parameters) {
|
|
230
231
|
if (parameters.hasOwnProperty(key)) {
|
|
231
|
-
|
|
232
|
+
var paramPath = key.replace(/\//g, ' ');
|
|
233
|
+
commands.push('set ' + paramPath + ' ' + parameters[key]);
|
|
232
234
|
}
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
commands.push('read ' + problemFile);
|
|
238
|
+
|
|
239
|
+
// Warm start: write and read initial solution
|
|
240
|
+
if (initialSolution && Object.keys(initialSolution).length > 0) {
|
|
241
|
+
var solLines = ['solution status: unknown'];
|
|
242
|
+
for (var varName in initialSolution) {
|
|
243
|
+
if (initialSolution.hasOwnProperty(varName)) {
|
|
244
|
+
var val = initialSolution[varName];
|
|
245
|
+
if (val !== 0) {
|
|
246
|
+
solLines.push(varName + ' ' + val);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
var initialSolutionFile = '/solutions/initial.sol';
|
|
251
|
+
scipModule.FS.writeFile(initialSolutionFile, solLines.join('\n'));
|
|
252
|
+
commands.push('read solution ' + initialSolutionFile);
|
|
253
|
+
}
|
|
236
254
|
commands.push('optimize');
|
|
237
255
|
commands.push('display solution');
|
|
238
256
|
commands.push('write solution ' + solutionFile);
|
package/dist/scip.min.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(je){"use strict";var Yr=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 b=document.currentScript.src;return b.substring(0,b.lastIndexOf("/")+1)}return"https://cdn.jsdelivr.net/npm/@areb0s/scip.js@1.2.8/dist/"}(),ze=(()=>{var b=Yr;return function(A={}){var f=A,W,D;f.ready=new Promise((r,e)=>{W=r,D=e});var O=Object.assign({},f),nr=[],K="./this.program",X=(r,e)=>{throw e},J=typeof window=="object",Z=typeof importScripts=="function",ae=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",q="";function xr(r){return f.locateFile?f.locateFile(r,q):q+r}var vr,Y,ur;(J||Z)&&(Z?q=self.location.href:typeof document<"u"&&document.currentScript&&(q=document.currentScript.src),b&&(q=b),q.startsWith("blob:")?q="":q=q.substr(0,q.replace(/[?#].*/,"").lastIndexOf("/")+1),vr=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},Z&&(ur=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),Y=(r,e,t)=>{var n=new XMLHttpRequest;n.open("GET",r,!0),n.responseType="arraybuffer",n.onload=()=>{if(n.status==200||n.status==0&&n.response){e(n.response);return}t()},n.onerror=t,n.send(null)});var Er=f.print||console.log.bind(console),V=f.printErr||console.error.bind(console);Object.assign(f,O),O=null,f.arguments&&(nr=f.arguments),f.thisProgram&&(K=f.thisProgram),f.quit&&(X=f.quit);var Q;f.wasmBinary&&(Q=f.wasmBinary);var cr,hr=!1,mr,U,rr,fr,Gr,k,R,kr,pr;function ir(){var r=cr.buffer;f.HEAP8=U=new Int8Array(r),f.HEAP16=fr=new Int16Array(r),f.HEAPU8=rr=new Uint8Array(r),f.HEAPU16=Gr=new Uint16Array(r),f.HEAP32=k=new Int32Array(r),f.HEAPU32=R=new Uint32Array(r),f.HEAPF32=kr=new Float32Array(r),f.HEAPF64=pr=new Float64Array(r)}var _r=[],or=[],I=[],Sr=[],qe=!1;function Ve(){if(f.preRun)for(typeof f.preRun=="function"&&(f.preRun=[f.preRun]);f.preRun.length;)Ze(f.preRun.shift());Ir(_r)}function Ge(){qe=!0,!f.noFSInit&&!i.init.initialized&&i.init(),i.ignorePermissions=!1,ar.init(),Ir(or)}function Ke(){Ir(I)}function Je(){if(f.postRun)for(typeof f.postRun=="function"&&(f.postRun=[f.postRun]);f.postRun.length;)rt(f.postRun.shift());Ir(Sr)}function Ze(r){_r.unshift(r)}function Qe(r){or.unshift(r)}function rt(r){Sr.unshift(r)}var lr=0,Kr=null,br=null;function bi(r){return r}function Tr(r){lr++,f.monitorRunDependencies?.(lr)}function Fr(r){if(lr--,f.monitorRunDependencies?.(lr),lr==0&&(Kr!==null&&(clearInterval(Kr),Kr=null),br)){var e=br;br=null,e()}}function Nr(r){f.onAbort?.(r),r="Aborted("+r+")",V(r),hr=!0,mr=1,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw D(e),e}var et="data:application/octet-stream;base64,",se=r=>r.startsWith(et),dr;f.locateFile?(dr="scip.wasm",se(dr)||(dr=xr(dr))):dr=new URL("scip.wasm",Yr).href;function ue(r){if(r==dr&&Q)return new Uint8Array(Q);if(ur)return ur(r);throw"both async and sync fetching of the wasm failed"}function tt(r){return!Q&&(J||Z)&&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(()=>ue(r)):Promise.resolve().then(()=>ue(r))}function ce(r,e,t){return tt(r).then(n=>WebAssembly.instantiate(n,e)).then(t,n=>{V(`failed to asynchronously prepare wasm: ${n}`),Nr(n)})}function nt(r,e,t,n){return!r&&typeof WebAssembly.instantiateStreaming=="function"&&!se(e)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(o=>{var a=WebAssembly.instantiateStreaming(o,t);return a.then(n,function(s){return V(`wasm streaming compile failed: ${s}`),V("falling back to ArrayBuffer instantiation"),ce(e,t,n)})}):ce(e,t,n)}function it(){var r={a:yn};function e(n,o){return N=n.exports,cr=N.Ra,ir(),de=N.Ua,Qe(N.Sa),Fr("wasm-instantiate"),N}Tr("wasm-instantiate");function t(n){e(n.instance)}if(f.instantiateWasm)try{return f.instantiateWasm(r,e)}catch(n){V(`Module.instantiateWasm callback failed with error: ${n}`),D(n)}return nt(Q,dr,r,t).catch(D),{}}var M,B;function fe(r){this.name="ExitStatus",this.message=`Program terminated with exit(${r})`,this.status=r}var Ir=r=>{for(;r.length>0;)r.shift()(f)},le=f.noExitRuntime||!0,jr=[],de,g=r=>{var e=jr[r];return e||(r>=jr.length&&(jr.length=r+1),jr[r]=e=de.get(r)),e},ot=(r,e)=>g(r)(e),zr=[],Lr=0,at=r=>{var e=new Jr(r);return e.get_caught()||(e.set_caught(!0),Lr--),e.set_rethrown(!1),zr.push(e),oe(e.excPtr),e.get_exception_ptr()},er=0,st=()=>{m(0,0);var r=zr.pop();ie(r.excPtr),er=0};class Jr{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){R[this.ptr+4>>2]=e}get_type(){return R[this.ptr+4>>2]}set_destructor(e){R[this.ptr+8>>2]=e}get_destructor(){return R[this.ptr+8>>2]}set_caught(e){e=e?1:0,U[this.ptr+12]=e}get_caught(){return U[this.ptr+12]!=0}set_rethrown(e){e=e?1:0,U[this.ptr+13]=e}get_rethrown(){return U[this.ptr+13]!=0}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){R[this.ptr+16>>2]=e}get_adjusted_ptr(){return R[this.ptr+16>>2]}get_exception_ptr(){var e=De(this.get_type());if(e)return R[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var ut=r=>{throw er||(er=r),er},Or=r=>{var e=er;if(!e)return Dr(0),0;var t=new Jr(e);t.set_adjusted_ptr(e);var n=t.get_type();if(!n)return Dr(0),e;for(var o in r){var a=r[o];if(a===0||a===n)break;var s=t.ptr+16;if(Me(a,n,s))return Dr(a),e}return Dr(n),e},ct=()=>Or([]),ft=r=>Or([r]),lt=(r,e)=>Or([r,e]),dt=(r,e,t,n,o)=>Or([r,e,t,n,o]),vt=()=>{var r=zr.pop();r||Nr("no exception to throw");var e=r.excPtr;throw r.get_rethrown()||(zr.push(r),r.set_rethrown(!0),r.set_caught(!1),Lr++),er=e,er},ht=(r,e,t)=>{var n=new Jr(r);throw n.init(e,t),er=r,Lr++,er},mt=()=>Lr,C={isAbs:r=>r.charAt(0)==="/",splitPath:r=>{var e=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return e.exec(r).slice(1)},normalizeArray:(r,e)=>{for(var t=0,n=r.length-1;n>=0;n--){var o=r[n];o==="."?r.splice(n,1):o===".."?(r.splice(n,1),t++):t&&(r.splice(n,1),t--)}if(e)for(;t;t--)r.unshift("..");return r},normalize:r=>{var e=C.isAbs(r),t=r.substr(-1)==="/";return r=C.normalizeArray(r.split("/").filter(n=>!!n),!e).join("/"),!r&&!e&&(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=C.splitPath(r),t=e[0],n=e[1];return!t&&!n?".":(n&&(n=n.substr(0,n.length-1)),t+n)},basename:r=>{if(r==="/")return"/";r=C.normalize(r),r=r.replace(/\/$/,"");var e=r.lastIndexOf("/");return e===-1?r:r.substr(e+1)},join:(...r)=>C.normalize(r.join("/")),join2:(r,e)=>C.normalize(r+"/"+e)},pt=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return r=>crypto.getRandomValues(r);Nr("initRandomDevice")},ve=r=>(ve=pt())(r),tr={resolve:(...r)=>{for(var e="",t=!1,n=r.length-1;n>=-1&&!t;n--){var o=n>=0?r[n]:i.cwd();if(typeof o!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";e=o+"/"+e,t=C.isAbs(o)}return e=C.normalizeArray(e.split("/").filter(a=>!!a),!t).join("/"),(t?"/":"")+e||"."},relative:(r,e)=>{r=tr.resolve(r).substr(1),e=tr.resolve(e).substr(1);function t(d){for(var v=0;v<d.length&&d[v]==="";v++);for(var E=d.length-1;E>=0&&d[E]==="";E--);return v>E?[]:d.slice(v,E-v+1)}for(var n=t(r.split("/")),o=t(e.split("/")),a=Math.min(n.length,o.length),s=a,u=0;u<a;u++)if(n[u]!==o[u]){s=u;break}for(var c=[],u=s;u<n.length;u++)c.push("..");return c=c.concat(o.slice(s)),c.join("/")}},he=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,wr=(r,e,t)=>{for(var n=e+t,o=e;r[o]&&!(o>=n);)++o;if(o-e>16&&r.buffer&&he)return he.decode(r.subarray(e,o));for(var a="";e<o;){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 d=s-65536;a+=String.fromCharCode(55296|d>>10,56320|d&1023)}}return a},Zr=[],Ur=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++t):e+=3}return e},Qr=(r,e,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-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-o};function Br(r,e,t){var n=t>0?t:Ur(r)+1,o=new Array(n),a=Qr(r,o,0,o.length);return e&&(o.length=a),o}var _t=()=>{if(!Zr.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;Xr=jr(r,!0)}return Xr.shift()},tr={ttys:[],init(){},shutdown(){},register(r,e){tr.ttys[r]={input:[],output:[],ops:e},i.registerDevice(r,tr.stream_ops)},stream_ops:{open(r){var e=tr.ttys[r.node.rdev];if(!e)throw new i.ErrnoError(43);r.tty=e,r.seekable=!1},close(r){r.tty.ops.fsync(r.tty)},fsync(r){r.tty.ops.fsync(r.tty)},read(r,e,t,n,o){if(!r.tty||!r.tty.ops.get_char)throw new i.ErrnoError(60);for(var a=0,s=0;s<n;s++){var u;try{u=r.tty.ops.get_char(r.tty)}catch{throw new i.ErrnoError(29)}if(u===void 0&&a===0)throw new i.ErrnoError(6);if(u==null)break;a++,e[t+s]=u}return a&&(r.node.timestamp=Date.now()),a},write(r,e,t,n,o){if(!r.tty||!r.tty.ops.put_char)throw new i.ErrnoError(60);try{for(var a=0;a<n;a++)r.tty.ops.put_char(r.tty,e[t+a])}catch{throw new i.ErrnoError(29)}return n&&(r.node.timestamp=Date.now()),a}},default_tty_ops:{get_char(r){return pt()},put_char(r,e){e===null||e===10?(_r(dr(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(_r(dr(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?(K(dr(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(K(dr(r.output,0)),r.output=[])}}},wt=(r,e)=>(q.fill(0,r,r+e),r),yt=(r,e)=>Math.ceil(r/e)*e,ve=r=>{r=yt(r,65536);var e=Se(65536,r);return e?wt(e,r):0},b={ops_table:null,mount(r){return b.createNode(null,"/",16895,0)},createNode(r,e,t,n){if(i.isBlkdev(t)||i.isFIFO(t))throw new i.ErrnoError(63);b.ops_table||(b.ops_table={dir:{node:{getattr:b.node_ops.getattr,setattr:b.node_ops.setattr,lookup:b.node_ops.lookup,mknod:b.node_ops.mknod,rename:b.node_ops.rename,unlink:b.node_ops.unlink,rmdir:b.node_ops.rmdir,readdir:b.node_ops.readdir,symlink:b.node_ops.symlink},stream:{llseek:b.stream_ops.llseek}},file:{node:{getattr:b.node_ops.getattr,setattr:b.node_ops.setattr},stream:{llseek:b.stream_ops.llseek,read:b.stream_ops.read,write:b.stream_ops.write,allocate:b.stream_ops.allocate,mmap:b.stream_ops.mmap,msync:b.stream_ops.msync}},link:{node:{getattr:b.node_ops.getattr,setattr:b.node_ops.setattr,readlink:b.node_ops.readlink},stream:{}},chrdev:{node:{getattr:b.node_ops.getattr,setattr:b.node_ops.setattr},stream:i.chrdev_stream_ops}});var o=i.createNode(r,e,t,n);return i.isDir(o.mode)?(o.node_ops=b.ops_table.dir.node,o.stream_ops=b.ops_table.dir.stream,o.contents={}):i.isFile(o.mode)?(o.node_ops=b.ops_table.file.node,o.stream_ops=b.ops_table.file.stream,o.usedBytes=0,o.contents=null):i.isLink(o.mode)?(o.node_ops=b.ops_table.link.node,o.stream_ops=b.ops_table.link.stream):i.isChrdev(o.mode)&&(o.node_ops=b.ops_table.chrdev.node,o.stream_ops=b.ops_table.chrdev.stream),o.timestamp=Date.now(),r&&(r.contents[e]=o,r.timestamp=o.timestamp),o},getFileDataAsTypedArray(r){return r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0)},expandFileStorage(r,e){var t=r.contents?r.contents.length:0;if(!(t>=e)){var n=1024*1024;e=Math.max(e,t*(t<n?2:1.125)>>>0),t!=0&&(e=Math.max(e,256));var o=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(o.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=i.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,i.isDir(r.mode)?e.size=4096:i.isFile(r.mode)?e.size=r.usedBytes:i.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&&b.resizeFileStorage(r,e.size)},lookup(r,e){throw i.genericErrors[44]},mknod(r,e,t,n){return b.createNode(r,e,t,n)},rename(r,e,t){if(i.isDir(r.mode)){var n;try{n=i.lookupNode(e,t)}catch{}if(n)for(var o in n.contents)throw new i.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=i.lookupNode(r,e);for(var n in t.contents)throw new i.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 n=b.createNode(r,e,41471,0);return n.link=t,n},readlink(r){if(!i.isLink(r.mode))throw new i.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,n,o){var a=r.node.contents;if(o>=r.node.usedBytes)return 0;var s=Math.min(r.node.usedBytes-o,n);if(s>8&&a.subarray)e.set(a.subarray(o,o+s),t);else for(var u=0;u<s;u++)e[t+u]=a[o+u];return s},write(r,e,t,n,o,a){if(e.buffer===I.buffer&&(a=!1),!n)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+n),s.usedBytes=n,n;if(s.usedBytes===0&&o===0)return s.contents=e.slice(t,t+n),s.usedBytes=n,n;if(o+n<=s.usedBytes)return s.contents.set(e.subarray(t,t+n),o),n}if(b.expandFileStorage(s,o+n),s.contents.subarray&&e.subarray)s.contents.set(e.subarray(t,t+n),o);else for(var u=0;u<n;u++)s.contents[o+u]=e[t+u];return s.usedBytes=Math.max(s.usedBytes,o+n),n},llseek(r,e,t){var n=e;if(t===1?n+=r.position:t===2&&i.isFile(r.node.mode)&&(n+=r.node.usedBytes),n<0)throw new i.ErrnoError(28);return n},allocate(r,e,t){b.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,n,o){if(!i.isFile(r.node.mode))throw new i.ErrnoError(43);var a,s,u=r.node.contents;if(!(o&2)&&u.buffer===I.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=ve(e),!a)throw new i.ErrnoError(48);I.set(u,a)}return{ptr:a,allocated:s}},msync(r,e,t,n,o){return b.stream_ops.write(r,e,0,n,t,!1),0}}},gt=(r,e,t,n)=>{var o=n?"":`al ${r}`;cr(r,a=>{e(new Uint8Array(a)),o&&yr(o)},a=>{if(t)t();else throw`Loading data file "${r}" failed.`}),o&&Dr(o)},Et=(r,e,t,n,o,a)=>{i.createDataFile(r,e,t,n,o,a)},kt=f.preloadPlugins||[],St=(r,e,t,n)=>{typeof Browser<"u"&&Browser.init();var o=!1;return kt.forEach(a=>{o||a.canHandle(e)&&(a.handle(r,e,t,n),o=!0)}),o},bt=(r,e,t,n,o,a,s,u,c,d)=>{var v=e?Q.resolve(C.join2(r,e)):r,E=`cp ${v}`;function h(w){function P(j){d?.(),u||Et(r,e,j,n,o,c),a?.(),yr(E)}St(w,v,P,()=>{s?.(),yr(E)})||P(w)}Dr(E),typeof t=="string"?gt(t,h,s):h(t)},Ft=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},Vr=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},i={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,n){r||(r=this),this.parent=r,this.mount=r.mount,this.mounted=null,this.id=i.nextInode++,this.name=e,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(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 i.isDir(this.mode)}get isDevice(){return i.isChrdev(this.mode)}},lookupPath(r,e={}){if(r=Q.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 i.ErrnoError(32);for(var n=r.split("/").filter(E=>!!E),o=i.root,a="/",s=0;s<n.length;s++){var u=s===n.length-1;if(u&&e.parent)break;if(o=i.lookupNode(o,n[s]),a=C.join2(a,n[s]),i.isMountpoint(o)&&(!u||u&&e.follow_mount)&&(o=o.mounted.root),!u||e.follow)for(var c=0;i.isLink(o.mode);){var d=i.readlink(a);a=Q.resolve(C.dirname(a),d);var v=i.lookupPath(a,{recurse_count:e.recurse_count+1});if(o=v.node,c++>40)throw new i.ErrnoError(32)}}return{path:a,node:o}},getPath(r){for(var e;;){if(i.isRoot(r)){var t=r.mount.mountpoint;return e?t[t.length-1]!=="/"?`${t}/${e}`:t+e:t}e=e?`${r.name}/${e}`:r.name,r=r.parent}},hashName(r,e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return(r+t>>>0)%i.nameTable.length},hashAddNode(r){var e=i.hashName(r.parent.id,r.name);r.name_next=i.nameTable[e],i.nameTable[e]=r},hashRemoveNode(r){var e=i.hashName(r.parent.id,r.name);if(i.nameTable[e]===r)i.nameTable[e]=r.name_next;else for(var t=i.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=i.mayLookup(r);if(t)throw new i.ErrnoError(t);for(var n=i.hashName(r.id,e),o=i.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===r.id&&a===e)return o}return i.lookup(r,e)},createNode(r,e,t,n){var o=new i.FSNode(r,e,t,n);return i.hashAddNode(o),o},destroyNode(r){i.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 i.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(!i.isDir(r.mode))return 54;var e=i.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){try{var t=i.lookupNode(r,e);return 20}catch{}return i.nodePermissions(r,"wx")},mayDelete(r,e,t){var n;try{n=i.lookupNode(r,e)}catch(a){return a.errno}var o=i.nodePermissions(r,"wx");if(o)return o;if(t){if(!i.isDir(n.mode))return 54;if(i.isRoot(n)||i.getPath(n)===i.cwd())return 10}else if(i.isDir(n.mode))return 31;return 0},mayOpen(r,e){return r?i.isLink(r.mode)?32:i.isDir(r.mode)&&(i.flagsToPermissionString(e)!=="r"||e&512)?31:i.nodePermissions(r,i.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=i.MAX_OPEN_FDS;r++)if(!i.streams[r])return r;throw new i.ErrnoError(33)},getStreamChecked(r){var e=i.getStream(r);if(!e)throw new i.ErrnoError(8);return e},getStream:r=>i.streams[r],createStream(r,e=-1){return r=Object.assign(new i.FSStream,r),e==-1&&(e=i.nextfd()),r.fd=e,i.streams[e]=r,r},closeStream(r){i.streams[r]=null},dupStream(r,e=-1){var t=i.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=i.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new i.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,e)=>r<<8|e,registerDevice(r,e){i.devices[r]={stream_ops:e}},getDevice:r=>i.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var n=t.pop();e.push(n),t.push(...n.mounts)}return e},syncfs(r,e){typeof r=="function"&&(e=r,r=!1),i.syncFSRequests++,i.syncFSRequests>1&&K(`warning: ${i.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=i.getMounts(i.root.mount),n=0;function o(s){return i.syncFSRequests--,e(s)}function a(s){if(s)return a.errored?void 0:(a.errored=!0,o(s));++n>=t.length&&o(null)}t.forEach(s=>{if(!s.type.syncfs)return a(null);s.type.syncfs(s,r,a)})},mount(r,e,t){var n=t==="/",o=!t,a;if(n&&i.root)throw new i.ErrnoError(10);if(!n&&!o){var s=i.lookupPath(t,{follow_mount:!1});if(t=s.path,a=s.node,i.isMountpoint(a))throw new i.ErrnoError(10);if(!i.isDir(a.mode))throw new i.ErrnoError(54)}var u={type:r,opts:e,mountpoint:t,mounts:[]},c=r.mount(u);return c.mount=u,u.root=c,n?i.root=c:a&&(a.mounted=u,a.mount&&a.mount.mounts.push(u)),c},unmount(r){var e=i.lookupPath(r,{follow_mount:!1});if(!i.isMountpoint(e.node))throw new i.ErrnoError(28);var t=e.node,n=t.mounted,o=i.getMounts(n);Object.keys(i.nameTable).forEach(s=>{for(var u=i.nameTable[s];u;){var c=u.name_next;o.includes(u.mount)&&i.destroyNode(u),u=c}}),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup(r,e){return r.node_ops.lookup(r,e)},mknod(r,e,t){var n=i.lookupPath(r,{parent:!0}),o=n.node,a=C.basename(r);if(!a||a==="."||a==="..")throw new i.ErrnoError(28);var s=i.mayCreate(o,a);if(s)throw new i.ErrnoError(s);if(!o.node_ops.mknod)throw new i.ErrnoError(63);return o.node_ops.mknod(o,a,e,t)},create(r,e){return e=e!==void 0?e:438,e&=4095,e|=32768,i.mknod(r,e,0)},mkdir(r,e){return e=e!==void 0?e:511,e&=1023,e|=16384,i.mknod(r,e,0)},mkdirTree(r,e){for(var t=r.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{i.mkdir(n,e)}catch(a){if(a.errno!=20)throw a}}},mkdev(r,e,t){return typeof t>"u"&&(t=e,e=438),e|=8192,i.mknod(r,e,t)},symlink(r,e){if(!Q.resolve(r))throw new i.ErrnoError(44);var t=i.lookupPath(e,{parent:!0}),n=t.node;if(!n)throw new i.ErrnoError(44);var o=C.basename(e),a=i.mayCreate(n,o);if(a)throw new i.ErrnoError(a);if(!n.node_ops.symlink)throw new i.ErrnoError(63);return n.node_ops.symlink(n,o,r)},rename(r,e){var t=C.dirname(r),n=C.dirname(e),o=C.basename(r),a=C.basename(e),s,u,c;if(s=i.lookupPath(r,{parent:!0}),u=s.node,s=i.lookupPath(e,{parent:!0}),c=s.node,!u||!c)throw new i.ErrnoError(44);if(u.mount!==c.mount)throw new i.ErrnoError(75);var d=i.lookupNode(u,o),v=Q.relative(r,n);if(v.charAt(0)!==".")throw new i.ErrnoError(28);if(v=Q.relative(e,t),v.charAt(0)!==".")throw new i.ErrnoError(55);var E;try{E=i.lookupNode(c,a)}catch{}if(d!==E){var h=i.isDir(d.mode),w=i.mayDelete(u,o,h);if(w)throw new i.ErrnoError(w);if(w=E?i.mayDelete(c,a,h):i.mayCreate(c,a),w)throw new i.ErrnoError(w);if(!u.node_ops.rename)throw new i.ErrnoError(63);if(i.isMountpoint(d)||E&&i.isMountpoint(E))throw new i.ErrnoError(10);if(c!==u&&(w=i.nodePermissions(u,"w"),w))throw new i.ErrnoError(w);i.hashRemoveNode(d);try{u.node_ops.rename(d,c,a)}catch(P){throw P}finally{i.hashAddNode(d)}}},rmdir(r){var e=i.lookupPath(r,{parent:!0}),t=e.node,n=C.basename(r),o=i.lookupNode(t,n),a=i.mayDelete(t,n,!0);if(a)throw new i.ErrnoError(a);if(!t.node_ops.rmdir)throw new i.ErrnoError(63);if(i.isMountpoint(o))throw new i.ErrnoError(10);t.node_ops.rmdir(t,n),i.destroyNode(o)},readdir(r){var e=i.lookupPath(r,{follow:!0}),t=e.node;if(!t.node_ops.readdir)throw new i.ErrnoError(54);return t.node_ops.readdir(t)},unlink(r){var e=i.lookupPath(r,{parent:!0}),t=e.node;if(!t)throw new i.ErrnoError(44);var n=C.basename(r),o=i.lookupNode(t,n),a=i.mayDelete(t,n,!1);if(a)throw new i.ErrnoError(a);if(!t.node_ops.unlink)throw new i.ErrnoError(63);if(i.isMountpoint(o))throw new i.ErrnoError(10);t.node_ops.unlink(t,n),i.destroyNode(o)},readlink(r){var e=i.lookupPath(r),t=e.node;if(!t)throw new i.ErrnoError(44);if(!t.node_ops.readlink)throw new i.ErrnoError(28);return Q.resolve(i.getPath(t.parent),t.node_ops.readlink(t))},stat(r,e){var t=i.lookupPath(r,{follow:!e}),n=t.node;if(!n)throw new i.ErrnoError(44);if(!n.node_ops.getattr)throw new i.ErrnoError(63);return n.node_ops.getattr(n)},lstat(r){return i.stat(r,!0)},chmod(r,e,t){var n;if(typeof r=="string"){var o=i.lookupPath(r,{follow:!t});n=o.node}else n=r;if(!n.node_ops.setattr)throw new i.ErrnoError(63);n.node_ops.setattr(n,{mode:e&4095|n.mode&-4096,timestamp:Date.now()})},lchmod(r,e){i.chmod(r,e,!0)},fchmod(r,e){var t=i.getStreamChecked(r);i.chmod(t.node,e)},chown(r,e,t,n){var o;if(typeof r=="string"){var a=i.lookupPath(r,{follow:!n});o=a.node}else o=r;if(!o.node_ops.setattr)throw new i.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(r,e,t){i.chown(r,e,t,!0)},fchown(r,e,t){var n=i.getStreamChecked(r);i.chown(n.node,e,t)},truncate(r,e){if(e<0)throw new i.ErrnoError(28);var t;if(typeof r=="string"){var n=i.lookupPath(r,{follow:!0});t=n.node}else t=r;if(!t.node_ops.setattr)throw new i.ErrnoError(63);if(i.isDir(t.mode))throw new i.ErrnoError(31);if(!i.isFile(t.mode))throw new i.ErrnoError(28);var o=i.nodePermissions(t,"w");if(o)throw new i.ErrnoError(o);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=i.getStreamChecked(r);if(!(t.flags&2097155))throw new i.ErrnoError(28);i.truncate(t.node,e)},utime(r,e,t){var n=i.lookupPath(r,{follow:!0}),o=n.node;o.node_ops.setattr(o,{timestamp:Math.max(e,t)})},open(r,e,t){if(r==="")throw new i.ErrnoError(44);e=typeof e=="string"?Ft(e):e,t=typeof t>"u"?438:t,e&64?t=t&4095|32768:t=0;var n;if(typeof r=="object")n=r;else{r=C.normalize(r);try{var o=i.lookupPath(r,{follow:!(e&131072)});n=o.node}catch{}}var a=!1;if(e&64)if(n){if(e&128)throw new i.ErrnoError(20)}else n=i.mknod(r,t,0),a=!0;if(!n)throw new i.ErrnoError(44);if(i.isChrdev(n.mode)&&(e&=-513),e&65536&&!i.isDir(n.mode))throw new i.ErrnoError(54);if(!a){var s=i.mayOpen(n,e);if(s)throw new i.ErrnoError(s)}e&512&&!a&&i.truncate(n,0),e&=-131713;var u=i.createStream({node:n,path:i.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),f.logReadFiles&&!(e&1)&&(i.readFiles||(i.readFiles={}),r in i.readFiles||(i.readFiles[r]=1)),u},close(r){if(i.isClosed(r))throw new i.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{i.closeStream(r.fd)}r.fd=null},isClosed(r){return r.fd===null},llseek(r,e,t){if(i.isClosed(r))throw new i.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new i.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new i.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,n,o){if(n<0||o<0)throw new i.ErrnoError(28);if(i.isClosed(r))throw new i.ErrnoError(8);if((r.flags&2097155)===1)throw new i.ErrnoError(8);if(i.isDir(r.node.mode))throw new i.ErrnoError(31);if(!r.stream_ops.read)throw new i.ErrnoError(28);var a=typeof o<"u";if(!a)o=r.position;else if(!r.seekable)throw new i.ErrnoError(70);var s=r.stream_ops.read(r,e,t,n,o);return a||(r.position+=s),s},write(r,e,t,n,o,a){if(n<0||o<0)throw new i.ErrnoError(28);if(i.isClosed(r))throw new i.ErrnoError(8);if(!(r.flags&2097155))throw new i.ErrnoError(8);if(i.isDir(r.node.mode))throw new i.ErrnoError(31);if(!r.stream_ops.write)throw new i.ErrnoError(28);r.seekable&&r.flags&1024&&i.llseek(r,0,2);var s=typeof o<"u";if(!s)o=r.position;else if(!r.seekable)throw new i.ErrnoError(70);var u=r.stream_ops.write(r,e,t,n,o,a);return s||(r.position+=u),u},allocate(r,e,t){if(i.isClosed(r))throw new i.ErrnoError(8);if(e<0||t<=0)throw new i.ErrnoError(28);if(!(r.flags&2097155))throw new i.ErrnoError(8);if(!i.isFile(r.node.mode)&&!i.isDir(r.node.mode))throw new i.ErrnoError(43);if(!r.stream_ops.allocate)throw new i.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,n,o){if(n&2&&!(o&2)&&(r.flags&2097155)!==2)throw new i.ErrnoError(2);if((r.flags&2097155)===1)throw new i.ErrnoError(2);if(!r.stream_ops.mmap)throw new i.ErrnoError(43);return r.stream_ops.mmap(r,e,t,n,o)},msync(r,e,t,n,o){return r.stream_ops.msync?r.stream_ops.msync(r,e,t,n,o):0},ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new i.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary",e.encoding!=="utf8"&&e.encoding!=="binary")throw new Error(`Invalid encoding type "${e.encoding}"`);var t,n=i.open(r,e.flags),o=i.stat(r),a=o.size,s=new Uint8Array(a);return i.read(n,s,0,a,0),e.encoding==="utf8"?t=dr(s,0):e.encoding==="binary"&&(t=s),i.close(n),t},writeFile(r,e,t={}){t.flags=t.flags||577;var n=i.open(r,t.flags,t.mode);if(typeof e=="string"){var o=new Uint8Array(Ir(e)+1),a=qr(e,o,0,o.length);i.write(n,o,0,a,void 0,t.canOwn)}else if(ArrayBuffer.isView(e))i.write(n,e,0,e.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");i.close(n)},cwd:()=>i.currentPath,chdir(r){var e=i.lookupPath(r,{follow:!0});if(e.node===null)throw new i.ErrnoError(44);if(!i.isDir(e.node.mode))throw new i.ErrnoError(54);var t=i.nodePermissions(e.node,"x");if(t)throw new i.ErrnoError(t);i.currentPath=e.path},createDefaultDirectories(){i.mkdir("/tmp"),i.mkdir("/home"),i.mkdir("/home/web_user")},createDefaultDevices(){i.mkdir("/dev"),i.registerDevice(i.makedev(1,3),{read:()=>0,write:(n,o,a,s,u)=>s}),i.mkdev("/dev/null",i.makedev(1,3)),tr.register(i.makedev(5,0),tr.default_tty_ops),tr.register(i.makedev(6,0),tr.default_tty1_ops),i.mkdev("/dev/tty",i.makedev(5,0)),i.mkdev("/dev/tty1",i.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(e===0&&(e=le(r).byteLength),r[--e]);i.createDevice("/dev","random",t),i.createDevice("/dev","urandom",t),i.mkdir("/dev/shm"),i.mkdir("/dev/shm/tmp")},createSpecialDirectories(){i.mkdir("/proc");var r=i.mkdir("/proc/self");i.mkdir("/proc/self/fd"),i.mount({mount(){var e=i.createNode(r,"fd",16895,73);return e.node_ops={lookup(t,n){var o=+n,a=i.getStreamChecked(o),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>a.path}};return s.parent=s,s}},e}},{},"/proc/self/fd")},createStandardStreams(){f.stdin?i.createDevice("/dev","stdin",f.stdin):i.symlink("/dev/tty","/dev/stdin"),f.stdout?i.createDevice("/dev","stdout",null,f.stdout):i.symlink("/dev/tty","/dev/stdout"),f.stderr?i.createDevice("/dev","stderr",null,f.stderr):i.symlink("/dev/tty1","/dev/stderr");var r=i.open("/dev/stdin",0),e=i.open("/dev/stdout",1),t=i.open("/dev/stderr",1)},staticInit(){[44].forEach(r=>{i.genericErrors[r]=new i.ErrnoError(r),i.genericErrors[r].stack="<generic error, no stack>"}),i.nameTable=new Array(4096),i.mount(b,{},"/"),i.createDefaultDirectories(),i.createDefaultDevices(),i.createSpecialDirectories(),i.filesystems={MEMFS:b}},init(r,e,t){i.init.initialized=!0,f.stdin=r||f.stdin,f.stdout=e||f.stdout,f.stderr=t||f.stderr,i.createStandardStreams()},quit(){i.init.initialized=!1;for(var r=0;r<i.streams.length;r++){var e=i.streams[r];e&&i.close(e)}},findObject(r,e){var t=i.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{var t=i.lookupPath(r,{follow:!e});r=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=i.lookupPath(r,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=C.basename(r),t=i.lookupPath(r,{follow:!e}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(o){n.error=o.errno}return n},createPath(r,e,t,n){r=typeof r=="string"?r:i.getPath(r);for(var o=e.split("/").reverse();o.length;){var a=o.pop();if(a){var s=C.join2(r,a);try{i.mkdir(s)}catch{}r=s}}return s},createFile(r,e,t,n,o){var a=C.join2(typeof r=="string"?r:i.getPath(r),e),s=Vr(n,o);return i.create(a,s)},createDataFile(r,e,t,n,o,a){var s=e;r&&(r=typeof r=="string"?r:i.getPath(r),s=e?C.join2(r,e):r);var u=Vr(n,o),c=i.create(s,u);if(t){if(typeof t=="string"){for(var d=new Array(t.length),v=0,E=t.length;v<E;++v)d[v]=t.charCodeAt(v);t=d}i.chmod(c,u|146);var h=i.open(c,577);i.write(h,t,0,t.length,0,a),i.close(h),i.chmod(c,u)}},createDevice(r,e,t,n){var o=C.join2(typeof r=="string"?r:i.getPath(r),e),a=Vr(!!t,!!n);i.createDevice.major||(i.createDevice.major=64);var s=i.makedev(i.createDevice.major++,0);return i.registerDevice(s,{open(u){u.seekable=!1},close(u){n?.buffer?.length&&n(10)},read(u,c,d,v,E){for(var h=0,w=0;w<v;w++){var P;try{P=t()}catch{throw new i.ErrnoError(29)}if(P===void 0&&h===0)throw new i.ErrnoError(6);if(P==null)break;h++,c[d+w]=P}return h&&(u.node.timestamp=Date.now()),h},write(u,c,d,v,E){for(var h=0;h<v;h++)try{n(c[d+h])}catch{throw new i.ErrnoError(29)}return v&&(u.node.timestamp=Date.now()),h}}),i.mkdev(o,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(Y)try{r.contents=jr(Y(r.url),!0),r.usedBytes=r.contents.length}catch{throw new i.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(r,e,t,n,o){class a{constructor(){this.lengthKnown=!1,this.chunks=[]}get(w){if(!(w>this.length-1||w<0)){var P=w%this.chunkSize,j=w/this.chunkSize|0;return this.getter(j)[P]}}setDataGetter(w){this.getter=w}cacheLength(){var w=new XMLHttpRequest;if(w.open("HEAD",t,!1),w.send(null),!(w.status>=200&&w.status<300||w.status===304))throw new Error("Couldn't load "+t+". Status: "+w.status);var P=Number(w.getResponseHeader("Content-length")),j,$=(j=w.getResponseHeader("Accept-Ranges"))&&j==="bytes",z=(j=w.getResponseHeader("Content-Encoding"))&&j==="gzip",l=1024*1024;$||(l=P);var y=(T,V)=>{if(T>V)throw new Error("invalid range ("+T+", "+V+") or no bytes requested!");if(V>P-1)throw new Error("only "+P+" bytes available! programmer error!");var L=new XMLHttpRequest;if(L.open("GET",t,!1),P!==l&&L.setRequestHeader("Range","bytes="+T+"-"+V),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)},B=this;B.setDataGetter(T=>{var V=T*l,L=(T+1)*l-1;if(L=Math.min(L,P-1),typeof B.chunks[T]>"u"&&(B.chunks[T]=y(V,L)),typeof B.chunks[T]>"u")throw new Error("doXHR failed!");return B.chunks[T]}),(z||!P)&&(l=P=1,P=this.getter(0).length,l=P,_r("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=P,this._chunkSize=l,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(!ir)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=i.createFile(r,e,u,n,o);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 d={},v=Object.keys(c.stream_ops);v.forEach(h=>{var w=c.stream_ops[h];d[h]=(...P)=>(i.forceLoadFile(c),w(...P))});function E(h,w,P,j,$){var z=h.node.contents;if($>=z.length)return 0;var l=Math.min(z.length-$,j);if(z.slice)for(var y=0;y<l;y++)w[P+y]=z[$+y];else for(var y=0;y<l;y++)w[P+y]=z.get($+y);return l}return d.read=(h,w,P,j,$)=>(i.forceLoadFile(c),E(h,w,P,j,$)),d.mmap=(h,w,P,j,$)=>{i.forceLoadFile(c);var z=ve(w);if(!z)throw new i.ErrnoError(48);return E(h,I,z,w,P),{ptr:z,allocated:!0}},c.stream_ops=d,c}},gr=(r,e)=>r?dr(q,r,e):"",M={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(C.isAbs(e))return e;var n;if(r===-100)n=i.cwd();else{var o=M.getStreamFromFD(r);n=o.path}if(e.length==0){if(!t)throw new i.ErrnoError(44);return n}return C.join2(n,e)},doStat(r,e,t){var n=r(e);k[t>>2]=n.dev,k[t+4>>2]=n.mode,S[t+8>>2]=n.nlink,k[t+12>>2]=n.uid,k[t+16>>2]=n.gid,k[t+20>>2]=n.rdev,O=[n.size>>>0,(D=n.size,+Math.abs(D)>=1?D>0?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)],k[t+24>>2]=O[0],k[t+28>>2]=O[1],k[t+32>>2]=4096,k[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),s=n.ctime.getTime();return O=[Math.floor(o/1e3)>>>0,(D=Math.floor(o/1e3),+Math.abs(D)>=1?D>0?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)],k[t+40>>2]=O[0],k[t+44>>2]=O[1],S[t+48>>2]=o%1e3*1e3,O=[Math.floor(a/1e3)>>>0,(D=Math.floor(a/1e3),+Math.abs(D)>=1?D>0?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)],k[t+56>>2]=O[0],k[t+60>>2]=O[1],S[t+64>>2]=a%1e3*1e3,O=[Math.floor(s/1e3)>>>0,(D=Math.floor(s/1e3),+Math.abs(D)>=1?D>0?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)],k[t+72>>2]=O[0],k[t+76>>2]=O[1],S[t+80>>2]=s%1e3*1e3,O=[n.ino>>>0,(D=n.ino,+Math.abs(D)>=1?D>0?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)],k[t+88>>2]=O[0],k[t+92>>2]=O[1],0},doMsync(r,e,t,n,o){if(!i.isFile(e.node.mode))throw new i.ErrnoError(43);if(n&2)return 0;var a=q.slice(r,r+t);i.msync(e,a,o,t,n)},varargs:void 0,get(){var r=k[+M.varargs>>2];return M.varargs+=4,r},getp(){return M.get()},getStr(r){var e=gr(r);return e},getStreamFromFD(r){var e=i.getStreamChecked(r);return e}};function Pt(r){try{return r=M.getStr(r),i.chdir(r),0}catch(e){if(typeof i>"u"||e.name!=="ErrnoError")throw e;return-e.errno}}function Mt(r,e,t,n){try{if(e=M.getStr(e),e=M.calculateAt(r,e),t&-8)return-28;var o=i.lookupPath(e,{follow:!0}),a=o.node;if(!a)return-44;var s="";return t&4&&(s+="r"),t&2&&(s+="w"),t&1&&(s+="x"),s&&i.nodePermissions(a,s)?-2:0}catch(u){if(typeof i>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Dt(r,e,t){M.varargs=t;try{var n=M.getStreamFromFD(r);switch(e){case 0:{var o=M.get();if(o<0)return-28;for(;i.streams[o];)o++;var a;return a=i.dupStream(n,o),a.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var o=M.get();return n.flags|=o,0}case 12:{var o=M.getp(),s=0;return J[o+s>>1]=2,0}case 13:case 14:return 0}return-28}catch(u){if(typeof i>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function At(r,e){try{var t=M.getStreamFromFD(r);return M.doStat(i.stat,t.path,e)}catch(n){if(typeof i>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var he=(r,e,t)=>qr(r,q,e,t);function Rt(r,e){try{if(e===0)return-28;var t=i.cwd(),n=Ir(t)+1;return e<n?-68:(he(t,r,e),n)}catch(o){if(typeof i>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Ct(r,e,t){M.varargs=t;try{var n=M.getStreamFromFD(r);switch(e){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),a=M.getp();k[a>>2]=o.c_iflag||0,k[a+4>>2]=o.c_oflag||0,k[a+8>>2]=o.c_cflag||0,k[a+12>>2]=o.c_lflag||0;for(var s=0;s<32;s++)I[a+s+17]=o.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var a=M.getp(),u=k[a>>2],c=k[a+4>>2],d=k[a+8>>2],v=k[a+12>>2],E=[],s=0;s<32;s++)E.push(I[a+s+17]);return n.tty.ops.ioctl_tcsets(n.tty,e,{c_iflag:u,c_oflag:c,c_cflag:d,c_lflag:v,c_cc:E})}return 0}case 21519:{if(!n.tty)return-59;var a=M.getp();return k[a>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var a=M.getp();return i.ioctl(n,e,a)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var h=n.tty.ops.ioctl_tiocgwinsz(n.tty),a=M.getp();J[a>>1]=h[0],J[a+2>>1]=h[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(w){if(typeof i>"u"||w.name!=="ErrnoError")throw w;return-w.errno}}function xt(r,e,t,n){try{e=M.getStr(e);var o=n&256,a=n&4096;return n=n&-6401,e=M.calculateAt(r,e,a),M.doStat(o?i.lstat:i.stat,e,t)}catch(s){if(typeof i>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function Tt(r,e,t,n){M.varargs=n;try{e=M.getStr(e),e=M.calculateAt(r,e);var o=n?M.get():0;return i.open(e,t,o).fd}catch(a){if(typeof i>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function Nt(r,e){try{return r=M.getStr(r),M.doStat(i.stat,r,e)}catch(t){if(typeof i>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var It=1,jt=()=>It,zt=()=>{ce=!1,pe=0},Lt=()=>{throw 1/0},Gr=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+e*4294967296:NaN;function Ut(r,e,t,n,o,a,s,u){var c=Gr(o,a);try{if(isNaN(c))return 61;var d=M.getStreamFromFD(n),v=i.mmap(d,r,c,e,t),E=v.ptr;return k[s>>2]=v.allocated,S[u>>2]=E,0}catch(h){if(typeof i>"u"||h.name!=="ErrnoError")throw h;return-h.errno}}function Ot(r,e,t,n,o,a,s){var u=Gr(a,s);try{var c=M.getStreamFromFD(o);t&2&&M.doMsync(r,c,e,n,u)}catch(d){if(typeof i>"u"||d.name!=="ErrnoError")throw d;return-d.errno}}var Bt=()=>{Ar("")},Ht=()=>Date.now(),me=()=>2147483648,Wt=()=>me(),_e;_e=()=>performance.now();var Yt=(r,e,t)=>q.copyWithin(r,e,e+t),$t=r=>{var e=fr.buffer,t=(r-e.byteLength+65535)/65536;try{return fr.grow(t),ee(),1}catch{}},Xt=r=>{var e=q.length;r>>>=0;var t=me();if(r>t)return!1;for(var n=(c,d)=>c+(d-c%d)%d,o=1;o<=4;o*=2){var a=e*(1+.2/o);a=Math.min(a,r+100663296);var s=Math.min(t,n(Math.max(r,a),65536)),u=$t(s);if(u)return!0}return!1},Kr={},qt=()=>G||"./this.program",Er=()=>{if(!Er.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,_:qt()};for(var t in Kr)Kr[t]===void 0?delete e[t]:e[t]=Kr[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);Er.strings=n}return Er.strings},Vt=(r,e)=>{for(var t=0;t<r.length;++t)I[e++]=r.charCodeAt(t);I[e]=0},Gt=(r,e)=>{var t=0;return Er().forEach((n,o)=>{var a=e+t;S[r+o*4>>2]=a,Vt(n,a),t+=n.length+1}),0},Kt=(r,e)=>{var t=Er();S[r>>2]=t.length;var n=0;return t.forEach(o=>n+=o.length+1),S[e>>2]=n,0},pe=0,Jt=()=>ce||pe>0,we=r=>{or=r,Jt()||(f.onExit?.(r),lr=!0),W(r,new ue(r))},ye=(r,e)=>{or=r,we(r)},Zt=ye;function Qt(r){try{var e=M.getStreamFromFD(r);return i.close(e),0}catch(t){if(typeof i>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var rn=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var s=S[e>>2],u=S[e+4>>2];e+=8;var c=i.read(r,I,s,u,n);if(c<0)return-1;if(o+=c,c<u)break;typeof n<"u"&&(n+=c)}return o};function en(r,e,t,n){try{var o=M.getStreamFromFD(r),a=rn(o,e,t);return S[n>>2]=a,0}catch(s){if(typeof i>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function tn(r,e,t,n,o){var a=Gr(e,t);try{if(isNaN(a))return 61;var s=M.getStreamFromFD(r);return i.llseek(s,a,n),O=[s.position>>>0,(D=s.position,+Math.abs(D)>=1?D>0?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)],k[o>>2]=O[0],k[o+4>>2]=O[1],s.getdents&&a===0&&n===0&&(s.getdents=null),0}catch(u){if(typeof i>"u"||u.name!=="ErrnoError")throw u;return u.errno}}var nn=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var s=S[e>>2],u=S[e+4>>2];e+=8;var c=i.write(r,I,s,u,n);if(c<0)return-1;o+=c,typeof n<"u"&&(n+=c)}return o};function on(r,e,t,n){try{var o=M.getStreamFromFD(r),a=nn(o,e,t);return S[n>>2]=a,0}catch(s){if(typeof i>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var an=r=>r,zr=r=>r%4===0&&(r%100!==0||r%400===0),sn=(r,e)=>{for(var t=0,n=0;n<=e;t+=r[n++]);return t},ge=[31,29,31,30,31,30,31,31,30,31,30,31],Ee=[31,28,31,30,31,30,31,31,30,31,30,31],un=(r,e)=>{for(var t=new Date(r.getTime());e>0;){var n=zr(t.getFullYear()),o=t.getMonth(),a=(n?ge:Ee)[o];if(e>a-t.getDate())e-=a-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+e),t}return t},cn=(r,e)=>{I.set(r,e)},fn=(r,e,t,n)=>{var o=S[n+40>>2],a={tm_sec:k[n>>2],tm_min:k[n+4>>2],tm_hour:k[n+8>>2],tm_mday:k[n+12>>2],tm_mon:k[n+16>>2],tm_year:k[n+20>>2],tm_wday:k[n+24>>2],tm_yday:k[n+28>>2],tm_isdst:k[n+32>>2],tm_gmtoff:k[n+36>>2],tm_zone:o?gr(o):""},s=gr(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 d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],v=["January","February","March","April","May","June","July","August","September","October","November","December"];function E(l,y,B){for(var T=typeof l=="number"?l.toString():l||"";T.length<y;)T=B[0]+T;return T}function h(l,y){return E(l,y,"0")}function w(l,y){function B(V){return V<0?-1:V>0?1:0}var T;return(T=B(l.getFullYear()-y.getFullYear()))===0&&(T=B(l.getMonth()-y.getMonth()))===0&&(T=B(l.getDate()-y.getDate())),T}function P(l){switch(l.getDay()){case 0:return new Date(l.getFullYear()-1,11,29);case 1:return l;case 2:return new Date(l.getFullYear(),0,3);case 3:return new Date(l.getFullYear(),0,2);case 4:return new Date(l.getFullYear(),0,1);case 5:return new Date(l.getFullYear()-1,11,31);case 6:return new Date(l.getFullYear()-1,11,30)}}function j(l){var y=un(new Date(l.tm_year+1900,0,1),l.tm_yday),B=new Date(y.getFullYear(),0,4),T=new Date(y.getFullYear()+1,0,4),V=P(B),L=P(T);return w(V,y)<=0?w(L,y)<=0?y.getFullYear()+1:y.getFullYear():y.getFullYear()-1}var $={"%a":l=>d[l.tm_wday].substring(0,3),"%A":l=>d[l.tm_wday],"%b":l=>v[l.tm_mon].substring(0,3),"%B":l=>v[l.tm_mon],"%C":l=>{var y=l.tm_year+1900;return h(y/100|0,2)},"%d":l=>h(l.tm_mday,2),"%e":l=>E(l.tm_mday,2," "),"%g":l=>j(l).toString().substring(2),"%G":j,"%H":l=>h(l.tm_hour,2),"%I":l=>{var y=l.tm_hour;return y==0?y=12:y>12&&(y-=12),h(y,2)},"%j":l=>h(l.tm_mday+sn(zr(l.tm_year+1900)?ge:Ee,l.tm_mon-1),3),"%m":l=>h(l.tm_mon+1,2),"%M":l=>h(l.tm_min,2),"%n":()=>`
|
|
4
|
-
`,"%p":l=>l.tm_hour>=0&&l.tm_hour<12?"AM":"PM","%S":l=>h(l.tm_sec,2),"%t":()=>" ","%u":l=>l.tm_wday||7,"%U":l=>{var y=l.tm_yday+7-l.tm_wday;return h(Math.floor(y/7),2)},"%V":l=>{var y=Math.floor((l.tm_yday+7-(l.tm_wday+6)%7)/7);if((l.tm_wday+371-l.tm_yday-2)%7<=2&&y++,y){if(y==53){var T=(l.tm_wday+371-l.tm_yday)%7;T!=4&&(T!=3||!zr(l.tm_year))&&(y=1)}}else{y=52;var B=(l.tm_wday+7-l.tm_yday-1)%7;(B==4||B==5&&zr(l.tm_year%400-1))&&y++}return h(y,2)},"%w":l=>l.tm_wday,"%W":l=>{var y=l.tm_yday+7-(l.tm_wday+6)%7;return h(Math.floor(y/7),2)},"%y":l=>(l.tm_year+1900).toString().substring(2),"%Y":l=>l.tm_year+1900,"%z":l=>{var y=l.tm_gmtoff,B=y>=0;return y=Math.abs(y)/60,y=y/60*100+y%60,(B?"+":"-")+("0000"+y).slice(-4)},"%Z":l=>l.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var c in $)s.includes(c)&&(s=s.replace(new RegExp(c,"g"),$[c](a)));s=s.replace(/\0\0/g,"%");var z=jr(s,!1);return z.length>e?0:(cn(z,r),z.length-1)},ln=(r,e,t,n,o)=>fn(r,e,t,n),dn=r=>{if(r instanceof ue||r=="unwind")return or;W(1,r)},vn=r=>{var e=Ir(r)+1,t=Sr(e);return he(r,t,e),t},hn=r=>{var e=_(),t=r();return p(e),t},mn=r=>hn(()=>{var e=Sr(4),t=Sr(4);be(r,e,t);var n=S[e>>2],o=S[t>>2],a=gr(n);Jr(n);var s;return o&&(s=gr(o),Jr(o)),[a,s]}),_n=r=>mn(r),pn=r=>Qr(r),wn=r=>Zr(r);i.createPreloadedFile=bt,i.staticInit(),f.FS_createPath=i.createPath,f.FS_createDataFile=i.createDataFile,f.FS_createPreloadedFile=i.createPreloadedFile,f.FS_unlink=i.unlink,f.FS_createLazyFile=i.createLazyFile,f.FS_createDevice=i.createDevice;var yn={ka:ot,l:at,t:st,a:ct,h:ft,E:lt,Pa:dt,P:vt,r:ht,ga:mt,d:ut,xa:Pt,ya:Mt,T:Dt,sa:At,pa:Rt,za:Ct,qa:xt,Q:Tt,ra:Nt,ua:jt,ma:zt,ha:Lt,aa:Ut,ba:Ot,q:Bt,va:Ht,ja:Wt,ta:_e,wa:Yt,ia:Xt,na:Gt,oa:Kt,L:Zt,M:Qt,S:en,ca:tn,R:on,s:An,z:Zn,K:Gn,O:pi,v:Fn,g:Sn,n:Un,b:kn,y:Kn,Na:Yn,e:xn,C:ni,G:Jn,Oa:Wn,p:Ln,U:_i,Ma:$n,Da:ci,N:ii,w:Mn,Z:ai,Fa:oi,Ka:qn,A:In,La:Xn,Ea:ui,x:On,Qa:Hn,Ja:Vn,J:wi,Y:si,$:ki,_:Si,j:jn,i:bn,D:Qn,Ba:hi,Ca:vi,Ga:ti,c:Dn,Aa:mi,Ha:ei,Ia:ri,f:Rn,k:Tn,W:li,u:Pn,V:di,X:fi,B:Cn,o:Nn,H:Bn,F:zn,I:yi,da:Ei,ea:gi,m:an,la:we,fa:ln},N=it(),gn=()=>(gn=N.Sa)(),ke=f._main=(r,e)=>(ke=f._main=N.Ta)(r,e),Jr=r=>(Jr=N.Va)(r),En=r=>(En=N.__cxa_free_exception)(r),kr=r=>(kr=N.Wa)(r),Se=(r,e)=>(Se=N.Xa)(r,e),m=(r,e)=>(m=N.Ya)(r,e),_=()=>(_=N.Za)(),p=r=>(p=N._a)(r),Sr=r=>(Sr=N.$a)(r),Zr=r=>(Zr=N.ab)(r),Qr=r=>(Qr=N.bb)(r),be=(r,e,t)=>(be=N.cb)(r,e,t),Fe=(r,e,t)=>(Fe=N.db)(r,e,t),Pe=r=>(Pe=N.eb)(r),Me=f.dynCall_vij=(r,e,t,n)=>(Me=f.dynCall_vij=N.fb)(r,e,t,n),De=f.dynCall_j=r=>(De=f.dynCall_j=N.gb)(r),Ae=f.dynCall_viijii=(r,e,t,n,o,a,s)=>(Ae=f.dynCall_viijii=N.hb)(r,e,t,n,o,a,s),Re=f.dynCall_jiiii=(r,e,t,n,o)=>(Re=f.dynCall_jiiii=N.ib)(r,e,t,n,o);function kn(r,e,t){var n=_();try{return g(r)(e,t)}catch(o){if(p(n),o!==o+0)throw o;m(1,0)}}function Sn(r,e){var t=_();try{return g(r)(e)}catch(n){if(p(t),n!==n+0)throw n;m(1,0)}}function bn(r,e){var t=_();try{g(r)(e)}catch(n){if(p(t),n!==n+0)throw n;m(1,0)}}function Fn(r){var e=_();try{return g(r)()}catch(t){if(p(e),t!==t+0)throw t;m(1,0)}}function Pn(r,e,t,n,o,a){var s=_();try{g(r)(e,t,n,o,a)}catch(u){if(p(s),u!==u+0)throw u;m(1,0)}}function Mn(r,e,t,n,o,a){var s=_();try{return g(r)(e,t,n,o,a)}catch(u){if(p(s),u!==u+0)throw u;m(1,0)}}function Dn(r,e,t){var n=_();try{g(r)(e,t)}catch(o){if(p(n),o!==o+0)throw o;m(1,0)}}function An(r,e){var t=_();try{return g(r)(e)}catch(n){if(p(t),n!==n+0)throw n;m(1,0)}}function Rn(r,e,t,n){var o=_();try{g(r)(e,t,n)}catch(a){if(p(o),a!==a+0)throw a;m(1,0)}}function Cn(r,e,t,n,o,a,s){var u=_();try{g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function xn(r,e,t,n){var o=_();try{return g(r)(e,t,n)}catch(a){if(p(o),a!==a+0)throw a;m(1,0)}}function Tn(r,e,t,n,o){var a=_();try{g(r)(e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}function Nn(r,e,t,n,o,a,s,u){var c=_();try{g(r)(e,t,n,o,a,s,u)}catch(d){if(p(c),d!==d+0)throw d;m(1,0)}}function In(r,e,t,n,o,a,s){var u=_();try{return g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function jn(r){var e=_();try{g(r)()}catch(t){if(p(e),t!==t+0)throw t;m(1,0)}}function zn(r,e,t,n,o,a,s,u,c,d,v){var E=_();try{g(r)(e,t,n,o,a,s,u,c,d,v)}catch(h){if(p(E),h!==h+0)throw h;m(1,0)}}function Ln(r,e,t,n,o){var a=_();try{return g(r)(e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}function Un(r,e,t){var n=_();try{return g(r)(e,t)}catch(o){if(p(n),o!==o+0)throw o;m(1,0)}}function On(r,e,t,n,o,a,s,u){var c=_();try{return g(r)(e,t,n,o,a,s,u)}catch(d){if(p(c),d!==d+0)throw d;m(1,0)}}function Bn(r,e,t,n,o,a,s,u,c){var d=_();try{g(r)(e,t,n,o,a,s,u,c)}catch(v){if(p(d),v!==v+0)throw v;m(1,0)}}function Hn(r,e,t,n,o,a,s,u,c,d){var v=_();try{return g(r)(e,t,n,o,a,s,u,c,d)}catch(E){if(p(v),E!==E+0)throw E;m(1,0)}}function Wn(r,e,t,n,o,a,s,u){var c=_();try{return g(r)(e,t,n,o,a,s,u)}catch(d){if(p(c),d!==d+0)throw d;m(1,0)}}function Yn(r,e,t,n,o,a){var s=_();try{return g(r)(e,t,n,o,a)}catch(u){if(p(s),u!==u+0)throw u;m(1,0)}}function $n(r,e,t,n,o,a,s){var u=_();try{return g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function Xn(r,e,t,n,o,a,s,u,c){var d=_();try{return g(r)(e,t,n,o,a,s,u,c)}catch(v){if(p(d),v!==v+0)throw v;m(1,0)}}function qn(r,e,t,n,o,a,s,u,c){var d=_();try{return g(r)(e,t,n,o,a,s,u,c)}catch(v){if(p(d),v!==v+0)throw v;m(1,0)}}function Vn(r,e,t,n,o,a,s,u,c,d,v){var E=_();try{return g(r)(e,t,n,o,a,s,u,c,d,v)}catch(h){if(p(E),h!==h+0)throw h;m(1,0)}}function Gn(r,e,t,n){var o=_();try{return g(r)(e,t,n)}catch(a){if(p(o),a!==a+0)throw a;m(1,0)}}function Kn(r,e,t,n){var o=_();try{return g(r)(e,t,n)}catch(a){if(p(o),a!==a+0)throw a;m(1,0)}}function Jn(r,e,t,n,o,a){var s=_();try{return g(r)(e,t,n,o,a)}catch(u){if(p(s),u!==u+0)throw u;m(1,0)}}function Zn(r,e,t){var n=_();try{return g(r)(e,t)}catch(o){if(p(n),o!==o+0)throw o;m(1,0)}}function Qn(r,e,t){var n=_();try{g(r)(e,t)}catch(o){if(p(n),o!==o+0)throw o;m(1,0)}}function ri(r,e,t,n,o,a){var s=_();try{g(r)(e,t,n,o,a)}catch(u){if(p(s),u!==u+0)throw u;m(1,0)}}function ei(r,e,t,n,o){var a=_();try{g(r)(e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}function ti(r,e,t,n,o,a,s,u,c){var d=_();try{g(r)(e,t,n,o,a,s,u,c)}catch(v){if(p(d),v!==v+0)throw v;m(1,0)}}function ni(r,e,t,n,o){var a=_();try{return g(r)(e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}function ii(r,e,t,n,o,a,s){var u=_();try{return g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function oi(r,e,t,n,o,a,s,u){var c=_();try{return g(r)(e,t,n,o,a,s,u)}catch(d){if(p(c),d!==d+0)throw d;m(1,0)}}function ai(r,e,t,n,o,a,s){var u=_();try{return g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function si(r,e,t,n,o,a,s,u,c,d,v,E,h){var w=_();try{return g(r)(e,t,n,o,a,s,u,c,d,v,E,h)}catch(P){if(p(w),P!==P+0)throw P;m(1,0)}}function ui(r,e,t,n,o,a,s,u,c,d,v){var E=_();try{return g(r)(e,t,n,o,a,s,u,c,d,v)}catch(h){if(p(E),h!==h+0)throw h;m(1,0)}}function ci(r,e,t,n,o,a,s,u){var c=_();try{return g(r)(e,t,n,o,a,s,u)}catch(d){if(p(c),d!==d+0)throw d;m(1,0)}}function fi(r,e,t,n,o,a,s,u,c,d){var v=_();try{g(r)(e,t,n,o,a,s,u,c,d)}catch(E){if(p(v),E!==E+0)throw E;m(1,0)}}function li(r,e,t,n,o,a,s){var u=_();try{g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function di(r,e,t,n,o,a,s,u,c){var d=_();try{g(r)(e,t,n,o,a,s,u,c)}catch(v){if(p(d),v!==v+0)throw v;m(1,0)}}function vi(r,e,t,n,o,a,s){var u=_();try{g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function hi(r,e,t,n,o){var a=_();try{g(r)(e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}function mi(r,e,t,n,o){var a=_();try{g(r)(e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}function _i(r,e,t,n,o,a){var s=_();try{return g(r)(e,t,n,o,a)}catch(u){if(p(s),u!==u+0)throw u;m(1,0)}}function pi(r,e,t,n){var o=_();try{return g(r)(e,t,n)}catch(a){if(p(o),a!==a+0)throw a;m(1,0)}}function wi(r,e,t,n,o,a,s,u,c,d,v,E){var h=_();try{return g(r)(e,t,n,o,a,s,u,c,d,v,E)}catch(w){if(p(h),w!==w+0)throw w;m(1,0)}}function yi(r,e,t,n,o,a,s,u,c,d,v,E,h,w,P,j){var $=_();try{g(r)(e,t,n,o,a,s,u,c,d,v,E,h,w,P,j)}catch(z){if(p($),z!==z+0)throw z;m(1,0)}}function gi(r,e,t,n){var o=_();try{Me(r,e,t,n)}catch(a){if(p(o),a!==a+0)throw a;m(1,0)}}function Ei(r,e,t,n,o,a,s){var u=_();try{Ae(r,e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function ki(r){var e=_();try{return De(r)}catch(t){if(p(e),t!==t+0)throw t;m(1,0)}}function Si(r,e,t,n,o){var a=_();try{return Re(r,e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}f.addRunDependency=Dr,f.removeRunDependency=yr,f.FS_createPath=i.createPath,f.FS_createLazyFile=i.createLazyFile,f.FS_createDevice=i.createDevice,f.callMain=Ce,f.incrementExceptionRefcount=pn,f.decrementExceptionRefcount=wn,f.getExceptionMessage=_n,f.FS_createPreloadedFile=i.createPreloadedFile,f.FS=i,f.FS_createDataFile=i.createDataFile,f.FS_unlink=i.unlink;var Lr;wr=function r(){Lr||xe(),Lr||(wr=r)};function Ce(r=[]){var e=ke;r.unshift(G);var t=r.length,n=Sr((t+1)*4),o=n;r.forEach(s=>{S[o>>2]=vn(s),o+=4}),S[o>>2]=0;try{var a=e(t,n);return ye(a,!0),a}catch(s){return dn(s)}}function xe(r=rr){if(ar>0||(Ve(),ar>0))return;function e(){Lr||(Lr=!0,f.calledRun=!0,!lr&&(Ge(),Ke(),H(f),f.onRuntimeInitialized&&f.onRuntimeInitialized(),Te&&Ce(r),Je()))}f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("")},1),e()},1)):e()}if(f.preInit)for(typeof f.preInit=="function"&&(f.preInit=[f.preInit]);f.preInit.length>0;)f.preInit.pop()();var Te=!1;return f.noInitialRun&&(Te=!1),xe(),R.ready}})(),x=null,vr=!1,br=null,Or=null,hr=null,Br=null,Hr=null,je=new Promise(function(F,R){Or=F,hr=R}),nr={OPTIMAL:"optimal",INFEASIBLE:"infeasible",UNBOUNDED:"unbounded",TIME_LIMIT:"timelimit",UNKNOWN:"unknown",ERROR:"error"};function ze(F){return F.includes("optimal solution found")?nr.OPTIMAL:F.includes("problem is infeasible")?nr.INFEASIBLE:F.includes("problem is unbounded")?nr.UNBOUNDED:F.includes("time limit reached")?nr.TIME_LIMIT:nr.UNKNOWN}function Le(F){var R={},f={value:null},H=F.match(/objective value:\s*([\d.e+-]+)/i);H&&(f.value=parseFloat(H[1]));for(var A=/^(\S+)\s+([\d.e+-]+)/gm,U,rr=F.split("solution:")[1]||F;(U=A.exec(rr))!==null;){var G=U[1],W=parseFloat(U[2]);!isNaN(W)&&G!=="objective"&&(R[G]=W)}return{variables:R,objective:f}}function Ue(F){var R={solvingTime:null,nodes:null,iterations:null,gap:null},f=F.match(/Solving Time \(sec\)\s*:\s*([\d.]+)/);f&&(R.solvingTime=parseFloat(f[1]));var H=F.match(/Nodes\s*:\s*(\d+)/);H&&(R.nodes=parseInt(H[1]));var A=F.match(/LP Iterations\s*:\s*(\d+)/);A&&(R.iterations=parseInt(A[1]));var U=F.match(/Gap\s*:\s*([\d.]+)\s*%/);return U&&(R.gap=parseFloat(U[1])),R}function Fr(F){return F=F||{},vr?Promise.resolve():br||(br=new Promise(function(R,f){try{var H=F.wasmPath||Ur+"scip.wasm";Ie({locateFile:function(A){return A.endsWith(".wasm")?H:A},print:function(A){x&&x.onStdout&&x.onStdout(A)},printErr:function(A){x&&x.onStderr&&x.onStderr(A)},onAbort:function(A){Br=A,console.error("[SCIP WASM Abort]",A)},onExit:function(A){Hr=A,A!==0&&console.error("[SCIP WASM Exit]",A)}}).then(function(A){if(x=A,x.FS){try{x.FS.mkdir("/problems")}catch{}try{x.FS.mkdir("/solutions")}catch{}try{x.FS.mkdir("/settings")}catch{}}vr=!0,Or&&Or(),R()}).catch(function(A){console.error("[SCIP.js] WASM loading failed:",A),console.error("[SCIP.js] Attempted WASM path:",H),console.error("[SCIP.js] Make sure the WASM file is accessible at this URL."),console.error("[SCIP.js] You can set window.SCIP_BASE_URL before loading this script to specify a custom path.");var U=new Error("SCIP WASM loading failed: "+(A.message||A)+". WASM path: "+H);hr&&hr(U),f(U)})}catch(A){console.error("[SCIP.js] Initialization error:",A),hr&&hr(A),f(A)}}),br)}function Wr(F,R){R=R||{};var f=function(){var H=R.format||"lp",A=R.timeLimit||3600,U=R.gap||null,rr=R.verbose||!1,G=R.parameters||{},W="",ur="";x.onStdout=function(S){W+=S+`
|
|
5
|
-
`,
|
|
6
|
-
`,
|
|
7
|
-
`)
|
|
8
|
-
|
|
9
|
-
`+
|
|
10
|
-
|
|
3
|
+
`)),!r)return null;Zr=Br(r,!0)}return Zr.shift()},ar={ttys:[],init(){},shutdown(){},register(r,e){ar.ttys[r]={input:[],output:[],ops:e},i.registerDevice(r,ar.stream_ops)},stream_ops:{open(r){var e=ar.ttys[r.node.rdev];if(!e)throw new i.ErrnoError(43);r.tty=e,r.seekable=!1},close(r){r.tty.ops.fsync(r.tty)},fsync(r){r.tty.ops.fsync(r.tty)},read(r,e,t,n,o){if(!r.tty||!r.tty.ops.get_char)throw new i.ErrnoError(60);for(var a=0,s=0;s<n;s++){var u;try{u=r.tty.ops.get_char(r.tty)}catch{throw new i.ErrnoError(29)}if(u===void 0&&a===0)throw new i.ErrnoError(6);if(u==null)break;a++,e[t+s]=u}return a&&(r.node.timestamp=Date.now()),a},write(r,e,t,n,o){if(!r.tty||!r.tty.ops.put_char)throw new i.ErrnoError(60);try{for(var a=0;a<n;a++)r.tty.ops.put_char(r.tty,e[t+a])}catch{throw new i.ErrnoError(29)}return n&&(r.node.timestamp=Date.now()),a}},default_tty_ops:{get_char(r){return _t()},put_char(r,e){e===null||e===10?(Er(wr(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(Er(wr(r.output,0)),r.output=[])},ioctl_tcgets(r){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(r,e,t){return 0},ioctl_tiocgwinsz(r){return[24,80]}},default_tty1_ops:{put_char(r,e){e===null||e===10?(V(wr(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(V(wr(r.output,0)),r.output=[])}}},wt=(r,e)=>(rr.fill(0,r,r+e),r),yt=(r,e)=>Math.ceil(r/e)*e,me=r=>{r=yt(r,65536);var e=Fe(65536,r);return e?wt(e,r):0},S={ops_table:null,mount(r){return S.createNode(null,"/",16895,0)},createNode(r,e,t,n){if(i.isBlkdev(t)||i.isFIFO(t))throw new i.ErrnoError(63);S.ops_table||(S.ops_table={dir:{node:{getattr:S.node_ops.getattr,setattr:S.node_ops.setattr,lookup:S.node_ops.lookup,mknod:S.node_ops.mknod,rename:S.node_ops.rename,unlink:S.node_ops.unlink,rmdir:S.node_ops.rmdir,readdir:S.node_ops.readdir,symlink:S.node_ops.symlink},stream:{llseek:S.stream_ops.llseek}},file:{node:{getattr:S.node_ops.getattr,setattr:S.node_ops.setattr},stream:{llseek:S.stream_ops.llseek,read:S.stream_ops.read,write:S.stream_ops.write,allocate:S.stream_ops.allocate,mmap:S.stream_ops.mmap,msync:S.stream_ops.msync}},link:{node:{getattr:S.node_ops.getattr,setattr:S.node_ops.setattr,readlink:S.node_ops.readlink},stream:{}},chrdev:{node:{getattr:S.node_ops.getattr,setattr:S.node_ops.setattr},stream:i.chrdev_stream_ops}});var o=i.createNode(r,e,t,n);return i.isDir(o.mode)?(o.node_ops=S.ops_table.dir.node,o.stream_ops=S.ops_table.dir.stream,o.contents={}):i.isFile(o.mode)?(o.node_ops=S.ops_table.file.node,o.stream_ops=S.ops_table.file.stream,o.usedBytes=0,o.contents=null):i.isLink(o.mode)?(o.node_ops=S.ops_table.link.node,o.stream_ops=S.ops_table.link.stream):i.isChrdev(o.mode)&&(o.node_ops=S.ops_table.chrdev.node,o.stream_ops=S.ops_table.chrdev.stream),o.timestamp=Date.now(),r&&(r.contents[e]=o,r.timestamp=o.timestamp),o},getFileDataAsTypedArray(r){return r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0)},expandFileStorage(r,e){var t=r.contents?r.contents.length:0;if(!(t>=e)){var n=1024*1024;e=Math.max(e,t*(t<n?2:1.125)>>>0),t!=0&&(e=Math.max(e,256));var o=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(o.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=i.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,i.isDir(r.mode)?e.size=4096:i.isFile(r.mode)?e.size=r.usedBytes:i.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&&S.resizeFileStorage(r,e.size)},lookup(r,e){throw i.genericErrors[44]},mknod(r,e,t,n){return S.createNode(r,e,t,n)},rename(r,e,t){if(i.isDir(r.mode)){var n;try{n=i.lookupNode(e,t)}catch{}if(n)for(var o in n.contents)throw new i.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=i.lookupNode(r,e);for(var n in t.contents)throw new i.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 n=S.createNode(r,e,41471,0);return n.link=t,n},readlink(r){if(!i.isLink(r.mode))throw new i.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,n,o){var a=r.node.contents;if(o>=r.node.usedBytes)return 0;var s=Math.min(r.node.usedBytes-o,n);if(s>8&&a.subarray)e.set(a.subarray(o,o+s),t);else for(var u=0;u<s;u++)e[t+u]=a[o+u];return s},write(r,e,t,n,o,a){if(e.buffer===U.buffer&&(a=!1),!n)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+n),s.usedBytes=n,n;if(s.usedBytes===0&&o===0)return s.contents=e.slice(t,t+n),s.usedBytes=n,n;if(o+n<=s.usedBytes)return s.contents.set(e.subarray(t,t+n),o),n}if(S.expandFileStorage(s,o+n),s.contents.subarray&&e.subarray)s.contents.set(e.subarray(t,t+n),o);else for(var u=0;u<n;u++)s.contents[o+u]=e[t+u];return s.usedBytes=Math.max(s.usedBytes,o+n),n},llseek(r,e,t){var n=e;if(t===1?n+=r.position:t===2&&i.isFile(r.node.mode)&&(n+=r.node.usedBytes),n<0)throw new i.ErrnoError(28);return n},allocate(r,e,t){S.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,n,o){if(!i.isFile(r.node.mode))throw new i.ErrnoError(43);var a,s,u=r.node.contents;if(!(o&2)&&u.buffer===U.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=me(e),!a)throw new i.ErrnoError(48);U.set(u,a)}return{ptr:a,allocated:s}},msync(r,e,t,n,o){return S.stream_ops.write(r,e,0,n,t,!1),0}}},gt=(r,e,t,n)=>{var o=n?"":`al ${r}`;Y(r,a=>{e(new Uint8Array(a)),o&&Fr(o)},a=>{if(t)t();else throw`Loading data file "${r}" failed.`}),o&&Tr(o)},Et=(r,e,t,n,o,a)=>{i.createDataFile(r,e,t,n,o,a)},kt=f.preloadPlugins||[],St=(r,e,t,n)=>{typeof Browser<"u"&&Browser.init();var o=!1;return kt.forEach(a=>{o||a.canHandle(e)&&(a.handle(r,e,t,n),o=!0)}),o},bt=(r,e,t,n,o,a,s,u,c,d)=>{var v=e?tr.resolve(C.join2(r,e)):r,E=`cp ${v}`;function h(w){function F(j){d?.(),u||Et(r,e,j,n,o,c),a?.(),Fr(E)}St(w,v,F,()=>{s?.(),Fr(E)})||F(w)}Tr(E),typeof t=="string"?gt(t,h,s):h(t)},Ft=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},re=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},i={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,n){r||(r=this),this.parent=r,this.mount=r.mount,this.mounted=null,this.id=i.nextInode++,this.name=e,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(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 i.isDir(this.mode)}get isDevice(){return i.isChrdev(this.mode)}},lookupPath(r,e={}){if(r=tr.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 i.ErrnoError(32);for(var n=r.split("/").filter(E=>!!E),o=i.root,a="/",s=0;s<n.length;s++){var u=s===n.length-1;if(u&&e.parent)break;if(o=i.lookupNode(o,n[s]),a=C.join2(a,n[s]),i.isMountpoint(o)&&(!u||u&&e.follow_mount)&&(o=o.mounted.root),!u||e.follow)for(var c=0;i.isLink(o.mode);){var d=i.readlink(a);a=tr.resolve(C.dirname(a),d);var v=i.lookupPath(a,{recurse_count:e.recurse_count+1});if(o=v.node,c++>40)throw new i.ErrnoError(32)}}return{path:a,node:o}},getPath(r){for(var e;;){if(i.isRoot(r)){var t=r.mount.mountpoint;return e?t[t.length-1]!=="/"?`${t}/${e}`:t+e:t}e=e?`${r.name}/${e}`:r.name,r=r.parent}},hashName(r,e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return(r+t>>>0)%i.nameTable.length},hashAddNode(r){var e=i.hashName(r.parent.id,r.name);r.name_next=i.nameTable[e],i.nameTable[e]=r},hashRemoveNode(r){var e=i.hashName(r.parent.id,r.name);if(i.nameTable[e]===r)i.nameTable[e]=r.name_next;else for(var t=i.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=i.mayLookup(r);if(t)throw new i.ErrnoError(t);for(var n=i.hashName(r.id,e),o=i.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===r.id&&a===e)return o}return i.lookup(r,e)},createNode(r,e,t,n){var o=new i.FSNode(r,e,t,n);return i.hashAddNode(o),o},destroyNode(r){i.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 i.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(!i.isDir(r.mode))return 54;var e=i.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){try{var t=i.lookupNode(r,e);return 20}catch{}return i.nodePermissions(r,"wx")},mayDelete(r,e,t){var n;try{n=i.lookupNode(r,e)}catch(a){return a.errno}var o=i.nodePermissions(r,"wx");if(o)return o;if(t){if(!i.isDir(n.mode))return 54;if(i.isRoot(n)||i.getPath(n)===i.cwd())return 10}else if(i.isDir(n.mode))return 31;return 0},mayOpen(r,e){return r?i.isLink(r.mode)?32:i.isDir(r.mode)&&(i.flagsToPermissionString(e)!=="r"||e&512)?31:i.nodePermissions(r,i.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=i.MAX_OPEN_FDS;r++)if(!i.streams[r])return r;throw new i.ErrnoError(33)},getStreamChecked(r){var e=i.getStream(r);if(!e)throw new i.ErrnoError(8);return e},getStream:r=>i.streams[r],createStream(r,e=-1){return r=Object.assign(new i.FSStream,r),e==-1&&(e=i.nextfd()),r.fd=e,i.streams[e]=r,r},closeStream(r){i.streams[r]=null},dupStream(r,e=-1){var t=i.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=i.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new i.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,e)=>r<<8|e,registerDevice(r,e){i.devices[r]={stream_ops:e}},getDevice:r=>i.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var n=t.pop();e.push(n),t.push(...n.mounts)}return e},syncfs(r,e){typeof r=="function"&&(e=r,r=!1),i.syncFSRequests++,i.syncFSRequests>1&&V(`warning: ${i.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=i.getMounts(i.root.mount),n=0;function o(s){return i.syncFSRequests--,e(s)}function a(s){if(s)return a.errored?void 0:(a.errored=!0,o(s));++n>=t.length&&o(null)}t.forEach(s=>{if(!s.type.syncfs)return a(null);s.type.syncfs(s,r,a)})},mount(r,e,t){var n=t==="/",o=!t,a;if(n&&i.root)throw new i.ErrnoError(10);if(!n&&!o){var s=i.lookupPath(t,{follow_mount:!1});if(t=s.path,a=s.node,i.isMountpoint(a))throw new i.ErrnoError(10);if(!i.isDir(a.mode))throw new i.ErrnoError(54)}var u={type:r,opts:e,mountpoint:t,mounts:[]},c=r.mount(u);return c.mount=u,u.root=c,n?i.root=c:a&&(a.mounted=u,a.mount&&a.mount.mounts.push(u)),c},unmount(r){var e=i.lookupPath(r,{follow_mount:!1});if(!i.isMountpoint(e.node))throw new i.ErrnoError(28);var t=e.node,n=t.mounted,o=i.getMounts(n);Object.keys(i.nameTable).forEach(s=>{for(var u=i.nameTable[s];u;){var c=u.name_next;o.includes(u.mount)&&i.destroyNode(u),u=c}}),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup(r,e){return r.node_ops.lookup(r,e)},mknod(r,e,t){var n=i.lookupPath(r,{parent:!0}),o=n.node,a=C.basename(r);if(!a||a==="."||a==="..")throw new i.ErrnoError(28);var s=i.mayCreate(o,a);if(s)throw new i.ErrnoError(s);if(!o.node_ops.mknod)throw new i.ErrnoError(63);return o.node_ops.mknod(o,a,e,t)},create(r,e){return e=e!==void 0?e:438,e&=4095,e|=32768,i.mknod(r,e,0)},mkdir(r,e){return e=e!==void 0?e:511,e&=1023,e|=16384,i.mknod(r,e,0)},mkdirTree(r,e){for(var t=r.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{i.mkdir(n,e)}catch(a){if(a.errno!=20)throw a}}},mkdev(r,e,t){return typeof t>"u"&&(t=e,e=438),e|=8192,i.mknod(r,e,t)},symlink(r,e){if(!tr.resolve(r))throw new i.ErrnoError(44);var t=i.lookupPath(e,{parent:!0}),n=t.node;if(!n)throw new i.ErrnoError(44);var o=C.basename(e),a=i.mayCreate(n,o);if(a)throw new i.ErrnoError(a);if(!n.node_ops.symlink)throw new i.ErrnoError(63);return n.node_ops.symlink(n,o,r)},rename(r,e){var t=C.dirname(r),n=C.dirname(e),o=C.basename(r),a=C.basename(e),s,u,c;if(s=i.lookupPath(r,{parent:!0}),u=s.node,s=i.lookupPath(e,{parent:!0}),c=s.node,!u||!c)throw new i.ErrnoError(44);if(u.mount!==c.mount)throw new i.ErrnoError(75);var d=i.lookupNode(u,o),v=tr.relative(r,n);if(v.charAt(0)!==".")throw new i.ErrnoError(28);if(v=tr.relative(e,t),v.charAt(0)!==".")throw new i.ErrnoError(55);var E;try{E=i.lookupNode(c,a)}catch{}if(d!==E){var h=i.isDir(d.mode),w=i.mayDelete(u,o,h);if(w)throw new i.ErrnoError(w);if(w=E?i.mayDelete(c,a,h):i.mayCreate(c,a),w)throw new i.ErrnoError(w);if(!u.node_ops.rename)throw new i.ErrnoError(63);if(i.isMountpoint(d)||E&&i.isMountpoint(E))throw new i.ErrnoError(10);if(c!==u&&(w=i.nodePermissions(u,"w"),w))throw new i.ErrnoError(w);i.hashRemoveNode(d);try{u.node_ops.rename(d,c,a)}catch(F){throw F}finally{i.hashAddNode(d)}}},rmdir(r){var e=i.lookupPath(r,{parent:!0}),t=e.node,n=C.basename(r),o=i.lookupNode(t,n),a=i.mayDelete(t,n,!0);if(a)throw new i.ErrnoError(a);if(!t.node_ops.rmdir)throw new i.ErrnoError(63);if(i.isMountpoint(o))throw new i.ErrnoError(10);t.node_ops.rmdir(t,n),i.destroyNode(o)},readdir(r){var e=i.lookupPath(r,{follow:!0}),t=e.node;if(!t.node_ops.readdir)throw new i.ErrnoError(54);return t.node_ops.readdir(t)},unlink(r){var e=i.lookupPath(r,{parent:!0}),t=e.node;if(!t)throw new i.ErrnoError(44);var n=C.basename(r),o=i.lookupNode(t,n),a=i.mayDelete(t,n,!1);if(a)throw new i.ErrnoError(a);if(!t.node_ops.unlink)throw new i.ErrnoError(63);if(i.isMountpoint(o))throw new i.ErrnoError(10);t.node_ops.unlink(t,n),i.destroyNode(o)},readlink(r){var e=i.lookupPath(r),t=e.node;if(!t)throw new i.ErrnoError(44);if(!t.node_ops.readlink)throw new i.ErrnoError(28);return tr.resolve(i.getPath(t.parent),t.node_ops.readlink(t))},stat(r,e){var t=i.lookupPath(r,{follow:!e}),n=t.node;if(!n)throw new i.ErrnoError(44);if(!n.node_ops.getattr)throw new i.ErrnoError(63);return n.node_ops.getattr(n)},lstat(r){return i.stat(r,!0)},chmod(r,e,t){var n;if(typeof r=="string"){var o=i.lookupPath(r,{follow:!t});n=o.node}else n=r;if(!n.node_ops.setattr)throw new i.ErrnoError(63);n.node_ops.setattr(n,{mode:e&4095|n.mode&-4096,timestamp:Date.now()})},lchmod(r,e){i.chmod(r,e,!0)},fchmod(r,e){var t=i.getStreamChecked(r);i.chmod(t.node,e)},chown(r,e,t,n){var o;if(typeof r=="string"){var a=i.lookupPath(r,{follow:!n});o=a.node}else o=r;if(!o.node_ops.setattr)throw new i.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(r,e,t){i.chown(r,e,t,!0)},fchown(r,e,t){var n=i.getStreamChecked(r);i.chown(n.node,e,t)},truncate(r,e){if(e<0)throw new i.ErrnoError(28);var t;if(typeof r=="string"){var n=i.lookupPath(r,{follow:!0});t=n.node}else t=r;if(!t.node_ops.setattr)throw new i.ErrnoError(63);if(i.isDir(t.mode))throw new i.ErrnoError(31);if(!i.isFile(t.mode))throw new i.ErrnoError(28);var o=i.nodePermissions(t,"w");if(o)throw new i.ErrnoError(o);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=i.getStreamChecked(r);if(!(t.flags&2097155))throw new i.ErrnoError(28);i.truncate(t.node,e)},utime(r,e,t){var n=i.lookupPath(r,{follow:!0}),o=n.node;o.node_ops.setattr(o,{timestamp:Math.max(e,t)})},open(r,e,t){if(r==="")throw new i.ErrnoError(44);e=typeof e=="string"?Ft(e):e,t=typeof t>"u"?438:t,e&64?t=t&4095|32768:t=0;var n;if(typeof r=="object")n=r;else{r=C.normalize(r);try{var o=i.lookupPath(r,{follow:!(e&131072)});n=o.node}catch{}}var a=!1;if(e&64)if(n){if(e&128)throw new i.ErrnoError(20)}else n=i.mknod(r,t,0),a=!0;if(!n)throw new i.ErrnoError(44);if(i.isChrdev(n.mode)&&(e&=-513),e&65536&&!i.isDir(n.mode))throw new i.ErrnoError(54);if(!a){var s=i.mayOpen(n,e);if(s)throw new i.ErrnoError(s)}e&512&&!a&&i.truncate(n,0),e&=-131713;var u=i.createStream({node:n,path:i.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),f.logReadFiles&&!(e&1)&&(i.readFiles||(i.readFiles={}),r in i.readFiles||(i.readFiles[r]=1)),u},close(r){if(i.isClosed(r))throw new i.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{i.closeStream(r.fd)}r.fd=null},isClosed(r){return r.fd===null},llseek(r,e,t){if(i.isClosed(r))throw new i.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new i.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new i.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,n,o){if(n<0||o<0)throw new i.ErrnoError(28);if(i.isClosed(r))throw new i.ErrnoError(8);if((r.flags&2097155)===1)throw new i.ErrnoError(8);if(i.isDir(r.node.mode))throw new i.ErrnoError(31);if(!r.stream_ops.read)throw new i.ErrnoError(28);var a=typeof o<"u";if(!a)o=r.position;else if(!r.seekable)throw new i.ErrnoError(70);var s=r.stream_ops.read(r,e,t,n,o);return a||(r.position+=s),s},write(r,e,t,n,o,a){if(n<0||o<0)throw new i.ErrnoError(28);if(i.isClosed(r))throw new i.ErrnoError(8);if(!(r.flags&2097155))throw new i.ErrnoError(8);if(i.isDir(r.node.mode))throw new i.ErrnoError(31);if(!r.stream_ops.write)throw new i.ErrnoError(28);r.seekable&&r.flags&1024&&i.llseek(r,0,2);var s=typeof o<"u";if(!s)o=r.position;else if(!r.seekable)throw new i.ErrnoError(70);var u=r.stream_ops.write(r,e,t,n,o,a);return s||(r.position+=u),u},allocate(r,e,t){if(i.isClosed(r))throw new i.ErrnoError(8);if(e<0||t<=0)throw new i.ErrnoError(28);if(!(r.flags&2097155))throw new i.ErrnoError(8);if(!i.isFile(r.node.mode)&&!i.isDir(r.node.mode))throw new i.ErrnoError(43);if(!r.stream_ops.allocate)throw new i.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,n,o){if(n&2&&!(o&2)&&(r.flags&2097155)!==2)throw new i.ErrnoError(2);if((r.flags&2097155)===1)throw new i.ErrnoError(2);if(!r.stream_ops.mmap)throw new i.ErrnoError(43);return r.stream_ops.mmap(r,e,t,n,o)},msync(r,e,t,n,o){return r.stream_ops.msync?r.stream_ops.msync(r,e,t,n,o):0},ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new i.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary",e.encoding!=="utf8"&&e.encoding!=="binary")throw new Error(`Invalid encoding type "${e.encoding}"`);var t,n=i.open(r,e.flags),o=i.stat(r),a=o.size,s=new Uint8Array(a);return i.read(n,s,0,a,0),e.encoding==="utf8"?t=wr(s,0):e.encoding==="binary"&&(t=s),i.close(n),t},writeFile(r,e,t={}){t.flags=t.flags||577;var n=i.open(r,t.flags,t.mode);if(typeof e=="string"){var o=new Uint8Array(Ur(e)+1),a=Qr(e,o,0,o.length);i.write(n,o,0,a,void 0,t.canOwn)}else if(ArrayBuffer.isView(e))i.write(n,e,0,e.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");i.close(n)},cwd:()=>i.currentPath,chdir(r){var e=i.lookupPath(r,{follow:!0});if(e.node===null)throw new i.ErrnoError(44);if(!i.isDir(e.node.mode))throw new i.ErrnoError(54);var t=i.nodePermissions(e.node,"x");if(t)throw new i.ErrnoError(t);i.currentPath=e.path},createDefaultDirectories(){i.mkdir("/tmp"),i.mkdir("/home"),i.mkdir("/home/web_user")},createDefaultDevices(){i.mkdir("/dev"),i.registerDevice(i.makedev(1,3),{read:()=>0,write:(n,o,a,s,u)=>s}),i.mkdev("/dev/null",i.makedev(1,3)),ar.register(i.makedev(5,0),ar.default_tty_ops),ar.register(i.makedev(6,0),ar.default_tty1_ops),i.mkdev("/dev/tty",i.makedev(5,0)),i.mkdev("/dev/tty1",i.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(e===0&&(e=ve(r).byteLength),r[--e]);i.createDevice("/dev","random",t),i.createDevice("/dev","urandom",t),i.mkdir("/dev/shm"),i.mkdir("/dev/shm/tmp")},createSpecialDirectories(){i.mkdir("/proc");var r=i.mkdir("/proc/self");i.mkdir("/proc/self/fd"),i.mount({mount(){var e=i.createNode(r,"fd",16895,73);return e.node_ops={lookup(t,n){var o=+n,a=i.getStreamChecked(o),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>a.path}};return s.parent=s,s}},e}},{},"/proc/self/fd")},createStandardStreams(){f.stdin?i.createDevice("/dev","stdin",f.stdin):i.symlink("/dev/tty","/dev/stdin"),f.stdout?i.createDevice("/dev","stdout",null,f.stdout):i.symlink("/dev/tty","/dev/stdout"),f.stderr?i.createDevice("/dev","stderr",null,f.stderr):i.symlink("/dev/tty1","/dev/stderr");var r=i.open("/dev/stdin",0),e=i.open("/dev/stdout",1),t=i.open("/dev/stderr",1)},staticInit(){[44].forEach(r=>{i.genericErrors[r]=new i.ErrnoError(r),i.genericErrors[r].stack="<generic error, no stack>"}),i.nameTable=new Array(4096),i.mount(S,{},"/"),i.createDefaultDirectories(),i.createDefaultDevices(),i.createSpecialDirectories(),i.filesystems={MEMFS:S}},init(r,e,t){i.init.initialized=!0,f.stdin=r||f.stdin,f.stdout=e||f.stdout,f.stderr=t||f.stderr,i.createStandardStreams()},quit(){i.init.initialized=!1;for(var r=0;r<i.streams.length;r++){var e=i.streams[r];e&&i.close(e)}},findObject(r,e){var t=i.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{var t=i.lookupPath(r,{follow:!e});r=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=i.lookupPath(r,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=C.basename(r),t=i.lookupPath(r,{follow:!e}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(o){n.error=o.errno}return n},createPath(r,e,t,n){r=typeof r=="string"?r:i.getPath(r);for(var o=e.split("/").reverse();o.length;){var a=o.pop();if(a){var s=C.join2(r,a);try{i.mkdir(s)}catch{}r=s}}return s},createFile(r,e,t,n,o){var a=C.join2(typeof r=="string"?r:i.getPath(r),e),s=re(n,o);return i.create(a,s)},createDataFile(r,e,t,n,o,a){var s=e;r&&(r=typeof r=="string"?r:i.getPath(r),s=e?C.join2(r,e):r);var u=re(n,o),c=i.create(s,u);if(t){if(typeof t=="string"){for(var d=new Array(t.length),v=0,E=t.length;v<E;++v)d[v]=t.charCodeAt(v);t=d}i.chmod(c,u|146);var h=i.open(c,577);i.write(h,t,0,t.length,0,a),i.close(h),i.chmod(c,u)}},createDevice(r,e,t,n){var o=C.join2(typeof r=="string"?r:i.getPath(r),e),a=re(!!t,!!n);i.createDevice.major||(i.createDevice.major=64);var s=i.makedev(i.createDevice.major++,0);return i.registerDevice(s,{open(u){u.seekable=!1},close(u){n?.buffer?.length&&n(10)},read(u,c,d,v,E){for(var h=0,w=0;w<v;w++){var F;try{F=t()}catch{throw new i.ErrnoError(29)}if(F===void 0&&h===0)throw new i.ErrnoError(6);if(F==null)break;h++,c[d+w]=F}return h&&(u.node.timestamp=Date.now()),h},write(u,c,d,v,E){for(var h=0;h<v;h++)try{n(c[d+h])}catch{throw new i.ErrnoError(29)}return v&&(u.node.timestamp=Date.now()),h}}),i.mkdev(o,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(vr)try{r.contents=Br(vr(r.url),!0),r.usedBytes=r.contents.length}catch{throw new i.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(r,e,t,n,o){class a{constructor(){this.lengthKnown=!1,this.chunks=[]}get(w){if(!(w>this.length-1||w<0)){var F=w%this.chunkSize,j=w/this.chunkSize|0;return this.getter(j)[F]}}setDataGetter(w){this.getter=w}cacheLength(){var w=new XMLHttpRequest;if(w.open("HEAD",t,!1),w.send(null),!(w.status>=200&&w.status<300||w.status===304))throw new Error("Couldn't load "+t+". Status: "+w.status);var F=Number(w.getResponseHeader("Content-length")),j,$=(j=w.getResponseHeader("Accept-Ranges"))&&j==="bytes",z=(j=w.getResponseHeader("Content-Encoding"))&&j==="gzip",l=1024*1024;$||(l=F);var y=(T,G)=>{if(T>G)throw new Error("invalid range ("+T+", "+G+") or no bytes requested!");if(G>F-1)throw new Error("only "+F+" bytes available! programmer error!");var L=new XMLHttpRequest;if(L.open("GET",t,!1),F!==l&&L.setRequestHeader("Range","bytes="+T+"-"+G),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||[]):Br(L.responseText||"",!0)},H=this;H.setDataGetter(T=>{var G=T*l,L=(T+1)*l-1;if(L=Math.min(L,F-1),typeof H.chunks[T]>"u"&&(H.chunks[T]=y(G,L)),typeof H.chunks[T]>"u")throw new Error("doXHR failed!");return H.chunks[T]}),(z||!F)&&(l=F=1,F=this.getter(0).length,l=F,Er("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=F,this._chunkSize=l,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(!Z)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=i.createFile(r,e,u,n,o);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 d={},v=Object.keys(c.stream_ops);v.forEach(h=>{var w=c.stream_ops[h];d[h]=(...F)=>(i.forceLoadFile(c),w(...F))});function E(h,w,F,j,$){var z=h.node.contents;if($>=z.length)return 0;var l=Math.min(z.length-$,j);if(z.slice)for(var y=0;y<l;y++)w[F+y]=z[$+y];else for(var y=0;y<l;y++)w[F+y]=z.get($+y);return l}return d.read=(h,w,F,j,$)=>(i.forceLoadFile(c),E(h,w,F,j,$)),d.mmap=(h,w,F,j,$)=>{i.forceLoadFile(c);var z=me(w);if(!z)throw new i.ErrnoError(48);return E(h,U,z,w,F),{ptr:z,allocated:!0}},c.stream_ops=d,c}},Pr=(r,e)=>r?wr(rr,r,e):"",P={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(C.isAbs(e))return e;var n;if(r===-100)n=i.cwd();else{var o=P.getStreamFromFD(r);n=o.path}if(e.length==0){if(!t)throw new i.ErrnoError(44);return n}return C.join2(n,e)},doStat(r,e,t){var n=r(e);k[t>>2]=n.dev,k[t+4>>2]=n.mode,R[t+8>>2]=n.nlink,k[t+12>>2]=n.uid,k[t+16>>2]=n.gid,k[t+20>>2]=n.rdev,B=[n.size>>>0,(M=n.size,+Math.abs(M)>=1?M>0?+Math.floor(M/4294967296)>>>0:~~+Math.ceil((M-+(~~M>>>0))/4294967296)>>>0:0)],k[t+24>>2]=B[0],k[t+28>>2]=B[1],k[t+32>>2]=4096,k[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),s=n.ctime.getTime();return B=[Math.floor(o/1e3)>>>0,(M=Math.floor(o/1e3),+Math.abs(M)>=1?M>0?+Math.floor(M/4294967296)>>>0:~~+Math.ceil((M-+(~~M>>>0))/4294967296)>>>0:0)],k[t+40>>2]=B[0],k[t+44>>2]=B[1],R[t+48>>2]=o%1e3*1e3,B=[Math.floor(a/1e3)>>>0,(M=Math.floor(a/1e3),+Math.abs(M)>=1?M>0?+Math.floor(M/4294967296)>>>0:~~+Math.ceil((M-+(~~M>>>0))/4294967296)>>>0:0)],k[t+56>>2]=B[0],k[t+60>>2]=B[1],R[t+64>>2]=a%1e3*1e3,B=[Math.floor(s/1e3)>>>0,(M=Math.floor(s/1e3),+Math.abs(M)>=1?M>0?+Math.floor(M/4294967296)>>>0:~~+Math.ceil((M-+(~~M>>>0))/4294967296)>>>0:0)],k[t+72>>2]=B[0],k[t+76>>2]=B[1],R[t+80>>2]=s%1e3*1e3,B=[n.ino>>>0,(M=n.ino,+Math.abs(M)>=1?M>0?+Math.floor(M/4294967296)>>>0:~~+Math.ceil((M-+(~~M>>>0))/4294967296)>>>0:0)],k[t+88>>2]=B[0],k[t+92>>2]=B[1],0},doMsync(r,e,t,n,o){if(!i.isFile(e.node.mode))throw new i.ErrnoError(43);if(n&2)return 0;var a=rr.slice(r,r+t);i.msync(e,a,o,t,n)},varargs:void 0,get(){var r=k[+P.varargs>>2];return P.varargs+=4,r},getp(){return P.get()},getStr(r){var e=Pr(r);return e},getStreamFromFD(r){var e=i.getStreamChecked(r);return e}};function Pt(r){try{return r=P.getStr(r),i.chdir(r),0}catch(e){if(typeof i>"u"||e.name!=="ErrnoError")throw e;return-e.errno}}function Mt(r,e,t,n){try{if(e=P.getStr(e),e=P.calculateAt(r,e),t&-8)return-28;var o=i.lookupPath(e,{follow:!0}),a=o.node;if(!a)return-44;var s="";return t&4&&(s+="r"),t&2&&(s+="w"),t&1&&(s+="x"),s&&i.nodePermissions(a,s)?-2:0}catch(u){if(typeof i>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Dt(r,e,t){P.varargs=t;try{var n=P.getStreamFromFD(r);switch(e){case 0:{var o=P.get();if(o<0)return-28;for(;i.streams[o];)o++;var a;return a=i.dupStream(n,o),a.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var o=P.get();return n.flags|=o,0}case 12:{var o=P.getp(),s=0;return fr[o+s>>1]=2,0}case 13:case 14:return 0}return-28}catch(u){if(typeof i>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function At(r,e){try{var t=P.getStreamFromFD(r);return P.doStat(i.stat,t.path,e)}catch(n){if(typeof i>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var pe=(r,e,t)=>Qr(r,rr,e,t);function Rt(r,e){try{if(e===0)return-28;var t=i.cwd(),n=Ur(t)+1;return e<n?-68:(pe(t,r,e),n)}catch(o){if(typeof i>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Ct(r,e,t){P.varargs=t;try{var n=P.getStreamFromFD(r);switch(e){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),a=P.getp();k[a>>2]=o.c_iflag||0,k[a+4>>2]=o.c_oflag||0,k[a+8>>2]=o.c_cflag||0,k[a+12>>2]=o.c_lflag||0;for(var s=0;s<32;s++)U[a+s+17]=o.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var a=P.getp(),u=k[a>>2],c=k[a+4>>2],d=k[a+8>>2],v=k[a+12>>2],E=[],s=0;s<32;s++)E.push(U[a+s+17]);return n.tty.ops.ioctl_tcsets(n.tty,e,{c_iflag:u,c_oflag:c,c_cflag:d,c_lflag:v,c_cc:E})}return 0}case 21519:{if(!n.tty)return-59;var a=P.getp();return k[a>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var a=P.getp();return i.ioctl(n,e,a)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var h=n.tty.ops.ioctl_tiocgwinsz(n.tty),a=P.getp();fr[a>>1]=h[0],fr[a+2>>1]=h[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(w){if(typeof i>"u"||w.name!=="ErrnoError")throw w;return-w.errno}}function xt(r,e,t,n){try{e=P.getStr(e);var o=n&256,a=n&4096;return n=n&-6401,e=P.calculateAt(r,e,a),P.doStat(o?i.lstat:i.stat,e,t)}catch(s){if(typeof i>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function Tt(r,e,t,n){P.varargs=n;try{e=P.getStr(e),e=P.calculateAt(r,e);var o=n?P.get():0;return i.open(e,t,o).fd}catch(a){if(typeof i>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function Nt(r,e){try{return r=P.getStr(r),P.doStat(i.stat,r,e)}catch(t){if(typeof i>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var It=1,jt=()=>It,zt=()=>{le=!1,ye=0},Lt=()=>{throw 1/0},ee=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+e*4294967296:NaN;function Ot(r,e,t,n,o,a,s,u){var c=ee(o,a);try{if(isNaN(c))return 61;var d=P.getStreamFromFD(n),v=i.mmap(d,r,c,e,t),E=v.ptr;return k[s>>2]=v.allocated,R[u>>2]=E,0}catch(h){if(typeof i>"u"||h.name!=="ErrnoError")throw h;return-h.errno}}function Ut(r,e,t,n,o,a,s){var u=ee(a,s);try{var c=P.getStreamFromFD(o);t&2&&P.doMsync(r,c,e,n,u)}catch(d){if(typeof i>"u"||d.name!=="ErrnoError")throw d;return-d.errno}}var Bt=()=>{Nr("")},Ht=()=>Date.now(),_e=()=>2147483648,Wt=()=>_e(),we;we=()=>performance.now();var Yt=(r,e,t)=>rr.copyWithin(r,e,e+t),$t=r=>{var e=cr.buffer,t=(r-e.byteLength+65535)/65536;try{return cr.grow(t),ir(),1}catch{}},Xt=r=>{var e=rr.length;r>>>=0;var t=_e();if(r>t)return!1;for(var n=(c,d)=>c+(d-c%d)%d,o=1;o<=4;o*=2){var a=e*(1+.2/o);a=Math.min(a,r+100663296);var s=Math.min(t,n(Math.max(r,a),65536)),u=$t(s);if(u)return!0}return!1},te={},qt=()=>K||"./this.program",Mr=()=>{if(!Mr.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,_:qt()};for(var t in te)te[t]===void 0?delete e[t]:e[t]=te[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);Mr.strings=n}return Mr.strings},Vt=(r,e)=>{for(var t=0;t<r.length;++t)U[e++]=r.charCodeAt(t);U[e]=0},Gt=(r,e)=>{var t=0;return Mr().forEach((n,o)=>{var a=e+t;R[r+o*4>>2]=a,Vt(n,a),t+=n.length+1}),0},Kt=(r,e)=>{var t=Mr();R[r>>2]=t.length;var n=0;return t.forEach(o=>n+=o.length+1),R[e>>2]=n,0},ye=0,Jt=()=>le||ye>0,ge=r=>{mr=r,Jt()||(f.onExit?.(r),hr=!0),X(r,new fe(r))},Ee=(r,e)=>{mr=r,ge(r)},Zt=Ee;function Qt(r){try{var e=P.getStreamFromFD(r);return i.close(e),0}catch(t){if(typeof i>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var rn=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var s=R[e>>2],u=R[e+4>>2];e+=8;var c=i.read(r,U,s,u,n);if(c<0)return-1;if(o+=c,c<u)break;typeof n<"u"&&(n+=c)}return o};function en(r,e,t,n){try{var o=P.getStreamFromFD(r),a=rn(o,e,t);return R[n>>2]=a,0}catch(s){if(typeof i>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function tn(r,e,t,n,o){var a=ee(e,t);try{if(isNaN(a))return 61;var s=P.getStreamFromFD(r);return i.llseek(s,a,n),B=[s.position>>>0,(M=s.position,+Math.abs(M)>=1?M>0?+Math.floor(M/4294967296)>>>0:~~+Math.ceil((M-+(~~M>>>0))/4294967296)>>>0:0)],k[o>>2]=B[0],k[o+4>>2]=B[1],s.getdents&&a===0&&n===0&&(s.getdents=null),0}catch(u){if(typeof i>"u"||u.name!=="ErrnoError")throw u;return u.errno}}var nn=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var s=R[e>>2],u=R[e+4>>2];e+=8;var c=i.write(r,U,s,u,n);if(c<0)return-1;o+=c,typeof n<"u"&&(n+=c)}return o};function on(r,e,t,n){try{var o=P.getStreamFromFD(r),a=nn(o,e,t);return R[n>>2]=a,0}catch(s){if(typeof i>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var an=r=>r,Hr=r=>r%4===0&&(r%100!==0||r%400===0),sn=(r,e)=>{for(var t=0,n=0;n<=e;t+=r[n++]);return t},ke=[31,29,31,30,31,30,31,31,30,31,30,31],Se=[31,28,31,30,31,30,31,31,30,31,30,31],un=(r,e)=>{for(var t=new Date(r.getTime());e>0;){var n=Hr(t.getFullYear()),o=t.getMonth(),a=(n?ke:Se)[o];if(e>a-t.getDate())e-=a-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+e),t}return t},cn=(r,e)=>{U.set(r,e)},fn=(r,e,t,n)=>{var o=R[n+40>>2],a={tm_sec:k[n>>2],tm_min:k[n+4>>2],tm_hour:k[n+8>>2],tm_mday:k[n+12>>2],tm_mon:k[n+16>>2],tm_year:k[n+20>>2],tm_wday:k[n+24>>2],tm_yday:k[n+28>>2],tm_isdst:k[n+32>>2],tm_gmtoff:k[n+36>>2],tm_zone:o?Pr(o):""},s=Pr(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 d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],v=["January","February","March","April","May","June","July","August","September","October","November","December"];function E(l,y,H){for(var T=typeof l=="number"?l.toString():l||"";T.length<y;)T=H[0]+T;return T}function h(l,y){return E(l,y,"0")}function w(l,y){function H(G){return G<0?-1:G>0?1:0}var T;return(T=H(l.getFullYear()-y.getFullYear()))===0&&(T=H(l.getMonth()-y.getMonth()))===0&&(T=H(l.getDate()-y.getDate())),T}function F(l){switch(l.getDay()){case 0:return new Date(l.getFullYear()-1,11,29);case 1:return l;case 2:return new Date(l.getFullYear(),0,3);case 3:return new Date(l.getFullYear(),0,2);case 4:return new Date(l.getFullYear(),0,1);case 5:return new Date(l.getFullYear()-1,11,31);case 6:return new Date(l.getFullYear()-1,11,30)}}function j(l){var y=un(new Date(l.tm_year+1900,0,1),l.tm_yday),H=new Date(y.getFullYear(),0,4),T=new Date(y.getFullYear()+1,0,4),G=F(H),L=F(T);return w(G,y)<=0?w(L,y)<=0?y.getFullYear()+1:y.getFullYear():y.getFullYear()-1}var $={"%a":l=>d[l.tm_wday].substring(0,3),"%A":l=>d[l.tm_wday],"%b":l=>v[l.tm_mon].substring(0,3),"%B":l=>v[l.tm_mon],"%C":l=>{var y=l.tm_year+1900;return h(y/100|0,2)},"%d":l=>h(l.tm_mday,2),"%e":l=>E(l.tm_mday,2," "),"%g":l=>j(l).toString().substring(2),"%G":j,"%H":l=>h(l.tm_hour,2),"%I":l=>{var y=l.tm_hour;return y==0?y=12:y>12&&(y-=12),h(y,2)},"%j":l=>h(l.tm_mday+sn(Hr(l.tm_year+1900)?ke:Se,l.tm_mon-1),3),"%m":l=>h(l.tm_mon+1,2),"%M":l=>h(l.tm_min,2),"%n":()=>`
|
|
4
|
+
`,"%p":l=>l.tm_hour>=0&&l.tm_hour<12?"AM":"PM","%S":l=>h(l.tm_sec,2),"%t":()=>" ","%u":l=>l.tm_wday||7,"%U":l=>{var y=l.tm_yday+7-l.tm_wday;return h(Math.floor(y/7),2)},"%V":l=>{var y=Math.floor((l.tm_yday+7-(l.tm_wday+6)%7)/7);if((l.tm_wday+371-l.tm_yday-2)%7<=2&&y++,y){if(y==53){var T=(l.tm_wday+371-l.tm_yday)%7;T!=4&&(T!=3||!Hr(l.tm_year))&&(y=1)}}else{y=52;var H=(l.tm_wday+7-l.tm_yday-1)%7;(H==4||H==5&&Hr(l.tm_year%400-1))&&y++}return h(y,2)},"%w":l=>l.tm_wday,"%W":l=>{var y=l.tm_yday+7-(l.tm_wday+6)%7;return h(Math.floor(y/7),2)},"%y":l=>(l.tm_year+1900).toString().substring(2),"%Y":l=>l.tm_year+1900,"%z":l=>{var y=l.tm_gmtoff,H=y>=0;return y=Math.abs(y)/60,y=y/60*100+y%60,(H?"+":"-")+("0000"+y).slice(-4)},"%Z":l=>l.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var c in $)s.includes(c)&&(s=s.replace(new RegExp(c,"g"),$[c](a)));s=s.replace(/\0\0/g,"%");var z=Br(s,!1);return z.length>e?0:(cn(z,r),z.length-1)},ln=(r,e,t,n,o)=>fn(r,e,t,n),dn=r=>{if(r instanceof fe||r=="unwind")return mr;X(1,r)},vn=r=>{var e=Ur(r)+1,t=Ar(e);return pe(r,t,e),t},hn=r=>{var e=p(),t=r();return _(e),t},mn=r=>hn(()=>{var e=Ar(4),t=Ar(4);Pe(r,e,t);var n=R[e>>2],o=R[t>>2],a=Pr(n);ne(n);var s;return o&&(s=Pr(o),ne(o)),[a,s]}),pn=r=>mn(r),_n=r=>oe(r),wn=r=>ie(r);i.createPreloadedFile=bt,i.staticInit(),f.FS_createPath=i.createPath,f.FS_createDataFile=i.createDataFile,f.FS_createPreloadedFile=i.createPreloadedFile,f.FS_unlink=i.unlink,f.FS_createLazyFile=i.createLazyFile,f.FS_createDevice=i.createDevice;var yn={ka:ot,l:at,t:st,a:ct,h:ft,E:lt,Pa:dt,P:vt,r:ht,ga:mt,d:ut,xa:Pt,ya:Mt,T:Dt,sa:At,pa:Rt,za:Ct,qa:xt,Q:Tt,ra:Nt,ua:jt,ma:zt,ha:Lt,aa:Ot,ba:Ut,q:Bt,va:Ht,ja:Wt,ta:we,wa:Yt,ia:Xt,na:Gt,oa:Kt,L:Zt,M:Qt,S:en,ca:tn,R:on,s:An,z:Zn,K:Gn,O:_i,v:Fn,g:Sn,n:On,b:kn,y:Kn,Na:Yn,e:xn,C:ni,G:Jn,Oa:Wn,p:Ln,U:pi,Ma:$n,Da:ci,N:ii,w:Mn,Z:ai,Fa:oi,Ka:qn,A:In,La:Xn,Ea:ui,x:Un,Qa:Hn,Ja:Vn,J:wi,Y:si,$:ki,_:Si,j:jn,i:bn,D:Qn,Ba:hi,Ca:vi,Ga:ti,c:Dn,Aa:mi,Ha:ei,Ia:ri,f:Rn,k:Tn,W:li,u:Pn,V:di,X:fi,B:Cn,o:Nn,H:Bn,F:zn,I:yi,da:Ei,ea:gi,m:an,la:ge,fa:ln},N=it(),gn=()=>(gn=N.Sa)(),be=f._main=(r,e)=>(be=f._main=N.Ta)(r,e),ne=r=>(ne=N.Va)(r),En=r=>(En=N.__cxa_free_exception)(r),Dr=r=>(Dr=N.Wa)(r),Fe=(r,e)=>(Fe=N.Xa)(r,e),m=(r,e)=>(m=N.Ya)(r,e),p=()=>(p=N.Za)(),_=r=>(_=N._a)(r),Ar=r=>(Ar=N.$a)(r),ie=r=>(ie=N.ab)(r),oe=r=>(oe=N.bb)(r),Pe=(r,e,t)=>(Pe=N.cb)(r,e,t),Me=(r,e,t)=>(Me=N.db)(r,e,t),De=r=>(De=N.eb)(r),Ae=f.dynCall_vij=(r,e,t,n)=>(Ae=f.dynCall_vij=N.fb)(r,e,t,n),Re=f.dynCall_j=r=>(Re=f.dynCall_j=N.gb)(r),Ce=f.dynCall_viijii=(r,e,t,n,o,a,s)=>(Ce=f.dynCall_viijii=N.hb)(r,e,t,n,o,a,s),xe=f.dynCall_jiiii=(r,e,t,n,o)=>(xe=f.dynCall_jiiii=N.ib)(r,e,t,n,o);function kn(r,e,t){var n=p();try{return g(r)(e,t)}catch(o){if(_(n),o!==o+0)throw o;m(1,0)}}function Sn(r,e){var t=p();try{return g(r)(e)}catch(n){if(_(t),n!==n+0)throw n;m(1,0)}}function bn(r,e){var t=p();try{g(r)(e)}catch(n){if(_(t),n!==n+0)throw n;m(1,0)}}function Fn(r){var e=p();try{return g(r)()}catch(t){if(_(e),t!==t+0)throw t;m(1,0)}}function Pn(r,e,t,n,o,a){var s=p();try{g(r)(e,t,n,o,a)}catch(u){if(_(s),u!==u+0)throw u;m(1,0)}}function Mn(r,e,t,n,o,a){var s=p();try{return g(r)(e,t,n,o,a)}catch(u){if(_(s),u!==u+0)throw u;m(1,0)}}function Dn(r,e,t){var n=p();try{g(r)(e,t)}catch(o){if(_(n),o!==o+0)throw o;m(1,0)}}function An(r,e){var t=p();try{return g(r)(e)}catch(n){if(_(t),n!==n+0)throw n;m(1,0)}}function Rn(r,e,t,n){var o=p();try{g(r)(e,t,n)}catch(a){if(_(o),a!==a+0)throw a;m(1,0)}}function Cn(r,e,t,n,o,a,s){var u=p();try{g(r)(e,t,n,o,a,s)}catch(c){if(_(u),c!==c+0)throw c;m(1,0)}}function xn(r,e,t,n){var o=p();try{return g(r)(e,t,n)}catch(a){if(_(o),a!==a+0)throw a;m(1,0)}}function Tn(r,e,t,n,o){var a=p();try{g(r)(e,t,n,o)}catch(s){if(_(a),s!==s+0)throw s;m(1,0)}}function Nn(r,e,t,n,o,a,s,u){var c=p();try{g(r)(e,t,n,o,a,s,u)}catch(d){if(_(c),d!==d+0)throw d;m(1,0)}}function In(r,e,t,n,o,a,s){var u=p();try{return g(r)(e,t,n,o,a,s)}catch(c){if(_(u),c!==c+0)throw c;m(1,0)}}function jn(r){var e=p();try{g(r)()}catch(t){if(_(e),t!==t+0)throw t;m(1,0)}}function zn(r,e,t,n,o,a,s,u,c,d,v){var E=p();try{g(r)(e,t,n,o,a,s,u,c,d,v)}catch(h){if(_(E),h!==h+0)throw h;m(1,0)}}function Ln(r,e,t,n,o){var a=p();try{return g(r)(e,t,n,o)}catch(s){if(_(a),s!==s+0)throw s;m(1,0)}}function On(r,e,t){var n=p();try{return g(r)(e,t)}catch(o){if(_(n),o!==o+0)throw o;m(1,0)}}function Un(r,e,t,n,o,a,s,u){var c=p();try{return g(r)(e,t,n,o,a,s,u)}catch(d){if(_(c),d!==d+0)throw d;m(1,0)}}function Bn(r,e,t,n,o,a,s,u,c){var d=p();try{g(r)(e,t,n,o,a,s,u,c)}catch(v){if(_(d),v!==v+0)throw v;m(1,0)}}function Hn(r,e,t,n,o,a,s,u,c,d){var v=p();try{return g(r)(e,t,n,o,a,s,u,c,d)}catch(E){if(_(v),E!==E+0)throw E;m(1,0)}}function Wn(r,e,t,n,o,a,s,u){var c=p();try{return g(r)(e,t,n,o,a,s,u)}catch(d){if(_(c),d!==d+0)throw d;m(1,0)}}function Yn(r,e,t,n,o,a){var s=p();try{return g(r)(e,t,n,o,a)}catch(u){if(_(s),u!==u+0)throw u;m(1,0)}}function $n(r,e,t,n,o,a,s){var u=p();try{return g(r)(e,t,n,o,a,s)}catch(c){if(_(u),c!==c+0)throw c;m(1,0)}}function Xn(r,e,t,n,o,a,s,u,c){var d=p();try{return g(r)(e,t,n,o,a,s,u,c)}catch(v){if(_(d),v!==v+0)throw v;m(1,0)}}function qn(r,e,t,n,o,a,s,u,c){var d=p();try{return g(r)(e,t,n,o,a,s,u,c)}catch(v){if(_(d),v!==v+0)throw v;m(1,0)}}function Vn(r,e,t,n,o,a,s,u,c,d,v){var E=p();try{return g(r)(e,t,n,o,a,s,u,c,d,v)}catch(h){if(_(E),h!==h+0)throw h;m(1,0)}}function Gn(r,e,t,n){var o=p();try{return g(r)(e,t,n)}catch(a){if(_(o),a!==a+0)throw a;m(1,0)}}function Kn(r,e,t,n){var o=p();try{return g(r)(e,t,n)}catch(a){if(_(o),a!==a+0)throw a;m(1,0)}}function Jn(r,e,t,n,o,a){var s=p();try{return g(r)(e,t,n,o,a)}catch(u){if(_(s),u!==u+0)throw u;m(1,0)}}function Zn(r,e,t){var n=p();try{return g(r)(e,t)}catch(o){if(_(n),o!==o+0)throw o;m(1,0)}}function Qn(r,e,t){var n=p();try{g(r)(e,t)}catch(o){if(_(n),o!==o+0)throw o;m(1,0)}}function ri(r,e,t,n,o,a){var s=p();try{g(r)(e,t,n,o,a)}catch(u){if(_(s),u!==u+0)throw u;m(1,0)}}function ei(r,e,t,n,o){var a=p();try{g(r)(e,t,n,o)}catch(s){if(_(a),s!==s+0)throw s;m(1,0)}}function ti(r,e,t,n,o,a,s,u,c){var d=p();try{g(r)(e,t,n,o,a,s,u,c)}catch(v){if(_(d),v!==v+0)throw v;m(1,0)}}function ni(r,e,t,n,o){var a=p();try{return g(r)(e,t,n,o)}catch(s){if(_(a),s!==s+0)throw s;m(1,0)}}function ii(r,e,t,n,o,a,s){var u=p();try{return g(r)(e,t,n,o,a,s)}catch(c){if(_(u),c!==c+0)throw c;m(1,0)}}function oi(r,e,t,n,o,a,s,u){var c=p();try{return g(r)(e,t,n,o,a,s,u)}catch(d){if(_(c),d!==d+0)throw d;m(1,0)}}function ai(r,e,t,n,o,a,s){var u=p();try{return g(r)(e,t,n,o,a,s)}catch(c){if(_(u),c!==c+0)throw c;m(1,0)}}function si(r,e,t,n,o,a,s,u,c,d,v,E,h){var w=p();try{return g(r)(e,t,n,o,a,s,u,c,d,v,E,h)}catch(F){if(_(w),F!==F+0)throw F;m(1,0)}}function ui(r,e,t,n,o,a,s,u,c,d,v){var E=p();try{return g(r)(e,t,n,o,a,s,u,c,d,v)}catch(h){if(_(E),h!==h+0)throw h;m(1,0)}}function ci(r,e,t,n,o,a,s,u){var c=p();try{return g(r)(e,t,n,o,a,s,u)}catch(d){if(_(c),d!==d+0)throw d;m(1,0)}}function fi(r,e,t,n,o,a,s,u,c,d){var v=p();try{g(r)(e,t,n,o,a,s,u,c,d)}catch(E){if(_(v),E!==E+0)throw E;m(1,0)}}function li(r,e,t,n,o,a,s){var u=p();try{g(r)(e,t,n,o,a,s)}catch(c){if(_(u),c!==c+0)throw c;m(1,0)}}function di(r,e,t,n,o,a,s,u,c){var d=p();try{g(r)(e,t,n,o,a,s,u,c)}catch(v){if(_(d),v!==v+0)throw v;m(1,0)}}function vi(r,e,t,n,o,a,s){var u=p();try{g(r)(e,t,n,o,a,s)}catch(c){if(_(u),c!==c+0)throw c;m(1,0)}}function hi(r,e,t,n,o){var a=p();try{g(r)(e,t,n,o)}catch(s){if(_(a),s!==s+0)throw s;m(1,0)}}function mi(r,e,t,n,o){var a=p();try{g(r)(e,t,n,o)}catch(s){if(_(a),s!==s+0)throw s;m(1,0)}}function pi(r,e,t,n,o,a){var s=p();try{return g(r)(e,t,n,o,a)}catch(u){if(_(s),u!==u+0)throw u;m(1,0)}}function _i(r,e,t,n){var o=p();try{return g(r)(e,t,n)}catch(a){if(_(o),a!==a+0)throw a;m(1,0)}}function wi(r,e,t,n,o,a,s,u,c,d,v,E){var h=p();try{return g(r)(e,t,n,o,a,s,u,c,d,v,E)}catch(w){if(_(h),w!==w+0)throw w;m(1,0)}}function yi(r,e,t,n,o,a,s,u,c,d,v,E,h,w,F,j){var $=p();try{g(r)(e,t,n,o,a,s,u,c,d,v,E,h,w,F,j)}catch(z){if(_($),z!==z+0)throw z;m(1,0)}}function gi(r,e,t,n){var o=p();try{Ae(r,e,t,n)}catch(a){if(_(o),a!==a+0)throw a;m(1,0)}}function Ei(r,e,t,n,o,a,s){var u=p();try{Ce(r,e,t,n,o,a,s)}catch(c){if(_(u),c!==c+0)throw c;m(1,0)}}function ki(r){var e=p();try{return Re(r)}catch(t){if(_(e),t!==t+0)throw t;m(1,0)}}function Si(r,e,t,n,o){var a=p();try{return xe(r,e,t,n,o)}catch(s){if(_(a),s!==s+0)throw s;m(1,0)}}f.addRunDependency=Tr,f.removeRunDependency=Fr,f.FS_createPath=i.createPath,f.FS_createLazyFile=i.createLazyFile,f.FS_createDevice=i.createDevice,f.callMain=Te,f.incrementExceptionRefcount=_n,f.decrementExceptionRefcount=wn,f.getExceptionMessage=pn,f.FS_createPreloadedFile=i.createPreloadedFile,f.FS=i,f.FS_createDataFile=i.createDataFile,f.FS_unlink=i.unlink;var Wr;br=function r(){Wr||Ne(),Wr||(br=r)};function Te(r=[]){var e=be;r.unshift(K);var t=r.length,n=Ar((t+1)*4),o=n;r.forEach(s=>{R[o>>2]=vn(s),o+=4}),R[o>>2]=0;try{var a=e(t,n);return Ee(a,!0),a}catch(s){return dn(s)}}function Ne(r=nr){if(lr>0||(Ve(),lr>0))return;function e(){Wr||(Wr=!0,f.calledRun=!0,!hr&&(Ge(),Ke(),W(f),f.onRuntimeInitialized&&f.onRuntimeInitialized(),Ie&&Te(r),Je()))}f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("")},1),e()},1)):e()}if(f.preInit)for(typeof f.preInit=="function"&&(f.preInit=[f.preInit]);f.preInit.length>0;)f.preInit.pop()();var Ie=!1;return f.noInitialRun&&(Ie=!1),Ne(),A.ready}})(),x=null,yr=!1,Rr=null,$r=null,gr=null,Xr=null,qr=null,Le=new Promise(function(b,A){$r=b,gr=A}),sr={OPTIMAL:"optimal",INFEASIBLE:"infeasible",UNBOUNDED:"unbounded",TIME_LIMIT:"timelimit",UNKNOWN:"unknown",ERROR:"error"};function Oe(b){return b.includes("optimal solution found")?sr.OPTIMAL:b.includes("problem is infeasible")?sr.INFEASIBLE:b.includes("problem is unbounded")?sr.UNBOUNDED:b.includes("time limit reached")?sr.TIME_LIMIT:sr.UNKNOWN}function Ue(b){var A={},f={value:null},W=b.match(/objective value:\s*([\d.e+-]+)/i);W&&(f.value=parseFloat(W[1]));for(var D=/^(\S+)\s+([\d.e+-]+)/gm,O,nr=b.split("solution:")[1]||b;(O=D.exec(nr))!==null;){var K=O[1],X=parseFloat(O[2]);!isNaN(X)&&K!=="objective"&&(A[K]=X)}return{variables:A,objective:f}}function Be(b){var A={solvingTime:null,nodes:null,iterations:null,gap:null},f=b.match(/Solving Time \(sec\)\s*:\s*([\d.]+)/);f&&(A.solvingTime=parseFloat(f[1]));var W=b.match(/Nodes\s*:\s*(\d+)/);W&&(A.nodes=parseInt(W[1]));var D=b.match(/LP Iterations\s*:\s*(\d+)/);D&&(A.iterations=parseInt(D[1]));var O=b.match(/Gap\s*:\s*([\d.]+)\s*%/);return O&&(A.gap=parseFloat(O[1])),A}function Cr(b){return b=b||{},yr?Promise.resolve():Rr||(Rr=new Promise(function(A,f){try{var W=b.wasmPath||Yr+"scip.wasm";ze({locateFile:function(D){return D.endsWith(".wasm")?W:D},print:function(D){x&&x.onStdout&&x.onStdout(D)},printErr:function(D){x&&x.onStderr&&x.onStderr(D)},onAbort:function(D){Xr=D,console.error("[SCIP WASM Abort]",D)},onExit:function(D){qr=D,D!==0&&console.error("[SCIP WASM Exit]",D)}}).then(function(D){if(x=D,x.FS){try{x.FS.mkdir("/problems")}catch{}try{x.FS.mkdir("/solutions")}catch{}try{x.FS.mkdir("/settings")}catch{}}yr=!0,$r&&$r(),A()}).catch(function(D){console.error("[SCIP.js] WASM loading failed:",D),console.error("[SCIP.js] Attempted WASM path:",W),console.error("[SCIP.js] Make sure the WASM file is accessible at this URL."),console.error("[SCIP.js] You can set window.SCIP_BASE_URL before loading this script to specify a custom path.");var O=new Error("SCIP WASM loading failed: "+(D.message||D)+". WASM path: "+W);gr&&gr(O),f(O)})}catch(D){console.error("[SCIP.js] Initialization error:",D),gr&&gr(D),f(D)}}),Rr)}function Vr(b,A){A=A||{};var f=function(){var W=A.format||"lp",D=A.timeLimit||3600,O=A.gap||null,nr=A.verbose||!1,K=A.parameters||{},X=A.initialSolution||null,J="",Z="";x.onStdout=function(I){J+=I+`
|
|
5
|
+
`,nr&&console.log("[SCIP]",I)},x.onStderr=function(I){Z+=I+`
|
|
6
|
+
`,nr&&console.error("[SCIP Error]",I)};try{var ae={mps:"mps",zpl:"zpl",cip:"cip",lp:"lp"},q=ae[W]||"lp",xr="/problems/problem."+q,vr="/solutions/solution.sol";x.FS.writeFile(xr,b);var Y=[];Y.push("set limits time "+D),O!==null&&Y.push("set limits gap "+O);for(var ur in K)if(K.hasOwnProperty(ur)){var Er=ur.replace(/\//g," ");Y.push("set "+Er+" "+K[ur])}if(Y.push("read "+xr),X&&Object.keys(X).length>0){var V=["solution status: unknown"];for(var Q in X)if(X.hasOwnProperty(Q)){var cr=X[Q];cr!==0&&V.push(Q+" "+cr)}var hr="/solutions/initial.sol";x.FS.writeFile(hr,V.join(`
|
|
7
|
+
`)),Y.push("read solution "+hr)}Y.push("optimize"),Y.push("display solution"),Y.push("write solution "+vr),Y.push("display statistics"),Y.push("quit");var mr=Y.join(`
|
|
8
|
+
`);x.FS.writeFile("/settings/commands.txt",mr);var U=x.callMain(["-b","/settings/commands.txt"]),rr=Oe(J),fr=Ue(J),Gr=Be(J),k=null;try{k=x.FS.readFile(vr,{encoding:"utf8"})}catch{}for(var R=["/problems/problem.lp","/problems/problem.mps","/problems/problem.zpl","/problems/problem.cip","/solutions/solution.sol","/settings/commands.txt"],kr=0;kr<R.length;kr++)try{x.FS.unlink(R[kr])}catch{}return{status:rr,objective:fr.objective.value,variables:fr.variables,statistics:Gr,exitCode:U,output:nr?J:void 0,rawSolution:k}}catch(I){var pr=I.message||String(I),ir=null;if(typeof I=="number"||/^\d+$/.test(String(I))){var _r=typeof I=="number"?I:parseInt(String(I),10);if(x)try{if(typeof x.getExceptionMessage=="function")ir=x.getExceptionMessage(_r),pr="WASM Exception: "+ir;else if(typeof x.UTF8ToString=="function")try{var or=x.UTF8ToString(_r);or&&or.length>0&&or.length<1e3&&(ir=or,pr="WASM Exception: "+or)}catch{}}catch(Sr){console.error("[SCIP] Failed to get exception message:",Sr)}ir||(pr="WASM Exception (ptr: "+_r+"). Enable exception handling in build for details.")}return{status:sr.ERROR,error:pr,errorDetails:{rawError:String(I),exceptionInfo:ir,abortReason:Xr,exitCode:qr,type:typeof I,stdout:J,stderr:Z},output:J+Z}}Xr=null,qr=null};return yr?Promise.resolve(f()):Cr(A).then(f)}function He(b,A){return b.toLowerCase().includes("minimize")||(b=`Minimize
|
|
9
|
+
`+b),Vr(b,A)}function We(b,A){return b.toLowerCase().includes("maximize")||(b=`Maximize
|
|
10
|
+
`+b),Vr(b,A)}function Ye(){var b=function(){var A="";return x.onStdout=function(f){A+=f+`
|
|
11
|
+
`},x.callMain(["--version"]),A.trim()};return yr?Promise.resolve(b()):Cr().then(b)}function $e(){return yr}var Xe={init:Cr,ready:Le,isReady:$e,solve:Vr,minimize:He,maximize:We,version:Ye,Status:sr};je.SCIP=Xe,Cr().catch(function(b){console.error("[SCIP.js] Auto-initialization failed:",b.message)})})(typeof self<"u"?self:typeof window<"u"?window:globalThis);
|