@kerebron/tree-sitter 0.4.27 → 0.4.29

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.
Files changed (107) hide show
  1. package/esm/deno-tree-sitter/main/extended/base_node.d.ts +48 -0
  2. package/esm/deno-tree-sitter/main/extended/base_node.d.ts.map +1 -0
  3. package/esm/deno-tree-sitter/main/extended/base_node.js +155 -0
  4. package/esm/deno-tree-sitter/main/extended/base_node.js.map +1 -0
  5. package/esm/deno-tree-sitter/main/extended/node_extended.d.ts +237 -0
  6. package/esm/deno-tree-sitter/main/extended/node_extended.d.ts.map +1 -0
  7. package/esm/deno-tree-sitter/main/extended/node_extended.js +573 -0
  8. package/esm/deno-tree-sitter/main/extended/node_extended.js.map +1 -0
  9. package/esm/deno-tree-sitter/main/extended/parser.d.ts +37 -0
  10. package/esm/deno-tree-sitter/main/extended/parser.d.ts.map +1 -0
  11. package/esm/deno-tree-sitter/main/extended/parser.js +87 -0
  12. package/esm/deno-tree-sitter/main/extended/parser.js.map +1 -0
  13. package/esm/deno-tree-sitter/main/extended/soft_node.d.ts +15 -0
  14. package/esm/deno-tree-sitter/main/extended/soft_node.d.ts.map +1 -0
  15. package/esm/deno-tree-sitter/main/extended/soft_node.js +28 -0
  16. package/esm/deno-tree-sitter/main/extended/soft_node.js.map +1 -0
  17. package/esm/deno-tree-sitter/main/extended/soft_text_node.d.ts +10 -0
  18. package/esm/deno-tree-sitter/main/extended/soft_text_node.d.ts.map +1 -0
  19. package/esm/deno-tree-sitter/main/extended/soft_text_node.js +11 -0
  20. package/esm/deno-tree-sitter/main/extended/soft_text_node.js.map +1 -0
  21. package/esm/deno-tree-sitter/main/extended/whitespace_node.d.ts +10 -0
  22. package/esm/deno-tree-sitter/main/extended/whitespace_node.d.ts.map +1 -0
  23. package/esm/deno-tree-sitter/main/extended/whitespace_node.js +11 -0
  24. package/esm/deno-tree-sitter/main/extended/whitespace_node.js.map +1 -0
  25. package/esm/deno-tree-sitter/main/extras/misc.d.ts +2 -0
  26. package/esm/deno-tree-sitter/main/extras/misc.d.ts.map +1 -0
  27. package/esm/deno-tree-sitter/main/extras/misc.js +14 -0
  28. package/esm/deno-tree-sitter/main/extras/misc.js.map +1 -0
  29. package/esm/deno-tree-sitter/main/tree_sitter/bindings.d.ts +14 -0
  30. package/esm/deno-tree-sitter/main/tree_sitter/bindings.d.ts.map +1 -0
  31. package/esm/deno-tree-sitter/main/tree_sitter/bindings.js +22 -0
  32. package/esm/deno-tree-sitter/main/tree_sitter/bindings.js.map +1 -0
  33. package/esm/deno-tree-sitter/main/tree_sitter/constants.d.ts +60 -0
  34. package/esm/deno-tree-sitter/main/tree_sitter/constants.d.ts.map +1 -0
  35. package/esm/deno-tree-sitter/main/tree_sitter/constants.js +67 -0
  36. package/esm/deno-tree-sitter/main/tree_sitter/constants.js.map +1 -0
  37. package/esm/deno-tree-sitter/main/tree_sitter/language.d.ts +137 -0
  38. package/esm/deno-tree-sitter/main/tree_sitter/language.d.ts.map +1 -0
  39. package/esm/deno-tree-sitter/main/tree_sitter/language.js +265 -0
  40. package/esm/deno-tree-sitter/main/tree_sitter/language.js.map +1 -0
  41. package/esm/deno-tree-sitter/main/tree_sitter/lookahead_iterator.d.ts +41 -0
  42. package/esm/deno-tree-sitter/main/tree_sitter/lookahead_iterator.d.ts.map +1 -0
  43. package/esm/deno-tree-sitter/main/tree_sitter/lookahead_iterator.js +66 -0
  44. package/esm/deno-tree-sitter/main/tree_sitter/lookahead_iterator.js.map +1 -0
  45. package/esm/deno-tree-sitter/main/tree_sitter/marshal.d.ts +85 -0
  46. package/esm/deno-tree-sitter/main/tree_sitter/marshal.d.ts.map +1 -0
  47. package/esm/deno-tree-sitter/main/tree_sitter/marshal.js +174 -0
  48. package/esm/deno-tree-sitter/main/tree_sitter/marshal.js.map +1 -0
  49. package/esm/deno-tree-sitter/main/tree_sitter/node.d.ts +260 -0
  50. package/esm/deno-tree-sitter/main/tree_sitter/node.d.ts.map +1 -0
  51. package/esm/deno-tree-sitter/main/tree_sitter/node.js +558 -0
  52. package/esm/deno-tree-sitter/main/tree_sitter/node.js.map +1 -0
  53. package/esm/deno-tree-sitter/main/tree_sitter/parser.d.ts +124 -0
  54. package/esm/deno-tree-sitter/main/tree_sitter/parser.d.ts.map +1 -0
  55. package/esm/deno-tree-sitter/main/tree_sitter/parser.js +253 -0
  56. package/esm/deno-tree-sitter/main/tree_sitter/parser.js.map +1 -0
  57. package/esm/deno-tree-sitter/main/tree_sitter/query.d.ts +134 -0
  58. package/esm/deno-tree-sitter/main/tree_sitter/query.d.ts.map +1 -0
  59. package/esm/deno-tree-sitter/main/tree_sitter/query.js +621 -0
  60. package/esm/deno-tree-sitter/main/tree_sitter/query.js.map +1 -0
  61. package/esm/deno-tree-sitter/main/tree_sitter/tree.d.ts +49 -0
  62. package/esm/deno-tree-sitter/main/tree_sitter/tree.d.ts.map +1 -0
  63. package/esm/deno-tree-sitter/main/tree_sitter/tree.js +131 -0
  64. package/esm/deno-tree-sitter/main/tree_sitter/tree.js.map +1 -0
  65. package/esm/deno-tree-sitter/main/tree_sitter/tree_cursor.d.ts +165 -0
  66. package/esm/deno-tree-sitter/main/tree_sitter/tree_cursor.d.ts.map +1 -0
  67. package/esm/deno-tree-sitter/main/tree_sitter/tree_cursor.js +281 -0
  68. package/esm/deno-tree-sitter/main/tree_sitter/tree_cursor.js.map +1 -0
  69. package/esm/deno-tree-sitter/main/tree_sitter_wasm.d.ts +3 -0
  70. package/esm/deno-tree-sitter/main/tree_sitter_wasm.d.ts.map +1 -0
  71. package/esm/deno-tree-sitter/main/tree_sitter_wasm.js +0 -0
  72. package/esm/deno-tree-sitter/main/tree_sitter_wasm.js.map +1 -0
  73. package/esm/deno-tree-sitter/main/wasm_loader.d.ts +29 -0
  74. package/esm/deno-tree-sitter/main/wasm_loader.d.ts.map +1 -0
  75. package/esm/deno-tree-sitter/main/wasm_loader.js +1703 -0
  76. package/esm/deno-tree-sitter/main/wasm_loader.js.map +1 -0
  77. package/esm/deno-tree-sitter/main/wasm_loader_with_defaults.d.ts +3 -0
  78. package/esm/deno-tree-sitter/main/wasm_loader_with_defaults.d.ts.map +1 -0
  79. package/esm/deno-tree-sitter/main/wasm_loader_with_defaults.js +9 -0
  80. package/esm/deno-tree-sitter/main/wasm_loader_with_defaults.js.map +1 -0
  81. package/esm/mod.d.ts +7 -0
  82. package/esm/mod.d.ts.map +1 -0
  83. package/esm/mod.js +8 -0
  84. package/esm/mod.js.map +1 -0
  85. package/esm/package.json +3 -0
  86. package/package.json +5 -2
  87. package/src/deno-tree-sitter/main/extended/base_node.js +174 -0
  88. package/src/deno-tree-sitter/main/extended/node_extended.js +588 -0
  89. package/src/deno-tree-sitter/main/extended/parser.js +87 -0
  90. package/src/deno-tree-sitter/main/extended/soft_node.js +32 -0
  91. package/src/deno-tree-sitter/main/extended/soft_text_node.js +11 -0
  92. package/src/deno-tree-sitter/main/extended/whitespace_node.js +11 -0
  93. package/src/deno-tree-sitter/main/extras/misc.js +12 -0
  94. package/src/deno-tree-sitter/main/tree_sitter/bindings.js +26 -0
  95. package/src/deno-tree-sitter/main/tree_sitter/constants.js +79 -0
  96. package/src/deno-tree-sitter/main/tree_sitter/language.js +289 -0
  97. package/src/deno-tree-sitter/main/tree_sitter/lookahead_iterator.js +74 -0
  98. package/src/deno-tree-sitter/main/tree_sitter/marshal.js +186 -0
  99. package/src/deno-tree-sitter/main/tree_sitter/node.js +616 -0
  100. package/src/deno-tree-sitter/main/tree_sitter/parser.js +273 -0
  101. package/src/deno-tree-sitter/main/tree_sitter/query.js +705 -0
  102. package/src/deno-tree-sitter/main/tree_sitter/tree.js +145 -0
  103. package/src/deno-tree-sitter/main/tree_sitter/tree_cursor.js +314 -0
  104. package/src/deno-tree-sitter/main/tree_sitter_wasm.js +0 -0
  105. package/src/deno-tree-sitter/main/wasm_loader.js +1702 -0
  106. package/src/deno-tree-sitter/main/wasm_loader_with_defaults.js +9 -0
  107. package/src/mod.ts +8 -0
