@aztec/noir-acvm_js 0.0.1-commit.f146247c → 0.0.1-commit.f224bb98b

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 CHANGED
@@ -1,137 +1,615 @@
1
- let wasm;
1
+ /* @ts-self-types="./acvm_js.d.ts" */
2
2
 
3
- function addToExternrefTable0(obj) {
4
- const idx = wasm.__externref_table_alloc();
5
- wasm.__wbindgen_export_2.set(idx, obj);
6
- return idx;
3
+ /**
4
+ * Performs a bitwise AND operation between `lhs` and `rhs`
5
+ * @param {string} lhs
6
+ * @param {string} rhs
7
+ * @returns {string}
8
+ */
9
+ export function and(lhs, rhs) {
10
+ const ret = wasm.and(lhs, rhs);
11
+ return ret;
7
12
  }
8
13
 
9
- function handleError(f, args) {
10
- try {
11
- return f.apply(this, args);
12
- } catch (e) {
13
- const idx = addToExternrefTable0(e);
14
- wasm.__wbindgen_exn_store(idx);
15
- }
14
+ /**
15
+ * Calculates the Blake2s256 hash of the input bytes
16
+ * @param {Uint8Array} inputs
17
+ * @returns {Uint8Array}
18
+ */
19
+ export function blake2s256(inputs) {
20
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
21
+ const len0 = WASM_VECTOR_LEN;
22
+ const ret = wasm.blake2s256(ptr0, len0);
23
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
24
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
25
+ return v2;
16
26
  }
17
27
 
18
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
28
+ /**
29
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
30
+ * @returns {BuildInfo} - Information on how the installed package was built.
31
+ */
32
+ export function buildInfo() {
33
+ const ret = wasm.buildInfo();
34
+ return ret;
35
+ }
19
36
 
20
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
37
+ /**
38
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
39
+ *
40
+ * @param {WitnessMap} witness_map - A witness map.
41
+ * @returns {Uint8Array} A compressed witness map
42
+ */
43
+ export function compressWitness(witness_map) {
44
+ const ret = wasm.compressWitness(witness_map);
45
+ if (ret[3]) {
46
+ throw takeFromExternrefTable0(ret[2]);
47
+ }
48
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
49
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
50
+ return v1;
51
+ }
21
52
 
22
- let cachedUint8ArrayMemory0 = null;
53
+ /**
54
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
55
+ *
56
+ * @param {WitnessStack} witness_stack - A witness stack.
57
+ * @returns {Uint8Array} A compressed witness stack
58
+ */
59
+ export function compressWitnessStack(witness_stack) {
60
+ const ret = wasm.compressWitnessStack(witness_stack);
61
+ if (ret[3]) {
62
+ throw takeFromExternrefTable0(ret[2]);
63
+ }
64
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
65
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
66
+ return v1;
67
+ }
23
68
 
24
- function getUint8ArrayMemory0() {
25
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
26
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
69
+ /**
70
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
71
+ * This should be used to only fetch the witness map for the main function.
72
+ *
73
+ * @param {Uint8Array} compressed_witness - A compressed witness.
74
+ * @returns {WitnessMap} The decompressed witness map.
75
+ */
76
+ export function decompressWitness(compressed_witness) {
77
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
78
+ const len0 = WASM_VECTOR_LEN;
79
+ const ret = wasm.decompressWitness(ptr0, len0);
80
+ if (ret[2]) {
81
+ throw takeFromExternrefTable0(ret[1]);
27
82
  }
28
- return cachedUint8ArrayMemory0;
83
+ return takeFromExternrefTable0(ret[0]);
29
84
  }
30
85
 
31
- function getStringFromWasm0(ptr, len) {
32
- ptr = ptr >>> 0;
33
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
86
+ /**
87
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
88
+ *
89
+ * @param {Uint8Array} compressed_witness - A compressed witness.
90
+ * @returns {WitnessStack} The decompressed witness stack.
91
+ */
92
+ export function decompressWitnessStack(compressed_witness) {
93
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
94
+ const len0 = WASM_VECTOR_LEN;
95
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
96
+ if (ret[2]) {
97
+ throw takeFromExternrefTable0(ret[1]);
98
+ }
99
+ return takeFromExternrefTable0(ret[0]);
34
100
  }
35
101
 
36
- let WASM_VECTOR_LEN = 0;
102
+ /**
103
+ * Verifies a ECDSA signature over the secp256k1 curve.
104
+ * @param {Uint8Array} hashed_msg
105
+ * @param {Uint8Array} public_key_x_bytes
106
+ * @param {Uint8Array} public_key_y_bytes
107
+ * @param {Uint8Array} signature
108
+ * @returns {boolean}
109
+ */
110
+ export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
111
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
112
+ const len0 = WASM_VECTOR_LEN;
113
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
114
+ const len1 = WASM_VECTOR_LEN;
115
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
116
+ const len2 = WASM_VECTOR_LEN;
117
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
118
+ const len3 = WASM_VECTOR_LEN;
119
+ const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
120
+ return ret !== 0;
121
+ }
37
122
 
38
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
123
+ /**
124
+ * Verifies a ECDSA signature over the secp256r1 curve.
125
+ * @param {Uint8Array} hashed_msg
126
+ * @param {Uint8Array} public_key_x_bytes
127
+ * @param {Uint8Array} public_key_y_bytes
128
+ * @param {Uint8Array} signature
129
+ * @returns {boolean}
130
+ */
131
+ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
132
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
133
+ const len0 = WASM_VECTOR_LEN;
134
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
135
+ const len1 = WASM_VECTOR_LEN;
136
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
137
+ const len2 = WASM_VECTOR_LEN;
138
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
139
+ const len3 = WASM_VECTOR_LEN;
140
+ const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
141
+ return ret !== 0;
142
+ }
39
143
 
40
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
41
- ? function (arg, view) {
42
- return cachedTextEncoder.encodeInto(arg, view);
144
+ /**
145
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
146
+ *
147
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
148
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
149
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
150
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
151
+ */
152
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
153
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
154
+ const len0 = WASM_VECTOR_LEN;
155
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
156
+ return ret;
43
157
  }
44
- : function (arg, view) {
45
- const buf = cachedTextEncoder.encode(arg);
46
- view.set(buf);
47
- return {
48
- read: arg.length,
49
- written: buf.length
50
- };
51
- });
52
158
 
53
- function passStringToWasm0(arg, malloc, realloc) {
159
+ /**
160
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
161
+ * This method also extracts the public return values from the solved witness into its own return witness.
162
+ *
163
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
164
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
165
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
166
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
167
+ */
168
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
169
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
170
+ const len0 = WASM_VECTOR_LEN;
171
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
172
+ return ret;
173
+ }
54
174
 
55
- if (realloc === undefined) {
56
- const buf = cachedTextEncoder.encode(arg);
57
- const ptr = malloc(buf.length, 1) >>> 0;
58
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
59
- WASM_VECTOR_LEN = buf.length;
60
- return ptr;
61
- }
175
+ /**
176
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
177
+ *
178
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
179
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
180
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
181
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
182
+ */
183
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
184
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
185
+ const len0 = WASM_VECTOR_LEN;
186
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
187
+ return ret;
188
+ }
62
189
 
