@kerebron/tree-sitter 0.4.6

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