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