63
- let len = arg.length;
64
- let ptr = malloc(len, 1) >>> 0;
190
+ /**
191
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
192
+ *
193
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
194
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
195
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
196
+ * @param {Uint8Array} program
197
+ * @param {WitnessMap} solved_witness
198
+ * @returns {WitnessMap}
199
+ */
200
+ export function getPublicParametersWitness(program, solved_witness) {
201
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
202
+ const len0 = WASM_VECTOR_LEN;
203
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
204
+ if (ret[2]) {
205
+ throw takeFromExternrefTable0(ret[1]);
206
+ }
207
+ return takeFromExternrefTable0(ret[0]);
208
+ }
65
209
 
66
- const mem = getUint8ArrayMemory0();
210
+ /**
211
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
212
+ *
213
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
214
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
215
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
216
+ * @param {Uint8Array} program
217
+ * @param {WitnessMap} solved_witness
218
+ * @returns {WitnessMap}
219
+ */
220
+ export function getPublicWitness(program, solved_witness) {
221
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
222
+ const len0 = WASM_VECTOR_LEN;
223
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
224
+ if (ret[2]) {
225
+ throw takeFromExternrefTable0(ret[1]);
226
+ }
227
+ return takeFromExternrefTable0(ret[0]);
228
+ }
67
229
 
68
- let offset = 0;
230
+ /**
231
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
232
+ *
233
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
234
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
235
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
236
+ * @param {Uint8Array} program
237
+ * @param {WitnessMap} witness_map
238
+ * @returns {WitnessMap}
239
+ */
240
+ export function getReturnWitness(program, witness_map) {
241
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
242
+ const len0 = WASM_VECTOR_LEN;
243
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
244
+ if (ret[2]) {
245
+ throw takeFromExternrefTable0(ret[1]);
246
+ }
247
+ return takeFromExternrefTable0(ret[0]);
248
+ }
69
249
 
