@pi-oxide/extension-js 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.
@@ -0,0 +1,1367 @@
1
+ /* @ts-self-types="./extension_js.d.ts" */
2
+ import * as import1 from "env";
3
+ import * as import2 from "env";
4
+ import * as import3 from "env";
5
+ import * as import4 from "env";
6
+ import * as import5 from "env";
7
+ import * as import6 from "env";
8
+ import * as import7 from "env";
9
+ import * as import8 from "env";
10
+ import * as import9 from "env";
11
+ import * as import10 from "env";
12
+ import * as import11 from "env";
13
+ import * as import12 from "env";
14
+ import * as import13 from "env";
15
+ import * as import14 from "env";
16
+ import * as import15 from "env";
17
+ import * as import16 from "env";
18
+ import * as import17 from "env";
19
+ import * as import18 from "env";
20
+ import * as import19 from "env";
21
+ import * as import20 from "env";
22
+ import * as import21 from "env";
23
+ import * as import22 from "env";
24
+ import * as import23 from "env";
25
+ import * as import24 from "env";
26
+ import * as import25 from "env";
27
+ import * as import26 from "env";
28
+ import * as import27 from "env";
29
+ import * as import28 from "env";
30
+ import * as import29 from "env";
31
+ import * as import30 from "env";
32
+ import * as import31 from "env";
33
+
34
+ //#region exports
35
+
36
+ /**
37
+ * ExtensionSession wraps BaseSession for the Chrome Extension environment.
38
+ * WASM runs inside a Web Worker; all browser side-effects are relayed
39
+ * to the main-thread runner via the `__extension_js_relay` global function.
40
+ */
41
+ export class ExtensionSession {
42
+ __destroy_into_raw() {
43
+ const ptr = this.__wbg_ptr;
44
+ this.__wbg_ptr = 0;
45
+ ExtensionSessionFinalization.unregister(this);
46
+ return ptr;
47
+ }
48
+ free() {
49
+ const ptr = this.__destroy_into_raw();
50
+ wasm.__wbg_extensionsession_free(ptr, 0);
51
+ }
52
+ /**
53
+ * Inspect all global variables in the current JS state.
54
+ * @returns {WasmGlobalsSnapshot}
55
+ */
56
+ inspect_globals() {
57
+ if (this.__wbg_ptr == 0) throw new Error("Attempt to use a moved value");
58
+ _assertNum(this.__wbg_ptr);
59
+ const ret = wasm.extensionsession_inspect_globals(this.__wbg_ptr);
60
+ return ret;
61
+ }
62
+ /**
63
+ * Load a JS library by executing its source code.
64
+ * @param {string} source
65
+ * @returns {CellResult}
66
+ */
67
+ load_library(source) {
68
+ if (this.__wbg_ptr == 0) throw new Error("Attempt to use a moved value");
69
+ _assertNum(this.__wbg_ptr);
70
+ const ptr0 = passStringToWasm0(
71
+ source,
72
+ wasm.__wbindgen_malloc,
73
+ wasm.__wbindgen_realloc,
74
+ );
75
+ const len0 = WASM_VECTOR_LEN;
76
+ const ret = wasm.extensionsession_load_library(this.__wbg_ptr, ptr0, len0);
77
+ return ret;
78
+ }
79
+ /**
80
+ * Create a new extension session.
81
+ */
82
+ constructor() {
83
+ const ret = wasm.extensionsession_new();
84
+ this.__wbg_ptr = ret;
85
+ ExtensionSessionFinalization.register(this, this.__wbg_ptr, this);
86
+ return this;
87
+ }
88
+ /**
89
+ * Reset the session, clearing all JS state.
90
+ */
91
+ reset() {
92
+ if (this.__wbg_ptr == 0) throw new Error("Attempt to use a moved value");
93
+ _assertNum(this.__wbg_ptr);
94
+ wasm.extensionsession_reset(this.__wbg_ptr);
95
+ }
96
+ /**
97
+ * Run a cell, automatically resolving all async calls by relaying
98
+ * them to the main-thread runner via `__extension_js_relay`.
99
+ * @param {string} code
100
+ * @param {string} stdin
101
+ * @returns {Promise<CellResult>}
102
+ */
103
+ runCellAsync(code, stdin) {
104
+ if (this.__wbg_ptr == 0) throw new Error("Attempt to use a moved value");
105
+ _assertNum(this.__wbg_ptr);
106
+ const ptr0 = passStringToWasm0(
107
+ code,
108
+ wasm.__wbindgen_malloc,
109
+ wasm.__wbindgen_realloc,
110
+ );
111
+ const len0 = WASM_VECTOR_LEN;
112
+ const ptr1 = passStringToWasm0(
113
+ stdin,
114
+ wasm.__wbindgen_malloc,
115
+ wasm.__wbindgen_realloc,
116
+ );
117
+ const len1 = WASM_VECTOR_LEN;
118
+ const ret = wasm.extensionsession_runCellAsync(
119
+ this.__wbg_ptr,
120
+ ptr0,
121
+ len0,
122
+ ptr1,
123
+ len1,
124
+ );
125
+ return ret;
126
+ }
127
+ /**
128
+ * Set the fuel limit for execution.
129
+ * @param {number} limit
130
+ */
131
+ set_fuel_limit(limit) {
132
+ if (this.__wbg_ptr == 0) throw new Error("Attempt to use a moved value");
133
+ _assertNum(this.__wbg_ptr);
134
+ _assertNum(limit);
135
+ wasm.extensionsession_set_fuel_limit(this.__wbg_ptr, limit);
136
+ }
137
+ /**
138
+ * Clean up the session and release resources.
139
+ */
140
+ stopWith() {
141
+ if (this.__wbg_ptr == 0) throw new Error("Attempt to use a moved value");
142
+ _assertNum(this.__wbg_ptr);
143
+ wasm.extensionsession_stopWith(this.__wbg_ptr);
144
+ }
145
+ }
146
+ if (Symbol.dispose)
147
+ ExtensionSession.prototype[Symbol.dispose] = ExtensionSession.prototype.free;
148
+
149
+ /**
150
+ * @param {CollectOptions} options
151
+ * @returns {TreeSnapshot}
152
+ */
153
+ export function collect_document(options) {
154
+ const ret = wasm.collect_document(options);
155
+ return ret;
156
+ }
157
+
158
+ /**
159
+ * @param {Element} root
160
+ * @param {CollectOptions} options
161
+ * @returns {TreeSnapshot}
162
+ */
163
+ export function collect_element(root, options) {
164
+ const ret = wasm.collect_element(root, options);
165
+ return ret;
166
+ }
167
+
168
+ /**
169
+ * @param {TreeSnapshot} snapshot
170
+ * @param {SnapshotFormat | null} [format]
171
+ * @returns {string}
172
+ */
173
+ export function format_snapshot_js(snapshot, format) {
174
+ let deferred1_0;
175
+ let deferred1_1;
176
+ try {
177
+ const ret = wasm.format_snapshot_js(
178
+ snapshot,
179
+ isLikeNone(format) ? 0 : addToExternrefTable0(format),
180
+ );
181
+ deferred1_0 = ret[0];
182
+ deferred1_1 = ret[1];
183
+ return getStringFromWasm0(ret[0], ret[1]);
184
+ } finally {
185
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
186
+ }
187
+ }
188
+
189
+ /**
190
+ * @param {string} format
191
+ * @returns {string}
192
+ */
193
+ export function generateApiDocs(format) {
194
+ let deferred2_0;
195
+ let deferred2_1;
196
+ try {
197
+ const ptr0 = passStringToWasm0(
198
+ format,
199
+ wasm.__wbindgen_malloc,
200
+ wasm.__wbindgen_realloc,
201
+ );
202
+ const len0 = WASM_VECTOR_LEN;
203
+ const ret = wasm.generateApiDocs(ptr0, len0);
204
+ deferred2_0 = ret[0];
205
+ deferred2_1 = ret[1];
206
+ return getStringFromWasm0(ret[0], ret[1]);
207
+ } finally {
208
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
209
+ }
210
+ }
211
+
212
+ /**
213
+ * 0=debug, 1=info, 2=warn, 3=error, 4=none
214
+ * @param {number} level
215
+ */
216
+ export function setLogLevel(level) {
217
+ _assertNum(level);
218
+ wasm.setLogLevel(level);
219
+ }
220
+
221
+ //#endregion
222
+
223
+ //#region wasm imports
224
+ function __wbg_get_imports() {
225
+ const import0 = {
226
+ __proto__: null,
227
+ __wbg_URL_770be900109120c5: function () {
228
+ return handleError(function (arg0, arg1) {
229
+ const ret = arg1.URL;
230
+ const ptr1 = passStringToWasm0(
231
+ ret,
232
+ wasm.__wbindgen_malloc,
233
+ wasm.__wbindgen_realloc,
234
+ );
235
+ const len1 = WASM_VECTOR_LEN;
236
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
237
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
238
+ }, arguments);
239
+ },
240
+ __wbg___extension_js_relay_4838b4e1bcf11b70: function () {
241
+ return logError(function (arg0) {
242
+ const ret = __extension_js_relay(arg0);
243
+ return ret;
244
+ }, arguments);
245
+ },
246
+ __wbg___wbindgen_debug_string_0accd80f45e5faa2: function (arg0, arg1) {
247
+ const ret = debugString(arg1);
248
+ const ptr1 = passStringToWasm0(
249
+ ret,
250
+ wasm.__wbindgen_malloc,
251
+ wasm.__wbindgen_realloc,
252
+ );
253
+ const len1 = WASM_VECTOR_LEN;
254
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
255
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
256
+ },
257
+ __wbg___wbindgen_is_function_754e9f305ff6029e: function (arg0) {
258
+ const ret = typeof arg0 === "function";
259
+ _assertBoolean(ret);
260
+ return ret;
261
+ },
262
+ __wbg___wbindgen_is_undefined_67b456be8673d3d7: function (arg0) {
263
+ const ret = arg0 === undefined;
264
+ _assertBoolean(ret);
265
+ return ret;
266
+ },
267
+ __wbg___wbindgen_number_get_9bb1761122181af2: function (arg0, arg1) {
268
+ const obj = arg1;
269
+ const ret = typeof obj === "number" ? obj : undefined;
270
+ if (!isLikeNone(ret)) {
271
+ _assertNum(ret);
272
+ }
273
+ getDataViewMemory0().setFloat64(
274
+ arg0 + 8 * 1,
275
+ isLikeNone(ret) ? 0 : ret,
276
+ true,
277
+ );
278
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
279
+ },
280
+ __wbg___wbindgen_string_get_72bdf95d3ae505b1: function (arg0, arg1) {
281
+ const obj = arg1;
282
+ const ret = typeof obj === "string" ? obj : undefined;
283
+ var ptr1 = isLikeNone(ret)
284
+ ? 0
285
+ : passStringToWasm0(
286
+ ret,
287
+ wasm.__wbindgen_malloc,
288
+ wasm.__wbindgen_realloc,
289
+ );
290
+ var len1 = WASM_VECTOR_LEN;
291
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
292
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
293
+ },
294
+ __wbg___wbindgen_throw_1506f2235d1bdba0: function (arg0, arg1) {
295
+ throw new Error(getStringFromWasm0(arg0, arg1));
296
+ },
297
+ __wbg__wbg_cb_unref_61db23ac97f16c31: function () {
298
+ return logError(function (arg0) {
299
+ arg0._wbg_cb_unref();
300
+ }, arguments);
301
+ },
302
+ __wbg_body_7d5b1a2ac7f2c821: function () {
303
+ return logError(function (arg0) {
304
+ const ret = arg0.body;
305
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
306
+ }, arguments);
307
+ },
308
+ __wbg_call_9c758de292015997: function () {
309
+ return handleError(function (arg0, arg1, arg2) {
310
+ const ret = arg0.call(arg1, arg2);
311
+ return ret;
312
+ }, arguments);
313
+ },
314
+ __wbg_checked_08fc50bf12676638: function () {
315
+ return logError(function (arg0) {
316
+ const ret = arg0.checked;
317
+ _assertBoolean(ret);
318
+ return ret;
319
+ }, arguments);
320
+ },
321
+ __wbg_children_9ae5baa88ab73d20: function () {
322
+ return logError(function (arg0) {
323
+ const ret = arg0.children;
324
+ return ret;
325
+ }, arguments);
326
+ },
327
+ __wbg_disabled_1ba557c599ff8239: function () {
328
+ return logError(function (arg0) {
329
+ const ret = arg0.disabled;
330
+ _assertBoolean(ret);
331
+ return ret;
332
+ }, arguments);
333
+ },
334
+ __wbg_disabled_5f5a2fdd97589f72: function () {
335
+ return logError(function (arg0) {
336
+ const ret = arg0.disabled;
337
+ _assertBoolean(ret);
338
+ return ret;
339
+ }, arguments);
340
+ },
341
+ __wbg_disabled_a87e032112d0b1cb: function () {
342
+ return logError(function (arg0) {
343
+ const ret = arg0.disabled;
344
+ _assertBoolean(ret);
345
+ return ret;
346
+ }, arguments);
347
+ },
348
+ __wbg_disabled_c5c0ca44b7eab049: function () {
349
+ return logError(function (arg0) {
350
+ const ret = arg0.disabled;
351
+ _assertBoolean(ret);
352
+ return ret;
353
+ }, arguments);
354
+ },
355
+ __wbg_document_aceb08cd6489baf5: function () {
356
+ return logError(function (arg0) {
357
+ const ret = arg0.document;
358
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
359
+ }, arguments);
360
+ },
361
+ __wbg_error_7a86b9285ff1f3b7: function () {
362
+ return logError(function (arg0, arg1) {
363
+ console.error(getStringFromWasm0(arg0, arg1));
364
+ }, arguments);
365
+ },
366
+ __wbg_getAttribute_27f7a0d74339fd41: function () {
367
+ return logError(function (arg0, arg1, arg2, arg3) {
368
+ const ret = arg1.getAttribute(getStringFromWasm0(arg2, arg3));
369
+ var ptr1 = isLikeNone(ret)
370
+ ? 0
371
+ : passStringToWasm0(
372
+ ret,
373
+ wasm.__wbindgen_malloc,
374
+ wasm.__wbindgen_realloc,
375
+ );
376
+ var len1 = WASM_VECTOR_LEN;
377
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
378
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
379
+ }, arguments);
380
+ },
381
+ __wbg_getBoundingClientRect_93c2750834277567: function () {
382
+ return logError(function (arg0) {
383
+ const ret = arg0.getBoundingClientRect();
384
+ return ret;
385
+ }, arguments);
386
+ },
387
+ __wbg_getComputedStyle_c59f58a15bc6a800: function () {
388
+ return handleError(function (arg0, arg1) {
389
+ const ret = arg0.getComputedStyle(arg1);
390
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
391
+ }, arguments);
392
+ },
393
+ __wbg_getElementById_c35b4b7d270d161d: function () {
394
+ return logError(function (arg0, arg1, arg2) {
395
+ const ret = arg0.getElementById(getStringFromWasm0(arg1, arg2));
396
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
397
+ }, arguments);
398
+ },
399
+ __wbg_getPropertyValue_dbbb77f232017e4d: function () {
400
+ return handleError(function (arg0, arg1, arg2, arg3) {
401
+ const ret = arg1.getPropertyValue(getStringFromWasm0(arg2, arg3));
402
+ const ptr1 = passStringToWasm0(
403
+ ret,
404
+ wasm.__wbindgen_malloc,
405
+ wasm.__wbindgen_realloc,
406
+ );
407
+ const len1 = WASM_VECTOR_LEN;
408
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
409
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
410
+ }, arguments);
411
+ },
412
+ __wbg_hasAttribute_8a0e80dea64a024f: function () {
413
+ return logError(function (arg0, arg1, arg2) {
414
+ const ret = arg0.hasAttribute(getStringFromWasm0(arg1, arg2));
415
+ _assertBoolean(ret);
416
+ return ret;
417
+ }, arguments);
418
+ },
419
+ __wbg_height_8e3b6ac1a60655fb: function () {
420
+ return logError(function (arg0) {
421
+ const ret = arg0.height;
422
+ return ret;
423
+ }, arguments);
424
+ },
425
+ __wbg_inert_0bd91a1cdd1e743d: function () {
426
+ return logError(function (arg0) {
427
+ const ret = arg0.inert;
428
+ _assertBoolean(ret);
429
+ return ret;
430
+ }, arguments);
431
+ },
432
+ __wbg_innerHeight_8b6ee2571dbedb9d: function () {
433
+ return handleError(function (arg0) {
434
+ const ret = arg0.innerHeight;
435
+ return ret;
436
+ }, arguments);
437
+ },
438
+ __wbg_innerWidth_7475bec19f48fe43: function () {
439
+ return handleError(function (arg0) {
440
+ const ret = arg0.innerWidth;
441
+ return ret;
442
+ }, arguments);
443
+ },
444
+ __wbg_instanceof_Element_73566cb5986eac3a: function () {
445
+ return logError(function (arg0) {
446
+ let result;
447
+ try {
448
+ result = arg0 instanceof Element;
449
+ } catch (_) {
450
+ result = false;
451
+ }
452
+ const ret = result;
453
+ _assertBoolean(ret);
454
+ return ret;
455
+ }, arguments);
456
+ },
457
+ __wbg_instanceof_HtmlButtonElement_50af3d9222be97df: function () {
458
+ return logError(function (arg0) {
459
+ let result;
460
+ try {
461
+ result = arg0 instanceof HTMLButtonElement;
462
+ } catch (_) {
463
+ result = false;
464
+ }
465
+ const ret = result;
466
+ _assertBoolean(ret);
467
+ return ret;
468
+ }, arguments);
469
+ },
470
+ __wbg_instanceof_HtmlCollection_c16160759bef4bb4: function () {
471
+ return logError(function (arg0) {
472
+ let result;
473
+ try {
474
+ result = arg0 instanceof HTMLCollection;
475
+ } catch (_) {
476
+ result = false;
477
+ }
478
+ const ret = result;
479
+ _assertBoolean(ret);
480
+ return ret;
481
+ }, arguments);
482
+ },
483
+ __wbg_instanceof_HtmlElement_9d326f7a42217802: function () {
484
+ return logError(function (arg0) {
485
+ let result;
486
+ try {
487
+ result = arg0 instanceof HTMLElement;
488
+ } catch (_) {
489
+ result = false;
490
+ }
491
+ const ret = result;
492
+ _assertBoolean(ret);
493
+ return ret;
494
+ }, arguments);
495
+ },
496
+ __wbg_instanceof_HtmlInputElement_684a7e5d7dbec24c: function () {
497
+ return logError(function (arg0) {
498
+ let result;
499
+ try {
500
+ result = arg0 instanceof HTMLInputElement;
501
+ } catch (_) {
502
+ result = false;
503
+ }
504
+ const ret = result;
505
+ _assertBoolean(ret);
506
+ return ret;
507
+ }, arguments);
508
+ },
509
+ __wbg_instanceof_HtmlSelectElement_9678e03521a565e0: function () {
510
+ return logError(function (arg0) {
511
+ let result;
512
+ try {
513
+ result = arg0 instanceof HTMLSelectElement;
514
+ } catch (_) {
515
+ result = false;
516
+ }
517
+ const ret = result;
518
+ _assertBoolean(ret);
519
+ return ret;
520
+ }, arguments);
521
+ },
522
+ __wbg_instanceof_HtmlTextAreaElement_ddb0b111033391f4: function () {
523
+ return logError(function (arg0) {
524
+ let result;
525
+ try {
526
+ result = arg0 instanceof HTMLTextAreaElement;
527
+ } catch (_) {
528
+ result = false;
529
+ }
530
+ const ret = result;
531
+ _assertBoolean(ret);
532
+ return ret;
533
+ }, arguments);
534
+ },
535
+ __wbg_instanceof_Window_e093be59ee9a8e14: function () {
536
+ return logError(function (arg0) {
537
+ let result;
538
+ try {
539
+ result = arg0 instanceof Window;
540
+ } catch (_) {
541
+ result = false;
542
+ }
543
+ const ret = result;
544
+ _assertBoolean(ret);
545
+ return ret;
546
+ }, arguments);
547
+ },
548
+ __wbg_is_4801976d24bcae5b: function () {
549
+ return logError(function (arg0, arg1) {
550
+ const ret = Object.is(arg0, arg1);
551
+ _assertBoolean(ret);
552
+ return ret;
553
+ }, arguments);
554
+ },
555
+ __wbg_item_d4f14947933118b1: function () {
556
+ return logError(function (arg0, arg1) {
557
+ const ret = arg0.item(arg1 >>> 0);
558
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
559
+ }, arguments);
560
+ },
561
+ __wbg_length_9cc89ffd1c1c86d1: function () {
562
+ return logError(function (arg0) {
563
+ const ret = arg0.length;
564
+ _assertNum(ret);
565
+ return ret;
566
+ }, arguments);
567
+ },
568
+ __wbg_log_4216cc9a0cabcdb5: function () {
569
+ return logError(function (arg0, arg1) {
570
+ console.log(getStringFromWasm0(arg0, arg1));
571
+ }, arguments);
572
+ },
573
+ __wbg_log_cf2e968649f3384e: function () {
574
+ return logError(function (arg0) {
575
+ console.log(arg0);
576
+ }, arguments);
577
+ },
578
+ __wbg_new_typed_bf31d18f92484486: function () {
579
+ return logError(function (arg0, arg1) {
580
+ try {
581
+ var state0 = { a: arg0, b: arg1 };
582
+ var cb0 = (arg0, arg1) => {
583
+ const a = state0.a;
584
+ state0.a = 0;
585
+ try {
586
+ return wasm_bindgen__convert__closures_____invoke__hf458ead16698aa30(
587
+ a,
588
+ state0.b,
589
+ arg0,
590
+ arg1,
591
+ );
592
+ } finally {
593
+ state0.a = a;
594
+ }
595
+ };
596
+ const ret = new Promise(cb0);
597
+ return ret;
598
+ } finally {
599
+ state0.a = 0;
600
+ }
601
+ }, arguments);
602
+ },
603
+ __wbg_parentNode_6ee3190f9ba96b9b: function () {
604
+ return logError(function (arg0) {
605
+ const ret = arg0.parentNode;
606
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
607
+ }, arguments);
608
+ },
609
+ __wbg_parse_03863847d06c4e89: function () {
610
+ return handleError(function (arg0, arg1) {
611
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
612
+ return ret;
613
+ }, arguments);
614
+ },
615
+ __wbg_querySelector_6f6509bf1f8f4753: function () {
616
+ return handleError(function (arg0, arg1, arg2) {
617
+ const ret = arg0.querySelector(getStringFromWasm0(arg1, arg2));
618
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
619
+ }, arguments);
620
+ },
621
+ __wbg_queueMicrotask_35c611f4a14830b2: function () {
622
+ return logError(function (arg0) {
623
+ queueMicrotask(arg0);
624
+ }, arguments);
625
+ },
626
+ __wbg_queueMicrotask_404ed0a58e0b63cc: function () {
627
+ return logError(function (arg0) {
628
+ const ret = arg0.queueMicrotask;
629
+ return ret;
630
+ }, arguments);
631
+ },
632
+ __wbg_readOnly_13f0673887c3c745: function () {
633
+ return logError(function (arg0) {
634
+ const ret = arg0.readOnly;
635
+ _assertBoolean(ret);
636
+ return ret;
637
+ }, arguments);
638
+ },
639
+ __wbg_readOnly_44fbbbcbaa1d1a39: function () {
640
+ return logError(function (arg0) {
641
+ const ret = arg0.readOnly;
642
+ _assertBoolean(ret);
643
+ return ret;
644
+ }, arguments);
645
+ },
646
+ __wbg_required_02bbd48afeda04dc: function () {
647
+ return logError(function (arg0) {
648
+ const ret = arg0.required;
649
+ _assertBoolean(ret);
650
+ return ret;
651
+ }, arguments);
652
+ },
653
+ __wbg_required_a36726a26c3b38d4: function () {
654
+ return logError(function (arg0) {
655
+ const ret = arg0.required;
656
+ _assertBoolean(ret);
657
+ return ret;
658
+ }, arguments);
659
+ },
660
+ __wbg_required_c0738fcb4fab320c: function () {
661
+ return logError(function (arg0) {
662
+ const ret = arg0.required;
663
+ _assertBoolean(ret);
664
+ return ret;
665
+ }, arguments);
666
+ },
667
+ __wbg_resolve_25a7e548d5881dca: function () {
668
+ return logError(function (arg0) {
669
+ const ret = Promise.resolve(arg0);
670
+ return ret;
671
+ }, arguments);
672
+ },
673
+ __wbg_run_322bf7e1760605e9: function () {
674
+ return logError(function (arg0, arg1, arg2) {
675
+ try {
676
+ var state0 = { a: arg1, b: arg2 };
677
+ var cb0 = () => {
678
+ const a = state0.a;
679
+ state0.a = 0;
680
+ try {
681
+ return wasm_bindgen__convert__closures_____invoke__hd488ef5680429ef6(
682
+ a,
683
+ state0.b,
684
+ );
685
+ } finally {
686
+ state0.a = a;
687
+ }
688
+ };
689
+ const ret = arg0.run(cb0);
690
+ _assertBoolean(ret);
691
+ return ret;
692
+ } finally {
693
+ state0.a = 0;
694
+ }
695
+ }, arguments);
696
+ },
697
+ __wbg_scrollX_9c3fa310cb5ed346: function () {
698
+ return handleError(function (arg0) {
699
+ const ret = arg0.scrollX;
700
+ return ret;
701
+ }, arguments);
702
+ },
703
+ __wbg_scrollY_5502bd75aa44fd39: function () {
704
+ return handleError(function (arg0) {
705
+ const ret = arg0.scrollY;
706
+ return ret;
707
+ }, arguments);
708
+ },
709
+ __wbg_setAttribute_5b695d1c3be2e3e6: function () {
710
+ return handleError(function (arg0, arg1, arg2, arg3, arg4) {
711
+ arg0.setAttribute(
712
+ getStringFromWasm0(arg1, arg2),
713
+ getStringFromWasm0(arg3, arg4),
714
+ );
715
+ }, arguments);
716
+ },
717
+ __wbg_static_accessor_CREATE_TASK_b6a4b7f987c70792: function () {
718
+ return logError(function () {
719
+ const ret = typeof console === "undefined" ? null : console?.createTask;
720
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
721
+ }, arguments);
722
+ },
723
+ __wbg_static_accessor_GLOBAL_9d53f2689e622ca1: function () {
724
+ return logError(function () {
725
+ const ret = typeof global === "undefined" ? null : global;
726
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
727
+ }, arguments);
728
+ },
729
+ __wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a: function () {
730
+ return logError(function () {
731
+ const ret = typeof globalThis === "undefined" ? null : globalThis;
732
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
733
+ }, arguments);
734
+ },
735
+ __wbg_static_accessor_SELF_4c59f6c7ea29a144: function () {
736
+ return logError(function () {
737
+ const ret = typeof self === "undefined" ? null : self;
738
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
739
+ }, arguments);
740
+ },
741
+ __wbg_static_accessor_WINDOW_e70ae9f2eb052253: function () {
742
+ return logError(function () {
743
+ const ret = typeof window === "undefined" ? null : window;
744
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
745
+ }, arguments);
746
+ },
747
+ __wbg_stringify_8286df6dcc591521: function () {
748
+ return handleError(function (arg0) {
749
+ const ret = JSON.stringify(arg0);
750
+ return ret;
751
+ }, arguments);
752
+ },
753
+ __wbg_tabIndex_e7c1633f01c9cd5a: function () {
754
+ return logError(function (arg0) {
755
+ const ret = arg0.tabIndex;
756
+ _assertNum(ret);
757
+ return ret;
758
+ }, arguments);
759
+ },
760
+ __wbg_tagName_45bb7a95d4c5377b: function () {
761
+ return logError(function (arg0, arg1) {
762
+ const ret = arg1.tagName;
763
+ const ptr1 = passStringToWasm0(
764
+ ret,
765
+ wasm.__wbindgen_malloc,
766
+ wasm.__wbindgen_realloc,
767
+ );
768
+ const len1 = WASM_VECTOR_LEN;
769
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
770
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
771
+ }, arguments);
772
+ },
773
+ __wbg_textContent_666b896f07901078: function () {
774
+ return logError(function (arg0, arg1) {
775
+ const ret = arg1.textContent;
776
+ var ptr1 = isLikeNone(ret)
777
+ ? 0
778
+ : passStringToWasm0(
779
+ ret,
780
+ wasm.__wbindgen_malloc,
781
+ wasm.__wbindgen_realloc,
782
+ );
783
+ var len1 = WASM_VECTOR_LEN;
784
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
785
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
786
+ }, arguments);
787
+ },
788
+ __wbg_then_18f476d590e58992: function () {
789
+ return logError(function (arg0, arg1, arg2) {
790
+ const ret = arg0.then(arg1, arg2);
791
+ return ret;
792
+ }, arguments);
793
+ },
794
+ __wbg_then_ac7b025999b52837: function () {
795
+ return logError(function (arg0, arg1) {
796
+ const ret = arg0.then(arg1);
797
+ return ret;
798
+ }, arguments);
799
+ },
800
+ __wbg_title_42afd6249a172b6d: function () {
801
+ return logError(function (arg0, arg1) {
802
+ const ret = arg1.title;
803
+ const ptr1 = passStringToWasm0(
804
+ ret,
805
+ wasm.__wbindgen_malloc,
806
+ wasm.__wbindgen_realloc,
807
+ );
808
+ const len1 = WASM_VECTOR_LEN;
809
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
810
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
811
+ }, arguments);
812
+ },
813
+ __wbg_value_32493aa1c785ef7c: function () {
814
+ return logError(function (arg0, arg1) {
815
+ const ret = arg1.value;
816
+ const ptr1 = passStringToWasm0(
817
+ ret,
818
+ wasm.__wbindgen_malloc,
819
+ wasm.__wbindgen_realloc,
820
+ );
821
+ const len1 = WASM_VECTOR_LEN;
822
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
823
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
824
+ }, arguments);
825
+ },
826
+ __wbg_value_6177c7953f900695: function () {
827
+ return logError(function (arg0, arg1) {
828
+ const ret = arg1.value;
829
+ const ptr1 = passStringToWasm0(
830
+ ret,
831
+ wasm.__wbindgen_malloc,
832
+ wasm.__wbindgen_realloc,
833
+ );
834
+ const len1 = WASM_VECTOR_LEN;
835
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
836
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
837
+ }, arguments);
838
+ },
839
+ __wbg_value_ed244ce0aafd9d66: function () {
840
+ return logError(function (arg0, arg1) {
841
+ const ret = arg1.value;
842
+ const ptr1 = passStringToWasm0(
843
+ ret,
844
+ wasm.__wbindgen_malloc,
845
+ wasm.__wbindgen_realloc,
846
+ );
847
+ const len1 = WASM_VECTOR_LEN;
848
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
849
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
850
+ }, arguments);
851
+ },
852
+ __wbg_width_1e0b74fef17bc28b: function () {
853
+ return logError(function (arg0) {
854
+ const ret = arg0.width;
855
+ return ret;
856
+ }, arguments);
857
+ },
858
+ __wbg_x_e64ab23f42714230: function () {
859
+ return logError(function (arg0) {
860
+ const ret = arg0.x;
861
+ return ret;
862
+ }, arguments);
863
+ },
864
+ __wbg_y_c4a34029ac91ece3: function () {
865
+ return logError(function (arg0) {
866
+ const ret = arg0.y;
867
+ return ret;
868
+ }, arguments);
869
+ },
870
+ __wbindgen_cast_0000000000000001: function () {
871
+ return logError(function (arg0, arg1) {
872
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 682, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
873
+ const ret = makeMutClosure(
874
+ arg0,
875
+ arg1,
876
+ wasm_bindgen__convert__closures_____invoke__hbaf3bd60d2f803db,
877
+ );
878
+ return ret;
879
+ }, arguments);
880
+ },
881
+ __wbindgen_cast_0000000000000002: function () {
882
+ return logError(function (arg0, arg1) {
883
+ // Cast intrinsic for `Ref(String) -> Externref`.
884
+ const ret = getStringFromWasm0(arg0, arg1);
885
+ return ret;
886
+ }, arguments);
887
+ },
888
+ __wbindgen_init_externref_table: function () {
889
+ const table = wasm.__wbindgen_externrefs;
890
+ const offset = table.grow(4);
891
+ table.set(0, undefined);
892
+ table.set(offset + 0, undefined);
893
+ table.set(offset + 1, null);
894
+ table.set(offset + 2, true);
895
+ table.set(offset + 3, false);
896
+ },
897
+ };
898
+ return {
899
+ __proto__: null,
900
+ "./extension_js_bg.js": import0,
901
+ env: import1,
902
+ env: import2,
903
+ env: import3,
904
+ env: import4,
905
+ env: import5,
906
+ env: import6,
907
+ env: import7,
908
+ env: import8,
909
+ env: import9,
910
+ env: import10,
911
+ env: import11,
912
+ env: import12,
913
+ env: import13,
914
+ env: import14,
915
+ env: import15,
916
+ env: import16,
917
+ env: import17,
918
+ env: import18,
919
+ env: import19,
920
+ env: import20,
921
+ env: import21,
922
+ env: import22,
923
+ env: import23,
924
+ env: import24,
925
+ env: import25,
926
+ env: import26,
927
+ env: import27,
928
+ env: import28,
929
+ env: import29,
930
+ env: import30,
931
+ env: import31,
932
+ };
933
+ }
934
+
935
+ //#endregion
936
+ function wasm_bindgen__convert__closures_____invoke__hd488ef5680429ef6(
937
+ arg0,
938
+ arg1,
939
+ ) {
940
+ _assertNum(arg0);
941
+ _assertNum(arg1);
942
+ const ret =
943
+ wasm.wasm_bindgen__convert__closures_____invoke__hd488ef5680429ef6(
944
+ arg0,
945
+ arg1,
946
+ );
947
+ return ret !== 0;
948
+ }
949
+
950
+ function wasm_bindgen__convert__closures_____invoke__hbaf3bd60d2f803db(
951
+ arg0,
952
+ arg1,
953
+ arg2,
954
+ ) {
955
+ _assertNum(arg0);
956
+ _assertNum(arg1);
957
+ const ret =
958
+ wasm.wasm_bindgen__convert__closures_____invoke__hbaf3bd60d2f803db(
959
+ arg0,
960
+ arg1,
961
+ arg2,
962
+ );
963
+ if (ret[1]) {
964
+ throw takeFromExternrefTable0(ret[0]);
965
+ }
966
+ }
967
+
968
+ function wasm_bindgen__convert__closures_____invoke__hf458ead16698aa30(
969
+ arg0,
970
+ arg1,
971
+ arg2,
972
+ arg3,
973
+ ) {
974
+ _assertNum(arg0);
975
+ _assertNum(arg1);
976
+ wasm.wasm_bindgen__convert__closures_____invoke__hf458ead16698aa30(
977
+ arg0,
978
+ arg1,
979
+ arg2,
980
+ arg3,
981
+ );
982
+ }
983
+
984
+ const ExtensionSessionFinalization =
985
+ typeof FinalizationRegistry === "undefined"
986
+ ? { register: () => {}, unregister: () => {} }
987
+ : new FinalizationRegistry((ptr) =>
988
+ wasm.__wbg_extensionsession_free(ptr, 1),
989
+ );
990
+
991
+ //#region intrinsics
992
+ function addToExternrefTable0(obj) {
993
+ const idx = wasm.__externref_table_alloc();
994
+ wasm.__wbindgen_externrefs.set(idx, obj);
995
+ return idx;
996
+ }
997
+
998
+ function _assertBoolean(n) {
999
+ if (typeof n !== "boolean") {
1000
+ throw new Error(`expected a boolean argument, found ${typeof n}`);
1001
+ }
1002
+ }
1003
+
1004
+ function _assertNum(n) {
1005
+ if (typeof n !== "number")
1006
+ throw new Error(`expected a number argument, found ${typeof n}`);
1007
+ }
1008
+
1009
+ const CLOSURE_DTORS =
1010
+ typeof FinalizationRegistry === "undefined"
1011
+ ? { register: () => {}, unregister: () => {} }
1012
+ : new FinalizationRegistry((state) =>
1013
+ wasm.__wbindgen_destroy_closure(state.a, state.b),
1014
+ );
1015
+
1016
+ function debugString(val) {
1017
+ // primitive types
1018
+ const type = typeof val;
1019
+ if (type == "number" || type == "boolean" || val == null) {
1020
+ return `${val}`;
1021
+ }
1022
+ if (type == "string") {
1023
+ return `"${val}"`;
1024
+ }
1025
+ if (type == "symbol") {
1026
+ const description = val.description;
1027
+ if (description == null) {
1028
+ return "Symbol";
1029
+ } else {
1030
+ return `Symbol(${description})`;
1031
+ }
1032
+ }
1033
+ if (type == "function") {
1034
+ const name = val.name;
1035
+ if (typeof name == "string" && name.length > 0) {
1036
+ return `Function(${name})`;
1037
+ } else {
1038
+ return "Function";
1039
+ }
1040
+ }
1041
+ // objects
1042
+ if (Array.isArray(val)) {
1043
+ const length = val.length;
1044
+ let debug = "[";
1045
+ if (length > 0) {
1046
+ debug += debugString(val[0]);
1047
+ }
1048
+ for (let i = 1; i < length; i++) {
1049
+ debug += ", " + debugString(val[i]);
1050
+ }
1051
+ debug += "]";
1052
+ return debug;
1053
+ }
1054
+ // Test for built-in
1055
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1056
+ let className;
1057
+ if (builtInMatches && builtInMatches.length > 1) {
1058
+ className = builtInMatches[1];
1059
+ } else {
1060
+ // Failed to match the standard '[object ClassName]'
1061
+ return toString.call(val);
1062
+ }
1063
+ if (className == "Object") {
1064
+ // we're a user defined class or Object
1065
+ // JSON.stringify avoids problems with cycles, and is generally much
1066
+ // easier than looping through ownProperties of `val`.
1067
+ try {
1068
+ return "Object(" + JSON.stringify(val) + ")";
1069
+ } catch (_) {
1070
+ return "Object";
1071
+ }
1072
+ }
1073
+ // errors
1074
+ if (val instanceof Error) {
1075
+ return `${val.name}: ${val.message}\n${val.stack}`;
1076
+ }
1077
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1078
+ return className;
1079
+ }
1080
+
1081
+ let cachedDataViewMemory0 = null;
1082
+ function getDataViewMemory0() {
1083
+ if (
1084
+ cachedDataViewMemory0 === null ||
1085
+ cachedDataViewMemory0.buffer.detached === true ||
1086
+ (cachedDataViewMemory0.buffer.detached === undefined &&
1087
+ cachedDataViewMemory0.buffer !== wasm.memory.buffer)
1088
+ ) {
1089
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1090
+ }
1091
+ return cachedDataViewMemory0;
1092
+ }
1093
+
1094
+ function getStringFromWasm0(ptr, len) {
1095
+ return decodeText(ptr >>> 0, len);
1096
+ }
1097
+
1098
+ let cachedUint8ArrayMemory0 = null;
1099
+ function getUint8ArrayMemory0() {
1100
+ if (
1101
+ cachedUint8ArrayMemory0 === null ||
1102
+ cachedUint8ArrayMemory0.byteLength === 0
1103
+ ) {
1104
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1105
+ }
1106
+ return cachedUint8ArrayMemory0;
1107
+ }
1108
+
1109
+ function handleError(f, args) {
1110
+ try {
1111
+ return f.apply(this, args);
1112
+ } catch (e) {
1113
+ const idx = addToExternrefTable0(e);
1114
+ wasm.__wbindgen_exn_store(idx);
1115
+ }
1116
+ }
1117
+
1118
+ function isLikeNone(x) {
1119
+ return x === undefined || x === null;
1120
+ }
1121
+
1122
+ function logError(f, args) {
1123
+ try {
1124
+ return f.apply(this, args);
1125
+ } catch (e) {
1126
+ let error = (function () {
1127
+ try {
1128
+ return e instanceof Error
1129
+ ? `${e.message}\n\nStack:\n${e.stack}`
1130
+ : e.toString();
1131
+ } catch (_) {
1132
+ return "<failed to stringify thrown value>";
1133
+ }
1134
+ })();
1135
+ console.error(
1136
+ "wasm-bindgen: imported JS function that was not marked as `catch` threw an error:",
1137
+ error,
1138
+ );
1139
+ throw e;
1140
+ }
1141
+ }
1142
+
1143
+ function makeMutClosure(arg0, arg1, f) {
1144
+ const state = { a: arg0, b: arg1, cnt: 1 };
1145
+ const real = (...args) => {
1146
+ // First up with a closure we increment the internal reference
1147
+ // count. This ensures that the Rust closure environment won't
1148
+ // be deallocated while we're invoking it.
1149
+ state.cnt++;
1150
+ const a = state.a;
1151
+ state.a = 0;
1152
+ try {
1153
+ return f(a, state.b, ...args);
1154
+ } finally {
1155
+ state.a = a;
1156
+ real._wbg_cb_unref();
1157
+ }
1158
+ };
1159
+ real._wbg_cb_unref = () => {
1160
+ if (--state.cnt === 0) {
1161
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
1162
+ state.a = 0;
1163
+ CLOSURE_DTORS.unregister(state);
1164
+ }
1165
+ };
1166
+ CLOSURE_DTORS.register(real, state, state);
1167
+ return real;
1168
+ }
1169
+
1170
+ function passStringToWasm0(arg, malloc, realloc) {
1171
+ if (typeof arg !== "string")
1172
+ throw new Error(`expected a string argument, found ${typeof arg}`);
1173
+ if (realloc === undefined) {
1174
+ const buf = cachedTextEncoder.encode(arg);
1175
+ const ptr = malloc(buf.length, 1) >>> 0;
1176
+ getUint8ArrayMemory0()
1177
+ .subarray(ptr, ptr + buf.length)
1178
+ .set(buf);
1179
+ WASM_VECTOR_LEN = buf.length;
1180
+ return ptr;
1181
+ }
1182
+
1183
+ let len = arg.length;
1184
+ let ptr = malloc(len, 1) >>> 0;
1185
+
1186
+ const mem = getUint8ArrayMemory0();
1187
+
1188
+ let offset = 0;
1189
+
1190
+ for (; offset < len; offset++) {
1191
+ const code = arg.charCodeAt(offset);
1192
+ if (code > 0x7f) break;
1193
+ mem[ptr + offset] = code;
1194
+ }
1195
+ if (offset !== len) {
1196
+ if (offset !== 0) {
1197
+ arg = arg.slice(offset);
1198
+ }
1199
+ ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
1200
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1201
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1202
+ if (ret.read !== arg.length) throw new Error("failed to pass whole string");
1203
+ offset += ret.written;
1204
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1205
+ }
1206
+
1207
+ WASM_VECTOR_LEN = offset;
1208
+ return ptr;
1209
+ }
1210
+
1211
+ function takeFromExternrefTable0(idx) {
1212
+ const value = wasm.__wbindgen_externrefs.get(idx);
1213
+ wasm.__externref_table_dealloc(idx);
1214
+ return value;
1215
+ }
1216
+
1217
+ let cachedTextDecoder = new TextDecoder("utf-8", {
1218
+ ignoreBOM: true,
1219
+ fatal: true,
1220
+ });
1221
+ cachedTextDecoder.decode();
1222
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1223
+ let numBytesDecoded = 0;
1224
+ function decodeText(ptr, len) {
1225
+ numBytesDecoded += len;
1226
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1227
+ cachedTextDecoder = new TextDecoder("utf-8", {
1228
+ ignoreBOM: true,
1229
+ fatal: true,
1230
+ });
1231
+ cachedTextDecoder.decode();
1232
+ numBytesDecoded = len;
1233
+ }
1234
+ return cachedTextDecoder.decode(
1235
+ getUint8ArrayMemory0().subarray(ptr, ptr + len),
1236
+ );
1237
+ }
1238
+
1239
+ const cachedTextEncoder = new TextEncoder();
1240
+
1241
+ if (!("encodeInto" in cachedTextEncoder)) {
1242
+ cachedTextEncoder.encodeInto = function (arg, view) {
1243
+ const buf = cachedTextEncoder.encode(arg);
1244
+ view.set(buf);
1245
+ return {
1246
+ read: arg.length,
1247
+ written: buf.length,
1248
+ };
1249
+ };
1250
+ }
1251
+
1252
+ let WASM_VECTOR_LEN = 0;
1253
+
1254
+ //#endregion
1255
+
1256
+ //#region wasm loading
1257
+ let wasmModule, wasmInstance, wasm;
1258
+ function __wbg_finalize_init(instance, module) {
1259
+ wasmInstance = instance;
1260
+ wasm = instance.exports;
1261
+ wasmModule = module;
1262
+ cachedDataViewMemory0 = null;
1263
+ cachedUint8ArrayMemory0 = null;
1264
+ wasm.__wbindgen_start();
1265
+ return wasm;
1266
+ }
1267
+
1268
+ async function __wbg_load(module, imports) {
1269
+ if (typeof Response === "function" && module instanceof Response) {
1270
+ if (typeof WebAssembly.instantiateStreaming === "function") {
1271
+ try {
1272
+ return await WebAssembly.instantiateStreaming(module, imports);
1273
+ } catch (e) {
1274
+ const validResponse = module.ok && expectedResponseType(module.type);
1275
+
1276
+ if (
1277
+ validResponse &&
1278
+ module.headers.get("Content-Type") !== "application/wasm"
1279
+ ) {
1280
+ console.warn(
1281
+ "`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",
1282
+ e,
1283
+ );
1284
+ } else {
1285
+ throw e;
1286
+ }
1287
+ }
1288
+ }
1289
+
1290
+ const bytes = await module.arrayBuffer();
1291
+ return await WebAssembly.instantiate(bytes, imports);
1292
+ } else {
1293
+ const instance = await WebAssembly.instantiate(module, imports);
1294
+
1295
+ if (instance instanceof WebAssembly.Instance) {
1296
+ return { instance, module };
1297
+ } else {
1298
+ return instance;
1299
+ }
1300
+ }
1301
+
1302
+ function expectedResponseType(type) {
1303
+ switch (type) {
1304
+ case "basic":
1305
+ case "cors":
1306
+ case "default":
1307
+ return true;
1308
+ }
1309
+ return false;
1310
+ }
1311
+ }
1312
+
1313
+ function initSync(module) {
1314
+ if (wasm !== undefined) return wasm;
1315
+
1316
+ if (module !== undefined) {
1317
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1318
+ ({ module } = module);
1319
+ } else {
1320
+ console.warn(
1321
+ "using deprecated parameters for `initSync()`; pass a single object instead",
1322
+ );
1323
+ }
1324
+ }
1325
+
1326
+ const imports = __wbg_get_imports();
1327
+ if (!(module instanceof WebAssembly.Module)) {
1328
+ module = new WebAssembly.Module(module);
1329
+ }
1330
+ const instance = new WebAssembly.Instance(module, imports);
1331
+ return __wbg_finalize_init(instance, module);
1332
+ }
1333
+
1334
+ async function __wbg_init(module_or_path) {
1335
+ if (wasm !== undefined) return wasm;
1336
+
1337
+ if (module_or_path !== undefined) {
1338
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1339
+ ({ module_or_path } = module_or_path);
1340
+ } else {
1341
+ console.warn(
1342
+ "using deprecated parameters for the initialization function; pass a single object instead",
1343
+ );
1344
+ }
1345
+ }
1346
+
1347
+ if (module_or_path === undefined) {
1348
+ module_or_path = new URL("extension_js_bg.wasm", import.meta.url);
1349
+ }
1350
+ const imports = __wbg_get_imports();
1351
+
1352
+ if (
1353
+ typeof module_or_path === "string" ||
1354
+ (typeof Request === "function" && module_or_path instanceof Request) ||
1355
+ (typeof URL === "function" && module_or_path instanceof URL)
1356
+ ) {
1357
+ module_or_path = fetch(module_or_path);
1358
+ }
1359
+
1360
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1361
+
1362
+ return __wbg_finalize_init(instance, module);
1363
+ }
1364
+
1365
+ export { initSync, __wbg_init as default };
1366
+ //#endregion
1367
+ export { wasm as __wasm };