@@ -0,0 +1,1702 @@
1
+ // this file is the loader for tree-sitter.wasm, specifically derived from v0.25.3 of web-tree-sitter
2
+ // unlike the normal tree sitter code, this code allows for arguments to be given
3
+ // which allows it to be run on Deno, Web, Webworkers, and Node
4
+ // there is no platform-dependant code in here
5
+
6
+ const __name = (thing, name)=>thing
7
+ export const defaults = {
8
+ arguments: [],
9
+ dynamicLibraries: [],
10
+ thisProgram: "./this.program",
11
+ INITIAL_MEMORY: 33554432,
12
+ wasmBinary: null,
13
+ wasmBinaryFilePath: null,
14
+ noExitRuntime: true,
15
+ noInitialRun: false,
16
+ monitorRunDependencies: null, // func
17
+ onRuntimeInitialized: null, // func
18
+ preRun: null, // func or array of functions
19
+ preInit: null, // func or array of functions
20
+ onAbort: null, // func
21
+ onExit: null, // func
22
+ postRun: null, // func or array of functions
23
+ setStatus: null, // func, string arg of "Running..."
24
+ defaultWasmPath: "tree-sitter.wasm",
25
+ quit: (status, toThrow) => {
26
+ throw toThrow
27
+ },
28
+ locateFile: (relativePath)=>{
29
+ return relativePath
30
+ },
31
+ readAsync: async (path)=>{}, // expects Uint8Array output
32
+ readBinary: (path)=>{}, // expects Uint8Array output
33
+ print: null, // console.log alternative
34
+ printErr: null, // console.log alternative
35
+ instantiateWasm: null, // func(info, receiveInstance), // probably most important
36
+ fetch: globalThis.fetch,
37
+ // info2={
38
+ // env: wasmImports,
39
+ // wasi_snapshot_preview1: wasmImports,
40
+ // "GOT.mem": new Proxy(wasmImports, GOTHandler),
41
+ // "GOT.func": new Proxy(wasmImports, GOTHandler),
42
+ // }
43
+ // needs to call receiveInstance
44
+ // receiveInstance(instantiationResult["instance"], instantiationResult["module"])
45
+ }
46
+ export default async function (Module) {
47
+ Module = Object.assign({}, defaults, Module)
48
+ var readyPromiseResolve, readyPromiseReject
49
+ var readyPromise = new Promise((resolve, reject) => {
50
+ readyPromiseResolve = resolve
51
+ readyPromiseReject = reject
52
+ })
53
+ Module.currentQueryProgressCallback = null
54
+ Module.currentProgressCallback = null
55
+ Module.currentLogCallback = null
56
+ Module.currentParseCallback = null
57
+ var {
58
+ arguments: arguments_,
59
+ thisProgram,
60
+ INITIAL_MEMORY,
61
+ noExitRuntime,
62
+ dynamicLibraries,
63
+ wasmBinary,
64
+ wasmBinaryFilePath,
65
+ quit: quit_,
66
+ locateFile,
67
+ readAsync,
68
+ readBinary,
69
+ scriptDirectory,
70
+ wasmMemory,
71
+ } = Module
72
+ __name(quit_, "quit_")
73
+ __name(locateFile, "locateFile")
74
+ __name(readBinary, "readBinary")
75
+ __name(readAsync, "readAsync")
76
+
77
+ var out = Module["print"] || console.log.bind(console)
78
+ var err = Module["printErr"] || console.error.bind(console)
79
+
80
+ wasmMemory = wasmMemory || new WebAssembly.Memory({
81
+ initial: INITIAL_MEMORY / 65536,
82
+ // In theory we should not need to emit the maximum if we want "unlimited"
83
+ // or 4GB of memory, but VMs error on that atm, see
84
+ // https://github.com/emscripten-core/emscripten/issues/14130
85
+ // And in the pthreads case we definitely need to emit a maximum. So
86
+ // always emit one.
87
+ maximum: 32768,
88
+ })
89
+
90
+ var ABORT = false
91
+ var EXITSTATUS
92
+ function assert(condition, text) {
93
+ if (!condition) {
94
+ abort(text)
95
+ }
96
+ }
97
+ __name(assert, "assert")
98
+ var HEAP, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAP64, HEAPU64, HEAPF64
99
+ var HEAP_DATA_VIEW
100
+ var runtimeInitialized = false
101
+ var dataURIPrefix = "data:application/octet-stream;base64,"
102
+ var isUrl = (filename)=>{
103
+ try {
104
+ new URL(filename)
105
+ } catch (error) {
106
+ if (error?.message?.startsWith?.("Invalid URL: ")) {
107
+ return false
108
+ }
109
+ }
110
+ return true
111
+ }
112
+ var isDataURI = /* @__PURE__ */ __name((filename) => filename.startsWith(dataURIPrefix), "isDataURI")
113
+ var isFileURI = /* @__PURE__ */ __name((filename) => filename.startsWith("file://"), "isFileURI")
114
+ function updateMemoryViews() {
115
+ var b = wasmMemory.buffer
116
+ Module["HEAP_DATA_VIEW"] = HEAP_DATA_VIEW = new DataView(b)
117
+ Module["HEAP8"] = HEAP8 = new Int8Array(b)
118
+ Module["HEAP16"] = HEAP16 = new Int16Array(b)
119
+ Module["HEAPU8"] = HEAPU8 = new Uint8Array(b)
120
+ Module["HEAPU16"] = HEAPU16 = new Uint16Array(b)
121
+ Module["HEAP32"] = HEAP32 = new Int32Array(b)
122
+ Module["HEAPU32"] = HEAPU32 = new Uint32Array(b)
123
+ Module["HEAPF32"] = HEAPF32 = new Float32Array(b)
124
+ Module["HEAPF64"] = HEAPF64 = new Float64Array(b)
125
+ Module["HEAP64"] = HEAP64 = new BigInt64Array(b)
126
+ Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b)
127
+ }
128
+ __name(updateMemoryViews, "updateMemoryViews")
129
+ updateMemoryViews()
130
+ var __ATPRERUN__ = []
131
+ var __ATINIT__ = []
132
+ var __ATMAIN__ = []
133
+ var __ATEXIT__ = []
134
+ var __ATPOSTRUN__ = []
135
+ var __RELOC_FUNCS__ = []
136
+ function preRun() {
137
+ if (Module["preRun"]) {
138
+ if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]]
139
+ while (Module["preRun"].length) {
140
+ addOnPreRun(Module["preRun"].shift())
141
+ }
142
+ }
143
+ callRuntimeCallbacks(__ATPRERUN__)
144
+ }
145
+ __name(preRun, "preRun")
146
+ function initRuntime() {
147
+ runtimeInitialized = true
148
+ callRuntimeCallbacks(__RELOC_FUNCS__)
149
+ callRuntimeCallbacks(__ATINIT__)
150
+ }
151
+ __name(initRuntime, "initRuntime")
152
+ function preMain() {
153
+ callRuntimeCallbacks(__ATMAIN__)
154
+ }
155
+ __name(preMain, "preMain")
156
+ function postRun() {
157
+ if (Module["postRun"]) {
158
+ if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]]
159
+ while (Module["postRun"].length) {
160
+ addOnPostRun(Module["postRun"].shift())
161
+ }
162
+ }
163
+ callRuntimeCallbacks(__ATPOSTRUN__)
164
+ }
165
+ __name(postRun, "postRun")
166
+ function addOnPreRun(cb) {
167
+ __ATPRERUN__.unshift(cb)
168
+ }
169
+ __name(addOnPreRun, "addOnPreRun")
170
+ function addOnInit(cb) {
171
+ __ATINIT__.unshift(cb)
172
+ }
173
+ __name(addOnInit, "addOnInit")
174
+ function addOnPreMain(cb) {
175
+ __ATMAIN__.unshift(cb)
176
+ }
177
+ __name(addOnPreMain, "addOnPreMain")
178
+ function addOnExit(cb) {}
179
+ __name(addOnExit, "addOnExit")
180
+ function addOnPostRun(cb) {
181
+ __ATPOSTRUN__.unshift(cb)
182
+ }
183
+ __name(addOnPostRun, "addOnPostRun")
184
+ var runDependencies = 0
185
+ var dependenciesFulfilled = null
186
+ function getUniqueRunDependency(id) {
187
+ return id
188
+ }
189
+ __name(getUniqueRunDependency, "getUniqueRunDependency")
190
+ function addRunDependency(id) {
191
+ runDependencies++
192
+ Module["monitorRunDependencies"]?.(runDependencies)
193
+ }
194
+ __name(addRunDependency, "addRunDependency")
195
+ function removeRunDependency(id) {
196
+ runDependencies--
197
+ Module["monitorRunDependencies"]?.(runDependencies)
198
+ if (runDependencies == 0) {
199
+ if (dependenciesFulfilled) {
200
+ var callback = dependenciesFulfilled
201
+ dependenciesFulfilled = null
202
+ callback()
203
+ }
204
+ }
205
+ }
206
+ __name(removeRunDependency, "removeRunDependency")
207
+ function abort(what) {
208
+ Module["onAbort"]?.(what)
209
+ what = "Aborted(" + what + ")"
210
+ err(what)
211
+ ABORT = true
212
+ what += ". Build with -sASSERTIONS for more info."
213
+ var e = new WebAssembly.RuntimeError(what)
214
+ readyPromiseReject(e)
215
+ throw e
216
+ }
217
+ __name(abort, "abort")
218
+
219
+ var ASM_CONSTS = {}
220
+ class ExitStatus {
221
+ static {
222
+ __name(this, "ExitStatus")
223
+ }
224
+ name = "ExitStatus"
225
+ constructor(status) {
226
+ this.message = `Program terminated with exit(${status})`
227
+ this.status = status
228
+ }
229
+ }
230
+ var GOT = {}
231
+ var currentModuleWeakSymbols = /* @__PURE__ */ new Set([])
232
+ var GOTHandler = {
233
+ get(obj, symName) {
234
+ var rtn = GOT[symName]
235
+ if (!rtn) {
236
+ rtn = GOT[symName] = new WebAssembly.Global({
237
+ value: "i32",
238
+ mutable: true,
239
+ })
240
+ }
241
+ if (!currentModuleWeakSymbols.has(symName)) {
242
+ rtn.required = true
243
+ }
244
+ return rtn
245
+ },
246
+ }
247
+ var LE_HEAP_LOAD_F32 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getFloat32(byteOffset, true), "LE_HEAP_LOAD_F32")
248
+ var LE_HEAP_LOAD_F64 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getFloat64(byteOffset, true), "LE_HEAP_LOAD_F64")
249
+ var LE_HEAP_LOAD_I16 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getInt16(byteOffset, true), "LE_HEAP_LOAD_I16")
250
+ var LE_HEAP_LOAD_I32 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getInt32(byteOffset, true), "LE_HEAP_LOAD_I32")
251
+ var LE_HEAP_LOAD_U16 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getUint16(byteOffset, true), "LE_HEAP_LOAD_U16")
252
+ var LE_HEAP_LOAD_U32 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getUint32(byteOffset, true), "LE_HEAP_LOAD_U32")
253
+ var LE_HEAP_STORE_F32 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setFloat32(byteOffset, value, true), "LE_HEAP_STORE_F32")
254
+ var LE_HEAP_STORE_F64 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setFloat64(byteOffset, value, true), "LE_HEAP_STORE_F64")
255
+ var LE_HEAP_STORE_I16 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setInt16(byteOffset, value, true), "LE_HEAP_STORE_I16")
256
+ var LE_HEAP_STORE_I32 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setInt32(byteOffset, value, true), "LE_HEAP_STORE_I32")
257
+ var LE_HEAP_STORE_U16 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setUint16(byteOffset, value, true), "LE_HEAP_STORE_U16")
258
+ var LE_HEAP_STORE_U32 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setUint32(byteOffset, value, true), "LE_HEAP_STORE_U32")
259
+ var callRuntimeCallbacks = /* @__PURE__ */ __name((callbacks) => {
260
+ while (callbacks.length > 0) {
261
+ callbacks.shift()(Module)
262
+ }
263
+ }, "callRuntimeCallbacks")
264
+ var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder() : void 0
265
+ var UTF8ArrayToString = /* @__PURE__ */ __name((heapOrArray, idx = 0, maxBytesToRead = NaN) => {
266
+ var endIdx = idx + maxBytesToRead
267
+ var endPtr = idx
268
+ while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr
269
+ if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
270
+ return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr))
271
+ }
272
+ var str = ""
273
+ while (idx < endPtr) {
274
+ var u0 = heapOrArray[idx++]
275
+ if (!(u0 & 128)) {
276
+ str += String.fromCharCode(u0)
277
+ continue
278
+ }
279
+ var u1 = heapOrArray[idx++] & 63
280
+ if ((u0 & 224) == 192) {
281
+ str += String.fromCharCode(((u0 & 31) << 6) | u1)
282
+ continue
283
+ }
284
+ var u2 = heapOrArray[idx++] & 63
285
+ if ((u0 & 240) == 224) {
286
+ u0 = ((u0 & 15) << 12) | (u1 << 6) | u2
287
+ } else {
288
+ u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63)
289
+ }
290
+ if (u0 < 65536) {
291
+ str += String.fromCharCode(u0)
292
+ } else {
293
+ var ch = u0 - 65536
294
+ str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023))
295
+ }
296
+ }
297
+ return str
298
+ }, "UTF8ArrayToString")
299
+ var getDylinkMetadata = /* @__PURE__ */ __name((binary2) => {
300
+ var offset = 0
301
+ var end = 0
302
+ function getU8() {
303
+ return binary2[offset++]
304
+ }
305
+ __name(getU8, "getU8")
306
+ function getLEB() {
307
+ var ret = 0
308
+ var mul = 1
309
+ while (1) {
310
+ var byte = binary2[offset++]
311
+ ret += (byte & 127) * mul
312
+ mul *= 128
313
+ if (!(byte & 128)) break
314
+ }
315
+ return ret
316
+ }
317
+ __name(getLEB, "getLEB")
318
+ function getString() {
319
+ var len = getLEB()
320
+ offset += len
321
+ return UTF8ArrayToString(binary2, offset - len, len)
322
+ }
323
+ __name(getString, "getString")
324
+ function failIf(condition, message) {
325
+ if (condition) throw new Error(message)
326
+ }
327
+ __name(failIf, "failIf")
328
+ var name2 = "dylink.0"
329
+ if (binary2 instanceof WebAssembly.Module) {
330
+ var dylinkSection = WebAssembly.Module.customSections(binary2, name2)
331
+ if (dylinkSection.length === 0) {
332
+ name2 = "dylink"
333
+ dylinkSection = WebAssembly.Module.customSections(binary2, name2)
334
+ }
335
+ failIf(dylinkSection.length === 0, "need dylink section")
336
+ binary2 = new Uint8Array(dylinkSection[0])
337
+ end = binary2.length
338
+ } else {
339
+ var int32View = new Uint32Array(new Uint8Array(binary2.subarray(0, 24)).buffer)
340
+ var magicNumberFound = int32View[0] == 1836278016 || int32View[0] == 6386541
341
+ failIf(!magicNumberFound, "need to see wasm magic number")
342
+ failIf(binary2[8] !== 0, "need the dylink section to be first")
343
+ offset = 9
344
+ var section_size = getLEB()
345
+ end = offset + section_size
346
+ name2 = getString()
347
+ }
348
+ var customSection = {
349
+ neededDynlibs: [],
350
+ tlsExports: /* @__PURE__ */ new Set(),
351
+ weakImports: /* @__PURE__ */ new Set(),
352
+ }
353
+ if (name2 == "dylink") {
354
+ customSection.memorySize = getLEB()
355
+ customSection.memoryAlign = getLEB()
356
+ customSection.tableSize = getLEB()
357
+ customSection.tableAlign = getLEB()
358
+ var neededDynlibsCount = getLEB()
359
+ for (var i2 = 0; i2 < neededDynlibsCount; ++i2) {
360
+ var libname = getString()
361
+ customSection.neededDynlibs.push(libname)
362
+ }
363
+ } else {
364
+ failIf(name2 !== "dylink.0")
365
+ var WASM_DYLINK_MEM_INFO = 1
366
+ var WASM_DYLINK_NEEDED = 2
367
+ var WASM_DYLINK_EXPORT_INFO = 3
368
+ var WASM_DYLINK_IMPORT_INFO = 4
369
+ var WASM_SYMBOL_TLS = 256
370
+ var WASM_SYMBOL_BINDING_MASK = 3
371
+ var WASM_SYMBOL_BINDING_WEAK = 1
372
+ while (offset < end) {
373
+ var subsectionType = getU8()
374
+ var subsectionSize = getLEB()
375
+ if (subsectionType === WASM_DYLINK_MEM_INFO) {
376
+ customSection.memorySize = getLEB()
377
+ customSection.memoryAlign = getLEB()
378
+ customSection.tableSize = getLEB()
379
+ customSection.tableAlign = getLEB()
380
+ } else if (subsectionType === WASM_DYLINK_NEEDED) {
381
+ var neededDynlibsCount = getLEB()
382
+ for (var i2 = 0; i2 < neededDynlibsCount; ++i2) {
383
+ libname = getString()
384
+ customSection.neededDynlibs.push(libname)
385
+ }
386
+ } else if (subsectionType === WASM_DYLINK_EXPORT_INFO) {
387
+ var count = getLEB()
388
+ while (count--) {
389
+ var symname = getString()
390
+ var flags2 = getLEB()
391
+ if (flags2 & WASM_SYMBOL_TLS) {
392
+ customSection.tlsExports.add(symname)
393
+ }
394
+ }
395
+ } else if (subsectionType === WASM_DYLINK_IMPORT_INFO) {
396
+ var count = getLEB()
397
+ while (count--) {
398
+ var modname = getString()
399
+ var symname = getString()
400
+ var flags2 = getLEB()
401
+ if ((flags2 & WASM_SYMBOL_BINDING_MASK) == WASM_SYMBOL_BINDING_WEAK) {
402
+ customSection.weakImports.add(symname)
403
+ }
404
+ }
405
+ } else {
406
+ offset += subsectionSize
407
+ }
408
+ }
409
+ }
410
+ return customSection
411
+ }, "getDylinkMetadata")
412
+ function getValue(ptr, type = "i8") {
413
+ if (type.endsWith("*")) type = "*"
414
+ switch (type) {
415
+ case "i1":
416
+ return HEAP8[ptr]
417
+ case "i8":
418
+ return HEAP8[ptr]
419
+ case "i16":
420
+ return LE_HEAP_LOAD_I16((ptr >> 1) * 2)
421
+ case "i32":
422
+ return LE_HEAP_LOAD_I32((ptr >> 2) * 4)
423
+ case "i64":
424
+ return HEAP64[ptr >> 3]
425
+ case "float":
426
+ return LE_HEAP_LOAD_F32((ptr >> 2) * 4)
427
+ case "double":
428
+ return LE_HEAP_LOAD_F64((ptr >> 3) * 8)
429
+ case "*":
430
+ return LE_HEAP_LOAD_U32((ptr >> 2) * 4)
431
+ default:
432
+ abort(`invalid type for getValue: ${type}`)
433
+ }
434
+ }
435
+ __name(getValue, "getValue")
436
+ var newDSO = /* @__PURE__ */ __name((name2, handle2, syms) => {
437
+ var dso = {
438
+ refcount: Infinity,
439
+ name: name2,
440
+ exports: syms,
441
+ global: true,
442
+ }
443
+ LDSO.loadedLibsByName[name2] = dso
444
+ if (handle2 != void 0) {
445
+ LDSO.loadedLibsByHandle[handle2] = dso
446
+ }
447
+ return dso
448
+ }, "newDSO")
449
+ var LDSO = {
450
+ loadedLibsByName: {},
451
+ loadedLibsByHandle: {},
452
+ init() {
453
+ newDSO("__main__", 0, wasmImports)
454
+ },
455
+ }
456
+ var ___heap_base = 78224
457
+ var alignMemory = /* @__PURE__ */ __name((size, alignment) => Math.ceil(size / alignment) * alignment, "alignMemory")
458
+ var getMemory = /* @__PURE__ */ __name((size) => {
459
+ if (runtimeInitialized) {
460
+ return _calloc(size, 1)
461
+ }
462
+ var ret = ___heap_base
463
+ var end = ret + alignMemory(size, 16)
464
+ ___heap_base = end
465
+ // fix race condition that seems to only show up when loaded in the browser (not this was carried over from older loader so unsure if race condition still exists)
466
+ // note: this change should be ok even if nothing was wrong in the first place (just inits GOT.__heap_base)
467
+ (!GOT.__heap_base)&&GOTHandler.get(wasmImports, "__heap_base")
468
+ GOT["__heap_base"].value = end
469
+ return ret
470
+ }, "getMemory")
471
+ var isInternalSym = /* @__PURE__ */ __name((symName) => ["__cpp_exception", "__c_longjmp", "__wasm_apply_data_relocs", "__dso_handle", "__tls_size", "__tls_align", "__set_stack_limits", "_emscripten_tls_init", "__wasm_init_tls", "__wasm_call_ctors", "__start_em_asm", "__stop_em_asm", "__start_em_js", "__stop_em_js"].includes(symName) || symName.startsWith("__em_js__"), "isInternalSym")
472
+ var uleb128Encode = /* @__PURE__ */ __name((n, target) => {
473
+ if (n < 128) {
474
+ target.push(n)
475
+ } else {
476
+ target.push(n % 128 | 128, n >> 7)
477
+ }
478
+ }, "uleb128Encode")
479
+ var sigToWasmTypes = /* @__PURE__ */ __name((sig) => {
480
+ var typeNames = {
481
+ i: "i32",
482
+ j: "i64",
483
+ f: "f32",
484
+ d: "f64",
485
+ e: "externref",
486
+ p: "i32",
487
+ }
488
+ var type = {
489
+ parameters: [],
490
+ results: sig[0] == "v" ? [] : [typeNames[sig[0]]],
491
+ }
492
+ for (var i2 = 1; i2 < sig.length; ++i2) {
493
+ type.parameters.push(typeNames[sig[i2]])
494
+ }
495
+ return type
496
+ }, "sigToWasmTypes")
497
+ var generateFuncType = /* @__PURE__ */ __name((sig, target) => {
498
+ var sigRet = sig.slice(0, 1)
499
+ var sigParam = sig.slice(1)
500
+ var typeCodes = {
501
+ i: 127,
502
+ // i32
503
+ p: 127,
504
+ // i32
505
+ j: 126,
506
+ // i64
507
+ f: 125,
508
+ // f32
509
+ d: 124,
510
+ // f64
511
+ e: 111,
512
+ }
513
+ target.push(96)
514
+ uleb128Encode(sigParam.length, target)
515
+ for (var i2 = 0; i2 < sigParam.length; ++i2) {
516
+ target.push(typeCodes[sigParam[i2]])
517
+ }
518
+ if (sigRet == "v") {
519
+ target.push(0)
520
+ } else {
521
+ target.push(1, typeCodes[sigRet])
522
+ }
523
+ }, "generateFuncType")
524
+ var convertJsFunctionToWasm = /* @__PURE__ */ __name((func2, sig) => {
525
+ if (typeof WebAssembly.Function == "function") {
526
+ return new WebAssembly.Function(sigToWasmTypes(sig), func2)
527
+ }
528
+ var typeSectionBody = [1]
529
+ generateFuncType(sig, typeSectionBody)
530
+ var bytes = [
531
+ 0,
532
+ 97,
533
+ 115,
534
+ 109,
535
+ // magic ("\0asm")
536
+ 1,
537
+ 0,
538
+ 0,
539
+ 0,
540
+ // version: 1
541
+ 1,
542
+ ]
543
+ uleb128Encode(typeSectionBody.length, bytes)
544
+ bytes.push(...typeSectionBody)
545
+ bytes.push(
546
+ 2,
547
+ 7,
548
+ // import section
549
+ // (import "e" "f" (func 0 (type 0)))
550
+ 1,
551
+ 1,
552
+ 101,
553
+ 1,
554
+ 102,
555
+ 0,
556
+ 0,
557
+ 7,
558
+ 5,
559
+ // export section
560
+ // (export "f" (func 0 (type 0)))
561
+ 1,
562
+ 1,
563
+ 102,
564
+ 0,
565
+ 0
566
+ )
567
+ var module2 = new WebAssembly.Module(new Uint8Array(bytes))
568
+ var instance2 = new WebAssembly.Instance(module2, {
569
+ e: {
570
+ f: func2,
571
+ },
572
+ })
573
+ var wrappedFunc = instance2.exports["f"]
574
+ return wrappedFunc
575
+ }, "convertJsFunctionToWasm")
576
+ var wasmTableMirror = []
577
+ var wasmTable = new WebAssembly.Table({
578
+ initial: 31,
579
+ element: "anyfunc",
580
+ })
581
+ var getWasmTableEntry = /* @__PURE__ */ __name((funcPtr) => {
582
+ var func2 = wasmTableMirror[funcPtr]
583
+ if (!func2) {
584
+ if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1
585
+ wasmTableMirror[funcPtr] = func2 = wasmTable.get(funcPtr)
586
+ }
587
+ return func2
588
+ }, "getWasmTableEntry")
589
+ var updateTableMap = /* @__PURE__ */ __name((offset, count) => {
590
+ if (functionsInTableMap) {
591
+ for (var i2 = offset; i2 < offset + count; i2++) {
592
+ var item = getWasmTableEntry(i2)
593
+ if (item) {
594
+ functionsInTableMap.set(item, i2)
595
+ }
596
+ }
597
+ }
598
+ }, "updateTableMap")
599
+ var functionsInTableMap
600
+ var getFunctionAddress = /* @__PURE__ */ __name((func2) => {
601
+ if (!functionsInTableMap) {
602
+ functionsInTableMap = /* @__PURE__ */ new WeakMap()
603
+ updateTableMap(0, wasmTable.length)
604
+ }
605
+ return functionsInTableMap.get(func2) || 0
606
+ }, "getFunctionAddress")
607
+ var freeTableIndexes = []
608
+ var getEmptyTableSlot = /* @__PURE__ */ __name(() => {
609
+ if (freeTableIndexes.length) {
610
+ return freeTableIndexes.pop()
611
+ }
612
+ try {
613
+ wasmTable.grow(1)
614
+ } catch (err2) {
615
+ if (!(err2 instanceof RangeError)) {
616
+ throw err2
617
+ }
618
+ throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."
619
+ }
620
+ return wasmTable.length - 1
621
+ }, "getEmptyTableSlot")
622
+ var setWasmTableEntry = /* @__PURE__ */ __name((idx, func2) => {
623
+ wasmTable.set(idx, func2)
624
+ wasmTableMirror[idx] = wasmTable.get(idx)
625
+ }, "setWasmTableEntry")
626
+ var addFunction = /* @__PURE__ */ __name((func2, sig) => {
627
+ var rtn = getFunctionAddress(func2)
628
+ if (rtn) {
629
+ return rtn
630
+ }
631
+ var ret = getEmptyTableSlot()
632
+ try {
633
+ setWasmTableEntry(ret, func2)
634
+ } catch (err2) {
635
+ if (!(err2 instanceof TypeError)) {
636
+ throw err2
637
+ }
638
+ var wrapped = convertJsFunctionToWasm(func2, sig)
639
+ setWasmTableEntry(ret, wrapped)
640
+ }
641
+ functionsInTableMap.set(func2, ret)
642
+ return ret
643
+ }, "addFunction")
644
+ var updateGOT = /* @__PURE__ */ __name((exports, replace) => {
645
+ for (var symName in exports) {
646
+ if (isInternalSym(symName)) {
647
+ continue
648
+ }
649
+ var value = exports[symName]
650
+ GOT[symName] ||= new WebAssembly.Global({
651
+ value: "i32",
652
+ mutable: true,
653
+ })
654
+ if (replace || GOT[symName].value == 0) {
655
+ if (typeof value == "function") {
656
+ GOT[symName].value = addFunction(value)
657
+ } else if (typeof value == "number") {
658
+ GOT[symName].value = value
659
+ } else {
660
+ err(`unhandled export type for '${symName}': ${typeof value}`)
661
+ }
662
+ }
663
+ }
664
+ }, "updateGOT")
665
+ var relocateExports = /* @__PURE__ */ __name((exports, memoryBase2, replace) => {
666
+ var relocated = {}
667
+ for (var e in exports) {
668
+ var value = exports[e]
669
+ if (typeof value == "object") {
670
+ value = value.value
671
+ }
672
+ if (typeof value == "number") {
673
+ value += memoryBase2
674
+ }
675
+ relocated[e] = value
676
+ }
677
+ updateGOT(relocated, replace)
678
+ return relocated
679
+ }, "relocateExports")
680
+ var isSymbolDefined = /* @__PURE__ */ __name((symName) => {
681
+ var existing = wasmImports[symName]
682
+ if (!existing || existing.stub) {
683
+ return false
684
+ }
685
+ return true
686
+ }, "isSymbolDefined")
687
+ var dynCall = /* @__PURE__ */ __name((sig, ptr, args2 = []) => {
688
+ var rtn = getWasmTableEntry(ptr)(...args2)
689
+ return rtn
690
+ }, "dynCall")
691
+ var stackSave = /* @__PURE__ */ __name(() => _emscripten_stack_get_current(), "stackSave")
692
+ var stackRestore = /* @__PURE__ */ __name((val) => __emscripten_stack_restore(val), "stackRestore")
693
+ var createInvokeFunction = /* @__PURE__ */ __name(
694
+ (sig) =>
695
+ (ptr, ...args2) => {
696
+ var sp = stackSave()
697
+ try {
698
+ return dynCall(sig, ptr, args2)
699
+ } catch (e) {
700
+ stackRestore(sp)
701
+ if (e !== e + 0) throw e
702
+ _setThrew(1, 0)
703
+ if (sig[0] == "j") return 0n
704
+ }
705
+ },
706
+ "createInvokeFunction"
707
+ )
708
+ var resolveGlobalSymbol = /* @__PURE__ */ __name((symName, direct = false) => {
709
+ var sym
710
+ if (isSymbolDefined(symName)) {
711
+ sym = wasmImports[symName]
712
+ } else if (symName.startsWith("invoke_")) {
713
+ sym = wasmImports[symName] = createInvokeFunction(symName.split("_")[1])
714
+ }
715
+ return {
716
+ sym,
717
+ name: symName,
718
+ }
719
+ }, "resolveGlobalSymbol")
720
+ var UTF8ToString = /* @__PURE__ */ __name((ptr, maxBytesToRead) => (ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""), "UTF8ToString")
721
+ var loadWebAssemblyModule = /* @__PURE__ */ __name((binary, flags, libName, localScope, handle) => {
722
+ var metadata = getDylinkMetadata(binary)
723
+ currentModuleWeakSymbols = metadata.weakImports
724
+ function loadModule() {
725
+ var firstLoad = !handle || !HEAP8[handle + 8]
726
+ if (firstLoad) {
727
+ var memAlign = Math.pow(2, metadata.memoryAlign)
728
+ var memoryBase = metadata.memorySize ? alignMemory(getMemory(metadata.memorySize + memAlign), memAlign) : 0
729
+ var tableBase = metadata.tableSize ? wasmTable.length : 0
730
+ if (handle) {
731
+ HEAP8[handle + 8] = 1
732
+ LE_HEAP_STORE_U32(((handle + 12) >> 2) * 4, memoryBase)
733
+ LE_HEAP_STORE_I32(((handle + 16) >> 2) * 4, metadata.memorySize)
734
+ LE_HEAP_STORE_U32(((handle + 20) >> 2) * 4, tableBase)
735
+ LE_HEAP_STORE_I32(((handle + 24) >> 2) * 4, metadata.tableSize)
736
+ }
737
+ } else {
738
+ memoryBase = LE_HEAP_LOAD_U32(((handle + 12) >> 2) * 4)
739
+ tableBase = LE_HEAP_LOAD_U32(((handle + 20) >> 2) * 4)
740
+ }
741
+ var tableGrowthNeeded = tableBase + metadata.tableSize - wasmTable.length
742
+ if (tableGrowthNeeded > 0) {
743
+ wasmTable.grow(tableGrowthNeeded)
744
+ }
745
+ var moduleExports
746
+ function resolveSymbol(sym) {
747
+ var resolved = resolveGlobalSymbol(sym).sym
748
+ if (!resolved && localScope) {
749
+ resolved = localScope[sym]
750
+ }
751
+ if (!resolved) {
752
+ resolved = moduleExports[sym]
753
+ }
754
+ return resolved
755
+ }
756
+ __name(resolveSymbol, "resolveSymbol")
757
+ var proxyHandler = {
758
+ get(stubs, prop) {
759
+ switch (prop) {
760
+ case "__memory_base":
761
+ return memoryBase
762
+ case "__table_base":
763
+ return tableBase
764
+ }
765
+ if (prop in wasmImports && !wasmImports[prop].stub) {
766
+ return wasmImports[prop]
767
+ }
768
+ if (!(prop in stubs)) {
769
+ var resolved
770
+ stubs[prop] = (...args2) => {
771
+ resolved ||= resolveSymbol(prop)
772
+ return resolved(...args2)
773
+ }
774
+ }
775
+ return stubs[prop]
776
+ },
777
+ }
778
+ var proxy = new Proxy({}, proxyHandler)
779
+ var info = {
780
+ "GOT.mem": new Proxy({}, GOTHandler),
781
+ "GOT.func": new Proxy({}, GOTHandler),
782
+ env: proxy,
783
+ wasi_snapshot_preview1: proxy,
784
+ }
785
+ function postInstantiation(module, instance) {
786
+ updateTableMap(tableBase, metadata.tableSize)
787
+ moduleExports = relocateExports(instance.exports, memoryBase)
788
+ if (!flags.allowUndefined) {
789
+ reportUndefinedSymbols()
790
+ }
791
+ function addEmAsm(addr, body) {
792
+ var args = []
793
+ var arity = 0
794
+ for (; arity < 16; arity++) {
795
+ if (body.indexOf("$" + arity) != -1) {
796
+ args.push("$" + arity)
797
+ } else {
798
+ break
799
+ }
800
+ }
801
+ args = args.join(",")
802
+ var func = `(${args}) => { ${body} };`
803
+ ASM_CONSTS[start] = eval(func)
804
+ }
805
+ __name(addEmAsm, "addEmAsm")
806
+ if ("__start_em_asm" in moduleExports) {
807
+ var start = moduleExports["__start_em_asm"]
808
+ var stop = moduleExports["__stop_em_asm"]
809
+ while (start < stop) {
810
+ var jsString = UTF8ToString(start)
811
+ addEmAsm(start, jsString)
812
+ start = HEAPU8.indexOf(0, start) + 1
813
+ }
814
+ }
815
+ function addEmJs(name, cSig, body) {
816
+ var jsArgs = []
817
+ cSig = cSig.slice(1, -1)
818
+ if (cSig != "void") {
819
+ cSig = cSig.split(",")
820
+ for (var i in cSig) {
821
+ var jsArg = cSig[i].split(" ").pop()
822
+ jsArgs.push(jsArg.replace("*", ""))
823
+ }
824
+ }
825
+ var func = `(${jsArgs}) => ${body};`
826
+ moduleExports[name] = eval(func)
827
+ }
828
+ __name(addEmJs, "addEmJs")
829
+ for (var name in moduleExports) {
830
+ if (name.startsWith("__em_js__")) {
831
+ var start = moduleExports[name]
832
+ var jsString = UTF8ToString(start)
833
+ var parts = jsString.split("<::>")
834
+ addEmJs(name.replace("__em_js__", ""), parts[0], parts[1])
835
+ delete moduleExports[name]
836
+ }
837
+ }
838
+ var applyRelocs = moduleExports["__wasm_apply_data_relocs"]
839
+ if (applyRelocs) {
840
+ if (runtimeInitialized) {
841
+ applyRelocs()
842
+ } else {
843
+ __RELOC_FUNCS__.push(applyRelocs)
844
+ }
845
+ }
846
+ var init = moduleExports["__wasm_call_ctors"]
847
+ if (init) {
848
+ if (runtimeInitialized) {
849
+ init()
850
+ } else {
851
+ __ATINIT__.push(init)
852
+ }
853
+ }
854
+ return moduleExports
855
+ }
856
+ __name(postInstantiation, "postInstantiation")
857
+ if (flags.loadAsync) {
858
+ if (binary instanceof WebAssembly.Module) {
859
+ var instance = new WebAssembly.Instance(binary, info)
860
+ return Promise.resolve(postInstantiation(binary, instance))
861
+ }
862
+ return WebAssembly.instantiate(binary, info).then((result) => postInstantiation(result.module, result.instance))
863
+ }
864
+ var module = binary instanceof WebAssembly.Module ? binary : new WebAssembly.Module(binary)
865
+ var instance = new WebAssembly.Instance(module, info)
866
+ return postInstantiation(module, instance)
867
+ }
868
+ __name(loadModule, "loadModule")
869
+ if (flags.loadAsync) {
870
+ return metadata.neededDynlibs.reduce((chain, dynNeeded) => chain.then(() => loadDynamicLibrary(dynNeeded, flags, localScope)), Promise.resolve()).then(loadModule)
871
+ }
872
+ metadata.neededDynlibs.forEach((needed) => loadDynamicLibrary(needed, flags, localScope))
873
+ return loadModule()
874
+ }, "loadWebAssemblyModule")
875
+ var mergeLibSymbols = /* @__PURE__ */ __name((exports, libName2) => {
876
+ for (var [sym, exp] of Object.entries(exports)) {
877
+ const setImport = /* @__PURE__ */ __name((target) => {
878
+ if (!isSymbolDefined(target)) {
879
+ wasmImports[target] = exp
880
+ }
881
+ }, "setImport")
882
+ setImport(sym)
883
+ const main_alias = "__main_argc_argv"
884
+ if (sym == "main") {
885
+ setImport(main_alias)
886
+ }
887
+ if (sym == main_alias) {
888
+ setImport("main")
889
+ }
890
+ }
891
+ }, "mergeLibSymbols")
892
+ var asyncLoad = /* @__PURE__ */ __name(async (url) => {
893
+ var arrayBuffer = await readAsync(url)
894
+ return new Uint8Array(arrayBuffer)
895
+ }, "asyncLoad")
896
+ function loadDynamicLibrary(
897
+ libName2,
898
+ flags2 = {
899
+ global: true,
900
+ nodelete: true,
901
+ },
902
+ localScope2,
903
+ handle2
904
+ ) {
905
+ var dso = LDSO.loadedLibsByName[libName2]
906
+ if (dso) {
907
+ if (!flags2.global) {
908
+ if (localScope2) {
909
+ Object.assign(localScope2, dso.exports)
910
+ }
911
+ } else if (!dso.global) {
912
+ dso.global = true
913
+ mergeLibSymbols(dso.exports, libName2)
914
+ }
915
+ if (flags2.nodelete && dso.refcount !== Infinity) {
916
+ dso.refcount = Infinity
917
+ }
918
+ dso.refcount++
919
+ if (handle2) {
920
+ LDSO.loadedLibsByHandle[handle2] = dso
921
+ }
922
+ return flags2.loadAsync ? Promise.resolve(true) : true
923
+ }
924
+ dso = newDSO(libName2, handle2, "loading")
925
+ dso.refcount = flags2.nodelete ? Infinity : 1
926
+ dso.global = flags2.global
927
+ function loadLibData() {
928
+ if (handle2) {
929
+ var data = LE_HEAP_LOAD_U32(((handle2 + 28) >> 2) * 4)
930
+ var dataSize = LE_HEAP_LOAD_U32(((handle2 + 32) >> 2) * 4)
931
+ if (data && dataSize) {
932
+ var libData = HEAP8.slice(data, data + dataSize)
933
+ return flags2.loadAsync ? Promise.resolve(libData) : libData
934
+ }
935
+ }
936
+ var libFile = locateFile(libName2)
937
+ if (flags2.loadAsync) {
938
+ return asyncLoad(libFile)
939
+ }
940
+ if (!readBinary) {
941
+ throw new Error(`${libFile}: file not found, and synchronous loading of external files is not available`)
942
+ }
943
+ return readBinary(libFile)
944
+ }
945
+ __name(loadLibData, "loadLibData")
946
+ function getExports() {
947
+ if (flags2.loadAsync) {
948
+ return loadLibData().then((libData) => loadWebAssemblyModule(libData, flags2, libName2, localScope2, handle2))
949
+ }
950
+ return loadWebAssemblyModule(loadLibData(), flags2, libName2, localScope2, handle2)
951
+ }
952
+ __name(getExports, "getExports")
953
+ function moduleLoaded(exports) {
954
+ if (dso.global) {
955
+ mergeLibSymbols(exports, libName2)
956
+ } else if (localScope2) {
957
+ Object.assign(localScope2, exports)
958
+ }
959
+ dso.exports = exports
960
+ }
961
+ __name(moduleLoaded, "moduleLoaded")
962
+ if (flags2.loadAsync) {
963
+ return getExports().then((exports) => {
964
+ moduleLoaded(exports)
965
+ return true
966
+ })
967
+ }
968
+ moduleLoaded(getExports())
969
+ return true
970
+ }
971
+ __name(loadDynamicLibrary, "loadDynamicLibrary")
972
+ var reportUndefinedSymbols = /* @__PURE__ */ __name(() => {
973
+ for (var [symName, entry] of Object.entries(GOT)) {
974
+ if (entry.value == 0) {
975
+ var value = resolveGlobalSymbol(symName, true).sym
976
+ if (!value && !entry.required) {
977
+ continue
978
+ }
979
+ if (typeof value == "function") {
980
+ entry.value = addFunction(value, value.sig)
981
+ } else if (typeof value == "number") {
982
+ entry.value = value
983
+ } else {
984
+ throw new Error(`bad export type for '${symName}': ${typeof value}`)
985
+ }
986
+ }
987
+ }
988
+ }, "reportUndefinedSymbols")
989
+ var loadDylibs = /* @__PURE__ */ __name(() => {
990
+ if (!dynamicLibraries.length) {
991
+ reportUndefinedSymbols()
992
+ return
993
+ }
994
+ addRunDependency("loadDylibs")
995
+ dynamicLibraries
996
+ .reduce(
997
+ (chain, lib) =>
998
+ chain.then(() =>
999
+ loadDynamicLibrary(lib, {
1000
+ loadAsync: true,
1001
+ global: true,
1002
+ nodelete: true,
1003
+ allowUndefined: true,
1004
+ })
1005
+ ),
1006
+ Promise.resolve()
1007
+ )
1008
+ .then(() => {
1009
+ reportUndefinedSymbols()
1010
+ removeRunDependency("loadDylibs")
1011
+ })
1012
+ }, "loadDylibs")
1013
+ function setValue(ptr, value, type = "i8") {
1014
+ if (type.endsWith("*")) type = "*"
1015
+ switch (type) {
1016
+ case "i1":
1017
+ HEAP8[ptr] = value
1018
+ break
1019
+ case "i8":
1020
+ HEAP8[ptr] = value
1021
+ break
1022
+ case "i16":
1023
+ LE_HEAP_STORE_I16((ptr >> 1) * 2, value)
1024
+ break
1025
+ case "i32":
1026
+ LE_HEAP_STORE_I32((ptr >> 2) * 4, value)
1027
+ break
1028
+ case "i64":
1029
+ HEAP64[ptr >> 3] = BigInt(value)
1030
+ break
1031
+ case "float":
1032
+ LE_HEAP_STORE_F32((ptr >> 2) * 4, value)
1033
+ break
1034
+ case "double":
1035
+ LE_HEAP_STORE_F64((ptr >> 3) * 8, value)
1036
+ break
1037
+ case "*":
1038
+ LE_HEAP_STORE_U32((ptr >> 2) * 4, value)
1039
+ break
1040
+ default:
1041
+ abort(`invalid type for setValue: ${type}`)
1042
+ }
1043
+ }
1044
+ __name(setValue, "setValue")
1045
+ var ___memory_base = new WebAssembly.Global(
1046
+ {
1047
+ value: "i32",
1048
+ mutable: false,
1049
+ },
1050
+ 1024
1051
+ )
1052
+ var ___stack_pointer = new WebAssembly.Global(
1053
+ {
1054
+ value: "i32",
1055
+ mutable: true,
1056
+ },
1057
+ 78224
1058
+ )
1059
+ var ___table_base = new WebAssembly.Global(
1060
+ {
1061
+ value: "i32",
1062
+ mutable: false,
1063
+ },
1064
+ 1
1065
+ )
1066
+ var __abort_js = /* @__PURE__ */ __name(() => abort(""), "__abort_js")
1067
+ __abort_js.sig = "v"
1068
+ var _emscripten_get_now = /* @__PURE__ */ __name(() => performance.now(), "_emscripten_get_now")
1069
+ _emscripten_get_now.sig = "d"
1070
+ var _emscripten_date_now = /* @__PURE__ */ __name(() => Date.now(), "_emscripten_date_now")
1071
+ _emscripten_date_now.sig = "d"
1072
+ var nowIsMonotonic = 1
1073
+ var checkWasiClock = /* @__PURE__ */ __name((clock_id) => clock_id >= 0 && clock_id <= 3, "checkWasiClock")
1074
+ var INT53_MAX = 9007199254740992
1075
+ var INT53_MIN = -9007199254740992
1076
+ var bigintToI53Checked = /* @__PURE__ */ __name((num) => (num < INT53_MIN || num > INT53_MAX ? NaN : Number(num)), "bigintToI53Checked")
1077
+ function _clock_time_get(clk_id, ignored_precision, ptime) {
1078
+ ignored_precision = bigintToI53Checked(ignored_precision)
1079
+ if (!checkWasiClock(clk_id)) {
1080
+ return 28
1081
+ }
1082
+ var now
1083
+ if (clk_id === 0) {
1084
+ now = _emscripten_date_now()
1085
+ } else if (nowIsMonotonic) {
1086
+ now = _emscripten_get_now()
1087
+ } else {
1088
+ return 52
1089
+ }
1090
+ var nsec = Math.round(now * 1e3 * 1e3)
1091
+ HEAP64[ptime >> 3] = BigInt(nsec)
1092
+ return 0
1093
+ }
1094
+ __name(_clock_time_get, "_clock_time_get")
1095
+ _clock_time_get.sig = "iijp"
1096
+ var getHeapMax = /* @__PURE__ */ __name(
1097
+ () =>
1098
+ // Stay one Wasm page short of 4GB: while e.g. Chrome is able to allocate
1099
+ // full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side
1100
+ // for any code that deals with heap sizes, which would require special
1101
+ // casing all heap size related code to treat 0 specially.
1102
+ 2147483648,
1103
+ "getHeapMax"
1104
+ )
1105
+ var growMemory = /* @__PURE__ */ __name((size) => {
1106
+ var b = wasmMemory.buffer
1107
+ var pages = ((size - b.byteLength + 65535) / 65536) | 0
1108
+ try {
1109
+ wasmMemory.grow(pages)
1110
+ updateMemoryViews()
1111
+ return 1
1112
+ } catch (e) {}
1113
+ }, "growMemory")
1114
+ var _emscripten_resize_heap = /* @__PURE__ */ __name((requestedSize) => {
1115
+ var oldSize = HEAPU8.length
1116
+ requestedSize >>>= 0
1117
+ var maxHeapSize = getHeapMax()
1118
+ if (requestedSize > maxHeapSize) {
1119
+ return false
1120
+ }
1121
+ for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
1122
+ var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown)
1123
+ overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296)
1124
+ var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536))
1125
+ var replacement = growMemory(newSize)
1126
+ if (replacement) {
1127
+ return true
1128
+ }
1129
+ }
1130
+ return false
1131
+ }, "_emscripten_resize_heap")
1132
+ _emscripten_resize_heap.sig = "ip"
1133
+ var _fd_close = /* @__PURE__ */ __name((fd) => 52, "_fd_close")
1134
+ _fd_close.sig = "ii"
1135
+ function _fd_seek(fd, offset, whence, newOffset) {
1136
+ offset = bigintToI53Checked(offset)
1137
+ return 70
1138
+ }
1139
+ __name(_fd_seek, "_fd_seek")
1140
+ _fd_seek.sig = "iijip"
1141
+ var printCharBuffers = [null, [], []]
1142
+ var printChar = /* @__PURE__ */ __name((stream, curr) => {
1143
+ var buffer = printCharBuffers[stream]
1144
+ if (curr === 0 || curr === 10) {
1145
+ ;(stream === 1 ? out : err)(UTF8ArrayToString(buffer))
1146
+ buffer.length = 0
1147
+ } else {
1148
+ buffer.push(curr)
1149
+ }
1150
+ }, "printChar")
1151
+ var flush_NO_FILESYSTEM = /* @__PURE__ */ __name(() => {
1152
+ if (printCharBuffers[1].length) printChar(1, 10)
1153
+ if (printCharBuffers[2].length) printChar(2, 10)
1154
+ }, "flush_NO_FILESYSTEM")
1155
+ var SYSCALLS = {
1156
+ varargs: void 0,
1157
+ getStr(ptr) {
1158
+ var ret = UTF8ToString(ptr)
1159
+ return ret
1160
+ },
1161
+ }
1162
+ var _fd_write = /* @__PURE__ */ __name((fd, iov, iovcnt, pnum) => {
1163
+ var num = 0
1164
+ for (var i2 = 0; i2 < iovcnt; i2++) {
1165
+ var ptr = LE_HEAP_LOAD_U32((iov >> 2) * 4)
1166
+ var len = LE_HEAP_LOAD_U32(((iov + 4) >> 2) * 4)
1167
+ iov += 8
1168
+ for (var j = 0; j < len; j++) {
1169
+ printChar(fd, HEAPU8[ptr + j])
1170
+ }
1171
+ num += len
1172
+ }
1173
+ LE_HEAP_STORE_U32((pnum >> 2) * 4, num)
1174
+ return 0
1175
+ }, "_fd_write")
1176
+ _fd_write.sig = "iippp"
1177
+ function _tree_sitter_log_callback(isLexMessage, messageAddress) {
1178
+ if (Module.currentLogCallback) {
1179
+ const message = UTF8ToString(messageAddress)
1180
+ Module.currentLogCallback(message, isLexMessage !== 0)
1181
+ }
1182
+ }
1183
+ __name(_tree_sitter_log_callback, "_tree_sitter_log_callback")
1184
+ function _tree_sitter_parse_callback(inputBufferAddress, index, row, column, lengthAddress) {
1185
+ const INPUT_BUFFER_SIZE = 10 * 1024
1186
+ const string = Module.currentParseCallback(index, {
1187
+ row,
1188
+ column,
1189
+ })
1190
+ if (typeof string === "string") {
1191
+ setValue(lengthAddress, string.length, "i32")
1192
+ stringToUTF16(string, inputBufferAddress, INPUT_BUFFER_SIZE)
1193
+ } else {
1194
+ setValue(lengthAddress, 0, "i32")
1195
+ }
1196
+ }
1197
+ __name(_tree_sitter_parse_callback, "_tree_sitter_parse_callback")
1198
+ function _tree_sitter_progress_callback(currentOffset, hasError) {
1199
+ if (Module.currentProgressCallback) {
1200
+ return Module.currentProgressCallback({
1201
+ currentOffset,
1202
+ hasError,
1203
+ })
1204
+ }
1205
+ return false
1206
+ }
1207
+ __name(_tree_sitter_progress_callback, "_tree_sitter_progress_callback")
1208
+ function _tree_sitter_query_progress_callback(currentOffset) {
1209
+ if (Module.currentQueryProgressCallback) {
1210
+ return Module.currentQueryProgressCallback({
1211
+ currentOffset,
1212
+ })
1213
+ }
1214
+ return false
1215
+ }
1216
+ __name(_tree_sitter_query_progress_callback, "_tree_sitter_query_progress_callback")
1217
+ var runtimeKeepaliveCounter = 0
1218
+ var keepRuntimeAlive = /* @__PURE__ */ __name(() => noExitRuntime || runtimeKeepaliveCounter > 0, "keepRuntimeAlive")
1219
+ var _proc_exit = /* @__PURE__ */ __name((code) => {
1220
+ EXITSTATUS = code
1221
+ if (!keepRuntimeAlive()) {
1222
+ Module["onExit"]?.(code)
1223
+ ABORT = true
1224
+ }
1225
+ quit_(code, new ExitStatus(code))
1226
+ }, "_proc_exit")
1227
+ _proc_exit.sig = "vi"
1228
+ var exitJS = /* @__PURE__ */ __name((status, implicit) => {
1229
+ EXITSTATUS = status
1230
+ _proc_exit(status)
1231
+ }, "exitJS")
1232
+ var handleException = /* @__PURE__ */ __name((e) => {
1233
+ if (e instanceof ExitStatus || e == "unwind") {
1234
+ return EXITSTATUS
1235
+ }
1236
+ quit_(1, e)
1237
+ }, "handleException")
1238
+ var lengthBytesUTF8 = /* @__PURE__ */ __name((str) => {
1239
+ var len = 0
1240
+ for (var i2 = 0; i2 < str.length; ++i2) {
1241
+ var c = str.charCodeAt(i2)
1242
+ if (c <= 127) {
1243
+ len++
1244
+ } else if (c <= 2047) {
1245
+ len += 2
1246
+ } else if (c >= 55296 && c <= 57343) {
1247
+ len += 4
1248
+ ++i2
1249
+ } else {
1250
+ len += 3
1251
+ }
1252
+ }
1253
+ return len
1254
+ }, "lengthBytesUTF8")
1255
+ var stringToUTF8Array = /* @__PURE__ */ __name((str, heap, outIdx, maxBytesToWrite) => {
1256
+ if (!(maxBytesToWrite > 0)) return 0
1257
+ var startIdx = outIdx
1258
+ var endIdx = outIdx + maxBytesToWrite - 1
1259
+ for (var i2 = 0; i2 < str.length; ++i2) {
1260
+ var u = str.charCodeAt(i2)
1261
+ if (u >= 55296 && u <= 57343) {
1262
+ var u1 = str.charCodeAt(++i2)
1263
+ u = (65536 + ((u & 1023) << 10)) | (u1 & 1023)
1264
+ }
1265
+ if (u <= 127) {
1266
+ if (outIdx >= endIdx) break
1267
+ heap[outIdx++] = u
1268
+ } else if (u <= 2047) {
1269
+ if (outIdx + 1 >= endIdx) break
1270
+ heap[outIdx++] = 192 | (u >> 6)
1271
+ heap[outIdx++] = 128 | (u & 63)
1272
+ } else if (u <= 65535) {
1273
+ if (outIdx + 2 >= endIdx) break
1274
+ heap[outIdx++] = 224 | (u >> 12)
1275
+ heap[outIdx++] = 128 | ((u >> 6) & 63)
1276
+ heap[outIdx++] = 128 | (u & 63)
1277
+ } else {
1278
+ if (outIdx + 3 >= endIdx) break
1279
+ heap[outIdx++] = 240 | (u >> 18)
1280
+ heap[outIdx++] = 128 | ((u >> 12) & 63)
1281
+ heap[outIdx++] = 128 | ((u >> 6) & 63)
1282
+ heap[outIdx++] = 128 | (u & 63)
1283
+ }
1284
+ }
1285
+ heap[outIdx] = 0
1286
+ return outIdx - startIdx
1287
+ }, "stringToUTF8Array")
1288
+ var stringToUTF8 = /* @__PURE__ */ __name((str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite), "stringToUTF8")
1289
+ var stackAlloc = /* @__PURE__ */ __name((sz) => __emscripten_stack_alloc(sz), "stackAlloc")
1290
+ var stringToUTF8OnStack = /* @__PURE__ */ __name((str) => {
1291
+ var size = lengthBytesUTF8(str) + 1
1292
+ var ret = stackAlloc(size)
1293
+ stringToUTF8(str, ret, size)
1294
+ return ret
1295
+ }, "stringToUTF8OnStack")
1296
+ var AsciiToString = /* @__PURE__ */ __name((ptr) => {
1297
+ var str = ""
1298
+ while (1) {
1299
+ var ch = HEAPU8[ptr++]
1300
+ if (!ch) return str
1301
+ str += String.fromCharCode(ch)
1302
+ }
1303
+ }, "AsciiToString")
1304
+ var stringToUTF16 = /* @__PURE__ */ __name((str, outPtr, maxBytesToWrite) => {
1305
+ maxBytesToWrite ??= 2147483647
1306
+ if (maxBytesToWrite < 2) return 0
1307
+ maxBytesToWrite -= 2
1308
+ var startPtr = outPtr
1309
+ var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length
1310
+ for (var i2 = 0; i2 < numCharsToWrite; ++i2) {
1311
+ var codeUnit = str.charCodeAt(i2)
1312
+ LE_HEAP_STORE_I16((outPtr >> 1) * 2, codeUnit)
1313
+ outPtr += 2
1314
+ }
1315
+ LE_HEAP_STORE_I16((outPtr >> 1) * 2, 0)
1316
+ return outPtr - startPtr
1317
+ }, "stringToUTF16")
1318
+ var wasmImports = {
1319
+ /** @export */
1320
+ __heap_base: ___heap_base,
1321
+ /** @export */
1322
+ __indirect_function_table: wasmTable,
1323
+ /** @export */
1324
+ __memory_base: ___memory_base,
1325
+ /** @export */
1326
+ __stack_pointer: ___stack_pointer,
1327
+ /** @export */
1328
+ __table_base: ___table_base,
1329
+ /** @export */
1330
+ _abort_js: __abort_js,
1331
+ /** @export */
1332
+ clock_time_get: _clock_time_get,
1333
+ /** @export */
1334
+ emscripten_resize_heap: _emscripten_resize_heap,
1335
+ /** @export */
1336
+ fd_close: _fd_close,
1337
+ /** @export */
1338
+ fd_seek: _fd_seek,
1339
+ /** @export */
1340
+ fd_write: _fd_write,
1341
+ /** @export */
1342
+ memory: wasmMemory,
1343
+ /** @export */
1344
+ tree_sitter_log_callback: _tree_sitter_log_callback,
1345
+ /** @export */
1346
+ tree_sitter_parse_callback: _tree_sitter_parse_callback,
1347
+ /** @export */
1348
+ tree_sitter_progress_callback: _tree_sitter_progress_callback,
1349
+ /** @export */
1350
+ tree_sitter_query_progress_callback: _tree_sitter_query_progress_callback,
1351
+ }
1352
+ // IMPORTANT
1353
+ async function createWasm() {
1354
+ addRunDependency("wasm-instantiate")
1355
+ const info = {
1356
+ env: wasmImports,
1357
+ wasi_snapshot_preview1: wasmImports,
1358
+ "GOT.mem": new Proxy(wasmImports, GOTHandler),
1359
+ "GOT.func": new Proxy(wasmImports, GOTHandler),
1360
+ }
1361
+ //
1362
+ // try instantiate arg
1363
+ //
1364
+ if (Module["instantiateWasm"]) {
1365
+ try {
1366
+ return Module["instantiateWasm"](info, receiveInstance)
1367
+ } catch (e) {
1368
+ err(`Module.instantiateWasm callback failed with error: ${e}`)
1369
+ readyPromiseReject(e)
1370
+ }
1371
+ }
1372
+ //
1373
+ // get path (if missing)
1374
+ //
1375
+ if (!wasmBinaryFilePath) {
1376
+ const path = Module["defaultWasmPath"]
1377
+ if (locateFile) {
1378
+ if (!isDataURI(path)) {
1379
+ wasmBinaryFilePath = locateFile(path)
1380
+ } else {
1381
+ wasmBinaryFilePath = path
1382
+ }
1383
+ } else {
1384
+ wasmBinaryFilePath = new URL(path, import.meta.url).href
1385
+ }
1386
+ }
1387
+
1388
+ //
1389
+ // instantiate module
1390
+ //
1391
+ try {
1392
+ let instantiationResult
1393
+ //
1394
+ // load wasm file
1395
+ //
1396
+ const binaryFilePath = wasmBinaryFilePath
1397
+ const imports = info
1398
+ //
1399
+ // streaming
1400
+ //
1401
+ if (!wasmBinary && typeof WebAssembly.instantiateStreaming == "function" && !isDataURI(binaryFilePath) && isUrl(binaryFilePath) && !isFileURI(binaryFilePath) && fetch) {
1402
+ try {
1403
+ var response = fetch(binaryFilePath, {
1404
+ credentials: "same-origin",
1405
+ })
1406
+ instantiationResult = await WebAssembly.instantiateStreaming(response, imports)
1407
+ } catch (reason) {
1408
+ err(`wasm streaming compile failed: ${reason}`)
1409
+ err("falling back to ArrayBuffer instantiation")
1410
+ }
1411
+ }
1412
+
1413
+ //
1414
+ // fallback on non-streaming
1415
+ //
1416
+ if (!instantiationResult) {
1417
+ try {
1418
+ var binaryArray = wasmBinary
1419
+ //
1420
+ // get binary async
1421
+ //
1422
+ if (!binaryArray) { // argument of main function
1423
+ try {
1424
+ binaryArray = new Uint8Array(
1425
+ await readAsync(binaryFilePath)
1426
+ )
1427
+ } catch {}
1428
+ }
1429
+ //
1430
+ // get binary sync
1431
+ //
1432
+ if (!binaryArray) {
1433
+ if (binaryFilePath == wasmBinaryFilePath && wasmBinary) {
1434
+ binaryArray = new Uint8Array(wasmBinary)
1435
+ } else if (readBinary) {
1436
+ binaryArray = readBinary(binaryFilePath)
1437
+ } else {
1438
+ throw Error("both async and sync fetching of the wasm failed")
1439
+ }
1440
+ }
1441
+ //
1442
+ // instantiate
1443
+ //
1444
+ instantiationResult = await WebAssembly.instantiate(binaryArray, imports)
1445
+ } catch (reason) {
1446
+ err(`failed to asynchronously prepare wasm: ${reason}`)
1447
+ abort(reason)
1448
+ }
1449
+ }
1450
+ instantiationResult = await instantiationResult
1451
+ return receiveInstance(instantiationResult["instance"], instantiationResult["module"])
1452
+ } catch (e) {
1453
+ readyPromiseReject(e)
1454
+ return Promise.reject(e)
1455
+ }
1456
+
1457
+ function receiveInstance(instance2, module2) {
1458
+ wasmExports = instance2.exports
1459
+ wasmExports = relocateExports(wasmExports, 1024)
1460
+ var metadata2 = getDylinkMetadata(module2)
1461
+ if (metadata2.neededDynlibs) {
1462
+ dynamicLibraries = metadata2.neededDynlibs.concat(dynamicLibraries)
1463
+ }
1464
+ mergeLibSymbols(wasmExports, "main")
1465
+ LDSO.init()
1466
+ loadDylibs()
1467
+ addOnInit(wasmExports["__wasm_call_ctors"])
1468
+ __RELOC_FUNCS__.push(wasmExports["__wasm_apply_data_relocs"])
1469
+ removeRunDependency("wasm-instantiate")
1470
+ return wasmExports
1471
+ }
1472
+ __name(receiveInstance, "receiveInstance")
1473
+ }
1474
+ __name(createWasm, "createWasm")
1475
+ var wasmExports = await createWasm()
1476
+ var ___wasm_call_ctors = wasmExports["__wasm_call_ctors"]
1477
+ var _malloc = (Module["_malloc"] = wasmExports["malloc"])
1478
+ var _calloc = (Module["_calloc"] = wasmExports["calloc"])
1479
+ var _realloc = (Module["_realloc"] = wasmExports["realloc"])
1480
+ var _free = (Module["_free"] = wasmExports["free"])
1481
+ var _memcmp = (Module["_memcmp"] = wasmExports["memcmp"])
1482
+ var _ts_language_symbol_count = (Module["_ts_language_symbol_count"] = wasmExports["ts_language_symbol_count"])
1483
+ var _ts_language_state_count = (Module["_ts_language_state_count"] = wasmExports["ts_language_state_count"])
1484
+ var _ts_language_version = (Module["_ts_language_version"] = wasmExports["ts_language_version"])
1485
+ var _ts_language_abi_version = (Module["_ts_language_abi_version"] = wasmExports["ts_language_abi_version"])
1486
+ var _ts_language_metadata = (Module["_ts_language_metadata"] = wasmExports["ts_language_metadata"])
1487
+ var _ts_language_name = (Module["_ts_language_name"] = wasmExports["ts_language_name"])
1488
+ var _ts_language_field_count = (Module["_ts_language_field_count"] = wasmExports["ts_language_field_count"])
1489
+ var _ts_language_next_state = (Module["_ts_language_next_state"] = wasmExports["ts_language_next_state"])
1490
+ var _ts_language_symbol_name = (Module["_ts_language_symbol_name"] = wasmExports["ts_language_symbol_name"])
1491
+ var _ts_language_symbol_for_name = (Module["_ts_language_symbol_for_name"] = wasmExports["ts_language_symbol_for_name"])
1492
+ var _strncmp = (Module["_strncmp"] = wasmExports["strncmp"])
1493
+ var _ts_language_symbol_type = (Module["_ts_language_symbol_type"] = wasmExports["ts_language_symbol_type"])
1494
+ var _ts_language_field_name_for_id = (Module["_ts_language_field_name_for_id"] = wasmExports["ts_language_field_name_for_id"])
1495
+ var _ts_lookahead_iterator_new = (Module["_ts_lookahead_iterator_new"] = wasmExports["ts_lookahead_iterator_new"])
1496
+ var _ts_lookahead_iterator_delete = (Module["_ts_lookahead_iterator_delete"] = wasmExports["ts_lookahead_iterator_delete"])
1497
+ var _ts_lookahead_iterator_reset_state = (Module["_ts_lookahead_iterator_reset_state"] = wasmExports["ts_lookahead_iterator_reset_state"])
1498
+ var _ts_lookahead_iterator_reset = (Module["_ts_lookahead_iterator_reset"] = wasmExports["ts_lookahead_iterator_reset"])
1499
+ var _ts_lookahead_iterator_next = (Module["_ts_lookahead_iterator_next"] = wasmExports["ts_lookahead_iterator_next"])
1500
+ var _ts_lookahead_iterator_current_symbol = (Module["_ts_lookahead_iterator_current_symbol"] = wasmExports["ts_lookahead_iterator_current_symbol"])
1501
+ var _ts_parser_delete = (Module["_ts_parser_delete"] = wasmExports["ts_parser_delete"])
1502
+ var _ts_parser_reset = (Module["_ts_parser_reset"] = wasmExports["ts_parser_reset"])
1503
+ var _ts_parser_set_language = (Module["_ts_parser_set_language"] = wasmExports["ts_parser_set_language"])
1504
+ var _ts_parser_timeout_micros = (Module["_ts_parser_timeout_micros"] = wasmExports["ts_parser_timeout_micros"])
1505
+ var _ts_parser_set_timeout_micros = (Module["_ts_parser_set_timeout_micros"] = wasmExports["ts_parser_set_timeout_micros"])
1506
+ var _ts_parser_set_included_ranges = (Module["_ts_parser_set_included_ranges"] = wasmExports["ts_parser_set_included_ranges"])
1507
+ var _ts_query_new = (Module["_ts_query_new"] = wasmExports["ts_query_new"])
1508
+ var _ts_query_delete = (Module["_ts_query_delete"] = wasmExports["ts_query_delete"])
1509
+ var _iswspace = (Module["_iswspace"] = wasmExports["iswspace"])
1510
+ var _iswalnum = (Module["_iswalnum"] = wasmExports["iswalnum"])
1511
+ var _ts_query_pattern_count = (Module["_ts_query_pattern_count"] = wasmExports["ts_query_pattern_count"])
1512
+ var _ts_query_capture_count = (Module["_ts_query_capture_count"] = wasmExports["ts_query_capture_count"])
1513
+ var _ts_query_string_count = (Module["_ts_query_string_count"] = wasmExports["ts_query_string_count"])
1514
+ var _ts_query_capture_name_for_id = (Module["_ts_query_capture_name_for_id"] = wasmExports["ts_query_capture_name_for_id"])
1515
+ var _ts_query_capture_quantifier_for_id = (Module["_ts_query_capture_quantifier_for_id"] = wasmExports["ts_query_capture_quantifier_for_id"])
1516
+ var _ts_query_string_value_for_id = (Module["_ts_query_string_value_for_id"] = wasmExports["ts_query_string_value_for_id"])
1517
+ var _ts_query_predicates_for_pattern = (Module["_ts_query_predicates_for_pattern"] = wasmExports["ts_query_predicates_for_pattern"])
1518
+ var _ts_query_start_byte_for_pattern = (Module["_ts_query_start_byte_for_pattern"] = wasmExports["ts_query_start_byte_for_pattern"])
1519
+ var _ts_query_end_byte_for_pattern = (Module["_ts_query_end_byte_for_pattern"] = wasmExports["ts_query_end_byte_for_pattern"])
1520
+ var _ts_query_is_pattern_rooted = (Module["_ts_query_is_pattern_rooted"] = wasmExports["ts_query_is_pattern_rooted"])
1521
+ var _ts_query_is_pattern_non_local = (Module["_ts_query_is_pattern_non_local"] = wasmExports["ts_query_is_pattern_non_local"])
1522
+ var _ts_query_is_pattern_guaranteed_at_step = (Module["_ts_query_is_pattern_guaranteed_at_step"] = wasmExports["ts_query_is_pattern_guaranteed_at_step"])
1523
+ var _ts_query_disable_capture = (Module["_ts_query_disable_capture"] = wasmExports["ts_query_disable_capture"])
1524
+ var _ts_query_disable_pattern = (Module["_ts_query_disable_pattern"] = wasmExports["ts_query_disable_pattern"])
1525
+ var _ts_tree_copy = (Module["_ts_tree_copy"] = wasmExports["ts_tree_copy"])
1526
+ var _ts_tree_delete = (Module["_ts_tree_delete"] = wasmExports["ts_tree_delete"])
1527
+ var _ts_init = (Module["_ts_init"] = wasmExports["ts_init"])
1528
+ var _ts_parser_new_wasm = (Module["_ts_parser_new_wasm"] = wasmExports["ts_parser_new_wasm"])
1529
+ var _ts_parser_enable_logger_wasm = (Module["_ts_parser_enable_logger_wasm"] = wasmExports["ts_parser_enable_logger_wasm"])
1530
+ var _ts_parser_parse_wasm = (Module["_ts_parser_parse_wasm"] = wasmExports["ts_parser_parse_wasm"])
1531
+ var _ts_parser_included_ranges_wasm = (Module["_ts_parser_included_ranges_wasm"] = wasmExports["ts_parser_included_ranges_wasm"])
1532
+ var _ts_language_type_is_named_wasm = (Module["_ts_language_type_is_named_wasm"] = wasmExports["ts_language_type_is_named_wasm"])
1533
+ var _ts_language_type_is_visible_wasm = (Module["_ts_language_type_is_visible_wasm"] = wasmExports["ts_language_type_is_visible_wasm"])
1534
+ var _ts_language_supertypes_wasm = (Module["_ts_language_supertypes_wasm"] = wasmExports["ts_language_supertypes_wasm"])
1535
+ var _ts_language_subtypes_wasm = (Module["_ts_language_subtypes_wasm"] = wasmExports["ts_language_subtypes_wasm"])
1536
+ var _ts_tree_root_node_wasm = (Module["_ts_tree_root_node_wasm"] = wasmExports["ts_tree_root_node_wasm"])
1537
+ var _ts_tree_root_node_with_offset_wasm = (Module["_ts_tree_root_node_with_offset_wasm"] = wasmExports["ts_tree_root_node_with_offset_wasm"])
1538
+ var _ts_tree_edit_wasm = (Module["_ts_tree_edit_wasm"] = wasmExports["ts_tree_edit_wasm"])
1539
+ var _ts_tree_included_ranges_wasm = (Module["_ts_tree_included_ranges_wasm"] = wasmExports["ts_tree_included_ranges_wasm"])
1540
+ var _ts_tree_get_changed_ranges_wasm = (Module["_ts_tree_get_changed_ranges_wasm"] = wasmExports["ts_tree_get_changed_ranges_wasm"])
1541
+ var _ts_tree_cursor_new_wasm = (Module["_ts_tree_cursor_new_wasm"] = wasmExports["ts_tree_cursor_new_wasm"])
1542
+ var _ts_tree_cursor_copy_wasm = (Module["_ts_tree_cursor_copy_wasm"] = wasmExports["ts_tree_cursor_copy_wasm"])
1543
+ var _ts_tree_cursor_delete_wasm = (Module["_ts_tree_cursor_delete_wasm"] = wasmExports["ts_tree_cursor_delete_wasm"])
1544
+ var _ts_tree_cursor_reset_wasm = (Module["_ts_tree_cursor_reset_wasm"] = wasmExports["ts_tree_cursor_reset_wasm"])
1545
+ var _ts_tree_cursor_reset_to_wasm = (Module["_ts_tree_cursor_reset_to_wasm"] = wasmExports["ts_tree_cursor_reset_to_wasm"])
1546
+ var _ts_tree_cursor_goto_first_child_wasm = (Module["_ts_tree_cursor_goto_first_child_wasm"] = wasmExports["ts_tree_cursor_goto_first_child_wasm"])
1547
+ var _ts_tree_cursor_goto_last_child_wasm = (Module["_ts_tree_cursor_goto_last_child_wasm"] = wasmExports["ts_tree_cursor_goto_last_child_wasm"])
1548
+ var _ts_tree_cursor_goto_first_child_for_index_wasm = (Module["_ts_tree_cursor_goto_first_child_for_index_wasm"] = wasmExports["ts_tree_cursor_goto_first_child_for_index_wasm"])
1549
+ var _ts_tree_cursor_goto_first_child_for_position_wasm = (Module["_ts_tree_cursor_goto_first_child_for_position_wasm"] = wasmExports["ts_tree_cursor_goto_first_child_for_position_wasm"])
1550
+ var _ts_tree_cursor_goto_next_sibling_wasm = (Module["_ts_tree_cursor_goto_next_sibling_wasm"] = wasmExports["ts_tree_cursor_goto_next_sibling_wasm"])
1551
+ var _ts_tree_cursor_goto_previous_sibling_wasm = (Module["_ts_tree_cursor_goto_previous_sibling_wasm"] = wasmExports["ts_tree_cursor_goto_previous_sibling_wasm"])
1552
+ var _ts_tree_cursor_goto_descendant_wasm = (Module["_ts_tree_cursor_goto_descendant_wasm"] = wasmExports["ts_tree_cursor_goto_descendant_wasm"])
1553
+ var _ts_tree_cursor_goto_parent_wasm = (Module["_ts_tree_cursor_goto_parent_wasm"] = wasmExports["ts_tree_cursor_goto_parent_wasm"])
1554
+ var _ts_tree_cursor_current_node_type_id_wasm = (Module["_ts_tree_cursor_current_node_type_id_wasm"] = wasmExports["ts_tree_cursor_current_node_type_id_wasm"])
1555
+ var _ts_tree_cursor_current_node_state_id_wasm = (Module["_ts_tree_cursor_current_node_state_id_wasm"] = wasmExports["ts_tree_cursor_current_node_state_id_wasm"])
1556
+ var _ts_tree_cursor_current_node_is_named_wasm = (Module["_ts_tree_cursor_current_node_is_named_wasm"] = wasmExports["ts_tree_cursor_current_node_is_named_wasm"])
1557
+ var _ts_tree_cursor_current_node_is_missing_wasm = (Module["_ts_tree_cursor_current_node_is_missing_wasm"] = wasmExports["ts_tree_cursor_current_node_is_missing_wasm"])
1558
+ var _ts_tree_cursor_current_node_id_wasm = (Module["_ts_tree_cursor_current_node_id_wasm"] = wasmExports["ts_tree_cursor_current_node_id_wasm"])
1559
+ var _ts_tree_cursor_start_position_wasm = (Module["_ts_tree_cursor_start_position_wasm"] = wasmExports["ts_tree_cursor_start_position_wasm"])
1560
+ var _ts_tree_cursor_end_position_wasm = (Module["_ts_tree_cursor_end_position_wasm"] = wasmExports["ts_tree_cursor_end_position_wasm"])
1561
+ var _ts_tree_cursor_start_index_wasm = (Module["_ts_tree_cursor_start_index_wasm"] = wasmExports["ts_tree_cursor_start_index_wasm"])
1562
+ var _ts_tree_cursor_end_index_wasm = (Module["_ts_tree_cursor_end_index_wasm"] = wasmExports["ts_tree_cursor_end_index_wasm"])
1563
+ var _ts_tree_cursor_current_field_id_wasm = (Module["_ts_tree_cursor_current_field_id_wasm"] = wasmExports["ts_tree_cursor_current_field_id_wasm"])
1564
+ var _ts_tree_cursor_current_depth_wasm = (Module["_ts_tree_cursor_current_depth_wasm"] = wasmExports["ts_tree_cursor_current_depth_wasm"])
1565
+ var _ts_tree_cursor_current_descendant_index_wasm = (Module["_ts_tree_cursor_current_descendant_index_wasm"] = wasmExports["ts_tree_cursor_current_descendant_index_wasm"])
1566
+ var _ts_tree_cursor_current_node_wasm = (Module["_ts_tree_cursor_current_node_wasm"] = wasmExports["ts_tree_cursor_current_node_wasm"])
1567
+ var _ts_node_symbol_wasm = (Module["_ts_node_symbol_wasm"] = wasmExports["ts_node_symbol_wasm"])
1568
+ var _ts_node_field_name_for_child_wasm = (Module["_ts_node_field_name_for_child_wasm"] = wasmExports["ts_node_field_name_for_child_wasm"])
1569
+ var _ts_node_field_name_for_named_child_wasm = (Module["_ts_node_field_name_for_named_child_wasm"] = wasmExports["ts_node_field_name_for_named_child_wasm"])
1570
+ var _ts_node_children_by_field_id_wasm = (Module["_ts_node_children_by_field_id_wasm"] = wasmExports["ts_node_children_by_field_id_wasm"])
1571
+ var _ts_node_first_child_for_byte_wasm = (Module["_ts_node_first_child_for_byte_wasm"] = wasmExports["ts_node_first_child_for_byte_wasm"])
1572
+ var _ts_node_first_named_child_for_byte_wasm = (Module["_ts_node_first_named_child_for_byte_wasm"] = wasmExports["ts_node_first_named_child_for_byte_wasm"])
1573
+ var _ts_node_grammar_symbol_wasm = (Module["_ts_node_grammar_symbol_wasm"] = wasmExports["ts_node_grammar_symbol_wasm"])
1574
+ var _ts_node_child_count_wasm = (Module["_ts_node_child_count_wasm"] = wasmExports["ts_node_child_count_wasm"])
1575
+ var _ts_node_named_child_count_wasm = (Module["_ts_node_named_child_count_wasm"] = wasmExports["ts_node_named_child_count_wasm"])
1576
+ var _ts_node_child_wasm = (Module["_ts_node_child_wasm"] = wasmExports["ts_node_child_wasm"])
1577
+ var _ts_node_named_child_wasm = (Module["_ts_node_named_child_wasm"] = wasmExports["ts_node_named_child_wasm"])
1578
+ var _ts_node_child_by_field_id_wasm = (Module["_ts_node_child_by_field_id_wasm"] = wasmExports["ts_node_child_by_field_id_wasm"])
1579
+ var _ts_node_next_sibling_wasm = (Module["_ts_node_next_sibling_wasm"] = wasmExports["ts_node_next_sibling_wasm"])
1580
+ var _ts_node_prev_sibling_wasm = (Module["_ts_node_prev_sibling_wasm"] = wasmExports["ts_node_prev_sibling_wasm"])
1581
+ var _ts_node_next_named_sibling_wasm = (Module["_ts_node_next_named_sibling_wasm"] = wasmExports["ts_node_next_named_sibling_wasm"])
1582
+ var _ts_node_prev_named_sibling_wasm = (Module["_ts_node_prev_named_sibling_wasm"] = wasmExports["ts_node_prev_named_sibling_wasm"])
1583
+ var _ts_node_descendant_count_wasm = (Module["_ts_node_descendant_count_wasm"] = wasmExports["ts_node_descendant_count_wasm"])
1584
+ var _ts_node_parent_wasm = (Module["_ts_node_parent_wasm"] = wasmExports["ts_node_parent_wasm"])
1585
+ var _ts_node_child_with_descendant_wasm = (Module["_ts_node_child_with_descendant_wasm"] = wasmExports["ts_node_child_with_descendant_wasm"])
1586
+ var _ts_node_descendant_for_index_wasm = (Module["_ts_node_descendant_for_index_wasm"] = wasmExports["ts_node_descendant_for_index_wasm"])
1587
+ var _ts_node_named_descendant_for_index_wasm = (Module["_ts_node_named_descendant_for_index_wasm"] = wasmExports["ts_node_named_descendant_for_index_wasm"])
1588
+ var _ts_node_descendant_for_position_wasm = (Module["_ts_node_descendant_for_position_wasm"] = wasmExports["ts_node_descendant_for_position_wasm"])
1589
+ var _ts_node_named_descendant_for_position_wasm = (Module["_ts_node_named_descendant_for_position_wasm"] = wasmExports["ts_node_named_descendant_for_position_wasm"])
1590
+ var _ts_node_start_point_wasm = (Module["_ts_node_start_point_wasm"] = wasmExports["ts_node_start_point_wasm"])
1591
+ var _ts_node_end_point_wasm = (Module["_ts_node_end_point_wasm"] = wasmExports["ts_node_end_point_wasm"])
1592
+ var _ts_node_start_index_wasm = (Module["_ts_node_start_index_wasm"] = wasmExports["ts_node_start_index_wasm"])
1593
+ var _ts_node_end_index_wasm = (Module["_ts_node_end_index_wasm"] = wasmExports["ts_node_end_index_wasm"])
1594
+ var _ts_node_to_string_wasm = (Module["_ts_node_to_string_wasm"] = wasmExports["ts_node_to_string_wasm"])
1595
+ var _ts_node_children_wasm = (Module["_ts_node_children_wasm"] = wasmExports["ts_node_children_wasm"])
1596
+ var _ts_node_named_children_wasm = (Module["_ts_node_named_children_wasm"] = wasmExports["ts_node_named_children_wasm"])
1597
+ var _ts_node_descendants_of_type_wasm = (Module["_ts_node_descendants_of_type_wasm"] = wasmExports["ts_node_descendants_of_type_wasm"])
1598
+ var _ts_node_is_named_wasm = (Module["_ts_node_is_named_wasm"] = wasmExports["ts_node_is_named_wasm"])
1599
+ var _ts_node_has_changes_wasm = (Module["_ts_node_has_changes_wasm"] = wasmExports["ts_node_has_changes_wasm"])
1600
+ var _ts_node_has_error_wasm = (Module["_ts_node_has_error_wasm"] = wasmExports["ts_node_has_error_wasm"])
1601
+ var _ts_node_is_error_wasm = (Module["_ts_node_is_error_wasm"] = wasmExports["ts_node_is_error_wasm"])
1602
+ var _ts_node_is_missing_wasm = (Module["_ts_node_is_missing_wasm"] = wasmExports["ts_node_is_missing_wasm"])
1603
+ var _ts_node_is_extra_wasm = (Module["_ts_node_is_extra_wasm"] = wasmExports["ts_node_is_extra_wasm"])
1604
+ var _ts_node_parse_state_wasm = (Module["_ts_node_parse_state_wasm"] = wasmExports["ts_node_parse_state_wasm"])
1605
+ var _ts_node_next_parse_state_wasm = (Module["_ts_node_next_parse_state_wasm"] = wasmExports["ts_node_next_parse_state_wasm"])
1606
+ var _ts_query_matches_wasm = (Module["_ts_query_matches_wasm"] = wasmExports["ts_query_matches_wasm"])
1607
+ var _ts_query_captures_wasm = (Module["_ts_query_captures_wasm"] = wasmExports["ts_query_captures_wasm"])
1608
+ var _memset = (Module["_memset"] = wasmExports["memset"])
1609
+ var _memcpy = (Module["_memcpy"] = wasmExports["memcpy"])
1610
+ var _memmove = (Module["_memmove"] = wasmExports["memmove"])
1611
+ var _iswalpha = (Module["_iswalpha"] = wasmExports["iswalpha"])
1612
+ var _iswblank = (Module["_iswblank"] = wasmExports["iswblank"])
1613
+ var _iswdigit = (Module["_iswdigit"] = wasmExports["iswdigit"])
1614
+ var _iswlower = (Module["_iswlower"] = wasmExports["iswlower"])
1615
+ var _iswupper = (Module["_iswupper"] = wasmExports["iswupper"])
1616
+ var _iswxdigit = (Module["_iswxdigit"] = wasmExports["iswxdigit"])
1617
+ var _memchr = (Module["_memchr"] = wasmExports["memchr"])
1618
+ var _strlen = (Module["_strlen"] = wasmExports["strlen"])
1619
+ var _strcmp = (Module["_strcmp"] = wasmExports["strcmp"])
1620
+ var _strncat = (Module["_strncat"] = wasmExports["strncat"])
1621
+ var _strncpy = (Module["_strncpy"] = wasmExports["strncpy"])
1622
+ var _towlower = (Module["_towlower"] = wasmExports["towlower"])
1623
+ var _towupper = (Module["_towupper"] = wasmExports["towupper"])
1624
+ var _setThrew = wasmExports["setThrew"]
1625
+ var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"]
1626
+ var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"]
1627
+ var _emscripten_stack_get_current = wasmExports["emscripten_stack_get_current"]
1628
+ var ___wasm_apply_data_relocs = wasmExports["__wasm_apply_data_relocs"]
1629
+ Module["setValue"] = setValue
1630
+ Module["getValue"] = getValue
1631
+ Module["UTF8ToString"] = UTF8ToString
1632
+ Module["stringToUTF8"] = stringToUTF8
1633
+ Module["lengthBytesUTF8"] = lengthBytesUTF8
1634
+ Module["AsciiToString"] = AsciiToString
1635
+ Module["stringToUTF16"] = stringToUTF16
1636
+ Module["loadWebAssemblyModule"] = loadWebAssemblyModule
1637
+ function callMain(args2 = []) {
1638
+ var entryFunction = resolveGlobalSymbol("main").sym
1639
+ if (!entryFunction) return
1640
+ args2.unshift(thisProgram)
1641
+ var argc = args2.length
1642
+ var argv = stackAlloc((argc + 1) * 4)
1643
+ var argv_ptr = argv
1644
+ args2.forEach((arg) => {
1645
+ LE_HEAP_STORE_U32((argv_ptr >> 2) * 4, stringToUTF8OnStack(arg))
1646
+ argv_ptr += 4
1647
+ })
1648
+ LE_HEAP_STORE_U32((argv_ptr >> 2) * 4, 0)
1649
+ try {
1650
+ var ret = entryFunction(argc, argv)
1651
+ exitJS(
1652
+ ret,
1653
+ /* implicit = */
1654
+ true
1655
+ )
1656
+ return ret
1657
+ } catch (e) {
1658
+ return handleException(e)
1659
+ }
1660
+ }
1661
+ __name(callMain, "callMain")
1662
+ function run(args2 = arguments_) {
1663
+ if (runDependencies > 0) {
1664
+ dependenciesFulfilled = run
1665
+ return
1666
+ }
1667
+ preRun()
1668
+ if (runDependencies > 0) {
1669
+ dependenciesFulfilled = run
1670
+ return
1671
+ }
1672
+ function doRun() {
1673
+ Module["calledRun"] = true
1674
+ if (ABORT) return
1675
+ initRuntime()
1676
+ preMain()
1677
+ readyPromiseResolve(Module)
1678
+ Module["onRuntimeInitialized"]?.()
1679
+ if (!Module["noInitialRun"]) callMain(args2)
1680
+ postRun()
1681
+ }
1682
+ __name(doRun, "doRun")
1683
+ if (Module["setStatus"]) {
1684
+ Module["setStatus"]("Running...")
1685
+ setTimeout(() => {
1686
+ setTimeout(() => Module["setStatus"](""), 1)
1687
+ doRun()
1688
+ }, 1)
1689
+ } else {
1690
+ doRun()
1691
+ }
1692
+ }
1693
+ __name(run, "run")
1694
+ if (Module["preInit"]) {
1695
+ if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]]
1696
+ while (Module["preInit"].length > 0) {
1697
+ Module["preInit"].pop()()
1698
+ }
1699
+ }
1700
+ run()
1701
+ return readyPromise
1702
+ }