70
- for (; offset < len; offset++) {
71
- const code = arg.charCodeAt(offset);
72
- if (code > 0x7F) break;
73
- mem[ptr + offset] = code;
250
+ /**
251
+ * Sets the package's logging level.
252
+ *
253
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
254
+ */
255
+ export function initLogLevel(filter) {
256
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
257
+ const len0 = WASM_VECTOR_LEN;
258
+ const ret = wasm.initLogLevel(ptr0, len0);
259
+ if (ret[1]) {
260
+ throw takeFromExternrefTable0(ret[0]);
74
261
  }
262
+ }
75
263
 
76
- if (offset !== len) {
77
- if (offset !== 0) {
78
- arg = arg.slice(offset);
79
- }
80
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
81
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
82
- const ret = encodeString(arg, view);
264
+ /**
265
+ * Sha256 compression function
266
+ * @param {Uint32Array} inputs
267
+ * @param {Uint32Array} state
268
+ * @returns {Uint32Array}
269
+ */
270
+ export function sha256_compression(inputs, state) {
271
+ const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
272
+ const len0 = WASM_VECTOR_LEN;
273
+ const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
274
+ const len1 = WASM_VECTOR_LEN;
275
+ const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
276
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
277
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
278
+ return v3;
279
+ }
280
+
281
+ /**
282
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
283
+ * @param {string} lhs
284
+ * @param {string} rhs
285
+ * @returns {string}
286
+ */
287
+ export function xor(lhs, rhs) {
288
+ const ret = wasm.xor(lhs, rhs);
289
+ return ret;
290
+ }
291
+
292
+ function __wbg_get_imports() {
293
+ const import0 = {
294
+ __proto__: null,
295
+ __wbg___wbindgen_debug_string_ddde1867f49c2442: function(arg0, arg1) {
296
+ const ret = debugString(arg1);
297
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
298
+ const len1 = WASM_VECTOR_LEN;
299
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
300
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
301
+ },
302
+ __wbg___wbindgen_is_function_d633e708baf0d146: function(arg0) {
303
+ const ret = typeof(arg0) === 'function';
304
+ return ret;
305
+ },
306
+ __wbg___wbindgen_is_string_7debe47dc1e045c2: function(arg0) {
307
+ const ret = typeof(arg0) === 'string';
308
+ return ret;
309
+ },
310
+ __wbg___wbindgen_is_undefined_c18285b9fc34cb7d: function(arg0) {
311
+ const ret = arg0 === undefined;
312
+ return ret;
313
+ },
314
+ __wbg___wbindgen_number_get_5854912275df1894: function(arg0, arg1) {
315
+ const obj = arg1;
316
+ const ret = typeof(obj) === 'number' ? obj : undefined;
317
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
318
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
319
+ },
320
+ __wbg___wbindgen_string_get_3e5751597f39a112: function(arg0, arg1) {
321
+ const obj = arg1;
322
+ const ret = typeof(obj) === 'string' ? obj : undefined;
323
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
324
+ var len1 = WASM_VECTOR_LEN;
325
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
326
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
327
+ },
328
+ __wbg___wbindgen_throw_39bc967c0e5a9b58: function(arg0, arg1) {
329
+ throw new Error(getStringFromWasm0(arg0, arg1));
330
+ },
331
+ __wbg__wbg_cb_unref_b6d832240a919168: function(arg0) {
332
+ arg0._wbg_cb_unref();
333
+ },
334
+ __wbg_call_08ad0d89caa7cb79: function() { return handleError(function (arg0, arg1, arg2) {
335
+ const ret = arg0.call(arg1, arg2);
336
+ return ret;
337
+ }, arguments); },
338
+ __wbg_call_c974f0bf2231552e: function() { return handleError(function (arg0, arg1, arg2, arg3) {
339
+ const ret = arg0.call(arg1, arg2, arg3);
340
+ return ret;
341
+ }, arguments); },
342
+ __wbg_constructor_78e91522c0c3d715: function(arg0) {
343
+ const ret = new Error(arg0);
344
+ return ret;
345
+ },
346
+ __wbg_constructor_d2b676f9277a8e3c: function(arg0) {
347
+ const ret = new Error(arg0);
348
+ return ret;
349
+ },
350
+ __wbg_debug_8804c16f548276da: function(arg0, arg1, arg2, arg3) {
351
+ console.debug(arg0, arg1, arg2, arg3);
352
+ },
353
+ __wbg_debug_e69ad32e6af73f94: function(arg0) {
354
+ console.debug(arg0);
355
+ },
356
+ __wbg_error_91d10625a3b36a08: function(arg0, arg1, arg2, arg3) {
357
+ console.error(arg0, arg1, arg2, arg3);
358
+ },
359
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
360
+ let deferred0_0;
361
+ let deferred0_1;
362
+ try {
363
+ deferred0_0 = arg0;
364
+ deferred0_1 = arg1;
365
+ console.error(getStringFromWasm0(arg0, arg1));
366
+ } finally {
367
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
368
+ }
369
+ },
370
+ __wbg_error_ad28debb48b5c6bb: function(arg0) {
371
+ console.error(arg0);
372
+ },
373
+ __wbg_forEach_9694464cb60ea370: function(arg0, arg1, arg2) {
374
+ try {
375
+ var state0 = {a: arg1, b: arg2};
376
+ var cb0 = (arg0, arg1) => {
377
+ const a = state0.a;
378
+ state0.a = 0;
379
+ try {
380
+ return wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(a, state0.b, arg0, arg1);
381
+ } finally {
382
+ state0.a = a;
383
+ }
384
+ };
385
+ arg0.forEach(cb0);
386
+ } finally {
387
+ state0.a = state0.b = 0;
388
+ }
389
+ },
390
+ __wbg_forEach_f33e388a24ae7d4f: function(arg0, arg1, arg2) {
391
+ try {
392
+ var state0 = {a: arg1, b: arg2};
393
+ var cb0 = (arg0, arg1, arg2) => {
394
+ const a = state0.a;
395
+ state0.a = 0;
396
+ try {
397
+ return wasm_bindgen__convert__closures_____invoke__h149dcfc5e545a40e(a, state0.b, arg0, arg1, arg2);
398
+ } finally {
399
+ state0.a = a;
400
+ }
401
+ };
402
+ arg0.forEach(cb0);
403
+ } finally {
404
+ state0.a = state0.b = 0;
405
+ }
406
+ },
407
+ __wbg_fromEntries_2f51c4024e2a7aa3: function() { return handleError(function (arg0) {
408
+ const ret = Object.fromEntries(arg0);
409
+ return ret;
410
+ }, arguments); },
411
+ __wbg_from_d7e888a2e9063b32: function(arg0) {
412
+ const ret = Array.from(arg0);
413
+ return ret;
414
+ },
415
+ __wbg_get_f09c3a16f8848381: function(arg0, arg1) {
416
+ const ret = arg0[arg1 >>> 0];
417
+ return ret;
418
+ },
419
+ __wbg_get_unchecked_3d0f4b91c8eca4f0: function(arg0, arg1) {
420
+ const ret = arg0[arg1 >>> 0];
421
+ return ret;
422
+ },
423
+ __wbg_info_28d530adaabdab8c: function(arg0, arg1, arg2, arg3) {
424
+ console.info(arg0, arg1, arg2, arg3);
425
+ },
426
+ __wbg_info_72e7e65fa3fc8b25: function(arg0) {
427
+ console.info(arg0);
428
+ },
429
+ __wbg_isArray_581b02d0060c9728: function(arg0) {
430
+ const ret = Array.isArray(arg0);
431
+ return ret;
432
+ },
433
+ __wbg_length_a31e05262e09b7f8: function(arg0) {
434
+ const ret = arg0.length;
435
+ return ret;
436
+ },
437
+ __wbg_new_1213b57bccbdbb66: function(arg0, arg1) {
438
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
439
+ return ret;
440
+ },
441
+ __wbg_new_1faa82fcea3a8b7d: function() {
442
+ const ret = new Map();
443
+ return ret;
444
+ },
445
+ __wbg_new_227d7c05414eb861: function() {
446
+ const ret = new Error();
447
+ return ret;
448
+ },
449
+ __wbg_new_92df58a8ec3bfb6b: function() {
450
+ const ret = new Map();
451
+ return ret;
452
+ },
453
+ __wbg_new_cb7a57a3ce49e647: function() {
454
+ const ret = new Array();
455
+ return ret;
456
+ },
457
+ __wbg_new_cbee8c0d5c479eac: function() {
458
+ const ret = new Array();
459
+ return ret;
460
+ },
461
+ __wbg_new_typed_8258a0d8488ef2a2: function(arg0, arg1) {
462
+ try {
463
+ var state0 = {a: arg0, b: arg1};
464
+ var cb0 = (arg0, arg1) => {
465
+ const a = state0.a;
466
+ state0.a = 0;
467
+ try {
468
+ return wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2_21(a, state0.b, arg0, arg1);
469
+ } finally {
470
+ state0.a = a;
471
+ }
472
+ };
473
+ const ret = new Promise(cb0);
474
+ return ret;
475
+ } finally {
476
+ state0.a = state0.b = 0;
477
+ }
478
+ },
479
+ __wbg_parse_6dfe891b5bafb5cd: function() { return handleError(function (arg0, arg1) {
480
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
481
+ return ret;
482
+ }, arguments); },
483
+ __wbg_push_a6f9488ffd3fae3b: function(arg0, arg1) {
484
+ const ret = arg0.push(arg1);
485
+ return ret;
486
+ },
487
+ __wbg_queueMicrotask_2c8dfd1056f24fdc: function(arg0) {
488
+ const ret = arg0.queueMicrotask;
489
+ return ret;
490
+ },
491
+ __wbg_queueMicrotask_8985ad63815852e7: function(arg0) {
492
+ queueMicrotask(arg0);
493
+ },
494
+ __wbg_resolve_5d61e0d10c14730a: function(arg0) {
495
+ const ret = Promise.resolve(arg0);
496
+ return ret;
497
+ },
498
+ __wbg_reverse_fcf59127ee940f96: function(arg0) {
499
+ const ret = arg0.reverse();
500
+ return ret;
501
+ },
502
+ __wbg_set_bad5c505cc70b5f8: function() { return handleError(function (arg0, arg1, arg2) {
503
+ const ret = Reflect.set(arg0, arg1, arg2);
504
+ return ret;
505
+ }, arguments); },
506
+ __wbg_set_cause_7f44b7881bde2bb6: function(arg0, arg1) {
507
+ arg0.cause = arg1;
508
+ },
509
+ __wbg_set_cfc6de03f990decf: function(arg0, arg1, arg2) {
510
+ const ret = arg0.set(arg1, arg2);
511
+ return ret;
512
+ },
513
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
514
+ const ret = arg1.stack;
515
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
516
+ const len1 = WASM_VECTOR_LEN;
517
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
518
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
519
+ },
520
+ __wbg_static_accessor_GLOBAL_THIS_14325d8cca34bb77: function() {
521
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
522
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
523
+ },
524
+ __wbg_static_accessor_GLOBAL_f3a1e69f9c5a7e8e: function() {
525
+ const ret = typeof global === 'undefined' ? null : global;
526
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
527
+ },
528
+ __wbg_static_accessor_SELF_50cdb5b517789aca: function() {
529
+ const ret = typeof self === 'undefined' ? null : self;
530
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
531
+ },
532
+ __wbg_static_accessor_WINDOW_d6c4126e4c244380: function() {
533
+ const ret = typeof window === 'undefined' ? null : window;
534
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
535
+ },
536
+ __wbg_then_d4163530723f56f4: function(arg0, arg1, arg2) {
537
+ const ret = arg0.then(arg1, arg2);
538
+ return ret;
539
+ },
540
+ __wbg_then_f1c954fe00733701: function(arg0, arg1) {
541
+ const ret = arg0.then(arg1);
542
+ return ret;
543
+ },
544
+ __wbg_values_623449cff68c6e40: function(arg0) {
545
+ const ret = Object.values(arg0);
546
+ return ret;
547
+ },
548
+ __wbg_warn_2540fe736f19ad5c: function(arg0, arg1, arg2, arg3) {
549
+ console.warn(arg0, arg1, arg2, arg3);
550
+ },
551
+ __wbg_warn_3310c7343993c074: function(arg0) {
552
+ console.warn(arg0);
553
+ },
554
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
555
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 464, function: Function { arguments: [Externref], shim_idx: 465, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
556
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h589cd82bcdcce84d, wasm_bindgen__convert__closures_____invoke__hd0bc2cf4f980f051);
557
+ return ret;
558
+ },
559
+ __wbindgen_cast_0000000000000002: function(arg0) {
560
+ // Cast intrinsic for `F64 -> Externref`.
561
+ const ret = arg0;
562
+ return ret;
563
+ },
564
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
565
+ // Cast intrinsic for `Ref(String) -> Externref`.
566
+ const ret = getStringFromWasm0(arg0, arg1);
567
+ return ret;
568
+ },
569
+ __wbindgen_init_externref_table: function() {
570
+ const table = wasm.__wbindgen_externrefs;
571
+ const offset = table.grow(4);
572
+ table.set(0, undefined);
573
+ table.set(offset + 0, undefined);
574
+ table.set(offset + 1, null);
575
+ table.set(offset + 2, true);
576
+ table.set(offset + 3, false);
577
+ },
578
+ };
579
+ return {
580
+ __proto__: null,
581
+ "./acvm_js_bg.js": import0,
582
+ };
583
+ }
83
584
 
