@noir-lang/acvm_js 1.0.0-beta.3-f0c1c7b.nightly → 1.0.0-beta.3-826b18a.nightly

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,36 +1,40 @@
1
1
  let wasm;
2
2
 
3
- const heap = new Array(128).fill(undefined);
3
+ function addToExternrefTable0(obj) {
4
+ const idx = wasm.__externref_table_alloc();
5
+ wasm.__wbindgen_export_2.set(idx, obj);
6
+ return idx;
7
+ }
4
8
 
5
- heap.push(undefined, null, true, false);
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
+ }
16
+ }
6
17
 
7
- function getObject(idx) { return heap[idx]; }
18
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
8
19
 
9
- let heap_next = heap.length;
20
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
10
21
 
11
- function dropObject(idx) {
12
- if (idx < 132) return;
13
- heap[idx] = heap_next;
14
- heap_next = idx;
22
+ let cachedUint8ArrayMemory0 = null;
23
+
24
+ function getUint8ArrayMemory0() {
25
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
26
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
27
+ }
28
+ return cachedUint8ArrayMemory0;
15
29
  }
16
30
 
17
- function takeObject(idx) {
18
- const ret = getObject(idx);
19
- dropObject(idx);
20
- return ret;
31
+ function getStringFromWasm0(ptr, len) {
32
+ ptr = ptr >>> 0;
33
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
21
34
  }
22
35
 
23
36
  let WASM_VECTOR_LEN = 0;
24
37
 
25
- let cachedUint8Memory0 = null;
26
-
27
- function getUint8Memory0() {
28
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
29
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
30
- }
31
- return cachedUint8Memory0;
32
- }
33
-
34
38
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
35
39
 
36
40
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -50,16 +54,16 @@ function passStringToWasm0(arg, malloc, realloc) {
50
54
 
51
55
  if (realloc === undefined) {
52
56
  const buf = cachedTextEncoder.encode(arg);
53
- const ptr = malloc(buf.length) >>> 0;
54
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
57
+ const ptr = malloc(buf.length, 1) >>> 0;
58
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
55
59
  WASM_VECTOR_LEN = buf.length;
56
60
  return ptr;
57
61
  }
58
62
 
59
63
  let len = arg.length;
60
- let ptr = malloc(len) >>> 0;
64
+ let ptr = malloc(len, 1) >>> 0;
61
65
 
62
- const mem = getUint8Memory0();
66
+ const mem = getUint8ArrayMemory0();
63
67
 
64
68
  let offset = 0;
65
69
 
@@ -73,55 +77,60 @@ function passStringToWasm0(arg, malloc, realloc) {
73
77
  if (offset !== 0) {
74
78
  arg = arg.slice(offset);
75
79
  }
76
- ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
77
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
80
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
81
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
78
82
  const ret = encodeString(arg, view);
79
83
 
80
84
  offset += ret.written;
85
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
81
86
  }
82
87
 
83
88
  WASM_VECTOR_LEN = offset;
84
89
  return ptr;
85
90
  }
86
91
 
87
- function isLikeNone(x) {
88
- return x === undefined || x === null;
89
- }
92
+ let cachedDataViewMemory0 = null;
90
93
 
91
- let cachedInt32Memory0 = null;
92
-
93
- function getInt32Memory0() {
94
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
95
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
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);
96
97
  }
97
- return cachedInt32Memory0;
98
- }
99
-
100
- function addHeapObject(obj) {
101
- if (heap_next === heap.length) heap.push(heap.length + 1);
102
- const idx = heap_next;
103
- heap_next = heap[idx];
104
-
105
- heap[idx] = obj;
106
- return idx;
98
+ return cachedDataViewMemory0;
107
99
  }
108
100
 
109
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
110
-
111
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
112
-
113
- function getStringFromWasm0(ptr, len) {
114
- ptr = ptr >>> 0;
115
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
101
+ function isLikeNone(x) {
102
+ return x === undefined || x === null;
116
103
  }
117
104
 
118
- let cachedFloat64Memory0 = null;
105
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
106
+ ? { register: () => {}, unregister: () => {} }
107
+ : new FinalizationRegistry(state => {
108
+ wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b)
109
+ });
119
110
 
120
- function getFloat64Memory0() {
121
- if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
122
- cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
123
- }
124
- return cachedFloat64Memory0;
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;
125
134
  }
126
135
 
