@areb0s/scip.js 1.1.13 → 1.2.1

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.
@@ -1,20 +1,20 @@
1
1
  /**
2
2
  * SCIP.js - SCIP Optimization Solver for JavaScript
3
3
  * High-level wrapper around SCIP WASM
4
- *
4
+ *
5
5
  * Supports: LP, MIP, MINLP (Mixed Integer Nonlinear Programming)
6
- *
6
+ *
7
7
  * Usage in Worker (like OpenCV):
8
8
  * // Set base URL before loading script
9
9
  * self.SCIP_BASE_URL = 'https://cdn.jsdelivr.net/gh/user/scip.js@v1.0.0/dist/';
10
- *
10
+ *
11
11
  * // Load and execute script
12
12
  * const response = await fetch(SCIP_BASE_URL + 'scip.min.js');
13
13
  * new Function(await response.text())();
14
- *
14
+ *
15
15
  * // Wait for initialization
16
16
  * await self.SCIP.ready;
17
- *
17
+ *
18
18
  * // Use
19
19
  * const result = await self.SCIP.solve(`...`);
20
20
  */
@@ -38,31 +38,42 @@ export const ready = new Promise((resolve, reject) => {
38
38
  readyReject = reject;
39
39
  });
40
40
 
41
+ // Read version from package.json
42
+ const packageJson = JSON.parse(
43
+ readFileSync(join(rootDir, "package.json"), "utf-8")
44
+ );
45
+ const VERSION = packageJson.version;
46
+
41
47
  /**
42
48
  * Default CDN base URL for WASM files
43
49
  */
44
- const DEFAULT_CDN_BASE = 'https://cdn.jsdelivr.net/npm/@areb0s/scip.js@1.1.6/dist/';
50
+ const DEFAULT_CDN_BASE = `https://cdn.jsdelivr.net/npm/@areb0s/scip.js@${VERSION}/dist/`;
45
51
 
46
52
  /**
47
53
  * Get base URL from global SCIP_BASE_URL or default CDN
48
54
  */