84
- offset += ret.written;
85
- ptr = realloc(ptr, len, offset, 1) >>> 0;
585
+ function wasm_bindgen__convert__closures_____invoke__hd0bc2cf4f980f051(arg0, arg1, arg2) {
586
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hd0bc2cf4f980f051(arg0, arg1, arg2);
587
+ if (ret[1]) {
588
+ throw takeFromExternrefTable0(ret[0]);
86
589
  }
590
+ }
87
591
 
88
- WASM_VECTOR_LEN = offset;
89
- return ptr;
592
+ function wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(arg0, arg1, arg2, arg3) {
593
+ wasm.wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2(arg0, arg1, arg2, arg3);
90
594
  }
91
595
 
92
- let cachedDataViewMemory0 = null;
596
+ function wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2_21(arg0, arg1, arg2, arg3) {
597
+ wasm.wasm_bindgen__convert__closures_____invoke__h5a259cce50f322a2_21(arg0, arg1, arg2, arg3);
598
+ }
93
599
 
94
- function getDataViewMemory0() {
95
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
96
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
97
- }
98
- return cachedDataViewMemory0;
600
+ function wasm_bindgen__convert__closures_____invoke__h149dcfc5e545a40e(arg0, arg1, arg2, arg3, arg4) {
601
+ wasm.wasm_bindgen__convert__closures_____invoke__h149dcfc5e545a40e(arg0, arg1, arg2, arg3, arg4);
99
602
  }
100
603
 
101
- function isLikeNone(x) {
102
- return x === undefined || x === null;
604
+ function addToExternrefTable0(obj) {
605
+ const idx = wasm.__externref_table_alloc();
606
+ wasm.__wbindgen_externrefs.set(idx, obj);
607
+ return idx;
103
608
  }
104
609
 
105
610
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
106
611
  ? { register: () => {}, unregister: () => {} }
107
- : new FinalizationRegistry(state => {
108
- wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b)
109
- });
110
-
111
- function makeMutClosure(arg0, arg1, dtor, f) {
112
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
113
- const real = (...args) => {
114
- // First up with a closure we increment the internal reference
115
- // count. This ensures that the Rust closure environment won't
116
- // be deallocated while we're invoking it.
117
- state.cnt++;
118
- const a = state.a;
119
- state.a = 0;
120
- try {
121
- return f(a, state.b, ...args);
122
- } finally {
123
- if (--state.cnt === 0) {
124
- wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
125
- CLOSURE_DTORS.unregister(state);
126
- } else {
127
- state.a = a;
128
- }
129
- }
130
- };
131
- real.original = state;
132
- CLOSURE_DTORS.register(real, state, state);
133
- return real;
134
- }
612
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
135
613
 
