@haneullabs/walrus-wasm 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,626 @@
1
+ let wasm;
2
+
3
+ let cachedUint8ArrayMemory0 = null;
4
+
5
+ function getUint8ArrayMemory0() {
6
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
7
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
8
+ }
9
+ return cachedUint8ArrayMemory0;
10
+ }
11
+
12
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13
+
14
+ cachedTextDecoder.decode();
15
+
16
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
17
+ let numBytesDecoded = 0;
18
+ function decodeText(ptr, len) {
19
+ numBytesDecoded += len;
20
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
21
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
22
+ cachedTextDecoder.decode();
23
+ numBytesDecoded = len;
24
+ }
25
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
26
+ }
27
+
28
+ function getStringFromWasm0(ptr, len) {
29
+ ptr = ptr >>> 0;
30
+ return decodeText(ptr, len);
31
+ }
32
+
33
+ let WASM_VECTOR_LEN = 0;
34
+
35
+ const cachedTextEncoder = new TextEncoder();
36
+
37
+ if (!('encodeInto' in cachedTextEncoder)) {
38
+ cachedTextEncoder.encodeInto = function (arg, view) {
39
+ const buf = cachedTextEncoder.encode(arg);
40
+ view.set(buf);
41
+ return {
42
+ read: arg.length,
43
+ written: buf.length
44
+ };
45
+ }
46
+ }
47
+
48
+ function passStringToWasm0(arg, malloc, realloc) {
49
+
50
+ if (realloc === undefined) {
51
+ const buf = cachedTextEncoder.encode(arg);
52
+ const ptr = malloc(buf.length, 1) >>> 0;
53
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
54
+ WASM_VECTOR_LEN = buf.length;
55
+ return ptr;
56
+ }
57
+
58
+ let len = arg.length;
59
+ let ptr = malloc(len, 1) >>> 0;
60
+
61
+ const mem = getUint8ArrayMemory0();
62
+
63
+ let offset = 0;
64
+
65
+ for (; offset < len; offset++) {
66
+ const code = arg.charCodeAt(offset);
67
+ if (code > 0x7F) break;
68
+ mem[ptr + offset] = code;
69
+ }
70
+
71
+ if (offset !== len) {
72
+ if (offset !== 0) {
73
+ arg = arg.slice(offset);
74
+ }
75
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
76
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
77
+ const ret = cachedTextEncoder.encodeInto(arg, view);
78
+
79
+ offset += ret.written;
80
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
81
+ }
82
+
83
+ WASM_VECTOR_LEN = offset;
84
+ return ptr;
85
+ }
86
+
87
+ let cachedDataViewMemory0 = null;
88
+
89
+ function getDataViewMemory0() {
90
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
91
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
92
+ }
93
+ return cachedDataViewMemory0;
94
+ }
95
+
96
+ function isLikeNone(x) {
97
+ return x === undefined || x === null;
98
+ }
99
+
100
+ function debugString(val) {
101
+ // primitive types
102
+ const type = typeof val;
103
+ if (type == 'number' || type == 'boolean' || val == null) {
104
+ return `${val}`;
105
+ }
106
+ if (type == 'string') {
107
+ return `"${val}"`;
108
+ }
109
+ if (type == 'symbol') {
110
+ const description = val.description;
111
+ if (description == null) {
112
+ return 'Symbol';
113
+ } else {
114
+ return `Symbol(${description})`;
115
+ }
116
+ }
117
+ if (type == 'function') {
118
+ const name = val.name;
119
+ if (typeof name == 'string' && name.length > 0) {
120
+ return `Function(${name})`;
121
+ } else {
122
+ return 'Function';
123
+ }
124
+ }
125
+ // objects
126
+ if (Array.isArray(val)) {
127
+ const length = val.length;
128
+ let debug = '[';
129
+ if (length > 0) {
130
+ debug += debugString(val[0]);
131
+ }
132
+ for(let i = 1; i < length; i++) {
133
+ debug += ', ' + debugString(val[i]);
134
+ }
135
+ debug += ']';
136
+ return debug;
137
+ }
138
+ // Test for built-in
139
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
140
+ let className;
141
+ if (builtInMatches && builtInMatches.length > 1) {
142
+ className = builtInMatches[1];
143
+ } else {
144
+ // Failed to match the standard '[object ClassName]'
145
+ return toString.call(val);
146
+ }
147
+ if (className == 'Object') {
148
+ // we're a user defined class or Object
149
+ // JSON.stringify avoids problems with cycles, and is generally much
150
+ // easier than looping through ownProperties of `val`.
151
+ try {
152
+ return 'Object(' + JSON.stringify(val) + ')';
153
+ } catch (_) {
154
+ return 'Object';
155
+ }
156
+ }
157
+ // errors
158
+ if (val instanceof Error) {
159
+ return `${val.name}: ${val.message}\n${val.stack}`;
160
+ }
161
+ // TODO we could test for more things here, like `Set`s and `Map`s.
162
+ return className;
163
+ }
164
+
165
+ function addToExternrefTable0(obj) {
166
+ const idx = wasm.__externref_table_alloc();
167
+ wasm.__wbindgen_externrefs.set(idx, obj);
168
+ return idx;
169
+ }
170
+
171
+ function handleError(f, args) {
172
+ try {
173
+ return f.apply(this, args);
174
+ } catch (e) {
175
+ const idx = addToExternrefTable0(e);
176
+ wasm.__wbindgen_exn_store(idx);
177
+ }
178
+ }
179
+
180
+ function getArrayU8FromWasm0(ptr, len) {
181
+ ptr = ptr >>> 0;
182
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
183
+ }
184
+
185
+ function takeFromExternrefTable0(idx) {
186
+ const value = wasm.__wbindgen_externrefs.get(idx);
187
+ wasm.__externref_table_dealloc(idx);
188
+ return value;
189
+ }
190
+
191
+ function passArrayJsValueToWasm0(array, malloc) {
192
+ const ptr = malloc(array.length * 4, 4) >>> 0;
193
+ for (let i = 0; i < array.length; i++) {
194
+ const add = addToExternrefTable0(array[i]);
195
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
196
+ }
197
+ WASM_VECTOR_LEN = array.length;
198
+ return ptr;
199
+ }
200
+ /**
201
+ * Aggregate a list of signatures.
202
+ * The signatures must be of the type Vec<Vec<u8>> with each signature being a 96 bytes long serialized signature.
203
+ * @param {any} signatures
204
+ * @returns {Uint8Array}
205
+ */
206
+ export function bls12381_min_pk_aggregate(signatures) {
207
+ const ret = wasm.bls12381_min_pk_aggregate(signatures);
208
+ if (ret[3]) {
209
+ throw takeFromExternrefTable0(ret[2]);
210
+ }
211
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
212
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
213
+ return v1;
214
+ }
215
+
216
+ function passArray8ToWasm0(arg, malloc) {
217
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
218
+ getUint8ArrayMemory0().set(arg, ptr / 1);
219
+ WASM_VECTOR_LEN = arg.length;
220
+ return ptr;
221
+ }
222
+ /**
223
+ * Verify an aggregate signature.
224
+ * @param {any} public_keys
225
+ * @param {Uint8Array} msg
226
+ * @param {Uint8Array} signature
227
+ * @returns {boolean}
228
+ */
229
+ export function bls12381_min_pk_verify_aggregate(public_keys, msg, signature) {
230
+ const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
231
+ const len0 = WASM_VECTOR_LEN;
232
+ const ptr1 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
233
+ const len1 = WASM_VECTOR_LEN;
234
+ const ret = wasm.bls12381_min_pk_verify_aggregate(public_keys, ptr0, len0, ptr1, len1);
235
+ if (ret[2]) {
236
+ throw takeFromExternrefTable0(ret[1]);
237
+ }
238
+ return ret[0] !== 0;
239
+ }
240
+
241
+ /**
242
+ * @param {Uint8Array} signature
243
+ * @param {Uint8Array} public_key
244
+ * @param {Uint8Array} msg
245
+ * @returns {boolean}
246
+ */
247
+ export function bls12381_min_pk_verify(signature, public_key, msg) {
248
+ const ptr0 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
249
+ const len0 = WASM_VECTOR_LEN;
250
+ const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
251
+ const len1 = WASM_VECTOR_LEN;
252
+ const ptr2 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
253
+ const len2 = WASM_VECTOR_LEN;
254
+ const ret = wasm.bls12381_min_pk_verify(ptr0, len0, ptr1, len1, ptr2, len2);
255
+ if (ret[2]) {
256
+ throw takeFromExternrefTable0(ret[1]);
257
+ }
258
+ return ret[0] !== 0;
259
+ }
260
+
261
+ const BlobEncoderFinalization = (typeof FinalizationRegistry === 'undefined')
262
+ ? { register: () => {}, unregister: () => {} }
263
+ : new FinalizationRegistry(ptr => wasm.__wbg_blobencoder_free(ptr >>> 0, 1));
264
+
265
+ export class BlobEncoder {
266
+
267
+ __destroy_into_raw() {
268
+ const ptr = this.__wbg_ptr;
269
+ this.__wbg_ptr = 0;
270
+ BlobEncoderFinalization.unregister(this);
271
+ return ptr;
272
+ }
273
+
274
+ free() {
275
+ const ptr = this.__destroy_into_raw();
276
+ wasm.__wbg_blobencoder_free(ptr, 0);
277
+ }
278
+ /**
279
+ * Compute metadata for data without encoding it.
280
+ * Returns only the essential fields needed for blob registration:
281
+ * (blob_id, root_hash, unencoded_length, encoding_type)
282
+ *
283
+ * This avoids serializing all 2k sliver hashes across the JS/WASM boundary.
284
+ * @param {Uint8Array} data
285
+ * @returns {any}
286
+ */
287
+ compute_metadata(data) {
288
+ const ret = wasm.blobencoder_compute_metadata(this.__wbg_ptr, data);
289
+ if (ret[2]) {
290
+ throw takeFromExternrefTable0(ret[1]);
291
+ }
292
+ return takeFromExternrefTable0(ret[0]);
293
+ }
294
+ /**
295
+ * @param {number} n_shards
296
+ */
297
+ constructor(n_shards) {
298
+ const ret = wasm.blobencoder_new(n_shards);
299
+ if (ret[2]) {
300
+ throw takeFromExternrefTable0(ret[1]);
301
+ }
302
+ this.__wbg_ptr = ret[0] >>> 0;
303
+ BlobEncoderFinalization.register(this, this.__wbg_ptr, this);
304
+ return this;
305
+ }
306
+ /**
307
+ * Decode blob from BCS-encoded SliverData buffers.
308
+ *
309
+ * Arguments:
310
+ * - blob_id: The blob identifier
311
+ * - blob_size: The original unencoded blob size in bytes
312
+ * - bcs_buffers: Vec<Uint8Array>, each containing BCS-encoded SliverData<Primary>
313
+ * - output_buffer: Uint8Array to write decoded data into (must be exactly blob_size bytes)
314
+ * @param {any} blob_id
315
+ * @param {bigint} blob_size
316
+ * @param {Uint8Array[]} bcs_buffers
317
+ * @param {Uint8Array} output_buffer
318
+ */
319
+ decode(blob_id, blob_size, bcs_buffers, output_buffer) {
320
+ const ptr0 = passArrayJsValueToWasm0(bcs_buffers, wasm.__wbindgen_malloc);
321
+ const len0 = WASM_VECTOR_LEN;
322
+ const ret = wasm.blobencoder_decode(this.__wbg_ptr, blob_id, blob_size, ptr0, len0, output_buffer);
323
+ if (ret[1]) {
324
+ throw takeFromExternrefTable0(ret[0]);
325
+ }
326
+ }
327
+ /**
328
+ * Encode data and write BCS-encoded SliverData directly into pre-allocated buffers.
329
+ *
330
+ * Arguments:
331
+ * - data: Input data to encode
332
+ * - primary_buffers: Array of Uint8Array buffers (one per shard) for primary slivers
333
+ * - secondary_buffers: Array of Uint8Array buffers (one per shard) for secondary slivers
334
+ *
335
+ * Each buffer will be written with BCS-encoded SliverData.
336
+ *
337
+ * Returns: JsValue with (metadata, root_hash)
338
+ * @param {Uint8Array} data
339
+ * @param {Array<any>} primary_buffers
340
+ * @param {Array<any>} secondary_buffers
341
+ * @returns {any}
342
+ */
343
+ encode(data, primary_buffers, secondary_buffers) {
344
+ const ret = wasm.blobencoder_encode(this.__wbg_ptr, data, primary_buffers, secondary_buffers);
345
+ if (ret[2]) {
346
+ throw takeFromExternrefTable0(ret[1]);
347
+ }
348
+ return takeFromExternrefTable0(ret[0]);
349
+ }
350
+ }
351
+ if (Symbol.dispose) BlobEncoder.prototype[Symbol.dispose] = BlobEncoder.prototype.free;
352
+
353
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
354
+
355
+ async function __wbg_load(module, imports) {
356
+ if (typeof Response === 'function' && module instanceof Response) {
357
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
358
+ try {
359
+ return await WebAssembly.instantiateStreaming(module, imports);
360
+
361
+ } catch (e) {
362
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
363
+
364
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
365
+ 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);
366
+
367
+ } else {
368
+ throw e;
369
+ }
370
+ }
371
+ }
372
+
373
+ const bytes = await module.arrayBuffer();
374
+ return await WebAssembly.instantiate(bytes, imports);
375
+
376
+ } else {
377
+ const instance = await WebAssembly.instantiate(module, imports);
378
+
379
+ if (instance instanceof WebAssembly.Instance) {
380
+ return { instance, module };
381
+
382
+ } else {
383
+ return instance;
384
+ }
385
+ }
386
+ }
387
+
388
+ function __wbg_get_imports() {
389
+ const imports = {};
390
+ imports.wbg = {};
391
+ imports.wbg.__wbg_Error_e83987f665cf5504 = function(arg0, arg1) {
392
+ const ret = Error(getStringFromWasm0(arg0, arg1));
393
+ return ret;
394
+ };
395
+ imports.wbg.__wbg_String_fed4d24b68977888 = function(arg0, arg1) {
396
+ const ret = String(arg1);
397
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
398
+ const len1 = WASM_VECTOR_LEN;
399
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
400
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
401
+ };
402
+ imports.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
403
+ const v = arg0;
404
+ const ret = typeof(v) === 'boolean' ? v : undefined;
405
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
406
+ };
407
+ imports.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
408
+ const ret = debugString(arg1);
409
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
410
+ const len1 = WASM_VECTOR_LEN;
411
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
412
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
413
+ };
414
+ imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
415
+ const ret = typeof(arg0) === 'function';
416
+ return ret;
417
+ };
418
+ imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
419
+ const val = arg0;
420
+ const ret = typeof(val) === 'object' && val !== null;
421
+ return ret;
422
+ };
423
+ imports.wbg.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function(arg0, arg1) {
424
+ const ret = arg0 == arg1;
425
+ return ret;
426
+ };
427
+ imports.wbg.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
428
+ const obj = arg1;
429
+ const ret = typeof(obj) === 'number' ? obj : undefined;
430
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
431
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
432
+ };
433
+ imports.wbg.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
434
+ const obj = arg1;
435
+ const ret = typeof(obj) === 'string' ? obj : undefined;
436
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
437
+ var len1 = WASM_VECTOR_LEN;
438
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
439
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
440
+ };
441
+ imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
442
+ throw new Error(getStringFromWasm0(arg0, arg1));
443
+ };
444
+ imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
445
+ const ret = arg0.call(arg1);
446
+ return ret;
447
+ }, arguments) };
448
+ imports.wbg.__wbg_done_2042aa2670fb1db1 = function(arg0) {
449
+ const ret = arg0.done;
450
+ return ret;
451
+ };
452
+ imports.wbg.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
453
+ const ret = arg0[arg1 >>> 0];
454
+ return ret;
455
+ };
456
+ imports.wbg.__wbg_get_efcb449f58ec27c2 = function() { return handleError(function (arg0, arg1) {
457
+ const ret = Reflect.get(arg0, arg1);
458
+ return ret;
459
+ }, arguments) };
460
+ imports.wbg.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
461
+ let result;
462
+ try {
463
+ result = arg0 instanceof ArrayBuffer;
464
+ } catch (_) {
465
+ result = false;
466
+ }
467
+ const ret = result;
468
+ return ret;
469
+ };
470
+ imports.wbg.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
471
+ let result;
472
+ try {
473
+ result = arg0 instanceof Uint8Array;
474
+ } catch (_) {
475
+ result = false;
476
+ }
477
+ const ret = result;
478
+ return ret;
479
+ };
480
+ imports.wbg.__wbg_isArray_96e0af9891d0945d = function(arg0) {
481
+ const ret = Array.isArray(arg0);
482
+ return ret;
483
+ };
484
+ imports.wbg.__wbg_isSafeInteger_d216eda7911dde36 = function(arg0) {
485
+ const ret = Number.isSafeInteger(arg0);
486
+ return ret;
487
+ };
488
+ imports.wbg.__wbg_iterator_e5822695327a3c39 = function() {
489
+ const ret = Symbol.iterator;
490
+ return ret;
491
+ };
492
+ imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
493
+ const ret = arg0.length;
494
+ return ret;
495
+ };
496
+ imports.wbg.__wbg_length_cdd215e10d9dd507 = function(arg0) {
497
+ const ret = arg0.length;
498
+ return ret;
499
+ };
500
+ imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
501
+ const ret = new Object();
502
+ return ret;
503
+ };
504
+ imports.wbg.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
505
+ const ret = new Uint8Array(arg0);
506
+ return ret;
507
+ };
508
+ imports.wbg.__wbg_new_e17d9f43105b08be = function() {
509
+ const ret = new Array();
510
+ return ret;
511
+ };
512
+ imports.wbg.__wbg_next_020810e0ae8ebcb0 = function() { return handleError(function (arg0) {
513
+ const ret = arg0.next();
514
+ return ret;
515
+ }, arguments) };
516
+ imports.wbg.__wbg_next_2c826fe5dfec6b6a = function(arg0) {
517
+ const ret = arg0.next;
518
+ return ret;
519
+ };
520
+ imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
521
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
522
+ };
523
+ imports.wbg.__wbg_set_3fda3bac07393de4 = function(arg0, arg1, arg2) {
524
+ arg0[arg1] = arg2;
525
+ };
526
+ imports.wbg.__wbg_set_9e6516df7b7d0f19 = function(arg0, arg1, arg2) {
527
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
528
+ };
529
+ imports.wbg.__wbg_set_c213c871859d6500 = function(arg0, arg1, arg2) {
530
+ arg0[arg1 >>> 0] = arg2;
531
+ };
532
+ imports.wbg.__wbg_value_692627309814bb8c = function(arg0) {
533
+ const ret = arg0.value;
534
+ return ret;
535
+ };
536
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
537
+ // Cast intrinsic for `Ref(String) -> Externref`.
538
+ const ret = getStringFromWasm0(arg0, arg1);
539
+ return ret;
540
+ };
541
+ imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
542
+ // Cast intrinsic for `U64 -> Externref`.
543
+ const ret = BigInt.asUintN(64, arg0);
544
+ return ret;
545
+ };
546
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
547
+ // Cast intrinsic for `F64 -> Externref`.
548
+ const ret = arg0;
549
+ return ret;
550
+ };
551
+ imports.wbg.__wbindgen_init_externref_table = function() {
552
+ const table = wasm.__wbindgen_externrefs;
553
+ const offset = table.grow(4);
554
+ table.set(0, undefined);
555
+ table.set(offset + 0, undefined);
556
+ table.set(offset + 1, null);
557
+ table.set(offset + 2, true);
558
+ table.set(offset + 3, false);
559
+ ;
560
+ };
561
+
562
+ return imports;
563
+ }
564
+
565
+ function __wbg_finalize_init(instance, module) {
566
+ wasm = instance.exports;
567
+ __wbg_init.__wbindgen_wasm_module = module;
568
+ cachedDataViewMemory0 = null;
569
+ cachedUint8ArrayMemory0 = null;
570
+
571
+
572
+ wasm.__wbindgen_start();
573
+ return wasm;
574
+ }
575
+
576
+ function initSync(module) {
577
+ if (wasm !== undefined) return wasm;
578
+
579
+
580
+ if (typeof module !== 'undefined') {
581
+ if (Object.getPrototypeOf(module) === Object.prototype) {
582
+ ({module} = module)
583
+ } else {
584
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
585
+ }
586
+ }
587
+
588
+ const imports = __wbg_get_imports();
589
+
590
+ if (!(module instanceof WebAssembly.Module)) {
591
+ module = new WebAssembly.Module(module);
592
+ }
593
+
594
+ const instance = new WebAssembly.Instance(module, imports);
595
+
596
+ return __wbg_finalize_init(instance, module);
597
+ }
598
+
599
+ async function __wbg_init(module_or_path) {
600
+ if (wasm !== undefined) return wasm;
601
+
602
+
603
+ if (typeof module_or_path !== 'undefined') {
604
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
605
+ ({module_or_path} = module_or_path)
606
+ } else {
607
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
608
+ }
609
+ }
610
+
611
+ if (typeof module_or_path === 'undefined') {
612
+ module_or_path = new URL('walrus_wasm_bg.wasm', import.meta.url);
613
+ }
614
+ const imports = __wbg_get_imports();
615
+
616
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
617
+ module_or_path = fetch(module_or_path);
618
+ }
619
+
620
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
621
+
622
+ return __wbg_finalize_init(instance, module);
623
+ }
624
+
625
+ export { initSync };
626
+ export default __wbg_init;