@noir-lang/acvm_js 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/web/acvm_js.js ADDED
@@ -0,0 +1,1055 @@
1
+ let wasm;
2
+
3
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
4
+
5
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
6
+
7
+ let cachedUint8Memory0 = null;
8
+
9
+ function getUint8Memory0() {
10
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
11
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
12
+ }
13
+ return cachedUint8Memory0;
14
+ }
15
+
16
+ function getStringFromWasm0(ptr, len) {
17
+ ptr = ptr >>> 0;
18
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
19
+ }
20
+
21
+ const heap = new Array(128).fill(undefined);
22
+
23
+ heap.push(undefined, null, true, false);
24
+
25
+ let heap_next = heap.length;
26
+
27
+ function addHeapObject(obj) {
28
+ if (heap_next === heap.length) heap.push(heap.length + 1);
29
+ const idx = heap_next;
30
+ heap_next = heap[idx];
31
+
32
+ heap[idx] = obj;
33
+ return idx;
34
+ }
35
+
36
+ function getObject(idx) { return heap[idx]; }
37
+
38
+ function dropObject(idx) {
39
+ if (idx < 132) return;
40
+ heap[idx] = heap_next;
41
+ heap_next = idx;
42
+ }
43
+
44
+ function takeObject(idx) {
45
+ const ret = getObject(idx);
46
+ dropObject(idx);
47
+ return ret;
48
+ }
49
+
50
+ function isLikeNone(x) {
51
+ return x === undefined || x === null;
52
+ }
53
+
54
+ let cachedFloat64Memory0 = null;
55
+
56
+ function getFloat64Memory0() {
57
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
58
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
59
+ }
60
+ return cachedFloat64Memory0;
61
+ }
62
+
63
+ let cachedInt32Memory0 = null;
64
+
65
+ function getInt32Memory0() {
66
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
67
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
68
+ }
69
+ return cachedInt32Memory0;
70
+ }
71
+
72
+ let WASM_VECTOR_LEN = 0;
73
+
74
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
75
+
76
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
77
+ ? function (arg, view) {
78
+ return cachedTextEncoder.encodeInto(arg, view);
79
+ }
80
+ : function (arg, view) {
81
+ const buf = cachedTextEncoder.encode(arg);
82
+ view.set(buf);
83
+ return {
84
+ read: arg.length,
85
+ written: buf.length
86
+ };
87
+ });
88
+
89
+ function passStringToWasm0(arg, malloc, realloc) {
90
+
91
+ if (realloc === undefined) {
92
+ const buf = cachedTextEncoder.encode(arg);
93
+ const ptr = malloc(buf.length, 1) >>> 0;
94
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
95
+ WASM_VECTOR_LEN = buf.length;
96
+ return ptr;
97
+ }
98
+
99
+ let len = arg.length;
100
+ let ptr = malloc(len, 1) >>> 0;
101
+
102
+ const mem = getUint8Memory0();
103
+
104
+ let offset = 0;
105
+
106
+ for (; offset < len; offset++) {
107
+ const code = arg.charCodeAt(offset);
108
+ if (code > 0x7F) break;
109
+ mem[ptr + offset] = code;
110
+ }
111
+
112
+ if (offset !== len) {
113
+ if (offset !== 0) {
114
+ arg = arg.slice(offset);
115
+ }
116
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
117
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
118
+ const ret = encodeString(arg, view);
119
+
120
+ offset += ret.written;
121
+ }
122
+
123
+ WASM_VECTOR_LEN = offset;
124
+ return ptr;
125
+ }
126
+
127
+ let cachedBigInt64Memory0 = null;
128
+
129
+ function getBigInt64Memory0() {
130
+ if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) {
131
+ cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
132
+ }
133
+ return cachedBigInt64Memory0;
134
+ }
135
+
136
+ function debugString(val) {
137
+ // primitive types
138
+ const type = typeof val;
139
+ if (type == 'number' || type == 'boolean' || val == null) {
140
+ return `${val}`;
141
+ }
142
+ if (type == 'string') {
143
+ return `"${val}"`;
144
+ }
145
+ if (type == 'symbol') {
146
+ const description = val.description;
147
+ if (description == null) {
148
+ return 'Symbol';
149
+ } else {
150
+ return `Symbol(${description})`;
151
+ }
152
+ }
153
+ if (type == 'function') {
154
+ const name = val.name;
155
+ if (typeof name == 'string' && name.length > 0) {
156
+ return `Function(${name})`;
157
+ } else {
158
+ return 'Function';
159
+ }
160
+ }
161
+ // objects
162
+ if (Array.isArray(val)) {
163
+ const length = val.length;
164
+ let debug = '[';
165
+ if (length > 0) {
166
+ debug += debugString(val[0]);
167
+ }
168
+ for(let i = 1; i < length; i++) {
169
+ debug += ', ' + debugString(val[i]);
170
+ }
171
+ debug += ']';
172
+ return debug;
173
+ }
174
+ // Test for built-in
175
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
176
+ let className;
177
+ if (builtInMatches.length > 1) {
178
+ className = builtInMatches[1];
179
+ } else {
180
+ // Failed to match the standard '[object ClassName]'
181
+ return toString.call(val);
182
+ }
183
+ if (className == 'Object') {
184
+ // we're a user defined class or Object
185
+ // JSON.stringify avoids problems with cycles, and is generally much
186
+ // easier than looping through ownProperties of `val`.
187
+ try {
188
+ return 'Object(' + JSON.stringify(val) + ')';
189
+ } catch (_) {
190
+ return 'Object';
191
+ }
192
+ }
193
+ // errors
194
+ if (val instanceof Error) {
195
+ return `${val.name}: ${val.message}\n${val.stack}`;
196
+ }
197
+ // TODO we could test for more things here, like `Set`s and `Map`s.
198
+ return className;
199
+ }
200
+
201
+ function makeMutClosure(arg0, arg1, dtor, f) {
202
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
203
+ const real = (...args) => {
204
+ // First up with a closure we increment the internal reference
205
+ // count. This ensures that the Rust closure environment won't
206
+ // be deallocated while we're invoking it.
207
+ state.cnt++;
208
+ const a = state.a;
209
+ state.a = 0;
210
+ try {
211
+ return f(a, state.b, ...args);
212
+ } finally {
213
+ if (--state.cnt === 0) {
214
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
215
+
216
+ } else {
217
+ state.a = a;
218
+ }
219
+ }
220
+ };
221
+ real.original = state;
222
+
223
+ return real;
224
+ }
225
+ function __wbg_adapter_54(arg0, arg1, arg2) {
226
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8fdacd768a9ff6b4(arg0, arg1, addHeapObject(arg2));
227
+ }
228
+
229
+ /**
230
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
231
+ * @returns {BuildInfo} - Information on how the installed package was built.
232
+ */
233
+ export function buildInfo() {
234
+ const ret = wasm.buildInfo();
235
+ return takeObject(ret);
236
+ }
237
+
238
+ function _assertClass(instance, klass) {
239
+ if (!(instance instanceof klass)) {
240
+ throw new Error(`expected instance of ${klass.name}`);
241
+ }
242
+ return instance.ptr;
243
+ }
244
+
245
+ function passArray8ToWasm0(arg, malloc) {
246
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
247
+ getUint8Memory0().set(arg, ptr / 1);
248
+ WASM_VECTOR_LEN = arg.length;
249
+ return ptr;
250
+ }
251
+ /**
252
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
253
+ *
254
+ * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
255
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
256
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
257
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
258
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
259
+ */
260
+ export function executeCircuitWithBlackBoxSolver(solver, circuit, initial_witness, foreign_call_handler) {
261
+ _assertClass(solver, WasmBlackBoxFunctionSolver);
262
+ const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
263
+ const len0 = WASM_VECTOR_LEN;
264
+ const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
265
+ return takeObject(ret);
266
+ }
267
+
268
+ /**
269
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
270
+ *
271
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
272
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
273
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
274
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
275
+ */
276
+ export function executeCircuit(circuit, initial_witness, foreign_call_handler) {
277
+ const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
278
+ const len0 = WASM_VECTOR_LEN;
279
+ const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
280
+ return takeObject(ret);
281
+ }
282
+
283
+ /**
284
+ * @returns {Promise<WasmBlackBoxFunctionSolver>}
285
+ */
286
+ export function createBlackBoxSolver() {
287
+ const ret = wasm.createBlackBoxSolver();
288
+ return takeObject(ret);
289
+ }
290
+
291
+ /**
292
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
293
+ *
294
+ * @param {Uint8Array} compressed_witness - A compressed witness.
295
+ * @returns {WitnessMap} The decompressed witness map.
296
+ */
297
+ export function decompressWitness(compressed_witness) {
298
+ try {
299
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
300
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
301
+ const len0 = WASM_VECTOR_LEN;
302
+ wasm.decompressWitness(retptr, ptr0, len0);
303
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
304
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
305
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
306
+ if (r2) {
307
+ throw takeObject(r1);
308
+ }
309
+ return takeObject(r0);
310
+ } finally {
311
+ wasm.__wbindgen_add_to_stack_pointer(16);
312
+ }
313
+ }
314
+
315
+ function getArrayU8FromWasm0(ptr, len) {
316
+ ptr = ptr >>> 0;
317
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
318
+ }
319
+ /**
320
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
321
+ *
322
+ * @param {Uint8Array} compressed_witness - A witness map.
323
+ * @returns {WitnessMap} A compressed witness map
324
+ */
325
+ export function compressWitness(witness_map) {
326
+ try {
327
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
328
+ wasm.compressWitness(retptr, addHeapObject(witness_map));
329
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
330
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
331
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
332
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
333
+ if (r3) {
334
+ throw takeObject(r2);
335
+ }
336
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
337
+ wasm.__wbindgen_free(r0, r1 * 1);
338
+ return v1;
339
+ } finally {
340
+ wasm.__wbindgen_add_to_stack_pointer(16);
341
+ }
342
+ }
343
+
344
+ /**
345
+ * Sets the package's logging level.
346
+ *
347
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
348
+ */
349
+ export function initLogLevel(level) {
350
+ wasm.initLogLevel(addHeapObject(level));
351
+ }
352
+
353
+ /**
354
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
355
+ *
356
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
357
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
358
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
359
+ * @param {Uint8Array} circuit
360
+ * @param {WitnessMap} solved_witness
361
+ * @returns {WitnessMap}
362
+ */
363
+ export function getPublicWitness(circuit, solved_witness) {
364
+ try {
365
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
366
+ const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
367
+ const len0 = WASM_VECTOR_LEN;
368
+ wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
369
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
370
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
371
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
372
+ if (r2) {
373
+ throw takeObject(r1);
374
+ }
375
+ return takeObject(r0);
376
+ } finally {
377
+ wasm.__wbindgen_add_to_stack_pointer(16);
378
+ }
379
+ }
380
+
381
+ /**
382
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
383
+ *
384
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
385
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
386
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
387
+ * @param {Uint8Array} circuit
388
+ * @param {WitnessMap} solved_witness
389
+ * @returns {WitnessMap}
390
+ */
391
+ export function getPublicParametersWitness(circuit, solved_witness) {
392
+ try {
393
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
394
+ const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
395
+ const len0 = WASM_VECTOR_LEN;
396
+ wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
397
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
398
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
399
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
400
+ if (r2) {
401
+ throw takeObject(r1);
402
+ }
403
+ return takeObject(r0);
404
+ } finally {
405
+ wasm.__wbindgen_add_to_stack_pointer(16);
406
+ }
407
+ }
408
+
409
+ /**
410
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
411
+ *
412
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
413
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
414
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
415
+ * @param {Uint8Array} circuit
416
+ * @param {WitnessMap} witness_map
417
+ * @returns {WitnessMap}
418
+ */
419
+ export function getReturnWitness(circuit, witness_map) {
420
+ try {
421
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
422
+ const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
423
+ const len0 = WASM_VECTOR_LEN;
424
+ wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
425
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
426
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
427
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
428
+ if (r2) {
429
+ throw takeObject(r1);
430
+ }
431
+ return takeObject(r0);
432
+ } finally {
433
+ wasm.__wbindgen_add_to_stack_pointer(16);
434
+ }
435
+ }
436
+
437
+ function handleError(f, args) {
438
+ try {
439
+ return f.apply(this, args);
440
+ } catch (e) {
441
+ wasm.__wbindgen_exn_store(addHeapObject(e));
442
+ }
443
+ }
444
+ function __wbg_adapter_148(arg0, arg1, arg2, arg3) {
445
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h2def3b115f9d10e4(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
446
+ }
447
+
448
+ /**
449
+ * A struct representing a Trap
450
+ */
451
+ export class Trap {
452
+
453
+ __destroy_into_raw() {
454
+ const ptr = this.__wbg_ptr;
455
+ this.__wbg_ptr = 0;
456
+
457
+ return ptr;
458
+ }
459
+
460
+ free() {
461
+ const ptr = this.__destroy_into_raw();
462
+ wasm.__wbg_trap_free(ptr);
463
+ }
464
+ /**
465
+ * @returns {Symbol}
466
+ */
467
+ static __wbgd_downcast_token() {
468
+ const ret = wasm.trap___wbgd_downcast_token();
469
+ return takeObject(ret);
470
+ }
471
+ }
472
+ /**
473
+ */
474
+ export class WasmBlackBoxFunctionSolver {
475
+
476
+ static __wrap(ptr) {
477
+ ptr = ptr >>> 0;
478
+ const obj = Object.create(WasmBlackBoxFunctionSolver.prototype);
479
+ obj.__wbg_ptr = ptr;
480
+
481
+ return obj;
482
+ }
483
+
484
+ __destroy_into_raw() {
485
+ const ptr = this.__wbg_ptr;
486
+ this.__wbg_ptr = 0;
487
+
488
+ return ptr;
489
+ }
490
+
491
+ free() {
492
+ const ptr = this.__destroy_into_raw();
493
+ wasm.__wbg_wasmblackboxfunctionsolver_free(ptr);
494
+ }
495
+ }
496
+
497
+ async function __wbg_load(module, imports) {
498
+ if (typeof Response === 'function' && module instanceof Response) {
499
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
500
+ try {
501
+ return await WebAssembly.instantiateStreaming(module, imports);
502
+
503
+ } catch (e) {
504
+ if (module.headers.get('Content-Type') != 'application/wasm') {
505
+ 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);
506
+
507
+ } else {
508
+ throw e;
509
+ }
510
+ }
511
+ }
512
+
513
+ const bytes = await module.arrayBuffer();
514
+ return await WebAssembly.instantiate(bytes, imports);
515
+
516
+ } else {
517
+ const instance = await WebAssembly.instantiate(module, imports);
518
+
519
+ if (instance instanceof WebAssembly.Instance) {
520
+ return { instance, module };
521
+
522
+ } else {
523
+ return instance;
524
+ }
525
+ }
526
+ }
527
+
528
+ function __wbg_get_imports() {
529
+ const imports = {};
530
+ imports.wbg = {};
531
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
532
+ const ret = getStringFromWasm0(arg0, arg1);
533
+ return addHeapObject(ret);
534
+ };
535
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
536
+ takeObject(arg0);
537
+ };
538
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
539
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
540
+ return addHeapObject(ret);
541
+ };
542
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
543
+ const ret = getObject(arg0);
544
+ return addHeapObject(ret);
545
+ };
546
+ imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
547
+ const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
548
+ return addHeapObject(ret);
549
+ };
550
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
551
+ const obj = getObject(arg1);
552
+ const ret = typeof(obj) === 'number' ? obj : undefined;
553
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
554
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
555
+ };
556
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
557
+ const ret = getObject(arg0) === undefined;
558
+ return ret;
559
+ };
560
+ imports.wbg.__wbindgen_is_array = function(arg0) {
561
+ const ret = Array.isArray(getObject(arg0));
562
+ return ret;
563
+ };
564
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
565
+ const obj = takeObject(arg0).original;
566
+ if (obj.cnt-- == 1) {
567
+ obj.a = 0;
568
+ return true;
569
+ }
570
+ const ret = false;
571
+ return ret;
572
+ };
573
+ imports.wbg.__wbg_constructor_95333db3bb3f7aa0 = function(arg0) {
574
+ const ret = new Error(takeObject(arg0));
575
+ return addHeapObject(ret);
576
+ };
577
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
578
+ const obj = getObject(arg1);
579
+ const ret = typeof(obj) === 'string' ? obj : undefined;
580
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
581
+ var len1 = WASM_VECTOR_LEN;
582
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
583
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
584
+ };
585
+ imports.wbg.__wbg_new_dd47653ba06d189d = function() {
586
+ const ret = new Map();
587
+ return addHeapObject(ret);
588
+ };
589
+ imports.wbg.__wbindgen_number_new = function(arg0) {
590
+ const ret = arg0;
591
+ return addHeapObject(ret);
592
+ };
593
+ imports.wbg.__wbindgen_is_string = function(arg0) {
594
+ const ret = typeof(getObject(arg0)) === 'string';
595
+ return ret;
596
+ };
597
+ imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
598
+ const ret = new Error();
599
+ return addHeapObject(ret);
600
+ };
601
+ imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
602
+ const ret = getObject(arg1).stack;
603
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
604
+ const len1 = WASM_VECTOR_LEN;
605
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
606
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
607
+ };
608
+ imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
609
+ let deferred0_0;
610
+ let deferred0_1;
611
+ try {
612
+ deferred0_0 = arg0;
613
+ deferred0_1 = arg1;
614
+ console.error(getStringFromWasm0(arg0, arg1));
615
+ } finally {
616
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
617
+ }
618
+ };
619
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
620
+ const ret = BigInt.asUintN(64, arg0);
621
+ return addHeapObject(ret);
622
+ };
623
+ imports.wbg.__wbindgen_shr = function(arg0, arg1) {
624
+ const ret = getObject(arg0) >> getObject(arg1);
625
+ return addHeapObject(ret);
626
+ };
627
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
628
+ const ret = getObject(arg0) === getObject(arg1);
629
+ return ret;
630
+ };
631
+ imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
632
+ const ret = arg0;
633
+ return addHeapObject(ret);
634
+ };
635
+ imports.wbg.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
636
+ const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
637
+ return addHeapObject(ret);
638
+ };
639
+ imports.wbg.__wbindgen_ge = function(arg0, arg1) {
640
+ const ret = getObject(arg0) >= getObject(arg1);
641
+ return ret;
642
+ };
643
+ imports.wbg.__wbindgen_is_bigint = function(arg0) {
644
+ const ret = typeof(getObject(arg0)) === 'bigint';
645
+ return ret;
646
+ };
647
+ imports.wbg.__wbindgen_is_object = function(arg0) {
648
+ const val = getObject(arg0);
649
+ const ret = typeof(val) === 'object' && val !== null;
650
+ return ret;
651
+ };
652
+ imports.wbg.__wbindgen_is_function = function(arg0) {
653
+ const ret = typeof(getObject(arg0)) === 'function';
654
+ return ret;
655
+ };
656
+ imports.wbg.__wbg_instanceof_Global_68951a6a6244ac6e = function(arg0) {
657
+ let result;
658
+ try {
659
+ result = getObject(arg0) instanceof WebAssembly.Global;
660
+ } catch {
661
+ result = false;
662
+ }
663
+ const ret = result;
664
+ return ret;
665
+ };
666
+ imports.wbg.__wbg_static_accessor_SYMBOL_45d4d15e3c4aeb33 = function() {
667
+ const ret = Symbol;
668
+ return addHeapObject(ret);
669
+ };
670
+ imports.wbg.__wbindgen_is_symbol = function(arg0) {
671
+ const ret = typeof(getObject(arg0)) === 'symbol';
672
+ return ret;
673
+ };
674
+ imports.wbg.__wbg_getRandomValues_37fa2ca9e4e07fab = function() { return handleError(function (arg0, arg1) {
675
+ getObject(arg0).getRandomValues(getObject(arg1));
676
+ }, arguments) };
677
+ imports.wbg.__wbg_randomFillSync_dc1e9a60c158336d = function() { return handleError(function (arg0, arg1) {
678
+ getObject(arg0).randomFillSync(takeObject(arg1));
679
+ }, arguments) };
680
+ imports.wbg.__wbg_crypto_c48a774b022d20ac = function(arg0) {
681
+ const ret = getObject(arg0).crypto;
682
+ return addHeapObject(ret);
683
+ };
684
+ imports.wbg.__wbg_process_298734cf255a885d = function(arg0) {
685
+ const ret = getObject(arg0).process;
686
+ return addHeapObject(ret);
687
+ };
688
+ imports.wbg.__wbg_versions_e2e78e134e3e5d01 = function(arg0) {
689
+ const ret = getObject(arg0).versions;
690
+ return addHeapObject(ret);
691
+ };
692
+ imports.wbg.__wbg_node_1cd7a5d853dbea79 = function(arg0) {
693
+ const ret = getObject(arg0).node;
694
+ return addHeapObject(ret);
695
+ };
696
+ imports.wbg.__wbg_msCrypto_bcb970640f50a1e8 = function(arg0) {
697
+ const ret = getObject(arg0).msCrypto;
698
+ return addHeapObject(ret);
699
+ };
700
+ imports.wbg.__wbg_require_8f08ceecec0f4fee = function() { return handleError(function () {
701
+ const ret = module.require;
702
+ return addHeapObject(ret);
703
+ }, arguments) };
704
+ imports.wbg.__wbg_debug_9b8701f894da9929 = function(arg0, arg1, arg2, arg3) {
705
+ console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
706
+ };
707
+ imports.wbg.__wbg_error_788ae33f81d3b84b = function(arg0) {
708
+ console.error(getObject(arg0));
709
+ };
710
+ imports.wbg.__wbg_error_d9bce418caafb712 = function(arg0, arg1, arg2, arg3) {
711
+ console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
712
+ };
713
+ imports.wbg.__wbg_info_bb52f40b06f679de = function(arg0, arg1, arg2, arg3) {
714
+ console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
715
+ };
716
+ imports.wbg.__wbg_log_ea7093e35e3efd07 = function(arg0, arg1, arg2, arg3) {
717
+ console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
718
+ };
719
+ imports.wbg.__wbg_warn_dfc0e0cf544a13bd = function(arg0, arg1, arg2, arg3) {
720
+ console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
721
+ };
722
+ imports.wbg.__wbg_get_44be0491f933a435 = function(arg0, arg1) {
723
+ const ret = getObject(arg0)[arg1 >>> 0];
724
+ return addHeapObject(ret);
725
+ };
726
+ imports.wbg.__wbg_length_fff51ee6522a1a18 = function(arg0) {
727
+ const ret = getObject(arg0).length;
728
+ return ret;
729
+ };
730
+ imports.wbg.__wbg_new_898a68150f225f2e = function() {
731
+ const ret = new Array();
732
+ return addHeapObject(ret);
733
+ };
734
+ imports.wbg.__wbg_BigInt_025925c4804d8575 = function(arg0) {
735
+ const ret = BigInt(getObject(arg0));
736
+ return addHeapObject(ret);
737
+ };
738
+ imports.wbg.__wbg_newnoargs_581967eacc0e2604 = function(arg0, arg1) {
739
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
740
+ return addHeapObject(ret);
741
+ };
742
+ imports.wbg.__wbg_get_97b561fb56f034b5 = function() { return handleError(function (arg0, arg1) {
743
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
744
+ return addHeapObject(ret);
745
+ }, arguments) };
746
+ imports.wbg.__wbg_call_cb65541d95d71282 = function() { return handleError(function (arg0, arg1) {
747
+ const ret = getObject(arg0).call(getObject(arg1));
748
+ return addHeapObject(ret);
749
+ }, arguments) };
750
+ imports.wbg.__wbg_new_b51585de1b234aff = function() {
751
+ const ret = new Object();
752
+ return addHeapObject(ret);
753
+ };
754
+ imports.wbg.__wbg_self_1ff1d729e9aae938 = function() { return handleError(function () {
755
+ const ret = self.self;
756
+ return addHeapObject(ret);
757
+ }, arguments) };
758
+ imports.wbg.__wbg_window_5f4faef6c12b79ec = function() { return handleError(function () {
759
+ const ret = window.window;
760
+ return addHeapObject(ret);
761
+ }, arguments) };
762
+ imports.wbg.__wbg_globalThis_1d39714405582d3c = function() { return handleError(function () {
763
+ const ret = globalThis.globalThis;
764
+ return addHeapObject(ret);
765
+ }, arguments) };
766
+ imports.wbg.__wbg_global_651f05c6a0944d1c = function() { return handleError(function () {
767
+ const ret = global.global;
768
+ return addHeapObject(ret);
769
+ }, arguments) };
770
+ imports.wbg.__wbg_newwithlength_3ec098a360da1909 = function(arg0) {
771
+ const ret = new Array(arg0 >>> 0);
772
+ return addHeapObject(ret);
773
+ };
774
+ imports.wbg.__wbg_set_502d29070ea18557 = function(arg0, arg1, arg2) {
775
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
776
+ };
777
+ imports.wbg.__wbg_from_d7c216d4616bb368 = function(arg0) {
778
+ const ret = Array.from(getObject(arg0));
779
+ return addHeapObject(ret);
780
+ };
781
+ imports.wbg.__wbg_push_ca1c26067ef907ac = function(arg0, arg1) {
782
+ const ret = getObject(arg0).push(getObject(arg1));
783
+ return ret;
784
+ };
785
+ imports.wbg.__wbg_byteLength_0488a7a303dccf40 = function(arg0) {
786
+ const ret = getObject(arg0).byteLength;
787
+ return ret;
788
+ };
789
+ imports.wbg.__wbg_toString_26c114c5f3052ff5 = function(arg0, arg1, arg2) {
790
+ const ret = getObject(arg1).toString(arg2);
791
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
792
+ const len1 = WASM_VECTOR_LEN;
793
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
794
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
795
+ };
796
+ imports.wbg.__wbg_new_d258248ed531ff54 = function(arg0, arg1) {
797
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
798
+ return addHeapObject(ret);
799
+ };
800
+ imports.wbg.__wbg_setcause_a60925f08b71876d = function(arg0, arg1) {
801
+ getObject(arg0).cause = getObject(arg1);
802
+ };
803
+ imports.wbg.__wbg_instanceof_Function_3021b2be9300e7a7 = function(arg0) {
804
+ let result;
805
+ try {
806
+ result = getObject(arg0) instanceof Function;
807
+ } catch {
808
+ result = false;
809
+ }
810
+ const ret = result;
811
+ return ret;
812
+ };
813
+ imports.wbg.__wbg_call_01734de55d61e11d = function() { return handleError(function (arg0, arg1, arg2) {
814
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
815
+ return addHeapObject(ret);
816
+ }, arguments) };
817
+ imports.wbg.__wbg_call_4c92f6aec1e1d6e6 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
818
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
819
+ return addHeapObject(ret);
820
+ }, arguments) };
821
+ imports.wbg.__wbg_bind_f9d2c8ec337bbbe7 = function(arg0, arg1, arg2) {
822
+ const ret = getObject(arg0).bind(getObject(arg1), getObject(arg2));
823
+ return addHeapObject(ret);
824
+ };
825
+ imports.wbg.__wbg_bind_60a9a80cada2f33c = function(arg0, arg1, arg2, arg3) {
826
+ const ret = getObject(arg0).bind(getObject(arg1), getObject(arg2), getObject(arg3));
827
+ return addHeapObject(ret);
828
+ };
829
+ imports.wbg.__wbg_forEach_d3ffcb118358250b = function(arg0, arg1, arg2) {
830
+ try {
831
+ var state0 = {a: arg1, b: arg2};
832
+ var cb0 = (arg0, arg1) => {
833
+ const a = state0.a;
834
+ state0.a = 0;
835
+ try {
836
+ return __wbg_adapter_148(a, state0.b, arg0, arg1);
837
+ } finally {
838
+ state0.a = a;
839
+ }
840
+ };
841
+ getObject(arg0).forEach(cb0);
842
+ } finally {
843
+ state0.a = state0.b = 0;
844
+ }
845
+ };
846
+ imports.wbg.__wbg_set_bedc3d02d0f05eb0 = function(arg0, arg1, arg2) {
847
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
848
+ return addHeapObject(ret);
849
+ };
850
+ imports.wbg.__wbg_constructor_47e9bb352faf1649 = function(arg0) {
851
+ const ret = getObject(arg0).constructor;
852
+ return addHeapObject(ret);
853
+ };
854
+ imports.wbg.__wbg_new_43f1b47c28813cbd = function(arg0, arg1) {
855
+ try {
856
+ var state0 = {a: arg0, b: arg1};
857
+ var cb0 = (arg0, arg1) => {
858
+ const a = state0.a;
859
+ state0.a = 0;
860
+ try {
861
+ return __wbg_adapter_148(a, state0.b, arg0, arg1);
862
+ } finally {
863
+ state0.a = a;
864
+ }
865
+ };
866
+ const ret = new Promise(cb0);
867
+ return addHeapObject(ret);
868
+ } finally {
869
+ state0.a = state0.b = 0;
870
+ }
871
+ };
872
+ imports.wbg.__wbg_resolve_53698b95aaf7fcf8 = function(arg0) {
873
+ const ret = Promise.resolve(getObject(arg0));
874
+ return addHeapObject(ret);
875
+ };
876
+ imports.wbg.__wbg_then_f7e06ee3c11698eb = function(arg0, arg1) {
877
+ const ret = getObject(arg0).then(getObject(arg1));
878
+ return addHeapObject(ret);
879
+ };
880
+ imports.wbg.__wbg_then_b2267541e2a73865 = function(arg0, arg1, arg2) {
881
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
882
+ return addHeapObject(ret);
883
+ };
884
+ imports.wbg.__wbg_buffer_085ec1f694018c4f = function(arg0) {
885
+ const ret = getObject(arg0).buffer;
886
+ return addHeapObject(ret);
887
+ };
888
+ imports.wbg.__wbg_newwithbyteoffsetandlength_6da8e527659b86aa = function(arg0, arg1, arg2) {
889
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
890
+ return addHeapObject(ret);
891
+ };
892
+ imports.wbg.__wbg_new_8125e318e6245eed = function(arg0) {
893
+ const ret = new Uint8Array(getObject(arg0));
894
+ return addHeapObject(ret);
895
+ };
896
+ imports.wbg.__wbg_set_5cf90238115182c3 = function(arg0, arg1, arg2) {
897
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
898
+ };
899
+ imports.wbg.__wbg_length_72e2208bbc0efc61 = function(arg0) {
900
+ const ret = getObject(arg0).length;
901
+ return ret;
902
+ };
903
+ imports.wbg.__wbg_newwithlength_e5d69174d6984cd7 = function(arg0) {
904
+ const ret = new Uint8Array(arg0 >>> 0);
905
+ return addHeapObject(ret);
906
+ };
907
+ imports.wbg.__wbg_subarray_13db269f57aa838d = function(arg0, arg1, arg2) {
908
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
909
+ return addHeapObject(ret);
910
+ };
911
+ imports.wbg.__wbg_compile_0ef211355a4ebea3 = function(arg0) {
912
+ const ret = WebAssembly.compile(getObject(arg0));
913
+ return addHeapObject(ret);
914
+ };
915
+ imports.wbg.__wbg_instantiate_8900c71988551df8 = function(arg0, arg1) {
916
+ const ret = WebAssembly.instantiate(getObject(arg0), getObject(arg1));
917
+ return addHeapObject(ret);
918
+ };
919
+ imports.wbg.__wbg_exports_9484b00cdfd311fc = function(arg0) {
920
+ const ret = getObject(arg0).exports;
921
+ return addHeapObject(ret);
922
+ };
923
+ imports.wbg.__wbg_exports_b7984a3120d6aba2 = function(arg0) {
924
+ const ret = WebAssembly.Module.exports(getObject(arg0));
925
+ return addHeapObject(ret);
926
+ };
927
+ imports.wbg.__wbg_instanceof_Table_ba74319dfec929b1 = function(arg0) {
928
+ let result;
929
+ try {
930
+ result = getObject(arg0) instanceof WebAssembly.Table;
931
+ } catch {
932
+ result = false;
933
+ }
934
+ const ret = result;
935
+ return ret;
936
+ };
937
+ imports.wbg.__wbg_get_9bb402f6a9f0b436 = function() { return handleError(function (arg0, arg1) {
938
+ const ret = getObject(arg0).get(arg1 >>> 0);
939
+ return addHeapObject(ret);
940
+ }, arguments) };
941
+ imports.wbg.__wbg_instanceof_Memory_6b2a8e33c4176794 = function(arg0) {
942
+ let result;
943
+ try {
944
+ result = getObject(arg0) instanceof WebAssembly.Memory;
945
+ } catch {
946
+ result = false;
947
+ }
948
+ const ret = result;
949
+ return ret;
950
+ };
951
+ imports.wbg.__wbg_new_5514c0d576222fc2 = function() { return handleError(function (arg0) {
952
+ const ret = new WebAssembly.Memory(getObject(arg0));
953
+ return addHeapObject(ret);
954
+ }, arguments) };
955
+ imports.wbg.__wbg_apply_f9ecfcbfefaf7349 = function() { return handleError(function (arg0, arg1, arg2) {
956
+ const ret = Reflect.apply(getObject(arg0), getObject(arg1), getObject(arg2));
957
+ return addHeapObject(ret);
958
+ }, arguments) };
959
+ imports.wbg.__wbg_getPrototypeOf_2782f7ac7c421741 = function() { return handleError(function (arg0) {
960
+ const ret = Reflect.getPrototypeOf(getObject(arg0));
961
+ return addHeapObject(ret);
962
+ }, arguments) };
963
+ imports.wbg.__wbg_set_092e06b0f9d71865 = function() { return handleError(function (arg0, arg1, arg2) {
964
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
965
+ return ret;
966
+ }, arguments) };
967
+ imports.wbg.__wbg_parse_670c19d4e984792e = function() { return handleError(function (arg0, arg1) {
968
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
969
+ return addHeapObject(ret);
970
+ }, arguments) };
971
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
972
+ const v = getObject(arg1);
973
+ const ret = typeof(v) === 'bigint' ? v : undefined;
974
+ getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? BigInt(0) : ret;
975
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
976
+ };
977
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
978
+ const ret = debugString(getObject(arg1));
979
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
980
+ const len1 = WASM_VECTOR_LEN;
981
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
982
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
983
+ };
984
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
985
+ throw new Error(getStringFromWasm0(arg0, arg1));
986
+ };
987
+ imports.wbg.__wbindgen_memory = function() {
988
+ const ret = wasm.memory;
989
+ return addHeapObject(ret);
990
+ };
991
+ imports.wbg.__wbindgen_function_table = function() {
992
+ const ret = wasm.__wbindgen_export_2;
993
+ return addHeapObject(ret);
994
+ };
995
+ imports.wbg.__wbindgen_closure_wrapper765 = function(arg0, arg1, arg2) {
996
+ const ret = makeMutClosure(arg0, arg1, 228, __wbg_adapter_54);
997
+ return addHeapObject(ret);
998
+ };
999
+
1000
+ return imports;
1001
+ }
1002
+
1003
+ function __wbg_init_memory(imports, maybe_memory) {
1004
+
1005
+ }
1006
+
1007
+ function __wbg_finalize_init(instance, module) {
1008
+ wasm = instance.exports;
1009
+ __wbg_init.__wbindgen_wasm_module = module;
1010
+ cachedBigInt64Memory0 = null;
1011
+ cachedFloat64Memory0 = null;
1012
+ cachedInt32Memory0 = null;
1013
+ cachedUint8Memory0 = null;
1014
+
1015
+
1016
+ return wasm;
1017
+ }
1018
+
1019
+ function initSync(module) {
1020
+ if (wasm !== undefined) return wasm;
1021
+
1022
+ const imports = __wbg_get_imports();
1023
+
1024
+ __wbg_init_memory(imports);
1025
+
1026
+ if (!(module instanceof WebAssembly.Module)) {
1027
+ module = new WebAssembly.Module(module);
1028
+ }
1029
+
1030
+ const instance = new WebAssembly.Instance(module, imports);
1031
+
1032
+ return __wbg_finalize_init(instance, module);
1033
+ }
1034
+
1035
+ async function __wbg_init(input) {
1036
+ if (wasm !== undefined) return wasm;
1037
+
1038
+ if (typeof input === 'undefined') {
1039
+ input = new URL('acvm_js_bg.wasm', import.meta.url);
1040
+ }
1041
+ const imports = __wbg_get_imports();
1042
+
1043
+ if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
1044
+ input = fetch(input);
1045
+ }
1046
+
1047
+ __wbg_init_memory(imports);
1048
+
1049
+ const { instance, module } = await __wbg_load(await input, imports);
1050
+
1051
+ return __wbg_finalize_init(instance, module);
1052
+ }
1053
+
1054
+ export { initSync }
1055
+ export default __wbg_init;