127
136
  function debugString(val) {
@@ -165,7 +174,7 @@ function debugString(val) {
165
174
  // Test for built-in
166
175
  const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
167
176
  let className;
168
- if (builtInMatches.length > 1) {
177
+ if (builtInMatches && builtInMatches.length > 1) {
169
178
  className = builtInMatches[1];
170
179
  } else {
171
180
  // Failed to match the standard '[object ClassName]'
@@ -189,278 +198,231 @@ function debugString(val) {
189
198
  return className;
190
199
  }
191
200
 
192
- function makeMutClosure(arg0, arg1, dtor, f) {
193
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
194
- const real = (...args) => {
195
- // First up with a closure we increment the internal reference
196
- // count. This ensures that the Rust closure environment won't
197
- // be deallocated while we're invoking it.
198
- state.cnt++;
199
- const a = state.a;
200
- state.a = 0;
201
- try {
202
- return f(a, state.b, ...args);
203
- } finally {
204
- if (--state.cnt === 0) {
205
- wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
206
-
207
- } else {
208
- state.a = a;
209
- }
210
- }
211
- };
212
- real.original = state;
213
-
214
- return real;
215
- }
216
- function __wbg_adapter_22(arg0, arg1, arg2) {
217
- wasm.wasm_bindgen__convert__closures__invoke1_mut__h0d2f2cab014f8c52(arg0, arg1, addHeapObject(arg2));
218
- }
219
-
220
201
  function passArray8ToWasm0(arg, malloc) {
221
- const ptr = malloc(arg.length * 1) >>> 0;
222
- getUint8Memory0().set(arg, ptr / 1);
202
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
203
+ getUint8ArrayMemory0().set(arg, ptr / 1);
223
204
  WASM_VECTOR_LEN = arg.length;
224
205
  return ptr;
225
206
  }
226
207
  /**
227
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
228
- *
229
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
230
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
231
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
232
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
233
- */
208
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
209
+ *
210
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
211
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
212
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
213
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
214
+ */
234
215
  export function executeCircuit(program, initial_witness, foreign_call_handler) {
235
216
  const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
236
217
  const len0 = WASM_VECTOR_LEN;
237
- const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
238
- return takeObject(ret);
218
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
219
+ return ret;
239
220
  }
240
221
 
241
222
  /**
242
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
243
- * This method also extracts the public return values from the solved witness into its own return witness.
244
- *
245
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
246
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
247
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
248
- * @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.
249
- */
223
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
224
+ * This method also extracts the public return values from the solved witness into its own return witness.
225
+ *
226
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
227
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
228
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
229
+ * @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.
230
+ */
250
231
  export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
251
232
  const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
252
233
  const len0 = WASM_VECTOR_LEN;
253
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
254
- return takeObject(ret);
234
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
235
+ return ret;
255
236
  }
256
237
 
257
238
  /**
258
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
259
- *
260
- * @param {Uint8Array} program - A serialized representation of an ACIR program
261
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
262
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
263
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
264
- */
239
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
240
+ *
241
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
242
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
243
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
244
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
245
+ */
265
246
  export function executeProgram(program, initial_witness, foreign_call_handler) {
266
247
  const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
267
248
  const len0 = WASM_VECTOR_LEN;
268
- const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
269
- return takeObject(ret);
249
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
250
+ return ret;
270
251
  }
271
252
 
253
+ function takeFromExternrefTable0(idx) {
254
+ const value = wasm.__wbindgen_export_2.get(idx);
255
+ wasm.__externref_table_dealloc(idx);
256
+ return value;
257
+ }
272
258
  /**
273
- * Returns the `BuildInfo` object containing information about how the installed package was built.
274
- * @returns {BuildInfo} - Information on how the installed package was built.
275
- */
276
- export function buildInfo() {
277
- const ret = wasm.buildInfo();
278
- return takeObject(ret);
259
+ * Sets the package's logging level.
260
+ *
261
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
262
+ */
263
+ export function initLogLevel(filter) {
264
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
265
+ const len0 = WASM_VECTOR_LEN;
266
+ const ret = wasm.initLogLevel(ptr0, len0);
267
+ if (ret[1]) {
268
+ throw takeFromExternrefTable0(ret[0]);
269
+ }
279
270
  }
280
271
 
281
272
  /**
282
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
283
- *
284
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
285
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
286
- * @returns {WitnessMap} A witness map containing the circuit's return values.
287
- * @param {Uint8Array} program
288
- * @param {WitnessMap} witness_map
289
- * @returns {WitnessMap}
290
- */
273
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
274
+ *
275
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
276
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
277
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
278
+ * @param {Uint8Array} program
279
+ * @param {WitnessMap} witness_map
280
+ * @returns {WitnessMap}
281
+ */
291
282
  export function getReturnWitness(program, witness_map) {
292
- try {
293
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
294
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
295
- const len0 = WASM_VECTOR_LEN;
296
- wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
297
- var r0 = getInt32Memory0()[retptr / 4 + 0];
298
- var r1 = getInt32Memory0()[retptr / 4 + 1];
299
- var r2 = getInt32Memory0()[retptr / 4 + 2];
300
- if (r2) {
301
- throw takeObject(r1);
302
- }
303
- return takeObject(r0);
304
- } finally {
305
- wasm.__wbindgen_add_to_stack_pointer(16);
283
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
284
+ const len0 = WASM_VECTOR_LEN;
285
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
286
+ if (ret[2]) {
287
+ throw takeFromExternrefTable0(ret[1]);
306
288
  }
289
+ return takeFromExternrefTable0(ret[0]);
307
290
  }
308
291
 
309
292
  /**
310
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
311
- *
312
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
313
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
314
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
315
- * @param {Uint8Array} program
316
- * @param {WitnessMap} solved_witness
317
- * @returns {WitnessMap}
318
- */
293
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
294
+ *
295
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
296
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
297
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
298
+ * @param {Uint8Array} program
299
+ * @param {WitnessMap} solved_witness
300
+ * @returns {WitnessMap}
301
+ */
319
302
  export function getPublicParametersWitness(program, solved_witness) {
320
- try {
321
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
322
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
323
- const len0 = WASM_VECTOR_LEN;
324
- wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
325
- var r0 = getInt32Memory0()[retptr / 4 + 0];
326
- var r1 = getInt32Memory0()[retptr / 4 + 1];
327
- var r2 = getInt32Memory0()[retptr / 4 + 2];
328
- if (r2) {
329
- throw takeObject(r1);
330
- }
331
- return takeObject(r0);
332
- } finally {
333
- wasm.__wbindgen_add_to_stack_pointer(16);
303
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
304
+ const len0 = WASM_VECTOR_LEN;
305
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
306
+ if (ret[2]) {
307
+ throw takeFromExternrefTable0(ret[1]);
334
308
  }
309
+ return takeFromExternrefTable0(ret[0]);
335
310
  }
336
311
 
337
312
  /**
338
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
339
- *
340
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
341
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
342
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
343
- * @param {Uint8Array} program
344
- * @param {WitnessMap} solved_witness
345
- * @returns {WitnessMap}
346
- */
313
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
314
+ *
315
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
316
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
317
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
318
+ * @param {Uint8Array} program
319
+ * @param {WitnessMap} solved_witness
320
+ * @returns {WitnessMap}
321
+ */
347
322
  export function getPublicWitness(program, solved_witness) {
348
- try {
349
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
350
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
351
- const len0 = WASM_VECTOR_LEN;
352
- wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
353
- var r0 = getInt32Memory0()[retptr / 4 + 0];
354
- var r1 = getInt32Memory0()[retptr / 4 + 1];
355
- var r2 = getInt32Memory0()[retptr / 4 + 2];
356
- if (r2) {
357
- throw takeObject(r1);
358
- }
359
- return takeObject(r0);
360
- } finally {
361
- wasm.__wbindgen_add_to_stack_pointer(16);
323
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
324
+ const len0 = WASM_VECTOR_LEN;
325
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
326
+ if (ret[2]) {
327
+ throw takeFromExternrefTable0(ret[1]);
362
328
  }
329
+ return takeFromExternrefTable0(ret[0]);
363
330
  }
364
331
 
365
332
  /**
366
- * Performs a bitwise AND operation between `lhs` and `rhs`
367
- * @param {string} lhs
368
- * @param {string} rhs
369
- * @returns {string}
370
- */
333
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
334
+ * @returns {BuildInfo} - Information on how the installed package was built.
335
+ */
336
+ export function buildInfo() {
337
+ const ret = wasm.buildInfo();
338
+ return ret;
339
+ }
340
+
341
+ /**
342
+ * Performs a bitwise AND operation between `lhs` and `rhs`
343
+ * @param {string} lhs
344
+ * @param {string} rhs
345
+ * @returns {string}
346
+ */
371
347
  export function and(lhs, rhs) {
372
- const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs));
373
- return takeObject(ret);
348
+ const ret = wasm.and(lhs, rhs);
349
+ return ret;
374
350
  }
375
351
 
376
352
  /**
377
- * Performs a bitwise XOR operation between `lhs` and `rhs`
378
- * @param {string} lhs
379
- * @param {string} rhs
380
- * @returns {string}
381
- */
353
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
354
+ * @param {string} lhs
355
+ * @param {string} rhs
356
+ * @returns {string}
357
+ */
382
358
  export function xor(lhs, rhs) {
383
- const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs));
384
- return takeObject(ret);
359
+ const ret = wasm.xor(lhs, rhs);
360
+ return ret;
385
361
  }
386
362
 
387
- let cachedUint32Memory0 = null;
363
+ let cachedUint32ArrayMemory0 = null;
388
364
 
389
- function getUint32Memory0() {
390
- if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
391
- cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
365
+ function getUint32ArrayMemory0() {
366
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
367
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
392
368
  }
393
- return cachedUint32Memory0;
369
+ return cachedUint32ArrayMemory0;
394
370
  }
395
371
 
396
372
  function passArray32ToWasm0(arg, malloc) {
397
- const ptr = malloc(arg.length * 4) >>> 0;
398
- getUint32Memory0().set(arg, ptr / 4);
373
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
374
+ getUint32ArrayMemory0().set(arg, ptr / 4);
399
375
  WASM_VECTOR_LEN = arg.length;
400
376
  return ptr;
401
377
  }
402
378
 
403
379
  function getArrayU32FromWasm0(ptr, len) {
404
380
  ptr = ptr >>> 0;
405
- return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
381
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
406
382
  }
407
383
  /**
408
- * Sha256 compression function
409
- * @param {Uint32Array} inputs
410
- * @param {Uint32Array} state
411
- * @returns {Uint32Array}
412
- */
384
+ * Sha256 compression function
385
+ * @param {Uint32Array} inputs
386
+ * @param {Uint32Array} state
387
+ * @returns {Uint32Array}
388
+ */
413
389
  export function sha256_compression(inputs, state) {
414
- try {
415
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
416
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
417
- const len0 = WASM_VECTOR_LEN;
418
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
419
- const len1 = WASM_VECTOR_LEN;
420
- wasm.sha256_compression(retptr, ptr0, len0, ptr1, len1);
421
- var r0 = getInt32Memory0()[retptr / 4 + 0];
422
- var r1 = getInt32Memory0()[retptr / 4 + 1];
423
- var v3 = getArrayU32FromWasm0(r0, r1).slice();
424
- wasm.__wbindgen_free(r0, r1 * 4);
425
- return v3;
426
- } finally {
427
- wasm.__wbindgen_add_to_stack_pointer(16);
428
- }
390
+ const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
391
+ const len0 = WASM_VECTOR_LEN;
392
+ const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
393
+ const len1 = WASM_VECTOR_LEN;
394
+ const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
395
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
396
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
397
+ return v3;
429
398
  }
430
399
 
431
400
  function getArrayU8FromWasm0(ptr, len) {
432
401
  ptr = ptr >>> 0;
433
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
402
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
434
403
  }
435
404
  /**
436
- * Calculates the Blake2s256 hash of the input bytes
437
- * @param {Uint8Array} inputs
438
- * @returns {Uint8Array}
439
- */
405
+ * Calculates the Blake2s256 hash of the input bytes
406
+ * @param {Uint8Array} inputs
407
+ * @returns {Uint8Array}
408
+ */
440
409
  export function blake2s256(inputs) {
441
- try {
442
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
443
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
444
- const len0 = WASM_VECTOR_LEN;
445
- wasm.blake2s256(retptr, ptr0, len0);
446
- var r0 = getInt32Memory0()[retptr / 4 + 0];
447
- var r1 = getInt32Memory0()[retptr / 4 + 1];
448
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
449
- wasm.__wbindgen_free(r0, r1 * 1);
450
- return v2;
451
- } finally {
452
- wasm.__wbindgen_add_to_stack_pointer(16);
453
- }
410
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
411
+ const len0 = WASM_VECTOR_LEN;
412
+ const ret = wasm.blake2s256(ptr0, len0);
413
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
414
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
415
+ return v2;
454
416
  }
455
417
 
456
418
  /**
457
- * Verifies a ECDSA signature over the secp256k1 curve.
458
- * @param {Uint8Array} hashed_msg
459
- * @param {Uint8Array} public_key_x_bytes
460
- * @param {Uint8Array} public_key_y_bytes
461
- * @param {Uint8Array} signature
462
- * @returns {boolean}
463
- */
419
+ * Verifies a ECDSA signature over the secp256k1 curve.
420
+ * @param {Uint8Array} hashed_msg
421
+ * @param {Uint8Array} public_key_x_bytes
422
+ * @param {Uint8Array} public_key_y_bytes
423
+ * @param {Uint8Array} signature
424
+ * @returns {boolean}
425
+ */
464
426
  export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
465
427
  const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
466
428
  const len0 = WASM_VECTOR_LEN;
@@ -475,13 +437,13 @@ export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_ke
475
437
  }
476
438
 
477
439
  /**
478
- * Verifies a ECDSA signature over the secp256r1 curve.
479
- * @param {Uint8Array} hashed_msg
480
- * @param {Uint8Array} public_key_x_bytes
481
- * @param {Uint8Array} public_key_y_bytes
482
- * @param {Uint8Array} signature
483
- * @returns {boolean}
484
- */
440
+ * Verifies a ECDSA signature over the secp256r1 curve.
441
+ * @param {Uint8Array} hashed_msg
442
+ * @param {Uint8Array} public_key_x_bytes
443
+ * @param {Uint8Array} public_key_y_bytes
444
+ * @param {Uint8Array} signature
445
+ * @returns {boolean}
446
+ */
485
447
  export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
486
448
  const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
487
449
  const len0 = WASM_VECTOR_LEN;
@@ -496,138 +458,80 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
496
458
  }
497
459
 
498
460
  /**
499
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
500
- *
501
- * @param {WitnessMap} witness_map - A witness map.
502
- * @returns {Uint8Array} A compressed witness map
503
- */
461
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
462
+ *
463
+ * @param {WitnessMap} witness_map - A witness map.
464
+ * @returns {Uint8Array} A compressed witness map
465
+ */
504
466
  export function compressWitness(witness_map) {
505
- try {
506
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
507
- wasm.compressWitness(retptr, addHeapObject(witness_map));
508
- var r0 = getInt32Memory0()[retptr / 4 + 0];
509
- var r1 = getInt32Memory0()[retptr / 4 + 1];
510
- var r2 = getInt32Memory0()[retptr / 4 + 2];
511
- var r3 = getInt32Memory0()[retptr / 4 + 3];
512
- if (r3) {
513
- throw takeObject(r2);
514
- }
515
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
516
- wasm.__wbindgen_free(r0, r1 * 1);
517
- return v1;
518
- } finally {
519
- wasm.__wbindgen_add_to_stack_pointer(16);
467
+ const ret = wasm.compressWitness(witness_map);
468
+ if (ret[3]) {
469
+ throw takeFromExternrefTable0(ret[2]);
520
470
  }
471
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
472
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
473
+ return v1;
521
474
  }
522
475
 
523
476
  /**
524
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
525
- * This should be used to only fetch the witness map for the main function.
526
- *
527
- * @param {Uint8Array} compressed_witness - A compressed witness.
528
- * @returns {WitnessMap} The decompressed witness map.
529
- */
477
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
478
+ * This should be used to only fetch the witness map for the main function.
479
+ *
480
+ * @param {Uint8Array} compressed_witness - A compressed witness.
481
+ * @returns {WitnessMap} The decompressed witness map.
482
+ */
530
483
  export function decompressWitness(compressed_witness) {
531
- try {
532
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
533
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
534
- const len0 = WASM_VECTOR_LEN;
535
- wasm.decompressWitness(retptr, ptr0, len0);
536
- var r0 = getInt32Memory0()[retptr / 4 + 0];
537
- var r1 = getInt32Memory0()[retptr / 4 + 1];
538
- var r2 = getInt32Memory0()[retptr / 4 + 2];
539
- if (r2) {
540
- throw takeObject(r1);
541
- }
542
- return takeObject(r0);
543
- } finally {
544
- wasm.__wbindgen_add_to_stack_pointer(16);
484
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
485
+ const len0 = WASM_VECTOR_LEN;
486
+ const ret = wasm.decompressWitness(ptr0, len0);
487
+ if (ret[2]) {
488
+ throw takeFromExternrefTable0(ret[1]);
545
489
  }
490
+ return takeFromExternrefTable0(ret[0]);
546
491
  }
547
492
 
548
493
  /**
549
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
550
- *
551
- * @param {WitnessStack} witness_stack - A witness stack.
552
- * @returns {Uint8Array} A compressed witness stack
553
- */
494
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
495
+ *
496
+ * @param {WitnessStack} witness_stack - A witness stack.
497
+ * @returns {Uint8Array} A compressed witness stack
498
+ */
554
499
  export function compressWitnessStack(witness_stack) {
555
- try {
556
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
557
- wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
558
- var r0 = getInt32Memory0()[retptr / 4 + 0];
559
- var r1 = getInt32Memory0()[retptr / 4 + 1];
560
- var r2 = getInt32Memory0()[retptr / 4 + 2];
561
- var r3 = getInt32Memory0()[retptr / 4 + 3];
562
- if (r3) {
563
- throw takeObject(r2);
564
- }
565
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
566
- wasm.__wbindgen_free(r0, r1 * 1);
567
- return v1;
568
- } finally {
569
- wasm.__wbindgen_add_to_stack_pointer(16);
500
+ const ret = wasm.compressWitnessStack(witness_stack);
501
+ if (ret[3]) {
502
+ throw takeFromExternrefTable0(ret[2]);
570
503
  }
504
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
505
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
506
+ return v1;
571
507
  }
572
508
 
573
509
  /**
574
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
575
- *
576
- * @param {Uint8Array} compressed_witness - A compressed witness.
577
- * @returns {WitnessStack} The decompressed witness stack.
578
- */
510
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
511
+ *
512
+ * @param {Uint8Array} compressed_witness - A compressed witness.
513
+ * @returns {WitnessStack} The decompressed witness stack.
514
+ */
579
515
  export function decompressWitnessStack(compressed_witness) {
580
- try {
581
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
582
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
583
- const len0 = WASM_VECTOR_LEN;
584
- wasm.decompressWitnessStack(retptr, ptr0, len0);
585
- var r0 = getInt32Memory0()[retptr / 4 + 0];
586
- var r1 = getInt32Memory0()[retptr / 4 + 1];
587
- var r2 = getInt32Memory0()[retptr / 4 + 2];
588
- if (r2) {
589
- throw takeObject(r1);
590
- }
591
- return takeObject(r0);
592
- } finally {
593
- wasm.__wbindgen_add_to_stack_pointer(16);
516
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
517
+ const len0 = WASM_VECTOR_LEN;
518
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
519
+ if (ret[2]) {
520
+ throw takeFromExternrefTable0(ret[1]);
594
521
  }
522
+ return takeFromExternrefTable0(ret[0]);
595
523
  }
596
524
 
597
- /**
598
- * Sets the package's logging level.
599
- *
600
- * @param {LogLevel} level - The maximum level of logging to be emitted.
601
- */
602
- export function initLogLevel(filter) {
603
- try {
604
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
605
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
606
- const len0 = WASM_VECTOR_LEN;
607
- wasm.initLogLevel(retptr, ptr0, len0);
608
- var r0 = getInt32Memory0()[retptr / 4 + 0];
609
- var r1 = getInt32Memory0()[retptr / 4 + 1];
610
- if (r1) {
611
- throw takeObject(r0);
612
- }
613
- } finally {
614
- wasm.__wbindgen_add_to_stack_pointer(16);
615
- }
525
+ function __wbg_adapter_30(arg0, arg1, arg2) {
526
+ wasm.closure269_externref_shim(arg0, arg1, arg2);
616
527
  }
617
528
 
618
- function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
619
- wasm.wasm_bindgen__convert__closures__invoke3_mut__h2e8a0e541cb0c3bc(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
529
+ function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
+ wasm.closure834_externref_shim(arg0, arg1, arg2, arg3, arg4);
620
531
  }
621
532
 
622
- function handleError(f, args) {
623
- try {
624
- return f.apply(this, args);
625
- } catch (e) {
626
- wasm.__wbindgen_exn_store(addHeapObject(e));
627
- }
628
- }
629
- function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
630
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h56728cbaf4bbea81(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
533
+ function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
+ wasm.closure838_externref_shim(arg0, arg1, arg2, arg3);
631
535
  }
632
536
 
633
537
  async function __wbg_load(module, imports) {
@@ -638,7 +542,7 @@ async function __wbg_load(module, imports) {
638
542
 
639
543
  } catch (e) {
640
544
  if (module.headers.get('Content-Type') != 'application/wasm') {
641
- 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);
545
+ 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);
642
546
 
643
547
  } else {
644
548
  throw e;
@@ -664,72 +568,36 @@ async function __wbg_load(module, imports) {
664
568
  function __wbg_get_imports() {
665
569
  const imports = {};
666
570
  imports.wbg = {};
667
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
668
- takeObject(arg0);
669
- };
670
- imports.wbg.__wbindgen_is_array = function(arg0) {
671
- const ret = Array.isArray(getObject(arg0));
571
+ imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
572
+ const ret = arg0.call(arg1);
672
573
  return ret;
673
- };
674
- imports.wbg.__wbindgen_is_string = function(arg0) {
675
- const ret = typeof(getObject(arg0)) === 'string';
574
+ }, arguments) };
575
+ imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
576
+ const ret = arg0.call(arg1, arg2);
676
577
  return ret;
677
- };
678
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
679
- const obj = getObject(arg1);
680
- const ret = typeof(obj) === 'string' ? obj : undefined;
681
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
682
- var len1 = WASM_VECTOR_LEN;
683
- getInt32Memory0()[arg0 / 4 + 1] = len1;
684
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
685
- };
686
- imports.wbg.__wbg_new_9f82ec4c0bc017c1 = function() {
687
- const ret = new Map();
688
- return addHeapObject(ret);
689
- };
690
- imports.wbg.__wbindgen_number_new = function(arg0) {
691
- const ret = arg0;
692
- return addHeapObject(ret);
693
- };
694
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
695
- const ret = getStringFromWasm0(arg0, arg1);
696
- return addHeapObject(ret);
697
- };
698
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
699
- const obj = takeObject(arg0).original;
700
- if (obj.cnt-- == 1) {
701
- obj.a = 0;
702
- return true;
703
- }
704
- const ret = false;
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_003f4a4118e07291 = function(arg0) {
584
+ const ret = new Error(arg0);
705
585
  return ret;
706
586
  };
707
- imports.wbg.__wbg_constructor_3697b3eaa19355e5 = function(arg0) {
708
- const ret = new Error(takeObject(arg0));
709
- return addHeapObject(ret);
710
- };
711
- imports.wbg.__wbg_new_0fe3b501601ef88e = function() {
712
- const ret = new Array();
713
- return addHeapObject(ret);
587
+ imports.wbg.__wbg_constructor_c456dcccc52847dd = function(arg0) {
588
+ const ret = new Error(arg0);
589
+ return ret;
714
590
  };
715
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
716
- const obj = getObject(arg1);
717
- const ret = typeof(obj) === 'number' ? obj : undefined;
718
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
719
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
591
+ imports.wbg.__wbg_debug_3cb59063b29f58c1 = function(arg0) {
592
+ console.debug(arg0);
720
593
  };
721
- imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
722
- const ret = new Error();
723
- return addHeapObject(ret);
594
+ imports.wbg.__wbg_debug_e17b51583ca6a632 = function(arg0, arg1, arg2, arg3) {
595
+ console.debug(arg0, arg1, arg2, arg3);
724
596
  };
725
- imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
726
- const ret = getObject(arg1).stack;
727
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
728
- const len1 = WASM_VECTOR_LEN;
729
- getInt32Memory0()[arg0 / 4 + 1] = len1;
730
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
597
+ imports.wbg.__wbg_error_524f506f44df1645 = function(arg0) {
598
+ console.error(arg0);
731
599
  };
732
- imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
600
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
733
601
  let deferred0_0;
734
602
  let deferred0_1;
735
603
  try {
@@ -737,197 +605,292 @@ function __wbg_get_imports() {
737
605
  deferred0_1 = arg1;
738
606
  console.error(getStringFromWasm0(arg0, arg1));
739
607
  } finally {
740
- wasm.__wbindgen_free(deferred0_0, deferred0_1);
608
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
741
609
  }
742
610
  };
743
- imports.wbg.__wbg_debug_e3f6a1578e6d45ca = function(arg0) {
744
- console.debug(getObject(arg0));
745
- };
746
- imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
747
- console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
748
- };
749
- imports.wbg.__wbg_error_a7e23606158b68b9 = function(arg0) {
750
- console.error(getObject(arg0));
751
- };
752
- imports.wbg.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
753
- console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
754
- };
755
- imports.wbg.__wbg_info_05db236d79f1b785 = function(arg0) {
756
- console.info(getObject(arg0));
757
- };
758
- imports.wbg.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
759
- console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
760
- };
761
- imports.wbg.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) {
762
- console.warn(getObject(arg0));
763
- };
764
- imports.wbg.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
765
- console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
766
- };
767
- imports.wbg.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) {
768
- const ret = getObject(arg0)[arg1 >>> 0];
769
- return addHeapObject(ret);
770
- };
771
- imports.wbg.__wbg_length_820c786973abdd8a = function(arg0) {
772
- const ret = getObject(arg0).length;
773
- return ret;
774
- };
775
- imports.wbg.__wbg_new_0394642eae39db16 = function() {
776
- const ret = new Array();
777
- return addHeapObject(ret);
611
+ imports.wbg.__wbg_error_80de38b3f7cc3c3c = function(arg0, arg1, arg2, arg3) {
612
+ console.error(arg0, arg1, arg2, arg3);
778
613
  };
779
- imports.wbg.__wbg_new_0f2b71ca2f2a6029 = function() {
780
- const ret = new Map();
781
- return addHeapObject(ret);
782
- };
783
- imports.wbg.__wbg_from_6bc98a09a0b58bb1 = function(arg0) {
784
- const ret = Array.from(getObject(arg0));
785
- return addHeapObject(ret);
786
- };
787
- imports.wbg.__wbg_forEach_5ae261259d7517c8 = function(arg0, arg1, arg2) {
614
+ imports.wbg.__wbg_forEach_d6a05ca96422eff9 = function(arg0, arg1, arg2) {
788
615
  try {
789
616
  var state0 = {a: arg1, b: arg2};
790
617
  var cb0 = (arg0, arg1, arg2) => {
791
618
  const a = state0.a;
792
619
  state0.a = 0;
793
620
  try {
794
- return __wbg_adapter_75(a, state0.b, arg0, arg1, arg2);
621
+ return __wbg_adapter_89(a, state0.b, arg0, arg1, arg2);
795
622
  } finally {
796
623
  state0.a = a;
797
624
  }
798
625
  };
799
- getObject(arg0).forEach(cb0);
626
+ arg0.forEach(cb0);
800
627
  } finally {
801
628
  state0.a = state0.b = 0;
802
629
  }
803
630
  };
804
- imports.wbg.__wbg_push_109cfc26d02582dd = function(arg0, arg1) {
805
- const ret = getObject(arg0).push(getObject(arg1));
806
- return ret;
807
- };
808
- imports.wbg.__wbg_reverse_a322332d916e2705 = function(arg0) {
809
- const ret = getObject(arg0).reverse();
810
- return addHeapObject(ret);
811
- };
812
- imports.wbg.__wbg_new_87297f22973157c8 = function(arg0, arg1) {
813
- const ret = new Error(getStringFromWasm0(arg0, arg1));
814
- return addHeapObject(ret);
815
- };
816
- imports.wbg.__wbg_setcause_394738aae0ce9341 = function(arg0, arg1) {
817
- getObject(arg0).cause = getObject(arg1);
818
- };
819
- imports.wbg.__wbg_call_587b30eea3e09332 = function() { return handleError(function (arg0, arg1, arg2) {
820
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
821
- return addHeapObject(ret);
822
- }, arguments) };
823
- imports.wbg.__wbg_call_4c73e4aecced6a7d = function() { return handleError(function (arg0, arg1, arg2, arg3) {
824
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
825
- return addHeapObject(ret);
826
- }, arguments) };
827
- imports.wbg.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) {
631
+ imports.wbg.__wbg_forEach_e1cf6f7c8ecb7dae = function(arg0, arg1, arg2) {
828
632
  try {
829
633
  var state0 = {a: arg1, b: arg2};
830
634
  var cb0 = (arg0, arg1) => {
831
635
  const a = state0.a;
832
636
  state0.a = 0;
833
637
  try {
834
- return __wbg_adapter_92(a, state0.b, arg0, arg1);
638
+ return __wbg_adapter_110(a, state0.b, arg0, arg1);
835
639
  } finally {
836
640
  state0.a = a;
837
641
  }
838
642
  };
839
- getObject(arg0).forEach(cb0);
643
+ arg0.forEach(cb0);
840
644
  } finally {
841
645
  state0.a = state0.b = 0;
842
646
  }
843
647
  };
844
- imports.wbg.__wbg_set_da7be7bf0e037b14 = function(arg0, arg1, arg2) {
845
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
846
- return addHeapObject(ret);
847
- };
848
- imports.wbg.__wbg_fromEntries_d1b310956d20d858 = function() { return handleError(function (arg0) {
849
- const ret = Object.fromEntries(getObject(arg0));
850
- return addHeapObject(ret);
648
+ imports.wbg.__wbg_fromEntries_524679eecb0bdc2e = function() { return handleError(function (arg0) {
649
+ const ret = Object.fromEntries(arg0);
650
+ return ret;
851
651
  }, arguments) };
852
- imports.wbg.__wbg_values_099fd000c271c313 = function(arg0) {
853
- const ret = Object.values(getObject(arg0));
854
- return addHeapObject(ret);
652
+ imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
653
+ const ret = Array.from(arg0);
654
+ return ret;
855
655
  };
856
- imports.wbg.__wbg_new_2b55e405e4af4986 = function(arg0, arg1) {
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) {
857
671
  try {
858
672
  var state0 = {a: arg0, b: arg1};
859
673
  var cb0 = (arg0, arg1) => {
860
674
  const a = state0.a;
861
675
  state0.a = 0;
862
676
  try {
863
- return __wbg_adapter_92(a, state0.b, arg0, arg1);
677
+ return __wbg_adapter_110(a, state0.b, arg0, arg1);
864
678
  } finally {
865
679
  state0.a = a;
866
680
  }
867
681
  };
868
682
  const ret = new Promise(cb0);
869
- return addHeapObject(ret);
683
+ return ret;
870
684
  } finally {
871
685
  state0.a = state0.b = 0;
872
686
  }
873
687
  };
874
- imports.wbg.__wbg_resolve_ae38ad63c43ff98b = function(arg0) {
875
- const ret = Promise.resolve(getObject(arg0));
876
- return addHeapObject(ret);
688
+ imports.wbg.__wbg_new_3f4c5c451d69e970 = function() {
689
+ const ret = new Map();
690
+ return ret;
691
+ };
692
+ imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
693
+ const ret = new Map();
694
+ return ret;
695
+ };
696
+ imports.wbg.__wbg_new_78feb108b6472713 = function() {
697
+ const ret = new Array();
698
+ return ret;
699
+ };
700
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
701
+ const ret = new Error();
702
+ return ret;
877
703
  };
878
- imports.wbg.__wbg_then_8df675b8bb5d5e3c = function(arg0, arg1) {
879
- const ret = getObject(arg0).then(getObject(arg1));
880
- return addHeapObject(ret);
704
+ imports.wbg.__wbg_new_a324c5957dd8b845 = function() {
705
+ const ret = new Array();
706
+ return ret;
881
707
  };
882
- imports.wbg.__wbg_then_835b073a479138e5 = function(arg0, arg1, arg2) {
883
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
884
- return addHeapObject(ret);
708
+ imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
709
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
710
+ return ret;
711
+ };
712
+ imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
713
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
714
+ return ret;
885
715
  };
886
- imports.wbg.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
716
+ imports.wbg.__wbg_parse_def2e24ef1252aff = function() { return handleError(function (arg0, arg1) {
887
717
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
888
- return addHeapObject(ret);
718
+ return ret;
889
719
  }, arguments) };
890
- imports.wbg.__wbg_set_07da13cc24b69217 = function() { return handleError(function (arg0, arg1, arg2) {
891
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
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);
892
745
  return ret;
893
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;
796
+ }
797
+ const ret = false;
798
+ return ret;
799
+ };
800
+ imports.wbg.__wbindgen_closure_wrapper739 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 270, __wbg_adapter_30);
802
+ return ret;
803
+ };
894
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
895
- const ret = debugString(getObject(arg1));
805
+ const ret = debugString(arg1);
896
806
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
897
807
  const len1 = WASM_VECTOR_LEN;
898
- getInt32Memory0()[arg0 / 4 + 1] = len1;
899
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
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;
900
858
  };
901
859
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
902
860
  throw new Error(getStringFromWasm0(arg0, arg1));
903
861
  };