49
55
  function getBaseUrl() {
50
56
  // Safe check for global scope (works in browser, worker, and SSR)
51
- const globalScope = (typeof globalThis !== 'undefined' && globalThis) ||
52
- (typeof self !== 'undefined' && self) ||
53
- (typeof window !== 'undefined' && window) ||
54
- {};
55
-
57
+ const globalScope =
58
+ (typeof globalThis !== "undefined" && globalThis) ||
59
+ (typeof self !== "undefined" && self) ||
60
+ (typeof window !== "undefined" && window) ||
61
+ {};
62
+
56
63
  // Check for explicit SCIP_BASE_URL
57
64
  if (globalScope.SCIP_BASE_URL) {
58
65
  return globalScope.SCIP_BASE_URL;
59
66
  }
60
-
67
+
61
68
  // Check for __importMetaUrl (set by bundler)
62
- if (typeof __importMetaUrl !== 'undefined' && __importMetaUrl && !__importMetaUrl.startsWith('blob:')) {
63
- return __importMetaUrl.substring(0, __importMetaUrl.lastIndexOf('/') + 1);
69
+ if (
70
+ typeof __importMetaUrl !== "undefined" &&
71
+ __importMetaUrl &&
72
+ !__importMetaUrl.startsWith("blob:")
73
+ ) {
74
+ return __importMetaUrl.substring(0, __importMetaUrl.lastIndexOf("/") + 1);
64
75
  }
65
-
76
+
66
77
  // Default to CDN
67
78
  return DEFAULT_CDN_BASE;
68
79
  }
@@ -71,22 +82,22 @@ function getBaseUrl() {
71
82
  * Solution status enum
72
83
  */
73
84
  export const Status = {
74
- OPTIMAL: 'optimal',
75
- INFEASIBLE: 'infeasible',
76
- UNBOUNDED: 'unbounded',
77
- TIME_LIMIT: 'timelimit',
78
- UNKNOWN: 'unknown',
79
- ERROR: 'error'
85
+ OPTIMAL: "optimal",
86
+ INFEASIBLE: "infeasible",
87
+ UNBOUNDED: "unbounded",
88
+ TIME_LIMIT: "timelimit",
89
+ UNKNOWN: "unknown",
90
+ ERROR: "error",
80
91
  };
81
92
 
82
93
  /**
83
94
  * Parse SCIP status from output
84
95
  */
85
96
  function parseStatus(output) {
86
- if (output.includes('optimal solution found')) return Status.OPTIMAL;
87
- if (output.includes('problem is infeasible')) return Status.INFEASIBLE;
88
- if (output.includes('problem is unbounded')) return Status.UNBOUNDED;
89
- if (output.includes('time limit reached')) return Status.TIME_LIMIT;
97
+ if (output.includes("optimal solution found")) return Status.OPTIMAL;
98
+ if (output.includes("problem is infeasible")) return Status.INFEASIBLE;
99
+ if (output.includes("problem is unbounded")) return Status.UNBOUNDED;
100
+ if (output.includes("time limit reached")) return Status.TIME_LIMIT;
90
101
  return Status.UNKNOWN;
91
102
  }
92
103
 
@@ -98,30 +109,30 @@ function parseStatus(output) {
98
109
  function parseSolution(output, rawSolution = null) {
99
110
  const variables = {};
100
111
  const objective = { value: null, sense: null };
101
-
112
+
102
113
  // Use rawSolution if available (more reliable)
103
114
  const solText = rawSolution || output;
104
-
115
+
105
116
  // Parse objective value
106
117
  const objMatch = solText.match(/objective value:\s*([\d.e+-]+)/i);
107
118
  if (objMatch) {
108
119
  objective.value = parseFloat(objMatch[1]);
109
120
  }
110
-
121
+
111
122
  // Parse variable values from solution display
112
123
  // Match ZIMPL-style variable names: x$sun#0, effSum$star#1, b_sun_10, etc.
113
124
  // Format: variableName value (obj:coef)
114
125
  const varRegex = /^([\w$#]+)\s+([\d.e+-]+)/gm;
115
126
  let match;
116
-
127
+
117
128
  while ((match = varRegex.exec(solText)) !== null) {
118
129
  const name = match[1];
119
130
  const value = parseFloat(match[2]);
120
- if (!isNaN(value) && name !== 'objective' && name !== 'solution') {
131
+ if (!isNaN(value) && name !== "objective" && name !== "solution") {
121
132
  variables[name] = value;
122
133
  }
123
134
  }
124
-
135
+
125
136
  return { variables, objective };
126
137
  }
127
138
 
@@ -133,21 +144,21 @@ function parseStatistics(output) {
133
144
  solvingTime: null,
134
145
  nodes: null,
135
146
  iterations: null,
136
- gap: null
147
+ gap: null,
137
148
  };
138
-
149
+
139
150
  const timeMatch = output.match(/Solving Time \(sec\)\s*:\s*([\d.]+)/);
140
151
  if (timeMatch) stats.solvingTime = parseFloat(timeMatch[1]);
141
-
152
+
142
153
  const nodesMatch = output.match(/Nodes\s*:\s*(\d+)/);
143
154
  if (nodesMatch) stats.nodes = parseInt(nodesMatch[1]);
144
-
155
+
145
156
  const iterMatch = output.match(/LP Iterations\s*:\s*(\d+)/);
146
157
  if (iterMatch) stats.iterations = parseInt(iterMatch[1]);
147
-
158
+
148
159
  const gapMatch = output.match(/Gap\s*:\s*([\d.]+)\s*%/);
149
160
  if (gapMatch) stats.gap = parseFloat(gapMatch[1]);
150
-
161
+
151
162
  return stats;
152
163
  }
153
164
 
@@ -164,19 +175,19 @@ export async function init(options = {}) {
164
175
  if (initPromise) {
165
176
  return initPromise;
166
177
  }
167
-
178
+
168
179
  initPromise = (async () => {
169
180
  try {
170
181
  // Auto-detect wasmPath from SCIP_BASE_URL or script location
171
182
  const baseUrl = getBaseUrl();
172
- const wasmPath = options.wasmPath || (baseUrl + 'scip.wasm');
173
-
183
+ const wasmPath = options.wasmPath || baseUrl + "scip.wasm";
184
+
174
185
  // Dynamic import of the Emscripten-generated module
175
- const createSCIP = (await import('./scip-core.js')).default;
176
-
186
+ const createSCIP = (await import("./scip-core.js")).default;
187
+
177
188
  scipModule = await createSCIP({
178
189
  locateFile: (path) => {
179
- if (path.endsWith('.wasm')) {
190
+ if (path.endsWith(".wasm")) {
180
191
  return wasmPath;
181
192
  }
182
193
  return path;
@@ -195,25 +206,37 @@ export async function init(options = {}) {
195
206
  // Capture abort/exit reasons for better error messages
196
207
  onAbort: (reason) => {
197
208
  lastAbortReason = reason;
198
- console.error('[SCIP WASM Abort]', reason);
209
+ console.error("[SCIP WASM Abort]", reason);
199
210
  },
200
211
  onExit: (code) => {
201
212
  lastExitCode = code;
202
213
  if (code !== 0) {
203
- console.error('[SCIP WASM Exit]', code);
214
+ console.error("[SCIP WASM Exit]", code);
204
215
  }
205
- }
216
+ },
206
217
  });
207
-
218
+
208
219
  // Create directories for problems, solutions, settings
209
220
  if (scipModule.FS) {
210
- try { scipModule.FS.mkdir('/problems'); } catch (e) { /* exists */ }
211
- try { scipModule.FS.mkdir('/solutions'); } catch (e) { /* exists */ }
212
- try { scipModule.FS.mkdir('/settings'); } catch (e) { /* exists */ }
221
+ try {
222
+ scipModule.FS.mkdir("/problems");
223
+ } catch (e) {
224
+ /* exists */
225
+ }
226
+ try {
227
+ scipModule.FS.mkdir("/solutions");
228
+ } catch (e) {
229
+ /* exists */
230
+ }
231
+ try {
232
+ scipModule.FS.mkdir("/settings");
233
+ } catch (e) {
234
+ /* exists */
235
+ }
213
236
  }
214
-
237
+
215
238
  isInitialized = true;
216
-
239
+
217
240
  // Resolve ready promise
218
241
  if (readyResolve) {
219
242
  readyResolve();
@@ -225,7 +248,7 @@ export async function init(options = {}) {
225
248
  throw error;
226
249
  }
227
250
  })();
228
-
251
+
229
252
  return initPromise;
230
253
  }
231
254
 
@@ -239,9 +262,9 @@ export function isReady() {
239
262
 
240
263
  /**
241
264
  * Solve an optimization problem
242
- *
265
+ *
243
266
  * Supports LP, MIP, and MINLP (Mixed Integer Nonlinear Programming) problems.
244
- *
267
+ *
245
268
  * @param {string} problem - Problem definition in one of the supported formats
246
269
  * @param {Object} options - Solver options
247
270
  * @param {string} options.format - Input format: 'lp', 'mps', 'zpl', 'cip' (default: 'lp')
@@ -254,7 +277,7 @@ export function isReady() {
254
277
  * @param {boolean} options.verbose - Enable verbose output
255
278
  * @param {Object} options.parameters - Additional SCIP parameters
256
279
  * @returns {Promise<Object>} Solution object
257
- *
280
+ *
258
281
  * @example
259
282
  * // LP format (linear)
260
283
  * const result = await solve(`
@@ -266,7 +289,7 @@ export function isReady() {
266
289
  * 0 <= y <= 10
267
290
  * End
268
291
  * `);
269
- *
292
+ *
270
293
  * @example
271
294
  * // ZIMPL format (MINLP with nonlinear)
272
295
  * const result = await solve(`
@@ -275,7 +298,7 @@ export function isReady() {
275
298
  * minimize cost: x^2 + y^2;
276
299
  * subto c1: x + y >= 1;
277
300
  * `, { format: 'zpl' });
278
- *
301
+ *
279
302
  * console.log(result.status); // 'optimal'
280
303
  * console.log(result.objective); // 1.0
281
304
  * console.log(result.variables); // { x: 1, y: 0 }
@@ -284,82 +307,82 @@ export async function solve(problem, options = {}) {
284
307
  if (!isInitialized) {
285
308
  await init(options);
286
309
  }
287
-
310
+
288
311
  const {
289
- format = 'lp',
312
+ format = "lp",
290
313
  timeLimit = 3600,
291
314
  gap = null,
292
315
  verbose = false,
293
- parameters = {}
316
+ parameters = {},
294
317
  } = options;
295
-
318
+
296
319
  // Capture output
297
- let stdout = '';
298
- let stderr = '';
299
-
320
+ let stdout = "";
321
+ let stderr = "";
322
+
300
323
  scipModule.onStdout = (text) => {
301
- stdout += text + '\n';
302
- if (verbose) console.log('[SCIP]', text);
324
+ stdout += text + "\n";
325
+ if (verbose) console.log("[SCIP]", text);
303
326
  };
304
-
327
+
305
328
  scipModule.onStderr = (text) => {
306
- stderr += text + '\n';
307
- if (verbose) console.error('[SCIP Error]', text);
329
+ stderr += text + "\n";
330
+ if (verbose) console.error("[SCIP Error]", text);
308
331
  };
309
-
332
+
310
333
  try {
311
334
  // Determine file extension based on format
312
- const formatExtMap = { mps: 'mps', zpl: 'zpl', cip: 'cip', lp: 'lp' };
313
- const ext = formatExtMap[format] || 'lp';
335
+ const formatExtMap = { mps: "mps", zpl: "zpl", cip: "cip", lp: "lp" };
336
+ const ext = formatExtMap[format] || "lp";
314
337
  const problemFile = `/problems/problem.${ext}`;
315
- const solutionFile = '/solutions/solution.sol';
316
-
338
+ const solutionFile = "/solutions/solution.sol";
339
+
317
340
  // Write problem to virtual filesystem
318
341
  scipModule.FS.writeFile(problemFile, problem);
319
-
342
+
320
343
  // Build SCIP command
321
344
  const commands = [];
322
-
345
+
323
346
  // Set parameters
324
347
  commands.push(`set limits time ${timeLimit}`);
325
-
348
+
326
349
  if (gap !== null) {
327
350
  commands.push(`set limits gap ${gap}`);
328
351
  }
329
-
352
+
330
353
  // Custom parameters
331
354
  for (const [key, value] of Object.entries(parameters)) {
332
355
  commands.push(`set ${key} ${value}`);
333
356
  }
334
-
357
+
335
358
  // Read and solve
336
359
  commands.push(`read ${problemFile}`);
337
- commands.push('optimize');
338
- commands.push('display solution');
360
+ commands.push("optimize");
361
+ commands.push("display solution");
339
362
  commands.push(`write solution ${solutionFile}`);
340
- commands.push('display statistics');
341
- commands.push('quit');
342
-
363
+ commands.push("display statistics");
364
+ commands.push("quit");
365
+
343
366
  // Write settings file
344
- const settingsContent = commands.join('\n');
345
- scipModule.FS.writeFile('/settings/commands.txt', settingsContent);
346
-
367
+ const settingsContent = commands.join("\n");
368
+ scipModule.FS.writeFile("/settings/commands.txt", settingsContent);
369
+
347
370
  // Run SCIP with batch mode
348
- const exitCode = scipModule.callMain(['-b', '/settings/commands.txt']);
349
-
371
+ const exitCode = scipModule.callMain(["-b", "/settings/commands.txt"]);
372
+
350
373
  // Try to read solution file first (more reliable for parsing)
351
374
  let rawSolution = null;
352
375
  try {
353
- rawSolution = scipModule.FS.readFile(solutionFile, { encoding: 'utf8' });
376
+ rawSolution = scipModule.FS.readFile(solutionFile, { encoding: "utf8" });
354
377
  } catch (e) {
355
378
  // Solution file may not exist if infeasible
356
379
  }
357
-
380
+
358
381
  // Parse results
359
382
  const status = parseStatus(stdout);
360
383
  const { variables, objective } = parseSolution(stdout, rawSolution);
361
384
  const statistics = parseStatistics(stdout);
362
-
385
+
363
386
  return {
364
387
  status,
365
388
  objective: objective.value,
@@ -367,26 +390,26 @@ export async function solve(problem, options = {}) {
367
390
  statistics,
368
391
  exitCode,
369
392
  output: verbose ? stdout : undefined,
370
- rawSolution
393
+ rawSolution,
371
394
  };
372
-
373
395
  } catch (error) {
374
396
  // Attempt to extract detailed exception message from WASM
375
397
  let errorMessage = error.message || String(error);
376
398
  let exceptionInfo = null;
377
-
399
+
378
400
  // Check if this is a WASM exception (pointer address)
379
- if (typeof error === 'number' || /^\d+$/.test(String(error))) {
380
- const ptr = typeof error === 'number' ? error : parseInt(String(error), 10);
381
-
401
+ if (typeof error === "number" || /^\d+$/.test(String(error))) {
402
+ const ptr =
403
+ typeof error === "number" ? error : parseInt(String(error), 10);
404
+
382
405
  // Try to get exception message using Emscripten's exception handling
383
406
  if (scipModule) {
384
407
  try {
385
408
  // Modern Emscripten exception handling
386
- if (typeof scipModule.getExceptionMessage === 'function') {
409
+ if (typeof scipModule.getExceptionMessage === "function") {
387
410
  exceptionInfo = scipModule.getExceptionMessage(ptr);
388
411
  errorMessage = `WASM Exception: ${exceptionInfo}`;
389
- } else if (typeof scipModule.UTF8ToString === 'function') {
412
+ } else if (typeof scipModule.UTF8ToString === "function") {
390
413
  // Fallback: try to read as string from memory
391
414
  try {
392
415
  const str = scipModule.UTF8ToString(ptr);
@@ -394,18 +417,20 @@ export async function solve(problem, options = {}) {
394
417
  exceptionInfo = str;
395
418
  errorMessage = `WASM Exception: ${str}`;
396
419
  }
397
- } catch (e) { /* not a valid string pointer */ }
420
+ } catch (e) {
421
+ /* not a valid string pointer */
422
+ }
398
423
  }
399
424
  } catch (e) {
400
- console.error('[SCIP] Failed to get exception message:', e);
425
+ console.error("[SCIP] Failed to get exception message:", e);
401
426
  }
402
427
  }
403
-
428
+
404
429
  if (!exceptionInfo) {
405
430
  errorMessage = `WASM Exception (ptr: ${ptr}). Enable exception handling in build for details.`;
406
431
  }
407
432
  }
408
-
433
+
409
434
  return {
410
435
  status: Status.ERROR,
411
436
  error: errorMessage,
@@ -416,9 +441,9 @@ export async function solve(problem, options = {}) {
416
441
  exitCode: lastExitCode,
417
442
  type: typeof error,
418
443
  stdout: stdout,
419
- stderr: stderr
444
+ stderr: stderr,
420
445
  },
421
- output: stdout + stderr
446
+ output: stdout + stderr,
422
447
  };
423
448
  } finally {
424
449
  // Reset exception tracking
@@ -426,15 +451,17 @@ export async function solve(problem, options = {}) {
426
451
  lastExitCode = null;
427
452
  // Cleanup all possible problem files
428
453
  const cleanupFiles = [
429
- '/problems/problem.lp',
430
- '/problems/problem.mps',
431
- '/problems/problem.zpl',
432
- '/problems/problem.cip',
433
- '/solutions/solution.sol',
434
- '/settings/commands.txt'
454
+ "/problems/problem.lp",
455
+ "/problems/problem.mps",
456
+ "/problems/problem.zpl",
457
+ "/problems/problem.cip",
458
+ "/solutions/solution.sol",
459
+ "/settings/commands.txt",
435
460
  ];
436
461
  for (const file of cleanupFiles) {
437
- try { scipModule.FS.unlink(file); } catch (e) {}
462
+ try {
463
+ scipModule.FS.unlink(file);
464
+ } catch (e) {}
438
465
  }
439
466
  }
440
467
  }
@@ -445,8 +472,8 @@ export async function solve(problem, options = {}) {
445
472
  */
446
473
  export async function minimize(problem, options = {}) {
447
474
  // LP format uses "Minimize" keyword, ensure it's present
448
- if (!problem.toLowerCase().includes('minimize')) {
449
- problem = 'Minimize\n' + problem;
475
+ if (!problem.toLowerCase().includes("minimize")) {
476
+ problem = "Minimize\n" + problem;
450
477
  }
451
478
  return solve(problem, options);
452
479
  }
@@ -457,8 +484,8 @@ export async function minimize(problem, options = {}) {
457
484
  */
458
485
  export async function maximize(problem, options = {}) {
459
486
  // LP format uses "Maximize" keyword
460
- if (!problem.toLowerCase().includes('maximize')) {
461
- problem = 'Maximize\n' + problem;
487
+ if (!problem.toLowerCase().includes("maximize")) {
488
+ problem = "Maximize\n" + problem;
462
489
  }
463
490
  return solve(problem, options);
464
491
  }
@@ -470,12 +497,14 @@ export async function version() {
470
497
  if (!isInitialized) {
471
498
  await init();
472
499
  }
473
-
474
- let output = '';
475
- scipModule.onStdout = (text) => { output += text + '\n'; };
476
-
477
- scipModule.callMain(['--version']);
478
-
500
+
501
+ let output = "";
502
+ scipModule.onStdout = (text) => {
503
+ output += text + "\n";
504
+ };
505
+
506
+ scipModule.callMain(["--version"]);
507
+
479
508
  return output.trim();
480
509
  }
481
510
 
@@ -486,13 +515,15 @@ export async function getParameters() {
486
515
  if (!isInitialized) {
487
516
  await init();
488
517
  }
489
-
490
- let output = '';
491
- scipModule.onStdout = (text) => { output += text + '\n'; };
492
-
493
- scipModule.FS.writeFile('/settings/params.txt', 'set\nquit\n');
494
- scipModule.callMain(['-b', '/settings/params.txt']);
495
-
518
+
519
+ let output = "";
520
+ scipModule.onStdout = (text) => {
521
+ output += text + "\n";
522
+ };
523
+
524
+ scipModule.FS.writeFile("/settings/params.txt", "set\nquit\n");
525
+ scipModule.callMain(["-b", "/settings/params.txt"]);
526
+
496
527
  return output;
497
528
  }
498
529
 
@@ -506,5 +537,5 @@ export default {
506
537
  maximize,
507
538
  version,
508
539
  getParameters,
509
- Status
540
+ Status,
510
541
  };
package/dist/scip.js CHANGED
@@ -18,7 +18,7 @@
18
18
  return src.substring(0, src.lastIndexOf('/') + 1);
19
19
  }
20
20
  // Default CDN (npm)
21
- return 'https://cdn.jsdelivr.net/npm/@areb0s/scip.js@1.1.6/dist/';
21
+ return 'https://cdn.jsdelivr.net/npm/@areb0s/scip.js@1.2.1/dist/';
22
22
  })();
23
23
 
24
24
  // Inline the transformed scip-core.js (createSCIP factory function)
@@ -126,22 +126,10 @@ var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;Module["ready"]=
126
126
  initPromise = new Promise(function(resolve, reject) {
127
127
  try {
128
128
  var wasmPath = options.wasmPath || (__SCIP_SCRIPT_DIR__ + 'scip.wasm');
129
- console.log('[SCIP.js] __SCIP_SCRIPT_DIR__:', __SCIP_SCRIPT_DIR__);
130
- console.log('[SCIP.js] Loading WASM from:', wasmPath);
131
-
132
- // Verify WASM is accessible
133
- fetch(wasmPath, { method: 'HEAD' })
134
- .then(function(res) {
135
- console.log('[SCIP.js] WASM file check:', res.ok ? 'OK' : 'FAILED', res.status);
136
- })
137
- .catch(function(err) {
138
- console.error('[SCIP.js] WASM file check failed:', err);
139
- });
140
129
 
141
130
  createSCIP({
142
131
  locateFile: function(path) {
143
132
  if (path.endsWith('.wasm')) {
144
- console.log('[SCIP.js] locateFile called for:', path, '-> returning:', wasmPath);
145
133
  return wasmPath;
146
134
  }
147
135
  return path;
package/dist/scip.min.js CHANGED
@@ -1,10 +1,10 @@
1
- (function(Ie){"use strict";var br=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 F=document.currentScript.src;return F.substring(0,F.lastIndexOf("/")+1)}return"https://cdn.jsdelivr.net/npm/@areb0s/scip.js@1.1.6/dist/"}(),Ne=(()=>{var F=br;return function(R={}){var f=R,H,M;f.ready=new Promise((r,e)=>{H=r,M=e});var U=Object.assign({},f),rr=[],G="./this.program",W=(r,e)=>{throw e},ur=typeof window=="object",ir=typeof importScripts=="function",re=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",X="";function Mr(r){return f.locateFile?f.locateFile(r,X):X+r}var Y,cr,mr;(ur||ir)&&(ir?X=self.location.href:typeof document<"u"&&document.currentScript&&(X=document.currentScript.src),F&&(X=F),X.startsWith("blob:")?X="":X=X.substr(0,X.replace(/[?#].*/,"").lastIndexOf("/")+1),Y=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},ir&&(mr=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),cr=(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 _r=f.print||console.log.bind(console),K=f.printErr||console.error.bind(console);Object.assign(f,U),U=null,f.arguments&&(rr=f.arguments),f.thisProgram&&(G=f.thisProgram),f.quit&&(W=f.quit);var er;f.wasmBinary&&(er=f.wasmBinary);var fr,lr=!1,or,N,q,J,pr,k,S,Dr,$e;function ee(){var r=fr.buffer;f.HEAP8=N=new Int8Array(r),f.HEAP16=J=new Int16Array(r),f.HEAPU8=q=new Uint8Array(r),f.HEAPU16=pr=new Uint16Array(r),f.HEAP32=k=new Int32Array(r),f.HEAPU32=S=new Uint32Array(r),f.HEAPF32=Dr=new Float32Array(r),f.HEAPF64=$e=new Float64Array(r)}var te=[],ne=[],Xe=[],ie=[],qe=!1;function Ve(){if(f.preRun)for(typeof f.preRun=="function"&&(f.preRun=[f.preRun]);f.preRun.length;)Ze(f.preRun.shift());Cr(te)}function Ge(){qe=!0,!f.noFSInit&&!i.init.initialized&&i.init(),i.ignorePermissions=!1,tr.init(),Cr(ne)}function Ke(){Cr(Xe)}function Je(){if(f.postRun)for(typeof f.postRun=="function"&&(f.postRun=[f.postRun]);f.postRun.length;)rt(f.postRun.shift());Cr(ie)}function Ze(r){te.unshift(r)}function Qe(r){ne.unshift(r)}function rt(r){ie.unshift(r)}var ar=0,Yr=null,wr=null;function bi(r){return r}function Ar(r){ar++,f.monitorRunDependencies?.(ar)}function yr(r){if(ar--,f.monitorRunDependencies?.(ar),ar==0&&(Yr!==null&&(clearInterval(Yr),Yr=null),wr)){var e=wr;wr=null,e()}}function Rr(r){f.onAbort?.(r),r="Aborted("+r+")",K(r),lr=!0,or=1,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw M(e),e}var et="data:application/octet-stream;base64,",oe=r=>r.startsWith(et),sr;f.locateFile?(sr="scip.wasm",oe(sr)||(sr=Mr(sr))):sr=new URL("scip.wasm",br).href;function ae(r){if(r==sr&&er)return new Uint8Array(er);if(mr)return mr(r);throw"both async and sync fetching of the wasm failed"}function tt(r){return!er&&(ur||ir)&&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(()=>ae(r)):Promise.resolve().then(()=>ae(r))}function se(r,e,t){return tt(r).then(n=>WebAssembly.instantiate(n,e)).then(t,n=>{K(`failed to asynchronously prepare wasm: ${n}`),Rr(n)})}function nt(r,e,t,n){return!r&&typeof WebAssembly.instantiateStreaming=="function"&&!oe(e)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(o=>{var a=WebAssembly.instantiateStreaming(o,t);return a.then(n,function(s){return K(`wasm streaming compile failed: ${s}`),K("falling back to ArrayBuffer instantiation"),se(e,t,n)})}):se(e,t,n)}function it(){var r={a:yn};function e(n,o){return I=n.exports,fr=I.Ra,ee(),fe=I.Ua,Qe(I.Sa),yr("wasm-instantiate"),I}Ar("wasm-instantiate");function t(n){e(n.instance)}if(f.instantiateWasm)try{return f.instantiateWasm(r,e)}catch(n){K(`Module.instantiateWasm callback failed with error: ${n}`),M(n)}return nt(er,sr,r,t).catch(M),{}}var A,O;function ue(r){this.name="ExitStatus",this.message=`Program terminated with exit(${r})`,this.status=r}var Cr=r=>{for(;r.length>0;)r.shift()(f)},ce=f.noExitRuntime||!0,xr=[],fe,g=r=>{var e=xr[r];return e||(r>=xr.length&&(xr.length=r+1),xr[r]=e=fe.get(r)),e},ot=(r,e)=>g(r)(e),Tr=[],Ir=0,at=r=>{var e=new $r(r);return e.get_caught()||(e.set_caught(!0),Ir--),e.set_rethrown(!1),Tr.push(e),Qr(e.excPtr),e.get_exception_ptr()},Z=0,st=()=>{m(0,0);var r=Tr.pop();Zr(r.excPtr),Z=0};class $r{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){S[this.ptr+4>>2]=e}get_type(){return S[this.ptr+4>>2]}set_destructor(e){S[this.ptr+8>>2]=e}get_destructor(){return S[this.ptr+8>>2]}set_caught(e){e=e?1:0,N[this.ptr+12]=e}get_caught(){return N[this.ptr+12]!=0}set_rethrown(e){e=e?1:0,N[this.ptr+13]=e}get_rethrown(){return N[this.ptr+13]!=0}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){S[this.ptr+16>>2]=e}get_adjusted_ptr(){return S[this.ptr+16>>2]}get_exception_ptr(){var e=Pe(this.get_type());if(e)return S[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var ut=r=>{throw Z||(Z=r),Z},Nr=r=>{var e=Z;if(!e)return kr(0),0;var t=new $r(e);t.set_adjusted_ptr(e);var n=t.get_type();if(!n)return kr(0),e;for(var o in r){var a=r[o];if(a===0||a===n)break;var s=t.ptr+16;if(Fe(a,n,s))return kr(a),e}return kr(n),e},ct=()=>Nr([]),ft=r=>Nr([r]),lt=(r,e)=>Nr([r,e]),dt=(r,e,t,n,o)=>Nr([r,e,t,n,o]),vt=()=>{var r=Tr.pop();r||Rr("no exception to throw");var e=r.excPtr;throw r.get_rethrown()||(Tr.push(r),r.set_rethrown(!0),r.set_caught(!1),Ir++),Z=e,Z},ht=(r,e,t)=>{var n=new $r(r);throw n.init(e,t),Z=r,Ir++,Z},mt=()=>Ir,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)},_t=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return r=>crypto.getRandomValues(r);Rr("initRandomDevice")},le=r=>(le=_t())(r),Q={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=Q.resolve(r).substr(1),e=Q.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("/")}},de=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,dr=(r,e,t)=>{for(var n=e+t,o=e;r[o]&&!(o>=n);)++o;if(o-e>16&&r.buffer&&de)return de.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},Xr=[],jr=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 Lr(r,e,t){var n=t>0?t:jr(r)+1,o=new Array(n),a=qr(r,o,0,o.length);return e&&(o.length=a),o}var pt=()=>{if(!Xr.length){var r=null;if(typeof window<"u"&&typeof window.prompt=="function"?(r=window.prompt("Input: "),r!==null&&(r+=`
1
+ (function(Ne){"use strict";var Ur=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 F=document.currentScript.src;return F.substring(0,F.lastIndexOf("/")+1)}return"https://cdn.jsdelivr.net/npm/@areb0s/scip.js@1.2.1/dist/"}(),Ie=(()=>{var F=Ur;return function(R={}){var f=R,H,A;f.ready=new Promise((r,e)=>{H=r,A=e});var U=Object.assign({},f),rr=[],G="./this.program",W=(r,e)=>{throw e},ur=typeof window=="object",ir=typeof importScripts=="function",re=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",X="";function Pr(r){return f.locateFile?f.locateFile(r,X):X+r}var Y,cr,mr;(ur||ir)&&(ir?X=self.location.href:typeof document<"u"&&document.currentScript&&(X=document.currentScript.src),F&&(X=F),X.startsWith("blob:")?X="":X=X.substr(0,X.replace(/[?#].*/,"").lastIndexOf("/")+1),Y=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},ir&&(mr=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),cr=(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 _r=f.print||console.log.bind(console),K=f.printErr||console.error.bind(console);Object.assign(f,U),U=null,f.arguments&&(rr=f.arguments),f.thisProgram&&(G=f.thisProgram),f.quit&&(W=f.quit);var er;f.wasmBinary&&(er=f.wasmBinary);var fr,lr=!1,or,I,q,J,pr,k,S,Mr,$e;function ee(){var r=fr.buffer;f.HEAP8=I=new Int8Array(r),f.HEAP16=J=new Int16Array(r),f.HEAPU8=q=new Uint8Array(r),f.HEAPU16=pr=new Uint16Array(r),f.HEAP32=k=new Int32Array(r),f.HEAPU32=S=new Uint32Array(r),f.HEAPF32=Mr=new Float32Array(r),f.HEAPF64=$e=new Float64Array(r)}var te=[],ne=[],Xe=[],ie=[],qe=!1;function Ve(){if(f.preRun)for(typeof f.preRun=="function"&&(f.preRun=[f.preRun]);f.preRun.length;)Ze(f.preRun.shift());Rr(te)}function Ge(){qe=!0,!f.noFSInit&&!i.init.initialized&&i.init(),i.ignorePermissions=!1,tr.init(),Rr(ne)}function Ke(){Rr(Xe)}function Je(){if(f.postRun)for(typeof f.postRun=="function"&&(f.postRun=[f.postRun]);f.postRun.length;)rt(f.postRun.shift());Rr(ie)}function Ze(r){te.unshift(r)}function Qe(r){ne.unshift(r)}function rt(r){ie.unshift(r)}var ar=0,Yr=null,wr=null;function bi(r){return r}function Dr(r){ar++,f.monitorRunDependencies?.(ar)}function yr(r){if(ar--,f.monitorRunDependencies?.(ar),ar==0&&(Yr!==null&&(clearInterval(Yr),Yr=null),wr)){var e=wr;wr=null,e()}}function Ar(r){f.onAbort?.(r),r="Aborted("+r+")",K(r),lr=!0,or=1,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw A(e),e}var et="data:application/octet-stream;base64,",oe=r=>r.startsWith(et),sr;f.locateFile?(sr="scip.wasm",oe(sr)||(sr=Pr(sr))):sr=new URL("scip.wasm",Ur).href;function ae(r){if(r==sr&&er)return new Uint8Array(er);if(mr)return mr(r);throw"both async and sync fetching of the wasm failed"}function tt(r){return!er&&(ur||ir)&&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(()=>ae(r)):Promise.resolve().then(()=>ae(r))}function se(r,e,t){return tt(r).then(n=>WebAssembly.instantiate(n,e)).then(t,n=>{K(`failed to asynchronously prepare wasm: ${n}`),Ar(n)})}function nt(r,e,t,n){return!r&&typeof WebAssembly.instantiateStreaming=="function"&&!oe(e)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(o=>{var a=WebAssembly.instantiateStreaming(o,t);return a.then(n,function(s){return K(`wasm streaming compile failed: ${s}`),K("falling back to ArrayBuffer instantiation"),se(e,t,n)})}):se(e,t,n)}function it(){var r={a:yn};function e(n,o){return N=n.exports,fr=N.Ra,ee(),fe=N.Ua,Qe(N.Sa),yr("wasm-instantiate"),N}Dr("wasm-instantiate");function t(n){e(n.instance)}if(f.instantiateWasm)try{return f.instantiateWasm(r,e)}catch(n){K(`Module.instantiateWasm callback failed with error: ${n}`),A(n)}return nt(er,sr,r,t).catch(A),{}}var D,O;function ue(r){this.name="ExitStatus",this.message=`Program terminated with exit(${r})`,this.status=r}var Rr=r=>{for(;r.length>0;)r.shift()(f)},ce=f.noExitRuntime||!0,Cr=[],fe,g=r=>{var e=Cr[r];return e||(r>=Cr.length&&(Cr.length=r+1),Cr[r]=e=fe.get(r)),e},ot=(r,e)=>g(r)(e),xr=[],Tr=0,at=r=>{var e=new $r(r);return e.get_caught()||(e.set_caught(!0),Tr--),e.set_rethrown(!1),xr.push(e),Qr(e.excPtr),e.get_exception_ptr()},Z=0,st=()=>{m(0,0);var r=xr.pop();Zr(r.excPtr),Z=0};class $r{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){S[this.ptr+4>>2]=e}get_type(){return S[this.ptr+4>>2]}set_destructor(e){S[this.ptr+8>>2]=e}get_destructor(){return S[this.ptr+8>>2]}set_caught(e){e=e?1:0,I[this.ptr+12]=e}get_caught(){return I[this.ptr+12]!=0}set_rethrown(e){e=e?1:0,I[this.ptr+13]=e}get_rethrown(){return I[this.ptr+13]!=0}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){S[this.ptr+16>>2]=e}get_adjusted_ptr(){return S[this.ptr+16>>2]}get_exception_ptr(){var e=Pe(this.get_type());if(e)return S[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var ut=r=>{throw Z||(Z=r),Z},Nr=r=>{var e=Z;if(!e)return kr(0),0;var t=new $r(e);t.set_adjusted_ptr(e);var n=t.get_type();if(!n)return kr(0),e;for(var o in r){var a=r[o];if(a===0||a===n)break;var s=t.ptr+16;if(Fe(a,n,s))return kr(a),e}return kr(n),e},ct=()=>Nr([]),ft=r=>Nr([r]),lt=(r,e)=>Nr([r,e]),dt=(r,e,t,n,o)=>Nr([r,e,t,n,o]),vt=()=>{var r=xr.pop();r||Ar("no exception to throw");var e=r.excPtr;throw r.get_rethrown()||(xr.push(r),r.set_rethrown(!0),r.set_caught(!1),Tr++),Z=e,Z},ht=(r,e,t)=>{var n=new $r(r);throw n.init(e,t),Z=r,Tr++,Z},mt=()=>Tr,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)},_t=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return r=>crypto.getRandomValues(r);Ar("initRandomDevice")},le=r=>(le=_t())(r),Q={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=Q.resolve(r).substr(1),e=Q.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("/")}},de=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,dr=(r,e,t)=>{for(var n=e+t,o=e;r[o]&&!(o>=n);)++o;if(o-e>16&&r.buffer&&de)return de.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},Xr=[],Ir=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 jr(r,e,t){var n=t>0?t:Ir(r)+1,o=new Array(n),a=qr(r,o,0,o.length);return e&&(o.length=a),o}var pt=()=>{if(!Xr.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=Lr(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===N.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===N.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);N.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&&Ar(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)}Ar(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(jr(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=Lr(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",L=(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 z=new XMLHttpRequest;if(z.open("GET",t,!1),P!==l&&z.setRequestHeader("Range","bytes="+T+"-"+V),z.responseType="arraybuffer",z.overrideMimeType&&z.overrideMimeType("text/plain; charset=x-user-defined"),z.send(null),!(z.status>=200&&z.status<300||z.status===304))throw new Error("Couldn't load "+t+". Status: "+z.status);return z.response!==void 0?new Uint8Array(z.response||[]):Lr(z.responseText||"",!0)},B=this;B.setDataGetter(T=>{var V=T*l,z=(T+1)*l-1;if(z=Math.min(z,P-1),typeof B.chunks[T]>"u"&&(B.chunks[T]=y(V,z)),typeof B.chunks[T]>"u")throw new Error("doXHR failed!");return B.chunks[T]}),(L||!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 L=h.node.contents;if($>=L.length)return 0;var l=Math.min(L.length-$,j);if(L.slice)for(var y=0;y<l;y++)w[P+y]=L[$+y];else for(var y=0;y<l;y++)w[P+y]=L.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 L=ve(w);if(!L)throw new i.ErrnoError(48);return E(h,N,L,w,P),{ptr:L,allocated:!0}},c.stream_ops=d,c}},gr=(r,e)=>r?dr(q,r,e):"",D={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(C.isAbs(e))return e;var n;if(r===-100)n=i.cwd();else{var o=D.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,(A=n.size,+Math.abs(A)>=1?A>0?+Math.floor(A/4294967296)>>>0:~~+Math.ceil((A-+(~~A>>>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,(A=Math.floor(o/1e3),+Math.abs(A)>=1?A>0?+Math.floor(A/4294967296)>>>0:~~+Math.ceil((A-+(~~A>>>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,(A=Math.floor(a/1e3),+Math.abs(A)>=1?A>0?+Math.floor(A/4294967296)>>>0:~~+Math.ceil((A-+(~~A>>>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,(A=Math.floor(s/1e3),+Math.abs(A)>=1?A>0?+Math.floor(A/4294967296)>>>0:~~+Math.ceil((A-+(~~A>>>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,(A=n.ino,+Math.abs(A)>=1?A>0?+Math.floor(A/4294967296)>>>0:~~+Math.ceil((A-+(~~A>>>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[+D.varargs>>2];return D.varargs+=4,r},getp(){return D.get()},getStr(r){var e=gr(r);return e},getStreamFromFD(r){var e=i.getStreamChecked(r);return e}};function Pt(r){try{return r=D.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=D.getStr(e),e=D.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){D.varargs=t;try{var n=D.getStreamFromFD(r);switch(e){case 0:{var o=D.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=D.get();return n.flags|=o,0}case 12:{var o=D.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=D.getStreamFromFD(r);return D.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=jr(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){D.varargs=t;try{var n=D.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=D.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++)N[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=D.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(N[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=D.getp();return k[a>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var a=D.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=D.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=D.getStr(e);var o=n&256,a=n&4096;return n=n&-6401,e=D.calculateAt(r,e,a),D.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){D.varargs=n;try{e=D.getStr(e),e=D.calculateAt(r,e);var o=n?D.get():0;return i.open(e,t,o).fd}catch(a){if(typeof i>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function It(r,e){try{return r=D.getStr(r),D.doStat(i.stat,r,e)}catch(t){if(typeof i>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var Nt=1,jt=()=>Nt,Lt=()=>{ce=!1,pe=0},zt=()=>{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=D.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=D.getStreamFromFD(o);t&2&&D.doMsync(r,c,e,n,u)}catch(d){if(typeof i>"u"||d.name!=="ErrnoError")throw d;return-d.errno}}var Bt=()=>{Rr("")},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)N[e++]=r.charCodeAt(t);N[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=D.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,N,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=D.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=D.getStreamFromFD(r);return i.llseek(s,a,n),O=[s.position>>>0,(A=s.position,+Math.abs(A)>=1?A>0?+Math.floor(A/4294967296)>>>0:~~+Math.ceil((A-+(~~A>>>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,N,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=D.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)=>{N.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),z=P(T);return w(V,y)<=0?w(z,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 L=Lr(s,!1);return L.length>e?0:(cn(L,r),L.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=jr(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:It,ua:jt,ma:Lt,ha:zt,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:zn,U:_i,Ma:$n,Da:ci,N:ii,w:Mn,Z:ai,Fa:oi,Ka:qn,A:Nn,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:In,H:Bn,F:Ln,I:yi,da:Ei,ea:gi,m:an,la:we,fa:ln},I=it(),gn=()=>(gn=I.Sa)(),ke=f._main=(r,e)=>(ke=f._main=I.Ta)(r,e),Jr=r=>(Jr=I.Va)(r),En=r=>(En=I.__cxa_free_exception)(r),kr=r=>(kr=I.Wa)(r),Se=(r,e)=>(Se=I.Xa)(r,e),m=(r,e)=>(m=I.Ya)(r,e),_=()=>(_=I.Za)(),p=r=>(p=I._a)(r),Sr=r=>(Sr=I.$a)(r),Zr=r=>(Zr=I.ab)(r),Qr=r=>(Qr=I.bb)(r),be=(r,e,t)=>(be=I.cb)(r,e,t),Fe=(r,e,t)=>(Fe=I.db)(r,e,t),Pe=r=>(Pe=I.eb)(r),Me=f.dynCall_vij=(r,e,t,n)=>(Me=f.dynCall_vij=I.fb)(r,e,t,n),De=f.dynCall_j=r=>(De=f.dynCall_j=I.gb)(r),Ae=f.dynCall_viijii=(r,e,t,n,o,a,s)=>(Ae=f.dynCall_viijii=I.hb)(r,e,t,n,o,a,s),Re=f.dynCall_jiiii=(r,e,t,n,o)=>(Re=f.dynCall_jiiii=I.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 In(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 Nn(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 Ln(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 zn(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(L){if(p($),L!==L+0)throw L;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=Ar,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 Ur;wr=function r(){Ur||xe(),Ur||(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(){Ur||(Ur=!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,Fr=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 Le(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 ze(F){var R={},f={value:null},H=F.match(/objective value:\s*([\d.e+-]+)/i);H&&(f.value=parseFloat(H[1]));for(var M=/^(\w+)\s+([\d.e+-]+)/gm,U,rr=F.split("solution:")[1]||F;(U=M.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 M=F.match(/LP Iterations\s*:\s*(\d+)/);M&&(R.iterations=parseInt(M[1]));var U=F.match(/Gap\s*:\s*([\d.]+)\s*%/);return U&&(R.gap=parseFloat(U[1])),R}function Pr(F){return F=F||{},vr?Promise.resolve():Fr||(Fr=new Promise(function(R,f){try{var H=F.wasmPath||br+"scip.wasm";console.log("[SCIP.js] __SCIP_SCRIPT_DIR__:",br),console.log("[SCIP.js] Loading WASM from:",H),fetch(H,{method:"HEAD"}).then(function(M){console.log("[SCIP.js] WASM file check:",M.ok?"OK":"FAILED",M.status)}).catch(function(M){console.error("[SCIP.js] WASM file check failed:",M)}),Ne({locateFile:function(M){return M.endsWith(".wasm")?(console.log("[SCIP.js] locateFile called for:",M,"-> returning:",H),H):M},print:function(M){x&&x.onStdout&&x.onStdout(M)},printErr:function(M){x&&x.onStderr&&x.onStderr(M)},onAbort:function(M){Br=M,console.error("[SCIP WASM Abort]",M)},onExit:function(M){Hr=M,M!==0&&console.error("[SCIP WASM Exit]",M)}}).then(function(M){if(console.log("[SCIP.js] WASM loaded successfully"),x=M,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(M){console.error("[SCIP.js] WASM loading failed:",M),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: "+(M.message||M)+". WASM path: "+H);hr&&hr(U),f(U)})}catch(M){console.error("[SCIP.js] Initialization error:",M),hr&&hr(M),f(M)}}),Fr)}function Wr(F,R){R=R||{};var f=function(){var H=R.format||"lp",M=R.timeLimit||3600,U=R.gap||null,rr=R.verbose||!1,G=R.parameters||{},W="",ur="";x.onStdout=function(S){W+=S+`
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=/^(\w+)\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(console.log("[SCIP.js] WASM loaded successfully"),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
5
  `,rr&&console.log("[SCIP]",S)},x.onStderr=function(S){ur+=S+`
6
- `,rr&&console.error("[SCIP Error]",S)};try{var ir={mps:"mps",zpl:"zpl",cip:"cip",lp:"lp"},re=ir[H]||"lp",X="/problems/problem."+re,Mr="/solutions/solution.sol";x.FS.writeFile(X,F);var Y=[];Y.push("set limits time "+M),U!==null&&Y.push("set limits gap "+U);for(var cr in G)G.hasOwnProperty(cr)&&Y.push("set "+cr+" "+G[cr]);Y.push("read "+X),Y.push("optimize"),Y.push("display solution"),Y.push("write solution "+Mr),Y.push("display statistics"),Y.push("quit");var mr=Y.join(`
7
- `);x.FS.writeFile("/settings/commands.txt",mr);var _r=x.callMain(["-b","/settings/commands.txt"]),K=Le(W),er=ze(W),fr=Ue(W),lr=null;try{lr=x.FS.readFile(Mr,{encoding:"utf8"})}catch{}for(var or=["/problems/problem.lp","/problems/problem.mps","/problems/problem.zpl","/problems/problem.cip","/solutions/solution.sol","/settings/commands.txt"],N=0;N<or.length;N++)try{x.FS.unlink(or[N])}catch{}return{status:K,objective:er.objective.value,variables:er.variables,statistics:fr,exitCode:_r,output:rr?W:void 0,rawSolution:lr}}catch(S){var q=S.message||String(S),J=null;if(typeof S=="number"||/^\d+$/.test(String(S))){var pr=typeof S=="number"?S:parseInt(String(S),10);if(x)try{if(typeof x.getExceptionMessage=="function")J=x.getExceptionMessage(pr),q="WASM Exception: "+J;else if(typeof x.UTF8ToString=="function")try{var k=x.UTF8ToString(pr);k&&k.length>0&&k.length<1e3&&(J=k,q="WASM Exception: "+k)}catch{}}catch(Dr){console.error("[SCIP] Failed to get exception message:",Dr)}J||(q="WASM Exception (ptr: "+pr+"). Enable exception handling in build for details.")}return{status:nr.ERROR,error:q,errorDetails:{rawError:String(S),exceptionInfo:J,abortReason:Br,exitCode:Hr,type:typeof S,stdout:W,stderr:ur},output:W+ur}}Br=null,Hr=null};return vr?Promise.resolve(f()):Pr(R).then(f)}function Oe(F,R){return F.toLowerCase().includes("minimize")||(F=`Minimize
6
+ `,rr&&console.error("[SCIP Error]",S)};try{var ir={mps:"mps",zpl:"zpl",cip:"cip",lp:"lp"},re=ir[H]||"lp",X="/problems/problem."+re,Pr="/solutions/solution.sol";x.FS.writeFile(X,F);var Y=[];Y.push("set limits time "+A),U!==null&&Y.push("set limits gap "+U);for(var cr in G)G.hasOwnProperty(cr)&&Y.push("set "+cr+" "+G[cr]);Y.push("read "+X),Y.push("optimize"),Y.push("display solution"),Y.push("write solution "+Pr),Y.push("display statistics"),Y.push("quit");var mr=Y.join(`
7
+ `);x.FS.writeFile("/settings/commands.txt",mr);var _r=x.callMain(["-b","/settings/commands.txt"]),K=ze(W),er=Le(W),fr=Ue(W),lr=null;try{lr=x.FS.readFile(Pr,{encoding:"utf8"})}catch{}for(var or=["/problems/problem.lp","/problems/problem.mps","/problems/problem.zpl","/problems/problem.cip","/solutions/solution.sol","/settings/commands.txt"],I=0;I<or.length;I++)try{x.FS.unlink(or[I])}catch{}return{status:K,objective:er.objective.value,variables:er.variables,statistics:fr,exitCode:_r,output:rr?W:void 0,rawSolution:lr}}catch(S){var q=S.message||String(S),J=null;if(typeof S=="number"||/^\d+$/.test(String(S))){var pr=typeof S=="number"?S:parseInt(String(S),10);if(x)try{if(typeof x.getExceptionMessage=="function")J=x.getExceptionMessage(pr),q="WASM Exception: "+J;else if(typeof x.UTF8ToString=="function")try{var k=x.UTF8ToString(pr);k&&k.length>0&&k.length<1e3&&(J=k,q="WASM Exception: "+k)}catch{}}catch(Mr){console.error("[SCIP] Failed to get exception message:",Mr)}J||(q="WASM Exception (ptr: "+pr+"). Enable exception handling in build for details.")}return{status:nr.ERROR,error:q,errorDetails:{rawError:String(S),exceptionInfo:J,abortReason:Br,exitCode:Hr,type:typeof S,stdout:W,stderr:ur},output:W+ur}}Br=null,Hr=null};return vr?Promise.resolve(f()):Fr(R).then(f)}function Oe(F,R){return F.toLowerCase().includes("minimize")||(F=`Minimize
8
8
  `+F),Wr(F,R)}function Be(F,R){return F.toLowerCase().includes("maximize")||(F=`Maximize
9
9
  `+F),Wr(F,R)}function He(){var F=function(){var R="";return x.onStdout=function(f){R+=f+`
10
- `},x.callMain(["--version"]),R.trim()};return vr?Promise.resolve(F()):Pr().then(F)}function We(){return vr}var Ye={init:Pr,ready:je,isReady:We,solve:Wr,minimize:Oe,maximize:Be,version:He,Status:nr};Ie.SCIP=Ye,Pr().catch(function(F){console.error("[SCIP.js] Auto-initialization failed:",F.message)})})(typeof self<"u"?self:typeof window<"u"?window:globalThis);
10
+ `},x.callMain(["--version"]),R.trim()};return vr?Promise.resolve(F()):Fr().then(F)}function We(){return vr}var Ye={init:Fr,ready:je,isReady:We,solve:Wr,minimize:Oe,maximize:Be,version:He,Status:nr};Ne.SCIP=Ye,Fr().catch(function(F){console.error("[SCIP.js] Auto-initialization failed:",F.message)})})(typeof self<"u"?self:typeof window<"u"?window:globalThis);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@areb0s/scip.js",
3
- "version": "1.1.13",
3
+ "version": "1.2.1",
4
4
  "description": "SCIP Optimization Solver compiled to WebAssembly - LP, MIP, and MINLP support",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",