@hyper-light/vorpal-wasm 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/wasm_bg.js ADDED
@@ -0,0 +1,1429 @@
1
+ import { Parser, Language } from 'web-tree-sitter';
2
+
3
+
4
+ export class Pos {
5
+ static __wrap(ptr) {
6
+ const obj = Object.create(Pos.prototype);
7
+ obj.__wbg_ptr = ptr;
8
+ PosFinalization.register(obj, obj.__wbg_ptr, obj);
9
+ return obj;
10
+ }
11
+ __destroy_into_raw() {
12
+ const ptr = this.__wbg_ptr;
13
+ this.__wbg_ptr = 0;
14
+ PosFinalization.unregister(this);
15
+ return ptr;
16
+ }
17
+ free() {
18
+ const ptr = this.__destroy_into_raw();
19
+ wasm.__wbg_pos_free(ptr, 0);
20
+ }
21
+ /**
22
+ * column number starting from 0
23
+ * @returns {number}
24
+ */
25
+ get column() {
26
+ const ret = wasm.__wbg_get_pos_column(this.__wbg_ptr);
27
+ return ret >>> 0;
28
+ }
29
+ /**
30
+ * character offset of the position
31
+ * @returns {number}
32
+ */
33
+ get index() {
34
+ const ret = wasm.__wbg_get_pos_index(this.__wbg_ptr);
35
+ return ret >>> 0;
36
+ }
37
+ /**
38
+ * line number starting from 0
39
+ * @returns {number}
40
+ */
41
+ get line() {
42
+ const ret = wasm.__wbg_get_pos_line(this.__wbg_ptr);
43
+ return ret >>> 0;
44
+ }
45
+ /**
46
+ * column number starting from 0
47
+ * @param {number} arg0
48
+ */
49
+ set column(arg0) {
50
+ wasm.__wbg_set_pos_column(this.__wbg_ptr, arg0);
51
+ }
52
+ /**
53
+ * character offset of the position
54
+ * @param {number} arg0
55
+ */
56
+ set index(arg0) {
57
+ wasm.__wbg_set_pos_index(this.__wbg_ptr, arg0);
58
+ }
59
+ /**
60
+ * line number starting from 0
61
+ * @param {number} arg0
62
+ */
63
+ set line(arg0) {
64
+ wasm.__wbg_set_pos_line(this.__wbg_ptr, arg0);
65
+ }
66
+ }
67
+ if (Symbol.dispose) Pos.prototype[Symbol.dispose] = Pos.prototype.free;
68
+
69
+ export class Range {
70
+ static __wrap(ptr) {
71
+ const obj = Object.create(Range.prototype);
72
+ obj.__wbg_ptr = ptr;
73
+ RangeFinalization.register(obj, obj.__wbg_ptr, obj);
74
+ return obj;
75
+ }
76
+ __destroy_into_raw() {
77
+ const ptr = this.__wbg_ptr;
78
+ this.__wbg_ptr = 0;
79
+ RangeFinalization.unregister(this);
80
+ return ptr;
81
+ }
82
+ free() {
83
+ const ptr = this.__destroy_into_raw();
84
+ wasm.__wbg_range_free(ptr, 0);
85
+ }
86
+ /**
87
+ * ending position of the range
88
+ * @returns {Pos}
89
+ */
90
+ get end() {
91
+ const ret = wasm.__wbg_get_range_end(this.__wbg_ptr);
92
+ return Pos.__wrap(ret);
93
+ }
94
+ /**
95
+ * starting position of the range
96
+ * @returns {Pos}
97
+ */
98
+ get start() {
99
+ const ret = wasm.__wbg_get_range_start(this.__wbg_ptr);
100
+ return Pos.__wrap(ret);
101
+ }
102
+ /**
103
+ * ending position of the range
104
+ * @param {Pos} arg0
105
+ */
106
+ set end(arg0) {
107
+ _assertClass(arg0, Pos);
108
+ var ptr0 = arg0.__destroy_into_raw();
109
+ wasm.__wbg_set_range_end(this.__wbg_ptr, ptr0);
110
+ }
111
+ /**
112
+ * starting position of the range
113
+ * @param {Pos} arg0
114
+ */
115
+ set start(arg0) {
116
+ _assertClass(arg0, Pos);
117
+ var ptr0 = arg0.__destroy_into_raw();
118
+ wasm.__wbg_set_range_start(this.__wbg_ptr, ptr0);
119
+ }
120
+ }
121
+ if (Symbol.dispose) Range.prototype[Symbol.dispose] = Range.prototype.free;
122
+
123
+ /**
124
+ * Represents a single AST node.
125
+ */
126
+ export class SgNode {
127
+ static __wrap(ptr) {
128
+ const obj = Object.create(SgNode.prototype);
129
+ obj.__wbg_ptr = ptr;
130
+ SgNodeFinalization.register(obj, obj.__wbg_ptr, obj);
131
+ return obj;
132
+ }
133
+ __destroy_into_raw() {
134
+ const ptr = this.__wbg_ptr;
135
+ this.__wbg_ptr = 0;
136
+ SgNodeFinalization.unregister(this);
137
+ return ptr;
138
+ }
139
+ free() {
140
+ const ptr = this.__destroy_into_raw();
141
+ wasm.__wbg_sgnode_free(ptr, 0);
142
+ }
143
+ /**
144
+ * @returns {SgNode[]}
145
+ */
146
+ ancestors() {
147
+ const ret = wasm.sgnode_ancestors(this.__wbg_ptr);
148
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
149
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
150
+ return v1;
151
+ }
152
+ /**
153
+ * @param {number} nth
154
+ * @returns {SgNode | undefined}
155
+ */
156
+ child(nth) {
157
+ const ret = wasm.sgnode_child(this.__wbg_ptr, nth);
158
+ return ret === 0 ? undefined : SgNode.__wrap(ret);
159
+ }
160
+ /**
161
+ * @returns {SgNode[]}
162
+ */
163
+ children_nodes() {
164
+ const ret = wasm.sgnode_children_nodes(this.__wbg_ptr);
165
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
166
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
167
+ return v1;
168
+ }
169
+ /**
170
+ * @param {any} edits
171
+ * @returns {string}
172
+ */
173
+ commitEdits(edits) {
174
+ let deferred2_0;
175
+ let deferred2_1;
176
+ try {
177
+ const ret = wasm.sgnode_commitEdits(this.__wbg_ptr, edits);
178
+ var ptr1 = ret[0];
179
+ var len1 = ret[1];
180
+ if (ret[3]) {
181
+ ptr1 = 0; len1 = 0;
182
+ throw takeFromExternrefTable0(ret[2]);
183
+ }
184
+ deferred2_0 = ptr1;
185
+ deferred2_1 = len1;
186
+ return getStringFromWasm0(ptr1, len1);
187
+ } finally {
188
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
189
+ }
190
+ }
191
+ /**
192
+ * @param {string} name
193
+ * @returns {SgNode | undefined}
194
+ */
195
+ field(name) {
196
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
197
+ const len0 = WASM_VECTOR_LEN;
198
+ const ret = wasm.sgnode_field(this.__wbg_ptr, ptr0, len0);
199
+ return ret === 0 ? undefined : SgNode.__wrap(ret);
200
+ }
201
+ /**
202
+ * @param {string} name
203
+ * @returns {SgNode[]}
204
+ */
205
+ fieldChildren(name) {
206
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
207
+ const len0 = WASM_VECTOR_LEN;
208
+ const ret = wasm.sgnode_fieldChildren(this.__wbg_ptr, ptr0, len0);
209
+ var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
210
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
211
+ return v2;
212
+ }
213
+ /**
214
+ * @param {any} matcher
215
+ * @returns {SgNode | undefined}
216
+ */
217
+ find(matcher) {
218
+ const ret = wasm.sgnode_find(this.__wbg_ptr, matcher);
219
+ if (ret[2]) {
220
+ throw takeFromExternrefTable0(ret[1]);
221
+ }
222
+ return ret[0] === 0 ? undefined : SgNode.__wrap(ret[0]);
223
+ }
224
+ /**
225
+ * @param {any} matcher
226
+ * @returns {SgNode[]}
227
+ */
228
+ findAll(matcher) {
229
+ const ret = wasm.sgnode_findAll(this.__wbg_ptr, matcher);
230
+ if (ret[3]) {
231
+ throw takeFromExternrefTable0(ret[2]);
232
+ }
233
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
234
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
235
+ return v1;
236
+ }
237
+ /**
238
+ * @param {any} m
239
+ * @returns {boolean}
240
+ */
241
+ follows(m) {
242
+ const ret = wasm.sgnode_follows(this.__wbg_ptr, m);
243
+ if (ret[2]) {
244
+ throw takeFromExternrefTable0(ret[1]);
245
+ }
246
+ return ret[0] !== 0;
247
+ }
248
+ /**
249
+ * @param {string} m
250
+ * @returns {SgNode | undefined}
251
+ */
252
+ getMatch(m) {
253
+ const ptr0 = passStringToWasm0(m, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
254
+ const len0 = WASM_VECTOR_LEN;
255
+ const ret = wasm.sgnode_getMatch(this.__wbg_ptr, ptr0, len0);
256
+ return ret === 0 ? undefined : SgNode.__wrap(ret);
257
+ }
258
+ /**
259
+ * @param {string} m
260
+ * @returns {SgNode[]}
261
+ */
262
+ getMultipleMatches(m) {
263
+ const ptr0 = passStringToWasm0(m, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
264
+ const len0 = WASM_VECTOR_LEN;
265
+ const ret = wasm.sgnode_getMultipleMatches(this.__wbg_ptr, ptr0, len0);
266
+ var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
267
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
268
+ return v2;
269
+ }
270
+ /**
271
+ * @param {string} m
272
+ * @returns {string | undefined}
273
+ */
274
+ getTransformed(m) {
275
+ const ptr0 = passStringToWasm0(m, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
276
+ const len0 = WASM_VECTOR_LEN;
277
+ const ret = wasm.sgnode_getTransformed(this.__wbg_ptr, ptr0, len0);
278
+ let v2;
279
+ if (ret[0] !== 0) {
280
+ v2 = getStringFromWasm0(ret[0], ret[1]).slice();
281
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
282
+ }
283
+ return v2;
284
+ }
285
+ /**
286
+ * @param {any} m
287
+ * @returns {boolean}
288
+ */
289
+ has(m) {
290
+ const ret = wasm.sgnode_has(this.__wbg_ptr, m);
291
+ if (ret[2]) {
292
+ throw takeFromExternrefTable0(ret[1]);
293
+ }
294
+ return ret[0] !== 0;
295
+ }
296
+ /**
297
+ * @returns {number}
298
+ */
299
+ id() {
300
+ const ret = wasm.sgnode_id(this.__wbg_ptr);
301
+ return ret >>> 0;
302
+ }
303
+ /**
304
+ * @param {any} m
305
+ * @returns {boolean}
306
+ */
307
+ inside(m) {
308
+ const ret = wasm.sgnode_inside(this.__wbg_ptr, m);
309
+ if (ret[2]) {
310
+ throw takeFromExternrefTable0(ret[1]);
311
+ }
312
+ return ret[0] !== 0;
313
+ }
314
+ /**
315
+ * @param {string} kind
316
+ * @returns {boolean}
317
+ */
318
+ is(kind) {
319
+ const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
320
+ const len0 = WASM_VECTOR_LEN;
321
+ const ret = wasm.sgnode_is(this.__wbg_ptr, ptr0, len0);
322
+ return ret !== 0;
323
+ }
324
+ /**
325
+ * @returns {boolean}
326
+ */
327
+ isLeaf() {
328
+ const ret = wasm.sgnode_isLeaf(this.__wbg_ptr);
329
+ return ret !== 0;
330
+ }
331
+ /**
332
+ * @returns {boolean}
333
+ */
334
+ isNamed() {
335
+ const ret = wasm.sgnode_isNamed(this.__wbg_ptr);
336
+ return ret !== 0;
337
+ }
338
+ /**
339
+ * @returns {boolean}
340
+ */
341
+ isNamedLeaf() {
342
+ const ret = wasm.sgnode_isNamedLeaf(this.__wbg_ptr);
343
+ return ret !== 0;
344
+ }
345
+ /**
346
+ * @returns {string}
347
+ */
348
+ kind() {
349
+ let deferred1_0;
350
+ let deferred1_1;
351
+ try {
352
+ const ret = wasm.sgnode_kind(this.__wbg_ptr);
353
+ deferred1_0 = ret[0];
354
+ deferred1_1 = ret[1];
355
+ return getStringFromWasm0(ret[0], ret[1]);
356
+ } finally {
357
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
358
+ }
359
+ }
360
+ /**
361
+ * @param {any} m
362
+ * @returns {boolean}
363
+ */
364
+ matches(m) {
365
+ const ret = wasm.sgnode_matches(this.__wbg_ptr, m);
366
+ if (ret[2]) {
367
+ throw takeFromExternrefTable0(ret[1]);
368
+ }
369
+ return ret[0] !== 0;
370
+ }
371
+ /**
372
+ * @returns {SgNode | undefined}
373
+ */
374
+ next() {
375
+ const ret = wasm.sgnode_next(this.__wbg_ptr);
376
+ return ret === 0 ? undefined : SgNode.__wrap(ret);
377
+ }
378
+ /**
379
+ * @returns {SgNode[]}
380
+ */
381
+ nextAll() {
382
+ const ret = wasm.sgnode_nextAll(this.__wbg_ptr);
383
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
384
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
385
+ return v1;
386
+ }
387
+ /**
388
+ * @returns {SgNode | undefined}
389
+ */
390
+ parent_node() {
391
+ const ret = wasm.sgnode_parent_node(this.__wbg_ptr);
392
+ return ret === 0 ? undefined : SgNode.__wrap(ret);
393
+ }
394
+ /**
395
+ * @param {any} m
396
+ * @returns {boolean}
397
+ */
398
+ precedes(m) {
399
+ const ret = wasm.sgnode_precedes(this.__wbg_ptr, m);
400
+ if (ret[2]) {
401
+ throw takeFromExternrefTable0(ret[1]);
402
+ }
403
+ return ret[0] !== 0;
404
+ }
405
+ /**
406
+ * @returns {SgNode | undefined}
407
+ */
408
+ prev() {
409
+ const ret = wasm.sgnode_prev(this.__wbg_ptr);
410
+ return ret === 0 ? undefined : SgNode.__wrap(ret);
411
+ }
412
+ /**
413
+ * @returns {SgNode[]}
414
+ */
415
+ prevAll() {
416
+ const ret = wasm.sgnode_prevAll(this.__wbg_ptr);
417
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
418
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
419
+ return v1;
420
+ }
421
+ /**
422
+ * @returns {Range}
423
+ */
424
+ range() {
425
+ const ret = wasm.sgnode_range(this.__wbg_ptr);
426
+ return Range.__wrap(ret);
427
+ }
428
+ /**
429
+ * @param {string} text
430
+ * @returns {WasmEdit}
431
+ */
432
+ replace(text) {
433
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
434
+ const len0 = WASM_VECTOR_LEN;
435
+ const ret = wasm.sgnode_replace(this.__wbg_ptr, ptr0, len0);
436
+ return WasmEdit.__wrap(ret);
437
+ }
438
+ /**
439
+ * @returns {string}
440
+ */
441
+ text() {
442
+ let deferred1_0;
443
+ let deferred1_1;
444
+ try {
445
+ const ret = wasm.sgnode_text(this.__wbg_ptr);
446
+ deferred1_0 = ret[0];
447
+ deferred1_1 = ret[1];
448
+ return getStringFromWasm0(ret[0], ret[1]);
449
+ } finally {
450
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
451
+ }
452
+ }
453
+ }
454
+ if (Symbol.dispose) SgNode.prototype[Symbol.dispose] = SgNode.prototype.free;
455
+
456
+ /**
457
+ * Represents the parsed tree of code.
458
+ */
459
+ export class SgRoot {
460
+ static __wrap(ptr) {
461
+ const obj = Object.create(SgRoot.prototype);
462
+ obj.__wbg_ptr = ptr;
463
+ SgRootFinalization.register(obj, obj.__wbg_ptr, obj);
464
+ return obj;
465
+ }
466
+ __destroy_into_raw() {
467
+ const ptr = this.__wbg_ptr;
468
+ this.__wbg_ptr = 0;
469
+ SgRootFinalization.unregister(this);
470
+ return ptr;
471
+ }
472
+ free() {
473
+ const ptr = this.__destroy_into_raw();
474
+ wasm.__wbg_sgroot_free(ptr, 0);
475
+ }
476
+ /**
477
+ * Returns the path of the file if it is discovered by vorpal's `findInFiles`.
478
+ * Returns `"anonymous"` if the instance is created by `parse`.
479
+ * @returns {string}
480
+ */
481
+ filename() {
482
+ let deferred1_0;
483
+ let deferred1_1;
484
+ try {
485
+ const ret = wasm.sgroot_filename(this.__wbg_ptr);
486
+ deferred1_0 = ret[0];
487
+ deferred1_1 = ret[1];
488
+ return getStringFromWasm0(ret[0], ret[1]);
489
+ } finally {
490
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
491
+ }
492
+ }
493
+ /**
494
+ * This method is mainly for debugging tree parsing result.
495
+ * @returns {any}
496
+ */
497
+ getInnerTree() {
498
+ const ret = wasm.sgroot_getInnerTree(this.__wbg_ptr);
499
+ return ret;
500
+ }
501
+ /**
502
+ * Returns the root SgNode of the Vorpal instance.
503
+ * @returns {SgNode}
504
+ */
505
+ root() {
506
+ const ret = wasm.sgroot_root(this.__wbg_ptr);
507
+ return SgNode.__wrap(ret);
508
+ }
509
+ }
510
+ if (Symbol.dispose) SgRoot.prototype[Symbol.dispose] = SgRoot.prototype.free;
511
+
512
+ export class WasmEdit {
513
+ static __wrap(ptr) {
514
+ const obj = Object.create(WasmEdit.prototype);
515
+ obj.__wbg_ptr = ptr;
516
+ WasmEditFinalization.register(obj, obj.__wbg_ptr, obj);
517
+ return obj;
518
+ }
519
+ __destroy_into_raw() {
520
+ const ptr = this.__wbg_ptr;
521
+ this.__wbg_ptr = 0;
522
+ WasmEditFinalization.unregister(this);
523
+ return ptr;
524
+ }
525
+ free() {
526
+ const ptr = this.__destroy_into_raw();
527
+ wasm.__wbg_wasmedit_free(ptr, 0);
528
+ }
529
+ /**
530
+ * The end position of the edit (character offset)
531
+ * @returns {number}
532
+ */
533
+ get end_pos() {
534
+ const ret = wasm.__wbg_get_wasmedit_end_pos(this.__wbg_ptr);
535
+ return ret >>> 0;
536
+ }
537
+ /**
538
+ * The text to be inserted
539
+ * @returns {string}
540
+ */
541
+ get inserted_text() {
542
+ let deferred1_0;
543
+ let deferred1_1;
544
+ try {
545
+ const ret = wasm.__wbg_get_wasmedit_inserted_text(this.__wbg_ptr);
546
+ deferred1_0 = ret[0];
547
+ deferred1_1 = ret[1];
548
+ return getStringFromWasm0(ret[0], ret[1]);
549
+ } finally {
550
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
551
+ }
552
+ }
553
+ /**
554
+ * The start position of the edit (character offset)
555
+ * @returns {number}
556
+ */
557
+ get start_pos() {
558
+ const ret = wasm.__wbg_get_wasmedit_start_pos(this.__wbg_ptr);
559
+ return ret >>> 0;
560
+ }
561
+ /**
562
+ * The end position of the edit (character offset)
563
+ * @param {number} arg0
564
+ */
565
+ set end_pos(arg0) {
566
+ wasm.__wbg_set_wasmedit_end_pos(this.__wbg_ptr, arg0);
567
+ }
568
+ /**
569
+ * The text to be inserted
570
+ * @param {string} arg0
571
+ */
572
+ set inserted_text(arg0) {
573
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
574
+ const len0 = WASM_VECTOR_LEN;
575
+ wasm.__wbg_set_wasmedit_inserted_text(this.__wbg_ptr, ptr0, len0);
576
+ }
577
+ /**
578
+ * The start position of the edit (character offset)
579
+ * @param {number} arg0
580
+ */
581
+ set start_pos(arg0) {
582
+ wasm.__wbg_set_wasmedit_start_pos(this.__wbg_ptr, arg0);
583
+ }
584
+ }
585
+ if (Symbol.dispose) WasmEdit.prototype[Symbol.dispose] = WasmEdit.prototype.free;
586
+
587
+ /**
588
+ * Dump a pattern's internal structure for inspection.
589
+ * `selector` is an optional kind name for contextual patterns.
590
+ * `strictness` is one of: "cst", "smart", "ast", "relaxed", "signature", "template".
591
+ * Returns a tree structure showing how vorpal parses the pattern, including source positions.
592
+ * @param {string} lang
593
+ * @param {string} pattern_str
594
+ * @param {string | null} [selector]
595
+ * @param {string | null} [strictness]
596
+ * @returns {any}
597
+ */
598
+ export function dumpPattern(lang, pattern_str, selector, strictness) {
599
+ const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
600
+ const len0 = WASM_VECTOR_LEN;
601
+ const ptr1 = passStringToWasm0(pattern_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
602
+ const len1 = WASM_VECTOR_LEN;
603
+ var ptr2 = isLikeNone(selector) ? 0 : passStringToWasm0(selector, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
604
+ var len2 = WASM_VECTOR_LEN;
605
+ var ptr3 = isLikeNone(strictness) ? 0 : passStringToWasm0(strictness, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
606
+ var len3 = WASM_VECTOR_LEN;
607
+ const ret = wasm.dumpPattern(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
608
+ if (ret[2]) {
609
+ throw takeFromExternrefTable0(ret[1]);
610
+ }
611
+ return takeFromExternrefTable0(ret[0]);
612
+ }
613
+
614
+ /**
615
+ * Initialize the tree-sitter WASM runtime.
616
+ * Must be called before any other function.
617
+ * @returns {Promise<void>}
618
+ */
619
+ export function initializeTreeSitter() {
620
+ const ret = wasm.initializeTreeSitter();
621
+ return ret;
622
+ }
623
+
624
+ /**
625
+ * Get the `kind` number from its string name.
626
+ * @param {string} lang
627
+ * @param {string} kind_name
628
+ * @returns {number}
629
+ */
630
+ export function kind(lang, kind_name) {
631
+ const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
632
+ const len0 = WASM_VECTOR_LEN;
633
+ const ptr1 = passStringToWasm0(kind_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
634
+ const len1 = WASM_VECTOR_LEN;
635
+ const ret = wasm.kind(ptr0, len0, ptr1, len1);
636
+ if (ret[2]) {
637
+ throw takeFromExternrefTable0(ret[1]);
638
+ }
639
+ return ret[0];
640
+ }
641
+
642
+ /**
643
+ * Parse a string to a Vorpal instance.
644
+ * @param {string} lang
645
+ * @param {string} src
646
+ * @returns {SgRoot}
647
+ */
648
+ export function parse(lang, src) {
649
+ const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
650
+ const len0 = WASM_VECTOR_LEN;
651
+ const ptr1 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
652
+ const len1 = WASM_VECTOR_LEN;
653
+ const ret = wasm.parse(ptr0, len0, ptr1, len1);
654
+ if (ret[2]) {
655
+ throw takeFromExternrefTable0(ret[1]);
656
+ }
657
+ return SgRoot.__wrap(ret[0]);
658
+ }
659
+
660
+ /**
661
+ * Compile a string to a Vorpal Pattern config.
662
+ * @param {string} lang
663
+ * @param {string} pattern_str
664
+ * @returns {any}
665
+ */
666
+ export function pattern(lang, pattern_str) {
667
+ const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
668
+ const len0 = WASM_VECTOR_LEN;
669
+ const ptr1 = passStringToWasm0(pattern_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
670
+ const len1 = WASM_VECTOR_LEN;
671
+ const ret = wasm.pattern(ptr0, len0, ptr1, len1);
672
+ if (ret[2]) {
673
+ throw takeFromExternrefTable0(ret[1]);
674
+ }
675
+ return takeFromExternrefTable0(ret[0]);
676
+ }
677
+
678
+ /**
679
+ * Register dynamic languages for parsing.
680
+ * `langs` is a Map of language name to its registration config
681
+ * (with `libraryPath` and optional `expandoChar`).
682
+ * Can be called multiple times; existing languages are updated.
683
+ * @param {any} langs
684
+ * @returns {Promise<void>}
685
+ */
686
+ export function registerDynamicLanguage(langs) {
687
+ const ret = wasm.registerDynamicLanguage(langs);
688
+ return ret;
689
+ }
690
+ export function __wbg_Error_92b29b0548f8b746(arg0, arg1) {
691
+ const ret = Error(getStringFromWasm0(arg0, arg1));
692
+ return ret;
693
+ }
694
+ export function __wbg_Number_9a4e0ecb0fa16705(arg0) {
695
+ const ret = Number(arg0);
696
+ return ret;
697
+ }
698
+ export function __wbg_String_8564e559799eccda(arg0, arg1) {
699
+ const ret = String(arg1);
700
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
701
+ const len1 = WASM_VECTOR_LEN;
702
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
703
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
704
+ }
705
+ export function __wbg___new_5e2fc20cf77cbd93() { return handleError(function () {
706
+ const ret = new Parser();
707
+ return ret;
708
+ }, arguments); }
709
+ export function __wbg___wbindgen_bigint_get_as_i64_d968e41184ae354f(arg0, arg1) {
710
+ const v = arg1;
711
+ const ret = typeof(v) === 'bigint' ? v : undefined;
712
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
713
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
714
+ }
715
+ export function __wbg___wbindgen_boolean_get_fa956cfa2d1bd751(arg0) {
716
+ const v = arg0;
717
+ const ret = typeof(v) === 'boolean' ? v : undefined;
718
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
719
+ }
720
+ export function __wbg___wbindgen_debug_string_c25d447a39f5578f(arg0, arg1) {
721
+ const ret = debugString(arg1);
722
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
723
+ const len1 = WASM_VECTOR_LEN;
724
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
725
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
726
+ }
727
+ export function __wbg___wbindgen_in_aca499c5de7ff5e5(arg0, arg1) {
728
+ const ret = arg0 in arg1;
729
+ return ret;
730
+ }
731
+ export function __wbg___wbindgen_is_bigint_2f76dc55065b4273(arg0) {
732
+ const ret = typeof(arg0) === 'bigint';
733
+ return ret;
734
+ }
735
+ export function __wbg___wbindgen_is_function_1ff95bcc5517c252(arg0) {
736
+ const ret = typeof(arg0) === 'function';
737
+ return ret;
738
+ }
739
+ export function __wbg___wbindgen_is_object_a27215656b807791(arg0) {
740
+ const val = arg0;
741
+ const ret = typeof(val) === 'object' && val !== null;
742
+ return ret;
743
+ }
744
+ export function __wbg___wbindgen_is_string_ea5e6cc2e4141dfe(arg0) {
745
+ const ret = typeof(arg0) === 'string';
746
+ return ret;
747
+ }
748
+ export function __wbg___wbindgen_is_undefined_c05833b95a3cf397(arg0) {
749
+ const ret = arg0 === undefined;
750
+ return ret;
751
+ }
752
+ export function __wbg___wbindgen_jsval_eq_e659fcf7b0e32763(arg0, arg1) {
753
+ const ret = arg0 === arg1;
754
+ return ret;
755
+ }
756
+ export function __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170(arg0, arg1) {
757
+ const ret = arg0 == arg1;
758
+ return ret;
759
+ }
760
+ export function __wbg___wbindgen_number_get_394265ed1e1b84ee(arg0, arg1) {
761
+ const obj = arg1;
762
+ const ret = typeof(obj) === 'number' ? obj : undefined;
763
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
764
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
765
+ }
766
+ export function __wbg___wbindgen_string_get_b0ca35b86a603356(arg0, arg1) {
767
+ const obj = arg1;
768
+ const ret = typeof(obj) === 'string' ? obj : undefined;
769
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
770
+ var len1 = WASM_VECTOR_LEN;
771
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
772
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
773
+ }
774
+ export function __wbg___wbindgen_throw_344f42d3211c4765(arg0, arg1) {
775
+ throw new Error(getStringFromWasm0(arg0, arg1));
776
+ }
777
+ export function __wbg__wbg_cb_unref_fffb441def202758(arg0) {
778
+ arg0._wbg_cb_unref();
779
+ }
780
+ export function __wbg_call_8a2dd23819f8a60a() { return handleError(function (arg0, arg1) {
781
+ const ret = arg0.call(arg1);
782
+ return ret;
783
+ }, arguments); }
784
+ export function __wbg_call_a6e5c5dce5018821() { return handleError(function (arg0, arg1, arg2) {
785
+ const ret = arg0.call(arg1, arg2);
786
+ return ret;
787
+ }, arguments); }
788
+ export function __wbg_childCount_8fc5cf7f014160c3(arg0) {
789
+ const ret = arg0.childCount;
790
+ return ret;
791
+ }
792
+ export function __wbg_childForFieldId_8ffad69e26f9bf31(arg0, arg1) {
793
+ const ret = arg0.childForFieldId(arg1);
794
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
795
+ }
796
+ export function __wbg_childForFieldName_99cb68a253feb67a(arg0, arg1, arg2) {
797
+ const ret = arg0.childForFieldName(getStringFromWasm0(arg1, arg2));
798
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
799
+ }
800
+ export function __wbg_child_34f42f2d81f130c5(arg0, arg1) {
801
+ const ret = arg0.child(arg1 >>> 0);
802
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
803
+ }
804
+ export function __wbg_children_49516cc5878b18f9(arg0, arg1) {
805
+ const ret = arg1.children;
806
+ const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_malloc);
807
+ const len1 = WASM_VECTOR_LEN;
808
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
809
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
810
+ }
811
+ export function __wbg_codePointAt_ebd6d9bd1f1ee816(arg0, arg1) {
812
+ const ret = arg0.codePointAt(arg1 >>> 0);
813
+ return ret;
814
+ }
815
+ export function __wbg_column_beabe643537f814d(arg0) {
816
+ const ret = arg0.column;
817
+ return ret;
818
+ }
819
+ export function __wbg_copy_2ff620aa222bd72e(arg0) {
820
+ const ret = arg0.copy();
821
+ return ret;
822
+ }
823
+ export function __wbg_currentFieldId_d6f63ef8827fc05f(arg0) {
824
+ const ret = arg0.currentFieldId;
825
+ return isLikeNone(ret) ? 0xFFFFFF : ret;
826
+ }
827
+ export function __wbg_currentNode_fcd9c7bf4ebf936d(arg0) {
828
+ const ret = arg0.currentNode;
829
+ return ret;
830
+ }
831
+ export function __wbg_done_89b2b13e91a60321(arg0) {
832
+ const ret = arg0.done;
833
+ return ret;
834
+ }
835
+ export function __wbg_endIndex_ec4c7c66f484e11a(arg0) {
836
+ const ret = arg0.endIndex;
837
+ return ret;
838
+ }
839
+ export function __wbg_endPosition_668adf14944d8591(arg0) {
840
+ const ret = arg0.endPosition;
841
+ return ret;
842
+ }
843
+ export function __wbg_entries_015dc610cd81ede0(arg0) {
844
+ const ret = Object.entries(arg0);
845
+ return ret;
846
+ }
847
+ export function __wbg_fieldIdForName_773b488c3a39f08c(arg0, arg1, arg2) {
848
+ const ret = arg0.fieldIdForName(getStringFromWasm0(arg1, arg2));
849
+ return isLikeNone(ret) ? 0xFFFFFF : ret;
850
+ }
851
+ export function __wbg_get_507a50627bffa49b(arg0, arg1) {
852
+ const ret = arg0[arg1 >>> 0];
853
+ return ret;
854
+ }
855
+ export function __wbg_get_c7eb1f358a7654df() { return handleError(function (arg0, arg1) {
856
+ const ret = Reflect.get(arg0, arg1);
857
+ return ret;
858
+ }, arguments); }
859
+ export function __wbg_get_unchecked_6e0ad6d2a41b06f6(arg0, arg1) {
860
+ const ret = arg0[arg1 >>> 0];
861
+ return ret;
862
+ }
863
+ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
864
+ const ret = arg0[arg1];
865
+ return ret;
866
+ }
867
+ export function __wbg_gotoFirstChild_f429c1d500bad453(arg0) {
868
+ const ret = arg0.gotoFirstChild();
869
+ return ret;
870
+ }
871
+ export function __wbg_gotoNextSibling_000786859d347d6c(arg0) {
872
+ const ret = arg0.gotoNextSibling();
873
+ return ret;
874
+ }
875
+ export function __wbg_idForNodeType_d331e0737dcdd691(arg0, arg1, arg2, arg3) {
876
+ const ret = arg0.idForNodeType(getStringFromWasm0(arg1, arg2), arg3 !== 0);
877
+ return ret;
878
+ }
879
+ export function __wbg_id_7451a07454106d9d(arg0) {
880
+ const ret = arg0.id;
881
+ return ret;
882
+ }
883
+ export function __wbg_init_49ed3c4d5f8927a3() {
884
+ const ret = Parser.init();
885
+ return ret;
886
+ }
887
+ export function __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb(arg0) {
888
+ let result;
889
+ try {
890
+ result = arg0 instanceof ArrayBuffer;
891
+ } catch (_) {
892
+ result = false;
893
+ }
894
+ const ret = result;
895
+ return ret;
896
+ }
897
+ export function __wbg_instanceof_Error_1fdac9f13a8181ba(arg0) {
898
+ let result;
899
+ try {
900
+ result = arg0 instanceof Error;
901
+ } catch (_) {
902
+ result = false;
903
+ }
904
+ const ret = result;
905
+ return ret;
906
+ }
907
+ export function __wbg_instanceof_Map_e5b5e3db98422fcc(arg0) {
908
+ let result;
909
+ try {
910
+ result = arg0 instanceof Map;
911
+ } catch (_) {
912
+ result = false;
913
+ }
914
+ const ret = result;
915
+ return ret;
916
+ }
917
+ export function __wbg_instanceof_Uint8Array_309b927aaf7a3fc7(arg0) {
918
+ let result;
919
+ try {
920
+ result = arg0 instanceof Uint8Array;
921
+ } catch (_) {
922
+ result = false;
923
+ }
924
+ const ret = result;
925
+ return ret;
926
+ }
927
+ export function __wbg_isArray_0677c962b281d01a(arg0) {
928
+ const ret = Array.isArray(arg0);
929
+ return ret;
930
+ }
931
+ export function __wbg_isMissing_ba967f703d1ec8fb(arg0) {
932
+ const ret = arg0.isMissing;
933
+ return ret;
934
+ }
935
+ export function __wbg_isNamed_4adc1bd6e242a7eb(arg0) {
936
+ const ret = arg0.isNamed;
937
+ return ret;
938
+ }
939
+ export function __wbg_isSafeInteger_04f36e4056f1b851(arg0) {
940
+ const ret = Number.isSafeInteger(arg0);
941
+ return ret;
942
+ }
943
+ export function __wbg_iterator_6f722e4a93058b71() {
944
+ const ret = Symbol.iterator;
945
+ return ret;
946
+ }
947
+ export function __wbg_language_ff5656ade3ccdd9c(arg0) {
948
+ const ret = arg0.language;
949
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
950
+ }
951
+ export function __wbg_length_02c64e687322fa34(arg0) {
952
+ const ret = arg0.length;
953
+ return ret;
954
+ }
955
+ export function __wbg_length_1f0964f4a5e2c6d8(arg0) {
956
+ const ret = arg0.length;
957
+ return ret;
958
+ }
959
+ export function __wbg_length_370319915dc99107(arg0) {
960
+ const ret = arg0.length;
961
+ return ret;
962
+ }
963
+ export function __wbg_load_c9c738af2a15ae43(arg0, arg1) {
964
+ const ret = Language.load(getStringFromWasm0(arg0, arg1));
965
+ return ret;
966
+ }
967
+ export function __wbg_message_8326fb1d549bebc5(arg0) {
968
+ const ret = arg0.message;
969
+ return ret;
970
+ }
971
+ export function __wbg_namedChildCount_b5d3ade3ffaacf35(arg0) {
972
+ const ret = arg0.namedChildCount;
973
+ return ret;
974
+ }
975
+ export function __wbg_new_32b398fb48b6d94a() {
976
+ const ret = new Array();
977
+ return ret;
978
+ }
979
+ export function __wbg_new_7796ffc7ed656783() {
980
+ const ret = new Map();
981
+ return ret;
982
+ }
983
+ export function __wbg_new_cd45aabdf6073e84(arg0) {
984
+ const ret = new Uint8Array(arg0);
985
+ return ret;
986
+ }
987
+ export function __wbg_new_da52cf8fe3429cb2() {
988
+ const ret = new Object();
989
+ return ret;
990
+ }
991
+ export function __wbg_new_typed_1824d93f294193e5(arg0, arg1) {
992
+ try {
993
+ var state0 = {a: arg0, b: arg1};
994
+ var cb0 = (arg0, arg1) => {
995
+ const a = state0.a;
996
+ state0.a = 0;
997
+ try {
998
+ return wasm_bindgen_1bc7709ad50bb37e___convert__closures_____invoke___js_sys_40c9f221babda0c4___Function_fn_wasm_bindgen_1bc7709ad50bb37e___JsValue_____wasm_bindgen_1bc7709ad50bb37e___sys__Undefined___js_sys_40c9f221babda0c4___Function_fn_wasm_bindgen_1bc7709ad50bb37e___JsValue_____wasm_bindgen_1bc7709ad50bb37e___sys__Undefined_______true_(a, state0.b, arg0, arg1);
999
+ } finally {
1000
+ state0.a = a;
1001
+ }
1002
+ };
1003
+ const ret = new Promise(cb0);
1004
+ return ret;
1005
+ } finally {
1006
+ state0.a = 0;
1007
+ }
1008
+ }
1009
+ export function __wbg_nextSibling_c6aded82d2dfef25(arg0) {
1010
+ const ret = arg0.nextSibling;
1011
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1012
+ }
1013
+ export function __wbg_next_6dbf2c0ac8cde20f(arg0) {
1014
+ const ret = arg0.next;
1015
+ return ret;
1016
+ }
1017
+ export function __wbg_next_71f2aa1cb3d1e37e() { return handleError(function (arg0) {
1018
+ const ret = arg0.next();
1019
+ return ret;
1020
+ }, arguments); }
1021
+ export function __wbg_parent_c36f3a63f3f2c580(arg0) {
1022
+ const ret = arg0.parent;
1023
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1024
+ }
1025
+ export function __wbg_parse_bc1f2dae07ff9328() { return handleError(function (arg0, arg1, arg2, arg3) {
1026
+ const ret = arg0.parse(arg1, arg2, arg3);
1027
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1028
+ }, arguments); }
1029
+ export function __wbg_previousSibling_18a8a13f313c548b(arg0) {
1030
+ const ret = arg0.previousSibling;
1031
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1032
+ }
1033
+ export function __wbg_prototypesetcall_4770620bbe4688a0(arg0, arg1, arg2) {
1034
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1035
+ }
1036
+ export function __wbg_queueMicrotask_0ab5b2d2393e99b9(arg0) {
1037
+ const ret = arg0.queueMicrotask;
1038
+ return ret;
1039
+ }
1040
+ export function __wbg_queueMicrotask_6a09b7bc46549209(arg0) {
1041
+ queueMicrotask(arg0);
1042
+ }
1043
+ export function __wbg_resolve_2191a4dfe481c25b(arg0) {
1044
+ const ret = Promise.resolve(arg0);
1045
+ return ret;
1046
+ }
1047
+ export function __wbg_rootNode_ecac7457b6244b1a(arg0) {
1048
+ const ret = arg0.rootNode;
1049
+ return ret;
1050
+ }
1051
+ export function __wbg_row_4022fd29c18f40bb(arg0) {
1052
+ const ret = arg0.row;
1053
+ return ret;
1054
+ }
1055
+ export function __wbg_setLanguage_92e91e477c8dd076() { return handleError(function (arg0, arg1) {
1056
+ arg0.setLanguage(arg1);
1057
+ }, arguments); }
1058
+ export function __wbg_set_575dd786d51585f8(arg0, arg1, arg2) {
1059
+ const ret = arg0.set(arg1, arg2);
1060
+ return ret;
1061
+ }
1062
+ export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
1063
+ arg0[arg1] = arg2;
1064
+ }
1065
+ export function __wbg_set_8a16b38e4805b298(arg0, arg1, arg2) {
1066
+ arg0[arg1 >>> 0] = arg2;
1067
+ }
1068
+ export function __wbg_sgnode_new(arg0) {
1069
+ const ret = SgNode.__wrap(arg0);
1070
+ return ret;
1071
+ }
1072
+ export function __wbg_startIndex_6df419b7fd12a7e6(arg0) {
1073
+ const ret = arg0.startIndex;
1074
+ return ret;
1075
+ }
1076
+ export function __wbg_startPosition_f54251f34f327e51(arg0) {
1077
+ const ret = arg0.startPosition;
1078
+ return ret;
1079
+ }
1080
+ export function __wbg_static_accessor_GLOBAL_4ef717fb391d88b7() {
1081
+ const ret = typeof global === 'undefined' ? null : global;
1082
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1083
+ }
1084
+ export function __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4() {
1085
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1086
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1087
+ }
1088
+ export function __wbg_static_accessor_SELF_146583524fe1469b() {
1089
+ const ret = typeof self === 'undefined' ? null : self;
1090
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1091
+ }
1092
+ export function __wbg_static_accessor_WINDOW_f2829a2234d7819e() {
1093
+ const ret = typeof window === 'undefined' ? null : window;
1094
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1095
+ }
1096
+ export function __wbg_text_549ba866689ab411(arg0) {
1097
+ const ret = arg0.text;
1098
+ return ret;
1099
+ }
1100
+ export function __wbg_then_16d107c451e9905d(arg0, arg1, arg2) {
1101
+ const ret = arg0.then(arg1, arg2);
1102
+ return ret;
1103
+ }
1104
+ export function __wbg_then_6ec10ae38b3e92f7(arg0, arg1) {
1105
+ const ret = arg0.then(arg1);
1106
+ return ret;
1107
+ }
1108
+ export function __wbg_typeId_28b3c8be8f0fa5ac(arg0) {
1109
+ const ret = arg0.typeId;
1110
+ return ret;
1111
+ }
1112
+ export function __wbg_type_b613a15b32052ff4(arg0) {
1113
+ const ret = arg0.type;
1114
+ return ret;
1115
+ }
1116
+ export function __wbg_value_a5d5488a9589444a(arg0) {
1117
+ const ret = arg0.value;
1118
+ return ret;
1119
+ }
1120
+ export function __wbg_walk_0b8f139e5549a408(arg0) {
1121
+ const ret = arg0.walk();
1122
+ return ret;
1123
+ }
1124
+ export function __wbindgen_cast_0000000000000001(arg0, arg1) {
1125
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 340, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1126
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1bc7709ad50bb37e___convert__closures_____invoke___wasm_bindgen_1bc7709ad50bb37e___JsValue__core_f0fd674eaa06beef___result__Result_____wasm_bindgen_1bc7709ad50bb37e___JsError___true_);
1127
+ return ret;
1128
+ }
1129
+ export function __wbindgen_cast_0000000000000002(arg0) {
1130
+ // Cast intrinsic for `F64 -> Externref`.
1131
+ const ret = arg0;
1132
+ return ret;
1133
+ }
1134
+ export function __wbindgen_cast_0000000000000003(arg0) {
1135
+ // Cast intrinsic for `I64 -> Externref`.
1136
+ const ret = arg0;
1137
+ return ret;
1138
+ }
1139
+ export function __wbindgen_cast_0000000000000004(arg0, arg1) {
1140
+ // Cast intrinsic for `Ref(String) -> Externref`.
1141
+ const ret = getStringFromWasm0(arg0, arg1);
1142
+ return ret;
1143
+ }
1144
+ export function __wbindgen_cast_0000000000000005(arg0) {
1145
+ // Cast intrinsic for `U64 -> Externref`.
1146
+ const ret = BigInt.asUintN(64, arg0);
1147
+ return ret;
1148
+ }
1149
+ export function __wbindgen_init_externref_table() {
1150
+ const table = wasm.__wbindgen_externrefs;
1151
+ const offset = table.grow(4);
1152
+ table.set(0, undefined);
1153
+ table.set(offset + 0, undefined);
1154
+ table.set(offset + 1, null);
1155
+ table.set(offset + 2, true);
1156
+ table.set(offset + 3, false);
1157
+ }
1158
+ function wasm_bindgen_1bc7709ad50bb37e___convert__closures_____invoke___wasm_bindgen_1bc7709ad50bb37e___JsValue__core_f0fd674eaa06beef___result__Result_____wasm_bindgen_1bc7709ad50bb37e___JsError___true_(arg0, arg1, arg2) {
1159
+ const ret = wasm.wasm_bindgen_1bc7709ad50bb37e___convert__closures_____invoke___wasm_bindgen_1bc7709ad50bb37e___JsValue__core_f0fd674eaa06beef___result__Result_____wasm_bindgen_1bc7709ad50bb37e___JsError___true_(arg0, arg1, arg2);
1160
+ if (ret[1]) {
1161
+ throw takeFromExternrefTable0(ret[0]);
1162
+ }
1163
+ }
1164
+
1165
+ function wasm_bindgen_1bc7709ad50bb37e___convert__closures_____invoke___js_sys_40c9f221babda0c4___Function_fn_wasm_bindgen_1bc7709ad50bb37e___JsValue_____wasm_bindgen_1bc7709ad50bb37e___sys__Undefined___js_sys_40c9f221babda0c4___Function_fn_wasm_bindgen_1bc7709ad50bb37e___JsValue_____wasm_bindgen_1bc7709ad50bb37e___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
1166
+ wasm.wasm_bindgen_1bc7709ad50bb37e___convert__closures_____invoke___js_sys_40c9f221babda0c4___Function_fn_wasm_bindgen_1bc7709ad50bb37e___JsValue_____wasm_bindgen_1bc7709ad50bb37e___sys__Undefined___js_sys_40c9f221babda0c4___Function_fn_wasm_bindgen_1bc7709ad50bb37e___JsValue_____wasm_bindgen_1bc7709ad50bb37e___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
1167
+ }
1168
+
1169
+ const PosFinalization = (typeof FinalizationRegistry === 'undefined')
1170
+ ? { register: () => {}, unregister: () => {} }
1171
+ : new FinalizationRegistry(ptr => wasm.__wbg_pos_free(ptr, 1));
1172
+ const RangeFinalization = (typeof FinalizationRegistry === 'undefined')
1173
+ ? { register: () => {}, unregister: () => {} }
1174
+ : new FinalizationRegistry(ptr => wasm.__wbg_range_free(ptr, 1));
1175
+ const SgNodeFinalization = (typeof FinalizationRegistry === 'undefined')
1176
+ ? { register: () => {}, unregister: () => {} }
1177
+ : new FinalizationRegistry(ptr => wasm.__wbg_sgnode_free(ptr, 1));
1178
+ const SgRootFinalization = (typeof FinalizationRegistry === 'undefined')
1179
+ ? { register: () => {}, unregister: () => {} }
1180
+ : new FinalizationRegistry(ptr => wasm.__wbg_sgroot_free(ptr, 1));
1181
+ const WasmEditFinalization = (typeof FinalizationRegistry === 'undefined')
1182
+ ? { register: () => {}, unregister: () => {} }
1183
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmedit_free(ptr, 1));
1184
+
1185
+ function addToExternrefTable0(obj) {
1186
+ const idx = wasm.__externref_table_alloc();
1187
+ wasm.__wbindgen_externrefs.set(idx, obj);
1188
+ return idx;
1189
+ }
1190
+
1191
+ function _assertClass(instance, klass) {
1192
+ if (!(instance instanceof klass)) {
1193
+ throw new Error(`expected instance of ${klass.name}`);
1194
+ }
1195
+ }
1196
+
1197
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1198
+ ? { register: () => {}, unregister: () => {} }
1199
+ : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
1200
+
1201
+ function debugString(val) {
1202
+ // primitive types
1203
+ const type = typeof val;
1204
+ if (type == 'number' || type == 'boolean' || val == null) {
1205
+ return `${val}`;
1206
+ }
1207
+ if (type == 'string') {
1208
+ return `"${val}"`;
1209
+ }
1210
+ if (type == 'symbol') {
1211
+ const description = val.description;
1212
+ if (description == null) {
1213
+ return 'Symbol';
1214
+ } else {
1215
+ return `Symbol(${description})`;
1216
+ }
1217
+ }
1218
+ if (type == 'function') {
1219
+ const name = val.name;
1220
+ if (typeof name == 'string' && name.length > 0) {
1221
+ return `Function(${name})`;
1222
+ } else {
1223
+ return 'Function';
1224
+ }
1225
+ }
1226
+ // objects
1227
+ if (Array.isArray(val)) {
1228
+ const length = val.length;
1229
+ let debug = '[';
1230
+ if (length > 0) {
1231
+ debug += debugString(val[0]);
1232
+ }
1233
+ for(let i = 1; i < length; i++) {
1234
+ debug += ', ' + debugString(val[i]);
1235
+ }
1236
+ debug += ']';
1237
+ return debug;
1238
+ }
1239
+ // Test for built-in
1240
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1241
+ let className;
1242
+ if (builtInMatches && builtInMatches.length > 1) {
1243
+ className = builtInMatches[1];
1244
+ } else {
1245
+ // Failed to match the standard '[object ClassName]'
1246
+ return toString.call(val);
1247
+ }
1248
+ if (className == 'Object') {
1249
+ // we're a user defined class or Object
1250
+ // JSON.stringify avoids problems with cycles, and is generally much
1251
+ // easier than looping through ownProperties of `val`.
1252
+ try {
1253
+ return 'Object(' + JSON.stringify(val) + ')';
1254
+ } catch (_) {
1255
+ return 'Object';
1256
+ }
1257
+ }
1258
+ // errors
1259
+ if (val instanceof Error) {
1260
+ return `${val.name}: ${val.message}\n${val.stack}`;
1261
+ }
1262
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1263
+ return className;
1264
+ }
1265
+
1266
+ function getArrayJsValueFromWasm0(ptr, len) {
1267
+ ptr = ptr >>> 0;
1268
+ const mem = getDataViewMemory0();
1269
+ const result = [];
1270
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
1271
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
1272
+ }
1273
+ wasm.__externref_drop_slice(ptr, len);
1274
+ return result;
1275
+ }
1276
+
1277
+ function getArrayU8FromWasm0(ptr, len) {
1278
+ ptr = ptr >>> 0;
1279
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1280
+ }
1281
+
1282
+ let cachedDataViewMemory0 = null;
1283
+ function getDataViewMemory0() {
1284
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1285
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1286
+ }
1287
+ return cachedDataViewMemory0;
1288
+ }
1289
+
1290
+ function getStringFromWasm0(ptr, len) {
1291
+ return decodeText(ptr >>> 0, len);
1292
+ }
1293
+
1294
+ let cachedUint8ArrayMemory0 = null;
1295
+ function getUint8ArrayMemory0() {
1296
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1297
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1298
+ }
1299
+ return cachedUint8ArrayMemory0;
1300
+ }
1301
+
1302
+ function handleError(f, args) {
1303
+ try {
1304
+ return f.apply(this, args);
1305
+ } catch (e) {
1306
+ const idx = addToExternrefTable0(e);
1307
+ wasm.__wbindgen_exn_store(idx);
1308
+ }
1309
+ }
1310
+
1311
+ function isLikeNone(x) {
1312
+ return x === undefined || x === null;
1313
+ }
1314
+
1315
+ function makeMutClosure(arg0, arg1, f) {
1316
+ const state = { a: arg0, b: arg1, cnt: 1 };
1317
+ const real = (...args) => {
1318
+
1319
+ // First up with a closure we increment the internal reference
1320
+ // count. This ensures that the Rust closure environment won't
1321
+ // be deallocated while we're invoking it.
1322
+ state.cnt++;
1323
+ const a = state.a;
1324
+ state.a = 0;
1325
+ try {
1326
+ return f(a, state.b, ...args);
1327
+ } finally {
1328
+ state.a = a;
1329
+ real._wbg_cb_unref();
1330
+ }
1331
+ };
1332
+ real._wbg_cb_unref = () => {
1333
+ if (--state.cnt === 0) {
1334
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
1335
+ state.a = 0;
1336
+ CLOSURE_DTORS.unregister(state);
1337
+ }
1338
+ };
1339
+ CLOSURE_DTORS.register(real, state, state);
1340
+ return real;
1341
+ }
1342
+
1343
+ function passArrayJsValueToWasm0(array, malloc) {
1344
+ const ptr = malloc(array.length * 4, 4) >>> 0;
1345
+ for (let i = 0; i < array.length; i++) {
1346
+ const add = addToExternrefTable0(array[i]);
1347
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
1348
+ }
1349
+ WASM_VECTOR_LEN = array.length;
1350
+ return ptr;
1351
+ }
1352
+
1353
+ function passStringToWasm0(arg, malloc, realloc) {
1354
+ if (realloc === undefined) {
1355
+ const buf = cachedTextEncoder.encode(arg);
1356
+ const ptr = malloc(buf.length, 1) >>> 0;
1357
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1358
+ WASM_VECTOR_LEN = buf.length;
1359
+ return ptr;
1360
+ }
1361
+
1362
+ let len = arg.length;
1363
+ let ptr = malloc(len, 1) >>> 0;
1364
+
1365
+ const mem = getUint8ArrayMemory0();
1366
+
1367
+ let offset = 0;
1368
+
1369
+ for (; offset < len; offset++) {
1370
+ const code = arg.charCodeAt(offset);
1371
+ if (code > 0x7F) break;
1372
+ mem[ptr + offset] = code;
1373
+ }
1374
+ if (offset !== len) {
1375
+ if (offset !== 0) {
1376
+ arg = arg.slice(offset);
1377
+ }
1378
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1379
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1380
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1381
+
1382
+ offset += ret.written;
1383
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1384
+ }
1385
+
1386
+ WASM_VECTOR_LEN = offset;
1387
+ return ptr;
1388
+ }
1389
+
1390
+ function takeFromExternrefTable0(idx) {
1391
+ const value = wasm.__wbindgen_externrefs.get(idx);
1392
+ wasm.__externref_table_dealloc(idx);
1393
+ return value;
1394
+ }
1395
+
1396
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1397
+ cachedTextDecoder.decode();
1398
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1399
+ let numBytesDecoded = 0;
1400
+ function decodeText(ptr, len) {
1401
+ numBytesDecoded += len;
1402
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1403
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1404
+ cachedTextDecoder.decode();
1405
+ numBytesDecoded = len;
1406
+ }
1407
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1408
+ }
1409
+
1410
+ const cachedTextEncoder = new TextEncoder();
1411
+
1412
+ if (!('encodeInto' in cachedTextEncoder)) {
1413
+ cachedTextEncoder.encodeInto = function (arg, view) {
1414
+ const buf = cachedTextEncoder.encode(arg);
1415
+ view.set(buf);
1416
+ return {
1417
+ read: arg.length,
1418
+ written: buf.length
1419
+ };
1420
+ };
1421
+ }
1422
+
1423
+ let WASM_VECTOR_LEN = 0;
1424
+
1425
+
1426
+ let wasm;
1427
+ export function __wbg_set_wasm(val) {
1428
+ wasm = val;
1429
+ }