Capycap commited on
Commit
6c810d1
·
verified ·
1 Parent(s): e1ea30c

Upload game.js with huggingface_hub

Browse files
Files changed (1) hide show
  1. game.js +2009 -0
game.js ADDED
@@ -0,0 +1,2009 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // This code implements the `-sMODULARIZE` settings by taking the generated
2
+ // JS program code (INNER_JS_CODE) and wrapping it in a factory function.
3
+
4
+ // Single threaded MINIMAL_RUNTIME programs do not need access to
5
+ // document.currentScript, so a simple export declaration is enough.
6
+ var createGameModule = (() => {
7
+ // When MODULARIZE this JS may be executed later,
8
+ // after document.currentScript is gone, so we save it.
9
+ // In EXPORT_ES6 mode we can just use 'import.meta.url'.
10
+ var _scriptName = globalThis.document?.currentScript?.src;
11
+ return async function(moduleArg = {}) {
12
+ var moduleRtn;
13
+
14
+ // include: shell.js
15
+ // include: minimum_runtime_check.js
16
+ (function() {
17
+ // "30.0.0" -> 300000
18
+ function humanReadableVersionToPacked(str) {
19
+ str = str.split('-')[0]; // Remove any trailing part from e.g. "12.53.3-alpha"
20
+ var vers = str.split('.').slice(0, 3);
21
+ while(vers.length < 3) vers.push('00');
22
+ vers = vers.map((n, i, arr) => n.padStart(2, '0'));
23
+ return vers.join('');
24
+ }
25
+ // 300000 -> "30.0.0"
26
+ var packedVersionToHumanReadable = n => [n / 10000 | 0, (n / 100 | 0) % 100, n % 100].join('.');
27
+
28
+ var TARGET_NOT_SUPPORTED = 2147483647;
29
+
30
+ // Note: We use a typeof check here instead of optional chaining using
31
+ // globalThis because older browsers might not have globalThis defined.
32
+ var currentNodeVersion = typeof process !== 'undefined' && process.versions?.node ? humanReadableVersionToPacked(process.versions.node) : TARGET_NOT_SUPPORTED;
33
+ if (currentNodeVersion < 160000) {
34
+ throw new Error(`This emscripten-generated code requires node v${ packedVersionToHumanReadable(160000) } (detected v${packedVersionToHumanReadable(currentNodeVersion)})`);
35
+ }
36
+
37
+ var userAgent = typeof navigator !== 'undefined' && navigator.userAgent;
38
+ if (!userAgent) {
39
+ return;
40
+ }
41
+
42
+ var currentSafariVersion = userAgent.includes("Safari/") && userAgent.match(/Version\/(\d+\.?\d*\.?\d*)/) ? humanReadableVersionToPacked(userAgent.match(/Version\/(\d+\.?\d*\.?\d*)/)[1]) : TARGET_NOT_SUPPORTED;
43
+ if (currentSafariVersion < 150000) {
44
+ throw new Error(`This emscripten-generated code requires Safari v${ packedVersionToHumanReadable(150000) } (detected v${currentSafariVersion})`);
45
+ }
46
+
47
+ var currentFirefoxVersion = userAgent.match(/Firefox\/(\d+(?:\.\d+)?)/) ? parseFloat(userAgent.match(/Firefox\/(\d+(?:\.\d+)?)/)[1]) : TARGET_NOT_SUPPORTED;
48
+ if (currentFirefoxVersion < 79) {
49
+ throw new Error(`This emscripten-generated code requires Firefox v79 (detected v${currentFirefoxVersion})`);
50
+ }
51
+
52
+ var currentChromeVersion = userAgent.match(/Chrome\/(\d+(?:\.\d+)?)/) ? parseFloat(userAgent.match(/Chrome\/(\d+(?:\.\d+)?)/)[1]) : TARGET_NOT_SUPPORTED;
53
+ if (currentChromeVersion < 85) {
54
+ throw new Error(`This emscripten-generated code requires Chrome v85 (detected v${currentChromeVersion})`);
55
+ }
56
+ })();
57
+
58
+ // end include: minimum_runtime_check.js
59
+ // The Module object: Our interface to the outside world. We import
60
+ // and export values on it. There are various ways Module can be used:
61
+ // 1. Not defined. We create it here
62
+ // 2. A function parameter, function(moduleArg) => Promise<Module>
63
+ // 3. pre-run appended it, var Module = {}; ..generated code..
64
+ // 4. External script tag defines var Module.
65
+ // We need to check if Module already exists (e.g. case 3 above).
66
+ // Substitution will be replaced with actual code on later stage of the build,
67
+ // this way Closure Compiler will not mangle it (e.g. case 4. above).
68
+ // Note that if you want to run closure, and also to use Module
69
+ // after the generated code, you will need to define var Module = {};
70
+ // before the code. Then that object will be used in the code, and you
71
+ // can continue to use Module afterwards as well.
72
+ var Module = moduleArg;
73
+
74
+ // Determine the runtime environment we are in. You can customize this by
75
+ // setting the ENVIRONMENT setting at compile time (see settings.js).
76
+
77
+ // Attempt to auto-detect the environment
78
+ var ENVIRONMENT_IS_WEB = !!globalThis.window;
79
+ var ENVIRONMENT_IS_WORKER = !!globalThis.WorkerGlobalScope;
80
+ // N.b. Electron.js environment is simultaneously a NODE-environment, but
81
+ // also a web environment.
82
+ var ENVIRONMENT_IS_NODE = globalThis.process?.versions?.node && globalThis.process?.type != 'renderer';
83
+ var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
84
+
85
+ // --pre-jses are emitted after the Module integration code, so that they can
86
+ // refer to Module (if they choose; they can also define Module)
87
+
88
+
89
+ var arguments_ = [];
90
+ var thisProgram = './this.program';
91
+ var quit_ = (status, toThrow) => {
92
+ throw toThrow;
93
+ };
94
+
95
+ if (typeof __filename != 'undefined') { // Node
96
+ _scriptName = __filename;
97
+ } else
98
+ if (ENVIRONMENT_IS_WORKER) {
99
+ _scriptName = self.location.href;
100
+ }
101
+
102
+ // `/` should be present at the end if `scriptDirectory` is not empty
103
+ var scriptDirectory = '';
104
+ function locateFile(path) {
105
+ if (Module['locateFile']) {
106
+ return Module['locateFile'](path, scriptDirectory);
107
+ }
108
+ return scriptDirectory + path;
109
+ }
110
+
111
+ // Hooks that are implemented differently in different runtime environments.
112
+ var readAsync, readBinary;
113
+
114
+ if (ENVIRONMENT_IS_NODE) {
115
+ const isNode = globalThis.process?.versions?.node && globalThis.process?.type != 'renderer';
116
+ if (!isNode) 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?)');
117
+
118
+ // These modules will usually be used on Node.js. Load them eagerly to avoid
119
+ // the complexity of lazy-loading.
120
+ var fs = require('fs');
121
+
122
+ scriptDirectory = __dirname + '/';
123
+
124
+ // include: node_shell_read.js
125
+ readBinary = (filename) => {
126
+ // We need to re-wrap `file://` strings to URLs.
127
+ filename = isFileURI(filename) ? new URL(filename) : filename;
128
+ var ret = fs.readFileSync(filename);
129
+ assert(Buffer.isBuffer(ret));
130
+ return ret;
131
+ };
132
+
133
+ readAsync = async (filename, binary = true) => {
134
+ // See the comment in the `readBinary` function.
135
+ filename = isFileURI(filename) ? new URL(filename) : filename;
136
+ var ret = fs.readFileSync(filename, binary ? undefined : 'utf8');
137
+ assert(binary ? Buffer.isBuffer(ret) : typeof ret == 'string');
138
+ return ret;
139
+ };
140
+ // end include: node_shell_read.js
141
+ if (process.argv.length > 1) {
142
+ thisProgram = process.argv[1].replace(/\\/g, '/');
143
+ }
144
+
145
+ arguments_ = process.argv.slice(2);
146
+
147
+ quit_ = (status, toThrow) => {
148
+ process.exitCode = status;
149
+ throw toThrow;
150
+ };
151
+
152
+ } else
153
+ if (ENVIRONMENT_IS_SHELL) {
154
+
155
+ } else
156
+
157
+ // Note that this includes Node.js workers when relevant (pthreads is enabled).
158
+ // Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
159
+ // ENVIRONMENT_IS_NODE.
160
+ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
161
+ try {
162
+ scriptDirectory = new URL('.', _scriptName).href; // includes trailing slash
163
+ } catch {
164
+ // Must be a `blob:` or `data:` URL (e.g. `blob:http://site.com/etc/etc`), we cannot
165
+ // infer anything from them.
166
+ }
167
+
168
+ if (!(globalThis.window || globalThis.WorkerGlobalScope)) 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?)');
169
+
170
+ {
171
+ // include: web_or_worker_shell_read.js
172
+ if (ENVIRONMENT_IS_WORKER) {
173
+ readBinary = (url) => {
174
+ var xhr = new XMLHttpRequest();
175
+ xhr.open('GET', url, false);
176
+ xhr.responseType = 'arraybuffer';
177
+ xhr.send(null);
178
+ return new Uint8Array(/** @type{!ArrayBuffer} */(xhr.response));
179
+ };
180
+ }
181
+
182
+ readAsync = async (url) => {
183
+ // Fetch has some additional restrictions over XHR, like it can't be used on a file:// url.
184
+ // See https://github.com/github/fetch/pull/92#issuecomment-140665932
185
+ // Cordova or Electron apps are typically loaded from a file:// url.
186
+ // So use XHR on webview if URL is a file URL.
187
+ if (isFileURI(url)) {
188
+ return new Promise((resolve, reject) => {
189
+ var xhr = new XMLHttpRequest();
190
+ xhr.open('GET', url, true);
191
+ xhr.responseType = 'arraybuffer';
192
+ xhr.onload = () => {
193
+ if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
194
+ resolve(xhr.response);
195
+ return;
196
+ }
197
+ reject(xhr.status);
198
+ };
199
+ xhr.onerror = reject;
200
+ xhr.send(null);
201
+ });
202
+ }
203
+ var response = await fetch(url, { credentials: 'same-origin' });
204
+ if (response.ok) {
205
+ return response.arrayBuffer();
206
+ }
207
+ throw new Error(response.status + ' : ' + response.url);
208
+ };
209
+ // end include: web_or_worker_shell_read.js
210
+ }
211
+ } else
212
+ {
213
+ throw new Error('environment detection error');
214
+ }
215
+
216
+ var out = console.log.bind(console);
217
+ var err = console.error.bind(console);
218
+
219
+ var IDBFS = 'IDBFS is no longer included by default; build with -lidbfs.js';
220
+ var PROXYFS = 'PROXYFS is no longer included by default; build with -lproxyfs.js';
221
+ var WORKERFS = 'WORKERFS is no longer included by default; build with -lworkerfs.js';
222
+ var FETCHFS = 'FETCHFS is no longer included by default; build with -lfetchfs.js';
223
+ var ICASEFS = 'ICASEFS is no longer included by default; build with -licasefs.js';
224
+ var JSFILEFS = 'JSFILEFS is no longer included by default; build with -ljsfilefs.js';
225
+ var OPFS = 'OPFS is no longer included by default; build with -lopfs.js';
226
+
227
+ var NODEFS = 'NODEFS is no longer included by default; build with -lnodefs.js';
228
+
229
+ // perform assertions in shell.js after we set up out() and err(), as otherwise
230
+ // if an assertion fails it cannot print the message
231
+
232
+ assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.');
233
+
234
+ // end include: shell.js
235
+
236
+ // include: preamble.js
237
+ // === Preamble library stuff ===
238
+
239
+ // Documentation for the public APIs defined in this file must be updated in:
240
+ // site/source/docs/api_reference/preamble.js.rst
241
+ // A prebuilt local version of the documentation is available at:
242
+ // site/build/text/docs/api_reference/preamble.js.txt
243
+ // You can also build docs locally as HTML or other formats in site/
244
+ // An online HTML version (which may be of a different version of Emscripten)
245
+ // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
246
+
247
+ var wasmBinary;
248
+
249
+ if (!globalThis.WebAssembly) {
250
+ err('no native wasm support detected');
251
+ }
252
+
253
+ // Wasm globals
254
+
255
+ //========================================
256
+ // Runtime essentials
257
+ //========================================
258
+
259
+ // whether we are quitting the application. no code should run after this.
260
+ // set in exit() and abort()
261
+ var ABORT = false;
262
+
263
+ // set by exit() and abort(). Passed to 'onExit' handler.
264
+ // NOTE: This is also used as the process return code code in shell environments
265
+ // but only when noExitRuntime is false.
266
+ var EXITSTATUS;
267
+
268
+ // In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we
269
+ // don't define it at all in release modes. This matches the behaviour of
270
+ // MINIMAL_RUNTIME.
271
+ // TODO(sbc): Make this the default even without STRICT enabled.
272
+ /** @type {function(*, string=)} */
273
+ function assert(condition, text) {
274
+ if (!condition) {
275
+ abort('Assertion failed' + (text ? ': ' + text : ''));
276
+ }
277
+ }
278
+
279
+ // We used to include malloc/free by default in the past. Show a helpful error in
280
+ // builds with assertions.
281
+
282
+ /**
283
+ * Indicates whether filename is delivered via file protocol (as opposed to http/https)
284
+ * @noinline
285
+ */
286
+ var isFileURI = (filename) => filename.startsWith('file://');
287
+
288
+ // include: runtime_common.js
289
+ // include: runtime_stack_check.js
290
+ // Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.
291
+ function writeStackCookie() {
292
+ var max = _emscripten_stack_get_end();
293
+ assert((max & 3) == 0);
294
+ // If the stack ends at address zero we write our cookies 4 bytes into the
295
+ // stack. This prevents interference with SAFE_HEAP and ASAN which also
296
+ // monitor writes to address zero.
297
+ if (max == 0) {
298
+ max += 4;
299
+ }
300
+ // The stack grow downwards towards _emscripten_stack_get_end.
301
+ // We write cookies to the final two words in the stack and detect if they are
302
+ // ever overwritten.
303
+ HEAPU32[((max)>>2)] = 0x02135467;
304
+ HEAPU32[(((max)+(4))>>2)] = 0x89BACDFE;
305
+ // Also test the global address 0 for integrity.
306
+ HEAPU32[((0)>>2)] = 1668509029;
307
+ }
308
+
309
+ function checkStackCookie() {
310
+ if (ABORT) return;
311
+ var max = _emscripten_stack_get_end();
312
+ // See writeStackCookie().
313
+ if (max == 0) {
314
+ max += 4;
315
+ }
316
+ var cookie1 = HEAPU32[((max)>>2)];
317
+ var cookie2 = HEAPU32[(((max)+(4))>>2)];
318
+ if (cookie1 != 0x02135467 || cookie2 != 0x89BACDFE) {
319
+ abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);
320
+ }
321
+ // Also test the global address 0 for integrity.
322
+ if (HEAPU32[((0)>>2)] != 0x63736d65 /* 'emsc' */) {
323
+ abort('Runtime error: The application has corrupted its heap memory area (address zero)!');
324
+ }
325
+ }
326
+ // end include: runtime_stack_check.js
327
+ // include: runtime_exceptions.js
328
+ // end include: runtime_exceptions.js
329
+ // include: runtime_debug.js
330
+ var runtimeDebug = true; // Switch to false at runtime to disable logging at the right times
331
+
332
+ // Used by XXXXX_DEBUG settings to output debug messages.
333
+ function dbg(...args) {
334
+ if (!runtimeDebug && typeof runtimeDebug != 'undefined') return;
335
+ // TODO(sbc): Make this configurable somehow. Its not always convenient for
336
+ // logging to show up as warnings.
337
+ console.warn(...args);
338
+ }
339
+
340
+ // Endianness check
341
+ (() => {
342
+ var h16 = new Int16Array(1);
343
+ var h8 = new Int8Array(h16.buffer);
344
+ h16[0] = 0x6373;
345
+ if (h8[0] !== 0x73 || h8[1] !== 0x63) abort('Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)');
346
+ })();
347
+
348
+ function consumedModuleProp(prop) {
349
+ if (!Object.getOwnPropertyDescriptor(Module, prop)) {
350
+ Object.defineProperty(Module, prop, {
351
+ configurable: true,
352
+ set() {
353
+ abort(`Attempt to set \`Module.${prop}\` after it has already been processed. This can happen, for example, when code is injected via '--post-js' rather than '--pre-js'`);
354
+
355
+ }
356
+ });
357
+ }
358
+ }
359
+
360
+ function makeInvalidEarlyAccess(name) {
361
+ return () => assert(false, `call to '${name}' via reference taken before Wasm module initialization`);
362
+
363
+ }
364
+
365
+ function ignoredModuleProp(prop) {
366
+ if (Object.getOwnPropertyDescriptor(Module, prop)) {
367
+ abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`);
368
+ }
369
+ }
370
+
371
+ // forcing the filesystem exports a few things by default
372
+ function isExportedByForceFilesystem(name) {
373
+ return name === 'FS_createPath' ||
374
+ name === 'FS_createDataFile' ||
375
+ name === 'FS_createPreloadedFile' ||
376
+ name === 'FS_preloadFile' ||
377
+ name === 'FS_unlink' ||
378
+ name === 'addRunDependency' ||
379
+ // The old FS has some functionality that WasmFS lacks.
380
+ name === 'FS_createLazyFile' ||
381
+ name === 'FS_createDevice' ||
382
+ name === 'removeRunDependency';
383
+ }
384
+
385
+ function missingLibrarySymbol(sym) {
386
+
387
+ // Any symbol that is not included from the JS library is also (by definition)
388
+ // not exported on the Module object.
389
+ unexportedRuntimeSymbol(sym);
390
+ }
391
+
392
+ function unexportedRuntimeSymbol(sym) {
393
+ if (!Object.getOwnPropertyDescriptor(Module, sym)) {
394
+ Object.defineProperty(Module, sym, {
395
+ configurable: true,
396
+ get() {
397
+ var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
398
+ if (isExportedByForceFilesystem(sym)) {
399
+ msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
400
+ }
401
+ abort(msg);
402
+ },
403
+ });
404
+ }
405
+ }
406
+
407
+ // end include: runtime_debug.js
408
+ var readyPromiseResolve, readyPromiseReject;
409
+
410
+ // Memory management
411
+ var
412
+ /** @type {!Int8Array} */
413
+ HEAP8,
414
+ /** @type {!Uint8Array} */
415
+ HEAPU8,
416
+ /** @type {!Int16Array} */
417
+ HEAP16,
418
+ /** @type {!Uint16Array} */
419
+ HEAPU16,
420
+ /** @type {!Int32Array} */
421
+ HEAP32,
422
+ /** @type {!Uint32Array} */
423
+ HEAPU32,
424
+ /** @type {!Float32Array} */
425
+ HEAPF32,
426
+ /** @type {!Float64Array} */
427
+ HEAPF64;
428
+
429
+ // BigInt64Array type is not correctly defined in closure
430
+ var
431
+ /** not-@type {!BigInt64Array} */
432
+ HEAP64,
433
+ /* BigUint64Array type is not correctly defined in closure
434
+ /** not-@type {!BigUint64Array} */
435
+ HEAPU64;
436
+
437
+ var runtimeInitialized = false;
438
+
439
+
440
+
441
+ function updateMemoryViews() {
442
+ var b = wasmMemory.buffer;
443
+ HEAP8 = new Int8Array(b);
444
+ HEAP16 = new Int16Array(b);
445
+ Module['HEAPU8'] = HEAPU8 = new Uint8Array(b);
446
+ HEAPU16 = new Uint16Array(b);
447
+ HEAP32 = new Int32Array(b);
448
+ Module['HEAPU32'] = HEAPU32 = new Uint32Array(b);
449
+ Module['HEAPF32'] = HEAPF32 = new Float32Array(b);
450
+ HEAPF64 = new Float64Array(b);
451
+ HEAP64 = new BigInt64Array(b);
452
+ HEAPU64 = new BigUint64Array(b);
453
+ }
454
+
455
+ // include: memoryprofiler.js
456
+ // end include: memoryprofiler.js
457
+ // end include: runtime_common.js
458
+ assert(globalThis.Int32Array && globalThis.Float64Array && Int32Array.prototype.subarray && Int32Array.prototype.set,
459
+ 'JS engine does not provide full typed array support');
460
+
461
+ function preRun() {
462
+ if (Module['preRun']) {
463
+ if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
464
+ while (Module['preRun'].length) {
465
+ addOnPreRun(Module['preRun'].shift());
466
+ }
467
+ }
468
+ consumedModuleProp('preRun');
469
+ // Begin ATPRERUNS hooks
470
+ callRuntimeCallbacks(onPreRuns);
471
+ // End ATPRERUNS hooks
472
+ }
473
+
474
+ function initRuntime() {
475
+ assert(!runtimeInitialized);
476
+ runtimeInitialized = true;
477
+
478
+ checkStackCookie();
479
+
480
+ // No ATINITS hooks
481
+
482
+ wasmExports['__wasm_call_ctors']();
483
+
484
+ // No ATPOSTCTORS hooks
485
+ }
486
+
487
+ function postRun() {
488
+ checkStackCookie();
489
+ // PThreads reuse the runtime from the main thread.
490
+
491
+ if (Module['postRun']) {
492
+ if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']];
493
+ while (Module['postRun'].length) {
494
+ addOnPostRun(Module['postRun'].shift());
495
+ }
496
+ }
497
+ consumedModuleProp('postRun');
498
+
499
+ // Begin ATPOSTRUNS hooks
500
+ callRuntimeCallbacks(onPostRuns);
501
+ // End ATPOSTRUNS hooks
502
+ }
503
+
504
+ /** @param {string|number=} what */
505
+ function abort(what) {
506
+ Module['onAbort']?.(what);
507
+
508
+ what = 'Aborted(' + what + ')';
509
+ // TODO(sbc): Should we remove printing and leave it up to whoever
510
+ // catches the exception?
511
+ err(what);
512
+
513
+ ABORT = true;
514
+
515
+ // Use a wasm runtime error, because a JS error might be seen as a foreign
516
+ // exception, which means we'd run destructors on it. We need the error to
517
+ // simply make the program stop.
518
+ // FIXME This approach does not work in Wasm EH because it currently does not assume
519
+ // all RuntimeErrors are from traps; it decides whether a RuntimeError is from
520
+ // a trap or not based on a hidden field within the object. So at the moment
521
+ // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that
522
+ // allows this in the wasm spec.
523
+
524
+ // Suppress closure compiler warning here. Closure compiler's builtin extern
525
+ // definition for WebAssembly.RuntimeError claims it takes no arguments even
526
+ // though it can.
527
+ // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
528
+ /** @suppress {checkTypes} */
529
+ var e = new WebAssembly.RuntimeError(what);
530
+
531
+ readyPromiseReject?.(e);
532
+ // Throw the error whether or not MODULARIZE is set because abort is used
533
+ // in code paths apart from instantiation where an exception is expected
534
+ // to be thrown when abort is called.
535
+ throw e;
536
+ }
537
+
538
+ // show errors on likely calls to FS when it was not included
539
+ var FS = {
540
+ error() {
541
+ 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');
542
+ },
543
+ init() { FS.error() },
544
+ createDataFile() { FS.error() },
545
+ createPreloadedFile() { FS.error() },
546
+ createLazyFile() { FS.error() },
547
+ open() { FS.error() },
548
+ mkdev() { FS.error() },
549
+ registerDevice() { FS.error() },
550
+ analyzePath() { FS.error() },
551
+
552
+ ErrnoError() { FS.error() },
553
+ };
554
+
555
+
556
+ function createExportWrapper(name, nargs) {
557
+ return (...args) => {
558
+ assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`);
559
+ var f = wasmExports[name];
560
+ assert(f, `exported native function \`${name}\` not found`);
561
+ // Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled.
562
+ assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`);
563
+ return f(...args);
564
+ };
565
+ }
566
+
567
+ var wasmBinaryFile;
568
+
569
+ function findWasmBinary() {
570
+ return locateFile('game.wasm');
571
+ }
572
+
573
+ function getBinarySync(file) {
574
+ if (file == wasmBinaryFile && wasmBinary) {
575
+ return new Uint8Array(wasmBinary);
576
+ }
577
+ if (readBinary) {
578
+ return readBinary(file);
579
+ }
580
+ // Throwing a plain string here, even though it not normally adviables since
581
+ // this gets turning into an `abort` in instantiateArrayBuffer.
582
+ throw 'both async and sync fetching of the wasm failed';
583
+ }
584
+
585
+ async function getWasmBinary(binaryFile) {
586
+ // If we don't have the binary yet, load it asynchronously using readAsync.
587
+ if (!wasmBinary) {
588
+ // Fetch the binary using readAsync
589
+ try {
590
+ var response = await readAsync(binaryFile);
591
+ return new Uint8Array(response);
592
+ } catch {
593
+ // Fall back to getBinarySync below;
594
+ }
595
+ }
596
+
597
+ // Otherwise, getBinarySync should be able to get it synchronously
598
+ return getBinarySync(binaryFile);
599
+ }
600
+
601
+ async function instantiateArrayBuffer(binaryFile, imports) {
602
+ try {
603
+ var binary = await getWasmBinary(binaryFile);
604
+ var instance = await WebAssembly.instantiate(binary, imports);
605
+ return instance;
606
+ } catch (reason) {
607
+ err(`failed to asynchronously prepare wasm: ${reason}`);
608
+
609
+ // Warn on some common problems.
610
+ if (isFileURI(binaryFile)) {
611
+ err(`warning: Loading from a file URI (${binaryFile}) 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`);
612
+ }
613
+ abort(reason);
614
+ }
615
+ }
616
+
617
+ async function instantiateAsync(binary, binaryFile, imports) {
618
+ if (!binary
619
+ // Don't use streaming for file:// delivered objects in a webview, fetch them synchronously.
620
+ && !isFileURI(binaryFile)
621
+ // Avoid instantiateStreaming() on Node.js environment for now, as while
622
+ // Node.js v18.1.0 implements it, it does not have a full fetch()
623
+ // implementation yet.
624
+ //
625
+ // Reference:
626
+ // https://github.com/emscripten-core/emscripten/pull/16917
627
+ && !ENVIRONMENT_IS_NODE
628
+ ) {
629
+ try {
630
+ var response = fetch(binaryFile, { credentials: 'same-origin' });
631
+ var instantiationResult = await WebAssembly.instantiateStreaming(response, imports);
632
+ return instantiationResult;
633
+ } catch (reason) {
634
+ // We expect the most common failure cause to be a bad MIME type for the binary,
635
+ // in which case falling back to ArrayBuffer instantiation should work.
636
+ err(`wasm streaming compile failed: ${reason}`);
637
+ err('falling back to ArrayBuffer instantiation');
638
+ // fall back of instantiateArrayBuffer below
639
+ };
640
+ }
641
+ return instantiateArrayBuffer(binaryFile, imports);
642
+ }
643
+
644
+ function getWasmImports() {
645
+ // prepare imports
646
+ var imports = {
647
+ 'env': wasmImports,
648
+ 'wasi_snapshot_preview1': wasmImports,
649
+ };
650
+ return imports;
651
+ }
652
+
653
+ // Create the wasm instance.
654
+ // Receives the wasm imports, returns the exports.
655
+ async function createWasm() {
656
+ // Load the wasm module and create an instance of using native support in the JS engine.
657
+ // handle a generated wasm instance, receiving its exports and
658
+ // performing other necessary setup
659
+ /** @param {WebAssembly.Module=} module*/
660
+ function receiveInstance(instance, module) {
661
+ wasmExports = instance.exports;
662
+
663
+ assignWasmExports(wasmExports);
664
+
665
+ updateMemoryViews();
666
+
667
+ return wasmExports;
668
+ }
669
+
670
+ // Prefer streaming instantiation if available.
671
+ // Async compilation can be confusing when an error on the page overwrites Module
672
+ // (for example, if the order of elements is wrong, and the one defining Module is
673
+ // later), so we save Module and check it later.
674
+ var trueModule = Module;
675
+ function receiveInstantiationResult(result) {
676
+ // 'result' is a ResultObject object which has both the module and instance.
677
+ // receiveInstance() will swap in the exports (to Module.asm) so they can be called
678
+ assert(Module === trueModule, 'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?');
679
+ trueModule = null;
680
+ // 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.
681
+ // When the regression is fixed, can restore the above PTHREADS-enabled path.
682
+ return receiveInstance(result['instance']);
683
+ }
684
+
685
+ var info = getWasmImports();
686
+
687
+ // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback
688
+ // to manually instantiate the Wasm module themselves. This allows pages to
689
+ // run the instantiation parallel to any other async startup actions they are
690
+ // performing.
691
+ // Also pthreads and wasm workers initialize the wasm instance through this
692
+ // path.
693
+ if (Module['instantiateWasm']) {
694
+ return new Promise((resolve, reject) => {
695
+ try {
696
+ Module['instantiateWasm'](info, (inst, mod) => {
697
+ resolve(receiveInstance(inst, mod));
698
+ });
699
+ } catch(e) {
700
+ err(`Module.instantiateWasm callback failed with error: ${e}`);
701
+ reject(e);
702
+ }
703
+ });
704
+ }
705
+
706
+ wasmBinaryFile ??= findWasmBinary();
707
+ var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info);
708
+ var exports = receiveInstantiationResult(result);
709
+ return exports;
710
+ }
711
+
712
+ // end include: preamble.js
713
+
714
+ // Begin JS library code
715
+
716
+
717
+ class ExitStatus {
718
+ name = 'ExitStatus';
719
+ constructor(status) {
720
+ this.message = `Program terminated with exit(${status})`;
721
+ this.status = status;
722
+ }
723
+ }
724
+
725
+ var callRuntimeCallbacks = (callbacks) => {
726
+ while (callbacks.length > 0) {
727
+ // Pass the module as the first argument.
728
+ callbacks.shift()(Module);
729
+ }
730
+ };
731
+ var onPostRuns = [];
732
+ var addOnPostRun = (cb) => onPostRuns.push(cb);
733
+
734
+ var onPreRuns = [];
735
+ var addOnPreRun = (cb) => onPreRuns.push(cb);
736
+
737
+
738
+
739
+ /**
740
+ * @param {number} ptr
741
+ * @param {string} type
742
+ */
743
+ function getValue(ptr, type = 'i8') {
744
+ if (type.endsWith('*')) type = '*';
745
+ switch (type) {
746
+ case 'i1': return HEAP8[ptr];
747
+ case 'i8': return HEAP8[ptr];
748
+ case 'i16': return HEAP16[((ptr)>>1)];
749
+ case 'i32': return HEAP32[((ptr)>>2)];
750
+ case 'i64': return HEAP64[((ptr)>>3)];
751
+ case 'float': return HEAPF32[((ptr)>>2)];
752
+ case 'double': return HEAPF64[((ptr)>>3)];
753
+ case '*': return HEAPU32[((ptr)>>2)];
754
+ default: abort(`invalid type for getValue: ${type}`);
755
+ }
756
+ }
757
+
758
+ var noExitRuntime = true;
759
+
760
+ var ptrToString = (ptr) => {
761
+ assert(typeof ptr === 'number', `ptrToString expects a number, got ${typeof ptr}`);
762
+ // Convert to 32-bit unsigned value
763
+ ptr >>>= 0;
764
+ return '0x' + ptr.toString(16).padStart(8, '0');
765
+ };
766
+
767
+
768
+ /**
769
+ * @param {number} ptr
770
+ * @param {number} value
771
+ * @param {string} type
772
+ */
773
+ function setValue(ptr, value, type = 'i8') {
774
+ if (type.endsWith('*')) type = '*';
775
+ switch (type) {
776
+ case 'i1': HEAP8[ptr] = value; break;
777
+ case 'i8': HEAP8[ptr] = value; break;
778
+ case 'i16': HEAP16[((ptr)>>1)] = value; break;
779
+ case 'i32': HEAP32[((ptr)>>2)] = value; break;
780
+ case 'i64': HEAP64[((ptr)>>3)] = BigInt(value); break;
781
+ case 'float': HEAPF32[((ptr)>>2)] = value; break;
782
+ case 'double': HEAPF64[((ptr)>>3)] = value; break;
783
+ case '*': HEAPU32[((ptr)>>2)] = value; break;
784
+ default: abort(`invalid type for setValue: ${type}`);
785
+ }
786
+ }
787
+
788
+ var stackRestore = (val) => __emscripten_stack_restore(val);
789
+
790
+ var stackSave = () => _emscripten_stack_get_current();
791
+
792
+ var warnOnce = (text) => {
793
+ warnOnce.shown ||= {};
794
+ if (!warnOnce.shown[text]) {
795
+ warnOnce.shown[text] = 1;
796
+ if (ENVIRONMENT_IS_NODE) text = 'warning: ' + text;
797
+ err(text);
798
+ }
799
+ };
800
+
801
+
802
+
803
+ var __abort_js = () =>
804
+ abort('native code called abort()');
805
+
806
+ var __emscripten_throw_longjmp = () => {
807
+ throw Infinity;
808
+ };
809
+
810
+ var _emscripten_get_now = () => performance.now();
811
+
812
+ var _emscripten_date_now = () => Date.now();
813
+
814
+ var nowIsMonotonic = 1;
815
+
816
+ var checkWasiClock = (clock_id) => clock_id >= 0 && clock_id <= 3;
817
+
818
+ var INT53_MAX = 9007199254740992;
819
+
820
+ var INT53_MIN = -9007199254740992;
821
+ var bigintToI53Checked = (num) => (num < INT53_MIN || num > INT53_MAX) ? NaN : Number(num);
822
+ function _clock_time_get(clk_id, ignored_precision, ptime) {
823
+ ignored_precision = bigintToI53Checked(ignored_precision);
824
+
825
+
826
+ if (!checkWasiClock(clk_id)) {
827
+ return 28;
828
+ }
829
+ var now;
830
+ // all wasi clocks but realtime are monotonic
831
+ if (clk_id === 0) {
832
+ now = _emscripten_date_now();
833
+ } else if (nowIsMonotonic) {
834
+ now = _emscripten_get_now();
835
+ } else {
836
+ return 52;
837
+ }
838
+ // "now" is in ms, and wasi times are in ns.
839
+ var nsec = Math.round(now * 1000 * 1000);
840
+ HEAP64[((ptime)>>3)] = BigInt(nsec);
841
+ return 0;
842
+ ;
843
+ }
844
+
845
+
846
+ var getHeapMax = () =>
847
+ // Stay one Wasm page short of 4GB: while e.g. Chrome is able to allocate
848
+ // full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side
849
+ // for any code that deals with heap sizes, which would require special
850
+ // casing all heap size related code to treat 0 specially.
851
+ 67108864;
852
+
853
+ var alignMemory = (size, alignment) => {
854
+ assert(alignment, "alignment argument is required");
855
+ return Math.ceil(size / alignment) * alignment;
856
+ };
857
+
858
+ var growMemory = (size) => {
859
+ var oldHeapSize = wasmMemory.buffer.byteLength;
860
+ var pages = ((size - oldHeapSize + 65535) / 65536) | 0;
861
+ try {
862
+ // round size grow request up to wasm page size (fixed 64KB per spec)
863
+ wasmMemory.grow(pages); // .grow() takes a delta compared to the previous size
864
+ updateMemoryViews();
865
+ return 1 /*success*/;
866
+ } catch(e) {
867
+ err(`growMemory: Attempted to grow heap from ${oldHeapSize} bytes to ${size} bytes, but got error: ${e}`);
868
+ }
869
+ // implicit 0 return to save code size (caller will cast "undefined" into 0
870
+ // anyhow)
871
+ };
872
+ var _emscripten_resize_heap = (requestedSize) => {
873
+ var oldSize = HEAPU8.length;
874
+ // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned.
875
+ requestedSize >>>= 0;
876
+ // With multithreaded builds, races can happen (another thread might increase the size
877
+ // in between), so return a failure, and let the caller retry.
878
+ assert(requestedSize > oldSize);
879
+
880
+ // Memory resize rules:
881
+ // 1. Always increase heap size to at least the requested size, rounded up
882
+ // to next page multiple.
883
+ // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap
884
+ // geometrically: increase the heap size according to
885
+ // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most
886
+ // overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB).
887
+ // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap
888
+ // linearly: increase the heap size by at least
889
+ // MEMORY_GROWTH_LINEAR_STEP bytes.
890
+ // 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by
891
+ // MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest
892
+ // 4. If we were unable to allocate as much memory, it may be due to
893
+ // over-eager decision to excessively reserve due to (3) above.
894
+ // Hence if an allocation fails, cut down on the amount of excess
895
+ // growth, in an attempt to succeed to perform a smaller allocation.
896
+
897
+ // A limit is set for how much we can grow. We should not exceed that
898
+ // (the wasm binary specifies it, so if we tried, we'd fail anyhow).
899
+ var maxHeapSize = getHeapMax();
900
+ if (requestedSize > maxHeapSize) {
901
+ err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`);
902
+ return false;
903
+ }
904
+
905
+ // Loop through potential heap size increases. If we attempt a too eager
906
+ // reservation that fails, cut down on the attempted size and reserve a
907
+ // smaller bump instead. (max 3 times, chosen somewhat arbitrarily)
908
+ for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
909
+ var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); // ensure geometric growth
910
+ // but limit overreserving (default to capping at +96MB overgrowth at most)
911
+ overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296 );
912
+
913
+ var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
914
+
915
+ var replacement = growMemory(newSize);
916
+ if (replacement) {
917
+
918
+ return true;
919
+ }
920
+ }
921
+ err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`);
922
+ return false;
923
+ };
924
+
925
+ var UTF8Decoder = globalThis.TextDecoder && new TextDecoder();
926
+
927
+ var findStringEnd = (heapOrArray, idx, maxBytesToRead, ignoreNul) => {
928
+ var maxIdx = idx + maxBytesToRead;
929
+ if (ignoreNul) return maxIdx;
930
+ // TextDecoder needs to know the byte length in advance, it doesn't stop on
931
+ // null terminator by itself.
932
+ // As a tiny code save trick, compare idx against maxIdx using a negation,
933
+ // so that maxBytesToRead=undefined/NaN means Infinity.
934
+ while (heapOrArray[idx] && !(idx >= maxIdx)) ++idx;
935
+ return idx;
936
+ };
937
+
938
+
939
+ /**
940
+ * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given
941
+ * array that contains uint8 values, returns a copy of that string as a
942
+ * Javascript String object.
943
+ * heapOrArray is either a regular array, or a JavaScript typed array view.
944
+ * @param {number=} idx
945
+ * @param {number=} maxBytesToRead
946
+ * @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
947
+ * @return {string}
948
+ */
949
+ var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead, ignoreNul) => {
950
+
951
+ var endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul);
952
+
953
+ // When using conditional TextDecoder, skip it for short strings as the overhead of the native call is not worth it.
954
+ if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
955
+ return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
956
+ }
957
+ var str = '';
958
+ while (idx < endPtr) {
959
+ // For UTF8 byte structure, see:
960
+ // http://en.wikipedia.org/wiki/UTF-8#Description
961
+ // https://www.ietf.org/rfc/rfc2279.txt
962
+ // https://tools.ietf.org/html/rfc3629
963
+ var u0 = heapOrArray[idx++];
964
+ if (!(u0 & 0x80)) { str += String.fromCharCode(u0); continue; }
965
+ var u1 = heapOrArray[idx++] & 63;
966
+ if ((u0 & 0xE0) == 0xC0) { str += String.fromCharCode(((u0 & 31) << 6) | u1); continue; }
967
+ var u2 = heapOrArray[idx++] & 63;
968
+ if ((u0 & 0xF0) == 0xE0) {
969
+ u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
970
+ } else {
971
+ 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!');
972
+ u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
973
+ }
974
+
975
+ if (u0 < 0x10000) {
976
+ str += String.fromCharCode(u0);
977
+ } else {
978
+ var ch = u0 - 0x10000;
979
+ str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF));
980
+ }
981
+ }
982
+ return str;
983
+ };
984
+
985
+ /**
986
+ * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
987
+ * emscripten HEAP, returns a copy of that string as a Javascript String object.
988
+ *
989
+ * @param {number} ptr
990
+ * @param {number=} maxBytesToRead - An optional length that specifies the
991
+ * maximum number of bytes to read. You can omit this parameter to scan the
992
+ * string until the first 0 byte. If maxBytesToRead is passed, and the string
993
+ * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
994
+ * string will cut short at that byte index.
995
+ * @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
996
+ * @return {string}
997
+ */
998
+ var UTF8ToString = (ptr, maxBytesToRead, ignoreNul) => {
999
+ assert(typeof ptr == 'number', `UTF8ToString expects a number (got ${typeof ptr})`);
1000
+ return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead, ignoreNul) : '';
1001
+ };
1002
+ var SYSCALLS = {
1003
+ varargs:undefined,
1004
+ getStr(ptr) {
1005
+ var ret = UTF8ToString(ptr);
1006
+ return ret;
1007
+ },
1008
+ };
1009
+ var _fd_close = (fd) => {
1010
+ abort('fd_close called without SYSCALLS_REQUIRE_FILESYSTEM');
1011
+ };
1012
+
1013
+ function _fd_seek(fd, offset, whence, newOffset) {
1014
+ offset = bigintToI53Checked(offset);
1015
+
1016
+
1017
+ return 70;
1018
+ ;
1019
+ }
1020
+
1021
+ var printCharBuffers = [null,[],[]];
1022
+
1023
+ var printChar = (stream, curr) => {
1024
+ var buffer = printCharBuffers[stream];
1025
+ assert(buffer);
1026
+ if (curr === 0 || curr === 10) {
1027
+ (stream === 1 ? out : err)(UTF8ArrayToString(buffer));
1028
+ buffer.length = 0;
1029
+ } else {
1030
+ buffer.push(curr);
1031
+ }
1032
+ };
1033
+
1034
+ var flush_NO_FILESYSTEM = () => {
1035
+ // flush anything remaining in the buffers during shutdown
1036
+ _fflush(0);
1037
+ if (printCharBuffers[1].length) printChar(1, 10);
1038
+ if (printCharBuffers[2].length) printChar(2, 10);
1039
+ };
1040
+
1041
+
1042
+ var _fd_write = (fd, iov, iovcnt, pnum) => {
1043
+ // hack to support printf in SYSCALLS_REQUIRE_FILESYSTEM=0
1044
+ var num = 0;
1045
+ for (var i = 0; i < iovcnt; i++) {
1046
+ var ptr = HEAPU32[((iov)>>2)];
1047
+ var len = HEAPU32[(((iov)+(4))>>2)];
1048
+ iov += 8;
1049
+ for (var j = 0; j < len; j++) {
1050
+ printChar(fd, HEAPU8[ptr+j]);
1051
+ }
1052
+ num += len;
1053
+ }
1054
+ HEAPU32[((pnum)>>2)] = num;
1055
+ return 0;
1056
+ };
1057
+
1058
+ var wasmTableMirror = [];
1059
+
1060
+
1061
+ var getWasmTableEntry = (funcPtr) => {
1062
+ var func = wasmTableMirror[funcPtr];
1063
+ if (!func) {
1064
+ /** @suppress {checkTypes} */
1065
+ wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
1066
+ }
1067
+ /** @suppress {checkTypes} */
1068
+ assert(wasmTable.get(funcPtr) == func, 'JavaScript-side Wasm function table mirror is out of date!');
1069
+ return func;
1070
+ };
1071
+
1072
+ var getCFunc = (ident) => {
1073
+ var func = Module['_' + ident]; // closure exported function
1074
+ assert(func, 'Cannot call unknown function ' + ident + ', make sure it is exported');
1075
+ return func;
1076
+ };
1077
+
1078
+ var writeArrayToMemory = (array, buffer) => {
1079
+ assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)')
1080
+ HEAP8.set(array, buffer);
1081
+ };
1082
+
1083
+ var lengthBytesUTF8 = (str) => {
1084
+ var len = 0;
1085
+ for (var i = 0; i < str.length; ++i) {
1086
+ // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
1087
+ // unit, not a Unicode code point of the character! So decode
1088
+ // UTF16->UTF32->UTF8.
1089
+ // See http://unicode.org/faq/utf_bom.html#utf16-3
1090
+ var c = str.charCodeAt(i); // possibly a lead surrogate
1091
+ if (c <= 0x7F) {
1092
+ len++;
1093
+ } else if (c <= 0x7FF) {
1094
+ len += 2;
1095
+ } else if (c >= 0xD800 && c <= 0xDFFF) {
1096
+ len += 4; ++i;
1097
+ } else {
1098
+ len += 3;
1099
+ }
1100
+ }
1101
+ return len;
1102
+ };
1103
+
1104
+ var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
1105
+ assert(typeof str === 'string', `stringToUTF8Array expects a string (got ${typeof str})`);
1106
+ // Parameter maxBytesToWrite is not optional. Negative values, 0, null,
1107
+ // undefined and false each don't write out any bytes.
1108
+ if (!(maxBytesToWrite > 0))
1109
+ return 0;
1110
+
1111
+ var startIdx = outIdx;
1112
+ var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator.
1113
+ for (var i = 0; i < str.length; ++i) {
1114
+ // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description
1115
+ // and https://www.ietf.org/rfc/rfc2279.txt
1116
+ // and https://tools.ietf.org/html/rfc3629
1117
+ var u = str.codePointAt(i);
1118
+ if (u <= 0x7F) {
1119
+ if (outIdx >= endIdx) break;
1120
+ heap[outIdx++] = u;
1121
+ } else if (u <= 0x7FF) {
1122
+ if (outIdx + 1 >= endIdx) break;
1123
+ heap[outIdx++] = 0xC0 | (u >> 6);
1124
+ heap[outIdx++] = 0x80 | (u & 63);
1125
+ } else if (u <= 0xFFFF) {
1126
+ if (outIdx + 2 >= endIdx) break;
1127
+ heap[outIdx++] = 0xE0 | (u >> 12);
1128
+ heap[outIdx++] = 0x80 | ((u >> 6) & 63);
1129
+ heap[outIdx++] = 0x80 | (u & 63);
1130
+ } else {
1131
+ if (outIdx + 3 >= endIdx) break;
1132
+ 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).');
1133
+ heap[outIdx++] = 0xF0 | (u >> 18);
1134
+ heap[outIdx++] = 0x80 | ((u >> 12) & 63);
1135
+ heap[outIdx++] = 0x80 | ((u >> 6) & 63);
1136
+ heap[outIdx++] = 0x80 | (u & 63);
1137
+ // Gotcha: if codePoint is over 0xFFFF, it is represented as a surrogate pair in UTF-16.
1138
+ // We need to manually skip over the second code unit for correct iteration.
1139
+ i++;
1140
+ }
1141
+ }
1142
+ // Null-terminate the pointer to the buffer.
1143
+ heap[outIdx] = 0;
1144
+ return outIdx - startIdx;
1145
+ };
1146
+ var stringToUTF8 = (str, outPtr, maxBytesToWrite) => {
1147
+ assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
1148
+ return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
1149
+ };
1150
+
1151
+ var stackAlloc = (sz) => __emscripten_stack_alloc(sz);
1152
+ var stringToUTF8OnStack = (str) => {
1153
+ var size = lengthBytesUTF8(str) + 1;
1154
+ var ret = stackAlloc(size);
1155
+ stringToUTF8(str, ret, size);
1156
+ return ret;
1157
+ };
1158
+
1159
+
1160
+
1161
+
1162
+
1163
+ /**
1164
+ * @param {string|null=} returnType
1165
+ * @param {Array=} argTypes
1166
+ * @param {Array=} args
1167
+ * @param {Object=} opts
1168
+ */
1169
+ var ccall = (ident, returnType, argTypes, args, opts) => {
1170
+ // For fast lookup of conversion functions
1171
+ var toC = {
1172
+ 'string': (str) => {
1173
+ var ret = 0;
1174
+ if (str !== null && str !== undefined && str !== 0) { // null string
1175
+ ret = stringToUTF8OnStack(str);
1176
+ }
1177
+ return ret;
1178
+ },
1179
+ 'array': (arr) => {
1180
+ var ret = stackAlloc(arr.length);
1181
+ writeArrayToMemory(arr, ret);
1182
+ return ret;
1183
+ }
1184
+ };
1185
+
1186
+ function convertReturnValue(ret) {
1187
+ if (returnType === 'string') {
1188
+ return UTF8ToString(ret);
1189
+ }
1190
+ if (returnType === 'boolean') return Boolean(ret);
1191
+ return ret;
1192
+ }
1193
+
1194
+ var func = getCFunc(ident);
1195
+ var cArgs = [];
1196
+ var stack = 0;
1197
+ assert(returnType !== 'array', 'Return type should not be "array".');
1198
+ if (args) {
1199
+ for (var i = 0; i < args.length; i++) {
1200
+ var converter = toC[argTypes[i]];
1201
+ if (converter) {
1202
+ if (stack === 0) stack = stackSave();
1203
+ cArgs[i] = converter(args[i]);
1204
+ } else {
1205
+ cArgs[i] = args[i];
1206
+ }
1207
+ }
1208
+ }
1209
+ var ret = func(...cArgs);
1210
+ function onDone(ret) {
1211
+ if (stack !== 0) stackRestore(stack);
1212
+ return convertReturnValue(ret);
1213
+ }
1214
+
1215
+ ret = onDone(ret);
1216
+ return ret;
1217
+ };
1218
+
1219
+
1220
+ /**
1221
+ * @param {string=} returnType
1222
+ * @param {Array=} argTypes
1223
+ * @param {Object=} opts
1224
+ */
1225
+ var cwrap = (ident, returnType, argTypes, opts) => {
1226
+ return (...args) => ccall(ident, returnType, argTypes, args, opts);
1227
+ };
1228
+
1229
+
1230
+
1231
+
1232
+ // End JS library code
1233
+
1234
+ // include: postlibrary.js
1235
+ // This file is included after the automatically-generated JS library code
1236
+ // but before the wasm module is created.
1237
+
1238
+ {
1239
+
1240
+ // Begin ATMODULES hooks
1241
+ if (Module['noExitRuntime']) noExitRuntime = Module['noExitRuntime'];
1242
+ if (Module['print']) out = Module['print'];
1243
+ if (Module['printErr']) err = Module['printErr'];
1244
+ if (Module['wasmBinary']) wasmBinary = Module['wasmBinary'];
1245
+
1246
+ Module['FS_createDataFile'] = FS.createDataFile;
1247
+ Module['FS_createPreloadedFile'] = FS.createPreloadedFile;
1248
+
1249
+ // End ATMODULES hooks
1250
+
1251
+ checkIncomingModuleAPI();
1252
+
1253
+ if (Module['arguments']) arguments_ = Module['arguments'];
1254
+ if (Module['thisProgram']) thisProgram = Module['thisProgram'];
1255
+
1256
+ // Assertions on removed incoming Module JS APIs.
1257
+ assert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead');
1258
+ assert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead');
1259
+ assert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead');
1260
+ assert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead');
1261
+ assert(typeof Module['read'] == 'undefined', 'Module.read option was removed');
1262
+ assert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)');
1263
+ assert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)');
1264
+ assert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)');
1265
+ assert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY');
1266
+ assert(typeof Module['ENVIRONMENT'] == 'undefined', 'Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)');
1267
+ assert(typeof Module['STACK_SIZE'] == 'undefined', 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time')
1268
+ // If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY
1269
+ assert(typeof Module['wasmMemory'] == 'undefined', 'Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally');
1270
+ assert(typeof Module['INITIAL_MEMORY'] == 'undefined', 'Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically');
1271
+
1272
+ if (Module['preInit']) {
1273
+ if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']];
1274
+ while (Module['preInit'].length > 0) {
1275
+ Module['preInit'].shift()();
1276
+ }
1277
+ }
1278
+ consumedModuleProp('preInit');
1279
+ }
1280
+
1281
+ // Begin runtime exports
1282
+ Module['ccall'] = ccall;
1283
+ Module['cwrap'] = cwrap;
1284
+ Module['setValue'] = setValue;
1285
+ Module['getValue'] = getValue;
1286
+ Module['UTF8ToString'] = UTF8ToString;
1287
+ var missingLibrarySymbols = [
1288
+ 'writeI53ToI64',
1289
+ 'writeI53ToI64Clamped',
1290
+ 'writeI53ToI64Signaling',
1291
+ 'writeI53ToU64Clamped',
1292
+ 'writeI53ToU64Signaling',
1293
+ 'readI53FromI64',
1294
+ 'readI53FromU64',
1295
+ 'convertI32PairToI53',
1296
+ 'convertI32PairToI53Checked',
1297
+ 'convertU32PairToI53',
1298
+ 'getTempRet0',
1299
+ 'setTempRet0',
1300
+ 'createNamedFunction',
1301
+ 'zeroMemory',
1302
+ 'exitJS',
1303
+ 'withStackSave',
1304
+ 'strError',
1305
+ 'inetPton4',
1306
+ 'inetNtop4',
1307
+ 'inetPton6',
1308
+ 'inetNtop6',
1309
+ 'readSockaddr',
1310
+ 'writeSockaddr',
1311
+ 'readEmAsmArgs',
1312
+ 'jstoi_q',
1313
+ 'getExecutableName',
1314
+ 'autoResumeAudioContext',
1315
+ 'getDynCaller',
1316
+ 'dynCall',
1317
+ 'handleException',
1318
+ 'keepRuntimeAlive',
1319
+ 'runtimeKeepalivePush',
1320
+ 'runtimeKeepalivePop',
1321
+ 'callUserCallback',
1322
+ 'maybeExit',
1323
+ 'asyncLoad',
1324
+ 'asmjsMangle',
1325
+ 'mmapAlloc',
1326
+ 'HandleAllocator',
1327
+ 'getUniqueRunDependency',
1328
+ 'addRunDependency',
1329
+ 'removeRunDependency',
1330
+ 'addOnInit',
1331
+ 'addOnPostCtor',
1332
+ 'addOnPreMain',
1333
+ 'addOnExit',
1334
+ 'STACK_SIZE',
1335
+ 'STACK_ALIGN',
1336
+ 'POINTER_SIZE',
1337
+ 'ASSERTIONS',
1338
+ 'convertJsFunctionToWasm',
1339
+ 'getEmptyTableSlot',
1340
+ 'updateTableMap',
1341
+ 'getFunctionAddress',
1342
+ 'addFunction',
1343
+ 'removeFunction',
1344
+ 'intArrayFromString',
1345
+ 'intArrayToString',
1346
+ 'AsciiToString',
1347
+ 'stringToAscii',
1348
+ 'UTF16ToString',
1349
+ 'stringToUTF16',
1350
+ 'lengthBytesUTF16',
1351
+ 'UTF32ToString',
1352
+ 'stringToUTF32',
1353
+ 'lengthBytesUTF32',
1354
+ 'stringToNewUTF8',
1355
+ 'registerKeyEventCallback',
1356
+ 'maybeCStringToJsString',
1357
+ 'findEventTarget',
1358
+ 'getBoundingClientRect',
1359
+ 'fillMouseEventData',
1360
+ 'registerMouseEventCallback',
1361
+ 'registerWheelEventCallback',
1362
+ 'registerUiEventCallback',
1363
+ 'registerFocusEventCallback',
1364
+ 'fillDeviceOrientationEventData',
1365
+ 'registerDeviceOrientationEventCallback',
1366
+ 'fillDeviceMotionEventData',
1367
+ 'registerDeviceMotionEventCallback',
1368
+ 'screenOrientation',
1369
+ 'fillOrientationChangeEventData',
1370
+ 'registerOrientationChangeEventCallback',
1371
+ 'fillFullscreenChangeEventData',
1372
+ 'registerFullscreenChangeEventCallback',
1373
+ 'JSEvents_requestFullscreen',
1374
+ 'JSEvents_resizeCanvasForFullscreen',
1375
+ 'registerRestoreOldStyle',
1376
+ 'hideEverythingExceptGivenElement',
1377
+ 'restoreHiddenElements',
1378
+ 'setLetterbox',
1379
+ 'softFullscreenResizeWebGLRenderTarget',
1380
+ 'doRequestFullscreen',
1381
+ 'fillPointerlockChangeEventData',
1382
+ 'registerPointerlockChangeEventCallback',
1383
+ 'registerPointerlockErrorEventCallback',
1384
+ 'requestPointerLock',
1385
+ 'fillVisibilityChangeEventData',
1386
+ 'registerVisibilityChangeEventCallback',
1387
+ 'registerTouchEventCallback',
1388
+ 'fillGamepadEventData',
1389
+ 'registerGamepadEventCallback',
1390
+ 'registerBeforeUnloadEventCallback',
1391
+ 'fillBatteryEventData',
1392
+ 'registerBatteryEventCallback',
1393
+ 'setCanvasElementSize',
1394
+ 'getCanvasElementSize',
1395
+ 'jsStackTrace',
1396
+ 'getCallstack',
1397
+ 'convertPCtoSourceLocation',
1398
+ 'getEnvStrings',
1399
+ 'wasiRightsToMuslOFlags',
1400
+ 'wasiOFlagsToMuslOFlags',
1401
+ 'initRandomFill',
1402
+ 'randomFill',
1403
+ 'safeSetTimeout',
1404
+ 'setImmediateWrapped',
1405
+ 'safeRequestAnimationFrame',
1406
+ 'clearImmediateWrapped',
1407
+ 'registerPostMainLoop',
1408
+ 'registerPreMainLoop',
1409
+ 'getPromise',
1410
+ 'makePromise',
1411
+ 'idsToPromises',
1412
+ 'makePromiseCallback',
1413
+ 'ExceptionInfo',
1414
+ 'findMatchingCatch',
1415
+ 'Browser_asyncPrepareDataCounter',
1416
+ 'isLeapYear',
1417
+ 'ydayFromDate',
1418
+ 'arraySum',
1419
+ 'addDays',
1420
+ 'getSocketFromFD',
1421
+ 'getSocketAddress',
1422
+ 'FS_createPreloadedFile',
1423
+ 'FS_preloadFile',
1424
+ 'FS_modeStringToFlags',
1425
+ 'FS_getMode',
1426
+ 'FS_stdin_getChar',
1427
+ 'FS_mkdirTree',
1428
+ '_setNetworkCallback',
1429
+ 'heapObjectForWebGLType',
1430
+ 'toTypedArrayIndex',
1431
+ 'webgl_enable_ANGLE_instanced_arrays',
1432
+ 'webgl_enable_OES_vertex_array_object',
1433
+ 'webgl_enable_WEBGL_draw_buffers',
1434
+ 'webgl_enable_WEBGL_multi_draw',
1435
+ 'webgl_enable_EXT_polygon_offset_clamp',
1436
+ 'webgl_enable_EXT_clip_control',
1437
+ 'webgl_enable_WEBGL_polygon_mode',
1438
+ 'emscriptenWebGLGet',
1439
+ 'computeUnpackAlignedImageSize',
1440
+ 'colorChannelsInGlTextureFormat',
1441
+ 'emscriptenWebGLGetTexPixelData',
1442
+ 'emscriptenWebGLGetUniform',
1443
+ 'webglGetUniformLocation',
1444
+ 'webglPrepareUniformLocationsBeforeFirstUse',
1445
+ 'webglGetLeftBracePos',
1446
+ 'emscriptenWebGLGetVertexAttrib',
1447
+ '__glGetActiveAttribOrUniform',
1448
+ 'writeGLArray',
1449
+ 'registerWebGlEventCallback',
1450
+ 'runAndAbortIfError',
1451
+ 'ALLOC_NORMAL',
1452
+ 'ALLOC_STACK',
1453
+ 'allocate',
1454
+ 'writeStringToMemory',
1455
+ 'writeAsciiToMemory',
1456
+ 'allocateUTF8',
1457
+ 'allocateUTF8OnStack',
1458
+ 'demangle',
1459
+ 'stackTrace',
1460
+ 'getNativeTypeSize',
1461
+ ];
1462
+ missingLibrarySymbols.forEach(missingLibrarySymbol)
1463
+
1464
+ var unexportedSymbols = [
1465
+ 'run',
1466
+ 'out',
1467
+ 'err',
1468
+ 'callMain',
1469
+ 'abort',
1470
+ 'wasmExports',
1471
+ 'HEAPF64',
1472
+ 'HEAP8',
1473
+ 'HEAP16',
1474
+ 'HEAPU16',
1475
+ 'HEAP32',
1476
+ 'HEAP64',
1477
+ 'HEAPU64',
1478
+ 'writeStackCookie',
1479
+ 'checkStackCookie',
1480
+ 'INT53_MAX',
1481
+ 'INT53_MIN',
1482
+ 'bigintToI53Checked',
1483
+ 'stackSave',
1484
+ 'stackRestore',
1485
+ 'stackAlloc',
1486
+ 'ptrToString',
1487
+ 'getHeapMax',
1488
+ 'growMemory',
1489
+ 'ENV',
1490
+ 'ERRNO_CODES',
1491
+ 'DNS',
1492
+ 'Protocols',
1493
+ 'Sockets',
1494
+ 'timers',
1495
+ 'warnOnce',
1496
+ 'readEmAsmArgsArray',
1497
+ 'alignMemory',
1498
+ 'wasmTable',
1499
+ 'noExitRuntime',
1500
+ 'addOnPreRun',
1501
+ 'addOnPostRun',
1502
+ 'freeTableIndexes',
1503
+ 'functionsInTableMap',
1504
+ 'PATH',
1505
+ 'PATH_FS',
1506
+ 'UTF8Decoder',
1507
+ 'UTF8ArrayToString',
1508
+ 'stringToUTF8Array',
1509
+ 'stringToUTF8',
1510
+ 'lengthBytesUTF8',
1511
+ 'UTF16Decoder',
1512
+ 'stringToUTF8OnStack',
1513
+ 'writeArrayToMemory',
1514
+ 'JSEvents',
1515
+ 'specialHTMLTargets',
1516
+ 'findCanvasEventTarget',
1517
+ 'currentFullscreenStrategy',
1518
+ 'restoreOldWindowedStyle',
1519
+ 'UNWIND_CACHE',
1520
+ 'ExitStatus',
1521
+ 'checkWasiClock',
1522
+ 'flush_NO_FILESYSTEM',
1523
+ 'emSetImmediate',
1524
+ 'emClearImmediate_deps',
1525
+ 'emClearImmediate',
1526
+ 'promiseMap',
1527
+ 'uncaughtExceptionCount',
1528
+ 'exceptionLast',
1529
+ 'exceptionCaught',
1530
+ 'Browser',
1531
+ 'requestFullscreen',
1532
+ 'requestFullScreen',
1533
+ 'setCanvasSize',
1534
+ 'getUserMedia',
1535
+ 'createContext',
1536
+ 'getPreloadedImageData__data',
1537
+ 'wget',
1538
+ 'MONTH_DAYS_REGULAR',
1539
+ 'MONTH_DAYS_LEAP',
1540
+ 'MONTH_DAYS_REGULAR_CUMULATIVE',
1541
+ 'MONTH_DAYS_LEAP_CUMULATIVE',
1542
+ 'SYSCALLS',
1543
+ 'preloadPlugins',
1544
+ 'FS_stdin_getChar_buffer',
1545
+ 'FS_unlink',
1546
+ 'FS_createPath',
1547
+ 'FS_createDevice',
1548
+ 'FS_readFile',
1549
+ 'FS',
1550
+ 'FS_root',
1551
+ 'FS_mounts',
1552
+ 'FS_devices',
1553
+ 'FS_streams',
1554
+ 'FS_nextInode',
1555
+ 'FS_nameTable',
1556
+ 'FS_currentPath',
1557
+ 'FS_initialized',
1558
+ 'FS_ignorePermissions',
1559
+ 'FS_filesystems',
1560
+ 'FS_syncFSRequests',
1561
+ 'FS_readFiles',
1562
+ 'FS_lookupPath',
1563
+ 'FS_getPath',
1564
+ 'FS_hashName',
1565
+ 'FS_hashAddNode',
1566
+ 'FS_hashRemoveNode',
1567
+ 'FS_lookupNode',
1568
+ 'FS_createNode',
1569
+ 'FS_destroyNode',
1570
+ 'FS_isRoot',
1571
+ 'FS_isMountpoint',
1572
+ 'FS_isFile',
1573
+ 'FS_isDir',
1574
+ 'FS_isLink',
1575
+ 'FS_isChrdev',
1576
+ 'FS_isBlkdev',
1577
+ 'FS_isFIFO',
1578
+ 'FS_isSocket',
1579
+ 'FS_flagsToPermissionString',
1580
+ 'FS_nodePermissions',
1581
+ 'FS_mayLookup',
1582
+ 'FS_mayCreate',
1583
+ 'FS_mayDelete',
1584
+ 'FS_mayOpen',
1585
+ 'FS_checkOpExists',
1586
+ 'FS_nextfd',
1587
+ 'FS_getStreamChecked',
1588
+ 'FS_getStream',
1589
+ 'FS_createStream',
1590
+ 'FS_closeStream',
1591
+ 'FS_dupStream',
1592
+ 'FS_doSetAttr',
1593
+ 'FS_chrdev_stream_ops',
1594
+ 'FS_major',
1595
+ 'FS_minor',
1596
+ 'FS_makedev',
1597
+ 'FS_registerDevice',
1598
+ 'FS_getDevice',
1599
+ 'FS_getMounts',
1600
+ 'FS_syncfs',
1601
+ 'FS_mount',
1602
+ 'FS_unmount',
1603
+ 'FS_lookup',
1604
+ 'FS_mknod',
1605
+ 'FS_statfs',
1606
+ 'FS_statfsStream',
1607
+ 'FS_statfsNode',
1608
+ 'FS_create',
1609
+ 'FS_mkdir',
1610
+ 'FS_mkdev',
1611
+ 'FS_symlink',
1612
+ 'FS_rename',
1613
+ 'FS_rmdir',
1614
+ 'FS_readdir',
1615
+ 'FS_readlink',
1616
+ 'FS_stat',
1617
+ 'FS_fstat',
1618
+ 'FS_lstat',
1619
+ 'FS_doChmod',
1620
+ 'FS_chmod',
1621
+ 'FS_lchmod',
1622
+ 'FS_fchmod',
1623
+ 'FS_doChown',
1624
+ 'FS_chown',
1625
+ 'FS_lchown',
1626
+ 'FS_fchown',
1627
+ 'FS_doTruncate',
1628
+ 'FS_truncate',
1629
+ 'FS_ftruncate',
1630
+ 'FS_utime',
1631
+ 'FS_open',
1632
+ 'FS_close',
1633
+ 'FS_isClosed',
1634
+ 'FS_llseek',
1635
+ 'FS_read',
1636
+ 'FS_write',
1637
+ 'FS_mmap',
1638
+ 'FS_msync',
1639
+ 'FS_ioctl',
1640
+ 'FS_writeFile',
1641
+ 'FS_cwd',
1642
+ 'FS_chdir',
1643
+ 'FS_createDefaultDirectories',
1644
+ 'FS_createDefaultDevices',
1645
+ 'FS_createSpecialDirectories',
1646
+ 'FS_createStandardStreams',
1647
+ 'FS_staticInit',
1648
+ 'FS_init',
1649
+ 'FS_quit',
1650
+ 'FS_findObject',
1651
+ 'FS_analyzePath',
1652
+ 'FS_createFile',
1653
+ 'FS_createDataFile',
1654
+ 'FS_forceLoadFile',
1655
+ 'FS_createLazyFile',
1656
+ 'FS_absolutePath',
1657
+ 'FS_createFolder',
1658
+ 'FS_createLink',
1659
+ 'FS_joinPath',
1660
+ 'FS_mmapAlloc',
1661
+ 'FS_standardizePath',
1662
+ 'MEMFS',
1663
+ 'TTY',
1664
+ 'PIPEFS',
1665
+ 'SOCKFS',
1666
+ 'tempFixedLengthArray',
1667
+ 'miniTempWebGLFloatBuffers',
1668
+ 'miniTempWebGLIntBuffers',
1669
+ 'GL',
1670
+ 'AL',
1671
+ 'GLUT',
1672
+ 'EGL',
1673
+ 'GLEW',
1674
+ 'IDBStore',
1675
+ 'SDL',
1676
+ 'SDL_gfx',
1677
+ 'print',
1678
+ 'printErr',
1679
+ 'jstoi_s',
1680
+ ];
1681
+ unexportedSymbols.forEach(unexportedRuntimeSymbol);
1682
+
1683
+ // End runtime exports
1684
+ // Begin JS library exports
1685
+ // End JS library exports
1686
+
1687
+ // end include: postlibrary.js
1688
+
1689
+ function checkIncomingModuleAPI() {
1690
+ ignoredModuleProp('fetchSettings');
1691
+ }
1692
+
1693
+ // Imports from the Wasm binary.
1694
+ var _game_init = Module['_game_init'] = makeInvalidEarlyAccess('_game_init');
1695
+ var _free = Module['_free'] = makeInvalidEarlyAccess('_free');
1696
+ var _malloc = Module['_malloc'] = makeInvalidEarlyAccess('_malloc');
1697
+ var _game_step = Module['_game_step'] = makeInvalidEarlyAccess('_game_step');
1698
+ var _game_record_input = Module['_game_record_input'] = makeInvalidEarlyAccess('_game_record_input');
1699
+ var _game_record_marker = Module['_game_record_marker'] = makeInvalidEarlyAccess('_game_record_marker');
1700
+ var _game_apply_input = Module['_game_apply_input'] = makeInvalidEarlyAccess('_game_apply_input');
1701
+ var _game_render = Module['_game_render'] = makeInvalidEarlyAccess('_game_render');
1702
+ var _game_is_solved = Module['_game_is_solved'] = makeInvalidEarlyAccess('_game_is_solved');
1703
+ var _game_is_failed = Module['_game_is_failed'] = makeInvalidEarlyAccess('_game_is_failed');
1704
+ var _game_get_outcome = Module['_game_get_outcome'] = makeInvalidEarlyAccess('_game_get_outcome');
1705
+ var _game_get_pixel_buffer = Module['_game_get_pixel_buffer'] = makeInvalidEarlyAccess('_game_get_pixel_buffer');
1706
+ var _game_get_pixel_buffer_size = Module['_game_get_pixel_buffer_size'] = makeInvalidEarlyAccess('_game_get_pixel_buffer_size');
1707
+ var _game_get_buffer_width = Module['_game_get_buffer_width'] = makeInvalidEarlyAccess('_game_get_buffer_width');
1708
+ var _game_get_buffer_height = Module['_game_get_buffer_height'] = makeInvalidEarlyAccess('_game_get_buffer_height');
1709
+ var _game_render_commands = Module['_game_render_commands'] = makeInvalidEarlyAccess('_game_render_commands');
1710
+ var _game_get_command_buffer = Module['_game_get_command_buffer'] = makeInvalidEarlyAccess('_game_get_command_buffer');
1711
+ var _game_get_command_buffer_size = Module['_game_get_command_buffer_size'] = makeInvalidEarlyAccess('_game_get_command_buffer_size');
1712
+ var _get_physics_hash = Module['_get_physics_hash'] = makeInvalidEarlyAccess('_get_physics_hash');
1713
+ var _game_get_session_data = Module['_game_get_session_data'] = makeInvalidEarlyAccess('_game_get_session_data');
1714
+ var _game_get_session_data_length = Module['_game_get_session_data_length'] = makeInvalidEarlyAccess('_game_get_session_data_length');
1715
+ var _game_get_current_tick = Module['_game_get_current_tick'] = makeInvalidEarlyAccess('_game_get_current_tick');
1716
+ var _game_get_target_info = Module['_game_get_target_info'] = makeInvalidEarlyAccess('_game_get_target_info');
1717
+ var _game_cleanup = Module['_game_cleanup'] = makeInvalidEarlyAccess('_game_cleanup');
1718
+ var _game_render_pvg = Module['_game_render_pvg'] = makeInvalidEarlyAccess('_game_render_pvg');
1719
+ var _game_get_pvg_pixels = Module['_game_get_pvg_pixels'] = makeInvalidEarlyAccess('_game_get_pvg_pixels');
1720
+ var _game_get_pvg_stride = Module['_game_get_pvg_stride'] = makeInvalidEarlyAccess('_game_get_pvg_stride');
1721
+ var _game_get_pvg_renderer = Module['_game_get_pvg_renderer'] = makeInvalidEarlyAccess('_game_get_pvg_renderer');
1722
+ var _fflush = makeInvalidEarlyAccess('_fflush');
1723
+ var _emscripten_builtin_memalign = makeInvalidEarlyAccess('_emscripten_builtin_memalign');
1724
+ var _emscripten_stack_get_end = makeInvalidEarlyAccess('_emscripten_stack_get_end');
1725
+ var _emscripten_stack_get_base = makeInvalidEarlyAccess('_emscripten_stack_get_base');
1726
+ var _strerror = makeInvalidEarlyAccess('_strerror');
1727
+ var _setThrew = makeInvalidEarlyAccess('_setThrew');
1728
+ var _emscripten_stack_init = makeInvalidEarlyAccess('_emscripten_stack_init');
1729
+ var _emscripten_stack_get_free = makeInvalidEarlyAccess('_emscripten_stack_get_free');
1730
+ var __emscripten_stack_restore = makeInvalidEarlyAccess('__emscripten_stack_restore');
1731
+ var __emscripten_stack_alloc = makeInvalidEarlyAccess('__emscripten_stack_alloc');
1732
+ var _emscripten_stack_get_current = makeInvalidEarlyAccess('_emscripten_stack_get_current');
1733
+ var memory = makeInvalidEarlyAccess('memory');
1734
+ var __indirect_function_table = makeInvalidEarlyAccess('__indirect_function_table');
1735
+ var wasmMemory = makeInvalidEarlyAccess('wasmMemory');
1736
+ var wasmTable = makeInvalidEarlyAccess('wasmTable');
1737
+
1738
+ function assignWasmExports(wasmExports) {
1739
+ assert(typeof wasmExports['game_init'] != 'undefined', 'missing Wasm export: game_init');
1740
+ assert(typeof wasmExports['free'] != 'undefined', 'missing Wasm export: free');
1741
+ assert(typeof wasmExports['malloc'] != 'undefined', 'missing Wasm export: malloc');
1742
+ assert(typeof wasmExports['game_step'] != 'undefined', 'missing Wasm export: game_step');
1743
+ assert(typeof wasmExports['game_record_input'] != 'undefined', 'missing Wasm export: game_record_input');
1744
+ assert(typeof wasmExports['game_record_marker'] != 'undefined', 'missing Wasm export: game_record_marker');
1745
+ assert(typeof wasmExports['game_apply_input'] != 'undefined', 'missing Wasm export: game_apply_input');
1746
+ assert(typeof wasmExports['game_render'] != 'undefined', 'missing Wasm export: game_render');
1747
+ assert(typeof wasmExports['game_is_solved'] != 'undefined', 'missing Wasm export: game_is_solved');
1748
+ assert(typeof wasmExports['game_is_failed'] != 'undefined', 'missing Wasm export: game_is_failed');
1749
+ assert(typeof wasmExports['game_get_outcome'] != 'undefined', 'missing Wasm export: game_get_outcome');
1750
+ assert(typeof wasmExports['game_get_pixel_buffer'] != 'undefined', 'missing Wasm export: game_get_pixel_buffer');
1751
+ assert(typeof wasmExports['game_get_pixel_buffer_size'] != 'undefined', 'missing Wasm export: game_get_pixel_buffer_size');
1752
+ assert(typeof wasmExports['game_get_buffer_width'] != 'undefined', 'missing Wasm export: game_get_buffer_width');
1753
+ assert(typeof wasmExports['game_get_buffer_height'] != 'undefined', 'missing Wasm export: game_get_buffer_height');
1754
+ assert(typeof wasmExports['game_render_commands'] != 'undefined', 'missing Wasm export: game_render_commands');
1755
+ assert(typeof wasmExports['game_get_command_buffer'] != 'undefined', 'missing Wasm export: game_get_command_buffer');
1756
+ assert(typeof wasmExports['game_get_command_buffer_size'] != 'undefined', 'missing Wasm export: game_get_command_buffer_size');
1757
+ assert(typeof wasmExports['get_physics_hash'] != 'undefined', 'missing Wasm export: get_physics_hash');
1758
+ assert(typeof wasmExports['game_get_session_data'] != 'undefined', 'missing Wasm export: game_get_session_data');
1759
+ assert(typeof wasmExports['game_get_session_data_length'] != 'undefined', 'missing Wasm export: game_get_session_data_length');
1760
+ assert(typeof wasmExports['game_get_current_tick'] != 'undefined', 'missing Wasm export: game_get_current_tick');
1761
+ assert(typeof wasmExports['game_get_target_info'] != 'undefined', 'missing Wasm export: game_get_target_info');
1762
+ assert(typeof wasmExports['game_cleanup'] != 'undefined', 'missing Wasm export: game_cleanup');
1763
+ assert(typeof wasmExports['game_render_pvg'] != 'undefined', 'missing Wasm export: game_render_pvg');
1764
+ assert(typeof wasmExports['game_get_pvg_pixels'] != 'undefined', 'missing Wasm export: game_get_pvg_pixels');
1765
+ assert(typeof wasmExports['game_get_pvg_stride'] != 'undefined', 'missing Wasm export: game_get_pvg_stride');
1766
+ assert(typeof wasmExports['game_get_pvg_renderer'] != 'undefined', 'missing Wasm export: game_get_pvg_renderer');
1767
+ assert(typeof wasmExports['fflush'] != 'undefined', 'missing Wasm export: fflush');
1768
+ assert(typeof wasmExports['emscripten_builtin_memalign'] != 'undefined', 'missing Wasm export: emscripten_builtin_memalign');
1769
+ assert(typeof wasmExports['emscripten_stack_get_end'] != 'undefined', 'missing Wasm export: emscripten_stack_get_end');
1770
+ assert(typeof wasmExports['emscripten_stack_get_base'] != 'undefined', 'missing Wasm export: emscripten_stack_get_base');
1771
+ assert(typeof wasmExports['strerror'] != 'undefined', 'missing Wasm export: strerror');
1772
+ assert(typeof wasmExports['setThrew'] != 'undefined', 'missing Wasm export: setThrew');
1773
+ assert(typeof wasmExports['emscripten_stack_init'] != 'undefined', 'missing Wasm export: emscripten_stack_init');
1774
+ assert(typeof wasmExports['emscripten_stack_get_free'] != 'undefined', 'missing Wasm export: emscripten_stack_get_free');
1775
+ assert(typeof wasmExports['_emscripten_stack_restore'] != 'undefined', 'missing Wasm export: _emscripten_stack_restore');
1776
+ assert(typeof wasmExports['_emscripten_stack_alloc'] != 'undefined', 'missing Wasm export: _emscripten_stack_alloc');
1777
+ assert(typeof wasmExports['emscripten_stack_get_current'] != 'undefined', 'missing Wasm export: emscripten_stack_get_current');
1778
+ assert(typeof wasmExports['memory'] != 'undefined', 'missing Wasm export: memory');
1779
+ assert(typeof wasmExports['__indirect_function_table'] != 'undefined', 'missing Wasm export: __indirect_function_table');
1780
+ _game_init = Module['_game_init'] = createExportWrapper('game_init', 4);
1781
+ _free = Module['_free'] = createExportWrapper('free', 1);
1782
+ _malloc = Module['_malloc'] = createExportWrapper('malloc', 1);
1783
+ _game_step = Module['_game_step'] = createExportWrapper('game_step', 3);
1784
+ _game_record_input = Module['_game_record_input'] = createExportWrapper('game_record_input', 2);
1785
+ _game_record_marker = Module['_game_record_marker'] = createExportWrapper('game_record_marker', 1);
1786
+ _game_apply_input = Module['_game_apply_input'] = createExportWrapper('game_apply_input', 3);
1787
+ _game_render = Module['_game_render'] = createExportWrapper('game_render', 0);
1788
+ _game_is_solved = Module['_game_is_solved'] = createExportWrapper('game_is_solved', 0);
1789
+ _game_is_failed = Module['_game_is_failed'] = createExportWrapper('game_is_failed', 0);
1790
+ _game_get_outcome = Module['_game_get_outcome'] = createExportWrapper('game_get_outcome', 0);
1791
+ _game_get_pixel_buffer = Module['_game_get_pixel_buffer'] = createExportWrapper('game_get_pixel_buffer', 0);
1792
+ _game_get_pixel_buffer_size = Module['_game_get_pixel_buffer_size'] = createExportWrapper('game_get_pixel_buffer_size', 0);
1793
+ _game_get_buffer_width = Module['_game_get_buffer_width'] = createExportWrapper('game_get_buffer_width', 0);
1794
+ _game_get_buffer_height = Module['_game_get_buffer_height'] = createExportWrapper('game_get_buffer_height', 0);
1795
+ _game_render_commands = Module['_game_render_commands'] = createExportWrapper('game_render_commands', 0);
1796
+ _game_get_command_buffer = Module['_game_get_command_buffer'] = createExportWrapper('game_get_command_buffer', 0);
1797
+ _game_get_command_buffer_size = Module['_game_get_command_buffer_size'] = createExportWrapper('game_get_command_buffer_size', 0);
1798
+ _get_physics_hash = Module['_get_physics_hash'] = createExportWrapper('get_physics_hash', 2);
1799
+ _game_get_session_data = Module['_game_get_session_data'] = createExportWrapper('game_get_session_data', 0);
1800
+ _game_get_session_data_length = Module['_game_get_session_data_length'] = createExportWrapper('game_get_session_data_length', 0);
1801
+ _game_get_current_tick = Module['_game_get_current_tick'] = createExportWrapper('game_get_current_tick', 0);
1802
+ _game_get_target_info = Module['_game_get_target_info'] = createExportWrapper('game_get_target_info', 3);
1803
+ _game_cleanup = Module['_game_cleanup'] = createExportWrapper('game_cleanup', 0);
1804
+ _game_render_pvg = Module['_game_render_pvg'] = createExportWrapper('game_render_pvg', 0);
1805
+ _game_get_pvg_pixels = Module['_game_get_pvg_pixels'] = createExportWrapper('game_get_pvg_pixels', 0);
1806
+ _game_get_pvg_stride = Module['_game_get_pvg_stride'] = createExportWrapper('game_get_pvg_stride', 0);
1807
+ _game_get_pvg_renderer = Module['_game_get_pvg_renderer'] = createExportWrapper('game_get_pvg_renderer', 0);
1808
+ _fflush = createExportWrapper('fflush', 1);
1809
+ _emscripten_builtin_memalign = createExportWrapper('emscripten_builtin_memalign', 2);
1810
+ _emscripten_stack_get_end = wasmExports['emscripten_stack_get_end'];
1811
+ _emscripten_stack_get_base = wasmExports['emscripten_stack_get_base'];
1812
+ _strerror = createExportWrapper('strerror', 1);
1813
+ _setThrew = createExportWrapper('setThrew', 2);
1814
+ _emscripten_stack_init = wasmExports['emscripten_stack_init'];
1815
+ _emscripten_stack_get_free = wasmExports['emscripten_stack_get_free'];
1816
+ __emscripten_stack_restore = wasmExports['_emscripten_stack_restore'];
1817
+ __emscripten_stack_alloc = wasmExports['_emscripten_stack_alloc'];
1818
+ _emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'];
1819
+ memory = wasmMemory = Module['wasmMemory'] = wasmExports['memory'];
1820
+ __indirect_function_table = wasmTable = wasmExports['__indirect_function_table'];
1821
+ }
1822
+
1823
+ var wasmImports = {
1824
+ /** @export */
1825
+ _abort_js: __abort_js,
1826
+ /** @export */
1827
+ _emscripten_throw_longjmp: __emscripten_throw_longjmp,
1828
+ /** @export */
1829
+ clock_time_get: _clock_time_get,
1830
+ /** @export */
1831
+ emscripten_get_now: _emscripten_get_now,
1832
+ /** @export */
1833
+ emscripten_resize_heap: _emscripten_resize_heap,
1834
+ /** @export */
1835
+ fd_close: _fd_close,
1836
+ /** @export */
1837
+ fd_seek: _fd_seek,
1838
+ /** @export */
1839
+ fd_write: _fd_write,
1840
+ /** @export */
1841
+ invoke_iii,
1842
+ /** @export */
1843
+ invoke_vi
1844
+ };
1845
+
1846
+ function invoke_iii(index,a1,a2) {
1847
+ var sp = stackSave();
1848
+ try {
1849
+ return getWasmTableEntry(index)(a1,a2);
1850
+ } catch(e) {
1851
+ stackRestore(sp);
1852
+ if (e !== e+0) throw e;
1853
+ _setThrew(1, 0);
1854
+ }
1855
+ }
1856
+
1857
+ function invoke_vi(index,a1) {
1858
+ var sp = stackSave();
1859
+ try {
1860
+ getWasmTableEntry(index)(a1);
1861
+ } catch(e) {
1862
+ stackRestore(sp);
1863
+ if (e !== e+0) throw e;
1864
+ _setThrew(1, 0);
1865
+ }
1866
+ }
1867
+
1868
+
1869
+ // include: postamble.js
1870
+ // === Auto-generated postamble setup entry stuff ===
1871
+
1872
+ var calledRun;
1873
+
1874
+ function stackCheckInit() {
1875
+ // This is normally called automatically during __wasm_call_ctors but need to
1876
+ // get these values before even running any of the ctors so we call it redundantly
1877
+ // here.
1878
+ _emscripten_stack_init();
1879
+ // TODO(sbc): Move writeStackCookie to native to to avoid this.
1880
+ writeStackCookie();
1881
+ }
1882
+
1883
+ function run() {
1884
+
1885
+ stackCheckInit();
1886
+
1887
+ preRun();
1888
+
1889
+ function doRun() {
1890
+ // run may have just been called through dependencies being fulfilled just in this very frame,
1891
+ // or while the async setStatus time below was happening
1892
+ assert(!calledRun);
1893
+ calledRun = true;
1894
+ Module['calledRun'] = true;
1895
+
1896
+ if (ABORT) return;
1897
+
1898
+ initRuntime();
1899
+
1900
+ readyPromiseResolve?.(Module);
1901
+ Module['onRuntimeInitialized']?.();
1902
+ consumedModuleProp('onRuntimeInitialized');
1903
+
1904
+ assert(!Module['_main'], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]');
1905
+
1906
+ postRun();
1907
+ }
1908
+
1909
+ if (Module['setStatus']) {
1910
+ Module['setStatus']('Running...');
1911
+ setTimeout(() => {
1912
+ setTimeout(() => Module['setStatus'](''), 1);
1913
+ doRun();
1914
+ }, 1);
1915
+ } else
1916
+ {
1917
+ doRun();
1918
+ }
1919
+ checkStackCookie();
1920
+ }
1921
+
1922
+ function checkUnflushedContent() {
1923
+ // Compiler settings do not allow exiting the runtime, so flushing
1924
+ // the streams is not possible. but in ASSERTIONS mode we check
1925
+ // if there was something to flush, and if so tell the user they
1926
+ // should request that the runtime be exitable.
1927
+ // Normally we would not even include flush() at all, but in ASSERTIONS
1928
+ // builds we do so just for this check, and here we see if there is any
1929
+ // content to flush, that is, we check if there would have been
1930
+ // something a non-ASSERTIONS build would have not seen.
1931
+ // How we flush the streams depends on whether we are in SYSCALLS_REQUIRE_FILESYSTEM=0
1932
+ // mode (which has its own special function for this; otherwise, all
1933
+ // the code is inside libc)
1934
+ var oldOut = out;
1935
+ var oldErr = err;
1936
+ var has = false;
1937
+ out = err = (x) => {
1938
+ has = true;
1939
+ }
1940
+ try { // it doesn't matter if it fails
1941
+ flush_NO_FILESYSTEM();
1942
+ } catch(e) {}
1943
+ out = oldOut;
1944
+ err = oldErr;
1945
+ if (has) {
1946
+ 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.');
1947
+ warnOnce('(this may also be due to not including full filesystem support - try building with -sFORCE_FILESYSTEM)');
1948
+ }
1949
+ }
1950
+
1951
+ var wasmExports;
1952
+
1953
+ // In modularize mode the generated code is within a factory function so we
1954
+ // can use await here (since it's not top-level-await).
1955
+ wasmExports = await (createWasm());
1956
+
1957
+ run();
1958
+
1959
+ // end include: postamble.js
1960
+
1961
+ // include: postamble_modularize.js
1962
+ // In MODULARIZE mode we wrap the generated code in a factory function
1963
+ // and return either the Module itself, or a promise of the module.
1964
+ //
1965
+ // We assign to the `moduleRtn` global here and configure closure to see
1966
+ // this as and extern so it won't get minified.
1967
+
1968
+ if (runtimeInitialized) {
1969
+ moduleRtn = Module;
1970
+ } else {
1971
+ // Set up the promise that indicates the Module is initialized
1972
+ moduleRtn = new Promise((resolve, reject) => {
1973
+ readyPromiseResolve = resolve;
1974
+ readyPromiseReject = reject;
1975
+ });
1976
+ }
1977
+
1978
+ // Assertion for attempting to access module properties on the incoming
1979
+ // moduleArg. In the past we used this object as the prototype of the module
1980
+ // and assigned properties to it, but now we return a distinct object. This
1981
+ // keeps the instance private until it is ready (i.e the promise has been
1982
+ // resolved).
1983
+ for (const prop of Object.keys(Module)) {
1984
+ if (!(prop in moduleArg)) {
1985
+ Object.defineProperty(moduleArg, prop, {
1986
+ configurable: true,
1987
+ get() {
1988
+ abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)
1989
+ }
1990
+ });
1991
+ }
1992
+ }
1993
+ // end include: postamble_modularize.js
1994
+
1995
+
1996
+
1997
+ return moduleRtn;
1998
+ };
1999
+ })();
2000
+
2001
+ // Export using a UMD style export, or ES6 exports if selected
2002
+ if (typeof exports === 'object' && typeof module === 'object') {
2003
+ module.exports = createGameModule;
2004
+ // This default export looks redundant, but it allows TS to import this
2005
+ // commonjs style module.
2006
+ module.exports.default = createGameModule;
2007
+ } else if (typeof define === 'function' && define['amd'])
2008
+ define([], () => createGameModule);
2009
+