@aztec/bb.js 0.76.4 → 0.77.0-testnet-ignition.6
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/README.md +10 -2
- package/dest/browser/barretenberg/backend.d.ts +5 -1
- package/dest/browser/barretenberg/backend.d.ts.map +1 -1
- package/dest/browser/barretenberg/index.d.ts +3 -1
- package/dest/browser/barretenberg/index.d.ts.map +1 -1
- package/dest/browser/barretenberg-threads.js +1 -1
- package/dest/browser/barretenberg.js +1 -1
- package/dest/browser/barretenberg_api/index.d.ts +1 -0
- package/dest/browser/barretenberg_api/index.d.ts.map +1 -1
- package/dest/browser/barretenberg_wasm/barretenberg_wasm_base/index.d.ts.map +1 -1
- package/dest/browser/barretenberg_wasm/barretenberg_wasm_main/index.d.ts.map +1 -1
- package/dest/browser/barretenberg_wasm/fetch_code/browser/index.d.ts.map +1 -1
- package/dest/browser/barretenberg_wasm/index.d.ts +2 -2
- package/dest/browser/barretenberg_wasm/index.d.ts.map +1 -1
- package/dest/browser/crs/net_crs.d.ts.map +1 -1
- package/dest/browser/crs/node/index.d.ts +6 -4
- package/dest/browser/crs/node/index.d.ts.map +1 -1
- package/dest/browser/index.js +98 -38
- package/dest/browser/retry/index.d.ts +26 -0
- package/dest/browser/retry/index.d.ts.map +1 -0
- package/dest/node/barretenberg/__snapshots__/pedersen.test.js.snap +156 -0
- package/dest/node/barretenberg/__snapshots__/poseidon.test.js.snap +40 -0
- package/dest/node/barretenberg/backend.d.ts +5 -1
- package/dest/node/barretenberg/backend.d.ts.map +1 -1
- package/dest/node/barretenberg/backend.js +21 -4
- package/dest/node/barretenberg/index.d.ts +3 -1
- package/dest/node/barretenberg/index.d.ts.map +1 -1
- package/dest/node/barretenberg/index.js +11 -12
- package/dest/node/barretenberg_api/index.d.ts +1 -0
- package/dest/node/barretenberg_api/index.d.ts.map +1 -1
- package/dest/node/barretenberg_api/index.js +25 -1
- package/dest/node/barretenberg_wasm/barretenberg-threads.wasm.gz +0 -0
- package/dest/node/barretenberg_wasm/barretenberg_wasm_base/index.d.ts.map +1 -1
- package/dest/node/barretenberg_wasm/barretenberg_wasm_base/index.js +5 -6
- package/dest/node/barretenberg_wasm/barretenberg_wasm_main/index.d.ts.map +1 -1
- package/dest/node/barretenberg_wasm/barretenberg_wasm_main/index.js +6 -7
- package/dest/node/barretenberg_wasm/fetch_code/browser/index.d.ts.map +1 -1
- package/dest/node/barretenberg_wasm/fetch_code/browser/index.js +5 -2
- package/dest/node/barretenberg_wasm/fetch_code/node/index.js +2 -2
- package/dest/node/barretenberg_wasm/index.d.ts +2 -2
- package/dest/node/barretenberg_wasm/index.d.ts.map +1 -1
- package/dest/node/barretenberg_wasm/index.js +11 -9
- package/dest/node/barretenberg_wasm/index.test.js +3 -3
- package/dest/node/crs/net_crs.d.ts.map +1 -1
- package/dest/node/crs/net_crs.js +6 -5
- package/dest/node/crs/node/index.d.ts +6 -4
- package/dest/node/crs/node/index.d.ts.map +1 -1
- package/dest/node/crs/node/index.js +16 -13
- package/dest/node/examples/simple.test.js +2 -2
- package/dest/node/main.d.ts.map +1 -1
- package/dest/node/main.js +55 -65
- package/dest/node/retry/index.d.ts +26 -0
- package/dest/node/retry/index.d.ts.map +1 -0
- package/dest/node/retry/index.js +50 -0
- package/dest/node-cjs/barretenberg/backend.d.ts +5 -1
- package/dest/node-cjs/barretenberg/backend.d.ts.map +1 -1
- package/dest/node-cjs/barretenberg/backend.js +23 -5
- package/dest/node-cjs/barretenberg/index.d.ts +3 -1
- package/dest/node-cjs/barretenberg/index.d.ts.map +1 -1
- package/dest/node-cjs/barretenberg/index.js +11 -12
- package/dest/node-cjs/barretenberg_api/index.d.ts +1 -0
- package/dest/node-cjs/barretenberg_api/index.d.ts.map +1 -1
- package/dest/node-cjs/barretenberg_api/index.js +25 -1
- package/dest/node-cjs/barretenberg_wasm/barretenberg-threads.wasm.gz +0 -0
- package/dest/node-cjs/barretenberg_wasm/barretenberg_wasm_base/index.d.ts.map +1 -1
- package/dest/node-cjs/barretenberg_wasm/barretenberg_wasm_base/index.js +5 -6
- package/dest/node-cjs/barretenberg_wasm/barretenberg_wasm_main/index.d.ts.map +1 -1
- package/dest/node-cjs/barretenberg_wasm/barretenberg_wasm_main/index.js +6 -7
- package/dest/node-cjs/barretenberg_wasm/fetch_code/browser/index.d.ts.map +1 -1
- package/dest/node-cjs/barretenberg_wasm/fetch_code/browser/index.js +5 -2
- package/dest/node-cjs/barretenberg_wasm/fetch_code/node/index.js +2 -2
- package/dest/node-cjs/barretenberg_wasm/index.d.ts +2 -2
- package/dest/node-cjs/barretenberg_wasm/index.d.ts.map +1 -1
- package/dest/node-cjs/barretenberg_wasm/index.js +11 -9
- package/dest/node-cjs/barretenberg_wasm/index.test.js +3 -3
- package/dest/node-cjs/crs/net_crs.d.ts.map +1 -1
- package/dest/node-cjs/crs/net_crs.js +6 -5
- package/dest/node-cjs/crs/node/index.d.ts +6 -4
- package/dest/node-cjs/crs/node/index.d.ts.map +1 -1
- package/dest/node-cjs/crs/node/index.js +16 -13
- package/dest/node-cjs/examples/simple.test.js +2 -2
- package/dest/node-cjs/main.d.ts.map +1 -1
- package/dest/node-cjs/main.js +55 -65
- package/dest/node-cjs/retry/index.d.ts +26 -0
- package/dest/node-cjs/retry/index.d.ts.map +1 -0
- package/dest/node-cjs/retry/index.js +56 -0
- package/package.json +3 -3
- package/src/barretenberg/backend.ts +22 -3
- package/src/barretenberg/index.ts +19 -12
- package/src/barretenberg_api/index.ts +35 -0
- package/src/barretenberg_wasm/barretenberg_wasm_base/index.ts +4 -6
- package/src/barretenberg_wasm/barretenberg_wasm_main/index.ts +5 -7
- package/src/barretenberg_wasm/fetch_code/browser/index.ts +4 -1
- package/src/barretenberg_wasm/fetch_code/node/index.ts +1 -1
- package/src/barretenberg_wasm/index.test.ts +2 -2
- package/src/barretenberg_wasm/index.ts +21 -10
- package/src/crs/net_crs.ts +18 -9
- package/src/crs/node/index.ts +31 -15
- package/src/examples/simple.test.ts +1 -1
- package/src/main.ts +59 -70
- package/src/retry/index.ts +50 -0
package/dest/browser/index.js
CHANGED
|
@@ -2325,6 +2325,32 @@ var __webpack_exports__ = {};
|
|
|
2325
2325
|
H2: () => reconstructHonkProof,
|
|
2326
2326
|
ly: () => splitHonkProof
|
|
2327
2327
|
});
|
|
2328
|
+
function* backoffGenerator() {
|
|
2329
|
+
const v = [ 1, 1, 1, 2, 4, 8, 16, 32, 64 ];
|
|
2330
|
+
let i = 0;
|
|
2331
|
+
while (true) {
|
|
2332
|
+
yield v[Math.min(i++, v.length - 1)];
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
function* makeBackoff(retries) {
|
|
2336
|
+
for (const retry of retries) {
|
|
2337
|
+
yield retry;
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
async function retry(fn, backoff = backoffGenerator()) {
|
|
2341
|
+
while (true) {
|
|
2342
|
+
try {
|
|
2343
|
+
return await fn();
|
|
2344
|
+
} catch (err) {
|
|
2345
|
+
const s = backoff.next().value;
|
|
2346
|
+
if (s === undefined) {
|
|
2347
|
+
throw err;
|
|
2348
|
+
}
|
|
2349
|
+
await new Promise((resolve => setTimeout(resolve, s * 1e3)));
|
|
2350
|
+
continue;
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2328
2354
|
class NetCrs {
|
|
2329
2355
|
constructor(numPoints) {
|
|
2330
2356
|
this.numPoints = numPoints;
|
|
@@ -2338,18 +2364,18 @@ var __webpack_exports__ = {};
|
|
|
2338
2364
|
return this.data = new Uint8Array([]);
|
|
2339
2365
|
}
|
|
2340
2366
|
const g1End = this.numPoints * 64 - 1;
|
|
2341
|
-
const response = await fetch("https://aztec-ignition.s3.amazonaws.com/MAIN%20IGNITION/flat/g1.dat", {
|
|
2367
|
+
const response = await retry((() => fetch("https://aztec-ignition.s3.amazonaws.com/MAIN%20IGNITION/flat/g1.dat", {
|
|
2342
2368
|
headers: {
|
|
2343
2369
|
Range: `bytes=0-${g1End}`
|
|
2344
2370
|
},
|
|
2345
2371
|
cache: "force-cache"
|
|
2346
|
-
});
|
|
2372
|
+
})), makeBackoff([ 5, 5, 5 ]));
|
|
2347
2373
|
return this.data = new Uint8Array(await response.arrayBuffer());
|
|
2348
2374
|
}
|
|
2349
2375
|
async downloadG2Data() {
|
|
2350
|
-
const response2 = await fetch("https://aztec-ignition.s3.amazonaws.com/MAIN%20IGNITION/flat/g2.dat", {
|
|
2376
|
+
const response2 = await retry((() => fetch("https://aztec-ignition.s3.amazonaws.com/MAIN%20IGNITION/flat/g2.dat", {
|
|
2351
2377
|
cache: "force-cache"
|
|
2352
|
-
});
|
|
2378
|
+
})), makeBackoff([ 5, 5, 5 ]));
|
|
2353
2379
|
return this.g2Data = new Uint8Array(await response2.arrayBuffer());
|
|
2354
2380
|
}
|
|
2355
2381
|
getG1Data() {
|
|
@@ -3336,6 +3362,21 @@ var __webpack_exports__ = {};
|
|
|
3336
3362
|
}
|
|
3337
3363
|
}
|
|
3338
3364
|
Buffer128.SIZE_IN_BYTES = 128;
|
|
3365
|
+
function parseBigEndianU32Array(buffer, hasSizePrefix = false) {
|
|
3366
|
+
const dv = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
3367
|
+
let offset = 0;
|
|
3368
|
+
let count = buffer.byteLength >>> 2;
|
|
3369
|
+
if (hasSizePrefix) {
|
|
3370
|
+
count = dv.getUint32(0, false);
|
|
3371
|
+
offset = 4;
|
|
3372
|
+
}
|
|
3373
|
+
const out = new Array(count);
|
|
3374
|
+
for (let i = 0; i < count; i++) {
|
|
3375
|
+
out[i] = dv.getUint32(offset, false);
|
|
3376
|
+
offset += 4;
|
|
3377
|
+
}
|
|
3378
|
+
return out;
|
|
3379
|
+
}
|
|
3339
3380
|
class BarretenbergApi {
|
|
3340
3381
|
constructor(wasm) {
|
|
3341
3382
|
this.wasm = wasm;
|
|
@@ -3529,6 +3570,12 @@ var __webpack_exports__ = {};
|
|
|
3529
3570
|
const out = result.map(((r, i) => outTypes[i].fromBuffer(r)));
|
|
3530
3571
|
return out;
|
|
3531
3572
|
}
|
|
3573
|
+
async acirGatesAztecClient(acirVec) {
|
|
3574
|
+
const inArgs = [ acirVec ].map(serializeBufferable);
|
|
3575
|
+
const outTypes = [ BufferDeserializer() ];
|
|
3576
|
+
const resultBuffer = await this.wasm.callWasmExport("acir_gates_aztec_client", inArgs, outTypes.map((t => t.SIZE_IN_BYTES)));
|
|
3577
|
+
return parseBigEndianU32Array(resultBuffer[0], true);
|
|
3578
|
+
}
|
|
3532
3579
|
async acirNewAcirComposer(sizeHint) {
|
|
3533
3580
|
const inArgs = [ sizeHint ].map(serializeBufferable);
|
|
3534
3581
|
const outTypes = [ Ptr ];
|
|
@@ -4072,7 +4119,7 @@ var __webpack_exports__ = {};
|
|
|
4072
4119
|
var inline = __webpack_require__(477);
|
|
4073
4120
|
var inline_default = __webpack_require__.n(inline);
|
|
4074
4121
|
function Worker_fn() {
|
|
4075
|
-
return inline_default()('/*! For license information please see main.worker.worker.js.LICENSE.txt */\nvar __webpack_modules__ = {\n 227: (module, exports, __webpack_require__) => {\n exports.formatArgs = formatArgs;\n exports.save = save;\n exports.load = load;\n exports.useColors = useColors;\n exports.storage = localstorage();\n exports.destroy = (() => {\n let warned = false;\n return () => {\n if (!warned) {\n warned = true;\n console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");\n }\n };\n })();\n exports.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ];\n function useColors() {\n if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {\n return true;\n }\n if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false;\n }\n return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n }\n function formatArgs(args) {\n args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);\n if (!this.useColors) {\n return;\n }\n const c = "color: " + this.color;\n args.splice(1, 0, c, "color: inherit");\n let index = 0;\n let lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, (match => {\n if (match === "%%") {\n return;\n }\n index++;\n if (match === "%c") {\n lastC = index;\n }\n }));\n args.splice(lastC, 0, c);\n }\n exports.log = console.debug || console.log || (() => {});\n function save(namespaces) {\n try {\n if (namespaces) {\n exports.storage.setItem("debug", namespaces);\n } else {\n exports.storage.removeItem("debug");\n }\n } catch (error) {}\n }\n function load() {\n let r;\n try {\n r = exports.storage.getItem("debug");\n } catch (error) {}\n if (!r && typeof process !== "undefined" && "env" in process) {\n r = process.env.DEBUG;\n }\n return r;\n }\n function localstorage() {\n try {\n return localStorage;\n } catch (error) {}\n }\n module.exports = __webpack_require__(447)(exports);\n const {formatters} = module.exports;\n formatters.j = function(v) {\n try {\n return JSON.stringify(v);\n } catch (error) {\n return "[UnexpectedJSONParseError]: " + error.message;\n }\n };\n },\n 447: (module, __unused_webpack_exports, __webpack_require__) => {\n function setup(env) {\n createDebug.debug = createDebug;\n createDebug.default = createDebug;\n createDebug.coerce = coerce;\n createDebug.disable = disable;\n createDebug.enable = enable;\n createDebug.enabled = enabled;\n createDebug.humanize = __webpack_require__(824);\n createDebug.destroy = destroy;\n Object.keys(env).forEach((key => {\n createDebug[key] = env[key];\n }));\n createDebug.names = [];\n createDebug.skips = [];\n createDebug.formatters = {};\n function selectColor(namespace) {\n let hash = 0;\n for (let i = 0; i < namespace.length; i++) {\n hash = (hash << 5) - hash + namespace.charCodeAt(i);\n hash |= 0;\n }\n return createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n }\n createDebug.selectColor = selectColor;\n function createDebug(namespace) {\n let prevTime;\n let enableOverride = null;\n let namespacesCache;\n let enabledCache;\n function debug(...args) {\n if (!debug.enabled) {\n return;\n }\n const self = debug;\n const curr = Number(new Date);\n const ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n args[0] = createDebug.coerce(args[0]);\n if (typeof args[0] !== "string") {\n args.unshift("%O");\n }\n let index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, ((match, format) => {\n if (match === "%%") {\n return "%";\n }\n index++;\n const formatter = createDebug.formatters[format];\n if (typeof formatter === "function") {\n const val = args[index];\n match = formatter.call(self, val);\n args.splice(index, 1);\n index--;\n }\n return match;\n }));\n createDebug.formatArgs.call(self, args);\n const logFn = self.log || createDebug.log;\n logFn.apply(self, args);\n }\n debug.namespace = namespace;\n debug.useColors = createDebug.useColors();\n debug.color = createDebug.selectColor(namespace);\n debug.extend = extend;\n debug.destroy = createDebug.destroy;\n Object.defineProperty(debug, "enabled", {\n enumerable: true,\n configurable: false,\n get: () => {\n if (enableOverride !== null) {\n return enableOverride;\n }\n if (namespacesCache !== createDebug.namespaces) {\n namespacesCache = createDebug.namespaces;\n enabledCache = createDebug.enabled(namespace);\n }\n return enabledCache;\n },\n set: v => {\n enableOverride = v;\n }\n });\n if (typeof createDebug.init === "function") {\n createDebug.init(debug);\n }\n return debug;\n }\n function extend(namespace, delimiter) {\n const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);\n newDebug.log = this.log;\n return newDebug;\n }\n function enable(namespaces) {\n createDebug.save(namespaces);\n createDebug.namespaces = namespaces;\n createDebug.names = [];\n createDebug.skips = [];\n let i;\n const split = (typeof namespaces === "string" ? namespaces : "").split(/[\\s,]+/);\n const len = split.length;\n for (i = 0; i < len; i++) {\n if (!split[i]) {\n continue;\n }\n namespaces = split[i].replace(/\\*/g, ".*?");\n if (namespaces[0] === "-") {\n createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));\n } else {\n createDebug.names.push(new RegExp("^" + namespaces + "$"));\n }\n }\n }\n function disable() {\n const namespaces = [ ...createDebug.names.map(toNamespace), ...createDebug.skips.map(toNamespace).map((namespace => "-" + namespace)) ].join(",");\n createDebug.enable("");\n return namespaces;\n }\n function enabled(name) {\n if (name[name.length - 1] === "*") {\n return true;\n }\n let i;\n let len;\n for (i = 0, len = createDebug.skips.length; i < len; i++) {\n if (createDebug.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = createDebug.names.length; i < len; i++) {\n if (createDebug.names[i].test(name)) {\n return true;\n }\n }\n return false;\n }\n function toNamespace(regexp) {\n return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\\.\\*\\?$/, "*");\n }\n function coerce(val) {\n if (val instanceof Error) {\n return val.stack || val.message;\n }\n return val;\n }\n function destroy() {\n console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");\n }\n createDebug.enable(createDebug.load());\n return createDebug;\n }\n module.exports = setup;\n },\n 824: module => {\n var s = 1e3;\n var m = s * 60;\n var h = m * 60;\n var d = h * 24;\n var w = d * 7;\n var y = d * 365.25;\n module.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === "string" && val.length > 0) {\n return parse(val);\n } else if (type === "number" && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));\n };\n function parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || "ms").toLowerCase();\n switch (type) {\n case "years":\n case "year":\n case "yrs":\n case "yr":\n case "y":\n return n * y;\n\n case "weeks":\n case "week":\n case "w":\n return n * w;\n\n case "days":\n case "day":\n case "d":\n return n * d;\n\n case "hours":\n case "hour":\n case "hrs":\n case "hr":\n case "h":\n return n * h;\n\n case "minutes":\n case "minute":\n case "mins":\n case "min":\n case "m":\n return n * m;\n\n case "seconds":\n case "second":\n case "secs":\n case "sec":\n case "s":\n return n * s;\n\n case "milliseconds":\n case "millisecond":\n case "msecs":\n case "msec":\n case "ms":\n return n;\n\n default:\n return undefined;\n }\n }\n function fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + "d";\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + "h";\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + "m";\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + "s";\n }\n return ms + "ms";\n }\n function fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, "day");\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, "hour");\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, "minute");\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, "second");\n }\n return ms + " ms";\n }\n function plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");\n }\n },\n 477: module => {\n module.exports = function(content, workerConstructor, workerOptions, url) {\n var globalScope = self || window;\n try {\n try {\n var blob;\n try {\n blob = new globalScope.Blob([ content ]);\n } catch (e) {\n var BlobBuilder = globalScope.BlobBuilder || globalScope.WebKitBlobBuilder || globalScope.MozBlobBuilder || globalScope.MSBlobBuilder;\n blob = new BlobBuilder;\n blob.append(content);\n blob = blob.getBlob();\n }\n var URL = globalScope.URL || globalScope.webkitURL;\n var objectURL = URL.createObjectURL(blob);\n var worker = new globalScope[workerConstructor](objectURL, workerOptions);\n URL.revokeObjectURL(objectURL);\n return worker;\n } catch (e) {\n return new globalScope[workerConstructor]("data:application/javascript,".concat(encodeURIComponent(content)), workerOptions);\n }\n } catch (e) {\n if (!url) {\n throw Error("Inline worker is not supported");\n }\n return new globalScope[workerConstructor](url, workerOptions);\n }\n };\n }\n};\n\nvar __webpack_module_cache__ = {};\n\nfunction __webpack_require__(moduleId) {\n var cachedModule = __webpack_module_cache__[moduleId];\n if (cachedModule !== undefined) {\n return cachedModule.exports;\n }\n var module = __webpack_module_cache__[moduleId] = {\n exports: {}\n };\n __webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n return module.exports;\n}\n\n(() => {\n __webpack_require__.n = module => {\n var getter = module && module.__esModule ? () => module["default"] : () => module;\n __webpack_require__.d(getter, {\n a: getter\n });\n return getter;\n };\n})();\n\n(() => {\n __webpack_require__.d = (exports, definition) => {\n for (var key in definition) {\n if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: definition[key]\n });\n }\n }\n };\n})();\n\n(() => {\n __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\n})();\n\nvar __webpack_exports__ = {};\n\n(() => {\n const proxyMarker = Symbol("Comlink.proxy");\n const createEndpoint = Symbol("Comlink.endpoint");\n const releaseProxy = Symbol("Comlink.releaseProxy");\n const finalizer = Symbol("Comlink.finalizer");\n const throwMarker = Symbol("Comlink.thrown");\n const isObject = val => typeof val === "object" && val !== null || typeof val === "function";\n const proxyTransferHandler = {\n canHandle: val => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const {port1, port2} = new MessageChannel;\n expose(obj, port1);\n return [ port2, [ port2 ] ];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n }\n };\n const throwTransferHandler = {\n canHandle: value => isObject(value) && throwMarker in value,\n serialize({value}) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack\n }\n };\n } else {\n serialized = {\n isError: false,\n value\n };\n }\n return [ serialized, [] ];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n }\n };\n const transferHandlers = new Map([ [ "proxy", proxyTransferHandler ], [ "throw", throwTransferHandler ] ]);\n function isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === "*") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n }\n function expose(obj, ep = globalThis, allowedOrigins = [ "*" ]) {\n ep.addEventListener("message", (function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin \'${ev.origin}\' for comlink proxy`);\n return;\n }\n const {id, type, path} = Object.assign({\n path: []\n }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce(((obj, prop) => obj[prop]), obj);\n const rawValue = path.reduce(((obj, prop) => obj[prop]), obj);\n switch (type) {\n case "GET":\n {\n returnValue = rawValue;\n }\n break;\n\n case "SET":\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n\n case "APPLY":\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n\n case "CONSTRUCT":\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n\n case "ENDPOINT":\n {\n const {port1, port2} = new MessageChannel;\n expose(obj, port2);\n returnValue = transfer(port1, [ port1 ]);\n }\n break;\n\n case "RELEASE":\n {\n returnValue = undefined;\n }\n break;\n\n default:\n return;\n }\n } catch (value) {\n returnValue = {\n value,\n [throwMarker]: 0\n };\n }\n Promise.resolve(returnValue).catch((value => ({\n value,\n [throwMarker]: 0\n }))).then((returnValue => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), {\n id\n }), transferables);\n if (type === "RELEASE") {\n ep.removeEventListener("message", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === "function") {\n obj[finalizer]();\n }\n }\n })).catch((error => {\n const [wireValue, transferables] = toWireValue({\n value: new TypeError("Unserializable return value"),\n [throwMarker]: 0\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), {\n id\n }), transferables);\n }));\n }));\n if (ep.start) {\n ep.start();\n }\n }\n function isMessagePort(endpoint) {\n return endpoint.constructor.name === "MessagePort";\n }\n function closeEndPoint(endpoint) {\n if (isMessagePort(endpoint)) endpoint.close();\n }\n function wrap(ep, target) {\n return createProxy(ep, [], target);\n }\n function throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error("Proxy has been released and is not useable");\n }\n }\n function releaseEndpoint(ep) {\n return requestResponseMessage(ep, {\n type: "RELEASE"\n }).then((() => {\n closeEndPoint(ep);\n }));\n }\n const proxyCounter = new WeakMap;\n const proxyFinalizers = "FinalizationRegistry" in globalThis && new FinalizationRegistry((ep => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n }));\n function registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n }\n function unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n }\n function createProxy(ep, path = [], target = function() {}) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n isProxyReleased = true;\n };\n }\n if (prop === "then") {\n if (path.length === 0) {\n return {\n then: () => proxy\n };\n }\n const r = requestResponseMessage(ep, {\n type: "GET",\n path: path.map((p => p.toString()))\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, [ ...path, prop ]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, {\n type: "SET",\n path: [ ...path, prop ].map((p => p.toString())),\n value\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, {\n type: "ENDPOINT"\n }).then(fromWireValue);\n }\n if (last === "bind") {\n return createProxy(ep, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: "APPLY",\n path: path.map((p => p.toString())),\n argumentList\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: "CONSTRUCT",\n path: path.map((p => p.toString())),\n argumentList\n }, transferables).then(fromWireValue);\n }\n });\n registerProxy(proxy, ep);\n return proxy;\n }\n function myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n }\n function processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [ processed.map((v => v[0])), myFlat(processed.map((v => v[1]))) ];\n }\n const transferCache = new WeakMap;\n function transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n }\n function proxy(obj) {\n return Object.assign(obj, {\n [proxyMarker]: true\n });\n }\n function windowEndpoint(w, context = globalThis, targetOrigin = "*") {\n return {\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\n addEventListener: context.addEventListener.bind(context),\n removeEventListener: context.removeEventListener.bind(context)\n };\n }\n function toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [ {\n type: "HANDLER",\n name,\n value: serializedValue\n }, transferables ];\n }\n }\n return [ {\n type: "RAW",\n value\n }, transferCache.get(value) || [] ];\n }\n function fromWireValue(value) {\n switch (value.type) {\n case "HANDLER":\n return transferHandlers.get(value.name).deserialize(value.value);\n\n case "RAW":\n return value.value;\n }\n }\n function requestResponseMessage(ep, msg, transfers) {\n return new Promise((resolve => {\n const id = generateUUID();\n ep.addEventListener("message", (function l(ev) {\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\n return;\n }\n ep.removeEventListener("message", l);\n resolve(ev.data);\n }));\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({\n id\n }, msg), transfers);\n }));\n }\n function generateUUID() {\n return new Array(4).fill(0).map((() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))).join("-");\n }\n var browser = __webpack_require__(227);\n var browser_default = __webpack_require__.n(browser);\n function getSharedMemoryAvailable() {\n const globalScope = typeof window !== "undefined" ? window : globalThis;\n return typeof SharedArrayBuffer !== "undefined" && globalScope.crossOriginIsolated;\n }\n function getRemoteBarretenbergWasm(worker) {\n return wrap(worker);\n }\n function getNumCpu() {\n return navigator.hardwareConcurrency;\n }\n function threadLogger() {\n return undefined;\n }\n function killSelf() {\n self.close();\n }\n var inline = __webpack_require__(477);\n var inline_default = __webpack_require__.n(inline);\n function Worker_fn() {\n return inline_default()(\'/*! For license information please see thread.worker.worker.worker.js.LICENSE.txt */\\nvar __webpack_modules__ = {\\n 227: (module, exports, __webpack_require__) => {\\n exports.formatArgs = formatArgs;\\n exports.save = save;\\n exports.load = load;\\n exports.useColors = useColors;\\n exports.storage = localstorage();\\n exports.destroy = (() => {\\n let warned = false;\\n return () => {\\n if (!warned) {\\n warned = true;\\n console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");\\n }\\n };\\n })();\\n exports.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ];\\n function useColors() {\\n if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {\\n return true;\\n }\\n if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\\\/(\\\\d+)/)) {\\n return false;\\n }\\n return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\\\/(\\\\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\\\/(\\\\d+)/);\\n }\\n function formatArgs(args) {\\n args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);\\n if (!this.useColors) {\\n return;\\n }\\n const c = "color: " + this.color;\\n args.splice(1, 0, c, "color: inherit");\\n let index = 0;\\n let lastC = 0;\\n args[0].replace(/%[a-zA-Z%]/g, (match => {\\n if (match === "%%") {\\n return;\\n }\\n index++;\\n if (match === "%c") {\\n lastC = index;\\n }\\n }));\\n args.splice(lastC, 0, c);\\n }\\n exports.log = console.debug || console.log || (() => {});\\n function save(namespaces) {\\n try {\\n if (namespaces) {\\n exports.storage.setItem("debug", namespaces);\\n } else {\\n exports.storage.removeItem("debug");\\n }\\n } catch (error) {}\\n }\\n function load() {\\n let r;\\n try {\\n r = exports.storage.getItem("debug");\\n } catch (error) {}\\n if (!r && typeof process !== "undefined" && "env" in process) {\\n r = process.env.DEBUG;\\n }\\n return r;\\n }\\n function localstorage() {\\n try {\\n return localStorage;\\n } catch (error) {}\\n }\\n module.exports = __webpack_require__(447)(exports);\\n const {formatters} = module.exports;\\n formatters.j = function(v) {\\n try {\\n return JSON.stringify(v);\\n } catch (error) {\\n return "[UnexpectedJSONParseError]: " + error.message;\\n }\\n };\\n },\\n 447: (module, __unused_webpack_exports, __webpack_require__) => {\\n function setup(env) {\\n createDebug.debug = createDebug;\\n createDebug.default = createDebug;\\n createDebug.coerce = coerce;\\n createDebug.disable = disable;\\n createDebug.enable = enable;\\n createDebug.enabled = enabled;\\n createDebug.humanize = __webpack_require__(824);\\n createDebug.destroy = destroy;\\n Object.keys(env).forEach((key => {\\n createDebug[key] = env[key];\\n }));\\n createDebug.names = [];\\n createDebug.skips = [];\\n createDebug.formatters = {};\\n function selectColor(namespace) {\\n let hash = 0;\\n for (let i = 0; i < namespace.length; i++) {\\n hash = (hash << 5) - hash + namespace.charCodeAt(i);\\n hash |= 0;\\n }\\n return createDebug.colors[Math.abs(hash) % createDebug.colors.length];\\n }\\n createDebug.selectColor = selectColor;\\n function createDebug(namespace) {\\n let prevTime;\\n let enableOverride = null;\\n let namespacesCache;\\n let enabledCache;\\n function debug(...args) {\\n if (!debug.enabled) {\\n return;\\n }\\n const self = debug;\\n const curr = Number(new Date);\\n const ms = curr - (prevTime || curr);\\n self.diff = ms;\\n self.prev = prevTime;\\n self.curr = curr;\\n prevTime = curr;\\n args[0] = createDebug.coerce(args[0]);\\n if (typeof args[0] !== "string") {\\n args.unshift("%O");\\n }\\n let index = 0;\\n args[0] = args[0].replace(/%([a-zA-Z%])/g, ((match, format) => {\\n if (match === "%%") {\\n return "%";\\n }\\n index++;\\n const formatter = createDebug.formatters[format];\\n if (typeof formatter === "function") {\\n const val = args[index];\\n match = formatter.call(self, val);\\n args.splice(index, 1);\\n index--;\\n }\\n return match;\\n }));\\n createDebug.formatArgs.call(self, args);\\n const logFn = self.log || createDebug.log;\\n logFn.apply(self, args);\\n }\\n debug.namespace = namespace;\\n debug.useColors = createDebug.useColors();\\n debug.color = createDebug.selectColor(namespace);\\n debug.extend = extend;\\n debug.destroy = createDebug.destroy;\\n Object.defineProperty(debug, "enabled", {\\n enumerable: true,\\n configurable: false,\\n get: () => {\\n if (enableOverride !== null) {\\n return enableOverride;\\n }\\n if (namespacesCache !== createDebug.namespaces) {\\n namespacesCache = createDebug.namespaces;\\n enabledCache = createDebug.enabled(namespace);\\n }\\n return enabledCache;\\n },\\n set: v => {\\n enableOverride = v;\\n }\\n });\\n if (typeof createDebug.init === "function") {\\n createDebug.init(debug);\\n }\\n return debug;\\n }\\n function extend(namespace, delimiter) {\\n const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);\\n newDebug.log = this.log;\\n return newDebug;\\n }\\n function enable(namespaces) {\\n createDebug.save(namespaces);\\n createDebug.namespaces = namespaces;\\n createDebug.names = [];\\n createDebug.skips = [];\\n let i;\\n const split = (typeof namespaces === "string" ? namespaces : "").split(/[\\\\s,]+/);\\n const len = split.length;\\n for (i = 0; i < len; i++) {\\n if (!split[i]) {\\n continue;\\n }\\n namespaces = split[i].replace(/\\\\*/g, ".*?");\\n if (namespaces[0] === "-") {\\n createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));\\n } else {\\n createDebug.names.push(new RegExp("^" + namespaces + "$"));\\n }\\n }\\n }\\n function disable() {\\n const namespaces = [ ...createDebug.names.map(toNamespace), ...createDebug.skips.map(toNamespace).map((namespace => "-" + namespace)) ].join(",");\\n createDebug.enable("");\\n return namespaces;\\n }\\n function enabled(name) {\\n if (name[name.length - 1] === "*") {\\n return true;\\n }\\n let i;\\n let len;\\n for (i = 0, len = createDebug.skips.length; i < len; i++) {\\n if (createDebug.skips[i].test(name)) {\\n return false;\\n }\\n }\\n for (i = 0, len = createDebug.names.length; i < len; i++) {\\n if (createDebug.names[i].test(name)) {\\n return true;\\n }\\n }\\n return false;\\n }\\n function toNamespace(regexp) {\\n return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\\\\.\\\\*\\\\?$/, "*");\\n }\\n function coerce(val) {\\n if (val instanceof Error) {\\n return val.stack || val.message;\\n }\\n return val;\\n }\\n function destroy() {\\n console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");\\n }\\n createDebug.enable(createDebug.load());\\n return createDebug;\\n }\\n module.exports = setup;\\n },\\n 824: module => {\\n var s = 1e3;\\n var m = s * 60;\\n var h = m * 60;\\n var d = h * 24;\\n var w = d * 7;\\n var y = d * 365.25;\\n module.exports = function(val, options) {\\n options = options || {};\\n var type = typeof val;\\n if (type === "string" && val.length > 0) {\\n return parse(val);\\n } else if (type === "number" && isFinite(val)) {\\n return options.long ? fmtLong(val) : fmtShort(val);\\n }\\n throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));\\n };\\n function parse(str) {\\n str = String(str);\\n if (str.length > 100) {\\n return;\\n }\\n var match = /^(-?(?:\\\\d+)?\\\\.?\\\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);\\n if (!match) {\\n return;\\n }\\n var n = parseFloat(match[1]);\\n var type = (match[2] || "ms").toLowerCase();\\n switch (type) {\\n case "years":\\n case "year":\\n case "yrs":\\n case "yr":\\n case "y":\\n return n * y;\\n\\n case "weeks":\\n case "week":\\n case "w":\\n return n * w;\\n\\n case "days":\\n case "day":\\n case "d":\\n return n * d;\\n\\n case "hours":\\n case "hour":\\n case "hrs":\\n case "hr":\\n case "h":\\n return n * h;\\n\\n case "minutes":\\n case "minute":\\n case "mins":\\n case "min":\\n case "m":\\n return n * m;\\n\\n case "seconds":\\n case "second":\\n case "secs":\\n case "sec":\\n case "s":\\n return n * s;\\n\\n case "milliseconds":\\n case "millisecond":\\n case "msecs":\\n case "msec":\\n case "ms":\\n return n;\\n\\n default:\\n return undefined;\\n }\\n }\\n function fmtShort(ms) {\\n var msAbs = Math.abs(ms);\\n if (msAbs >= d) {\\n return Math.round(ms / d) + "d";\\n }\\n if (msAbs >= h) {\\n return Math.round(ms / h) + "h";\\n }\\n if (msAbs >= m) {\\n return Math.round(ms / m) + "m";\\n }\\n if (msAbs >= s) {\\n return Math.round(ms / s) + "s";\\n }\\n return ms + "ms";\\n }\\n function fmtLong(ms) {\\n var msAbs = Math.abs(ms);\\n if (msAbs >= d) {\\n return plural(ms, msAbs, d, "day");\\n }\\n if (msAbs >= h) {\\n return plural(ms, msAbs, h, "hour");\\n }\\n if (msAbs >= m) {\\n return plural(ms, msAbs, m, "minute");\\n }\\n if (msAbs >= s) {\\n return plural(ms, msAbs, s, "second");\\n }\\n return ms + " ms";\\n }\\n function plural(ms, msAbs, n, name) {\\n var isPlural = msAbs >= n * 1.5;\\n return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");\\n }\\n }\\n};\\n\\nvar __webpack_module_cache__ = {};\\n\\nfunction __webpack_require__(moduleId) {\\n var cachedModule = __webpack_module_cache__[moduleId];\\n if (cachedModule !== undefined) {\\n return cachedModule.exports;\\n }\\n var module = __webpack_module_cache__[moduleId] = {\\n exports: {}\\n };\\n __webpack_modules__[moduleId](module, module.exports, __webpack_require__);\\n return module.exports;\\n}\\n\\n(() => {\\n __webpack_require__.n = module => {\\n var getter = module && module.__esModule ? () => module["default"] : () => module;\\n __webpack_require__.d(getter, {\\n a: getter\\n });\\n return getter;\\n };\\n})();\\n\\n(() => {\\n __webpack_require__.d = (exports, definition) => {\\n for (var key in definition) {\\n if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\\n Object.defineProperty(exports, key, {\\n enumerable: true,\\n get: definition[key]\\n });\\n }\\n }\\n };\\n})();\\n\\n(() => {\\n __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\\n})();\\n\\nvar __webpack_exports__ = {};\\n\\n(() => {\\n const proxyMarker = Symbol("Comlink.proxy");\\n const createEndpoint = Symbol("Comlink.endpoint");\\n const releaseProxy = Symbol("Comlink.releaseProxy");\\n const finalizer = Symbol("Comlink.finalizer");\\n const throwMarker = Symbol("Comlink.thrown");\\n const isObject = val => typeof val === "object" && val !== null || typeof val === "function";\\n const proxyTransferHandler = {\\n canHandle: val => isObject(val) && val[proxyMarker],\\n serialize(obj) {\\n const {port1, port2} = new MessageChannel;\\n expose(obj, port1);\\n return [ port2, [ port2 ] ];\\n },\\n deserialize(port) {\\n port.start();\\n return comlink_wrap(port);\\n }\\n };\\n const throwTransferHandler = {\\n canHandle: value => isObject(value) && throwMarker in value,\\n serialize({value}) {\\n let serialized;\\n if (value instanceof Error) {\\n serialized = {\\n isError: true,\\n value: {\\n message: value.message,\\n name: value.name,\\n stack: value.stack\\n }\\n };\\n } else {\\n serialized = {\\n isError: false,\\n value\\n };\\n }\\n return [ serialized, [] ];\\n },\\n deserialize(serialized) {\\n if (serialized.isError) {\\n throw Object.assign(new Error(serialized.value.message), serialized.value);\\n }\\n throw serialized.value;\\n }\\n };\\n const transferHandlers = new Map([ [ "proxy", proxyTransferHandler ], [ "throw", throwTransferHandler ] ]);\\n function isAllowedOrigin(allowedOrigins, origin) {\\n for (const allowedOrigin of allowedOrigins) {\\n if (origin === allowedOrigin || allowedOrigin === "*") {\\n return true;\\n }\\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\\n return true;\\n }\\n }\\n return false;\\n }\\n function expose(obj, ep = globalThis, allowedOrigins = [ "*" ]) {\\n ep.addEventListener("message", (function callback(ev) {\\n if (!ev || !ev.data) {\\n return;\\n }\\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\\n console.warn(`Invalid origin \\\'${ev.origin}\\\' for comlink proxy`);\\n return;\\n }\\n const {id, type, path} = Object.assign({\\n path: []\\n }, ev.data);\\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\\n let returnValue;\\n try {\\n const parent = path.slice(0, -1).reduce(((obj, prop) => obj[prop]), obj);\\n const rawValue = path.reduce(((obj, prop) => obj[prop]), obj);\\n switch (type) {\\n case "GET":\\n {\\n returnValue = rawValue;\\n }\\n break;\\n\\n case "SET":\\n {\\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\\n returnValue = true;\\n }\\n break;\\n\\n case "APPLY":\\n {\\n returnValue = rawValue.apply(parent, argumentList);\\n }\\n break;\\n\\n case "CONSTRUCT":\\n {\\n const value = new rawValue(...argumentList);\\n returnValue = proxy(value);\\n }\\n break;\\n\\n case "ENDPOINT":\\n {\\n const {port1, port2} = new MessageChannel;\\n expose(obj, port2);\\n returnValue = transfer(port1, [ port1 ]);\\n }\\n break;\\n\\n case "RELEASE":\\n {\\n returnValue = undefined;\\n }\\n break;\\n\\n default:\\n return;\\n }\\n } catch (value) {\\n returnValue = {\\n value,\\n [throwMarker]: 0\\n };\\n }\\n Promise.resolve(returnValue).catch((value => ({\\n value,\\n [throwMarker]: 0\\n }))).then((returnValue => {\\n const [wireValue, transferables] = toWireValue(returnValue);\\n ep.postMessage(Object.assign(Object.assign({}, wireValue), {\\n id\\n }), transferables);\\n if (type === "RELEASE") {\\n ep.removeEventListener("message", callback);\\n closeEndPoint(ep);\\n if (finalizer in obj && typeof obj[finalizer] === "function") {\\n obj[finalizer]();\\n }\\n }\\n })).catch((error => {\\n const [wireValue, transferables] = toWireValue({\\n value: new TypeError("Unserializable return value"),\\n [throwMarker]: 0\\n });\\n ep.postMessage(Object.assign(Object.assign({}, wireValue), {\\n id\\n }), transferables);\\n }));\\n }));\\n if (ep.start) {\\n ep.start();\\n }\\n }\\n function isMessagePort(endpoint) {\\n return endpoint.constructor.name === "MessagePort";\\n }\\n function closeEndPoint(endpoint) {\\n if (isMessagePort(endpoint)) endpoint.close();\\n }\\n function comlink_wrap(ep, target) {\\n return createProxy(ep, [], target);\\n }\\n function throwIfProxyReleased(isReleased) {\\n if (isReleased) {\\n throw new Error("Proxy has been released and is not useable");\\n }\\n }\\n function releaseEndpoint(ep) {\\n return requestResponseMessage(ep, {\\n type: "RELEASE"\\n }).then((() => {\\n closeEndPoint(ep);\\n }));\\n }\\n const proxyCounter = new WeakMap;\\n const proxyFinalizers = "FinalizationRegistry" in globalThis && new FinalizationRegistry((ep => {\\n const newCount = (proxyCounter.get(ep) || 0) - 1;\\n proxyCounter.set(ep, newCount);\\n if (newCount === 0) {\\n releaseEndpoint(ep);\\n }\\n }));\\n function registerProxy(proxy, ep) {\\n const newCount = (proxyCounter.get(ep) || 0) + 1;\\n proxyCounter.set(ep, newCount);\\n if (proxyFinalizers) {\\n proxyFinalizers.register(proxy, ep, proxy);\\n }\\n }\\n function unregisterProxy(proxy) {\\n if (proxyFinalizers) {\\n proxyFinalizers.unregister(proxy);\\n }\\n }\\n function createProxy(ep, path = [], target = function() {}) {\\n let isProxyReleased = false;\\n const proxy = new Proxy(target, {\\n get(_target, prop) {\\n throwIfProxyReleased(isProxyReleased);\\n if (prop === releaseProxy) {\\n return () => {\\n unregisterProxy(proxy);\\n releaseEndpoint(ep);\\n isProxyReleased = true;\\n };\\n }\\n if (prop === "then") {\\n if (path.length === 0) {\\n return {\\n then: () => proxy\\n };\\n }\\n const r = requestResponseMessage(ep, {\\n type: "GET",\\n path: path.map((p => p.toString()))\\n }).then(fromWireValue);\\n return r.then.bind(r);\\n }\\n return createProxy(ep, [ ...path, prop ]);\\n },\\n set(_target, prop, rawValue) {\\n throwIfProxyReleased(isProxyReleased);\\n const [value, transferables] = toWireValue(rawValue);\\n return requestResponseMessage(ep, {\\n type: "SET",\\n path: [ ...path, prop ].map((p => p.toString())),\\n value\\n }, transferables).then(fromWireValue);\\n },\\n apply(_target, _thisArg, rawArgumentList) {\\n throwIfProxyReleased(isProxyReleased);\\n const last = path[path.length - 1];\\n if (last === createEndpoint) {\\n return requestResponseMessage(ep, {\\n type: "ENDPOINT"\\n }).then(fromWireValue);\\n }\\n if (last === "bind") {\\n return createProxy(ep, path.slice(0, -1));\\n }\\n const [argumentList, transferables] = processArguments(rawArgumentList);\\n return requestResponseMessage(ep, {\\n type: "APPLY",\\n path: path.map((p => p.toString())),\\n argumentList\\n }, transferables).then(fromWireValue);\\n },\\n construct(_target, rawArgumentList) {\\n throwIfProxyReleased(isProxyReleased);\\n const [argumentList, transferables] = processArguments(rawArgumentList);\\n return requestResponseMessage(ep, {\\n type: "CONSTRUCT",\\n path: path.map((p => p.toString())),\\n argumentList\\n }, transferables).then(fromWireValue);\\n }\\n });\\n registerProxy(proxy, ep);\\n return proxy;\\n }\\n function myFlat(arr) {\\n return Array.prototype.concat.apply([], arr);\\n }\\n function processArguments(argumentList) {\\n const processed = argumentList.map(toWireValue);\\n return [ processed.map((v => v[0])), myFlat(processed.map((v => v[1]))) ];\\n }\\n const transferCache = new WeakMap;\\n function transfer(obj, transfers) {\\n transferCache.set(obj, transfers);\\n return obj;\\n }\\n function proxy(obj) {\\n return Object.assign(obj, {\\n [proxyMarker]: true\\n });\\n }\\n function windowEndpoint(w, context = globalThis, targetOrigin = "*") {\\n return {\\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\\n addEventListener: context.addEventListener.bind(context),\\n removeEventListener: context.removeEventListener.bind(context)\\n };\\n }\\n function toWireValue(value) {\\n for (const [name, handler] of transferHandlers) {\\n if (handler.canHandle(value)) {\\n const [serializedValue, transferables] = handler.serialize(value);\\n return [ {\\n type: "HANDLER",\\n name,\\n value: serializedValue\\n }, transferables ];\\n }\\n }\\n return [ {\\n type: "RAW",\\n value\\n }, transferCache.get(value) || [] ];\\n }\\n function fromWireValue(value) {\\n switch (value.type) {\\n case "HANDLER":\\n return transferHandlers.get(value.name).deserialize(value.value);\\n\\n case "RAW":\\n return value.value;\\n }\\n }\\n function requestResponseMessage(ep, msg, transfers) {\\n return new Promise((resolve => {\\n const id = generateUUID();\\n ep.addEventListener("message", (function l(ev) {\\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\\n return;\\n }\\n ep.removeEventListener("message", l);\\n resolve(ev.data);\\n }));\\n if (ep.start) {\\n ep.start();\\n }\\n ep.postMessage(Object.assign({\\n id\\n }, msg), transfers);\\n }));\\n }\\n function generateUUID() {\\n return new Array(4).fill(0).map((() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))).join("-");\\n }\\n function getSharedMemoryAvailable() {\\n const globalScope = typeof window !== "undefined" ? window : globalThis;\\n return typeof SharedArrayBuffer !== "undefined" && globalScope.crossOriginIsolated;\\n }\\n function getRemoteBarretenbergWasm(worker) {\\n return wrap(worker);\\n }\\n function getNumCpu() {\\n return navigator.hardwareConcurrency;\\n }\\n function threadLogger() {\\n return undefined;\\n }\\n function killSelf() {\\n self.close();\\n }\\n var browser = __webpack_require__(227);\\n var browser_default = __webpack_require__.n(browser);\\n const randomBytes = len => {\\n const getWebCrypto = () => {\\n if (typeof window !== "undefined" && window.crypto) return window.crypto;\\n if (typeof globalThis !== "undefined" && globalThis.crypto) return globalThis.crypto;\\n return undefined;\\n };\\n const crypto = getWebCrypto();\\n if (!crypto) {\\n throw new Error("randomBytes UnsupportedEnvironment");\\n }\\n const buf = new Uint8Array(len);\\n const MAX_BYTES = 65536;\\n if (len > MAX_BYTES) {\\n for (let generated = 0; generated < len; generated += MAX_BYTES) {\\n crypto.getRandomValues(buf.subarray(generated, generated + MAX_BYTES));\\n }\\n } else {\\n crypto.getRandomValues(buf);\\n }\\n return buf;\\n };\\n const debug = browser_default()("bb.js:wasm");\\n class BarretenbergWasmBase {\\n constructor() {\\n this.memStore = {};\\n this.logger = debug;\\n }\\n getImportObj(memory) {\\n const importObj = {\\n wasi_snapshot_preview1: {\\n random_get: (out, length) => {\\n out = out >>> 0;\\n const randomData = randomBytes(length);\\n const mem = this.getMemory();\\n mem.set(randomData, out);\\n },\\n clock_time_get: (a1, a2, out) => {\\n out = out >>> 0;\\n const ts = BigInt((new Date).getTime()) * 1000000n;\\n const view = new DataView(this.getMemory().buffer);\\n view.setBigUint64(out, ts, true);\\n },\\n proc_exit: () => {\\n this.logger("PANIC: proc_exit was called.");\\n throw new Error;\\n }\\n },\\n env: {\\n logstr: addr => {\\n const str = this.stringFromAddress(addr);\\n const m = this.getMemory();\\n const str2 = `${str} (mem: ${(m.length / (1024 * 1024)).toFixed(2)}MiB)`;\\n this.logger(str2);\\n if (str2.startsWith("WARNING:")) {\\n this.logger((new Error).stack);\\n }\\n },\\n get_data: (keyAddr, outBufAddr) => {\\n const key = this.stringFromAddress(keyAddr);\\n outBufAddr = outBufAddr >>> 0;\\n const data = this.memStore[key];\\n if (!data) {\\n this.logger(`get_data miss ${key}`);\\n return;\\n }\\n this.writeMemory(outBufAddr, data);\\n },\\n set_data: (keyAddr, dataAddr, dataLength) => {\\n const key = this.stringFromAddress(keyAddr);\\n dataAddr = dataAddr >>> 0;\\n this.memStore[key] = this.getMemorySlice(dataAddr, dataAddr + dataLength);\\n },\\n memory\\n }\\n };\\n return importObj;\\n }\\n exports() {\\n return this.instance.exports;\\n }\\n call(name, ...args) {\\n if (!this.exports()[name]) {\\n throw new Error(`WASM function ${name} not found.`);\\n }\\n try {\\n return this.exports()[name](...args) >>> 0;\\n } catch (err) {\\n const message = `WASM function ${name} aborted, error: ${err}`;\\n this.logger(message);\\n this.logger(err.stack);\\n throw err;\\n }\\n }\\n memSize() {\\n return this.getMemory().length;\\n }\\n getMemorySlice(start, end) {\\n return this.getMemory().subarray(start, end).slice();\\n }\\n writeMemory(offset, arr) {\\n const mem = this.getMemory();\\n mem.set(arr, offset);\\n }\\n getMemory() {\\n return new Uint8Array(this.memory.buffer);\\n }\\n stringFromAddress(addr) {\\n addr = addr >>> 0;\\n const m = this.getMemory();\\n let i = addr;\\n for (;m[i] !== 0; ++i) ;\\n const textDecoder = new TextDecoder("ascii");\\n return textDecoder.decode(m.slice(addr, i));\\n }\\n }\\n class BarretenbergWasmThread extends BarretenbergWasmBase {\\n async initThread(module, memory) {\\n this.logger = threadLogger() || this.logger;\\n this.memory = memory;\\n this.instance = await WebAssembly.instantiate(module, this.getImportObj(this.memory));\\n }\\n destroy() {\\n killSelf();\\n }\\n getImportObj(memory) {\\n const baseImports = super.getImportObj(memory);\\n return {\\n ...baseImports,\\n wasi: {\\n "thread-spawn": () => {\\n this.logger("PANIC: threads cannot spawn threads!");\\n this.logger((new Error).stack);\\n killSelf();\\n }\\n },\\n env: {\\n ...baseImports.env,\\n env_hardware_concurrency: () => 1\\n }\\n };\\n }\\n }\\n self.onmessage = function(e) {\\n if (e.data.debug) {\\n browser_default().enable(e.data.debug);\\n }\\n };\\n expose(new BarretenbergWasmThread);\\n self.postMessage({\\n ready: true\\n });\\n const thread_worker = null;\\n})();\', "Worker", undefined, undefined);\n }\n function createThreadWorker() {\n const worker = new Worker_fn;\n const debugStr = browser_default().disable();\n browser_default().enable(debugStr);\n worker.postMessage({\n debug: debugStr\n });\n return worker;\n }\n const randomBytes = len => {\n const getWebCrypto = () => {\n if (typeof window !== "undefined" && window.crypto) return window.crypto;\n if (typeof globalThis !== "undefined" && globalThis.crypto) return globalThis.crypto;\n return undefined;\n };\n const crypto = getWebCrypto();\n if (!crypto) {\n throw new Error("randomBytes UnsupportedEnvironment");\n }\n const buf = new Uint8Array(len);\n const MAX_BYTES = 65536;\n if (len > MAX_BYTES) {\n for (let generated = 0; generated < len; generated += MAX_BYTES) {\n crypto.getRandomValues(buf.subarray(generated, generated + MAX_BYTES));\n }\n } else {\n crypto.getRandomValues(buf);\n }\n return buf;\n };\n const debug = browser_default()("bb.js:wasm");\n class BarretenbergWasmBase {\n constructor() {\n this.memStore = {};\n this.logger = debug;\n }\n getImportObj(memory) {\n const importObj = {\n wasi_snapshot_preview1: {\n random_get: (out, length) => {\n out = out >>> 0;\n const randomData = randomBytes(length);\n const mem = this.getMemory();\n mem.set(randomData, out);\n },\n clock_time_get: (a1, a2, out) => {\n out = out >>> 0;\n const ts = BigInt((new Date).getTime()) * 1000000n;\n const view = new DataView(this.getMemory().buffer);\n view.setBigUint64(out, ts, true);\n },\n proc_exit: () => {\n this.logger("PANIC: proc_exit was called.");\n throw new Error;\n }\n },\n env: {\n logstr: addr => {\n const str = this.stringFromAddress(addr);\n const m = this.getMemory();\n const str2 = `${str} (mem: ${(m.length / (1024 * 1024)).toFixed(2)}MiB)`;\n this.logger(str2);\n if (str2.startsWith("WARNING:")) {\n this.logger((new Error).stack);\n }\n },\n get_data: (keyAddr, outBufAddr) => {\n const key = this.stringFromAddress(keyAddr);\n outBufAddr = outBufAddr >>> 0;\n const data = this.memStore[key];\n if (!data) {\n this.logger(`get_data miss ${key}`);\n return;\n }\n this.writeMemory(outBufAddr, data);\n },\n set_data: (keyAddr, dataAddr, dataLength) => {\n const key = this.stringFromAddress(keyAddr);\n dataAddr = dataAddr >>> 0;\n this.memStore[key] = this.getMemorySlice(dataAddr, dataAddr + dataLength);\n },\n memory\n }\n };\n return importObj;\n }\n exports() {\n return this.instance.exports;\n }\n call(name, ...args) {\n if (!this.exports()[name]) {\n throw new Error(`WASM function ${name} not found.`);\n }\n try {\n return this.exports()[name](...args) >>> 0;\n } catch (err) {\n const message = `WASM function ${name} aborted, error: ${err}`;\n this.logger(message);\n this.logger(err.stack);\n throw err;\n }\n }\n memSize() {\n return this.getMemory().length;\n }\n getMemorySlice(start, end) {\n return this.getMemory().subarray(start, end).slice();\n }\n writeMemory(offset, arr) {\n const mem = this.getMemory();\n mem.set(arr, offset);\n }\n getMemory() {\n return new Uint8Array(this.memory.buffer);\n }\n stringFromAddress(addr) {\n addr = addr >>> 0;\n const m = this.getMemory();\n let i = addr;\n for (;m[i] !== 0; ++i) ;\n const textDecoder = new TextDecoder("ascii");\n return textDecoder.decode(m.slice(addr, i));\n }\n }\n class HeapAllocator {\n constructor(wasm) {\n this.wasm = wasm;\n this.allocs = [];\n this.inScratchRemaining = 1024;\n this.outScratchRemaining = 1024;\n }\n getInputs(buffers) {\n return buffers.map((bufOrNum => {\n if (typeof bufOrNum === "object") {\n if (bufOrNum.length <= this.inScratchRemaining) {\n const ptr = this.inScratchRemaining -= bufOrNum.length;\n this.wasm.writeMemory(ptr, bufOrNum);\n return ptr;\n } else {\n const ptr = this.wasm.call("bbmalloc", bufOrNum.length);\n this.wasm.writeMemory(ptr, bufOrNum);\n this.allocs.push(ptr);\n return ptr;\n }\n } else {\n return bufOrNum;\n }\n }));\n }\n getOutputPtrs(outLens) {\n return outLens.map((len => {\n const size = len || 4;\n if (size <= this.outScratchRemaining) {\n return this.outScratchRemaining -= size;\n } else {\n const ptr = this.wasm.call("bbmalloc", size);\n this.allocs.push(ptr);\n return ptr;\n }\n }));\n }\n addOutputPtr(ptr) {\n if (ptr >= 1024) {\n this.allocs.push(ptr);\n }\n }\n freeAll() {\n for (const ptr of this.allocs) {\n this.wasm.call("bbfree", ptr);\n }\n }\n }\n const barretenberg_wasm_main_debug = browser_default()("bb.js:wasm");\n class BarretenbergWasmMain extends BarretenbergWasmBase {\n constructor() {\n super(...arguments);\n this.workers = [];\n this.remoteWasms = [];\n this.nextWorker = 0;\n this.nextThreadId = 1;\n }\n getNumThreads() {\n return this.workers.length + 1;\n }\n async init(module, threads = Math.min(getNumCpu(), BarretenbergWasmMain.MAX_THREADS), logger = barretenberg_wasm_main_debug, initial = 32, maximum = 2 ** 16) {\n this.logger = logger;\n const initialMb = initial * 2 ** 16 / (1024 * 1024);\n const maxMb = maximum * 2 ** 16 / (1024 * 1024);\n const shared = getSharedMemoryAvailable();\n this.logger(`initial mem: ${initial} pages, ${initialMb}MiB. ` + `max mem: ${maximum} pages, ${maxMb}MiB. ` + `threads: ${threads}, shared: ${shared}`);\n this.memory = new WebAssembly.Memory({\n initial,\n maximum,\n shared\n });\n const instance = await WebAssembly.instantiate(module, this.getImportObj(this.memory));\n this.instance = instance;\n this.call("_initialize");\n if (threads > 1) {\n this.logger(`creating ${threads} worker threads...`);\n this.workers = await Promise.all(Array.from({\n length: threads - 1\n }).map(createThreadWorker));\n this.remoteWasms = await Promise.all(this.workers.map(getRemoteBarretenbergWasm));\n await Promise.all(this.remoteWasms.map((w => w.initThread(module, this.memory))));\n }\n }\n async destroy() {\n await Promise.all(this.workers.map((w => w.terminate())));\n }\n getImportObj(memory) {\n const baseImports = super.getImportObj(memory);\n return {\n ...baseImports,\n wasi: {\n "thread-spawn": arg => {\n arg = arg >>> 0;\n const id = this.nextThreadId++;\n const worker = this.nextWorker++ % this.remoteWasms.length;\n this.remoteWasms[worker].call("wasi_thread_start", id, arg).catch(this.logger);\n return id;\n }\n },\n env: {\n ...baseImports.env,\n env_hardware_concurrency: () => this.remoteWasms.length + 1\n }\n };\n }\n callWasmExport(funcName, inArgs, outLens) {\n const alloc = new HeapAllocator(this);\n const inPtrs = alloc.getInputs(inArgs);\n const outPtrs = alloc.getOutputPtrs(outLens);\n this.call(funcName, ...inPtrs, ...outPtrs);\n const outArgs = this.getOutputArgs(outLens, outPtrs, alloc);\n alloc.freeAll();\n return outArgs;\n }\n getOutputArgs(outLens, outPtrs, alloc) {\n return outLens.map(((len, i) => {\n if (len) {\n return this.getMemorySlice(outPtrs[i], outPtrs[i] + len);\n }\n const slice = this.getMemorySlice(outPtrs[i], outPtrs[i] + 4);\n const ptr = new DataView(slice.buffer, slice.byteOffset, slice.byteLength).getUint32(0, true);\n alloc.addOutputPtr(ptr);\n const lslice = this.getMemorySlice(ptr, ptr + 4);\n const length = new DataView(lslice.buffer, lslice.byteOffset, lslice.byteLength).getUint32(0, false);\n return this.getMemorySlice(ptr + 4, ptr + 4 + length);\n }));\n }\n }\n BarretenbergWasmMain.MAX_THREADS = 32;\n self.onmessage = function(e) {\n if (e.data.debug) {\n browser_default().enable(e.data.debug);\n }\n };\n expose(new BarretenbergWasmMain);\n self.postMessage({\n ready: true\n });\n const main_worker = null;\n})();', "Worker", undefined, undefined);
|
|
4122
|
+
return inline_default()('/*! For license information please see main.worker.worker.js.LICENSE.txt */\nvar __webpack_modules__ = {\n 227: (module, exports, __webpack_require__) => {\n exports.formatArgs = formatArgs;\n exports.save = save;\n exports.load = load;\n exports.useColors = useColors;\n exports.storage = localstorage();\n exports.destroy = (() => {\n let warned = false;\n return () => {\n if (!warned) {\n warned = true;\n console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");\n }\n };\n })();\n exports.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ];\n function useColors() {\n if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {\n return true;\n }\n if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false;\n }\n return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n }\n function formatArgs(args) {\n args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);\n if (!this.useColors) {\n return;\n }\n const c = "color: " + this.color;\n args.splice(1, 0, c, "color: inherit");\n let index = 0;\n let lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, (match => {\n if (match === "%%") {\n return;\n }\n index++;\n if (match === "%c") {\n lastC = index;\n }\n }));\n args.splice(lastC, 0, c);\n }\n exports.log = console.debug || console.log || (() => {});\n function save(namespaces) {\n try {\n if (namespaces) {\n exports.storage.setItem("debug", namespaces);\n } else {\n exports.storage.removeItem("debug");\n }\n } catch (error) {}\n }\n function load() {\n let r;\n try {\n r = exports.storage.getItem("debug");\n } catch (error) {}\n if (!r && typeof process !== "undefined" && "env" in process) {\n r = process.env.DEBUG;\n }\n return r;\n }\n function localstorage() {\n try {\n return localStorage;\n } catch (error) {}\n }\n module.exports = __webpack_require__(447)(exports);\n const {formatters} = module.exports;\n formatters.j = function(v) {\n try {\n return JSON.stringify(v);\n } catch (error) {\n return "[UnexpectedJSONParseError]: " + error.message;\n }\n };\n },\n 447: (module, __unused_webpack_exports, __webpack_require__) => {\n function setup(env) {\n createDebug.debug = createDebug;\n createDebug.default = createDebug;\n createDebug.coerce = coerce;\n createDebug.disable = disable;\n createDebug.enable = enable;\n createDebug.enabled = enabled;\n createDebug.humanize = __webpack_require__(824);\n createDebug.destroy = destroy;\n Object.keys(env).forEach((key => {\n createDebug[key] = env[key];\n }));\n createDebug.names = [];\n createDebug.skips = [];\n createDebug.formatters = {};\n function selectColor(namespace) {\n let hash = 0;\n for (let i = 0; i < namespace.length; i++) {\n hash = (hash << 5) - hash + namespace.charCodeAt(i);\n hash |= 0;\n }\n return createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n }\n createDebug.selectColor = selectColor;\n function createDebug(namespace) {\n let prevTime;\n let enableOverride = null;\n let namespacesCache;\n let enabledCache;\n function debug(...args) {\n if (!debug.enabled) {\n return;\n }\n const self = debug;\n const curr = Number(new Date);\n const ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n args[0] = createDebug.coerce(args[0]);\n if (typeof args[0] !== "string") {\n args.unshift("%O");\n }\n let index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, ((match, format) => {\n if (match === "%%") {\n return "%";\n }\n index++;\n const formatter = createDebug.formatters[format];\n if (typeof formatter === "function") {\n const val = args[index];\n match = formatter.call(self, val);\n args.splice(index, 1);\n index--;\n }\n return match;\n }));\n createDebug.formatArgs.call(self, args);\n const logFn = self.log || createDebug.log;\n logFn.apply(self, args);\n }\n debug.namespace = namespace;\n debug.useColors = createDebug.useColors();\n debug.color = createDebug.selectColor(namespace);\n debug.extend = extend;\n debug.destroy = createDebug.destroy;\n Object.defineProperty(debug, "enabled", {\n enumerable: true,\n configurable: false,\n get: () => {\n if (enableOverride !== null) {\n return enableOverride;\n }\n if (namespacesCache !== createDebug.namespaces) {\n namespacesCache = createDebug.namespaces;\n enabledCache = createDebug.enabled(namespace);\n }\n return enabledCache;\n },\n set: v => {\n enableOverride = v;\n }\n });\n if (typeof createDebug.init === "function") {\n createDebug.init(debug);\n }\n return debug;\n }\n function extend(namespace, delimiter) {\n const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);\n newDebug.log = this.log;\n return newDebug;\n }\n function enable(namespaces) {\n createDebug.save(namespaces);\n createDebug.namespaces = namespaces;\n createDebug.names = [];\n createDebug.skips = [];\n let i;\n const split = (typeof namespaces === "string" ? namespaces : "").split(/[\\s,]+/);\n const len = split.length;\n for (i = 0; i < len; i++) {\n if (!split[i]) {\n continue;\n }\n namespaces = split[i].replace(/\\*/g, ".*?");\n if (namespaces[0] === "-") {\n createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));\n } else {\n createDebug.names.push(new RegExp("^" + namespaces + "$"));\n }\n }\n }\n function disable() {\n const namespaces = [ ...createDebug.names.map(toNamespace), ...createDebug.skips.map(toNamespace).map((namespace => "-" + namespace)) ].join(",");\n createDebug.enable("");\n return namespaces;\n }\n function enabled(name) {\n if (name[name.length - 1] === "*") {\n return true;\n }\n let i;\n let len;\n for (i = 0, len = createDebug.skips.length; i < len; i++) {\n if (createDebug.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = createDebug.names.length; i < len; i++) {\n if (createDebug.names[i].test(name)) {\n return true;\n }\n }\n return false;\n }\n function toNamespace(regexp) {\n return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\\.\\*\\?$/, "*");\n }\n function coerce(val) {\n if (val instanceof Error) {\n return val.stack || val.message;\n }\n return val;\n }\n function destroy() {\n console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");\n }\n createDebug.enable(createDebug.load());\n return createDebug;\n }\n module.exports = setup;\n },\n 824: module => {\n var s = 1e3;\n var m = s * 60;\n var h = m * 60;\n var d = h * 24;\n var w = d * 7;\n var y = d * 365.25;\n module.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === "string" && val.length > 0) {\n return parse(val);\n } else if (type === "number" && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));\n };\n function parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || "ms").toLowerCase();\n switch (type) {\n case "years":\n case "year":\n case "yrs":\n case "yr":\n case "y":\n return n * y;\n\n case "weeks":\n case "week":\n case "w":\n return n * w;\n\n case "days":\n case "day":\n case "d":\n return n * d;\n\n case "hours":\n case "hour":\n case "hrs":\n case "hr":\n case "h":\n return n * h;\n\n case "minutes":\n case "minute":\n case "mins":\n case "min":\n case "m":\n return n * m;\n\n case "seconds":\n case "second":\n case "secs":\n case "sec":\n case "s":\n return n * s;\n\n case "milliseconds":\n case "millisecond":\n case "msecs":\n case "msec":\n case "ms":\n return n;\n\n default:\n return undefined;\n }\n }\n function fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + "d";\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + "h";\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + "m";\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + "s";\n }\n return ms + "ms";\n }\n function fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, "day");\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, "hour");\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, "minute");\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, "second");\n }\n return ms + " ms";\n }\n function plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");\n }\n },\n 477: module => {\n module.exports = function(content, workerConstructor, workerOptions, url) {\n var globalScope = self || window;\n try {\n try {\n var blob;\n try {\n blob = new globalScope.Blob([ content ]);\n } catch (e) {\n var BlobBuilder = globalScope.BlobBuilder || globalScope.WebKitBlobBuilder || globalScope.MozBlobBuilder || globalScope.MSBlobBuilder;\n blob = new BlobBuilder;\n blob.append(content);\n blob = blob.getBlob();\n }\n var URL = globalScope.URL || globalScope.webkitURL;\n var objectURL = URL.createObjectURL(blob);\n var worker = new globalScope[workerConstructor](objectURL, workerOptions);\n URL.revokeObjectURL(objectURL);\n return worker;\n } catch (e) {\n return new globalScope[workerConstructor]("data:application/javascript,".concat(encodeURIComponent(content)), workerOptions);\n }\n } catch (e) {\n if (!url) {\n throw Error("Inline worker is not supported");\n }\n return new globalScope[workerConstructor](url, workerOptions);\n }\n };\n }\n};\n\nvar __webpack_module_cache__ = {};\n\nfunction __webpack_require__(moduleId) {\n var cachedModule = __webpack_module_cache__[moduleId];\n if (cachedModule !== undefined) {\n return cachedModule.exports;\n }\n var module = __webpack_module_cache__[moduleId] = {\n exports: {}\n };\n __webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n return module.exports;\n}\n\n(() => {\n __webpack_require__.n = module => {\n var getter = module && module.__esModule ? () => module["default"] : () => module;\n __webpack_require__.d(getter, {\n a: getter\n });\n return getter;\n };\n})();\n\n(() => {\n __webpack_require__.d = (exports, definition) => {\n for (var key in definition) {\n if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: definition[key]\n });\n }\n }\n };\n})();\n\n(() => {\n __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\n})();\n\nvar __webpack_exports__ = {};\n\n(() => {\n const proxyMarker = Symbol("Comlink.proxy");\n const createEndpoint = Symbol("Comlink.endpoint");\n const releaseProxy = Symbol("Comlink.releaseProxy");\n const finalizer = Symbol("Comlink.finalizer");\n const throwMarker = Symbol("Comlink.thrown");\n const isObject = val => typeof val === "object" && val !== null || typeof val === "function";\n const proxyTransferHandler = {\n canHandle: val => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const {port1, port2} = new MessageChannel;\n expose(obj, port1);\n return [ port2, [ port2 ] ];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n }\n };\n const throwTransferHandler = {\n canHandle: value => isObject(value) && throwMarker in value,\n serialize({value}) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack\n }\n };\n } else {\n serialized = {\n isError: false,\n value\n };\n }\n return [ serialized, [] ];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n }\n };\n const transferHandlers = new Map([ [ "proxy", proxyTransferHandler ], [ "throw", throwTransferHandler ] ]);\n function isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === "*") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n }\n function expose(obj, ep = globalThis, allowedOrigins = [ "*" ]) {\n ep.addEventListener("message", (function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin \'${ev.origin}\' for comlink proxy`);\n return;\n }\n const {id, type, path} = Object.assign({\n path: []\n }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce(((obj, prop) => obj[prop]), obj);\n const rawValue = path.reduce(((obj, prop) => obj[prop]), obj);\n switch (type) {\n case "GET":\n {\n returnValue = rawValue;\n }\n break;\n\n case "SET":\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n\n case "APPLY":\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n\n case "CONSTRUCT":\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n\n case "ENDPOINT":\n {\n const {port1, port2} = new MessageChannel;\n expose(obj, port2);\n returnValue = transfer(port1, [ port1 ]);\n }\n break;\n\n case "RELEASE":\n {\n returnValue = undefined;\n }\n break;\n\n default:\n return;\n }\n } catch (value) {\n returnValue = {\n value,\n [throwMarker]: 0\n };\n }\n Promise.resolve(returnValue).catch((value => ({\n value,\n [throwMarker]: 0\n }))).then((returnValue => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), {\n id\n }), transferables);\n if (type === "RELEASE") {\n ep.removeEventListener("message", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === "function") {\n obj[finalizer]();\n }\n }\n })).catch((error => {\n const [wireValue, transferables] = toWireValue({\n value: new TypeError("Unserializable return value"),\n [throwMarker]: 0\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), {\n id\n }), transferables);\n }));\n }));\n if (ep.start) {\n ep.start();\n }\n }\n function isMessagePort(endpoint) {\n return endpoint.constructor.name === "MessagePort";\n }\n function closeEndPoint(endpoint) {\n if (isMessagePort(endpoint)) endpoint.close();\n }\n function wrap(ep, target) {\n return createProxy(ep, [], target);\n }\n function throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error("Proxy has been released and is not useable");\n }\n }\n function releaseEndpoint(ep) {\n return requestResponseMessage(ep, {\n type: "RELEASE"\n }).then((() => {\n closeEndPoint(ep);\n }));\n }\n const proxyCounter = new WeakMap;\n const proxyFinalizers = "FinalizationRegistry" in globalThis && new FinalizationRegistry((ep => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n }));\n function registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n }\n function unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n }\n function createProxy(ep, path = [], target = function() {}) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n isProxyReleased = true;\n };\n }\n if (prop === "then") {\n if (path.length === 0) {\n return {\n then: () => proxy\n };\n }\n const r = requestResponseMessage(ep, {\n type: "GET",\n path: path.map((p => p.toString()))\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, [ ...path, prop ]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, {\n type: "SET",\n path: [ ...path, prop ].map((p => p.toString())),\n value\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, {\n type: "ENDPOINT"\n }).then(fromWireValue);\n }\n if (last === "bind") {\n return createProxy(ep, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: "APPLY",\n path: path.map((p => p.toString())),\n argumentList\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: "CONSTRUCT",\n path: path.map((p => p.toString())),\n argumentList\n }, transferables).then(fromWireValue);\n }\n });\n registerProxy(proxy, ep);\n return proxy;\n }\n function myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n }\n function processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [ processed.map((v => v[0])), myFlat(processed.map((v => v[1]))) ];\n }\n const transferCache = new WeakMap;\n function transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n }\n function proxy(obj) {\n return Object.assign(obj, {\n [proxyMarker]: true\n });\n }\n function windowEndpoint(w, context = globalThis, targetOrigin = "*") {\n return {\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\n addEventListener: context.addEventListener.bind(context),\n removeEventListener: context.removeEventListener.bind(context)\n };\n }\n function toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [ {\n type: "HANDLER",\n name,\n value: serializedValue\n }, transferables ];\n }\n }\n return [ {\n type: "RAW",\n value\n }, transferCache.get(value) || [] ];\n }\n function fromWireValue(value) {\n switch (value.type) {\n case "HANDLER":\n return transferHandlers.get(value.name).deserialize(value.value);\n\n case "RAW":\n return value.value;\n }\n }\n function requestResponseMessage(ep, msg, transfers) {\n return new Promise((resolve => {\n const id = generateUUID();\n ep.addEventListener("message", (function l(ev) {\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\n return;\n }\n ep.removeEventListener("message", l);\n resolve(ev.data);\n }));\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({\n id\n }, msg), transfers);\n }));\n }\n function generateUUID() {\n return new Array(4).fill(0).map((() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))).join("-");\n }\n var browser = __webpack_require__(227);\n var browser_default = __webpack_require__.n(browser);\n function getSharedMemoryAvailable() {\n const globalScope = typeof window !== "undefined" ? window : globalThis;\n return typeof SharedArrayBuffer !== "undefined" && globalScope.crossOriginIsolated;\n }\n function getRemoteBarretenbergWasm(worker) {\n return wrap(worker);\n }\n function getNumCpu() {\n return navigator.hardwareConcurrency;\n }\n function threadLogger() {\n return undefined;\n }\n function killSelf() {\n self.close();\n }\n var inline = __webpack_require__(477);\n var inline_default = __webpack_require__.n(inline);\n function Worker_fn() {\n return inline_default()(\'/*! For license information please see thread.worker.worker.worker.js.LICENSE.txt */\\nvar __webpack_modules__ = {\\n 227: (module, exports, __webpack_require__) => {\\n exports.formatArgs = formatArgs;\\n exports.save = save;\\n exports.load = load;\\n exports.useColors = useColors;\\n exports.storage = localstorage();\\n exports.destroy = (() => {\\n let warned = false;\\n return () => {\\n if (!warned) {\\n warned = true;\\n console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");\\n }\\n };\\n })();\\n exports.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ];\\n function useColors() {\\n if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {\\n return true;\\n }\\n if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\\\/(\\\\d+)/)) {\\n return false;\\n }\\n return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\\\/(\\\\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\\\/(\\\\d+)/);\\n }\\n function formatArgs(args) {\\n args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);\\n if (!this.useColors) {\\n return;\\n }\\n const c = "color: " + this.color;\\n args.splice(1, 0, c, "color: inherit");\\n let index = 0;\\n let lastC = 0;\\n args[0].replace(/%[a-zA-Z%]/g, (match => {\\n if (match === "%%") {\\n return;\\n }\\n index++;\\n if (match === "%c") {\\n lastC = index;\\n }\\n }));\\n args.splice(lastC, 0, c);\\n }\\n exports.log = console.debug || console.log || (() => {});\\n function save(namespaces) {\\n try {\\n if (namespaces) {\\n exports.storage.setItem("debug", namespaces);\\n } else {\\n exports.storage.removeItem("debug");\\n }\\n } catch (error) {}\\n }\\n function load() {\\n let r;\\n try {\\n r = exports.storage.getItem("debug");\\n } catch (error) {}\\n if (!r && typeof process !== "undefined" && "env" in process) {\\n r = process.env.DEBUG;\\n }\\n return r;\\n }\\n function localstorage() {\\n try {\\n return localStorage;\\n } catch (error) {}\\n }\\n module.exports = __webpack_require__(447)(exports);\\n const {formatters} = module.exports;\\n formatters.j = function(v) {\\n try {\\n return JSON.stringify(v);\\n } catch (error) {\\n return "[UnexpectedJSONParseError]: " + error.message;\\n }\\n };\\n },\\n 447: (module, __unused_webpack_exports, __webpack_require__) => {\\n function setup(env) {\\n createDebug.debug = createDebug;\\n createDebug.default = createDebug;\\n createDebug.coerce = coerce;\\n createDebug.disable = disable;\\n createDebug.enable = enable;\\n createDebug.enabled = enabled;\\n createDebug.humanize = __webpack_require__(824);\\n createDebug.destroy = destroy;\\n Object.keys(env).forEach((key => {\\n createDebug[key] = env[key];\\n }));\\n createDebug.names = [];\\n createDebug.skips = [];\\n createDebug.formatters = {};\\n function selectColor(namespace) {\\n let hash = 0;\\n for (let i = 0; i < namespace.length; i++) {\\n hash = (hash << 5) - hash + namespace.charCodeAt(i);\\n hash |= 0;\\n }\\n return createDebug.colors[Math.abs(hash) % createDebug.colors.length];\\n }\\n createDebug.selectColor = selectColor;\\n function createDebug(namespace) {\\n let prevTime;\\n let enableOverride = null;\\n let namespacesCache;\\n let enabledCache;\\n function debug(...args) {\\n if (!debug.enabled) {\\n return;\\n }\\n const self = debug;\\n const curr = Number(new Date);\\n const ms = curr - (prevTime || curr);\\n self.diff = ms;\\n self.prev = prevTime;\\n self.curr = curr;\\n prevTime = curr;\\n args[0] = createDebug.coerce(args[0]);\\n if (typeof args[0] !== "string") {\\n args.unshift("%O");\\n }\\n let index = 0;\\n args[0] = args[0].replace(/%([a-zA-Z%])/g, ((match, format) => {\\n if (match === "%%") {\\n return "%";\\n }\\n index++;\\n const formatter = createDebug.formatters[format];\\n if (typeof formatter === "function") {\\n const val = args[index];\\n match = formatter.call(self, val);\\n args.splice(index, 1);\\n index--;\\n }\\n return match;\\n }));\\n createDebug.formatArgs.call(self, args);\\n const logFn = self.log || createDebug.log;\\n logFn.apply(self, args);\\n }\\n debug.namespace = namespace;\\n debug.useColors = createDebug.useColors();\\n debug.color = createDebug.selectColor(namespace);\\n debug.extend = extend;\\n debug.destroy = createDebug.destroy;\\n Object.defineProperty(debug, "enabled", {\\n enumerable: true,\\n configurable: false,\\n get: () => {\\n if (enableOverride !== null) {\\n return enableOverride;\\n }\\n if (namespacesCache !== createDebug.namespaces) {\\n namespacesCache = createDebug.namespaces;\\n enabledCache = createDebug.enabled(namespace);\\n }\\n return enabledCache;\\n },\\n set: v => {\\n enableOverride = v;\\n }\\n });\\n if (typeof createDebug.init === "function") {\\n createDebug.init(debug);\\n }\\n return debug;\\n }\\n function extend(namespace, delimiter) {\\n const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);\\n newDebug.log = this.log;\\n return newDebug;\\n }\\n function enable(namespaces) {\\n createDebug.save(namespaces);\\n createDebug.namespaces = namespaces;\\n createDebug.names = [];\\n createDebug.skips = [];\\n let i;\\n const split = (typeof namespaces === "string" ? namespaces : "").split(/[\\\\s,]+/);\\n const len = split.length;\\n for (i = 0; i < len; i++) {\\n if (!split[i]) {\\n continue;\\n }\\n namespaces = split[i].replace(/\\\\*/g, ".*?");\\n if (namespaces[0] === "-") {\\n createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));\\n } else {\\n createDebug.names.push(new RegExp("^" + namespaces + "$"));\\n }\\n }\\n }\\n function disable() {\\n const namespaces = [ ...createDebug.names.map(toNamespace), ...createDebug.skips.map(toNamespace).map((namespace => "-" + namespace)) ].join(",");\\n createDebug.enable("");\\n return namespaces;\\n }\\n function enabled(name) {\\n if (name[name.length - 1] === "*") {\\n return true;\\n }\\n let i;\\n let len;\\n for (i = 0, len = createDebug.skips.length; i < len; i++) {\\n if (createDebug.skips[i].test(name)) {\\n return false;\\n }\\n }\\n for (i = 0, len = createDebug.names.length; i < len; i++) {\\n if (createDebug.names[i].test(name)) {\\n return true;\\n }\\n }\\n return false;\\n }\\n function toNamespace(regexp) {\\n return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\\\\.\\\\*\\\\?$/, "*");\\n }\\n function coerce(val) {\\n if (val instanceof Error) {\\n return val.stack || val.message;\\n }\\n return val;\\n }\\n function destroy() {\\n console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");\\n }\\n createDebug.enable(createDebug.load());\\n return createDebug;\\n }\\n module.exports = setup;\\n },\\n 824: module => {\\n var s = 1e3;\\n var m = s * 60;\\n var h = m * 60;\\n var d = h * 24;\\n var w = d * 7;\\n var y = d * 365.25;\\n module.exports = function(val, options) {\\n options = options || {};\\n var type = typeof val;\\n if (type === "string" && val.length > 0) {\\n return parse(val);\\n } else if (type === "number" && isFinite(val)) {\\n return options.long ? fmtLong(val) : fmtShort(val);\\n }\\n throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));\\n };\\n function parse(str) {\\n str = String(str);\\n if (str.length > 100) {\\n return;\\n }\\n var match = /^(-?(?:\\\\d+)?\\\\.?\\\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);\\n if (!match) {\\n return;\\n }\\n var n = parseFloat(match[1]);\\n var type = (match[2] || "ms").toLowerCase();\\n switch (type) {\\n case "years":\\n case "year":\\n case "yrs":\\n case "yr":\\n case "y":\\n return n * y;\\n\\n case "weeks":\\n case "week":\\n case "w":\\n return n * w;\\n\\n case "days":\\n case "day":\\n case "d":\\n return n * d;\\n\\n case "hours":\\n case "hour":\\n case "hrs":\\n case "hr":\\n case "h":\\n return n * h;\\n\\n case "minutes":\\n case "minute":\\n case "mins":\\n case "min":\\n case "m":\\n return n * m;\\n\\n case "seconds":\\n case "second":\\n case "secs":\\n case "sec":\\n case "s":\\n return n * s;\\n\\n case "milliseconds":\\n case "millisecond":\\n case "msecs":\\n case "msec":\\n case "ms":\\n return n;\\n\\n default:\\n return undefined;\\n }\\n }\\n function fmtShort(ms) {\\n var msAbs = Math.abs(ms);\\n if (msAbs >= d) {\\n return Math.round(ms / d) + "d";\\n }\\n if (msAbs >= h) {\\n return Math.round(ms / h) + "h";\\n }\\n if (msAbs >= m) {\\n return Math.round(ms / m) + "m";\\n }\\n if (msAbs >= s) {\\n return Math.round(ms / s) + "s";\\n }\\n return ms + "ms";\\n }\\n function fmtLong(ms) {\\n var msAbs = Math.abs(ms);\\n if (msAbs >= d) {\\n return plural(ms, msAbs, d, "day");\\n }\\n if (msAbs >= h) {\\n return plural(ms, msAbs, h, "hour");\\n }\\n if (msAbs >= m) {\\n return plural(ms, msAbs, m, "minute");\\n }\\n if (msAbs >= s) {\\n return plural(ms, msAbs, s, "second");\\n }\\n return ms + " ms";\\n }\\n function plural(ms, msAbs, n, name) {\\n var isPlural = msAbs >= n * 1.5;\\n return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");\\n }\\n }\\n};\\n\\nvar __webpack_module_cache__ = {};\\n\\nfunction __webpack_require__(moduleId) {\\n var cachedModule = __webpack_module_cache__[moduleId];\\n if (cachedModule !== undefined) {\\n return cachedModule.exports;\\n }\\n var module = __webpack_module_cache__[moduleId] = {\\n exports: {}\\n };\\n __webpack_modules__[moduleId](module, module.exports, __webpack_require__);\\n return module.exports;\\n}\\n\\n(() => {\\n __webpack_require__.n = module => {\\n var getter = module && module.__esModule ? () => module["default"] : () => module;\\n __webpack_require__.d(getter, {\\n a: getter\\n });\\n return getter;\\n };\\n})();\\n\\n(() => {\\n __webpack_require__.d = (exports, definition) => {\\n for (var key in definition) {\\n if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\\n Object.defineProperty(exports, key, {\\n enumerable: true,\\n get: definition[key]\\n });\\n }\\n }\\n };\\n})();\\n\\n(() => {\\n __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\\n})();\\n\\nvar __webpack_exports__ = {};\\n\\n(() => {\\n const proxyMarker = Symbol("Comlink.proxy");\\n const createEndpoint = Symbol("Comlink.endpoint");\\n const releaseProxy = Symbol("Comlink.releaseProxy");\\n const finalizer = Symbol("Comlink.finalizer");\\n const throwMarker = Symbol("Comlink.thrown");\\n const isObject = val => typeof val === "object" && val !== null || typeof val === "function";\\n const proxyTransferHandler = {\\n canHandle: val => isObject(val) && val[proxyMarker],\\n serialize(obj) {\\n const {port1, port2} = new MessageChannel;\\n expose(obj, port1);\\n return [ port2, [ port2 ] ];\\n },\\n deserialize(port) {\\n port.start();\\n return comlink_wrap(port);\\n }\\n };\\n const throwTransferHandler = {\\n canHandle: value => isObject(value) && throwMarker in value,\\n serialize({value}) {\\n let serialized;\\n if (value instanceof Error) {\\n serialized = {\\n isError: true,\\n value: {\\n message: value.message,\\n name: value.name,\\n stack: value.stack\\n }\\n };\\n } else {\\n serialized = {\\n isError: false,\\n value\\n };\\n }\\n return [ serialized, [] ];\\n },\\n deserialize(serialized) {\\n if (serialized.isError) {\\n throw Object.assign(new Error(serialized.value.message), serialized.value);\\n }\\n throw serialized.value;\\n }\\n };\\n const transferHandlers = new Map([ [ "proxy", proxyTransferHandler ], [ "throw", throwTransferHandler ] ]);\\n function isAllowedOrigin(allowedOrigins, origin) {\\n for (const allowedOrigin of allowedOrigins) {\\n if (origin === allowedOrigin || allowedOrigin === "*") {\\n return true;\\n }\\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\\n return true;\\n }\\n }\\n return false;\\n }\\n function expose(obj, ep = globalThis, allowedOrigins = [ "*" ]) {\\n ep.addEventListener("message", (function callback(ev) {\\n if (!ev || !ev.data) {\\n return;\\n }\\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\\n console.warn(`Invalid origin \\\'${ev.origin}\\\' for comlink proxy`);\\n return;\\n }\\n const {id, type, path} = Object.assign({\\n path: []\\n }, ev.data);\\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\\n let returnValue;\\n try {\\n const parent = path.slice(0, -1).reduce(((obj, prop) => obj[prop]), obj);\\n const rawValue = path.reduce(((obj, prop) => obj[prop]), obj);\\n switch (type) {\\n case "GET":\\n {\\n returnValue = rawValue;\\n }\\n break;\\n\\n case "SET":\\n {\\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\\n returnValue = true;\\n }\\n break;\\n\\n case "APPLY":\\n {\\n returnValue = rawValue.apply(parent, argumentList);\\n }\\n break;\\n\\n case "CONSTRUCT":\\n {\\n const value = new rawValue(...argumentList);\\n returnValue = proxy(value);\\n }\\n break;\\n\\n case "ENDPOINT":\\n {\\n const {port1, port2} = new MessageChannel;\\n expose(obj, port2);\\n returnValue = transfer(port1, [ port1 ]);\\n }\\n break;\\n\\n case "RELEASE":\\n {\\n returnValue = undefined;\\n }\\n break;\\n\\n default:\\n return;\\n }\\n } catch (value) {\\n returnValue = {\\n value,\\n [throwMarker]: 0\\n };\\n }\\n Promise.resolve(returnValue).catch((value => ({\\n value,\\n [throwMarker]: 0\\n }))).then((returnValue => {\\n const [wireValue, transferables] = toWireValue(returnValue);\\n ep.postMessage(Object.assign(Object.assign({}, wireValue), {\\n id\\n }), transferables);\\n if (type === "RELEASE") {\\n ep.removeEventListener("message", callback);\\n closeEndPoint(ep);\\n if (finalizer in obj && typeof obj[finalizer] === "function") {\\n obj[finalizer]();\\n }\\n }\\n })).catch((error => {\\n const [wireValue, transferables] = toWireValue({\\n value: new TypeError("Unserializable return value"),\\n [throwMarker]: 0\\n });\\n ep.postMessage(Object.assign(Object.assign({}, wireValue), {\\n id\\n }), transferables);\\n }));\\n }));\\n if (ep.start) {\\n ep.start();\\n }\\n }\\n function isMessagePort(endpoint) {\\n return endpoint.constructor.name === "MessagePort";\\n }\\n function closeEndPoint(endpoint) {\\n if (isMessagePort(endpoint)) endpoint.close();\\n }\\n function comlink_wrap(ep, target) {\\n return createProxy(ep, [], target);\\n }\\n function throwIfProxyReleased(isReleased) {\\n if (isReleased) {\\n throw new Error("Proxy has been released and is not useable");\\n }\\n }\\n function releaseEndpoint(ep) {\\n return requestResponseMessage(ep, {\\n type: "RELEASE"\\n }).then((() => {\\n closeEndPoint(ep);\\n }));\\n }\\n const proxyCounter = new WeakMap;\\n const proxyFinalizers = "FinalizationRegistry" in globalThis && new FinalizationRegistry((ep => {\\n const newCount = (proxyCounter.get(ep) || 0) - 1;\\n proxyCounter.set(ep, newCount);\\n if (newCount === 0) {\\n releaseEndpoint(ep);\\n }\\n }));\\n function registerProxy(proxy, ep) {\\n const newCount = (proxyCounter.get(ep) || 0) + 1;\\n proxyCounter.set(ep, newCount);\\n if (proxyFinalizers) {\\n proxyFinalizers.register(proxy, ep, proxy);\\n }\\n }\\n function unregisterProxy(proxy) {\\n if (proxyFinalizers) {\\n proxyFinalizers.unregister(proxy);\\n }\\n }\\n function createProxy(ep, path = [], target = function() {}) {\\n let isProxyReleased = false;\\n const proxy = new Proxy(target, {\\n get(_target, prop) {\\n throwIfProxyReleased(isProxyReleased);\\n if (prop === releaseProxy) {\\n return () => {\\n unregisterProxy(proxy);\\n releaseEndpoint(ep);\\n isProxyReleased = true;\\n };\\n }\\n if (prop === "then") {\\n if (path.length === 0) {\\n return {\\n then: () => proxy\\n };\\n }\\n const r = requestResponseMessage(ep, {\\n type: "GET",\\n path: path.map((p => p.toString()))\\n }).then(fromWireValue);\\n return r.then.bind(r);\\n }\\n return createProxy(ep, [ ...path, prop ]);\\n },\\n set(_target, prop, rawValue) {\\n throwIfProxyReleased(isProxyReleased);\\n const [value, transferables] = toWireValue(rawValue);\\n return requestResponseMessage(ep, {\\n type: "SET",\\n path: [ ...path, prop ].map((p => p.toString())),\\n value\\n }, transferables).then(fromWireValue);\\n },\\n apply(_target, _thisArg, rawArgumentList) {\\n throwIfProxyReleased(isProxyReleased);\\n const last = path[path.length - 1];\\n if (last === createEndpoint) {\\n return requestResponseMessage(ep, {\\n type: "ENDPOINT"\\n }).then(fromWireValue);\\n }\\n if (last === "bind") {\\n return createProxy(ep, path.slice(0, -1));\\n }\\n const [argumentList, transferables] = processArguments(rawArgumentList);\\n return requestResponseMessage(ep, {\\n type: "APPLY",\\n path: path.map((p => p.toString())),\\n argumentList\\n }, transferables).then(fromWireValue);\\n },\\n construct(_target, rawArgumentList) {\\n throwIfProxyReleased(isProxyReleased);\\n const [argumentList, transferables] = processArguments(rawArgumentList);\\n return requestResponseMessage(ep, {\\n type: "CONSTRUCT",\\n path: path.map((p => p.toString())),\\n argumentList\\n }, transferables).then(fromWireValue);\\n }\\n });\\n registerProxy(proxy, ep);\\n return proxy;\\n }\\n function myFlat(arr) {\\n return Array.prototype.concat.apply([], arr);\\n }\\n function processArguments(argumentList) {\\n const processed = argumentList.map(toWireValue);\\n return [ processed.map((v => v[0])), myFlat(processed.map((v => v[1]))) ];\\n }\\n const transferCache = new WeakMap;\\n function transfer(obj, transfers) {\\n transferCache.set(obj, transfers);\\n return obj;\\n }\\n function proxy(obj) {\\n return Object.assign(obj, {\\n [proxyMarker]: true\\n });\\n }\\n function windowEndpoint(w, context = globalThis, targetOrigin = "*") {\\n return {\\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\\n addEventListener: context.addEventListener.bind(context),\\n removeEventListener: context.removeEventListener.bind(context)\\n };\\n }\\n function toWireValue(value) {\\n for (const [name, handler] of transferHandlers) {\\n if (handler.canHandle(value)) {\\n const [serializedValue, transferables] = handler.serialize(value);\\n return [ {\\n type: "HANDLER",\\n name,\\n value: serializedValue\\n }, transferables ];\\n }\\n }\\n return [ {\\n type: "RAW",\\n value\\n }, transferCache.get(value) || [] ];\\n }\\n function fromWireValue(value) {\\n switch (value.type) {\\n case "HANDLER":\\n return transferHandlers.get(value.name).deserialize(value.value);\\n\\n case "RAW":\\n return value.value;\\n }\\n }\\n function requestResponseMessage(ep, msg, transfers) {\\n return new Promise((resolve => {\\n const id = generateUUID();\\n ep.addEventListener("message", (function l(ev) {\\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\\n return;\\n }\\n ep.removeEventListener("message", l);\\n resolve(ev.data);\\n }));\\n if (ep.start) {\\n ep.start();\\n }\\n ep.postMessage(Object.assign({\\n id\\n }, msg), transfers);\\n }));\\n }\\n function generateUUID() {\\n return new Array(4).fill(0).map((() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))).join("-");\\n }\\n function getSharedMemoryAvailable() {\\n const globalScope = typeof window !== "undefined" ? window : globalThis;\\n return typeof SharedArrayBuffer !== "undefined" && globalScope.crossOriginIsolated;\\n }\\n function getRemoteBarretenbergWasm(worker) {\\n return wrap(worker);\\n }\\n function getNumCpu() {\\n return navigator.hardwareConcurrency;\\n }\\n function threadLogger() {\\n return undefined;\\n }\\n function killSelf() {\\n self.close();\\n }\\n var browser = __webpack_require__(227);\\n var browser_default = __webpack_require__.n(browser);\\n const randomBytes = len => {\\n const getWebCrypto = () => {\\n if (typeof window !== "undefined" && window.crypto) return window.crypto;\\n if (typeof globalThis !== "undefined" && globalThis.crypto) return globalThis.crypto;\\n return undefined;\\n };\\n const crypto = getWebCrypto();\\n if (!crypto) {\\n throw new Error("randomBytes UnsupportedEnvironment");\\n }\\n const buf = new Uint8Array(len);\\n const MAX_BYTES = 65536;\\n if (len > MAX_BYTES) {\\n for (let generated = 0; generated < len; generated += MAX_BYTES) {\\n crypto.getRandomValues(buf.subarray(generated, generated + MAX_BYTES));\\n }\\n } else {\\n crypto.getRandomValues(buf);\\n }\\n return buf;\\n };\\n class BarretenbergWasmBase {\\n constructor() {\\n this.memStore = {};\\n this.logger = browser_default()("bb.js:bb_wasm_base");\\n }\\n getImportObj(memory) {\\n const importObj = {\\n wasi_snapshot_preview1: {\\n random_get: (out, length) => {\\n out = out >>> 0;\\n const randomData = randomBytes(length);\\n const mem = this.getMemory();\\n mem.set(randomData, out);\\n },\\n clock_time_get: (a1, a2, out) => {\\n out = out >>> 0;\\n const ts = BigInt((new Date).getTime()) * 1000000n;\\n const view = new DataView(this.getMemory().buffer);\\n view.setBigUint64(out, ts, true);\\n },\\n proc_exit: () => {\\n this.logger("PANIC: proc_exit was called.");\\n throw new Error;\\n }\\n },\\n env: {\\n logstr: addr => {\\n const str = this.stringFromAddress(addr);\\n const m = this.getMemory();\\n const str2 = `${str} (mem: ${(m.length / (1024 * 1024)).toFixed(2)}MiB)`;\\n this.logger(str2);\\n },\\n get_data: (keyAddr, outBufAddr) => {\\n const key = this.stringFromAddress(keyAddr);\\n outBufAddr = outBufAddr >>> 0;\\n const data = this.memStore[key];\\n if (!data) {\\n this.logger(`get_data miss ${key}`);\\n return;\\n }\\n this.writeMemory(outBufAddr, data);\\n },\\n set_data: (keyAddr, dataAddr, dataLength) => {\\n const key = this.stringFromAddress(keyAddr);\\n dataAddr = dataAddr >>> 0;\\n this.memStore[key] = this.getMemorySlice(dataAddr, dataAddr + dataLength);\\n },\\n memory\\n }\\n };\\n return importObj;\\n }\\n exports() {\\n return this.instance.exports;\\n }\\n call(name, ...args) {\\n if (!this.exports()[name]) {\\n throw new Error(`WASM function ${name} not found.`);\\n }\\n try {\\n return this.exports()[name](...args) >>> 0;\\n } catch (err) {\\n const message = `WASM function ${name} aborted, error: ${err}`;\\n this.logger(message);\\n this.logger(err.stack);\\n throw err;\\n }\\n }\\n memSize() {\\n return this.getMemory().length;\\n }\\n getMemorySlice(start, end) {\\n return this.getMemory().subarray(start, end).slice();\\n }\\n writeMemory(offset, arr) {\\n const mem = this.getMemory();\\n mem.set(arr, offset);\\n }\\n getMemory() {\\n return new Uint8Array(this.memory.buffer);\\n }\\n stringFromAddress(addr) {\\n addr = addr >>> 0;\\n const m = this.getMemory();\\n let i = addr;\\n for (;m[i] !== 0; ++i) ;\\n const textDecoder = new TextDecoder("ascii");\\n return textDecoder.decode(m.slice(addr, i));\\n }\\n }\\n class BarretenbergWasmThread extends BarretenbergWasmBase {\\n async initThread(module, memory) {\\n this.logger = threadLogger() || this.logger;\\n this.memory = memory;\\n this.instance = await WebAssembly.instantiate(module, this.getImportObj(this.memory));\\n }\\n destroy() {\\n killSelf();\\n }\\n getImportObj(memory) {\\n const baseImports = super.getImportObj(memory);\\n return {\\n ...baseImports,\\n wasi: {\\n "thread-spawn": () => {\\n this.logger("PANIC: threads cannot spawn threads!");\\n this.logger((new Error).stack);\\n killSelf();\\n }\\n },\\n env: {\\n ...baseImports.env,\\n env_hardware_concurrency: () => 1\\n }\\n };\\n }\\n }\\n self.onmessage = function(e) {\\n if (e.data.debug) {\\n browser_default().enable(e.data.debug);\\n }\\n };\\n expose(new BarretenbergWasmThread);\\n self.postMessage({\\n ready: true\\n });\\n const thread_worker = null;\\n})();\', "Worker", undefined, undefined);\n }\n function createThreadWorker() {\n const worker = new Worker_fn;\n const debugStr = browser_default().disable();\n browser_default().enable(debugStr);\n worker.postMessage({\n debug: debugStr\n });\n return worker;\n }\n const randomBytes = len => {\n const getWebCrypto = () => {\n if (typeof window !== "undefined" && window.crypto) return window.crypto;\n if (typeof globalThis !== "undefined" && globalThis.crypto) return globalThis.crypto;\n return undefined;\n };\n const crypto = getWebCrypto();\n if (!crypto) {\n throw new Error("randomBytes UnsupportedEnvironment");\n }\n const buf = new Uint8Array(len);\n const MAX_BYTES = 65536;\n if (len > MAX_BYTES) {\n for (let generated = 0; generated < len; generated += MAX_BYTES) {\n crypto.getRandomValues(buf.subarray(generated, generated + MAX_BYTES));\n }\n } else {\n crypto.getRandomValues(buf);\n }\n return buf;\n };\n class BarretenbergWasmBase {\n constructor() {\n this.memStore = {};\n this.logger = browser_default()("bb.js:bb_wasm_base");\n }\n getImportObj(memory) {\n const importObj = {\n wasi_snapshot_preview1: {\n random_get: (out, length) => {\n out = out >>> 0;\n const randomData = randomBytes(length);\n const mem = this.getMemory();\n mem.set(randomData, out);\n },\n clock_time_get: (a1, a2, out) => {\n out = out >>> 0;\n const ts = BigInt((new Date).getTime()) * 1000000n;\n const view = new DataView(this.getMemory().buffer);\n view.setBigUint64(out, ts, true);\n },\n proc_exit: () => {\n this.logger("PANIC: proc_exit was called.");\n throw new Error;\n }\n },\n env: {\n logstr: addr => {\n const str = this.stringFromAddress(addr);\n const m = this.getMemory();\n const str2 = `${str} (mem: ${(m.length / (1024 * 1024)).toFixed(2)}MiB)`;\n this.logger(str2);\n },\n get_data: (keyAddr, outBufAddr) => {\n const key = this.stringFromAddress(keyAddr);\n outBufAddr = outBufAddr >>> 0;\n const data = this.memStore[key];\n if (!data) {\n this.logger(`get_data miss ${key}`);\n return;\n }\n this.writeMemory(outBufAddr, data);\n },\n set_data: (keyAddr, dataAddr, dataLength) => {\n const key = this.stringFromAddress(keyAddr);\n dataAddr = dataAddr >>> 0;\n this.memStore[key] = this.getMemorySlice(dataAddr, dataAddr + dataLength);\n },\n memory\n }\n };\n return importObj;\n }\n exports() {\n return this.instance.exports;\n }\n call(name, ...args) {\n if (!this.exports()[name]) {\n throw new Error(`WASM function ${name} not found.`);\n }\n try {\n return this.exports()[name](...args) >>> 0;\n } catch (err) {\n const message = `WASM function ${name} aborted, error: ${err}`;\n this.logger(message);\n this.logger(err.stack);\n throw err;\n }\n }\n memSize() {\n return this.getMemory().length;\n }\n getMemorySlice(start, end) {\n return this.getMemory().subarray(start, end).slice();\n }\n writeMemory(offset, arr) {\n const mem = this.getMemory();\n mem.set(arr, offset);\n }\n getMemory() {\n return new Uint8Array(this.memory.buffer);\n }\n stringFromAddress(addr) {\n addr = addr >>> 0;\n const m = this.getMemory();\n let i = addr;\n for (;m[i] !== 0; ++i) ;\n const textDecoder = new TextDecoder("ascii");\n return textDecoder.decode(m.slice(addr, i));\n }\n }\n class HeapAllocator {\n constructor(wasm) {\n this.wasm = wasm;\n this.allocs = [];\n this.inScratchRemaining = 1024;\n this.outScratchRemaining = 1024;\n }\n getInputs(buffers) {\n return buffers.map((bufOrNum => {\n if (typeof bufOrNum === "object") {\n if (bufOrNum.length <= this.inScratchRemaining) {\n const ptr = this.inScratchRemaining -= bufOrNum.length;\n this.wasm.writeMemory(ptr, bufOrNum);\n return ptr;\n } else {\n const ptr = this.wasm.call("bbmalloc", bufOrNum.length);\n this.wasm.writeMemory(ptr, bufOrNum);\n this.allocs.push(ptr);\n return ptr;\n }\n } else {\n return bufOrNum;\n }\n }));\n }\n getOutputPtrs(outLens) {\n return outLens.map((len => {\n const size = len || 4;\n if (size <= this.outScratchRemaining) {\n return this.outScratchRemaining -= size;\n } else {\n const ptr = this.wasm.call("bbmalloc", size);\n this.allocs.push(ptr);\n return ptr;\n }\n }));\n }\n addOutputPtr(ptr) {\n if (ptr >= 1024) {\n this.allocs.push(ptr);\n }\n }\n freeAll() {\n for (const ptr of this.allocs) {\n this.wasm.call("bbfree", ptr);\n }\n }\n }\n class BarretenbergWasmMain extends BarretenbergWasmBase {\n constructor() {\n super(...arguments);\n this.workers = [];\n this.remoteWasms = [];\n this.nextWorker = 0;\n this.nextThreadId = 1;\n }\n getNumThreads() {\n return this.workers.length + 1;\n }\n async init(module, threads = Math.min(getNumCpu(), BarretenbergWasmMain.MAX_THREADS), logger = browser_default()("bb.js:bb_wasm"), initial = 32, maximum = 2 ** 16) {\n this.logger = logger;\n const initialMb = initial * 2 ** 16 / (1024 * 1024);\n const maxMb = maximum * 2 ** 16 / (1024 * 1024);\n const shared = getSharedMemoryAvailable();\n this.logger(`Initializing bb wasm: initial memory ${initial} pages ${initialMb}MiB; ` + `max memory: ${maximum} pages, ${maxMb}MiB; ` + `threads: ${threads}; shared memory: ${shared}`);\n this.memory = new WebAssembly.Memory({\n initial,\n maximum,\n shared\n });\n const instance = await WebAssembly.instantiate(module, this.getImportObj(this.memory));\n this.instance = instance;\n this.call("_initialize");\n if (threads > 1) {\n this.logger(`Creating ${threads} worker threads`);\n this.workers = await Promise.all(Array.from({\n length: threads - 1\n }).map(createThreadWorker));\n this.remoteWasms = await Promise.all(this.workers.map(getRemoteBarretenbergWasm));\n await Promise.all(this.remoteWasms.map((w => w.initThread(module, this.memory))));\n }\n }\n async destroy() {\n await Promise.all(this.workers.map((w => w.terminate())));\n }\n getImportObj(memory) {\n const baseImports = super.getImportObj(memory);\n return {\n ...baseImports,\n wasi: {\n "thread-spawn": arg => {\n arg = arg >>> 0;\n const id = this.nextThreadId++;\n const worker = this.nextWorker++ % this.remoteWasms.length;\n this.remoteWasms[worker].call("wasi_thread_start", id, arg).catch(this.logger);\n return id;\n }\n },\n env: {\n ...baseImports.env,\n env_hardware_concurrency: () => this.remoteWasms.length + 1\n }\n };\n }\n callWasmExport(funcName, inArgs, outLens) {\n const alloc = new HeapAllocator(this);\n const inPtrs = alloc.getInputs(inArgs);\n const outPtrs = alloc.getOutputPtrs(outLens);\n this.call(funcName, ...inPtrs, ...outPtrs);\n const outArgs = this.getOutputArgs(outLens, outPtrs, alloc);\n alloc.freeAll();\n return outArgs;\n }\n getOutputArgs(outLens, outPtrs, alloc) {\n return outLens.map(((len, i) => {\n if (len) {\n return this.getMemorySlice(outPtrs[i], outPtrs[i] + len);\n }\n const slice = this.getMemorySlice(outPtrs[i], outPtrs[i] + 4);\n const ptr = new DataView(slice.buffer, slice.byteOffset, slice.byteLength).getUint32(0, true);\n alloc.addOutputPtr(ptr);\n const lslice = this.getMemorySlice(ptr, ptr + 4);\n const length = new DataView(lslice.buffer, lslice.byteOffset, lslice.byteLength).getUint32(0, false);\n return this.getMemorySlice(ptr + 4, ptr + 4 + length);\n }));\n }\n }\n BarretenbergWasmMain.MAX_THREADS = 32;\n self.onmessage = function(e) {\n if (e.data.debug) {\n browser_default().enable(e.data.debug);\n }\n };\n expose(new BarretenbergWasmMain);\n self.postMessage({\n ready: true\n });\n const main_worker = null;\n})();', "Worker", undefined, undefined);
|
|
4076
4123
|
}
|
|
4077
4124
|
function browser_createMainWorker() {
|
|
4078
4125
|
const worker = new Worker_fn;
|
|
@@ -4100,7 +4147,7 @@ var __webpack_exports__ = {};
|
|
|
4100
4147
|
self.close();
|
|
4101
4148
|
}
|
|
4102
4149
|
function thread_worker_Worker_fn() {
|
|
4103
|
-
return inline_default()('/*! For license information please see thread.worker.worker.js.LICENSE.txt */\nvar __webpack_modules__ = {\n 227: (module, exports, __webpack_require__) => {\n exports.formatArgs = formatArgs;\n exports.save = save;\n exports.load = load;\n exports.useColors = useColors;\n exports.storage = localstorage();\n exports.destroy = (() => {\n let warned = false;\n return () => {\n if (!warned) {\n warned = true;\n console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");\n }\n };\n })();\n exports.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ];\n function useColors() {\n if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {\n return true;\n }\n if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false;\n }\n return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n }\n function formatArgs(args) {\n args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);\n if (!this.useColors) {\n return;\n }\n const c = "color: " + this.color;\n args.splice(1, 0, c, "color: inherit");\n let index = 0;\n let lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, (match => {\n if (match === "%%") {\n return;\n }\n index++;\n if (match === "%c") {\n lastC = index;\n }\n }));\n args.splice(lastC, 0, c);\n }\n exports.log = console.debug || console.log || (() => {});\n function save(namespaces) {\n try {\n if (namespaces) {\n exports.storage.setItem("debug", namespaces);\n } else {\n exports.storage.removeItem("debug");\n }\n } catch (error) {}\n }\n function load() {\n let r;\n try {\n r = exports.storage.getItem("debug");\n } catch (error) {}\n if (!r && typeof process !== "undefined" && "env" in process) {\n r = process.env.DEBUG;\n }\n return r;\n }\n function localstorage() {\n try {\n return localStorage;\n } catch (error) {}\n }\n module.exports = __webpack_require__(447)(exports);\n const {formatters} = module.exports;\n formatters.j = function(v) {\n try {\n return JSON.stringify(v);\n } catch (error) {\n return "[UnexpectedJSONParseError]: " + error.message;\n }\n };\n },\n 447: (module, __unused_webpack_exports, __webpack_require__) => {\n function setup(env) {\n createDebug.debug = createDebug;\n createDebug.default = createDebug;\n createDebug.coerce = coerce;\n createDebug.disable = disable;\n createDebug.enable = enable;\n createDebug.enabled = enabled;\n createDebug.humanize = __webpack_require__(824);\n createDebug.destroy = destroy;\n Object.keys(env).forEach((key => {\n createDebug[key] = env[key];\n }));\n createDebug.names = [];\n createDebug.skips = [];\n createDebug.formatters = {};\n function selectColor(namespace) {\n let hash = 0;\n for (let i = 0; i < namespace.length; i++) {\n hash = (hash << 5) - hash + namespace.charCodeAt(i);\n hash |= 0;\n }\n return createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n }\n createDebug.selectColor = selectColor;\n function createDebug(namespace) {\n let prevTime;\n let enableOverride = null;\n let namespacesCache;\n let enabledCache;\n function debug(...args) {\n if (!debug.enabled) {\n return;\n }\n const self = debug;\n const curr = Number(new Date);\n const ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n args[0] = createDebug.coerce(args[0]);\n if (typeof args[0] !== "string") {\n args.unshift("%O");\n }\n let index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, ((match, format) => {\n if (match === "%%") {\n return "%";\n }\n index++;\n const formatter = createDebug.formatters[format];\n if (typeof formatter === "function") {\n const val = args[index];\n match = formatter.call(self, val);\n args.splice(index, 1);\n index--;\n }\n return match;\n }));\n createDebug.formatArgs.call(self, args);\n const logFn = self.log || createDebug.log;\n logFn.apply(self, args);\n }\n debug.namespace = namespace;\n debug.useColors = createDebug.useColors();\n debug.color = createDebug.selectColor(namespace);\n debug.extend = extend;\n debug.destroy = createDebug.destroy;\n Object.defineProperty(debug, "enabled", {\n enumerable: true,\n configurable: false,\n get: () => {\n if (enableOverride !== null) {\n return enableOverride;\n }\n if (namespacesCache !== createDebug.namespaces) {\n namespacesCache = createDebug.namespaces;\n enabledCache = createDebug.enabled(namespace);\n }\n return enabledCache;\n },\n set: v => {\n enableOverride = v;\n }\n });\n if (typeof createDebug.init === "function") {\n createDebug.init(debug);\n }\n return debug;\n }\n function extend(namespace, delimiter) {\n const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);\n newDebug.log = this.log;\n return newDebug;\n }\n function enable(namespaces) {\n createDebug.save(namespaces);\n createDebug.namespaces = namespaces;\n createDebug.names = [];\n createDebug.skips = [];\n let i;\n const split = (typeof namespaces === "string" ? namespaces : "").split(/[\\s,]+/);\n const len = split.length;\n for (i = 0; i < len; i++) {\n if (!split[i]) {\n continue;\n }\n namespaces = split[i].replace(/\\*/g, ".*?");\n if (namespaces[0] === "-") {\n createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));\n } else {\n createDebug.names.push(new RegExp("^" + namespaces + "$"));\n }\n }\n }\n function disable() {\n const namespaces = [ ...createDebug.names.map(toNamespace), ...createDebug.skips.map(toNamespace).map((namespace => "-" + namespace)) ].join(",");\n createDebug.enable("");\n return namespaces;\n }\n function enabled(name) {\n if (name[name.length - 1] === "*") {\n return true;\n }\n let i;\n let len;\n for (i = 0, len = createDebug.skips.length; i < len; i++) {\n if (createDebug.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = createDebug.names.length; i < len; i++) {\n if (createDebug.names[i].test(name)) {\n return true;\n }\n }\n return false;\n }\n function toNamespace(regexp) {\n return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\\.\\*\\?$/, "*");\n }\n function coerce(val) {\n if (val instanceof Error) {\n return val.stack || val.message;\n }\n return val;\n }\n function destroy() {\n console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");\n }\n createDebug.enable(createDebug.load());\n return createDebug;\n }\n module.exports = setup;\n },\n 824: module => {\n var s = 1e3;\n var m = s * 60;\n var h = m * 60;\n var d = h * 24;\n var w = d * 7;\n var y = d * 365.25;\n module.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === "string" && val.length > 0) {\n return parse(val);\n } else if (type === "number" && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));\n };\n function parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || "ms").toLowerCase();\n switch (type) {\n case "years":\n case "year":\n case "yrs":\n case "yr":\n case "y":\n return n * y;\n\n case "weeks":\n case "week":\n case "w":\n return n * w;\n\n case "days":\n case "day":\n case "d":\n return n * d;\n\n case "hours":\n case "hour":\n case "hrs":\n case "hr":\n case "h":\n return n * h;\n\n case "minutes":\n case "minute":\n case "mins":\n case "min":\n case "m":\n return n * m;\n\n case "seconds":\n case "second":\n case "secs":\n case "sec":\n case "s":\n return n * s;\n\n case "milliseconds":\n case "millisecond":\n case "msecs":\n case "msec":\n case "ms":\n return n;\n\n default:\n return undefined;\n }\n }\n function fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + "d";\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + "h";\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + "m";\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + "s";\n }\n return ms + "ms";\n }\n function fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, "day");\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, "hour");\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, "minute");\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, "second");\n }\n return ms + " ms";\n }\n function plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");\n }\n }\n};\n\nvar __webpack_module_cache__ = {};\n\nfunction __webpack_require__(moduleId) {\n var cachedModule = __webpack_module_cache__[moduleId];\n if (cachedModule !== undefined) {\n return cachedModule.exports;\n }\n var module = __webpack_module_cache__[moduleId] = {\n exports: {}\n };\n __webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n return module.exports;\n}\n\n(() => {\n __webpack_require__.n = module => {\n var getter = module && module.__esModule ? () => module["default"] : () => module;\n __webpack_require__.d(getter, {\n a: getter\n });\n return getter;\n };\n})();\n\n(() => {\n __webpack_require__.d = (exports, definition) => {\n for (var key in definition) {\n if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: definition[key]\n });\n }\n }\n };\n})();\n\n(() => {\n __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\n})();\n\nvar __webpack_exports__ = {};\n\n(() => {\n const proxyMarker = Symbol("Comlink.proxy");\n const createEndpoint = Symbol("Comlink.endpoint");\n const releaseProxy = Symbol("Comlink.releaseProxy");\n const finalizer = Symbol("Comlink.finalizer");\n const throwMarker = Symbol("Comlink.thrown");\n const isObject = val => typeof val === "object" && val !== null || typeof val === "function";\n const proxyTransferHandler = {\n canHandle: val => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const {port1, port2} = new MessageChannel;\n expose(obj, port1);\n return [ port2, [ port2 ] ];\n },\n deserialize(port) {\n port.start();\n return comlink_wrap(port);\n }\n };\n const throwTransferHandler = {\n canHandle: value => isObject(value) && throwMarker in value,\n serialize({value}) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack\n }\n };\n } else {\n serialized = {\n isError: false,\n value\n };\n }\n return [ serialized, [] ];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n }\n };\n const transferHandlers = new Map([ [ "proxy", proxyTransferHandler ], [ "throw", throwTransferHandler ] ]);\n function isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === "*") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n }\n function expose(obj, ep = globalThis, allowedOrigins = [ "*" ]) {\n ep.addEventListener("message", (function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin \'${ev.origin}\' for comlink proxy`);\n return;\n }\n const {id, type, path} = Object.assign({\n path: []\n }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce(((obj, prop) => obj[prop]), obj);\n const rawValue = path.reduce(((obj, prop) => obj[prop]), obj);\n switch (type) {\n case "GET":\n {\n returnValue = rawValue;\n }\n break;\n\n case "SET":\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n\n case "APPLY":\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n\n case "CONSTRUCT":\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n\n case "ENDPOINT":\n {\n const {port1, port2} = new MessageChannel;\n expose(obj, port2);\n returnValue = transfer(port1, [ port1 ]);\n }\n break;\n\n case "RELEASE":\n {\n returnValue = undefined;\n }\n break;\n\n default:\n return;\n }\n } catch (value) {\n returnValue = {\n value,\n [throwMarker]: 0\n };\n }\n Promise.resolve(returnValue).catch((value => ({\n value,\n [throwMarker]: 0\n }))).then((returnValue => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), {\n id\n }), transferables);\n if (type === "RELEASE") {\n ep.removeEventListener("message", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === "function") {\n obj[finalizer]();\n }\n }\n })).catch((error => {\n const [wireValue, transferables] = toWireValue({\n value: new TypeError("Unserializable return value"),\n [throwMarker]: 0\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), {\n id\n }), transferables);\n }));\n }));\n if (ep.start) {\n ep.start();\n }\n }\n function isMessagePort(endpoint) {\n return endpoint.constructor.name === "MessagePort";\n }\n function closeEndPoint(endpoint) {\n if (isMessagePort(endpoint)) endpoint.close();\n }\n function comlink_wrap(ep, target) {\n return createProxy(ep, [], target);\n }\n function throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error("Proxy has been released and is not useable");\n }\n }\n function releaseEndpoint(ep) {\n return requestResponseMessage(ep, {\n type: "RELEASE"\n }).then((() => {\n closeEndPoint(ep);\n }));\n }\n const proxyCounter = new WeakMap;\n const proxyFinalizers = "FinalizationRegistry" in globalThis && new FinalizationRegistry((ep => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n }));\n function registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n }\n function unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n }\n function createProxy(ep, path = [], target = function() {}) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n isProxyReleased = true;\n };\n }\n if (prop === "then") {\n if (path.length === 0) {\n return {\n then: () => proxy\n };\n }\n const r = requestResponseMessage(ep, {\n type: "GET",\n path: path.map((p => p.toString()))\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, [ ...path, prop ]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, {\n type: "SET",\n path: [ ...path, prop ].map((p => p.toString())),\n value\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, {\n type: "ENDPOINT"\n }).then(fromWireValue);\n }\n if (last === "bind") {\n return createProxy(ep, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: "APPLY",\n path: path.map((p => p.toString())),\n argumentList\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: "CONSTRUCT",\n path: path.map((p => p.toString())),\n argumentList\n }, transferables).then(fromWireValue);\n }\n });\n registerProxy(proxy, ep);\n return proxy;\n }\n function myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n }\n function processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [ processed.map((v => v[0])), myFlat(processed.map((v => v[1]))) ];\n }\n const transferCache = new WeakMap;\n function transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n }\n function proxy(obj) {\n return Object.assign(obj, {\n [proxyMarker]: true\n });\n }\n function windowEndpoint(w, context = globalThis, targetOrigin = "*") {\n return {\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\n addEventListener: context.addEventListener.bind(context),\n removeEventListener: context.removeEventListener.bind(context)\n };\n }\n function toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [ {\n type: "HANDLER",\n name,\n value: serializedValue\n }, transferables ];\n }\n }\n return [ {\n type: "RAW",\n value\n }, transferCache.get(value) || [] ];\n }\n function fromWireValue(value) {\n switch (value.type) {\n case "HANDLER":\n return transferHandlers.get(value.name).deserialize(value.value);\n\n case "RAW":\n return value.value;\n }\n }\n function requestResponseMessage(ep, msg, transfers) {\n return new Promise((resolve => {\n const id = generateUUID();\n ep.addEventListener("message", (function l(ev) {\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\n return;\n }\n ep.removeEventListener("message", l);\n resolve(ev.data);\n }));\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({\n id\n }, msg), transfers);\n }));\n }\n function generateUUID() {\n return new Array(4).fill(0).map((() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))).join("-");\n }\n function getSharedMemoryAvailable() {\n const globalScope = typeof window !== "undefined" ? window : globalThis;\n return typeof SharedArrayBuffer !== "undefined" && globalScope.crossOriginIsolated;\n }\n function getRemoteBarretenbergWasm(worker) {\n return wrap(worker);\n }\n function getNumCpu() {\n return navigator.hardwareConcurrency;\n }\n function threadLogger() {\n return undefined;\n }\n function killSelf() {\n self.close();\n }\n var browser = __webpack_require__(227);\n var browser_default = __webpack_require__.n(browser);\n const randomBytes = len => {\n const getWebCrypto = () => {\n if (typeof window !== "undefined" && window.crypto) return window.crypto;\n if (typeof globalThis !== "undefined" && globalThis.crypto) return globalThis.crypto;\n return undefined;\n };\n const crypto = getWebCrypto();\n if (!crypto) {\n throw new Error("randomBytes UnsupportedEnvironment");\n }\n const buf = new Uint8Array(len);\n const MAX_BYTES = 65536;\n if (len > MAX_BYTES) {\n for (let generated = 0; generated < len; generated += MAX_BYTES) {\n crypto.getRandomValues(buf.subarray(generated, generated + MAX_BYTES));\n }\n } else {\n crypto.getRandomValues(buf);\n }\n return buf;\n };\n const debug = browser_default()("bb.js:wasm");\n class BarretenbergWasmBase {\n constructor() {\n this.memStore = {};\n this.logger = debug;\n }\n getImportObj(memory) {\n const importObj = {\n wasi_snapshot_preview1: {\n random_get: (out, length) => {\n out = out >>> 0;\n const randomData = randomBytes(length);\n const mem = this.getMemory();\n mem.set(randomData, out);\n },\n clock_time_get: (a1, a2, out) => {\n out = out >>> 0;\n const ts = BigInt((new Date).getTime()) * 1000000n;\n const view = new DataView(this.getMemory().buffer);\n view.setBigUint64(out, ts, true);\n },\n proc_exit: () => {\n this.logger("PANIC: proc_exit was called.");\n throw new Error;\n }\n },\n env: {\n logstr: addr => {\n const str = this.stringFromAddress(addr);\n const m = this.getMemory();\n const str2 = `${str} (mem: ${(m.length / (1024 * 1024)).toFixed(2)}MiB)`;\n this.logger(str2);\n if (str2.startsWith("WARNING:")) {\n this.logger((new Error).stack);\n }\n },\n get_data: (keyAddr, outBufAddr) => {\n const key = this.stringFromAddress(keyAddr);\n outBufAddr = outBufAddr >>> 0;\n const data = this.memStore[key];\n if (!data) {\n this.logger(`get_data miss ${key}`);\n return;\n }\n this.writeMemory(outBufAddr, data);\n },\n set_data: (keyAddr, dataAddr, dataLength) => {\n const key = this.stringFromAddress(keyAddr);\n dataAddr = dataAddr >>> 0;\n this.memStore[key] = this.getMemorySlice(dataAddr, dataAddr + dataLength);\n },\n memory\n }\n };\n return importObj;\n }\n exports() {\n return this.instance.exports;\n }\n call(name, ...args) {\n if (!this.exports()[name]) {\n throw new Error(`WASM function ${name} not found.`);\n }\n try {\n return this.exports()[name](...args) >>> 0;\n } catch (err) {\n const message = `WASM function ${name} aborted, error: ${err}`;\n this.logger(message);\n this.logger(err.stack);\n throw err;\n }\n }\n memSize() {\n return this.getMemory().length;\n }\n getMemorySlice(start, end) {\n return this.getMemory().subarray(start, end).slice();\n }\n writeMemory(offset, arr) {\n const mem = this.getMemory();\n mem.set(arr, offset);\n }\n getMemory() {\n return new Uint8Array(this.memory.buffer);\n }\n stringFromAddress(addr) {\n addr = addr >>> 0;\n const m = this.getMemory();\n let i = addr;\n for (;m[i] !== 0; ++i) ;\n const textDecoder = new TextDecoder("ascii");\n return textDecoder.decode(m.slice(addr, i));\n }\n }\n class BarretenbergWasmThread extends BarretenbergWasmBase {\n async initThread(module, memory) {\n this.logger = threadLogger() || this.logger;\n this.memory = memory;\n this.instance = await WebAssembly.instantiate(module, this.getImportObj(this.memory));\n }\n destroy() {\n killSelf();\n }\n getImportObj(memory) {\n const baseImports = super.getImportObj(memory);\n return {\n ...baseImports,\n wasi: {\n "thread-spawn": () => {\n this.logger("PANIC: threads cannot spawn threads!");\n this.logger((new Error).stack);\n killSelf();\n }\n },\n env: {\n ...baseImports.env,\n env_hardware_concurrency: () => 1\n }\n };\n }\n }\n self.onmessage = function(e) {\n if (e.data.debug) {\n browser_default().enable(e.data.debug);\n }\n };\n expose(new BarretenbergWasmThread);\n self.postMessage({\n ready: true\n });\n const thread_worker = null;\n})();', "Worker", undefined, undefined);
|
|
4150
|
+
return inline_default()('/*! For license information please see thread.worker.worker.js.LICENSE.txt */\nvar __webpack_modules__ = {\n 227: (module, exports, __webpack_require__) => {\n exports.formatArgs = formatArgs;\n exports.save = save;\n exports.load = load;\n exports.useColors = useColors;\n exports.storage = localstorage();\n exports.destroy = (() => {\n let warned = false;\n return () => {\n if (!warned) {\n warned = true;\n console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");\n }\n };\n })();\n exports.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ];\n function useColors() {\n if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {\n return true;\n }\n if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false;\n }\n return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n }\n function formatArgs(args) {\n args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);\n if (!this.useColors) {\n return;\n }\n const c = "color: " + this.color;\n args.splice(1, 0, c, "color: inherit");\n let index = 0;\n let lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, (match => {\n if (match === "%%") {\n return;\n }\n index++;\n if (match === "%c") {\n lastC = index;\n }\n }));\n args.splice(lastC, 0, c);\n }\n exports.log = console.debug || console.log || (() => {});\n function save(namespaces) {\n try {\n if (namespaces) {\n exports.storage.setItem("debug", namespaces);\n } else {\n exports.storage.removeItem("debug");\n }\n } catch (error) {}\n }\n function load() {\n let r;\n try {\n r = exports.storage.getItem("debug");\n } catch (error) {}\n if (!r && typeof process !== "undefined" && "env" in process) {\n r = process.env.DEBUG;\n }\n return r;\n }\n function localstorage() {\n try {\n return localStorage;\n } catch (error) {}\n }\n module.exports = __webpack_require__(447)(exports);\n const {formatters} = module.exports;\n formatters.j = function(v) {\n try {\n return JSON.stringify(v);\n } catch (error) {\n return "[UnexpectedJSONParseError]: " + error.message;\n }\n };\n },\n 447: (module, __unused_webpack_exports, __webpack_require__) => {\n function setup(env) {\n createDebug.debug = createDebug;\n createDebug.default = createDebug;\n createDebug.coerce = coerce;\n createDebug.disable = disable;\n createDebug.enable = enable;\n createDebug.enabled = enabled;\n createDebug.humanize = __webpack_require__(824);\n createDebug.destroy = destroy;\n Object.keys(env).forEach((key => {\n createDebug[key] = env[key];\n }));\n createDebug.names = [];\n createDebug.skips = [];\n createDebug.formatters = {};\n function selectColor(namespace) {\n let hash = 0;\n for (let i = 0; i < namespace.length; i++) {\n hash = (hash << 5) - hash + namespace.charCodeAt(i);\n hash |= 0;\n }\n return createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n }\n createDebug.selectColor = selectColor;\n function createDebug(namespace) {\n let prevTime;\n let enableOverride = null;\n let namespacesCache;\n let enabledCache;\n function debug(...args) {\n if (!debug.enabled) {\n return;\n }\n const self = debug;\n const curr = Number(new Date);\n const ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n args[0] = createDebug.coerce(args[0]);\n if (typeof args[0] !== "string") {\n args.unshift("%O");\n }\n let index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, ((match, format) => {\n if (match === "%%") {\n return "%";\n }\n index++;\n const formatter = createDebug.formatters[format];\n if (typeof formatter === "function") {\n const val = args[index];\n match = formatter.call(self, val);\n args.splice(index, 1);\n index--;\n }\n return match;\n }));\n createDebug.formatArgs.call(self, args);\n const logFn = self.log || createDebug.log;\n logFn.apply(self, args);\n }\n debug.namespace = namespace;\n debug.useColors = createDebug.useColors();\n debug.color = createDebug.selectColor(namespace);\n debug.extend = extend;\n debug.destroy = createDebug.destroy;\n Object.defineProperty(debug, "enabled", {\n enumerable: true,\n configurable: false,\n get: () => {\n if (enableOverride !== null) {\n return enableOverride;\n }\n if (namespacesCache !== createDebug.namespaces) {\n namespacesCache = createDebug.namespaces;\n enabledCache = createDebug.enabled(namespace);\n }\n return enabledCache;\n },\n set: v => {\n enableOverride = v;\n }\n });\n if (typeof createDebug.init === "function") {\n createDebug.init(debug);\n }\n return debug;\n }\n function extend(namespace, delimiter) {\n const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);\n newDebug.log = this.log;\n return newDebug;\n }\n function enable(namespaces) {\n createDebug.save(namespaces);\n createDebug.namespaces = namespaces;\n createDebug.names = [];\n createDebug.skips = [];\n let i;\n const split = (typeof namespaces === "string" ? namespaces : "").split(/[\\s,]+/);\n const len = split.length;\n for (i = 0; i < len; i++) {\n if (!split[i]) {\n continue;\n }\n namespaces = split[i].replace(/\\*/g, ".*?");\n if (namespaces[0] === "-") {\n createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));\n } else {\n createDebug.names.push(new RegExp("^" + namespaces + "$"));\n }\n }\n }\n function disable() {\n const namespaces = [ ...createDebug.names.map(toNamespace), ...createDebug.skips.map(toNamespace).map((namespace => "-" + namespace)) ].join(",");\n createDebug.enable("");\n return namespaces;\n }\n function enabled(name) {\n if (name[name.length - 1] === "*") {\n return true;\n }\n let i;\n let len;\n for (i = 0, len = createDebug.skips.length; i < len; i++) {\n if (createDebug.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = createDebug.names.length; i < len; i++) {\n if (createDebug.names[i].test(name)) {\n return true;\n }\n }\n return false;\n }\n function toNamespace(regexp) {\n return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\\.\\*\\?$/, "*");\n }\n function coerce(val) {\n if (val instanceof Error) {\n return val.stack || val.message;\n }\n return val;\n }\n function destroy() {\n console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");\n }\n createDebug.enable(createDebug.load());\n return createDebug;\n }\n module.exports = setup;\n },\n 824: module => {\n var s = 1e3;\n var m = s * 60;\n var h = m * 60;\n var d = h * 24;\n var w = d * 7;\n var y = d * 365.25;\n module.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === "string" && val.length > 0) {\n return parse(val);\n } else if (type === "number" && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));\n };\n function parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || "ms").toLowerCase();\n switch (type) {\n case "years":\n case "year":\n case "yrs":\n case "yr":\n case "y":\n return n * y;\n\n case "weeks":\n case "week":\n case "w":\n return n * w;\n\n case "days":\n case "day":\n case "d":\n return n * d;\n\n case "hours":\n case "hour":\n case "hrs":\n case "hr":\n case "h":\n return n * h;\n\n case "minutes":\n case "minute":\n case "mins":\n case "min":\n case "m":\n return n * m;\n\n case "seconds":\n case "second":\n case "secs":\n case "sec":\n case "s":\n return n * s;\n\n case "milliseconds":\n case "millisecond":\n case "msecs":\n case "msec":\n case "ms":\n return n;\n\n default:\n return undefined;\n }\n }\n function fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + "d";\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + "h";\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + "m";\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + "s";\n }\n return ms + "ms";\n }\n function fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, "day");\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, "hour");\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, "minute");\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, "second");\n }\n return ms + " ms";\n }\n function plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");\n }\n }\n};\n\nvar __webpack_module_cache__ = {};\n\nfunction __webpack_require__(moduleId) {\n var cachedModule = __webpack_module_cache__[moduleId];\n if (cachedModule !== undefined) {\n return cachedModule.exports;\n }\n var module = __webpack_module_cache__[moduleId] = {\n exports: {}\n };\n __webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n return module.exports;\n}\n\n(() => {\n __webpack_require__.n = module => {\n var getter = module && module.__esModule ? () => module["default"] : () => module;\n __webpack_require__.d(getter, {\n a: getter\n });\n return getter;\n };\n})();\n\n(() => {\n __webpack_require__.d = (exports, definition) => {\n for (var key in definition) {\n if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: definition[key]\n });\n }\n }\n };\n})();\n\n(() => {\n __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\n})();\n\nvar __webpack_exports__ = {};\n\n(() => {\n const proxyMarker = Symbol("Comlink.proxy");\n const createEndpoint = Symbol("Comlink.endpoint");\n const releaseProxy = Symbol("Comlink.releaseProxy");\n const finalizer = Symbol("Comlink.finalizer");\n const throwMarker = Symbol("Comlink.thrown");\n const isObject = val => typeof val === "object" && val !== null || typeof val === "function";\n const proxyTransferHandler = {\n canHandle: val => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const {port1, port2} = new MessageChannel;\n expose(obj, port1);\n return [ port2, [ port2 ] ];\n },\n deserialize(port) {\n port.start();\n return comlink_wrap(port);\n }\n };\n const throwTransferHandler = {\n canHandle: value => isObject(value) && throwMarker in value,\n serialize({value}) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack\n }\n };\n } else {\n serialized = {\n isError: false,\n value\n };\n }\n return [ serialized, [] ];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n }\n };\n const transferHandlers = new Map([ [ "proxy", proxyTransferHandler ], [ "throw", throwTransferHandler ] ]);\n function isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === "*") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n }\n function expose(obj, ep = globalThis, allowedOrigins = [ "*" ]) {\n ep.addEventListener("message", (function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin \'${ev.origin}\' for comlink proxy`);\n return;\n }\n const {id, type, path} = Object.assign({\n path: []\n }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce(((obj, prop) => obj[prop]), obj);\n const rawValue = path.reduce(((obj, prop) => obj[prop]), obj);\n switch (type) {\n case "GET":\n {\n returnValue = rawValue;\n }\n break;\n\n case "SET":\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n\n case "APPLY":\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n\n case "CONSTRUCT":\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n\n case "ENDPOINT":\n {\n const {port1, port2} = new MessageChannel;\n expose(obj, port2);\n returnValue = transfer(port1, [ port1 ]);\n }\n break;\n\n case "RELEASE":\n {\n returnValue = undefined;\n }\n break;\n\n default:\n return;\n }\n } catch (value) {\n returnValue = {\n value,\n [throwMarker]: 0\n };\n }\n Promise.resolve(returnValue).catch((value => ({\n value,\n [throwMarker]: 0\n }))).then((returnValue => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), {\n id\n }), transferables);\n if (type === "RELEASE") {\n ep.removeEventListener("message", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === "function") {\n obj[finalizer]();\n }\n }\n })).catch((error => {\n const [wireValue, transferables] = toWireValue({\n value: new TypeError("Unserializable return value"),\n [throwMarker]: 0\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), {\n id\n }), transferables);\n }));\n }));\n if (ep.start) {\n ep.start();\n }\n }\n function isMessagePort(endpoint) {\n return endpoint.constructor.name === "MessagePort";\n }\n function closeEndPoint(endpoint) {\n if (isMessagePort(endpoint)) endpoint.close();\n }\n function comlink_wrap(ep, target) {\n return createProxy(ep, [], target);\n }\n function throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error("Proxy has been released and is not useable");\n }\n }\n function releaseEndpoint(ep) {\n return requestResponseMessage(ep, {\n type: "RELEASE"\n }).then((() => {\n closeEndPoint(ep);\n }));\n }\n const proxyCounter = new WeakMap;\n const proxyFinalizers = "FinalizationRegistry" in globalThis && new FinalizationRegistry((ep => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n }));\n function registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n }\n function unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n }\n function createProxy(ep, path = [], target = function() {}) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n isProxyReleased = true;\n };\n }\n if (prop === "then") {\n if (path.length === 0) {\n return {\n then: () => proxy\n };\n }\n const r = requestResponseMessage(ep, {\n type: "GET",\n path: path.map((p => p.toString()))\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, [ ...path, prop ]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, {\n type: "SET",\n path: [ ...path, prop ].map((p => p.toString())),\n value\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, {\n type: "ENDPOINT"\n }).then(fromWireValue);\n }\n if (last === "bind") {\n return createProxy(ep, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: "APPLY",\n path: path.map((p => p.toString())),\n argumentList\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: "CONSTRUCT",\n path: path.map((p => p.toString())),\n argumentList\n }, transferables).then(fromWireValue);\n }\n });\n registerProxy(proxy, ep);\n return proxy;\n }\n function myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n }\n function processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [ processed.map((v => v[0])), myFlat(processed.map((v => v[1]))) ];\n }\n const transferCache = new WeakMap;\n function transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n }\n function proxy(obj) {\n return Object.assign(obj, {\n [proxyMarker]: true\n });\n }\n function windowEndpoint(w, context = globalThis, targetOrigin = "*") {\n return {\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\n addEventListener: context.addEventListener.bind(context),\n removeEventListener: context.removeEventListener.bind(context)\n };\n }\n function toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [ {\n type: "HANDLER",\n name,\n value: serializedValue\n }, transferables ];\n }\n }\n return [ {\n type: "RAW",\n value\n }, transferCache.get(value) || [] ];\n }\n function fromWireValue(value) {\n switch (value.type) {\n case "HANDLER":\n return transferHandlers.get(value.name).deserialize(value.value);\n\n case "RAW":\n return value.value;\n }\n }\n function requestResponseMessage(ep, msg, transfers) {\n return new Promise((resolve => {\n const id = generateUUID();\n ep.addEventListener("message", (function l(ev) {\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\n return;\n }\n ep.removeEventListener("message", l);\n resolve(ev.data);\n }));\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({\n id\n }, msg), transfers);\n }));\n }\n function generateUUID() {\n return new Array(4).fill(0).map((() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))).join("-");\n }\n function getSharedMemoryAvailable() {\n const globalScope = typeof window !== "undefined" ? window : globalThis;\n return typeof SharedArrayBuffer !== "undefined" && globalScope.crossOriginIsolated;\n }\n function getRemoteBarretenbergWasm(worker) {\n return wrap(worker);\n }\n function getNumCpu() {\n return navigator.hardwareConcurrency;\n }\n function threadLogger() {\n return undefined;\n }\n function killSelf() {\n self.close();\n }\n var browser = __webpack_require__(227);\n var browser_default = __webpack_require__.n(browser);\n const randomBytes = len => {\n const getWebCrypto = () => {\n if (typeof window !== "undefined" && window.crypto) return window.crypto;\n if (typeof globalThis !== "undefined" && globalThis.crypto) return globalThis.crypto;\n return undefined;\n };\n const crypto = getWebCrypto();\n if (!crypto) {\n throw new Error("randomBytes UnsupportedEnvironment");\n }\n const buf = new Uint8Array(len);\n const MAX_BYTES = 65536;\n if (len > MAX_BYTES) {\n for (let generated = 0; generated < len; generated += MAX_BYTES) {\n crypto.getRandomValues(buf.subarray(generated, generated + MAX_BYTES));\n }\n } else {\n crypto.getRandomValues(buf);\n }\n return buf;\n };\n class BarretenbergWasmBase {\n constructor() {\n this.memStore = {};\n this.logger = browser_default()("bb.js:bb_wasm_base");\n }\n getImportObj(memory) {\n const importObj = {\n wasi_snapshot_preview1: {\n random_get: (out, length) => {\n out = out >>> 0;\n const randomData = randomBytes(length);\n const mem = this.getMemory();\n mem.set(randomData, out);\n },\n clock_time_get: (a1, a2, out) => {\n out = out >>> 0;\n const ts = BigInt((new Date).getTime()) * 1000000n;\n const view = new DataView(this.getMemory().buffer);\n view.setBigUint64(out, ts, true);\n },\n proc_exit: () => {\n this.logger("PANIC: proc_exit was called.");\n throw new Error;\n }\n },\n env: {\n logstr: addr => {\n const str = this.stringFromAddress(addr);\n const m = this.getMemory();\n const str2 = `${str} (mem: ${(m.length / (1024 * 1024)).toFixed(2)}MiB)`;\n this.logger(str2);\n },\n get_data: (keyAddr, outBufAddr) => {\n const key = this.stringFromAddress(keyAddr);\n outBufAddr = outBufAddr >>> 0;\n const data = this.memStore[key];\n if (!data) {\n this.logger(`get_data miss ${key}`);\n return;\n }\n this.writeMemory(outBufAddr, data);\n },\n set_data: (keyAddr, dataAddr, dataLength) => {\n const key = this.stringFromAddress(keyAddr);\n dataAddr = dataAddr >>> 0;\n this.memStore[key] = this.getMemorySlice(dataAddr, dataAddr + dataLength);\n },\n memory\n }\n };\n return importObj;\n }\n exports() {\n return this.instance.exports;\n }\n call(name, ...args) {\n if (!this.exports()[name]) {\n throw new Error(`WASM function ${name} not found.`);\n }\n try {\n return this.exports()[name](...args) >>> 0;\n } catch (err) {\n const message = `WASM function ${name} aborted, error: ${err}`;\n this.logger(message);\n this.logger(err.stack);\n throw err;\n }\n }\n memSize() {\n return this.getMemory().length;\n }\n getMemorySlice(start, end) {\n return this.getMemory().subarray(start, end).slice();\n }\n writeMemory(offset, arr) {\n const mem = this.getMemory();\n mem.set(arr, offset);\n }\n getMemory() {\n return new Uint8Array(this.memory.buffer);\n }\n stringFromAddress(addr) {\n addr = addr >>> 0;\n const m = this.getMemory();\n let i = addr;\n for (;m[i] !== 0; ++i) ;\n const textDecoder = new TextDecoder("ascii");\n return textDecoder.decode(m.slice(addr, i));\n }\n }\n class BarretenbergWasmThread extends BarretenbergWasmBase {\n async initThread(module, memory) {\n this.logger = threadLogger() || this.logger;\n this.memory = memory;\n this.instance = await WebAssembly.instantiate(module, this.getImportObj(this.memory));\n }\n destroy() {\n killSelf();\n }\n getImportObj(memory) {\n const baseImports = super.getImportObj(memory);\n return {\n ...baseImports,\n wasi: {\n "thread-spawn": () => {\n this.logger("PANIC: threads cannot spawn threads!");\n this.logger((new Error).stack);\n killSelf();\n }\n },\n env: {\n ...baseImports.env,\n env_hardware_concurrency: () => 1\n }\n };\n }\n }\n self.onmessage = function(e) {\n if (e.data.debug) {\n browser_default().enable(e.data.debug);\n }\n };\n expose(new BarretenbergWasmThread);\n self.postMessage({\n ready: true\n });\n const thread_worker = null;\n})();', "Worker", undefined, undefined);
|
|
4104
4151
|
}
|
|
4105
4152
|
function createThreadWorker() {
|
|
4106
4153
|
const worker = new thread_worker_Worker_fn;
|
|
@@ -4111,11 +4158,10 @@ var __webpack_exports__ = {};
|
|
|
4111
4158
|
});
|
|
4112
4159
|
return worker;
|
|
4113
4160
|
}
|
|
4114
|
-
const debug = browser_default()("bb.js:wasm");
|
|
4115
4161
|
class BarretenbergWasmBase {
|
|
4116
4162
|
constructor() {
|
|
4117
4163
|
this.memStore = {};
|
|
4118
|
-
this.logger =
|
|
4164
|
+
this.logger = browser_default()("bb.js:bb_wasm_base");
|
|
4119
4165
|
}
|
|
4120
4166
|
getImportObj(memory) {
|
|
4121
4167
|
const importObj = {
|
|
@@ -4143,9 +4189,6 @@ var __webpack_exports__ = {};
|
|
|
4143
4189
|
const m = this.getMemory();
|
|
4144
4190
|
const str2 = `${str} (mem: ${(m.length / (1024 * 1024)).toFixed(2)}MiB)`;
|
|
4145
4191
|
this.logger(str2);
|
|
4146
|
-
if (str2.startsWith("WARNING:")) {
|
|
4147
|
-
this.logger((new Error).stack);
|
|
4148
|
-
}
|
|
4149
4192
|
},
|
|
4150
4193
|
get_data: (keyAddr, outBufAddr) => {
|
|
4151
4194
|
const key = this.stringFromAddress(keyAddr);
|
|
@@ -4253,7 +4296,6 @@ var __webpack_exports__ = {};
|
|
|
4253
4296
|
}
|
|
4254
4297
|
}
|
|
4255
4298
|
}
|
|
4256
|
-
const barretenberg_wasm_main_debug = browser_default()("bb.js:wasm");
|
|
4257
4299
|
class barretenberg_wasm_main_BarretenbergWasmMain extends BarretenbergWasmBase {
|
|
4258
4300
|
constructor() {
|
|
4259
4301
|
super(...arguments);
|
|
@@ -4265,12 +4307,12 @@ var __webpack_exports__ = {};
|
|
|
4265
4307
|
getNumThreads() {
|
|
4266
4308
|
return this.workers.length + 1;
|
|
4267
4309
|
}
|
|
4268
|
-
async init(module, threads = Math.min(getNumCpu(), barretenberg_wasm_main_BarretenbergWasmMain.MAX_THREADS), logger =
|
|
4310
|
+
async init(module, threads = Math.min(getNumCpu(), barretenberg_wasm_main_BarretenbergWasmMain.MAX_THREADS), logger = browser_default()("bb.js:bb_wasm"), initial = 32, maximum = 2 ** 16) {
|
|
4269
4311
|
this.logger = logger;
|
|
4270
4312
|
const initialMb = initial * 2 ** 16 / (1024 * 1024);
|
|
4271
4313
|
const maxMb = maximum * 2 ** 16 / (1024 * 1024);
|
|
4272
4314
|
const shared = getSharedMemoryAvailable();
|
|
4273
|
-
this.logger(`
|
|
4315
|
+
this.logger(`Initializing bb wasm: initial memory ${initial} pages ${initialMb}MiB; ` + `max memory: ${maximum} pages, ${maxMb}MiB; ` + `threads: ${threads}; shared memory: ${shared}`);
|
|
4274
4316
|
this.memory = new WebAssembly.Memory({
|
|
4275
4317
|
initial,
|
|
4276
4318
|
maximum,
|
|
@@ -4280,7 +4322,7 @@ var __webpack_exports__ = {};
|
|
|
4280
4322
|
this.instance = instance;
|
|
4281
4323
|
this.call("_initialize");
|
|
4282
4324
|
if (threads > 1) {
|
|
4283
|
-
this.logger(`
|
|
4325
|
+
this.logger(`Creating ${threads} worker threads`);
|
|
4284
4326
|
this.workers = await Promise.all(Array.from({
|
|
4285
4327
|
length: threads - 1
|
|
4286
4328
|
}).map(createThreadWorker));
|
|
@@ -8231,7 +8273,10 @@ var __webpack_exports__ = {};
|
|
|
8231
8273
|
let url;
|
|
8232
8274
|
if (wasmPath) {
|
|
8233
8275
|
const suffix = multithreaded ? "-threads" : "";
|
|
8234
|
-
|
|
8276
|
+
const filePath = wasmPath.split("/").slice(0, -1).join("/");
|
|
8277
|
+
const fileNameWithExtensions = wasmPath.split("/").pop();
|
|
8278
|
+
const [fileName, ...extensions] = fileNameWithExtensions.split(".");
|
|
8279
|
+
url = `${filePath}/${fileName}${suffix}.${extensions.join(".")}`;
|
|
8235
8280
|
} else {
|
|
8236
8281
|
url = multithreaded ? (await import("./barretenberg-threads.js")).default : (await import("./barretenberg.js")).default;
|
|
8237
8282
|
}
|
|
@@ -8246,19 +8291,21 @@ var __webpack_exports__ = {};
|
|
|
8246
8291
|
return buffer;
|
|
8247
8292
|
}
|
|
8248
8293
|
}
|
|
8249
|
-
|
|
8250
|
-
async function fetchModuleAndThreads(desiredThreads = 32, wasmPath) {
|
|
8294
|
+
async function fetchModuleAndThreads(desiredThreads = 32, wasmPath, logger = browser_default()("bb.js:fetch_mat")) {
|
|
8251
8295
|
const shared = getSharedMemoryAvailable();
|
|
8252
|
-
const availableThreads = shared ? await getAvailableThreads() : 1;
|
|
8296
|
+
const availableThreads = shared ? await getAvailableThreads(logger) : 1;
|
|
8253
8297
|
const limitedThreads = Math.min(desiredThreads, availableThreads, 32);
|
|
8298
|
+
logger(`Fetching bb wasm from ${wasmPath ?? "default location"}`);
|
|
8254
8299
|
const code = await fetchCode(shared, wasmPath);
|
|
8300
|
+
logger(`Compiling bb wasm of ${code.byteLength} bytes`);
|
|
8255
8301
|
const module = await WebAssembly.compile(code);
|
|
8302
|
+
logger("Compilation of bb wasm complete");
|
|
8256
8303
|
return {
|
|
8257
8304
|
module,
|
|
8258
8305
|
threads: limitedThreads
|
|
8259
8306
|
};
|
|
8260
8307
|
}
|
|
8261
|
-
async function getAvailableThreads() {
|
|
8308
|
+
async function getAvailableThreads(logger) {
|
|
8262
8309
|
if (typeof navigator !== "undefined" && navigator.hardwareConcurrency) {
|
|
8263
8310
|
return navigator.hardwareConcurrency;
|
|
8264
8311
|
} else {
|
|
@@ -8266,17 +8313,17 @@ var __webpack_exports__ = {};
|
|
|
8266
8313
|
const os = await __webpack_require__.e(522).then(__webpack_require__.t.bind(__webpack_require__, 522, 23));
|
|
8267
8314
|
return os.cpus().length;
|
|
8268
8315
|
} catch (e) {
|
|
8269
|
-
|
|
8316
|
+
logger(`Could not detect environment to query number of threads. Falling back to one thread. Error: ${e.message ?? e}`);
|
|
8270
8317
|
return 1;
|
|
8271
8318
|
}
|
|
8272
8319
|
}
|
|
8273
8320
|
}
|
|
8274
8321
|
class BarretenbergWasm extends(null && BarretenbergWasmMain){
|
|
8275
|
-
static async new(desiredThreads, wasmPath) {
|
|
8322
|
+
static async new(desiredThreads, wasmPath, logger = createDebug("bb.js:bb_wasm_main")) {
|
|
8276
8323
|
const worker = createMainWorker();
|
|
8277
8324
|
const wasm = getRemoteBarretenbergWasm(worker);
|
|
8278
|
-
const {module, threads} = await fetchModuleAndThreads(desiredThreads, wasmPath);
|
|
8279
|
-
await wasm.init(module, threads, proxy(
|
|
8325
|
+
const {module, threads} = await fetchModuleAndThreads(desiredThreads, wasmPath, logger);
|
|
8326
|
+
await wasm.init(module, threads, proxy(logger));
|
|
8280
8327
|
return {
|
|
8281
8328
|
worker,
|
|
8282
8329
|
wasm
|
|
@@ -10337,6 +10384,11 @@ var __webpack_exports__ = {};
|
|
|
10337
10384
|
return files;
|
|
10338
10385
|
}
|
|
10339
10386
|
var backend_Buffer = __webpack_require__(764)["lW"];
|
|
10387
|
+
class AztecClientBackendError extends Error {
|
|
10388
|
+
constructor(message) {
|
|
10389
|
+
super(message);
|
|
10390
|
+
}
|
|
10391
|
+
}
|
|
10340
10392
|
class UltraPlonkBackend {
|
|
10341
10393
|
constructor(acirBytecode, backendOptions = {
|
|
10342
10394
|
threads: 1
|
|
@@ -10479,9 +10531,9 @@ var __webpack_exports__ = {};
|
|
|
10479
10531
|
const vkBuf = await writeVkUltraHonk(this.acirUncompressedBytecode, this.circuitOptions.recursive);
|
|
10480
10532
|
return await verifyUltraHonk(proof, new RawBuffer(vkBuf));
|
|
10481
10533
|
}
|
|
10482
|
-
async getVerificationKey() {
|
|
10534
|
+
async getVerificationKey(options) {
|
|
10483
10535
|
await this.instantiate();
|
|
10484
|
-
return await this.api.acirWriteVkUltraHonk(this.acirUncompressedBytecode, this.circuitOptions.recursive);
|
|
10536
|
+
return options?.keccak ? await this.api.acirWriteVkUltraKeccakHonk(this.acirUncompressedBytecode, this.circuitOptions.recursive) : await this.api.acirWriteVkUltraHonk(this.acirUncompressedBytecode, this.circuitOptions.recursive);
|
|
10485
10537
|
}
|
|
10486
10538
|
async getSolidityVerifier(vk) {
|
|
10487
10539
|
await this.instantiate();
|
|
@@ -10521,7 +10573,12 @@ var __webpack_exports__ = {};
|
|
|
10521
10573
|
}
|
|
10522
10574
|
async prove(witnessMsgpack) {
|
|
10523
10575
|
await this.instantiate();
|
|
10524
|
-
|
|
10576
|
+
const proofAndVk = await this.api.acirProveAztecClient(this.acirMsgpack, witnessMsgpack);
|
|
10577
|
+
const [proof, vk] = proofAndVk;
|
|
10578
|
+
if (!await this.verify(proof, vk)) {
|
|
10579
|
+
throw new AztecClientBackendError("Failed to verify the private (ClientIVC) transaction proof!");
|
|
10580
|
+
}
|
|
10581
|
+
return proofAndVk;
|
|
10525
10582
|
}
|
|
10526
10583
|
async verify(proof, vk) {
|
|
10527
10584
|
await this.instantiate();
|
|
@@ -10531,6 +10588,10 @@ var __webpack_exports__ = {};
|
|
|
10531
10588
|
await this.instantiate();
|
|
10532
10589
|
return this.api.acirProveAndVerifyAztecClient(this.acirMsgpack, witnessMsgpack);
|
|
10533
10590
|
}
|
|
10591
|
+
async gates() {
|
|
10592
|
+
await this.instantiate();
|
|
10593
|
+
return this.api.acirGatesAztecClient(this.acirMsgpack);
|
|
10594
|
+
}
|
|
10534
10595
|
async destroy() {
|
|
10535
10596
|
if (!this.api) {
|
|
10536
10597
|
return;
|
|
@@ -10552,7 +10613,6 @@ var __webpack_exports__ = {};
|
|
|
10552
10613
|
throw new Error("No implementation found for base64 decoding.");
|
|
10553
10614
|
}
|
|
10554
10615
|
}
|
|
10555
|
-
const barretenberg_debug = browser_default()("bb.js:wasm");
|
|
10556
10616
|
class Barretenberg extends BarretenbergApi {
|
|
10557
10617
|
constructor(worker, wasm, options) {
|
|
10558
10618
|
super(wasm);
|
|
@@ -10562,20 +10622,20 @@ var __webpack_exports__ = {};
|
|
|
10562
10622
|
static async new(options = {}) {
|
|
10563
10623
|
const worker = browser_createMainWorker();
|
|
10564
10624
|
const wasm = browser_getRemoteBarretenbergWasm(worker);
|
|
10565
|
-
const {module, threads} = await fetchModuleAndThreads(options.threads, options.wasmPath);
|
|
10566
|
-
await wasm.init(module, threads, comlink_proxy(
|
|
10625
|
+
const {module, threads} = await fetchModuleAndThreads(options.threads, options.wasmPath, options.logger);
|
|
10626
|
+
await wasm.init(module, threads, comlink_proxy(options.logger ?? browser_default()("bb.js:bb_wasm_async")), options.memory?.initial, options.memory?.maximum);
|
|
10567
10627
|
return new Barretenberg(worker, wasm, options);
|
|
10568
10628
|
}
|
|
10569
10629
|
async getNumThreads() {
|
|
10570
10630
|
return await this.wasm.getNumThreads();
|
|
10571
10631
|
}
|
|
10572
10632
|
async initSRSForCircuitSize(circuitSize) {
|
|
10573
|
-
const crs = await CachedNetCrs.new(circuitSize + 1, this.options.crsPath);
|
|
10633
|
+
const crs = await CachedNetCrs.new(circuitSize + 1, this.options.crsPath, this.options.logger);
|
|
10574
10634
|
await this.srsInitSrs(new RawBuffer(crs.getG1Data()), crs.numPoints, new RawBuffer(crs.getG2Data()));
|
|
10575
10635
|
}
|
|
10576
10636
|
async initSRSClientIVC() {
|
|
10577
|
-
const crs = await CachedNetCrs.new(2 ** 20 + 1, this.options.crsPath);
|
|
10578
|
-
const grumpkinCrs = await CachedNetGrumpkinCrs.new(2 ** 16 + 1, this.options.crsPath);
|
|
10637
|
+
const crs = await CachedNetCrs.new(2 ** 20 + 1, this.options.crsPath, this.options.logger);
|
|
10638
|
+
const grumpkinCrs = await CachedNetGrumpkinCrs.new(2 ** 16 + 1, this.options.crsPath, this.options.logger);
|
|
10579
10639
|
await this.srsInitSrs(new RawBuffer(crs.getG1Data()), crs.numPoints, new RawBuffer(crs.getG2Data()));
|
|
10580
10640
|
await this.srsInitGrumpkinSrs(new RawBuffer(grumpkinCrs.getG1Data()), grumpkinCrs.numPoints);
|
|
10581
10641
|
}
|
|
@@ -10594,15 +10654,15 @@ var __webpack_exports__ = {};
|
|
|
10594
10654
|
constructor(wasm) {
|
|
10595
10655
|
super(wasm);
|
|
10596
10656
|
}
|
|
10597
|
-
static async new(wasmPath) {
|
|
10657
|
+
static async new(wasmPath, logger = browser_default()("bb.js:bb_wasm_sync")) {
|
|
10598
10658
|
const wasm = new barretenberg_wasm_main_BarretenbergWasmMain;
|
|
10599
|
-
const {module, threads} = await fetchModuleAndThreads(1, wasmPath);
|
|
10600
|
-
await wasm.init(module, threads);
|
|
10659
|
+
const {module, threads} = await fetchModuleAndThreads(1, wasmPath, logger);
|
|
10660
|
+
await wasm.init(module, threads, logger);
|
|
10601
10661
|
return new BarretenbergSync(wasm);
|
|
10602
10662
|
}
|
|
10603
|
-
static async initSingleton(wasmPath) {
|
|
10663
|
+
static async initSingleton(wasmPath, logger = browser_default()("bb.js:bb_wasm_sync")) {
|
|
10604
10664
|
if (!barrentenbergSyncSingletonPromise) {
|
|
10605
|
-
barrentenbergSyncSingletonPromise = BarretenbergSync.new(wasmPath);
|
|
10665
|
+
barrentenbergSyncSingletonPromise = BarretenbergSync.new(wasmPath, logger);
|
|
10606
10666
|
}
|
|
10607
10667
|
barretenbergSyncSingleton = await barrentenbergSyncSingletonPromise;
|
|
10608
10668
|
return barretenbergSyncSingleton;
|