904
- imports.wbg.__wbindgen_closure_wrapper782 = function(arg0, arg1, arg2) {
905
- const ret = makeMutClosure(arg0, arg1, 298, __wbg_adapter_22);
906
- return addHeapObject(ret);
907
- };
908
862
 
909
863
  return imports;
910
864
  }
911
865
 
912
- function __wbg_init_memory(imports, maybe_memory) {
866
+ function __wbg_init_memory(imports, memory) {
913
867
 
914
868
  }
915
869
 
916
870
  function __wbg_finalize_init(instance, module) {
917
871
  wasm = instance.exports;
918
872
  __wbg_init.__wbindgen_wasm_module = module;
919
- cachedFloat64Memory0 = null;
920
- cachedInt32Memory0 = null;
921
- cachedUint32Memory0 = null;
922
- cachedUint8Memory0 = null;
873
+ cachedDataViewMemory0 = null;
874
+ cachedUint32ArrayMemory0 = null;
875
+ cachedUint8ArrayMemory0 = null;
923
876
 
924
877
 
878
+ wasm.__wbindgen_start();
925
879
  return wasm;
926
880
  }
927
881
 
928
882
  function initSync(module) {
929
883
  if (wasm !== undefined) return wasm;
930
884
 
885
+
886
+ if (typeof module !== 'undefined') {
887
+ if (Object.getPrototypeOf(module) === Object.prototype) {
888
+ ({module} = module)
889
+ } else {
890
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
891
+ }
892
+ }
893
+
931
894
  const imports = __wbg_get_imports();
932
895
 
933
896
  __wbg_init_memory(imports);
@@ -941,24 +904,33 @@ function initSync(module) {
941
904
  return __wbg_finalize_init(instance, module);
942
905
  }
943
906
 
944
- async function __wbg_init(input) {
907
+ async function __wbg_init(module_or_path) {
945
908
  if (wasm !== undefined) return wasm;
946
909
 
947
- if (typeof input === 'undefined') {
948
- input = new URL('acvm_js_bg.wasm', import.meta.url);
910
+
911
+ if (typeof module_or_path !== 'undefined') {
912
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
913
+ ({module_or_path} = module_or_path)
914
+ } else {
915
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
916
+ }
917
+ }
918
+
919
+ if (typeof module_or_path === 'undefined') {
920
+ module_or_path = new URL('acvm_js_bg.wasm', import.meta.url);
949
921
  }
950
922
  const imports = __wbg_get_imports();
951
923
 
952
- if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
953
- input = fetch(input);
924
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
925
+ module_or_path = fetch(module_or_path);
954
926
  }
955
927
 
956
928
  __wbg_init_memory(imports);
957
929
 
958
- const { instance, module } = await __wbg_load(await input, imports);
930
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
959
931
 
960
932
  return __wbg_finalize_init(instance, module);
961
933
  }
962
934
 
963
- export { initSync }
935
+ export { initSync };
964
936
  export default __wbg_init;