136
614
  function debugString(val) {
137
615
  // primitive types
@@ -197,120 +675,31 @@ function debugString(val) {
197
675
  // TODO we could test for more things here, like `Set`s and `Map`s.
198
676
  return className;
199
677
  }
200
- /**
201
- * Returns the `BuildInfo` object containing information about how the installed package was built.
202
- * @returns {BuildInfo} - Information on how the installed package was built.
203
- */
204
- export function buildInfo() {
205
- const ret = wasm.buildInfo();
206
- return ret;
207
- }
208
678
 
209
- function takeFromExternrefTable0(idx) {
210
- const value = wasm.__wbindgen_export_2.get(idx);
211
- wasm.__externref_table_dealloc(idx);
212
- return value;
679
+ function getArrayU32FromWasm0(ptr, len) {
680
+ ptr = ptr >>> 0;
681
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
213
682
  }
214
683
 
215
684
  function getArrayU8FromWasm0(ptr, len) {
216
685
  ptr = ptr >>> 0;
217
686
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
218
687
  }
219
- /**
220
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
221
- *
222
- * @param {WitnessMap} witness_map - A witness map.
223
- * @returns {Uint8Array} A compressed witness map
224
- */
225
- export function compressWitness(witness_map) {
226
- const ret = wasm.compressWitness(witness_map);
227
- if (ret[3]) {
228
- throw takeFromExternrefTable0(ret[2]);
229
- }
230
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
231
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
232
- return v1;
233
- }
234
-
235
- function passArray8ToWasm0(arg, malloc) {
236
- const ptr = malloc(arg.length * 1, 1) >>> 0;
237
- getUint8ArrayMemory0().set(arg, ptr / 1);
238
- WASM_VECTOR_LEN = arg.length;
239
- return ptr;
240
- }
241
- /**
242
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
243
- * This should be used to only fetch the witness map for the main function.
244
- *
245
- * @param {Uint8Array} compressed_witness - A compressed witness.
246
- * @returns {WitnessMap} The decompressed witness map.
247
- */
248
- export function decompressWitness(compressed_witness) {
249
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
250
- const len0 = WASM_VECTOR_LEN;
251
- const ret = wasm.decompressWitness(ptr0, len0);
252
- if (ret[2]) {
253
- throw takeFromExternrefTable0(ret[1]);
254
- }
255
- return takeFromExternrefTable0(ret[0]);
256
- }
257
-
258
- /**
259
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
260
- *
261
- * @param {WitnessStack} witness_stack - A witness stack.
262
- * @returns {Uint8Array} A compressed witness stack
263
- */
264
- export function compressWitnessStack(witness_stack) {
265
- const ret = wasm.compressWitnessStack(witness_stack);
266
- if (ret[3]) {
267
- throw takeFromExternrefTable0(ret[2]);
268
- }
269
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
270
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
271
- return v1;
272
- }
273
688
 
274
- /**
275
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
276
- *
277
- * @param {Uint8Array} compressed_witness - A compressed witness.
278
- * @returns {WitnessStack} The decompressed witness stack.
279
- */
280
- export function decompressWitnessStack(compressed_witness) {
281
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
282
- const len0 = WASM_VECTOR_LEN;
283
- const ret = wasm.decompressWitnessStack(ptr0, len0);
284
- if (ret[2]) {
285
- throw takeFromExternrefTable0(ret[1]);
689
+ let cachedDataViewMemory0 = null;
690
+ function getDataViewMemory0() {
691
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
692
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
286
693
  }
287
- return takeFromExternrefTable0(ret[0]);
288
- }
289
-
290
- /**
291
- * Performs a bitwise AND operation between `lhs` and `rhs`
292
- * @param {string} lhs
293
- * @param {string} rhs
294
- * @returns {string}
295
- */
296
- export function and(lhs, rhs) {
297
- const ret = wasm.and(lhs, rhs);
298
- return ret;
694
+ return cachedDataViewMemory0;
299
695
  }
300
696
 
301
- /**
302
- * Performs a bitwise XOR operation between `lhs` and `rhs`
303
- * @param {string} lhs
304
- * @param {string} rhs
305
- * @returns {string}
306
- */
307
- export function xor(lhs, rhs) {
308
- const ret = wasm.xor(lhs, rhs);
309
- return ret;
697
+ function getStringFromWasm0(ptr, len) {
698
+ ptr = ptr >>> 0;
699
+ return decodeText(ptr, len);
310
700
  }
311
701
 
312
702
  let cachedUint32ArrayMemory0 = null;
313
-
314
703
  function getUint32ArrayMemory0() {
315
704
  if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
316
705
  cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
@@ -318,220 +707,150 @@ function getUint32ArrayMemory0() {
318
707
  return cachedUint32ArrayMemory0;
319
708
  }
320
709
 
321
- function passArray32ToWasm0(arg, malloc) {
322
- const ptr = malloc(arg.length * 4, 4) >>> 0;
323
- getUint32ArrayMemory0().set(arg, ptr / 4);
324
- WASM_VECTOR_LEN = arg.length;
325
- return ptr;
710
+ let cachedUint8ArrayMemory0 = null;
711
+ function getUint8ArrayMemory0() {
712
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
713
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
714
+ }
715
+ return cachedUint8ArrayMemory0;
326
716
  }
327
717
 
328
- function getArrayU32FromWasm0(ptr, len) {
329
- ptr = ptr >>> 0;
330
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
331
- }
332
- /**
333
- * Sha256 compression function
334
- * @param {Uint32Array} inputs
335
- * @param {Uint32Array} state
336
- * @returns {Uint32Array}
337
- */
338
- export function sha256_compression(inputs, state) {
339
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
340
- const len0 = WASM_VECTOR_LEN;
341
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
342
- const len1 = WASM_VECTOR_LEN;
343
- const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
344
- var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
345
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
346
- return v3;
718
+ function handleError(f, args) {
719
+ try {
720
+ return f.apply(this, args);
721
+ } catch (e) {
722
+ const idx = addToExternrefTable0(e);
723
+ wasm.__wbindgen_exn_store(idx);
724
+ }
347
725
  }
348
726
 
349
- /**
350
- * Calculates the Blake2s256 hash of the input bytes
351
- * @param {Uint8Array} inputs
352
- * @returns {Uint8Array}
353
- */
354
- export function blake2s256(inputs) {
355
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
356
- const len0 = WASM_VECTOR_LEN;
357
- const ret = wasm.blake2s256(ptr0, len0);
358
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
359
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
360
- return v2;
727
+ function isLikeNone(x) {
728
+ return x === undefined || x === null;
361
729
  }
362
730
 
363
- /**
364
- * Verifies a ECDSA signature over the secp256k1 curve.
365
- * @param {Uint8Array} hashed_msg
366
- * @param {Uint8Array} public_key_x_bytes
367
- * @param {Uint8Array} public_key_y_bytes
368
- * @param {Uint8Array} signature
369
- * @returns {boolean}
370
- */
371
- export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
372
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
373
- const len0 = WASM_VECTOR_LEN;
374
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
375
- const len1 = WASM_VECTOR_LEN;
376
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
377
- const len2 = WASM_VECTOR_LEN;
378
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
379
- const len3 = WASM_VECTOR_LEN;
380
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
381
- return ret !== 0;
382
- }
731
+ function makeMutClosure(arg0, arg1, dtor, f) {
732
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
733
+ const real = (...args) => {
383
734
 
384
- /**
385
- * Verifies a ECDSA signature over the secp256r1 curve.
386
- * @param {Uint8Array} hashed_msg
387
- * @param {Uint8Array} public_key_x_bytes
388
- * @param {Uint8Array} public_key_y_bytes
389
- * @param {Uint8Array} signature
390
- * @returns {boolean}
391
- */
392
- export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
393
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
394
- const len0 = WASM_VECTOR_LEN;
395
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
396
- const len1 = WASM_VECTOR_LEN;
397
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
398
- const len2 = WASM_VECTOR_LEN;
399
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
400
- const len3 = WASM_VECTOR_LEN;
401
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
402
- return ret !== 0;
735
+ // First up with a closure we increment the internal reference
736
+ // count. This ensures that the Rust closure environment won't
737
+ // be deallocated while we're invoking it.
738
+ state.cnt++;
739
+ const a = state.a;
740
+ state.a = 0;
741
+ try {
742
+ return f(a, state.b, ...args);
743
+ } finally {
744
+ state.a = a;
745
+ real._wbg_cb_unref();
746
+ }
747
+ };
748
+ real._wbg_cb_unref = () => {
749
+ if (--state.cnt === 0) {
750
+ state.dtor(state.a, state.b);
751
+ state.a = 0;
752
+ CLOSURE_DTORS.unregister(state);
753
+ }
754
+ };
755
+ CLOSURE_DTORS.register(real, state, state);
756
+ return real;
403
757
  }
404
758
 
405
- /**
406
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
407
- *
408
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
409
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
410
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
411
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
412
- */
413
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
414
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
415
- const len0 = WASM_VECTOR_LEN;
416
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
417
- return ret;
759
+ function passArray32ToWasm0(arg, malloc) {
760
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
761
+ getUint32ArrayMemory0().set(arg, ptr / 4);
762
+ WASM_VECTOR_LEN = arg.length;
763
+ return ptr;
418
764
  }
419
765
 
420
- /**
421
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
422
- * This method also extracts the public return values from the solved witness into its own return witness.
423
- *
424
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
425
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
426
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
427
- * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
428
- */
429
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
430
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
431
- const len0 = WASM_VECTOR_LEN;
432
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
433
- return ret;
766
+ function passArray8ToWasm0(arg, malloc) {
767
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
768
+ getUint8ArrayMemory0().set(arg, ptr / 1);
769
+ WASM_VECTOR_LEN = arg.length;
770
+ return ptr;
434
771
  }
435
772
 
436
- /**
437
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
438
- *
439
- * @param {Uint8Array} program - A serialized representation of an ACIR program
440
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
441
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
442
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
443
- */
444
- export function executeProgram(program, initial_witness, foreign_call_handler) {
445
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
446
- const len0 = WASM_VECTOR_LEN;
447
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
448
- return ret;
449
- }
773
+ function passStringToWasm0(arg, malloc, realloc) {
774
+ if (realloc === undefined) {
775
+ const buf = cachedTextEncoder.encode(arg);
776
+ const ptr = malloc(buf.length, 1) >>> 0;
777
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
778
+ WASM_VECTOR_LEN = buf.length;
779
+ return ptr;
780
+ }
450
781
 
451
- /**
452
- * Sets the package's logging level.
453
- *
454
- * @param {LogLevel} level - The maximum level of logging to be emitted.
455
- */
456
- export function initLogLevel(filter) {
457
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
458
- const len0 = WASM_VECTOR_LEN;
459
- const ret = wasm.initLogLevel(ptr0, len0);
460
- if (ret[1]) {
461
- throw takeFromExternrefTable0(ret[0]);
782
+ let len = arg.length;
783
+ let ptr = malloc(len, 1) >>> 0;
784
+
785
+ const mem = getUint8ArrayMemory0();
786
+
787
+ let offset = 0;
788
+
789
+ for (; offset < len; offset++) {
790
+ const code = arg.charCodeAt(offset);
791
+ if (code > 0x7F) break;
792
+ mem[ptr + offset] = code;
462
793
  }
463
- }
794
+ if (offset !== len) {
795
+ if (offset !== 0) {
796
+ arg = arg.slice(offset);
797
+ }
798
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
799
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
800
+ const ret = cachedTextEncoder.encodeInto(arg, view);
464
801
 
465
- /**
466
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
467
- *
468
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
469
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
470
- * @returns {WitnessMap} A witness map containing the circuit's return values.
471
- * @param {Uint8Array} program
472
- * @param {WitnessMap} witness_map
473
- * @returns {WitnessMap}
474
- */
475
- export function getReturnWitness(program, witness_map) {
476
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
477
- const len0 = WASM_VECTOR_LEN;
478
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
479
- if (ret[2]) {
480
- throw takeFromExternrefTable0(ret[1]);
802
+ offset += ret.written;
803
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
481
804
  }
482
- return takeFromExternrefTable0(ret[0]);
805
+
806
+ WASM_VECTOR_LEN = offset;
807
+ return ptr;
483
808
  }
484
809
 
485
- /**
486
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
487
- *
488
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
489
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
490
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
491
- * @param {Uint8Array} program
492
- * @param {WitnessMap} solved_witness
493
- * @returns {WitnessMap}
494
- */
495
- export function getPublicParametersWitness(program, solved_witness) {
496
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
497
- const len0 = WASM_VECTOR_LEN;
498
- const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
499
- if (ret[2]) {
500
- throw takeFromExternrefTable0(ret[1]);
501
- }
502
- return takeFromExternrefTable0(ret[0]);
810
+ function takeFromExternrefTable0(idx) {
811
+ const value = wasm.__wbindgen_externrefs.get(idx);
812
+ wasm.__externref_table_dealloc(idx);
813
+ return value;
503
814
  }
504
815
 
505
- /**
506
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
507
- *
508
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
509
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
510
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
511
- * @param {Uint8Array} program
512
- * @param {WitnessMap} solved_witness
513
- * @returns {WitnessMap}
514
- */
515
- export function getPublicWitness(program, solved_witness) {
516
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
517
- const len0 = WASM_VECTOR_LEN;
518
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
519
- if (ret[2]) {
520
- throw takeFromExternrefTable0(ret[1]);
816
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
817
+ cachedTextDecoder.decode();
818
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
819
+ let numBytesDecoded = 0;
820
+ function decodeText(ptr, len) {
821
+ numBytesDecoded += len;
822
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
823
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
824
+ cachedTextDecoder.decode();
825
+ numBytesDecoded = len;
521
826
  }
522
- return takeFromExternrefTable0(ret[0]);
827
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
523
828
  }
524
829
 
525
- function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure448_externref_shim(arg0, arg1, arg2);
527
- }
830
+ const cachedTextEncoder = new TextEncoder();
528
831
 
529
- function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
832
+ if (!('encodeInto' in cachedTextEncoder)) {
833
+ cachedTextEncoder.encodeInto = function (arg, view) {
834
+ const buf = cachedTextEncoder.encode(arg);
835
+ view.set(buf);
836
+ return {
837
+ read: arg.length,
838
+ written: buf.length
839
+ };
840
+ };
531
841
  }
532
842
 
533
- function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure936_externref_shim(arg0, arg1, arg2, arg3);
843
+ let WASM_VECTOR_LEN = 0;
844
+
845
+ let wasmModule, wasm;
846
+ function __wbg_finalize_init(instance, module) {
847
+ wasm = instance.exports;
848
+ wasmModule = module;
849
+ cachedDataViewMemory0 = null;
850
+ cachedUint32ArrayMemory0 = null;
851
+ cachedUint8ArrayMemory0 = null;
852
+ wasm.__wbindgen_start();
853
+ return wasm;
535
854
  }
536
855
 
537
856
  async function __wbg_load(module, imports) {
@@ -539,351 +858,41 @@ async function __wbg_load(module, imports) {
539
858
  if (typeof WebAssembly.instantiateStreaming === 'function') {
540
859
  try {
541
860
  return await WebAssembly.instantiateStreaming(module, imports);
542
-
543
861
  } catch (e) {
544
- if (module.headers.get('Content-Type') != 'application/wasm') {
862
+ const validResponse = module.ok && expectedResponseType(module.type);
863
+
864
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
545
865
  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);
546
866
 
547
- } else {
548
- throw e;
549
- }
867
+ } else { throw e; }
550
868
  }
551
869
  }
552
870
 
553
871
  const bytes = await module.arrayBuffer();
554
872
  return await WebAssembly.instantiate(bytes, imports);
555
-
556
873
  } else {
557
874
  const instance = await WebAssembly.instantiate(module, imports);
558
875
 
559
876
  if (instance instanceof WebAssembly.Instance) {
560
877
  return { instance, module };
561
-
562
878
  } else {
563
879
  return instance;
564
880
  }
565
881
  }
566
- }
567
882
 
568
- function __wbg_get_imports() {
569
- const imports = {};
570
- imports.wbg = {};
571
- imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
572
- const ret = arg0.call(arg1);
573
- return ret;
574
- }, arguments) };
575
- imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
576
- const ret = arg0.call(arg1, arg2);
577
- return ret;
578
- }, arguments) };
579
- imports.wbg.__wbg_call_833bed5770ea2041 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
580
- const ret = arg0.call(arg1, arg2, arg3);
581
- return ret;
582
- }, arguments) };
583
- imports.wbg.__wbg_constructor_536364f6bcd4616b = function(arg0) {
584
- const ret = new Error(arg0);
585
- return ret;
586
- };
587
- imports.wbg.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
588
- const ret = new Error(arg0);
589
- return ret;
590
- };
591
- imports.wbg.__wbg_debug_3cb59063b29f58c1 = function(arg0) {
592
- console.debug(arg0);
593
- };
594
- imports.wbg.__wbg_debug_e17b51583ca6a632 = function(arg0, arg1, arg2, arg3) {
595
- console.debug(arg0, arg1, arg2, arg3);
596
- };
597
- imports.wbg.__wbg_error_524f506f44df1645 = function(arg0) {
598
- console.error(arg0);
599
- };
600
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
601
- let deferred0_0;
602
- let deferred0_1;
603
- try {
604
- deferred0_0 = arg0;
605
- deferred0_1 = arg1;
606
- console.error(getStringFromWasm0(arg0, arg1));
607
- } finally {
608
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
609
- }
610
- };
611
- imports.wbg.__wbg_error_80de38b3f7cc3c3c = function(arg0, arg1, arg2, arg3) {
612
- console.error(arg0, arg1, arg2, arg3);
613
- };
614
- imports.wbg.__wbg_forEach_d6a05ca96422eff9 = function(arg0, arg1, arg2) {
615
- try {
616
- var state0 = {a: arg1, b: arg2};
617
- var cb0 = (arg0, arg1, arg2) => {
618
- const a = state0.a;
619
- state0.a = 0;
620
- try {
621
- return __wbg_adapter_89(a, state0.b, arg0, arg1, arg2);
622
- } finally {
623
- state0.a = a;
624
- }
625
- };
626
- arg0.forEach(cb0);
627
- } finally {
628
- state0.a = state0.b = 0;
629
- }
630
- };
631
- imports.wbg.__wbg_forEach_e1cf6f7c8ecb7dae = function(arg0, arg1, arg2) {
632
- try {
633
- var state0 = {a: arg1, b: arg2};
634
- var cb0 = (arg0, arg1) => {
635
- const a = state0.a;
636
- state0.a = 0;
637
- try {
638
- return __wbg_adapter_110(a, state0.b, arg0, arg1);
639
- } finally {
640
- state0.a = a;
641
- }
642
- };
643
- arg0.forEach(cb0);
644
- } finally {
645
- state0.a = state0.b = 0;
646
- }
647
- };
648
- imports.wbg.__wbg_fromEntries_524679eecb0bdc2e = function() { return handleError(function (arg0) {
649
- const ret = Object.fromEntries(arg0);
650
- return ret;
651
- }, arguments) };
652
- imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
653
- const ret = Array.from(arg0);
654
- return ret;
655
- };
656
- imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
657
- const ret = arg0[arg1 >>> 0];
658
- return ret;
659
- };
660
- imports.wbg.__wbg_info_033d8b8a0838f1d3 = function(arg0, arg1, arg2, arg3) {
661
- console.info(arg0, arg1, arg2, arg3);
662
- };
663
- imports.wbg.__wbg_info_3daf2e093e091b66 = function(arg0) {
664
- console.info(arg0);
665
- };
666
- imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
667
- const ret = arg0.length;
668
- return ret;
669
- };
670
- imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
671
- try {
672
- var state0 = {a: arg0, b: arg1};
673
- var cb0 = (arg0, arg1) => {
674
- const a = state0.a;
675
- state0.a = 0;
676
- try {
677
- return __wbg_adapter_110(a, state0.b, arg0, arg1);
678
- } finally {
679
- state0.a = a;
680
- }
681
- };
682
- const ret = new Promise(cb0);
683
- return ret;
684
- } finally {
685
- state0.a = state0.b = 0;
686
- }
687
- };
688
- imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
689
- const ret = new Map();
690
- return ret;
691
- };
692
- imports.wbg.__wbg_new_78feb108b6472713 = function() {
693
- const ret = new Array();
694
- return ret;
695
- };
696
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
697
- const ret = new Error();
698
- return ret;
699
- };
700
- imports.wbg.__wbg_new_9f501325818b4158 = function() {
701
- const ret = new Array();
702
- return ret;
703
- };
704
- imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
705
- const ret = new Error(getStringFromWasm0(arg0, arg1));
706
- return ret;
707
- };
708
- imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
709
- const ret = new Map();
710
- return ret;
711
- };
712
- imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
713
- const ret = new Function(getStringFromWasm0(arg0, arg1));
714
- return ret;
715
- };
716
- imports.wbg.__wbg_parse_def2e24ef1252aff = function() { return handleError(function (arg0, arg1) {
717
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
718
- return ret;
719
- }, arguments) };
720
- imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
721
- const ret = arg0.push(arg1);
722
- return ret;
723
- };
724
- imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
725
- queueMicrotask(arg0);
726
- };
727
- imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
728
- const ret = arg0.queueMicrotask;
729
- return ret;
730
- };
731
- imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) {
732
- const ret = Promise.resolve(arg0);
733
- return ret;
734
- };
735
- imports.wbg.__wbg_reverse_71c11f9686a5c11b = function(arg0) {
736
- const ret = arg0.reverse();
737
- return ret;
738
- };
739
- imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
740
- const ret = arg0.set(arg1, arg2);
741
- return ret;
742
- };
743
- imports.wbg.__wbg_set_bb8cecf6a62b9f46 = function() { return handleError(function (arg0, arg1, arg2) {
744
- const ret = Reflect.set(arg0, arg1, arg2);
745
- return ret;
746
- }, arguments) };
747
- imports.wbg.__wbg_setcause_180f5110152d3ce3 = function(arg0, arg1) {
748
- arg0.cause = arg1;
749
- };
750
- imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
751
- const ret = arg1.stack;
752
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
753
- const len1 = WASM_VECTOR_LEN;
754
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
755
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
756
- };
757
- imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
758
- const ret = typeof global === 'undefined' ? null : global;
759
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
760
- };
761
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
762
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
763
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
764
- };
765
- imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
766
- const ret = typeof self === 'undefined' ? null : self;
767
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
768
- };
769
- imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
770
- const ret = typeof window === 'undefined' ? null : window;
771
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
772
- };
773
- imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
774
- const ret = arg0.then(arg1);
775
- return ret;
776
- };
777
- imports.wbg.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) {
778
- const ret = arg0.then(arg1, arg2);
779
- return ret;
780
- };
781
- imports.wbg.__wbg_values_fcb8ba8c0aad8b58 = function(arg0) {
782
- const ret = Object.values(arg0);
783
- return ret;
784
- };
785
- imports.wbg.__wbg_warn_4ca3906c248c47c4 = function(arg0) {
786
- console.warn(arg0);
787
- };
788
- imports.wbg.__wbg_warn_aaf1f4664a035bd6 = function(arg0, arg1, arg2, arg3) {
789
- console.warn(arg0, arg1, arg2, arg3);
790
- };
791
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
792
- const obj = arg0.original;
793
- if (obj.cnt-- == 1) {
794
- obj.a = 0;
795
- return true;
883
+ function expectedResponseType(type) {
884
+ switch (type) {
885
+ case 'basic': case 'cors': case 'default': return true;
796
886
  }
797
- const ret = false;
798
- return ret;
799
- };
800
- imports.wbg.__wbindgen_closure_wrapper1445 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
802
- return ret;
803
- };
804
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
805
- const ret = debugString(arg1);
806
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
807
- const len1 = WASM_VECTOR_LEN;
808
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
809
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
810
- };
811
- imports.wbg.__wbindgen_init_externref_table = function() {
812
- const table = wasm.__wbindgen_export_2;
813
- const offset = table.grow(4);
814
- table.set(0, undefined);
815
- table.set(offset + 0, undefined);
816
- table.set(offset + 1, null);
817
- table.set(offset + 2, true);
818
- table.set(offset + 3, false);
819
- ;
820
- };
821
- imports.wbg.__wbindgen_is_array = function(arg0) {
822
- const ret = Array.isArray(arg0);
823
- return ret;
824
- };
825
- imports.wbg.__wbindgen_is_function = function(arg0) {
826
- const ret = typeof(arg0) === 'function';
827
- return ret;
828
- };
829
- imports.wbg.__wbindgen_is_string = function(arg0) {
830
- const ret = typeof(arg0) === 'string';
831
- return ret;
832
- };
833
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
834
- const ret = arg0 === undefined;
835
- return ret;
836
- };
837
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
838
- const obj = arg1;
839
- const ret = typeof(obj) === 'number' ? obj : undefined;
840
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
841
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
842
- };
843
- imports.wbg.__wbindgen_number_new = function(arg0) {
844
- const ret = arg0;
845
- return ret;
846
- };
847
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
848
- const obj = arg1;
849
- const ret = typeof(obj) === 'string' ? obj : undefined;
850
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
851
- var len1 = WASM_VECTOR_LEN;
852
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
853
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
854
- };
855
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
856
- const ret = getStringFromWasm0(arg0, arg1);
857
- return ret;
858
- };
859
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
860
- throw new Error(getStringFromWasm0(arg0, arg1));
861
- };
862
-
863
- return imports;
864
- }
865
-
866
- function __wbg_init_memory(imports, memory) {
867
-
868
- }
869
-
870
- function __wbg_finalize_init(instance, module) {
871
- wasm = instance.exports;
872
- __wbg_init.__wbindgen_wasm_module = module;
873
- cachedDataViewMemory0 = null;
874
- cachedUint32ArrayMemory0 = null;
875
- cachedUint8ArrayMemory0 = null;
876
-
877
-
878
- wasm.__wbindgen_start();
879
- return wasm;
887
+ return false;
888
+ }
880
889
  }
