@componentor/quickjs-wasmfile-debug-asyncify 0.31.0

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.
@@ -0,0 +1,2412 @@
1
+
2
+ var QuickJSRaw = (() => {
3
+ var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
4
+
5
+ return (
6
+ function(moduleArg = {}) {
7
+ var moduleRtn;
8
+
9
+ // include: shell.js
10
+ // The Module object: Our interface to the outside world. We import
11
+ // and export values on it. There are various ways Module can be used:
12
+ // 1. Not defined. We create it here
13
+ // 2. A function parameter, function(moduleArg) => Promise<Module>
14
+ // 3. pre-run appended it, var Module = {}; ..generated code..
15
+ // 4. External script tag defines var Module.
16
+ // We need to check if Module already exists (e.g. case 3 above).
17
+ // Substitution will be replaced with actual code on later stage of the build,
18
+ // this way Closure Compiler will not mangle it (e.g. case 4. above).
19
+ // Note that if you want to run closure, and also to use Module
20
+ // after the generated code, you will need to define var Module = {};
21
+ // before the code. Then that object will be used in the code, and you
22
+ // can continue to use Module afterwards as well.
23
+ var Module = moduleArg;
24
+
25
+ // Set up the promise that indicates the Module is initialized
26
+ var readyPromiseResolve, readyPromiseReject;
27
+ var readyPromise = new Promise((resolve, reject) => {
28
+ readyPromiseResolve = resolve;
29
+ readyPromiseReject = reject;
30
+ });
31
+ ["_QTS_Throw","_QTS_NewError","_QTS_RuntimeSetMemoryLimit","_QTS_RuntimeComputeMemoryUsage","_QTS_RuntimeDumpMemoryUsage","_QTS_RecoverableLeakCheck","_QTS_BuildIsSanitizeLeak","_QTS_RuntimeSetMaxStackSize","_QTS_GetUndefined","_QTS_GetNull","_QTS_GetFalse","_QTS_GetTrue","_QTS_NewRuntime","_QTS_FreeRuntime","_QTS_NewContext","_QTS_FreeContext","_QTS_FreeValuePointer","_QTS_FreeValuePointerRuntime","_QTS_FreeVoidPointer","_QTS_FreeCString","_QTS_DupValuePointer","_QTS_NewObject","_QTS_NewObjectProto","_QTS_NewArray","_QTS_NewArrayBuffer","_QTS_NewFloat64","_QTS_GetFloat64","_QTS_NewString","_QTS_GetString","_QTS_GetArrayBuffer","_QTS_GetArrayBufferLength","_QTS_NewSymbol","_QTS_GetSymbolDescriptionOrKey","_QTS_IsGlobalSymbol","_QTS_IsJobPending","_QTS_ExecutePendingJob","_QTS_GetProp","_QTS_GetPropNumber","_QTS_SetProp","_QTS_DefineProp","_QTS_GetOwnPropertyNames","_QTS_Call","_QTS_ResolveException","_QTS_Dump","_QTS_Eval","_QTS_GetModuleNamespace","_QTS_Typeof","_QTS_GetLength","_QTS_IsEqual","_QTS_GetGlobalObject","_QTS_NewPromiseCapability","_QTS_PromiseState","_QTS_PromiseResult","_QTS_TestStringArg","_QTS_GetDebugLogEnabled","_QTS_SetDebugLogEnabled","_QTS_BuildIsDebug","_QTS_BuildIsAsyncify","_QTS_NewFunction","_QTS_ArgvGetJSValueConstPointer","_QTS_RuntimeEnableInterruptHandler","_QTS_RuntimeDisableInterruptHandler","_QTS_RuntimeEnableModuleLoader","_QTS_RuntimeDisableModuleLoader","_QTS_bjson_encode","_QTS_bjson_decode","_QTS_EvalFunction","_QTS_EncodeBytecode","_QTS_DecodeBytecode","_malloc","_free","_set_asyncify_stack_size","_qts_host_call_function","_qts_host_interrupt_handler","_qts_host_load_module_source","_qts_host_normalize_module","___indirect_function_table","onRuntimeInitialized"].forEach((prop) => {
32
+ if (!Object.getOwnPropertyDescriptor(readyPromise, prop)) {
33
+ Object.defineProperty(readyPromise, prop, {
34
+ get: () => abort('You are getting ' + prop + ' on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js'),
35
+ set: () => abort('You are setting ' + prop + ' on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js'),
36
+ });
37
+ }
38
+ });
39
+
40
+ // Determine the runtime environment we are in. You can customize this by
41
+ // setting the ENVIRONMENT setting at compile time (see settings.js).
42
+
43
+ var ENVIRONMENT_IS_WEB = true;
44
+ var ENVIRONMENT_IS_WORKER = false;
45
+ var ENVIRONMENT_IS_NODE = false;
46
+ var ENVIRONMENT_IS_SHELL = false;
47
+
48
+ if (Module['ENVIRONMENT']) {
49
+ throw new Error('Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)');
50
+ }
51
+
52
+ // --pre-jses are emitted after the Module integration code, so that they can
53
+ // refer to Module (if they choose; they can also define Module)
54
+ // include: /Users/steffanhalvorsen/Desktop/git/quickjs-emscripten/templates/pre-extension.js
55
+ /* eslint-disable no-undef */
56
+ // quickjs-emscripten code injected into emscripten-module.js
57
+ // We use this to expose and patch up issues with Emscripten's source map handling...
58
+ function quickjsEmscriptenInit(debugLog) {
59
+ const log = debugLog || function () {}
60
+ // Everything goes in a function so we can defer running until other variables
61
+ // are initialized in case they change.
62
+ const extension = { log }
63
+ for (const init of quickjsEmscriptenInit.inits) {
64
+ init(extension)
65
+ }
66
+ Module["quickJSEmscriptenExtensions"] = extension
67
+ return extension
68
+ }
69
+ quickjsEmscriptenInit.inits = []
70
+ Module["quickjsEmscriptenInit"] = quickjsEmscriptenInit
71
+ // end include: /Users/steffanhalvorsen/Desktop/git/quickjs-emscripten/templates/pre-extension.js
72
+ // include: /Users/steffanhalvorsen/Desktop/git/quickjs-emscripten/templates/pre-sourceMapJson.js
73
+ /* eslint-disable no-undef */
74
+ quickjsEmscriptenInit.inits.push((extension) => {
75
+ if (typeof receiveSourceMapJSON !== "undefined") {
76
+ extension["receiveSourceMapJSON"] = (data) => {
77
+ if (typeof wasmSourceMap === "undefined") {
78
+ extension.log("receiveSourceMapJSON: received", data)
79
+ return receiveSourceMapJSON(data)
80
+ } else {
81
+ extension.log("receiveSourceMapJSON: already have data:", wasmSourceMap, "ignoring", data)
82
+ }
83
+ }
84
+ }
85
+ })
86
+ // end include: /Users/steffanhalvorsen/Desktop/git/quickjs-emscripten/templates/pre-sourceMapJson.js
87
+ // include: /Users/steffanhalvorsen/Desktop/git/quickjs-emscripten/templates/pre-wasmOffsetConverter.js
88
+ /* eslint-disable no-undef */
89
+ quickjsEmscriptenInit.inits.push((extension) => {
90
+ if (typeof WasmOffsetConverter !== "undefined") {
91
+ extension["WasmOffsetConverter"] = WasmOffsetConverter
92
+ // Expose function to receive WasmOffsetConverter, set to wasmOffsetConverter local variable
93
+ // if it exists
94
+ try {
95
+ // Check if wasmOffsetConverter variable exists. If it isn't defined, this
96
+ // will throw and we'll skip the rest of the branch.
97
+ extension["existingWasmOffsetConverter"] = wasmOffsetConverter
98
+ extension["receiveWasmOffsetConverter"] = function (wasmBinary, wasmModule) {
99
+ if (!wasmOffsetConverter) {
100
+ extension.log("wasmOffsetConverter set")
101
+ wasmOffsetConverter = new WasmOffsetConverter(wasmBinary, wasmModule)
102
+ } else {
103
+ extension.log("wasmOffsetConverter already set, ignored")
104
+ }
105
+ }
106
+ } catch (error) {
107
+ // Nothing.
108
+ extension["receiveWasmOffsetConverter"] = function () {
109
+ extension.log("wasmOffsetConverter variable not defined, this is a no-op")
110
+ }
111
+ }
112
+ }
113
+ })
114
+ // end include: /Users/steffanhalvorsen/Desktop/git/quickjs-emscripten/templates/pre-wasmOffsetConverter.js
115
+ // include: /Users/steffanhalvorsen/Desktop/git/quickjs-emscripten/templates/pre-wasmMemory.js
116
+ /* eslint-disable no-undef */
117
+ quickjsEmscriptenInit.inits.push((extension) => {
118
+ extension["getWasmMemory"] = function () {
119
+ return wasmMemory
120
+ }
121
+ })
122
+ // end include: /Users/steffanhalvorsen/Desktop/git/quickjs-emscripten/templates/pre-wasmMemory.js
123
+
124
+
125
+ // Sometimes an existing Module object exists with properties
126
+ // meant to overwrite the default module functionality. Here
127
+ // we collect those properties and reapply _after_ we configure
128
+ // the current environment's defaults to avoid having to be so
129
+ // defensive during initialization.
130
+ var moduleOverrides = Object.assign({}, Module);
131
+
132
+ var arguments_ = [];
133
+ var thisProgram = './this.program';
134
+ var quit_ = (status, toThrow) => {
135
+ throw toThrow;
136
+ };
137
+
138
+ // `/` should be present at the end if `scriptDirectory` is not empty
139
+ var scriptDirectory = '';
140
+ function locateFile(path) {
141
+ if (Module['locateFile']) {
142
+ return Module['locateFile'](path, scriptDirectory);
143
+ }
144
+ return scriptDirectory + path;
145
+ }
146
+
147
+ // Hooks that are implemented differently in different runtime environments.
148
+ var readAsync, readBinary;
149
+
150
+ if (ENVIRONMENT_IS_SHELL) {
151
+
152
+ if ((typeof process == 'object' && typeof require === 'function') || typeof window == 'object' || typeof importScripts == 'function') throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
153
+
154
+ } else
155
+
156
+ // Note that this includes Node.js workers when relevant (pthreads is enabled).
157
+ // Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
158
+ // ENVIRONMENT_IS_NODE.
159
+ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
160
+ if (ENVIRONMENT_IS_WORKER) { // Check worker, not web, since window could be polyfilled
161
+ scriptDirectory = self.location.href;
162
+ } else if (typeof document != 'undefined' && document.currentScript) { // web
163
+ scriptDirectory = document.currentScript.src;
164
+ }
165
+ // When MODULARIZE, this JS may be executed later, after document.currentScript
166
+ // is gone, so we saved it, and we use it here instead of any other info.
167
+ if (_scriptName) {
168
+ scriptDirectory = _scriptName;
169
+ }
170
+ // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them.
171
+ // otherwise, slice off the final part of the url to find the script directory.
172
+ // if scriptDirectory does not contain a slash, lastIndexOf will return -1,
173
+ // and scriptDirectory will correctly be replaced with an empty string.
174
+ // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #),
175
+ // they are removed because they could contain a slash.
176
+ if (scriptDirectory.startsWith('blob:')) {
177
+ scriptDirectory = '';
178
+ } else {
179
+ scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/')+1);
180
+ }
181
+
182
+ if (!(typeof window == 'object' || typeof importScripts == 'function')) throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
183
+
184
+ {
185
+ // include: web_or_worker_shell_read.js
186
+ readAsync = (url) => {
187
+ assert(!isFileURI(url), "readAsync does not work with file:// URLs");
188
+ return fetch(url, { credentials: 'same-origin' })
189
+ .then((response) => {
190
+ if (response.ok) {
191
+ return response.arrayBuffer();
192
+ }
193
+ return Promise.reject(new Error(response.status + ' : ' + response.url));
194
+ })
195
+ };
196
+ // end include: web_or_worker_shell_read.js
197
+ }
198
+ } else
199
+ {
200
+ throw new Error('environment detection error');
201
+ }
202
+
203
+ var out = Module['print'] || console.log.bind(console);
204
+ var err = Module['printErr'] || console.error.bind(console);
205
+
206
+ // Merge back in the overrides
207
+ Object.assign(Module, moduleOverrides);
208
+ // Free the object hierarchy contained in the overrides, this lets the GC
209
+ // reclaim data used.
210
+ moduleOverrides = null;
211
+ checkIncomingModuleAPI();
212
+
213
+ // Emit code to handle expected values on the Module object. This applies Module.x
214
+ // to the proper local x. This has two benefits: first, we only emit it if it is
215
+ // expected to arrive, and second, by using a local everywhere else that can be
216
+ // minified.
217
+
218
+ if (Module['arguments']) arguments_ = Module['arguments'];legacyModuleProp('arguments', 'arguments_');
219
+
220
+ if (Module['thisProgram']) thisProgram = Module['thisProgram'];legacyModuleProp('thisProgram', 'thisProgram');
221
+
222
+ // perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message
223
+ // Assertions on removed incoming Module JS APIs.
224
+ assert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead');
225
+ assert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead');
226
+ assert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead');
227
+ assert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead');
228
+ assert(typeof Module['read'] == 'undefined', 'Module.read option was removed');
229
+ assert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)');
230
+ assert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)');
231
+ assert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)');
232
+ assert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY');
233
+ legacyModuleProp('asm', 'wasmExports');
234
+ legacyModuleProp('readAsync', 'readAsync');
235
+ legacyModuleProp('readBinary', 'readBinary');
236
+ legacyModuleProp('setWindowTitle', 'setWindowTitle');
237
+ var IDBFS = 'IDBFS is no longer included by default; build with -lidbfs.js';
238
+ var PROXYFS = 'PROXYFS is no longer included by default; build with -lproxyfs.js';
239
+ var WORKERFS = 'WORKERFS is no longer included by default; build with -lworkerfs.js';
240
+ var FETCHFS = 'FETCHFS is no longer included by default; build with -lfetchfs.js';
241
+ var ICASEFS = 'ICASEFS is no longer included by default; build with -licasefs.js';
242
+ var JSFILEFS = 'JSFILEFS is no longer included by default; build with -ljsfilefs.js';
243
+ var OPFS = 'OPFS is no longer included by default; build with -lopfs.js';
244
+
245
+ var NODEFS = 'NODEFS is no longer included by default; build with -lnodefs.js';
246
+
247
+ assert(!ENVIRONMENT_IS_WORKER, 'worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable.');
248
+
249
+ assert(!ENVIRONMENT_IS_NODE, 'node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable.');
250
+
251
+ assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.');
252
+
253
+ // end include: shell.js
254
+
255
+ // include: preamble.js
256
+ // === Preamble library stuff ===
257
+
258
+ // Documentation for the public APIs defined in this file must be updated in:
259
+ // site/source/docs/api_reference/preamble.js.rst
260
+ // A prebuilt local version of the documentation is available at:
261
+ // site/build/text/docs/api_reference/preamble.js.txt
262
+ // You can also build docs locally as HTML or other formats in site/
263
+ // An online HTML version (which may be of a different version of Emscripten)
264
+ // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
265
+
266
+ var wasmBinary = Module['wasmBinary'];legacyModuleProp('wasmBinary', 'wasmBinary');
267
+
268
+ if (typeof WebAssembly != 'object') {
269
+ err('no native wasm support detected');
270
+ }
271
+
272
+ // Wasm globals
273
+
274
+ var wasmMemory;
275
+
276
+ //========================================
277
+ // Runtime essentials
278
+ //========================================
279
+
280
+ // whether we are quitting the application. no code should run after this.
281
+ // set in exit() and abort()
282
+ var ABORT = false;
283
+
284
+ // set by exit() and abort(). Passed to 'onExit' handler.
285
+ // NOTE: This is also used as the process return code code in shell environments
286
+ // but only when noExitRuntime is false.
287
+ var EXITSTATUS;
288
+
289
+ // In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we
290
+ // don't define it at all in release modes. This matches the behaviour of
291
+ // MINIMAL_RUNTIME.
292
+ // TODO(sbc): Make this the default even without STRICT enabled.
293
+ /** @type {function(*, string=)} */
294
+ function assert(condition, text) {
295
+ if (!condition) {
296
+ abort('Assertion failed' + (text ? ': ' + text : ''));
297
+ }
298
+ }
299
+
300
+ // We used to include malloc/free by default in the past. Show a helpful error in
301
+ // builds with assertions.
302
+
303
+ // Memory management
304
+
305
+ var HEAP,
306
+ /** @type {!Int8Array} */
307
+ HEAP8,
308
+ /** @type {!Uint8Array} */
309
+ HEAPU8,
310
+ /** @type {!Int16Array} */
311
+ HEAP16,
312
+ /** @type {!Uint16Array} */
313
+ HEAPU16,
314
+ /** @type {!Int32Array} */
315
+ HEAP32,
316
+ /** @type {!Uint32Array} */
317
+ HEAPU32,
318
+ /** @type {!Float32Array} */
319
+ HEAPF32,
320
+ /** @type {!Float64Array} */
321
+ HEAPF64;
322
+
323
+ // include: runtime_shared.js
324
+ function updateMemoryViews() {
325
+ var b = wasmMemory.buffer;
326
+ Module['HEAP8'] = HEAP8 = new Int8Array(b);
327
+ Module['HEAP16'] = HEAP16 = new Int16Array(b);
328
+ Module['HEAPU8'] = HEAPU8 = new Uint8Array(b);
329
+ Module['HEAPU16'] = HEAPU16 = new Uint16Array(b);
330
+ Module['HEAP32'] = HEAP32 = new Int32Array(b);
331
+ Module['HEAPU32'] = HEAPU32 = new Uint32Array(b);
332
+ Module['HEAPF32'] = HEAPF32 = new Float32Array(b);
333
+ Module['HEAPF64'] = HEAPF64 = new Float64Array(b);
334
+ }
335
+ // end include: runtime_shared.js
336
+ assert(!Module['STACK_SIZE'], 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time')
337
+
338
+ assert(typeof Int32Array != 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined,
339
+ 'JS engine does not provide full typed array support');
340
+
341
+ // In non-standalone/normal mode, we create the memory here.
342
+ // include: runtime_init_memory.js
343
+ // Create the wasm memory. (Note: this only applies if IMPORTED_MEMORY is defined)
344
+
345
+ // check for full engine support (use string 'subarray' to avoid closure compiler confusion)
346
+
347
+ if (Module['wasmMemory']) {
348
+ wasmMemory = Module['wasmMemory'];
349
+ } else
350
+ {
351
+ var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 16777216;legacyModuleProp('INITIAL_MEMORY', 'INITIAL_MEMORY');
352
+
353
+ assert(INITIAL_MEMORY >= 5242880, 'INITIAL_MEMORY should be larger than STACK_SIZE, was ' + INITIAL_MEMORY + '! (STACK_SIZE=' + 5242880 + ')');
354
+ wasmMemory = new WebAssembly.Memory({
355
+ 'initial': INITIAL_MEMORY / 65536,
356
+ // In theory we should not need to emit the maximum if we want "unlimited"
357
+ // or 4GB of memory, but VMs error on that atm, see
358
+ // https://github.com/emscripten-core/emscripten/issues/14130
359
+ // And in the pthreads case we definitely need to emit a maximum. So
360
+ // always emit one.
361
+ 'maximum': 2147483648 / 65536,
362
+ });
363
+ }
364
+
365
+ updateMemoryViews();
366
+
367
+ // end include: runtime_init_memory.js
368
+
369
+ // include: runtime_stack_check.js
370
+ // Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.
371
+ function writeStackCookie() {
372
+ var max = _emscripten_stack_get_end();
373
+ assert((max & 3) == 0);
374
+ // If the stack ends at address zero we write our cookies 4 bytes into the
375
+ // stack. This prevents interference with SAFE_HEAP and ASAN which also
376
+ // monitor writes to address zero.
377
+ if (max == 0) {
378
+ max += 4;
379
+ }
380
+ // The stack grow downwards towards _emscripten_stack_get_end.
381
+ // We write cookies to the final two words in the stack and detect if they are
382
+ // ever overwritten.
383
+ HEAPU32[((max)>>2)] = 0x02135467;
384
+ HEAPU32[(((max)+(4))>>2)] = 0x89BACDFE;
385
+ // Also test the global address 0 for integrity.
386
+ HEAPU32[((0)>>2)] = 1668509029;
387
+ }
388
+
389
+ function checkStackCookie() {
390
+ if (ABORT) return;
391
+ var max = _emscripten_stack_get_end();
392
+ // See writeStackCookie().
393
+ if (max == 0) {
394
+ max += 4;
395
+ }
396
+ var cookie1 = HEAPU32[((max)>>2)];
397
+ var cookie2 = HEAPU32[(((max)+(4))>>2)];
398
+ if (cookie1 != 0x02135467 || cookie2 != 0x89BACDFE) {
399
+ abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);
400
+ }
401
+ // Also test the global address 0 for integrity.
402
+ if (HEAPU32[((0)>>2)] != 0x63736d65 /* 'emsc' */) {
403
+ abort('Runtime error: The application has corrupted its heap memory area (address zero)!');
404
+ }
405
+ }
406
+ // end include: runtime_stack_check.js
407
+ var __ATPRERUN__ = []; // functions called before the runtime is initialized
408
+ var __ATINIT__ = []; // functions called during startup
409
+ var __ATEXIT__ = []; // functions called during shutdown
410
+ var __ATPOSTRUN__ = []; // functions called after the main() is called
411
+
412
+ var runtimeInitialized = false;
413
+
414
+ function preRun() {
415
+ if (Module['preRun']) {
416
+ if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
417
+ while (Module['preRun'].length) {
418
+ addOnPreRun(Module['preRun'].shift());
419
+ }
420
+ }
421
+ callRuntimeCallbacks(__ATPRERUN__);
422
+ }
423
+
424
+ function initRuntime() {
425
+ assert(!runtimeInitialized);
426
+ runtimeInitialized = true;
427
+
428
+ checkStackCookie();
429
+
430
+
431
+ callRuntimeCallbacks(__ATINIT__);
432
+ }
433
+
434
+ function postRun() {
435
+ checkStackCookie();
436
+
437
+ if (Module['postRun']) {
438
+ if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']];
439
+ while (Module['postRun'].length) {
440
+ addOnPostRun(Module['postRun'].shift());
441
+ }
442
+ }
443
+
444
+ callRuntimeCallbacks(__ATPOSTRUN__);
445
+ }
446
+
447
+ function addOnPreRun(cb) {
448
+ __ATPRERUN__.unshift(cb);
449
+ }
450
+
451
+ function addOnInit(cb) {
452
+ __ATINIT__.unshift(cb);
453
+ }
454
+
455
+ function addOnExit(cb) {
456
+ }
457
+
458
+ function addOnPostRun(cb) {
459
+ __ATPOSTRUN__.unshift(cb);
460
+ }
461
+
462
+ // include: runtime_math.js
463
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul
464
+
465
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround
466
+
467
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32
468
+
469
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc
470
+
471
+ assert(Math.imul, 'This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');
472
+ assert(Math.fround, 'This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');
473
+ assert(Math.clz32, 'This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');
474
+ assert(Math.trunc, 'This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');
475
+ // end include: runtime_math.js
476
+ // A counter of dependencies for calling run(). If we need to
477
+ // do asynchronous work before running, increment this and
478
+ // decrement it. Incrementing must happen in a place like
479
+ // Module.preRun (used by emcc to add file preloading).
480
+ // Note that you can add dependencies in preRun, even though
481
+ // it happens right before run - run will be postponed until
482
+ // the dependencies are met.
483
+ var runDependencies = 0;
484
+ var runDependencyWatcher = null;
485
+ var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
486
+ var runDependencyTracking = {};
487
+
488
+ function getUniqueRunDependency(id) {
489
+ var orig = id;
490
+ while (1) {
491
+ if (!runDependencyTracking[id]) return id;
492
+ id = orig + Math.random();
493
+ }
494
+ }
495
+
496
+ function addRunDependency(id) {
497
+ runDependencies++;
498
+
499
+ Module['monitorRunDependencies']?.(runDependencies);
500
+
501
+ if (id) {
502
+ assert(!runDependencyTracking[id]);
503
+ runDependencyTracking[id] = 1;
504
+ if (runDependencyWatcher === null && typeof setInterval != 'undefined') {
505
+ // Check for missing dependencies every few seconds
506
+ runDependencyWatcher = setInterval(() => {
507
+ if (ABORT) {
508
+ clearInterval(runDependencyWatcher);
509
+ runDependencyWatcher = null;
510
+ return;
511
+ }
512
+ var shown = false;
513
+ for (var dep in runDependencyTracking) {
514
+ if (!shown) {
515
+ shown = true;
516
+ err('still waiting on run dependencies:');
517
+ }
518
+ err(`dependency: ${dep}`);
519
+ }
520
+ if (shown) {
521
+ err('(end of list)');
522
+ }
523
+ }, 10000);
524
+ }
525
+ } else {
526
+ err('warning: run dependency added without ID');
527
+ }
528
+ }
529
+
530
+ function removeRunDependency(id) {
531
+ runDependencies--;
532
+
533
+ Module['monitorRunDependencies']?.(runDependencies);
534
+
535
+ if (id) {
536
+ assert(runDependencyTracking[id]);
537
+ delete runDependencyTracking[id];
538
+ } else {
539
+ err('warning: run dependency removed without ID');
540
+ }
541
+ if (runDependencies == 0) {
542
+ if (runDependencyWatcher !== null) {
543
+ clearInterval(runDependencyWatcher);
544
+ runDependencyWatcher = null;
545
+ }
546
+ if (dependenciesFulfilled) {
547
+ var callback = dependenciesFulfilled;
548
+ dependenciesFulfilled = null;
549
+ callback(); // can add another dependenciesFulfilled
550
+ }
551
+ }
552
+ }
553
+
554
+ /** @param {string|number=} what */
555
+ function abort(what) {
556
+ Module['onAbort']?.(what);
557
+
558
+ what = 'Aborted(' + what + ')';
559
+ // TODO(sbc): Should we remove printing and leave it up to whoever
560
+ // catches the exception?
561
+ err(what);
562
+
563
+ ABORT = true;
564
+ EXITSTATUS = 1;
565
+
566
+ if (what.indexOf('RuntimeError: unreachable') >= 0) {
567
+ what += '. "unreachable" may be due to ASYNCIFY_STACK_SIZE not being large enough (try increasing it)';
568
+ }
569
+
570
+ // Use a wasm runtime error, because a JS error might be seen as a foreign
571
+ // exception, which means we'd run destructors on it. We need the error to
572
+ // simply make the program stop.
573
+ // FIXME This approach does not work in Wasm EH because it currently does not assume
574
+ // all RuntimeErrors are from traps; it decides whether a RuntimeError is from
575
+ // a trap or not based on a hidden field within the object. So at the moment
576
+ // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that
577
+ // allows this in the wasm spec.
578
+
579
+ // Suppress closure compiler warning here. Closure compiler's builtin extern
580
+ // definition for WebAssembly.RuntimeError claims it takes no arguments even
581
+ // though it can.
582
+ // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
583
+ /** @suppress {checkTypes} */
584
+ var e = new WebAssembly.RuntimeError(what);
585
+
586
+ readyPromiseReject(e);
587
+ // Throw the error whether or not MODULARIZE is set because abort is used
588
+ // in code paths apart from instantiation where an exception is expected
589
+ // to be thrown when abort is called.
590
+ throw e;
591
+ }
592
+
593
+ // include: memoryprofiler.js
594
+ // end include: memoryprofiler.js
595
+ // show errors on likely calls to FS when it was not included
596
+ var FS = {
597
+ error() {
598
+ abort('Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM');
599
+ },
600
+ init() { FS.error() },
601
+ createDataFile() { FS.error() },
602
+ createPreloadedFile() { FS.error() },
603
+ createLazyFile() { FS.error() },
604
+ open() { FS.error() },
605
+ mkdev() { FS.error() },
606
+ registerDevice() { FS.error() },
607
+ analyzePath() { FS.error() },
608
+
609
+ ErrnoError() { FS.error() },
610
+ };
611
+ Module['FS_createDataFile'] = FS.createDataFile;
612
+ Module['FS_createPreloadedFile'] = FS.createPreloadedFile;
613
+
614
+ // include: URIUtils.js
615
+ // Prefix of data URIs emitted by SINGLE_FILE and related options.
616
+ var dataURIPrefix = 'data:application/octet-stream;base64,';
617
+
618
+ /**
619
+ * Indicates whether filename is a base64 data URI.
620
+ * @noinline
621
+ */
622
+ var isDataURI = (filename) => filename.startsWith(dataURIPrefix);
623
+
624
+ /**
625
+ * Indicates whether filename is delivered via file protocol (as opposed to http/https)
626
+ * @noinline
627
+ */
628
+ var isFileURI = (filename) => filename.startsWith('file://');
629
+ // end include: URIUtils.js
630
+ function createExportWrapper(name, nargs) {
631
+ return (...args) => {
632
+ assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`);
633
+ var f = wasmExports[name];
634
+ assert(f, `exported native function \`${name}\` not found`);
635
+ // Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled.
636
+ assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`);
637
+ return f(...args);
638
+ };
639
+ }
640
+
641
+ // include: runtime_exceptions.js
642
+ // end include: runtime_exceptions.js
643
+ function findWasmBinary() {
644
+ var f = 'emscripten-module.wasm';
645
+ if (!isDataURI(f)) {
646
+ return locateFile(f);
647
+ }
648
+ return f;
649
+ }
650
+
651
+ var wasmBinaryFile;
652
+
653
+ function getBinarySync(file) {
654
+ if (file == wasmBinaryFile && wasmBinary) {
655
+ return new Uint8Array(wasmBinary);
656
+ }
657
+ if (readBinary) {
658
+ return readBinary(file);
659
+ }
660
+ throw 'both async and sync fetching of the wasm failed';
661
+ }
662
+
663
+ function getBinaryPromise(binaryFile) {
664
+ // If we don't have the binary yet, load it asynchronously using readAsync.
665
+ if (!wasmBinary
666
+ ) {
667
+ // Fetch the binary using readAsync
668
+ return readAsync(binaryFile).then(
669
+ (response) => new Uint8Array(/** @type{!ArrayBuffer} */(response)),
670
+ // Fall back to getBinarySync if readAsync fails
671
+ () => getBinarySync(binaryFile)
672
+ );
673
+ }
674
+
675
+ // Otherwise, getBinarySync should be able to get it synchronously
676
+ return Promise.resolve().then(() => getBinarySync(binaryFile));
677
+ }
678
+
679
+ function instantiateArrayBuffer(binaryFile, imports, receiver) {
680
+ return getBinaryPromise(binaryFile).then((binary) => {
681
+ return WebAssembly.instantiate(binary, imports);
682
+ }).then(receiver, (reason) => {
683
+ err(`failed to asynchronously prepare wasm: ${reason}`);
684
+
685
+ // Warn on some common problems.
686
+ if (isFileURI(wasmBinaryFile)) {
687
+ err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`);
688
+ }
689
+ abort(reason);
690
+ });
691
+ }
692
+
693
+ function instantiateAsync(binary, binaryFile, imports, callback) {
694
+ if (!binary &&
695
+ typeof WebAssembly.instantiateStreaming == 'function' &&
696
+ !isDataURI(binaryFile) &&
697
+ typeof fetch == 'function') {
698
+ return fetch(binaryFile, { credentials: 'same-origin' }).then((response) => {
699
+ // Suppress closure warning here since the upstream definition for
700
+ // instantiateStreaming only allows Promise<Repsponse> rather than
701
+ // an actual Response.
702
+ // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure is fixed.
703
+ /** @suppress {checkTypes} */
704
+ var result = WebAssembly.instantiateStreaming(response, imports);
705
+
706
+ return result.then(
707
+ callback,
708
+ function(reason) {
709
+ // We expect the most common failure cause to be a bad MIME type for the binary,
710
+ // in which case falling back to ArrayBuffer instantiation should work.
711
+ err(`wasm streaming compile failed: ${reason}`);
712
+ err('falling back to ArrayBuffer instantiation');
713
+ return instantiateArrayBuffer(binaryFile, imports, callback);
714
+ });
715
+ });
716
+ }
717
+ return instantiateArrayBuffer(binaryFile, imports, callback);
718
+ }
719
+
720
+ function getWasmImports() {
721
+ // instrumenting imports is used in asyncify in two ways: to add assertions
722
+ // that check for proper import use, and for ASYNCIFY=2 we use them to set up
723
+ // the Promise API on the import side.
724
+ Asyncify.instrumentWasmImports(wasmImports);
725
+ // prepare imports
726
+ return {
727
+ 'env': wasmImports,
728
+ 'wasi_snapshot_preview1': wasmImports,
729
+ }
730
+ }
731
+
732
+ // Create the wasm instance.
733
+ // Receives the wasm imports, returns the exports.
734
+ function createWasm() {
735
+ var info = getWasmImports();
736
+ // Load the wasm module and create an instance of using native support in the JS engine.
737
+ // handle a generated wasm instance, receiving its exports and
738
+ // performing other necessary setup
739
+ /** @param {WebAssembly.Module=} module*/
740
+ function receiveInstance(instance, module) {
741
+ wasmExports = instance.exports;
742
+
743
+ wasmExports = Asyncify.instrumentWasmExports(wasmExports);
744
+
745
+
746
+
747
+ addOnInit(wasmExports['__wasm_call_ctors']);
748
+
749
+ removeRunDependency('wasm-instantiate');
750
+ return wasmExports;
751
+ }
752
+ // wait for the pthread pool (if any)
753
+ addRunDependency('wasm-instantiate');
754
+
755
+ // Prefer streaming instantiation if available.
756
+ // Async compilation can be confusing when an error on the page overwrites Module
757
+ // (for example, if the order of elements is wrong, and the one defining Module is
758
+ // later), so we save Module and check it later.
759
+ var trueModule = Module;
760
+ function receiveInstantiationResult(result) {
761
+ // 'result' is a ResultObject object which has both the module and instance.
762
+ // receiveInstance() will swap in the exports (to Module.asm) so they can be called
763
+ assert(Module === trueModule, 'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?');
764
+ trueModule = null;
765
+ // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line.
766
+ // When the regression is fixed, can restore the above PTHREADS-enabled path.
767
+ receiveInstance(result['instance']);
768
+ }
769
+
770
+ // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback
771
+ // to manually instantiate the Wasm module themselves. This allows pages to
772
+ // run the instantiation parallel to any other async startup actions they are
773
+ // performing.
774
+ // Also pthreads and wasm workers initialize the wasm instance through this
775
+ // path.
776
+ if (Module['instantiateWasm']) {
777
+ try {
778
+ return Module['instantiateWasm'](info, receiveInstance);
779
+ } catch(e) {
780
+ err(`Module.instantiateWasm callback failed with error: ${e}`);
781
+ // If instantiation fails, reject the module ready promise.
782
+ readyPromiseReject(e);
783
+ }
784
+ }
785
+
786
+ if (!wasmBinaryFile) wasmBinaryFile = findWasmBinary();
787
+
788
+ // If instantiation fails, reject the module ready promise.
789
+ instantiateAsync(wasmBinary, wasmBinaryFile, info, receiveInstantiationResult).catch(readyPromiseReject);
790
+ return {}; // no exports yet; we'll fill them in later
791
+ }
792
+
793
+ // Globals used by JS i64 conversions (see makeSetValue)
794
+ var tempDouble;
795
+ var tempI64;
796
+
797
+ // include: runtime_debug.js
798
+ // Endianness check
799
+ (function() {
800
+ var h16 = new Int16Array(1);
801
+ var h8 = new Int8Array(h16.buffer);
802
+ h16[0] = 0x6373;
803
+ if (h8[0] !== 0x73 || h8[1] !== 0x63) throw 'Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)';
804
+ })();
805
+
806
+ function legacyModuleProp(prop, newName, incoming=true) {
807
+ if (!Object.getOwnPropertyDescriptor(Module, prop)) {
808
+ Object.defineProperty(Module, prop, {
809
+ configurable: true,
810
+ get() {
811
+ let extra = incoming ? ' (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)' : '';
812
+ abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra);
813
+
814
+ }
815
+ });
816
+ }
817
+ }
818
+
819
+ function ignoredModuleProp(prop) {
820
+ if (Object.getOwnPropertyDescriptor(Module, prop)) {
821
+ abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`);
822
+ }
823
+ }
824
+
825
+ // forcing the filesystem exports a few things by default
826
+ function isExportedByForceFilesystem(name) {
827
+ return name === 'FS_createPath' ||
828
+ name === 'FS_createDataFile' ||
829
+ name === 'FS_createPreloadedFile' ||
830
+ name === 'FS_unlink' ||
831
+ name === 'addRunDependency' ||
832
+ // The old FS has some functionality that WasmFS lacks.
833
+ name === 'FS_createLazyFile' ||
834
+ name === 'FS_createDevice' ||
835
+ name === 'removeRunDependency';
836
+ }
837
+
838
+ function missingGlobal(sym, msg) {
839
+ if (typeof globalThis != 'undefined') {
840
+ Object.defineProperty(globalThis, sym, {
841
+ configurable: true,
842
+ get() {
843
+ warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`);
844
+ return undefined;
845
+ }
846
+ });
847
+ }
848
+ }
849
+
850
+ missingGlobal('buffer', 'Please use HEAP8.buffer or wasmMemory.buffer');
851
+ missingGlobal('asm', 'Please use wasmExports instead');
852
+
853
+ function missingLibrarySymbol(sym) {
854
+ if (typeof globalThis != 'undefined' && !Object.getOwnPropertyDescriptor(globalThis, sym)) {
855
+ Object.defineProperty(globalThis, sym, {
856
+ configurable: true,
857
+ get() {
858
+ // Can't `abort()` here because it would break code that does runtime
859
+ // checks. e.g. `if (typeof SDL === 'undefined')`.
860
+ var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`;
861
+ // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in
862
+ // library.js, which means $name for a JS name with no prefix, or name
863
+ // for a JS name like _name.
864
+ var librarySymbol = sym;
865
+ if (!librarySymbol.startsWith('_')) {
866
+ librarySymbol = '$' + sym;
867
+ }
868
+ msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;
869
+ if (isExportedByForceFilesystem(sym)) {
870
+ msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
871
+ }
872
+ warnOnce(msg);
873
+ return undefined;
874
+ }
875
+ });
876
+ }
877
+ // Any symbol that is not included from the JS library is also (by definition)
878
+ // not exported on the Module object.
879
+ unexportedRuntimeSymbol(sym);
880
+ }
881
+
882
+ function unexportedRuntimeSymbol(sym) {
883
+ if (!Object.getOwnPropertyDescriptor(Module, sym)) {
884
+ Object.defineProperty(Module, sym, {
885
+ configurable: true,
886
+ get() {
887
+ var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
888
+ if (isExportedByForceFilesystem(sym)) {
889
+ msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
890
+ }
891
+ abort(msg);
892
+ }
893
+ });
894
+ }
895
+ }
896
+
897
+ // Used by XXXXX_DEBUG settings to output debug messages.
898
+ function dbg(...args) {
899
+ // TODO(sbc): Make this configurable somehow. Its not always convenient for
900
+ // logging to show up as warnings.
901
+ console.warn(...args);
902
+ }
903
+ // end include: runtime_debug.js
904
+ // === Body ===
905
+
906
+ function set_asyncify_stack_size(size,default_size) { Asyncify.StackSize = size || default_size; }
907
+ function qts_host_call_function(ctx,this_ptr,argc,argv,magic_func_id) { const asyncify = {['handleSleep'] : Asyncify.handleSleep}; return Module['callbacks']['callFunction'](asyncify, ctx, this_ptr, argc, argv, magic_func_id); }
908
+ function qts_host_interrupt_handler(rt) { const asyncify = undefined; return Module['callbacks']['shouldInterrupt'](asyncify, rt); }
909
+ function qts_host_load_module_source(rt,ctx,module_name) { const asyncify = {['handleSleep'] : Asyncify.handleSleep}; const moduleNameString = UTF8ToString(module_name); return Module['callbacks']['loadModuleSource'](asyncify, rt, ctx, moduleNameString); }
910
+ function qts_host_normalize_module(rt,ctx,module_base_name,module_name) { const asyncify = {['handleSleep'] : Asyncify.handleSleep}; const moduleBaseNameString = UTF8ToString(module_base_name); const moduleNameString = UTF8ToString(module_name); return Module['callbacks']['normalizeModule'](asyncify, rt, ctx, moduleBaseNameString, moduleNameString); }
911
+
912
+ // end include: preamble.js
913
+
914
+
915
+ /** @constructor */
916
+ function ExitStatus(status) {
917
+ this.name = 'ExitStatus';
918
+ this.message = `Program terminated with exit(${status})`;
919
+ this.status = status;
920
+ }
921
+
922
+ var callRuntimeCallbacks = (callbacks) => {
923
+ while (callbacks.length > 0) {
924
+ // Pass the module as the first argument.
925
+ callbacks.shift()(Module);
926
+ }
927
+ };
928
+
929
+
930
+ /**
931
+ * @param {number} ptr
932
+ * @param {string} type
933
+ */
934
+ function getValue(ptr, type = 'i8') {
935
+ if (type.endsWith('*')) type = '*';
936
+ switch (type) {
937
+ case 'i1': return HEAP8[ptr];
938
+ case 'i8': return HEAP8[ptr];
939
+ case 'i16': return HEAP16[((ptr)>>1)];
940
+ case 'i32': return HEAP32[((ptr)>>2)];
941
+ case 'i64': abort('to do getValue(i64) use WASM_BIGINT');
942
+ case 'float': return HEAPF32[((ptr)>>2)];
943
+ case 'double': return HEAPF64[((ptr)>>3)];
944
+ case '*': return HEAPU32[((ptr)>>2)];
945
+ default: abort(`invalid type for getValue: ${type}`);
946
+ }
947
+ }
948
+
949
+ var noExitRuntime = Module['noExitRuntime'] || true;
950
+
951
+ var ptrToString = (ptr) => {
952
+ assert(typeof ptr === 'number');
953
+ // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned.
954
+ ptr >>>= 0;
955
+ return '0x' + ptr.toString(16).padStart(8, '0');
956
+ };
957
+
958
+
959
+ /**
960
+ * @param {number} ptr
961
+ * @param {number} value
962
+ * @param {string} type
963
+ */
964
+ function setValue(ptr, value, type = 'i8') {
965
+ if (type.endsWith('*')) type = '*';
966
+ switch (type) {
967
+ case 'i1': HEAP8[ptr] = value; break;
968
+ case 'i8': HEAP8[ptr] = value; break;
969
+ case 'i16': HEAP16[((ptr)>>1)] = value; break;
970
+ case 'i32': HEAP32[((ptr)>>2)] = value; break;
971
+ case 'i64': abort('to do setValue(i64) use WASM_BIGINT');
972
+ case 'float': HEAPF32[((ptr)>>2)] = value; break;
973
+ case 'double': HEAPF64[((ptr)>>3)] = value; break;
974
+ case '*': HEAPU32[((ptr)>>2)] = value; break;
975
+ default: abort(`invalid type for setValue: ${type}`);
976
+ }
977
+ }
978
+
979
+ var stackRestore = (val) => __emscripten_stack_restore(val);
980
+
981
+ var stackSave = () => _emscripten_stack_get_current();
982
+
983
+ var warnOnce = (text) => {
984
+ warnOnce.shown ||= {};
985
+ if (!warnOnce.shown[text]) {
986
+ warnOnce.shown[text] = 1;
987
+ err(text);
988
+ }
989
+ };
990
+
991
+ var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder() : undefined;
992
+
993
+ /**
994
+ * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given
995
+ * array that contains uint8 values, returns a copy of that string as a
996
+ * Javascript String object.
997
+ * heapOrArray is either a regular array, or a JavaScript typed array view.
998
+ * @param {number} idx
999
+ * @param {number=} maxBytesToRead
1000
+ * @return {string}
1001
+ */
1002
+ var UTF8ArrayToString = (heapOrArray, idx, maxBytesToRead) => {
1003
+ var endIdx = idx + maxBytesToRead;
1004
+ var endPtr = idx;
1005
+ // TextDecoder needs to know the byte length in advance, it doesn't stop on
1006
+ // null terminator by itself. Also, use the length info to avoid running tiny
1007
+ // strings through TextDecoder, since .subarray() allocates garbage.
1008
+ // (As a tiny code save trick, compare endPtr against endIdx using a negation,
1009
+ // so that undefined means Infinity)
1010
+ while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
1011
+
1012
+ if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
1013
+ return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
1014
+ }
1015
+ var str = '';
1016
+ // If building with TextDecoder, we have already computed the string length
1017
+ // above, so test loop end condition against that
1018
+ while (idx < endPtr) {
1019
+ // For UTF8 byte structure, see:
1020
+ // http://en.wikipedia.org/wiki/UTF-8#Description
1021
+ // https://www.ietf.org/rfc/rfc2279.txt
1022
+ // https://tools.ietf.org/html/rfc3629
1023
+ var u0 = heapOrArray[idx++];
1024
+ if (!(u0 & 0x80)) { str += String.fromCharCode(u0); continue; }
1025
+ var u1 = heapOrArray[idx++] & 63;
1026
+ if ((u0 & 0xE0) == 0xC0) { str += String.fromCharCode(((u0 & 31) << 6) | u1); continue; }
1027
+ var u2 = heapOrArray[idx++] & 63;
1028
+ if ((u0 & 0xF0) == 0xE0) {
1029
+ u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
1030
+ } else {
1031
+ if ((u0 & 0xF8) != 0xF0) warnOnce('Invalid UTF-8 leading byte ' + ptrToString(u0) + ' encountered when deserializing a UTF-8 string in wasm memory to a JS string!');
1032
+ u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
1033
+ }
1034
+
1035
+ if (u0 < 0x10000) {
1036
+ str += String.fromCharCode(u0);
1037
+ } else {
1038
+ var ch = u0 - 0x10000;
1039
+ str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF));
1040
+ }
1041
+ }
1042
+ return str;
1043
+ };
1044
+
1045
+ /**
1046
+ * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
1047
+ * emscripten HEAP, returns a copy of that string as a Javascript String object.
1048
+ *
1049
+ * @param {number} ptr
1050
+ * @param {number=} maxBytesToRead - An optional length that specifies the
1051
+ * maximum number of bytes to read. You can omit this parameter to scan the
1052
+ * string until the first 0 byte. If maxBytesToRead is passed, and the string
1053
+ * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
1054
+ * string will cut short at that byte index (i.e. maxBytesToRead will not
1055
+ * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing
1056
+ * frequent uses of UTF8ToString() with and without maxBytesToRead may throw
1057
+ * JS JIT optimizations off, so it is worth to consider consistently using one
1058
+ * @return {string}
1059
+ */
1060
+ var UTF8ToString = (ptr, maxBytesToRead) => {
1061
+ assert(typeof ptr == 'number', `UTF8ToString expects a number (got ${typeof ptr})`);
1062
+ return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
1063
+ };
1064
+ var ___assert_fail = (condition, filename, line, func) => {
1065
+ abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [filename ? UTF8ToString(filename) : 'unknown filename', line, func ? UTF8ToString(func) : 'unknown function']);
1066
+ };
1067
+
1068
+ var __abort_js = () => {
1069
+ abort('native code called abort()');
1070
+ };
1071
+
1072
+ var __emscripten_memcpy_js = (dest, src, num) => HEAPU8.copyWithin(dest, src, src + num);
1073
+
1074
+ var isLeapYear = (year) => year%4 === 0 && (year%100 !== 0 || year%400 === 0);
1075
+
1076
+ var MONTH_DAYS_LEAP_CUMULATIVE = [0,31,60,91,121,152,182,213,244,274,305,335];
1077
+
1078
+ var MONTH_DAYS_REGULAR_CUMULATIVE = [0,31,59,90,120,151,181,212,243,273,304,334];
1079
+ var ydayFromDate = (date) => {
1080
+ var leap = isLeapYear(date.getFullYear());
1081
+ var monthDaysCumulative = (leap ? MONTH_DAYS_LEAP_CUMULATIVE : MONTH_DAYS_REGULAR_CUMULATIVE);
1082
+ var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; // -1 since it's days since Jan 1
1083
+
1084
+ return yday;
1085
+ };
1086
+
1087
+ var convertI32PairToI53Checked = (lo, hi) => {
1088
+ assert(lo == (lo >>> 0) || lo == (lo|0)); // lo should either be a i32 or a u32
1089
+ assert(hi === (hi|0)); // hi should be a i32
1090
+ return ((hi + 0x200000) >>> 0 < 0x400001 - !!lo) ? (lo >>> 0) + hi * 4294967296 : NaN;
1091
+ };
1092
+ function __localtime_js(time_low, time_high,tmPtr) {
1093
+ var time = convertI32PairToI53Checked(time_low, time_high);
1094
+
1095
+
1096
+ var date = new Date(time*1000);
1097
+ HEAP32[((tmPtr)>>2)] = date.getSeconds();
1098
+ HEAP32[(((tmPtr)+(4))>>2)] = date.getMinutes();
1099
+ HEAP32[(((tmPtr)+(8))>>2)] = date.getHours();
1100
+ HEAP32[(((tmPtr)+(12))>>2)] = date.getDate();
1101
+ HEAP32[(((tmPtr)+(16))>>2)] = date.getMonth();
1102
+ HEAP32[(((tmPtr)+(20))>>2)] = date.getFullYear()-1900;
1103
+ HEAP32[(((tmPtr)+(24))>>2)] = date.getDay();
1104
+
1105
+ var yday = ydayFromDate(date)|0;
1106
+ HEAP32[(((tmPtr)+(28))>>2)] = yday;
1107
+ HEAP32[(((tmPtr)+(36))>>2)] = -(date.getTimezoneOffset() * 60);
1108
+
1109
+ // Attention: DST is in December in South, and some regions don't have DST at all.
1110
+ var start = new Date(date.getFullYear(), 0, 1);
1111
+ var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset();
1112
+ var winterOffset = start.getTimezoneOffset();
1113
+ var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset))|0;
1114
+ HEAP32[(((tmPtr)+(32))>>2)] = dst;
1115
+ ;
1116
+ }
1117
+
1118
+ var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
1119
+ assert(typeof str === 'string', `stringToUTF8Array expects a string (got ${typeof str})`);
1120
+ // Parameter maxBytesToWrite is not optional. Negative values, 0, null,
1121
+ // undefined and false each don't write out any bytes.
1122
+ if (!(maxBytesToWrite > 0))
1123
+ return 0;
1124
+
1125
+ var startIdx = outIdx;
1126
+ var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator.
1127
+ for (var i = 0; i < str.length; ++i) {
1128
+ // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
1129
+ // unit, not a Unicode code point of the character! So decode
1130
+ // UTF16->UTF32->UTF8.
1131
+ // See http://unicode.org/faq/utf_bom.html#utf16-3
1132
+ // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description
1133
+ // and https://www.ietf.org/rfc/rfc2279.txt
1134
+ // and https://tools.ietf.org/html/rfc3629
1135
+ var u = str.charCodeAt(i); // possibly a lead surrogate
1136
+ if (u >= 0xD800 && u <= 0xDFFF) {
1137
+ var u1 = str.charCodeAt(++i);
1138
+ u = 0x10000 + ((u & 0x3FF) << 10) | (u1 & 0x3FF);
1139
+ }
1140
+ if (u <= 0x7F) {
1141
+ if (outIdx >= endIdx) break;
1142
+ heap[outIdx++] = u;
1143
+ } else if (u <= 0x7FF) {
1144
+ if (outIdx + 1 >= endIdx) break;
1145
+ heap[outIdx++] = 0xC0 | (u >> 6);
1146
+ heap[outIdx++] = 0x80 | (u & 63);
1147
+ } else if (u <= 0xFFFF) {
1148
+ if (outIdx + 2 >= endIdx) break;
1149
+ heap[outIdx++] = 0xE0 | (u >> 12);
1150
+ heap[outIdx++] = 0x80 | ((u >> 6) & 63);
1151
+ heap[outIdx++] = 0x80 | (u & 63);
1152
+ } else {
1153
+ if (outIdx + 3 >= endIdx) break;
1154
+ if (u > 0x10FFFF) warnOnce('Invalid Unicode code point ' + ptrToString(u) + ' encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).');
1155
+ heap[outIdx++] = 0xF0 | (u >> 18);
1156
+ heap[outIdx++] = 0x80 | ((u >> 12) & 63);
1157
+ heap[outIdx++] = 0x80 | ((u >> 6) & 63);
1158
+ heap[outIdx++] = 0x80 | (u & 63);
1159
+ }
1160
+ }
1161
+ // Null-terminate the pointer to the buffer.
1162
+ heap[outIdx] = 0;
1163
+ return outIdx - startIdx;
1164
+ };
1165
+ var stringToUTF8 = (str, outPtr, maxBytesToWrite) => {
1166
+ assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
1167
+ return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
1168
+ };
1169
+
1170
+ var lengthBytesUTF8 = (str) => {
1171
+ var len = 0;
1172
+ for (var i = 0; i < str.length; ++i) {
1173
+ // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
1174
+ // unit, not a Unicode code point of the character! So decode
1175
+ // UTF16->UTF32->UTF8.
1176
+ // See http://unicode.org/faq/utf_bom.html#utf16-3
1177
+ var c = str.charCodeAt(i); // possibly a lead surrogate
1178
+ if (c <= 0x7F) {
1179
+ len++;
1180
+ } else if (c <= 0x7FF) {
1181
+ len += 2;
1182
+ } else if (c >= 0xD800 && c <= 0xDFFF) {
1183
+ len += 4; ++i;
1184
+ } else {
1185
+ len += 3;
1186
+ }
1187
+ }
1188
+ return len;
1189
+ };
1190
+ var __tzset_js = (timezone, daylight, std_name, dst_name) => {
1191
+ // TODO: Use (malleable) environment variables instead of system settings.
1192
+ var currentYear = new Date().getFullYear();
1193
+ var winter = new Date(currentYear, 0, 1);
1194
+ var summer = new Date(currentYear, 6, 1);
1195
+ var winterOffset = winter.getTimezoneOffset();
1196
+ var summerOffset = summer.getTimezoneOffset();
1197
+
1198
+ // Local standard timezone offset. Local standard time is not adjusted for
1199
+ // daylight savings. This code uses the fact that getTimezoneOffset returns
1200
+ // a greater value during Standard Time versus Daylight Saving Time (DST).
1201
+ // Thus it determines the expected output during Standard Time, and it
1202
+ // compares whether the output of the given date the same (Standard) or less
1203
+ // (DST).
1204
+ var stdTimezoneOffset = Math.max(winterOffset, summerOffset);
1205
+
1206
+ // timezone is specified as seconds west of UTC ("The external variable
1207
+ // `timezone` shall be set to the difference, in seconds, between
1208
+ // Coordinated Universal Time (UTC) and local standard time."), the same
1209
+ // as returned by stdTimezoneOffset.
1210
+ // See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html
1211
+ HEAPU32[((timezone)>>2)] = stdTimezoneOffset * 60;
1212
+
1213
+ HEAP32[((daylight)>>2)] = Number(winterOffset != summerOffset);
1214
+
1215
+ var extractZone = (timezoneOffset) => {
1216
+ // Why inverse sign?
1217
+ // Read here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset
1218
+ var sign = timezoneOffset >= 0 ? "-" : "+";
1219
+
1220
+ var absOffset = Math.abs(timezoneOffset)
1221
+ var hours = String(Math.floor(absOffset / 60)).padStart(2, "0");
1222
+ var minutes = String(absOffset % 60).padStart(2, "0");
1223
+
1224
+ return `UTC${sign}${hours}${minutes}`;
1225
+ }
1226
+
1227
+ var winterName = extractZone(winterOffset);
1228
+ var summerName = extractZone(summerOffset);
1229
+ assert(winterName);
1230
+ assert(summerName);
1231
+ assert(lengthBytesUTF8(winterName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${winterName})`);
1232
+ assert(lengthBytesUTF8(summerName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${summerName})`);
1233
+ if (summerOffset < winterOffset) {
1234
+ // Northern hemisphere
1235
+ stringToUTF8(winterName, std_name, 17);
1236
+ stringToUTF8(summerName, dst_name, 17);
1237
+ } else {
1238
+ stringToUTF8(winterName, dst_name, 17);
1239
+ stringToUTF8(summerName, std_name, 17);
1240
+ }
1241
+ };
1242
+
1243
+ var _emscripten_date_now = () => Date.now();
1244
+
1245
+ var getHeapMax = () =>
1246
+ // Stay one Wasm page short of 4GB: while e.g. Chrome is able to allocate
1247
+ // full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side
1248
+ // for any code that deals with heap sizes, which would require special
1249
+ // casing all heap size related code to treat 0 specially.
1250
+ 2147483648;
1251
+
1252
+ var alignMemory = (size, alignment) => {
1253
+ assert(alignment, "alignment argument is required");
1254
+ return Math.ceil(size / alignment) * alignment;
1255
+ };
1256
+
1257
+ var growMemory = (size) => {
1258
+ var b = wasmMemory.buffer;
1259
+ var pages = (size - b.byteLength + 65535) / 65536;
1260
+ try {
1261
+ // round size grow request up to wasm page size (fixed 64KB per spec)
1262
+ wasmMemory.grow(pages); // .grow() takes a delta compared to the previous size
1263
+ updateMemoryViews();
1264
+ return 1 /*success*/;
1265
+ } catch(e) {
1266
+ err(`growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`);
1267
+ }
1268
+ // implicit 0 return to save code size (caller will cast "undefined" into 0
1269
+ // anyhow)
1270
+ };
1271
+ var _emscripten_resize_heap = (requestedSize) => {
1272
+ var oldSize = HEAPU8.length;
1273
+ // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned.
1274
+ requestedSize >>>= 0;
1275
+ // With multithreaded builds, races can happen (another thread might increase the size
1276
+ // in between), so return a failure, and let the caller retry.
1277
+ assert(requestedSize > oldSize);
1278
+
1279
+ // Memory resize rules:
1280
+ // 1. Always increase heap size to at least the requested size, rounded up
1281
+ // to next page multiple.
1282
+ // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap
1283
+ // geometrically: increase the heap size according to
1284
+ // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most
1285
+ // overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB).
1286
+ // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap
1287
+ // linearly: increase the heap size by at least
1288
+ // MEMORY_GROWTH_LINEAR_STEP bytes.
1289
+ // 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by
1290
+ // MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest
1291
+ // 4. If we were unable to allocate as much memory, it may be due to
1292
+ // over-eager decision to excessively reserve due to (3) above.
1293
+ // Hence if an allocation fails, cut down on the amount of excess
1294
+ // growth, in an attempt to succeed to perform a smaller allocation.
1295
+
1296
+ // A limit is set for how much we can grow. We should not exceed that
1297
+ // (the wasm binary specifies it, so if we tried, we'd fail anyhow).
1298
+ var maxHeapSize = getHeapMax();
1299
+ if (requestedSize > maxHeapSize) {
1300
+ err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`);
1301
+ return false;
1302
+ }
1303
+
1304
+ // Loop through potential heap size increases. If we attempt a too eager
1305
+ // reservation that fails, cut down on the attempted size and reserve a
1306
+ // smaller bump instead. (max 3 times, chosen somewhat arbitrarily)
1307
+ for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
1308
+ var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); // ensure geometric growth
1309
+ // but limit overreserving (default to capping at +96MB overgrowth at most)
1310
+ overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296 );
1311
+
1312
+ var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
1313
+
1314
+ var replacement = growMemory(newSize);
1315
+ if (replacement) {
1316
+
1317
+ return true;
1318
+ }
1319
+ }
1320
+ err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`);
1321
+ return false;
1322
+ };
1323
+
1324
+ var SYSCALLS = {
1325
+ varargs:undefined,
1326
+ getStr(ptr) {
1327
+ var ret = UTF8ToString(ptr);
1328
+ return ret;
1329
+ },
1330
+ };
1331
+ var _fd_close = (fd) => {
1332
+ abort('fd_close called without SYSCALLS_REQUIRE_FILESYSTEM');
1333
+ };
1334
+
1335
+ function _fd_seek(fd,offset_low, offset_high,whence,newOffset) {
1336
+ var offset = convertI32PairToI53Checked(offset_low, offset_high);
1337
+
1338
+
1339
+ return 70;
1340
+ ;
1341
+ }
1342
+
1343
+ var printCharBuffers = [null,[],[]];
1344
+
1345
+ var printChar = (stream, curr) => {
1346
+ var buffer = printCharBuffers[stream];
1347
+ assert(buffer);
1348
+ if (curr === 0 || curr === 10) {
1349
+ (stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0));
1350
+ buffer.length = 0;
1351
+ } else {
1352
+ buffer.push(curr);
1353
+ }
1354
+ };
1355
+
1356
+ var flush_NO_FILESYSTEM = () => {
1357
+ // flush anything remaining in the buffers during shutdown
1358
+ _fflush(0);
1359
+ if (printCharBuffers[1].length) printChar(1, 10);
1360
+ if (printCharBuffers[2].length) printChar(2, 10);
1361
+ };
1362
+
1363
+
1364
+ var _fd_write = (fd, iov, iovcnt, pnum) => {
1365
+ // hack to support printf in SYSCALLS_REQUIRE_FILESYSTEM=0
1366
+ var num = 0;
1367
+ for (var i = 0; i < iovcnt; i++) {
1368
+ var ptr = HEAPU32[((iov)>>2)];
1369
+ var len = HEAPU32[(((iov)+(4))>>2)];
1370
+ iov += 8;
1371
+ for (var j = 0; j < len; j++) {
1372
+ printChar(fd, HEAPU8[ptr+j]);
1373
+ }
1374
+ num += len;
1375
+ }
1376
+ HEAPU32[((pnum)>>2)] = num;
1377
+ return 0;
1378
+ };
1379
+
1380
+ var runAndAbortIfError = (func) => {
1381
+ try {
1382
+ return func();
1383
+ } catch (e) {
1384
+ abort(e);
1385
+ }
1386
+ };
1387
+
1388
+ var handleException = (e) => {
1389
+ // Certain exception types we do not treat as errors since they are used for
1390
+ // internal control flow.
1391
+ // 1. ExitStatus, which is thrown by exit()
1392
+ // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others
1393
+ // that wish to return to JS event loop.
1394
+ if (e instanceof ExitStatus || e == 'unwind') {
1395
+ return EXITSTATUS;
1396
+ }
1397
+ checkStackCookie();
1398
+ if (e instanceof WebAssembly.RuntimeError) {
1399
+ if (_emscripten_stack_get_current() <= 0) {
1400
+ err('Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 5242880)');
1401
+ }
1402
+ }
1403
+ quit_(1, e);
1404
+ };
1405
+
1406
+
1407
+ var runtimeKeepaliveCounter = 0;
1408
+ var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
1409
+ var _proc_exit = (code) => {
1410
+ EXITSTATUS = code;
1411
+ if (!keepRuntimeAlive()) {
1412
+ Module['onExit']?.(code);
1413
+ ABORT = true;
1414
+ }
1415
+ quit_(code, new ExitStatus(code));
1416
+ };
1417
+
1418
+ /** @suppress {duplicate } */
1419
+ /** @param {boolean|number=} implicit */
1420
+ var exitJS = (status, implicit) => {
1421
+ EXITSTATUS = status;
1422
+
1423
+ checkUnflushedContent();
1424
+
1425
+ // if exit() was called explicitly, warn the user if the runtime isn't actually being shut down
1426
+ if (keepRuntimeAlive() && !implicit) {
1427
+ var msg = `program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;
1428
+ readyPromiseReject(msg);
1429
+ err(msg);
1430
+ }
1431
+
1432
+ _proc_exit(status);
1433
+ };
1434
+ var _exit = exitJS;
1435
+
1436
+
1437
+ var maybeExit = () => {
1438
+ if (!keepRuntimeAlive()) {
1439
+ try {
1440
+ _exit(EXITSTATUS);
1441
+ } catch (e) {
1442
+ handleException(e);
1443
+ }
1444
+ }
1445
+ };
1446
+ var callUserCallback = (func) => {
1447
+ if (ABORT) {
1448
+ err('user callback triggered after runtime exited or application aborted. Ignoring.');
1449
+ return;
1450
+ }
1451
+ try {
1452
+ func();
1453
+ maybeExit();
1454
+ } catch (e) {
1455
+ handleException(e);
1456
+ }
1457
+ };
1458
+
1459
+ var sigToWasmTypes = (sig) => {
1460
+ assert(!sig.includes('j'), 'i64 not permitted in function signatures when WASM_BIGINT is disabled');
1461
+ var typeNames = {
1462
+ 'i': 'i32',
1463
+ 'j': 'i64',
1464
+ 'f': 'f32',
1465
+ 'd': 'f64',
1466
+ 'e': 'externref',
1467
+ 'p': 'i32',
1468
+ };
1469
+ var type = {
1470
+ parameters: [],
1471
+ results: sig[0] == 'v' ? [] : [typeNames[sig[0]]]
1472
+ };
1473
+ for (var i = 1; i < sig.length; ++i) {
1474
+ assert(sig[i] in typeNames, 'invalid signature char: ' + sig[i]);
1475
+ type.parameters.push(typeNames[sig[i]]);
1476
+ }
1477
+ return type;
1478
+ };
1479
+
1480
+ var runtimeKeepalivePush = () => {
1481
+ runtimeKeepaliveCounter += 1;
1482
+ };
1483
+
1484
+ var runtimeKeepalivePop = () => {
1485
+ assert(runtimeKeepaliveCounter > 0);
1486
+ runtimeKeepaliveCounter -= 1;
1487
+ };
1488
+
1489
+
1490
+ var Asyncify = {
1491
+ instrumentWasmImports(imports) {
1492
+ var importPattern = /^(qts_host_call_function|qts_host_load_module_source|qts_host_normalize_module|invoke_.*|__asyncjs__.*)$/;
1493
+
1494
+ for (let [x, original] of Object.entries(imports)) {
1495
+ if (typeof original == 'function') {
1496
+ let isAsyncifyImport = original.isAsync || importPattern.test(x);
1497
+ imports[x] = (...args) => {
1498
+ var originalAsyncifyState = Asyncify.state;
1499
+ try {
1500
+ return original(...args);
1501
+ } finally {
1502
+ // Only asyncify-declared imports are allowed to change the
1503
+ // state.
1504
+ // Changing the state from normal to disabled is allowed (in any
1505
+ // function) as that is what shutdown does (and we don't have an
1506
+ // explicit list of shutdown imports).
1507
+ var changedToDisabled =
1508
+ originalAsyncifyState === Asyncify.State.Normal &&
1509
+ Asyncify.state === Asyncify.State.Disabled;
1510
+ // invoke_* functions are allowed to change the state if we do
1511
+ // not ignore indirect calls.
1512
+ var ignoredInvoke = x.startsWith('invoke_') &&
1513
+ true;
1514
+ if (Asyncify.state !== originalAsyncifyState &&
1515
+ !isAsyncifyImport &&
1516
+ !changedToDisabled &&
1517
+ !ignoredInvoke) {
1518
+ throw new Error(`import ${x} was not in ASYNCIFY_IMPORTS, but changed the state`);
1519
+ }
1520
+ }
1521
+ };
1522
+ }
1523
+ }
1524
+ },
1525
+ instrumentWasmExports(exports) {
1526
+ var ret = {};
1527
+ for (let [x, original] of Object.entries(exports)) {
1528
+ if (typeof original == 'function') {
1529
+ ret[x] = (...args) => {
1530
+ Asyncify.exportCallStack.push(x);
1531
+ try {
1532
+ return original(...args);
1533
+ } finally {
1534
+ if (!ABORT) {
1535
+ var y = Asyncify.exportCallStack.pop();
1536
+ assert(y === x);
1537
+ Asyncify.maybeStopUnwind();
1538
+ }
1539
+ }
1540
+ };
1541
+ } else {
1542
+ ret[x] = original;
1543
+ }
1544
+ }
1545
+ return ret;
1546
+ },
1547
+ State:{
1548
+ Normal:0,
1549
+ Unwinding:1,
1550
+ Rewinding:2,
1551
+ Disabled:3,
1552
+ },
1553
+ state:0,
1554
+ StackSize:81920,
1555
+ currData:null,
1556
+ handleSleepReturnValue:0,
1557
+ exportCallStack:[],
1558
+ callStackNameToId:{
1559
+ },
1560
+ callStackIdToName:{
1561
+ },
1562
+ callStackId:0,
1563
+ asyncPromiseHandlers:null,
1564
+ sleepCallbacks:[],
1565
+ getCallStackId(funcName) {
1566
+ var id = Asyncify.callStackNameToId[funcName];
1567
+ if (id === undefined) {
1568
+ id = Asyncify.callStackId++;
1569
+ Asyncify.callStackNameToId[funcName] = id;
1570
+ Asyncify.callStackIdToName[id] = funcName;
1571
+ }
1572
+ return id;
1573
+ },
1574
+ maybeStopUnwind() {
1575
+ if (Asyncify.currData &&
1576
+ Asyncify.state === Asyncify.State.Unwinding &&
1577
+ Asyncify.exportCallStack.length === 0) {
1578
+ // We just finished unwinding.
1579
+ // Be sure to set the state before calling any other functions to avoid
1580
+ // possible infinite recursion here (For example in debug pthread builds
1581
+ // the dbg() function itself can call back into WebAssembly to get the
1582
+ // current pthread_self() pointer).
1583
+ Asyncify.state = Asyncify.State.Normal;
1584
+
1585
+ // Keep the runtime alive so that a re-wind can be done later.
1586
+ runAndAbortIfError(_asyncify_stop_unwind);
1587
+ if (typeof Fibers != 'undefined') {
1588
+ Fibers.trampoline();
1589
+ }
1590
+ }
1591
+ },
1592
+ whenDone() {
1593
+ assert(Asyncify.currData, 'Tried to wait for an async operation when none is in progress.');
1594
+ assert(!Asyncify.asyncPromiseHandlers, 'Cannot have multiple async operations in flight at once');
1595
+ return new Promise((resolve, reject) => {
1596
+ Asyncify.asyncPromiseHandlers = { resolve, reject };
1597
+ });
1598
+ },
1599
+ allocateData() {
1600
+ // An asyncify data structure has three fields:
1601
+ // 0 current stack pos
1602
+ // 4 max stack pos
1603
+ // 8 id of function at bottom of the call stack (callStackIdToName[id] == name of js function)
1604
+ //
1605
+ // The Asyncify ABI only interprets the first two fields, the rest is for the runtime.
1606
+ // We also embed a stack in the same memory region here, right next to the structure.
1607
+ // This struct is also defined as asyncify_data_t in emscripten/fiber.h
1608
+ var ptr = _malloc(12 + Asyncify.StackSize);
1609
+ Asyncify.setDataHeader(ptr, ptr + 12, Asyncify.StackSize);
1610
+ Asyncify.setDataRewindFunc(ptr);
1611
+ return ptr;
1612
+ },
1613
+ setDataHeader(ptr, stack, stackSize) {
1614
+ HEAPU32[((ptr)>>2)] = stack;
1615
+ HEAPU32[(((ptr)+(4))>>2)] = stack + stackSize;
1616
+ },
1617
+ setDataRewindFunc(ptr) {
1618
+ var bottomOfCallStack = Asyncify.exportCallStack[0];
1619
+ var rewindId = Asyncify.getCallStackId(bottomOfCallStack);
1620
+ HEAP32[(((ptr)+(8))>>2)] = rewindId;
1621
+ },
1622
+ getDataRewindFuncName(ptr) {
1623
+ var id = HEAP32[(((ptr)+(8))>>2)];
1624
+ var name = Asyncify.callStackIdToName[id];
1625
+ return name;
1626
+ },
1627
+ getDataRewindFunc(name) {
1628
+ var func = wasmExports[name];
1629
+ return func;
1630
+ },
1631
+ doRewind(ptr) {
1632
+ var name = Asyncify.getDataRewindFuncName(ptr);
1633
+ var func = Asyncify.getDataRewindFunc(name);
1634
+ // Once we have rewound and the stack we no longer need to artificially
1635
+ // keep the runtime alive.
1636
+
1637
+ return func();
1638
+ },
1639
+ handleSleep(startAsync) {
1640
+ assert(Asyncify.state !== Asyncify.State.Disabled, 'Asyncify cannot be done during or after the runtime exits');
1641
+ if (ABORT) return;
1642
+ if (Asyncify.state === Asyncify.State.Normal) {
1643
+ // Prepare to sleep. Call startAsync, and see what happens:
1644
+ // if the code decided to call our callback synchronously,
1645
+ // then no async operation was in fact begun, and we don't
1646
+ // need to do anything.
1647
+ var reachedCallback = false;
1648
+ var reachedAfterCallback = false;
1649
+ startAsync((handleSleepReturnValue = 0) => {
1650
+ assert(!handleSleepReturnValue || typeof handleSleepReturnValue == 'number' || typeof handleSleepReturnValue == 'boolean'); // old emterpretify API supported other stuff
1651
+ if (ABORT) return;
1652
+ Asyncify.handleSleepReturnValue = handleSleepReturnValue;
1653
+ reachedCallback = true;
1654
+ if (!reachedAfterCallback) {
1655
+ // We are happening synchronously, so no need for async.
1656
+ return;
1657
+ }
1658
+ // This async operation did not happen synchronously, so we did
1659
+ // unwind. In that case there can be no compiled code on the stack,
1660
+ // as it might break later operations (we can rewind ok now, but if
1661
+ // we unwind again, we would unwind through the extra compiled code
1662
+ // too).
1663
+ assert(!Asyncify.exportCallStack.length, 'Waking up (starting to rewind) must be done from JS, without compiled code on the stack.');
1664
+ Asyncify.state = Asyncify.State.Rewinding;
1665
+ runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData));
1666
+ if (typeof Browser != 'undefined' && Browser.mainLoop.func) {
1667
+ Browser.mainLoop.resume();
1668
+ }
1669
+ var asyncWasmReturnValue, isError = false;
1670
+ try {
1671
+ asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData);
1672
+ } catch (err) {
1673
+ asyncWasmReturnValue = err;
1674
+ isError = true;
1675
+ }
1676
+ // Track whether the return value was handled by any promise handlers.
1677
+ var handled = false;
1678
+ if (!Asyncify.currData) {
1679
+ // All asynchronous execution has finished.
1680
+ // `asyncWasmReturnValue` now contains the final
1681
+ // return value of the exported async WASM function.
1682
+ //
1683
+ // Note: `asyncWasmReturnValue` is distinct from
1684
+ // `Asyncify.handleSleepReturnValue`.
1685
+ // `Asyncify.handleSleepReturnValue` contains the return
1686
+ // value of the last C function to have executed
1687
+ // `Asyncify.handleSleep()`, where as `asyncWasmReturnValue`
1688
+ // contains the return value of the exported WASM function
1689
+ // that may have called C functions that
1690
+ // call `Asyncify.handleSleep()`.
1691
+ var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers;
1692
+ if (asyncPromiseHandlers) {
1693
+ Asyncify.asyncPromiseHandlers = null;
1694
+ (isError ? asyncPromiseHandlers.reject : asyncPromiseHandlers.resolve)(asyncWasmReturnValue);
1695
+ handled = true;
1696
+ }
1697
+ }
1698
+ if (isError && !handled) {
1699
+ // If there was an error and it was not handled by now, we have no choice but to
1700
+ // rethrow that error into the global scope where it can be caught only by
1701
+ // `onerror` or `onunhandledpromiserejection`.
1702
+ throw asyncWasmReturnValue;
1703
+ }
1704
+ });
1705
+ reachedAfterCallback = true;
1706
+ if (!reachedCallback) {
1707
+ // A true async operation was begun; start a sleep.
1708
+ Asyncify.state = Asyncify.State.Unwinding;
1709
+ // TODO: reuse, don't alloc/free every sleep
1710
+ Asyncify.currData = Asyncify.allocateData();
1711
+ if (typeof Browser != 'undefined' && Browser.mainLoop.func) {
1712
+ Browser.mainLoop.pause();
1713
+ }
1714
+ runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData));
1715
+ }
1716
+ } else if (Asyncify.state === Asyncify.State.Rewinding) {
1717
+ // Stop a resume.
1718
+ Asyncify.state = Asyncify.State.Normal;
1719
+ runAndAbortIfError(_asyncify_stop_rewind);
1720
+ _free(Asyncify.currData);
1721
+ Asyncify.currData = null;
1722
+ // Call all sleep callbacks now that the sleep-resume is all done.
1723
+ Asyncify.sleepCallbacks.forEach(callUserCallback);
1724
+ } else {
1725
+ abort(`invalid state: ${Asyncify.state}`);
1726
+ }
1727
+ return Asyncify.handleSleepReturnValue;
1728
+ },
1729
+ handleAsync(startAsync) {
1730
+ return Asyncify.handleSleep((wakeUp) => {
1731
+ // TODO: add error handling as a second param when handleSleep implements it.
1732
+ startAsync().then(wakeUp);
1733
+ });
1734
+ },
1735
+ };
1736
+
1737
+ var getCFunc = (ident) => {
1738
+ var func = Module['_' + ident]; // closure exported function
1739
+ assert(func, 'Cannot call unknown function ' + ident + ', make sure it is exported');
1740
+ return func;
1741
+ };
1742
+
1743
+
1744
+ var writeArrayToMemory = (array, buffer) => {
1745
+ assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)')
1746
+ HEAP8.set(array, buffer);
1747
+ };
1748
+
1749
+
1750
+
1751
+ var stackAlloc = (sz) => __emscripten_stack_alloc(sz);
1752
+ var stringToUTF8OnStack = (str) => {
1753
+ var size = lengthBytesUTF8(str) + 1;
1754
+ var ret = stackAlloc(size);
1755
+ stringToUTF8(str, ret, size);
1756
+ return ret;
1757
+ };
1758
+
1759
+
1760
+
1761
+
1762
+
1763
+
1764
+
1765
+ /**
1766
+ * @param {string|null=} returnType
1767
+ * @param {Array=} argTypes
1768
+ * @param {Arguments|Array=} args
1769
+ * @param {Object=} opts
1770
+ */
1771
+ var ccall = (ident, returnType, argTypes, args, opts) => {
1772
+ // For fast lookup of conversion functions
1773
+ var toC = {
1774
+ 'string': (str) => {
1775
+ var ret = 0;
1776
+ if (str !== null && str !== undefined && str !== 0) { // null string
1777
+ // at most 4 bytes per UTF-8 code point, +1 for the trailing '\0'
1778
+ ret = stringToUTF8OnStack(str);
1779
+ }
1780
+ return ret;
1781
+ },
1782
+ 'array': (arr) => {
1783
+ var ret = stackAlloc(arr.length);
1784
+ writeArrayToMemory(arr, ret);
1785
+ return ret;
1786
+ }
1787
+ };
1788
+
1789
+ function convertReturnValue(ret) {
1790
+ if (returnType === 'string') {
1791
+
1792
+ return UTF8ToString(ret);
1793
+ }
1794
+ if (returnType === 'boolean') return Boolean(ret);
1795
+ return ret;
1796
+ }
1797
+
1798
+ var func = getCFunc(ident);
1799
+ var cArgs = [];
1800
+ var stack = 0;
1801
+ assert(returnType !== 'array', 'Return type should not be "array".');
1802
+ if (args) {
1803
+ for (var i = 0; i < args.length; i++) {
1804
+ var converter = toC[argTypes[i]];
1805
+ if (converter) {
1806
+ if (stack === 0) stack = stackSave();
1807
+ cArgs[i] = converter(args[i]);
1808
+ } else {
1809
+ cArgs[i] = args[i];
1810
+ }
1811
+ }
1812
+ }
1813
+ // Data for a previous async operation that was in flight before us.
1814
+ var previousAsync = Asyncify.currData;
1815
+ var ret = func(...cArgs);
1816
+ function onDone(ret) {
1817
+ runtimeKeepalivePop();
1818
+ if (stack !== 0) stackRestore(stack);
1819
+ return convertReturnValue(ret);
1820
+ }
1821
+ var asyncMode = opts?.async;
1822
+
1823
+ // Keep the runtime alive through all calls. Note that this call might not be
1824
+ // async, but for simplicity we push and pop in all calls.
1825
+ runtimeKeepalivePush();
1826
+ if (Asyncify.currData != previousAsync) {
1827
+ // A change in async operation happened. If there was already an async
1828
+ // operation in flight before us, that is an error: we should not start
1829
+ // another async operation while one is active, and we should not stop one
1830
+ // either. The only valid combination is to have no change in the async
1831
+ // data (so we either had one in flight and left it alone, or we didn't have
1832
+ // one), or to have nothing in flight and to start one.
1833
+ assert(!(previousAsync && Asyncify.currData), 'We cannot start an async operation when one is already flight');
1834
+ assert(!(previousAsync && !Asyncify.currData), 'We cannot stop an async operation in flight');
1835
+ // This is a new async operation. The wasm is paused and has unwound its stack.
1836
+ // We need to return a Promise that resolves the return value
1837
+ // once the stack is rewound and execution finishes.
1838
+ assert(asyncMode, 'The call to ' + ident + ' is running asynchronously. If this was intended, add the async option to the ccall/cwrap call.');
1839
+ return Asyncify.whenDone().then(onDone);
1840
+ }
1841
+
1842
+ ret = onDone(ret);
1843
+ // If this is an async ccall, ensure we return a promise
1844
+ if (asyncMode) return Promise.resolve(ret);
1845
+ return ret;
1846
+ };
1847
+
1848
+ /**
1849
+ * @param {string=} returnType
1850
+ * @param {Array=} argTypes
1851
+ * @param {Object=} opts
1852
+ */
1853
+ var cwrap = (ident, returnType, argTypes, opts) => {
1854
+ return (...args) => ccall(ident, returnType, argTypes, args, opts);
1855
+ };
1856
+
1857
+
1858
+
1859
+ function checkIncomingModuleAPI() {
1860
+ ignoredModuleProp('fetchSettings');
1861
+ }
1862
+ var wasmImports = {
1863
+ /** @export */
1864
+ __assert_fail: ___assert_fail,
1865
+ /** @export */
1866
+ _abort_js: __abort_js,
1867
+ /** @export */
1868
+ _emscripten_memcpy_js: __emscripten_memcpy_js,
1869
+ /** @export */
1870
+ _localtime_js: __localtime_js,
1871
+ /** @export */
1872
+ _tzset_js: __tzset_js,
1873
+ /** @export */
1874
+ emscripten_date_now: _emscripten_date_now,
1875
+ /** @export */
1876
+ emscripten_resize_heap: _emscripten_resize_heap,
1877
+ /** @export */
1878
+ fd_close: _fd_close,
1879
+ /** @export */
1880
+ fd_seek: _fd_seek,
1881
+ /** @export */
1882
+ fd_write: _fd_write,
1883
+ /** @export */
1884
+ memory: wasmMemory,
1885
+ /** @export */
1886
+ qts_host_call_function,
1887
+ /** @export */
1888
+ qts_host_interrupt_handler,
1889
+ /** @export */
1890
+ qts_host_load_module_source,
1891
+ /** @export */
1892
+ qts_host_normalize_module,
1893
+ /** @export */
1894
+ set_asyncify_stack_size
1895
+ };
1896
+ var wasmExports = createWasm();
1897
+ var ___wasm_call_ctors = createExportWrapper('__wasm_call_ctors', 0);
1898
+ var _malloc = Module['_malloc'] = createExportWrapper('malloc', 1);
1899
+ var _QTS_Throw = Module['_QTS_Throw'] = createExportWrapper('QTS_Throw', 2);
1900
+ var _QTS_NewError = Module['_QTS_NewError'] = createExportWrapper('QTS_NewError', 1);
1901
+ var _QTS_RuntimeSetMemoryLimit = Module['_QTS_RuntimeSetMemoryLimit'] = createExportWrapper('QTS_RuntimeSetMemoryLimit', 2);
1902
+ var _QTS_RuntimeComputeMemoryUsage = Module['_QTS_RuntimeComputeMemoryUsage'] = createExportWrapper('QTS_RuntimeComputeMemoryUsage', 2);
1903
+ var _QTS_RuntimeDumpMemoryUsage = Module['_QTS_RuntimeDumpMemoryUsage'] = createExportWrapper('QTS_RuntimeDumpMemoryUsage', 1);
1904
+ var _QTS_RecoverableLeakCheck = Module['_QTS_RecoverableLeakCheck'] = createExportWrapper('QTS_RecoverableLeakCheck', 0);
1905
+ var _QTS_BuildIsSanitizeLeak = Module['_QTS_BuildIsSanitizeLeak'] = createExportWrapper('QTS_BuildIsSanitizeLeak', 0);
1906
+ var _QTS_RuntimeSetMaxStackSize = Module['_QTS_RuntimeSetMaxStackSize'] = createExportWrapper('QTS_RuntimeSetMaxStackSize', 2);
1907
+ var _QTS_GetUndefined = Module['_QTS_GetUndefined'] = createExportWrapper('QTS_GetUndefined', 0);
1908
+ var _QTS_GetNull = Module['_QTS_GetNull'] = createExportWrapper('QTS_GetNull', 0);
1909
+ var _QTS_GetFalse = Module['_QTS_GetFalse'] = createExportWrapper('QTS_GetFalse', 0);
1910
+ var _QTS_GetTrue = Module['_QTS_GetTrue'] = createExportWrapper('QTS_GetTrue', 0);
1911
+ var _QTS_NewRuntime = Module['_QTS_NewRuntime'] = createExportWrapper('QTS_NewRuntime', 0);
1912
+ var _QTS_FreeRuntime = Module['_QTS_FreeRuntime'] = createExportWrapper('QTS_FreeRuntime', 1);
1913
+ var _free = Module['_free'] = createExportWrapper('free', 1);
1914
+ var _QTS_NewContext = Module['_QTS_NewContext'] = createExportWrapper('QTS_NewContext', 2);
1915
+ var _QTS_FreeContext = Module['_QTS_FreeContext'] = createExportWrapper('QTS_FreeContext', 1);
1916
+ var _QTS_FreeValuePointer = Module['_QTS_FreeValuePointer'] = createExportWrapper('QTS_FreeValuePointer', 2);
1917
+ var _QTS_FreeValuePointerRuntime = Module['_QTS_FreeValuePointerRuntime'] = createExportWrapper('QTS_FreeValuePointerRuntime', 2);
1918
+ var _QTS_FreeVoidPointer = Module['_QTS_FreeVoidPointer'] = createExportWrapper('QTS_FreeVoidPointer', 2);
1919
+ var _QTS_FreeCString = Module['_QTS_FreeCString'] = createExportWrapper('QTS_FreeCString', 2);
1920
+ var _QTS_DupValuePointer = Module['_QTS_DupValuePointer'] = createExportWrapper('QTS_DupValuePointer', 2);
1921
+ var _QTS_NewObject = Module['_QTS_NewObject'] = createExportWrapper('QTS_NewObject', 1);
1922
+ var _QTS_NewObjectProto = Module['_QTS_NewObjectProto'] = createExportWrapper('QTS_NewObjectProto', 2);
1923
+ var _QTS_NewArray = Module['_QTS_NewArray'] = createExportWrapper('QTS_NewArray', 1);
1924
+ var _QTS_NewArrayBuffer = Module['_QTS_NewArrayBuffer'] = createExportWrapper('QTS_NewArrayBuffer', 3);
1925
+ var _QTS_NewFloat64 = Module['_QTS_NewFloat64'] = createExportWrapper('QTS_NewFloat64', 2);
1926
+ var _QTS_GetFloat64 = Module['_QTS_GetFloat64'] = createExportWrapper('QTS_GetFloat64', 2);
1927
+ var _QTS_NewString = Module['_QTS_NewString'] = createExportWrapper('QTS_NewString', 2);
1928
+ var _QTS_GetString = Module['_QTS_GetString'] = createExportWrapper('QTS_GetString', 2);
1929
+ var _QTS_GetArrayBuffer = Module['_QTS_GetArrayBuffer'] = createExportWrapper('QTS_GetArrayBuffer', 2);
1930
+ var _QTS_GetArrayBufferLength = Module['_QTS_GetArrayBufferLength'] = createExportWrapper('QTS_GetArrayBufferLength', 2);
1931
+ var _QTS_NewSymbol = Module['_QTS_NewSymbol'] = createExportWrapper('QTS_NewSymbol', 3);
1932
+ var _QTS_GetSymbolDescriptionOrKey = Module['_QTS_GetSymbolDescriptionOrKey'] = createExportWrapper('QTS_GetSymbolDescriptionOrKey', 2);
1933
+ var _QTS_IsGlobalSymbol = Module['_QTS_IsGlobalSymbol'] = createExportWrapper('QTS_IsGlobalSymbol', 2);
1934
+ var _QTS_IsJobPending = Module['_QTS_IsJobPending'] = createExportWrapper('QTS_IsJobPending', 1);
1935
+ var _QTS_ExecutePendingJob = Module['_QTS_ExecutePendingJob'] = createExportWrapper('QTS_ExecutePendingJob', 3);
1936
+ var _QTS_GetProp = Module['_QTS_GetProp'] = createExportWrapper('QTS_GetProp', 3);
1937
+ var _QTS_GetPropNumber = Module['_QTS_GetPropNumber'] = createExportWrapper('QTS_GetPropNumber', 3);
1938
+ var _QTS_SetProp = Module['_QTS_SetProp'] = createExportWrapper('QTS_SetProp', 4);
1939
+ var _QTS_DefineProp = Module['_QTS_DefineProp'] = createExportWrapper('QTS_DefineProp', 9);
1940
+ var _QTS_GetOwnPropertyNames = Module['_QTS_GetOwnPropertyNames'] = createExportWrapper('QTS_GetOwnPropertyNames', 5);
1941
+ var _QTS_Call = Module['_QTS_Call'] = createExportWrapper('QTS_Call', 5);
1942
+ var _QTS_ResolveException = Module['_QTS_ResolveException'] = createExportWrapper('QTS_ResolveException', 2);
1943
+ var _QTS_Dump = Module['_QTS_Dump'] = createExportWrapper('QTS_Dump', 2);
1944
+ var _QTS_Eval = Module['_QTS_Eval'] = createExportWrapper('QTS_Eval', 6);
1945
+ var _QTS_GetModuleNamespace = Module['_QTS_GetModuleNamespace'] = createExportWrapper('QTS_GetModuleNamespace', 2);
1946
+ var _QTS_Typeof = Module['_QTS_Typeof'] = createExportWrapper('QTS_Typeof', 2);
1947
+ var _QTS_GetLength = Module['_QTS_GetLength'] = createExportWrapper('QTS_GetLength', 3);
1948
+ var _QTS_IsEqual = Module['_QTS_IsEqual'] = createExportWrapper('QTS_IsEqual', 4);
1949
+ var _QTS_GetGlobalObject = Module['_QTS_GetGlobalObject'] = createExportWrapper('QTS_GetGlobalObject', 1);
1950
+ var _QTS_NewPromiseCapability = Module['_QTS_NewPromiseCapability'] = createExportWrapper('QTS_NewPromiseCapability', 2);
1951
+ var _QTS_PromiseState = Module['_QTS_PromiseState'] = createExportWrapper('QTS_PromiseState', 2);
1952
+ var _QTS_PromiseResult = Module['_QTS_PromiseResult'] = createExportWrapper('QTS_PromiseResult', 2);
1953
+ var _QTS_TestStringArg = Module['_QTS_TestStringArg'] = createExportWrapper('QTS_TestStringArg', 1);
1954
+ var _QTS_GetDebugLogEnabled = Module['_QTS_GetDebugLogEnabled'] = createExportWrapper('QTS_GetDebugLogEnabled', 1);
1955
+ var _QTS_SetDebugLogEnabled = Module['_QTS_SetDebugLogEnabled'] = createExportWrapper('QTS_SetDebugLogEnabled', 2);
1956
+ var _QTS_BuildIsDebug = Module['_QTS_BuildIsDebug'] = createExportWrapper('QTS_BuildIsDebug', 0);
1957
+ var _QTS_BuildIsAsyncify = Module['_QTS_BuildIsAsyncify'] = createExportWrapper('QTS_BuildIsAsyncify', 0);
1958
+ var _QTS_NewFunction = Module['_QTS_NewFunction'] = createExportWrapper('QTS_NewFunction', 3);
1959
+ var _QTS_ArgvGetJSValueConstPointer = Module['_QTS_ArgvGetJSValueConstPointer'] = createExportWrapper('QTS_ArgvGetJSValueConstPointer', 2);
1960
+ var _QTS_RuntimeEnableInterruptHandler = Module['_QTS_RuntimeEnableInterruptHandler'] = createExportWrapper('QTS_RuntimeEnableInterruptHandler', 1);
1961
+ var _QTS_RuntimeDisableInterruptHandler = Module['_QTS_RuntimeDisableInterruptHandler'] = createExportWrapper('QTS_RuntimeDisableInterruptHandler', 1);
1962
+ var _QTS_RuntimeEnableModuleLoader = Module['_QTS_RuntimeEnableModuleLoader'] = createExportWrapper('QTS_RuntimeEnableModuleLoader', 2);
1963
+ var _QTS_RuntimeDisableModuleLoader = Module['_QTS_RuntimeDisableModuleLoader'] = createExportWrapper('QTS_RuntimeDisableModuleLoader', 1);
1964
+ var _QTS_bjson_encode = Module['_QTS_bjson_encode'] = createExportWrapper('QTS_bjson_encode', 2);
1965
+ var _QTS_bjson_decode = Module['_QTS_bjson_decode'] = createExportWrapper('QTS_bjson_decode', 2);
1966
+ var _QTS_EvalFunction = Module['_QTS_EvalFunction'] = createExportWrapper('QTS_EvalFunction', 2);
1967
+ var _QTS_EncodeBytecode = Module['_QTS_EncodeBytecode'] = createExportWrapper('QTS_EncodeBytecode', 2);
1968
+ var _QTS_DecodeBytecode = Module['_QTS_DecodeBytecode'] = createExportWrapper('QTS_DecodeBytecode', 2);
1969
+ var _fflush = createExportWrapper('fflush', 1);
1970
+ var _strerror = createExportWrapper('strerror', 1);
1971
+ var __emscripten_tempret_set = createExportWrapper('_emscripten_tempret_set', 1);
1972
+ var _emscripten_stack_init = () => (_emscripten_stack_init = wasmExports['emscripten_stack_init'])();
1973
+ var _emscripten_stack_get_free = () => (_emscripten_stack_get_free = wasmExports['emscripten_stack_get_free'])();
1974
+ var _emscripten_stack_get_base = () => (_emscripten_stack_get_base = wasmExports['emscripten_stack_get_base'])();
1975
+ var _emscripten_stack_get_end = () => (_emscripten_stack_get_end = wasmExports['emscripten_stack_get_end'])();
1976
+ var __emscripten_stack_restore = (a0) => (__emscripten_stack_restore = wasmExports['_emscripten_stack_restore'])(a0);
1977
+ var __emscripten_stack_alloc = (a0) => (__emscripten_stack_alloc = wasmExports['_emscripten_stack_alloc'])(a0);
1978
+ var _emscripten_stack_get_current = () => (_emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'])();
1979
+ var dynCall_viii = Module['dynCall_viii'] = createExportWrapper('dynCall_viii', 4);
1980
+ var dynCall_jijiiii = Module['dynCall_jijiiii'] = createExportWrapper('dynCall_jijiiii', 8);
1981
+ var dynCall_jijiii = Module['dynCall_jijiii'] = createExportWrapper('dynCall_jijiii', 7);
1982
+ var dynCall_iii = Module['dynCall_iii'] = createExportWrapper('dynCall_iii', 3);
1983
+ var dynCall_iiiii = Module['dynCall_iiiii'] = createExportWrapper('dynCall_iiiii', 5);
1984
+ var dynCall_iiii = Module['dynCall_iiii'] = createExportWrapper('dynCall_iiii', 4);
1985
+ var dynCall_ii = Module['dynCall_ii'] = createExportWrapper('dynCall_ii', 2);
1986
+ var dynCall_jiij = Module['dynCall_jiij'] = createExportWrapper('dynCall_jiij', 5);
1987
+ var dynCall_iiiijj = Module['dynCall_iiiijj'] = createExportWrapper('dynCall_iiiijj', 8);
1988
+ var dynCall_iiiij = Module['dynCall_iiiij'] = createExportWrapper('dynCall_iiiij', 6);
1989
+ var dynCall_jiiiii = Module['dynCall_jiiiii'] = createExportWrapper('dynCall_jiiiii', 6);
1990
+ var dynCall_jij = Module['dynCall_jij'] = createExportWrapper('dynCall_jij', 4);
1991
+ var dynCall_jijjiii = Module['dynCall_jijjiii'] = createExportWrapper('dynCall_jijjiii', 9);
1992
+ var dynCall_vii = Module['dynCall_vii'] = createExportWrapper('dynCall_vii', 3);
1993
+ var dynCall_jiii = Module['dynCall_jiii'] = createExportWrapper('dynCall_jiii', 4);
1994
+ var dynCall_jijii = Module['dynCall_jijii'] = createExportWrapper('dynCall_jijii', 6);
1995
+ var dynCall_jijiiiii = Module['dynCall_jijiiiii'] = createExportWrapper('dynCall_jijiiiii', 9);
1996
+ var dynCall_jijj = Module['dynCall_jijj'] = createExportWrapper('dynCall_jijj', 6);
1997
+ var dynCall_viji = Module['dynCall_viji'] = createExportWrapper('dynCall_viji', 5);
1998
+ var dynCall_vij = Module['dynCall_vij'] = createExportWrapper('dynCall_vij', 4);
1999
+ var dynCall_iiijj = Module['dynCall_iiijj'] = createExportWrapper('dynCall_iiijj', 7);
2000
+ var dynCall_iijijjji = Module['dynCall_iijijjji'] = createExportWrapper('dynCall_iijijjji', 12);
2001
+ var dynCall_iiiji = Module['dynCall_iiiji'] = createExportWrapper('dynCall_iiiji', 6);
2002
+ var dynCall_iiji = Module['dynCall_iiji'] = createExportWrapper('dynCall_iiji', 5);
2003
+ var dynCall_jijij = Module['dynCall_jijij'] = createExportWrapper('dynCall_jijij', 7);
2004
+ var dynCall_iijijji = Module['dynCall_iijijji'] = createExportWrapper('dynCall_iijijji', 10);
2005
+ var dynCall_jiiii = Module['dynCall_jiiii'] = createExportWrapper('dynCall_jiiii', 5);
2006
+ var dynCall_jiji = Module['dynCall_jiji'] = createExportWrapper('dynCall_jiji', 5);
2007
+ var dynCall_jijji = Module['dynCall_jijji'] = createExportWrapper('dynCall_jijji', 7);
2008
+ var dynCall_dd = Module['dynCall_dd'] = createExportWrapper('dynCall_dd', 2);
2009
+ var dynCall_ddd = Module['dynCall_ddd'] = createExportWrapper('dynCall_ddd', 3);
2010
+ var dynCall_jii = Module['dynCall_jii'] = createExportWrapper('dynCall_jii', 3);
2011
+ var dynCall_iiiiii = Module['dynCall_iiiiii'] = createExportWrapper('dynCall_iiiiii', 6);
2012
+ var dynCall_iidiiii = Module['dynCall_iidiiii'] = createExportWrapper('dynCall_iidiiii', 7);
2013
+ var _asyncify_start_unwind = createExportWrapper('asyncify_start_unwind', 1);
2014
+ var _asyncify_stop_unwind = createExportWrapper('asyncify_stop_unwind', 0);
2015
+ var _asyncify_start_rewind = createExportWrapper('asyncify_start_rewind', 1);
2016
+ var _asyncify_stop_rewind = createExportWrapper('asyncify_stop_rewind', 0);
2017
+
2018
+
2019
+ // include: postamble.js
2020
+ // === Auto-generated postamble setup entry stuff ===
2021
+
2022
+ Module['cwrap'] = cwrap;
2023
+ Module['UTF8ToString'] = UTF8ToString;
2024
+ Module['stringToUTF8'] = stringToUTF8;
2025
+ Module['lengthBytesUTF8'] = lengthBytesUTF8;
2026
+ var missingLibrarySymbols = [
2027
+ 'writeI53ToI64',
2028
+ 'writeI53ToI64Clamped',
2029
+ 'writeI53ToI64Signaling',
2030
+ 'writeI53ToU64Clamped',
2031
+ 'writeI53ToU64Signaling',
2032
+ 'readI53FromI64',
2033
+ 'readI53FromU64',
2034
+ 'convertI32PairToI53',
2035
+ 'convertU32PairToI53',
2036
+ 'getTempRet0',
2037
+ 'setTempRet0',
2038
+ 'zeroMemory',
2039
+ 'strError',
2040
+ 'inetPton4',
2041
+ 'inetNtop4',
2042
+ 'inetPton6',
2043
+ 'inetNtop6',
2044
+ 'readSockaddr',
2045
+ 'writeSockaddr',
2046
+ 'initRandomFill',
2047
+ 'randomFill',
2048
+ 'emscriptenLog',
2049
+ 'readEmAsmArgs',
2050
+ 'jstoi_q',
2051
+ 'getExecutableName',
2052
+ 'listenOnce',
2053
+ 'autoResumeAudioContext',
2054
+ 'dynCallLegacy',
2055
+ 'getDynCaller',
2056
+ 'dynCall',
2057
+ 'asmjsMangle',
2058
+ 'asyncLoad',
2059
+ 'mmapAlloc',
2060
+ 'HandleAllocator',
2061
+ 'getNativeTypeSize',
2062
+ 'STACK_SIZE',
2063
+ 'STACK_ALIGN',
2064
+ 'POINTER_SIZE',
2065
+ 'ASSERTIONS',
2066
+ 'uleb128Encode',
2067
+ 'generateFuncType',
2068
+ 'convertJsFunctionToWasm',
2069
+ 'getEmptyTableSlot',
2070
+ 'updateTableMap',
2071
+ 'getFunctionAddress',
2072
+ 'addFunction',
2073
+ 'removeFunction',
2074
+ 'reallyNegative',
2075
+ 'unSign',
2076
+ 'strLen',
2077
+ 'reSign',
2078
+ 'formatString',
2079
+ 'intArrayFromString',
2080
+ 'intArrayToString',
2081
+ 'AsciiToString',
2082
+ 'stringToAscii',
2083
+ 'UTF16ToString',
2084
+ 'stringToUTF16',
2085
+ 'lengthBytesUTF16',
2086
+ 'UTF32ToString',
2087
+ 'stringToUTF32',
2088
+ 'lengthBytesUTF32',
2089
+ 'stringToNewUTF8',
2090
+ 'registerKeyEventCallback',
2091
+ 'maybeCStringToJsString',
2092
+ 'findEventTarget',
2093
+ 'getBoundingClientRect',
2094
+ 'fillMouseEventData',
2095
+ 'registerMouseEventCallback',
2096
+ 'registerWheelEventCallback',
2097
+ 'registerUiEventCallback',
2098
+ 'registerFocusEventCallback',
2099
+ 'fillDeviceOrientationEventData',
2100
+ 'registerDeviceOrientationEventCallback',
2101
+ 'fillDeviceMotionEventData',
2102
+ 'registerDeviceMotionEventCallback',
2103
+ 'screenOrientation',
2104
+ 'fillOrientationChangeEventData',
2105
+ 'registerOrientationChangeEventCallback',
2106
+ 'fillFullscreenChangeEventData',
2107
+ 'registerFullscreenChangeEventCallback',
2108
+ 'JSEvents_requestFullscreen',
2109
+ 'JSEvents_resizeCanvasForFullscreen',
2110
+ 'registerRestoreOldStyle',
2111
+ 'hideEverythingExceptGivenElement',
2112
+ 'restoreHiddenElements',
2113
+ 'setLetterbox',
2114
+ 'softFullscreenResizeWebGLRenderTarget',
2115
+ 'doRequestFullscreen',
2116
+ 'fillPointerlockChangeEventData',
2117
+ 'registerPointerlockChangeEventCallback',
2118
+ 'registerPointerlockErrorEventCallback',
2119
+ 'requestPointerLock',
2120
+ 'fillVisibilityChangeEventData',
2121
+ 'registerVisibilityChangeEventCallback',
2122
+ 'registerTouchEventCallback',
2123
+ 'fillGamepadEventData',
2124
+ 'registerGamepadEventCallback',
2125
+ 'registerBeforeUnloadEventCallback',
2126
+ 'fillBatteryEventData',
2127
+ 'battery',
2128
+ 'registerBatteryEventCallback',
2129
+ 'setCanvasElementSize',
2130
+ 'getCanvasElementSize',
2131
+ 'jsStackTrace',
2132
+ 'getCallstack',
2133
+ 'convertPCtoSourceLocation',
2134
+ 'getEnvStrings',
2135
+ 'checkWasiClock',
2136
+ 'wasiRightsToMuslOFlags',
2137
+ 'wasiOFlagsToMuslOFlags',
2138
+ 'createDyncallWrapper',
2139
+ 'safeSetTimeout',
2140
+ 'setImmediateWrapped',
2141
+ 'clearImmediateWrapped',
2142
+ 'polyfillSetImmediate',
2143
+ 'getPromise',
2144
+ 'makePromise',
2145
+ 'idsToPromises',
2146
+ 'makePromiseCallback',
2147
+ 'Browser_asyncPrepareDataCounter',
2148
+ 'setMainLoop',
2149
+ 'arraySum',
2150
+ 'addDays',
2151
+ 'getSocketFromFD',
2152
+ 'getSocketAddress',
2153
+ 'FS_createPreloadedFile',
2154
+ 'FS_modeStringToFlags',
2155
+ 'FS_getMode',
2156
+ 'FS_stdin_getChar',
2157
+ 'FS_unlink',
2158
+ 'FS_createDataFile',
2159
+ 'FS_mkdirTree',
2160
+ '_setNetworkCallback',
2161
+ 'ALLOC_NORMAL',
2162
+ 'ALLOC_STACK',
2163
+ 'allocate',
2164
+ 'writeStringToMemory',
2165
+ 'writeAsciiToMemory',
2166
+ 'setErrNo',
2167
+ 'stackTrace',
2168
+ ];
2169
+ missingLibrarySymbols.forEach(missingLibrarySymbol)
2170
+
2171
+ var unexportedSymbols = [
2172
+ 'run',
2173
+ 'addOnPreRun',
2174
+ 'addOnInit',
2175
+ 'addOnPreMain',
2176
+ 'addOnExit',
2177
+ 'addOnPostRun',
2178
+ 'addRunDependency',
2179
+ 'removeRunDependency',
2180
+ 'out',
2181
+ 'err',
2182
+ 'callMain',
2183
+ 'abort',
2184
+ 'wasmMemory',
2185
+ 'wasmExports',
2186
+ 'writeStackCookie',
2187
+ 'checkStackCookie',
2188
+ 'convertI32PairToI53Checked',
2189
+ 'stackSave',
2190
+ 'stackRestore',
2191
+ 'stackAlloc',
2192
+ 'ptrToString',
2193
+ 'exitJS',
2194
+ 'getHeapMax',
2195
+ 'growMemory',
2196
+ 'ENV',
2197
+ 'ERRNO_CODES',
2198
+ 'DNS',
2199
+ 'Protocols',
2200
+ 'Sockets',
2201
+ 'timers',
2202
+ 'warnOnce',
2203
+ 'readEmAsmArgsArray',
2204
+ 'jstoi_s',
2205
+ 'handleException',
2206
+ 'keepRuntimeAlive',
2207
+ 'runtimeKeepalivePush',
2208
+ 'runtimeKeepalivePop',
2209
+ 'callUserCallback',
2210
+ 'maybeExit',
2211
+ 'alignMemory',
2212
+ 'wasmTable',
2213
+ 'noExitRuntime',
2214
+ 'getCFunc',
2215
+ 'ccall',
2216
+ 'sigToWasmTypes',
2217
+ 'freeTableIndexes',
2218
+ 'functionsInTableMap',
2219
+ 'setValue',
2220
+ 'getValue',
2221
+ 'PATH',
2222
+ 'PATH_FS',
2223
+ 'UTF8Decoder',
2224
+ 'UTF8ArrayToString',
2225
+ 'stringToUTF8Array',
2226
+ 'UTF16Decoder',
2227
+ 'stringToUTF8OnStack',
2228
+ 'writeArrayToMemory',
2229
+ 'JSEvents',
2230
+ 'specialHTMLTargets',
2231
+ 'findCanvasEventTarget',
2232
+ 'currentFullscreenStrategy',
2233
+ 'restoreOldWindowedStyle',
2234
+ 'UNWIND_CACHE',
2235
+ 'ExitStatus',
2236
+ 'flush_NO_FILESYSTEM',
2237
+ 'promiseMap',
2238
+ 'Browser',
2239
+ 'getPreloadedImageData__data',
2240
+ 'wget',
2241
+ 'MONTH_DAYS_REGULAR',
2242
+ 'MONTH_DAYS_LEAP',
2243
+ 'MONTH_DAYS_REGULAR_CUMULATIVE',
2244
+ 'MONTH_DAYS_LEAP_CUMULATIVE',
2245
+ 'isLeapYear',
2246
+ 'ydayFromDate',
2247
+ 'SYSCALLS',
2248
+ 'preloadPlugins',
2249
+ 'FS_stdin_getChar_buffer',
2250
+ 'FS_createPath',
2251
+ 'FS_createDevice',
2252
+ 'FS_readFile',
2253
+ 'FS',
2254
+ 'FS_createLazyFile',
2255
+ 'MEMFS',
2256
+ 'TTY',
2257
+ 'PIPEFS',
2258
+ 'SOCKFS',
2259
+ 'runAndAbortIfError',
2260
+ 'Asyncify',
2261
+ 'Fibers',
2262
+ 'allocateUTF8',
2263
+ 'allocateUTF8OnStack',
2264
+ 'print',
2265
+ 'printErr',
2266
+ ];
2267
+ unexportedSymbols.forEach(unexportedRuntimeSymbol);
2268
+
2269
+
2270
+
2271
+ var calledRun;
2272
+
2273
+ dependenciesFulfilled = function runCaller() {
2274
+ // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false)
2275
+ if (!calledRun) run();
2276
+ if (!calledRun) dependenciesFulfilled = runCaller; // try this again later, after new deps are fulfilled
2277
+ };
2278
+
2279
+ function stackCheckInit() {
2280
+ // This is normally called automatically during __wasm_call_ctors but need to
2281
+ // get these values before even running any of the ctors so we call it redundantly
2282
+ // here.
2283
+ _emscripten_stack_init();
2284
+ // TODO(sbc): Move writeStackCookie to native to to avoid this.
2285
+ writeStackCookie();
2286
+ }
2287
+
2288
+ function run() {
2289
+
2290
+ if (runDependencies > 0) {
2291
+ return;
2292
+ }
2293
+
2294
+ stackCheckInit();
2295
+
2296
+ preRun();
2297
+
2298
+ // a preRun added a dependency, run will be called later
2299
+ if (runDependencies > 0) {
2300
+ return;
2301
+ }
2302
+
2303
+ function doRun() {
2304
+ // run may have just been called through dependencies being fulfilled just in this very frame,
2305
+ // or while the async setStatus time below was happening
2306
+ if (calledRun) return;
2307
+ calledRun = true;
2308
+ Module['calledRun'] = true;
2309
+
2310
+ if (ABORT) return;
2311
+
2312
+ initRuntime();
2313
+
2314
+ readyPromiseResolve(Module);
2315
+ Module['onRuntimeInitialized']?.();
2316
+
2317
+ assert(!Module['_main'], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]');
2318
+
2319
+ postRun();
2320
+ }
2321
+
2322
+ if (Module['setStatus']) {
2323
+ Module['setStatus']('Running...');
2324
+ setTimeout(function() {
2325
+ setTimeout(function() {
2326
+ Module['setStatus']('');
2327
+ }, 1);
2328
+ doRun();
2329
+ }, 1);
2330
+ } else
2331
+ {
2332
+ doRun();
2333
+ }
2334
+ checkStackCookie();
2335
+ }
2336
+
2337
+ function checkUnflushedContent() {
2338
+ // Compiler settings do not allow exiting the runtime, so flushing
2339
+ // the streams is not possible. but in ASSERTIONS mode we check
2340
+ // if there was something to flush, and if so tell the user they
2341
+ // should request that the runtime be exitable.
2342
+ // Normally we would not even include flush() at all, but in ASSERTIONS
2343
+ // builds we do so just for this check, and here we see if there is any
2344
+ // content to flush, that is, we check if there would have been
2345
+ // something a non-ASSERTIONS build would have not seen.
2346
+ // How we flush the streams depends on whether we are in SYSCALLS_REQUIRE_FILESYSTEM=0
2347
+ // mode (which has its own special function for this; otherwise, all
2348
+ // the code is inside libc)
2349
+ var oldOut = out;
2350
+ var oldErr = err;
2351
+ var has = false;
2352
+ out = err = (x) => {
2353
+ has = true;
2354
+ }
2355
+ try { // it doesn't matter if it fails
2356
+ flush_NO_FILESYSTEM();
2357
+ } catch(e) {}
2358
+ out = oldOut;
2359
+ err = oldErr;
2360
+ if (has) {
2361
+ warnOnce('stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.');
2362
+ warnOnce('(this may also be due to not including full filesystem support - try building with -sFORCE_FILESYSTEM)');
2363
+ }
2364
+ }
2365
+
2366
+ if (Module['preInit']) {
2367
+ if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']];
2368
+ while (Module['preInit'].length > 0) {
2369
+ Module['preInit'].pop()();
2370
+ }
2371
+ }
2372
+
2373
+ run();
2374
+
2375
+ // end include: postamble.js
2376
+
2377
+ // include: postamble_modularize.js
2378
+ // In MODULARIZE mode we wrap the generated code in a factory function
2379
+ // and return either the Module itself, or a promise of the module.
2380
+ //
2381
+ // We assign to the `moduleRtn` global here and configure closure to see
2382
+ // this as and extern so it won't get minified.
2383
+
2384
+ moduleRtn = readyPromise;
2385
+
2386
+ // Assertion for attempting to access module properties on the incoming
2387
+ // moduleArg. In the past we used this object as the prototype of the module
2388
+ // and assigned properties to it, but now we return a distinct object. This
2389
+ // keeps the instance private until it is ready (i.e the promise has been
2390
+ // resolved).
2391
+ for (const prop of Object.keys(Module)) {
2392
+ if (!(prop in moduleArg)) {
2393
+ Object.defineProperty(moduleArg, prop, {
2394
+ configurable: true,
2395
+ get() {
2396
+ abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)
2397
+ }
2398
+ });
2399
+ }
2400
+ }
2401
+ // end include: postamble_modularize.js
2402
+
2403
+
2404
+
2405
+ return moduleRtn;
2406
+ }
2407
+ );
2408
+ })();
2409
+ if (typeof exports === 'object' && typeof module === 'object')
2410
+ module.exports = QuickJSRaw;
2411
+ else if (typeof define === 'function' && define['amd'])
2412
+ define([], () => QuickJSRaw);