@spikard/wasm 0.2.1

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,843 @@
1
+
2
+ let imports = {};
3
+ imports['__wbindgen_placeholder__'] = module.exports;
4
+
5
+ function addHeapObject(obj) {
6
+ if (heap_next === heap.length) heap.push(heap.length + 1);
7
+ const idx = heap_next;
8
+ heap_next = heap[idx];
9
+
10
+ heap[idx] = obj;
11
+ return idx;
12
+ }
13
+
14
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
15
+ ? { register: () => {}, unregister: () => {} }
16
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
17
+
18
+ function debugString(val) {
19
+ // primitive types
20
+ const type = typeof val;
21
+ if (type == 'number' || type == 'boolean' || val == null) {
22
+ return `${val}`;
23
+ }
24
+ if (type == 'string') {
25
+ return `"${val}"`;
26
+ }
27
+ if (type == 'symbol') {
28
+ const description = val.description;
29
+ if (description == null) {
30
+ return 'Symbol';
31
+ } else {
32
+ return `Symbol(${description})`;
33
+ }
34
+ }
35
+ if (type == 'function') {
36
+ const name = val.name;
37
+ if (typeof name == 'string' && name.length > 0) {
38
+ return `Function(${name})`;
39
+ } else {
40
+ return 'Function';
41
+ }
42
+ }
43
+ // objects
44
+ if (Array.isArray(val)) {
45
+ const length = val.length;
46
+ let debug = '[';
47
+ if (length > 0) {
48
+ debug += debugString(val[0]);
49
+ }
50
+ for(let i = 1; i < length; i++) {
51
+ debug += ', ' + debugString(val[i]);
52
+ }
53
+ debug += ']';
54
+ return debug;
55
+ }
56
+ // Test for built-in
57
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
58
+ let className;
59
+ if (builtInMatches && builtInMatches.length > 1) {
60
+ className = builtInMatches[1];
61
+ } else {
62
+ // Failed to match the standard '[object ClassName]'
63
+ return toString.call(val);
64
+ }
65
+ if (className == 'Object') {
66
+ // we're a user defined class or Object
67
+ // JSON.stringify avoids problems with cycles, and is generally much
68
+ // easier than looping through ownProperties of `val`.
69
+ try {
70
+ return 'Object(' + JSON.stringify(val) + ')';
71
+ } catch (_) {
72
+ return 'Object';
73
+ }
74
+ }
75
+ // errors
76
+ if (val instanceof Error) {
77
+ return `${val.name}: ${val.message}\n${val.stack}`;
78
+ }
79
+ // TODO we could test for more things here, like `Set`s and `Map`s.
80
+ return className;
81
+ }
82
+
83
+ function dropObject(idx) {
84
+ if (idx < 132) return;
85
+ heap[idx] = heap_next;
86
+ heap_next = idx;
87
+ }
88
+
89
+ function getArrayU8FromWasm0(ptr, len) {
90
+ ptr = ptr >>> 0;
91
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
92
+ }
93
+
94
+ let cachedDataViewMemory0 = null;
95
+ function getDataViewMemory0() {
96
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
97
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
98
+ }
99
+ return cachedDataViewMemory0;
100
+ }
101
+
102
+ function getStringFromWasm0(ptr, len) {
103
+ ptr = ptr >>> 0;
104
+ return decodeText(ptr, len);
105
+ }
106
+
107
+ let cachedUint8ArrayMemory0 = null;
108
+ function getUint8ArrayMemory0() {
109
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
110
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
111
+ }
112
+ return cachedUint8ArrayMemory0;
113
+ }
114
+
115
+ function getObject(idx) { return heap[idx]; }
116
+
117
+ function handleError(f, args) {
118
+ try {
119
+ return f.apply(this, args);
120
+ } catch (e) {
121
+ wasm.__wbindgen_export3(addHeapObject(e));
122
+ }
123
+ }
124
+
125
+ let heap = new Array(128).fill(undefined);
126
+ heap.push(undefined, null, true, false);
127
+
128
+ let heap_next = heap.length;
129
+
130
+ function isLikeNone(x) {
131
+ return x === undefined || x === null;
132
+ }
133
+
134
+ function makeMutClosure(arg0, arg1, dtor, f) {
135
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
136
+ const real = (...args) => {
137
+
138
+ // First up with a closure we increment the internal reference
139
+ // count. This ensures that the Rust closure environment won't
140
+ // be deallocated while we're invoking it.
141
+ state.cnt++;
142
+ const a = state.a;
143
+ state.a = 0;
144
+ try {
145
+ return f(a, state.b, ...args);
146
+ } finally {
147
+ state.a = a;
148
+ real._wbg_cb_unref();
149
+ }
150
+ };
151
+ real._wbg_cb_unref = () => {
152
+ if (--state.cnt === 0) {
153
+ state.dtor(state.a, state.b);
154
+ state.a = 0;
155
+ CLOSURE_DTORS.unregister(state);
156
+ }
157
+ };
158
+ CLOSURE_DTORS.register(real, state, state);
159
+ return real;
160
+ }
161
+
162
+ function passStringToWasm0(arg, malloc, realloc) {
163
+ if (realloc === undefined) {
164
+ const buf = cachedTextEncoder.encode(arg);
165
+ const ptr = malloc(buf.length, 1) >>> 0;
166
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
167
+ WASM_VECTOR_LEN = buf.length;
168
+ return ptr;
169
+ }
170
+
171
+ let len = arg.length;
172
+ let ptr = malloc(len, 1) >>> 0;
173
+
174
+ const mem = getUint8ArrayMemory0();
175
+
176
+ let offset = 0;
177
+
178
+ for (; offset < len; offset++) {
179
+ const code = arg.charCodeAt(offset);
180
+ if (code > 0x7F) break;
181
+ mem[ptr + offset] = code;
182
+ }
183
+ if (offset !== len) {
184
+ if (offset !== 0) {
185
+ arg = arg.slice(offset);
186
+ }
187
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
188
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
189
+ const ret = cachedTextEncoder.encodeInto(arg, view);
190
+
191
+ offset += ret.written;
192
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
193
+ }
194
+
195
+ WASM_VECTOR_LEN = offset;
196
+ return ptr;
197
+ }
198
+
199
+ function takeObject(idx) {
200
+ const ret = getObject(idx);
201
+ dropObject(idx);
202
+ return ret;
203
+ }
204
+
205
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
206
+ cachedTextDecoder.decode();
207
+ function decodeText(ptr, len) {
208
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
209
+ }
210
+
211
+ const cachedTextEncoder = new TextEncoder();
212
+
213
+ if (!('encodeInto' in cachedTextEncoder)) {
214
+ cachedTextEncoder.encodeInto = function (arg, view) {
215
+ const buf = cachedTextEncoder.encode(arg);
216
+ view.set(buf);
217
+ return {
218
+ read: arg.length,
219
+ written: buf.length
220
+ };
221
+ }
222
+ }
223
+
224
+ let WASM_VECTOR_LEN = 0;
225
+
226
+ function __wasm_bindgen_func_elem_562(arg0, arg1, arg2) {
227
+ wasm.__wasm_bindgen_func_elem_562(arg0, arg1, addHeapObject(arg2));
228
+ }
229
+
230
+ function __wasm_bindgen_func_elem_4117(arg0, arg1, arg2, arg3) {
231
+ wasm.__wasm_bindgen_func_elem_4117(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
232
+ }
233
+
234
+ const TestClientFinalization = (typeof FinalizationRegistry === 'undefined')
235
+ ? { register: () => {}, unregister: () => {} }
236
+ : new FinalizationRegistry(ptr => wasm.__wbg_testclient_free(ptr >>> 0, 1));
237
+
238
+ class TestClient {
239
+ __destroy_into_raw() {
240
+ const ptr = this.__wbg_ptr;
241
+ this.__wbg_ptr = 0;
242
+ TestClientFinalization.unregister(this);
243
+ return ptr;
244
+ }
245
+ free() {
246
+ const ptr = this.__destroy_into_raw();
247
+ wasm.__wbg_testclient_free(ptr, 0);
248
+ }
249
+ /**
250
+ * @param {string} path
251
+ * @param {any} headers
252
+ * @returns {Promise<any>}
253
+ */
254
+ get(path, headers) {
255
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
256
+ const len0 = WASM_VECTOR_LEN;
257
+ const ret = wasm.testclient_get(this.__wbg_ptr, ptr0, len0, addHeapObject(headers));
258
+ return takeObject(ret);
259
+ }
260
+ /**
261
+ * Build a [`TestClient`] from serialized route metadata, handler map, server config, and lifecycle hooks.
262
+ * @param {string} routes_json
263
+ * @param {any} handlers
264
+ * @param {any} config
265
+ * @param {any | null} [lifecycle_hooks]
266
+ */
267
+ constructor(routes_json, handlers, config, lifecycle_hooks) {
268
+ try {
269
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
270
+ const ptr0 = passStringToWasm0(routes_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
271
+ const len0 = WASM_VECTOR_LEN;
272
+ wasm.testclient_new(retptr, ptr0, len0, addHeapObject(handlers), addHeapObject(config), isLikeNone(lifecycle_hooks) ? 0 : addHeapObject(lifecycle_hooks));
273
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
274
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
275
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
276
+ if (r2) {
277
+ throw takeObject(r1);
278
+ }
279
+ this.__wbg_ptr = r0 >>> 0;
280
+ TestClientFinalization.register(this, this.__wbg_ptr, this);
281
+ return this;
282
+ } finally {
283
+ wasm.__wbindgen_add_to_stack_pointer(16);
284
+ }
285
+ }
286
+ /**
287
+ * @param {string} path
288
+ * @param {any} options
289
+ * @returns {Promise<any>}
290
+ */
291
+ put(path, options) {
292
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
293
+ const len0 = WASM_VECTOR_LEN;
294
+ const ret = wasm.testclient_put(this.__wbg_ptr, ptr0, len0, addHeapObject(options));
295
+ return takeObject(ret);
296
+ }
297
+ /**
298
+ * @param {string} path
299
+ * @param {any} headers
300
+ * @returns {Promise<any>}
301
+ */
302
+ head(path, headers) {
303
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
304
+ const len0 = WASM_VECTOR_LEN;
305
+ const ret = wasm.testclient_head(this.__wbg_ptr, ptr0, len0, addHeapObject(headers));
306
+ return takeObject(ret);
307
+ }
308
+ /**
309
+ * @param {string} path
310
+ * @param {any} options
311
+ * @returns {Promise<any>}
312
+ */
313
+ post(path, options) {
314
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
315
+ const len0 = WASM_VECTOR_LEN;
316
+ const ret = wasm.testclient_post(this.__wbg_ptr, ptr0, len0, addHeapObject(options));
317
+ return takeObject(ret);
318
+ }
319
+ /**
320
+ * @param {string} path
321
+ * @param {any} options
322
+ * @returns {Promise<any>}
323
+ */
324
+ patch(path, options) {
325
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
326
+ const len0 = WASM_VECTOR_LEN;
327
+ const ret = wasm.testclient_patch(this.__wbg_ptr, ptr0, len0, addHeapObject(options));
328
+ return takeObject(ret);
329
+ }
330
+ /**
331
+ * @param {string} path
332
+ * @param {any} headers
333
+ * @returns {Promise<any>}
334
+ */
335
+ trace(path, headers) {
336
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
337
+ const len0 = WASM_VECTOR_LEN;
338
+ const ret = wasm.testclient_trace(this.__wbg_ptr, ptr0, len0, addHeapObject(headers));
339
+ return takeObject(ret);
340
+ }
341
+ /**
342
+ * @param {string} path
343
+ * @param {any} headers
344
+ * @returns {Promise<any>}
345
+ */
346
+ delete(path, headers) {
347
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
348
+ const len0 = WASM_VECTOR_LEN;
349
+ const ret = wasm.testclient_delete(this.__wbg_ptr, ptr0, len0, addHeapObject(headers));
350
+ return takeObject(ret);
351
+ }
352
+ /**
353
+ * @param {string} path
354
+ * @param {any} headers
355
+ * @returns {Promise<any>}
356
+ */
357
+ options(path, headers) {
358
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
359
+ const len0 = WASM_VECTOR_LEN;
360
+ const ret = wasm.testclient_options(this.__wbg_ptr, ptr0, len0, addHeapObject(headers));
361
+ return takeObject(ret);
362
+ }
363
+ }
364
+ if (Symbol.dispose) TestClient.prototype[Symbol.dispose] = TestClient.prototype.free;
365
+ exports.TestClient = TestClient;
366
+
367
+ /**
368
+ * Initialize the WASM module (sets panic hook).
369
+ */
370
+ function init() {
371
+ wasm.init();
372
+ }
373
+ exports.init = init;
374
+
375
+ exports.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
376
+ const ret = Error(getStringFromWasm0(arg0, arg1));
377
+ return addHeapObject(ret);
378
+ };
379
+
380
+ exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
381
+ const ret = String(getObject(arg1));
382
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
383
+ const len1 = WASM_VECTOR_LEN;
384
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
385
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
386
+ };
387
+
388
+ exports.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
389
+ const v = getObject(arg1);
390
+ const ret = typeof(v) === 'bigint' ? v : undefined;
391
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
392
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
393
+ };
394
+
395
+ exports.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
396
+ const v = getObject(arg0);
397
+ const ret = typeof(v) === 'boolean' ? v : undefined;
398
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
399
+ };
400
+
401
+ exports.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
402
+ const ret = debugString(getObject(arg1));
403
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
404
+ const len1 = WASM_VECTOR_LEN;
405
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
406
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
407
+ };
408
+
409
+ exports.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
410
+ const ret = getObject(arg0) in getObject(arg1);
411
+ return ret;
412
+ };
413
+
414
+ exports.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
415
+ const ret = typeof(getObject(arg0)) === 'bigint';
416
+ return ret;
417
+ };
418
+
419
+ exports.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
420
+ const ret = typeof(getObject(arg0)) === 'function';
421
+ return ret;
422
+ };
423
+
424
+ exports.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function(arg0) {
425
+ const ret = getObject(arg0) === null;
426
+ return ret;
427
+ };
428
+
429
+ exports.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
430
+ const val = getObject(arg0);
431
+ const ret = typeof(val) === 'object' && val !== null;
432
+ return ret;
433
+ };
434
+
435
+ exports.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
436
+ const ret = typeof(getObject(arg0)) === 'string';
437
+ return ret;
438
+ };
439
+
440
+ exports.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
441
+ const ret = getObject(arg0) === undefined;
442
+ return ret;
443
+ };
444
+
445
+ exports.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
446
+ const ret = getObject(arg0) === getObject(arg1);
447
+ return ret;
448
+ };
449
+
450
+ exports.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
451
+ const ret = getObject(arg0) == getObject(arg1);
452
+ return ret;
453
+ };
454
+
455
+ exports.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
456
+ const obj = getObject(arg1);
457
+ const ret = typeof(obj) === 'number' ? obj : undefined;
458
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
459
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
460
+ };
461
+
462
+ exports.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
463
+ const obj = getObject(arg1);
464
+ const ret = typeof(obj) === 'string' ? obj : undefined;
465
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
466
+ var len1 = WASM_VECTOR_LEN;
467
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
468
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
469
+ };
470
+
471
+ exports.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
472
+ throw new Error(getStringFromWasm0(arg0, arg1));
473
+ };
474
+
475
+ exports.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
476
+ getObject(arg0)._wbg_cb_unref();
477
+ };
478
+
479
+ exports.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
480
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
481
+ return addHeapObject(ret);
482
+ }, arguments) };
483
+
484
+ exports.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
485
+ const ret = getObject(arg0).call(getObject(arg1));
486
+ return addHeapObject(ret);
487
+ }, arguments) };
488
+
489
+ exports.__wbg_done_62ea16af4ce34b24 = function(arg0) {
490
+ const ret = getObject(arg0).done;
491
+ return ret;
492
+ };
493
+
494
+ exports.__wbg_entries_83c79938054e065f = function(arg0) {
495
+ const ret = Object.entries(getObject(arg0));
496
+ return addHeapObject(ret);
497
+ };
498
+
499
+ exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
500
+ let deferred0_0;
501
+ let deferred0_1;
502
+ try {
503
+ deferred0_0 = arg0;
504
+ deferred0_1 = arg1;
505
+ console.error(getStringFromWasm0(arg0, arg1));
506
+ } finally {
507
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
508
+ }
509
+ };
510
+
511
+ exports.__wbg_for_7246e2a062d6960c = function(arg0, arg1) {
512
+ const ret = Symbol.for(getStringFromWasm0(arg0, arg1));
513
+ return addHeapObject(ret);
514
+ };
515
+
516
+ exports.__wbg_from_29a8414a7a7cd19d = function(arg0) {
517
+ const ret = Array.from(getObject(arg0));
518
+ return addHeapObject(ret);
519
+ };
520
+
521
+ exports.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
522
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
523
+ }, arguments) };
524
+
525
+ exports.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
526
+ const ret = getObject(arg0)[arg1 >>> 0];
527
+ return addHeapObject(ret);
528
+ };
529
+
530
+ exports.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
531
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
532
+ return addHeapObject(ret);
533
+ }, arguments) };
534
+
535
+ exports.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
536
+ const ret = getObject(arg0)[getObject(arg1)];
537
+ return addHeapObject(ret);
538
+ };
539
+
540
+ exports.__wbg_has_0e670569d65d3a45 = function() { return handleError(function (arg0, arg1) {
541
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
542
+ return ret;
543
+ }, arguments) };
544
+
545
+ exports.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
546
+ let result;
547
+ try {
548
+ result = getObject(arg0) instanceof ArrayBuffer;
549
+ } catch (_) {
550
+ result = false;
551
+ }
552
+ const ret = result;
553
+ return ret;
554
+ };
555
+
556
+ exports.__wbg_instanceof_Error_3443650560328fa9 = function(arg0) {
557
+ let result;
558
+ try {
559
+ result = getObject(arg0) instanceof Error;
560
+ } catch (_) {
561
+ result = false;
562
+ }
563
+ const ret = result;
564
+ return ret;
565
+ };
566
+
567
+ exports.__wbg_instanceof_Map_084be8da74364158 = function(arg0) {
568
+ let result;
569
+ try {
570
+ result = getObject(arg0) instanceof Map;
571
+ } catch (_) {
572
+ result = false;
573
+ }
574
+ const ret = result;
575
+ return ret;
576
+ };
577
+
578
+ exports.__wbg_instanceof_Object_577e21051f7bcb79 = function(arg0) {
579
+ let result;
580
+ try {
581
+ result = getObject(arg0) instanceof Object;
582
+ } catch (_) {
583
+ result = false;
584
+ }
585
+ const ret = result;
586
+ return ret;
587
+ };
588
+
589
+ exports.__wbg_instanceof_Promise_eca6c43a2610558d = function(arg0) {
590
+ let result;
591
+ try {
592
+ result = getObject(arg0) instanceof Promise;
593
+ } catch (_) {
594
+ result = false;
595
+ }
596
+ const ret = result;
597
+ return ret;
598
+ };
599
+
600
+ exports.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
601
+ let result;
602
+ try {
603
+ result = getObject(arg0) instanceof Uint8Array;
604
+ } catch (_) {
605
+ result = false;
606
+ }
607
+ const ret = result;
608
+ return ret;
609
+ };
610
+
611
+ exports.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
612
+ const ret = Array.isArray(getObject(arg0));
613
+ return ret;
614
+ };
615
+
616
+ exports.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
617
+ const ret = Number.isSafeInteger(getObject(arg0));
618
+ return ret;
619
+ };
620
+
621
+ exports.__wbg_iterator_27b7c8b35ab3e86b = function() {
622
+ const ret = Symbol.iterator;
623
+ return addHeapObject(ret);
624
+ };
625
+
626
+ exports.__wbg_keys_f5c6002ff150fc6c = function(arg0) {
627
+ const ret = Object.keys(getObject(arg0));
628
+ return addHeapObject(ret);
629
+ };
630
+
631
+ exports.__wbg_length_22ac23eaec9d8053 = function(arg0) {
632
+ const ret = getObject(arg0).length;
633
+ return ret;
634
+ };
635
+
636
+ exports.__wbg_length_d45040a40c570362 = function(arg0) {
637
+ const ret = getObject(arg0).length;
638
+ return ret;
639
+ };
640
+
641
+ exports.__wbg_message_0305fa7903f4b3d9 = function(arg0) {
642
+ const ret = getObject(arg0).message;
643
+ return addHeapObject(ret);
644
+ };
645
+
646
+ exports.__wbg_new_1ba21ce319a06297 = function() {
647
+ const ret = new Object();
648
+ return addHeapObject(ret);
649
+ };
650
+
651
+ exports.__wbg_new_25f239778d6112b9 = function() {
652
+ const ret = new Array();
653
+ return addHeapObject(ret);
654
+ };
655
+
656
+ exports.__wbg_new_6421f6084cc5bc5a = function(arg0) {
657
+ const ret = new Uint8Array(getObject(arg0));
658
+ return addHeapObject(ret);
659
+ };
660
+
661
+ exports.__wbg_new_8a6f238a6ece86ea = function() {
662
+ const ret = new Error();
663
+ return addHeapObject(ret);
664
+ };
665
+
666
+ exports.__wbg_new_b546ae120718850e = function() {
667
+ const ret = new Map();
668
+ return addHeapObject(ret);
669
+ };
670
+
671
+ exports.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
672
+ try {
673
+ var state0 = {a: arg0, b: arg1};
674
+ var cb0 = (arg0, arg1) => {
675
+ const a = state0.a;
676
+ state0.a = 0;
677
+ try {
678
+ return __wasm_bindgen_func_elem_4117(a, state0.b, arg0, arg1);
679
+ } finally {
680
+ state0.a = a;
681
+ }
682
+ };
683
+ const ret = new Promise(cb0);
684
+ return addHeapObject(ret);
685
+ } finally {
686
+ state0.a = state0.b = 0;
687
+ }
688
+ };
689
+
690
+ exports.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
691
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
692
+ return addHeapObject(ret);
693
+ };
694
+
695
+ exports.__wbg_next_138a17bbf04e926c = function(arg0) {
696
+ const ret = getObject(arg0).next;
697
+ return addHeapObject(ret);
698
+ };
699
+
700
+ exports.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
701
+ const ret = getObject(arg0).next();
702
+ return addHeapObject(ret);
703
+ }, arguments) };
704
+
705
+ exports.__wbg_now_69d776cd24f5215b = function() {
706
+ const ret = Date.now();
707
+ return ret;
708
+ };
709
+
710
+ exports.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
711
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
712
+ };
713
+
714
+ exports.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
715
+ const ret = getObject(arg0).queueMicrotask;
716
+ return addHeapObject(ret);
717
+ };
718
+
719
+ exports.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
720
+ queueMicrotask(getObject(arg0));
721
+ };
722
+
723
+ exports.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
724
+ const ret = Promise.resolve(getObject(arg0));
725
+ return addHeapObject(ret);
726
+ };
727
+
728
+ exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
729
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
730
+ };
731
+
732
+ exports.__wbg_set_781438a03c0c3c81 = function() { return handleError(function (arg0, arg1, arg2) {
733
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
734
+ return ret;
735
+ }, arguments) };
736
+
737
+ exports.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
738
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
739
+ };
740
+
741
+ exports.__wbg_set_efaaf145b9377369 = function(arg0, arg1, arg2) {
742
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
743
+ return addHeapObject(ret);
744
+ };
745
+
746
+ exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
747
+ const ret = getObject(arg1).stack;
748
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
749
+ const len1 = WASM_VECTOR_LEN;
750
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
751
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
752
+ };
753
+
754
+ exports.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
755
+ const ret = typeof global === 'undefined' ? null : global;
756
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
757
+ };
758
+
759
+ exports.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
760
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
761
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
762
+ };
763
+
764
+ exports.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
765
+ const ret = typeof self === 'undefined' ? null : self;
766
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
767
+ };
768
+
769
+ exports.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
770
+ const ret = typeof window === 'undefined' ? null : window;
771
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
772
+ };
773
+
774
+ exports.__wbg_stringify_655a6390e1f5eb6b = function() { return handleError(function (arg0) {
775
+ const ret = JSON.stringify(getObject(arg0));
776
+ return addHeapObject(ret);
777
+ }, arguments) };
778
+
779
+ exports.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
780
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
781
+ return addHeapObject(ret);
782
+ };
783
+
784
+ exports.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
785
+ const ret = getObject(arg0).then(getObject(arg1));
786
+ return addHeapObject(ret);
787
+ };
788
+
789
+ exports.__wbg_value_57b7b035e117f7ee = function(arg0) {
790
+ const ret = getObject(arg0).value;
791
+ return addHeapObject(ret);
792
+ };
793
+
794
+ exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
795
+ // Cast intrinsic for `Ref(String) -> Externref`.
796
+ const ret = getStringFromWasm0(arg0, arg1);
797
+ return addHeapObject(ret);
798
+ };
799
+
800
+ exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
801
+ // Cast intrinsic for `U64 -> Externref`.
802
+ const ret = BigInt.asUintN(64, arg0);
803
+ return addHeapObject(ret);
804
+ };
805
+
806
+ exports.__wbindgen_cast_902a70736b89c8fd = function(arg0, arg1) {
807
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 119, function: Function { arguments: [Externref], shim_idx: 120, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
808
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_561, __wasm_bindgen_func_elem_562);
809
+ return addHeapObject(ret);
810
+ };
811
+
812
+ exports.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
813
+ // Cast intrinsic for `I64 -> Externref`.
814
+ const ret = arg0;
815
+ return addHeapObject(ret);
816
+ };
817
+
818
+ exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
819
+ // Cast intrinsic for `F64 -> Externref`.
820
+ const ret = arg0;
821
+ return addHeapObject(ret);
822
+ };
823
+
824
+ exports.__wbindgen_object_clone_ref = function(arg0) {
825
+ const ret = getObject(arg0);
826
+ return addHeapObject(ret);
827
+ };
828
+
829
+ exports.__wbindgen_object_drop_ref = function(arg0) {
830
+ takeObject(arg0);
831
+ };
832
+
833
+ exports.__wbindgen_object_is_undefined = function(arg0) {
834
+ const ret = getObject(arg0) === undefined;
835
+ return ret;
836
+ };
837
+
838
+ const wasmPath = `${__dirname}/spikard_wasm_bg.wasm`;
839
+ const wasmBytes = require('fs').readFileSync(wasmPath);
840
+ const wasmModule = new WebAssembly.Module(wasmBytes);
841
+ const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
842
+
843
+ wasm.__wbindgen_start();