881
890
 
882
891
  function initSync(module) {
883
892
  if (wasm !== undefined) return wasm;
884
893
 
885
894
 
886
- if (typeof module !== 'undefined') {
895
+ if (module !== undefined) {
887
896
  if (Object.getPrototypeOf(module) === Object.prototype) {
888
897
  ({module} = module)
889
898
  } else {
@@ -892,15 +901,10 @@ function initSync(module) {
892
901
  }
893
902
 
894
903
  const imports = __wbg_get_imports();
895
-
896
- __wbg_init_memory(imports);
897
-
898
904
  if (!(module instanceof WebAssembly.Module)) {
899
905
  module = new WebAssembly.Module(module);
900
906
  }
901
-
902
907
  const instance = new WebAssembly.Instance(module, imports);
903
-
904
908
  return __wbg_finalize_init(instance, module);
905
909
  }
906
910
 
@@ -908,7 +912,7 @@ async function __wbg_init(module_or_path) {
908
912
  if (wasm !== undefined) return wasm;
909
913
 
910
914
 
911
- if (typeof module_or_path !== 'undefined') {
915
+ if (module_or_path !== undefined) {
912
916
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
913
917
  ({module_or_path} = module_or_path)
914
918
  } else {
@@ -916,7 +920,7 @@ async function __wbg_init(module_or_path) {
916
920
  }
917
921
  }
918
922
 
919
- if (typeof module_or_path === 'undefined') {
923
+ if (module_or_path === undefined) {
920
924
  module_or_path = new URL('acvm_js_bg.wasm', import.meta.url);
921
925
  }
922
926
  const imports = __wbg_get_imports();
@@ -925,12 +929,9 @@ async function __wbg_init(module_or_path) {
925
929
  module_or_path = fetch(module_or_path);
926
930
  }
927
931
 
928
- __wbg_init_memory(imports);
929
-
930
932
  const { instance, module } = await __wbg_load(await module_or_path, imports);
931
933
 
932
934
  return __wbg_finalize_init(instance, module);
933
935
  }
934
936
 
935
- export { initSync };
936
- export default __wbg_init;
937
+ export { initSync, __wbg_init as default };