@sec-ant/zxing-wasm
Advanced tools
Comparing version 0.0.5 to 1.0.0
@@ -1,2 +0,2 @@ | ||
export { ZXING_BARCODE_FORMAT_NAMES, ZXING_CHARACTOR_SET_NAMES, defaultZXingReadOptions, defaultZXingWriteOptions, } from "./ZXing.js"; | ||
export type { ZXingBarcodeFormat, ZXingReadInputBarcodeFormat, ZXingReadResultBarcodeFormat, ZXingWriteInputBarcodeFormat, ZXingCharacterSet, ZXingEccLevel, ZXingReadResult, ZXingReadOptions, ZXingWriteResult, ZXingWriteOptions, } from "./ZXing.js"; | ||
export { setZXingModuleOverrides, purgeZXingModule, ZXING_BARCODE_FORMAT_NAMES, ZXING_CHARACTOR_SET_NAMES, defaultZXingReadOptions, defaultZXingWriteOptions, } from "./core.js"; | ||
export type { ZXingModuleType, ZXingModuleFactory, ZXingModuleFactoryTypeExtractor, ZXingModuleOverrides, ZXingModule, ZXingBarcodeFormat, ZXingReadInputBarcodeFormat, ZXingWriteInputBarcodeFormat, ZXingReadOutputBarcodeFormat, ZXingCharacterSet, ZXingECCLevel, ZXingPoint, ZXingPosition, ZXingVector, ZXingReadInnerOutput, ZXingWriteInnerOutput, ZXingReadOutput, ZXingWriteOutput, ZXingReadOptions, ZXingWriteOptions, } from "./core.js"; |
@@ -1,6 +0,7 @@ | ||
import { ZXingReadOptions, ZXingReadResult, ZXingWriteOptions, ZXingWriteResult } from "../ZXing.js"; | ||
export declare function getZXingInstance(): void; | ||
export declare function readBarcodeFromImageFile(imageFile: Blob | File, { tryHarder, formats, maxNumberOfSymbols, }?: ZXingReadOptions): Promise<ZXingReadResult[]>; | ||
export declare function readBarcodeFromImageData(imageData: ImageData, { tryHarder, formats, maxNumberOfSymbols, }?: ZXingReadOptions): Promise<ZXingReadResult[]>; | ||
export declare function writeBarcodeToImageFile(text: string, { format, charset, quietZone, width, height, eccLevel, }?: ZXingWriteOptions): Promise<ZXingWriteResult>; | ||
import zxingModuleFactory from "./zxing_full.js"; | ||
import { ZXingModuleFactoryTypeExtractor, ZXingModuleOverrides, getZXingModule as _getZXingModule, ZXingReadOptions, ZXingReadOutput, ZXingWriteOptions, ZXingWriteOutput } from "../core.js"; | ||
export declare function getZXingModule(zxingModuleOverrides?: ZXingModuleOverrides<ZXingModuleFactoryTypeExtractor<typeof zxingModuleFactory>>): ReturnType<typeof _getZXingModule>; | ||
export declare function readBarcodeFromImageFile(imageFile: Blob | File, { tryHarder, formats, maxNumberOfSymbols, }?: ZXingReadOptions): Promise<ZXingReadOutput[]>; | ||
export declare function readBarcodeFromImageData(imageData: ImageData, { tryHarder, formats, maxNumberOfSymbols, }?: ZXingReadOptions): Promise<ZXingReadOutput[]>; | ||
export declare function writeBarcodeToImageFile(text: string, { format, charset, quietZone, width, height, eccLevel, }?: ZXingWriteOptions): Promise<ZXingWriteOutput>; | ||
export * from "../exposed.js"; |
@@ -1,67 +0,1783 @@ | ||
import n from "./zxing_full.js"; | ||
import { getZXingInstance as g, readBarcodeFromImageFile as s, defaultZXingReadOptions as e, readBarcodeFromImageData as f, writeBarcodeToImageFile as I, defaultZXingWriteOptions as a } from "../ZXing.js"; | ||
import { ZXING_BARCODE_FORMAT_NAMES as p, ZXING_CHARACTOR_SET_NAMES as A } from "../ZXing.js"; | ||
function l() { | ||
g(n); | ||
import { g as ci, r as li, d as L, c as vi, w as di, b as G } from "../core-9bc51fdd.js"; | ||
import { Z as bi, a as Pi, p as Ci, s as Ti } from "../core-9bc51fdd.js"; | ||
var ke = (() => { | ||
var W = import.meta.url; | ||
return function(H = {}) { | ||
var u = typeof H < "u" ? H : {}, V, q; | ||
u.ready = new Promise(function(e, r) { | ||
V = e, q = r; | ||
}); | ||
var de = Object.assign({}, u), pe = "./this.program", qe = typeof window == "object", he = typeof importScripts == "function"; | ||
typeof process == "object" && typeof process.versions == "object" && process.versions.node; | ||
var j = ""; | ||
function Wr(e) { | ||
return u.locateFile ? u.locateFile(e, j) : j + e; | ||
} | ||
var De; | ||
(qe || he) && (he ? j = self.location.href : typeof document < "u" && document.currentScript && (j = document.currentScript.src), W && (j = W), j.indexOf("blob:") !== 0 ? j = j.substr(0, j.replace(/[?#].*/, "").lastIndexOf("/") + 1) : j = "", he && (De = (e) => { | ||
var r = new XMLHttpRequest(); | ||
return r.open("GET", e, !1), r.responseType = "arraybuffer", r.send(null), new Uint8Array(r.response); | ||
})), u.print || console.log.bind(console); | ||
var ne = u.printErr || console.warn.bind(console); | ||
Object.assign(u, de), de = null, u.arguments && u.arguments, u.thisProgram && (pe = u.thisProgram), u.quit && u.quit; | ||
var ie; | ||
u.wasmBinary && (ie = u.wasmBinary), u.noExitRuntime, typeof WebAssembly != "object" && K("no native wasm support detected"); | ||
var _e, Je = !1; | ||
function jr(e, r) { | ||
e || K(r); | ||
} | ||
var Ke = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0; | ||
function Ur(e, r, t) { | ||
for (var n = r + t, i = r; e[i] && !(i >= n); ) | ||
++i; | ||
if (i - r > 16 && e.buffer && Ke) | ||
return Ke.decode(e.subarray(r, i)); | ||
for (var a = ""; r < i; ) { | ||
var s = e[r++]; | ||
if (!(s & 128)) { | ||
a += String.fromCharCode(s); | ||
continue; | ||
} | ||
var o = e[r++] & 63; | ||
if ((s & 224) == 192) { | ||
a += String.fromCharCode((s & 31) << 6 | o); | ||
continue; | ||
} | ||
var f = e[r++] & 63; | ||
if ((s & 240) == 224 ? s = (s & 15) << 12 | o << 6 | f : s = (s & 7) << 18 | o << 12 | f << 6 | e[r++] & 63, s < 65536) | ||
a += String.fromCharCode(s); | ||
else { | ||
var c = s - 65536; | ||
a += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023); | ||
} | ||
} | ||
return a; | ||
} | ||
function Oe(e, r) { | ||
return e ? Ur(k, e, r) : ""; | ||
} | ||
function Qe(e, r, t, n) { | ||
if (!(n > 0)) | ||
return 0; | ||
for (var i = t, a = t + n - 1, s = 0; s < e.length; ++s) { | ||
var o = e.charCodeAt(s); | ||
if (o >= 55296 && o <= 57343) { | ||
var f = e.charCodeAt(++s); | ||
o = 65536 + ((o & 1023) << 10) | f & 1023; | ||
} | ||
if (o <= 127) { | ||
if (t >= a) | ||
break; | ||
r[t++] = o; | ||
} else if (o <= 2047) { | ||
if (t + 1 >= a) | ||
break; | ||
r[t++] = 192 | o >> 6, r[t++] = 128 | o & 63; | ||
} else if (o <= 65535) { | ||
if (t + 2 >= a) | ||
break; | ||
r[t++] = 224 | o >> 12, r[t++] = 128 | o >> 6 & 63, r[t++] = 128 | o & 63; | ||
} else { | ||
if (t + 3 >= a) | ||
break; | ||
r[t++] = 240 | o >> 18, r[t++] = 128 | o >> 12 & 63, r[t++] = 128 | o >> 6 & 63, r[t++] = 128 | o & 63; | ||
} | ||
} | ||
return r[t] = 0, t - i; | ||
} | ||
function Hr(e, r, t) { | ||
return Qe(e, k, r, t); | ||
} | ||
function er(e) { | ||
for (var r = 0, t = 0; t < e.length; ++t) { | ||
var n = e.charCodeAt(t); | ||
n <= 127 ? r++ : n <= 2047 ? r += 2 : n >= 55296 && n <= 57343 ? (r += 4, ++t) : r += 3; | ||
} | ||
return r; | ||
} | ||
var U, k, J, ge, T, F, rr, tr; | ||
function nr() { | ||
var e = _e.buffer; | ||
u.HEAP8 = U = new Int8Array(e), u.HEAP16 = J = new Int16Array(e), u.HEAP32 = T = new Int32Array(e), u.HEAPU8 = k = new Uint8Array(e), u.HEAPU16 = ge = new Uint16Array(e), u.HEAPU32 = F = new Uint32Array(e), u.HEAPF32 = rr = new Float32Array(e), u.HEAPF64 = tr = new Float64Array(e); | ||
} | ||
var ir, ar = [], or = [], sr = []; | ||
function Mr() { | ||
if (u.preRun) | ||
for (typeof u.preRun == "function" && (u.preRun = [u.preRun]); u.preRun.length; ) | ||
Yr(u.preRun.shift()); | ||
We(ar); | ||
} | ||
function Ir() { | ||
We(or); | ||
} | ||
function xr() { | ||
if (u.postRun) | ||
for (typeof u.postRun == "function" && (u.postRun = [u.postRun]); u.postRun.length; ) | ||
Br(u.postRun.shift()); | ||
We(sr); | ||
} | ||
function Yr(e) { | ||
ar.unshift(e); | ||
} | ||
function Vr(e) { | ||
or.unshift(e); | ||
} | ||
function Br(e) { | ||
sr.unshift(e); | ||
} | ||
var N = 0, ae = null; | ||
function Lr(e) { | ||
N++, u.monitorRunDependencies && u.monitorRunDependencies(N); | ||
} | ||
function Nr(e) { | ||
if (N--, u.monitorRunDependencies && u.monitorRunDependencies(N), N == 0 && ae) { | ||
var r = ae; | ||
ae = null, r(); | ||
} | ||
} | ||
function K(e) { | ||
u.onAbort && u.onAbort(e), e = "Aborted(" + e + ")", ne(e), Je = !0, e += ". Build with -sASSERTIONS for more info."; | ||
var r = new WebAssembly.RuntimeError(e); | ||
throw q(r), r; | ||
} | ||
var zr = "data:application/octet-stream;base64,"; | ||
function ur(e) { | ||
return e.startsWith(zr); | ||
} | ||
var z; | ||
u.locateFile ? (z = "zxing_full.wasm", ur(z) || (z = Wr(z))) : z = new URL("/full/zxing_full.wasm", self.location).href; | ||
function fr(e) { | ||
try { | ||
if (e == z && ie) | ||
return new Uint8Array(ie); | ||
if (De) | ||
return De(e); | ||
throw "both async and sync fetching of the wasm failed"; | ||
} catch (r) { | ||
K(r); | ||
} | ||
} | ||
function Xr(e) { | ||
return !ie && (qe || he) && typeof fetch == "function" ? fetch(e, { credentials: "same-origin" }).then(function(r) { | ||
if (!r.ok) | ||
throw "failed to load wasm binary file at '" + e + "'"; | ||
return r.arrayBuffer(); | ||
}).catch(function() { | ||
return fr(e); | ||
}) : Promise.resolve().then(function() { | ||
return fr(e); | ||
}); | ||
} | ||
function cr(e, r, t) { | ||
return Xr(e).then(function(n) { | ||
return WebAssembly.instantiate(n, r); | ||
}).then(function(n) { | ||
return n; | ||
}).then(t, function(n) { | ||
ne("failed to asynchronously prepare wasm: " + n), K(n); | ||
}); | ||
} | ||
function Zr(e, r, t, n) { | ||
return !e && typeof WebAssembly.instantiateStreaming == "function" && !ur(r) && typeof fetch == "function" ? fetch(r, { credentials: "same-origin" }).then(function(i) { | ||
var a = WebAssembly.instantiateStreaming(i, t); | ||
return a.then(n, function(s) { | ||
return ne("wasm streaming compile failed: " + s), ne("falling back to ArrayBuffer instantiation"), cr(r, t, n); | ||
}); | ||
}) : cr(r, t, n); | ||
} | ||
function Gr() { | ||
var e = { a: Dn }; | ||
function r(n, i) { | ||
var a = n.exports; | ||
return u.asm = a, _e = u.asm.oa, nr(), ir = u.asm.ta, Vr(u.asm.pa), Nr(), a; | ||
} | ||
Lr(); | ||
function t(n) { | ||
r(n.instance); | ||
} | ||
if (u.instantiateWasm) | ||
try { | ||
return u.instantiateWasm(e, r); | ||
} catch (n) { | ||
ne("Module.instantiateWasm callback failed with error: " + n), q(n); | ||
} | ||
return Zr(ie, z, e, t).catch(q), {}; | ||
} | ||
function We(e) { | ||
for (; e.length > 0; ) | ||
e.shift()(u); | ||
} | ||
var ye = []; | ||
function qr(e) { | ||
e.add_ref(); | ||
} | ||
var me = 0; | ||
function Jr(e) { | ||
var r = new be(e); | ||
return r.get_caught() || (r.set_caught(!0), me--), r.set_rethrown(!1), ye.push(r), qr(r), r.get_exception_ptr(); | ||
} | ||
var Q = 0, we = []; | ||
function m(e) { | ||
var r = we[e]; | ||
return r || (e >= we.length && (we.length = e + 1), we[e] = r = ir.get(e)), r; | ||
} | ||
function Kr(e) { | ||
if (e.release_ref() && !e.get_rethrown()) { | ||
var r = e.get_destructor(); | ||
r && m(r)(e.excPtr), Fr(e.excPtr); | ||
} | ||
} | ||
function Qr() { | ||
y(0); | ||
var e = ye.pop(); | ||
Kr(e), Q = 0; | ||
} | ||
function be(e) { | ||
this.excPtr = e, this.ptr = e - 24, this.set_type = function(r) { | ||
F[this.ptr + 4 >> 2] = r; | ||
}, this.get_type = function() { | ||
return F[this.ptr + 4 >> 2]; | ||
}, this.set_destructor = function(r) { | ||
F[this.ptr + 8 >> 2] = r; | ||
}, this.get_destructor = function() { | ||
return F[this.ptr + 8 >> 2]; | ||
}, this.set_refcount = function(r) { | ||
T[this.ptr >> 2] = r; | ||
}, this.set_caught = function(r) { | ||
r = r ? 1 : 0, U[this.ptr + 12 >> 0] = r; | ||
}, this.get_caught = function() { | ||
return U[this.ptr + 12 >> 0] != 0; | ||
}, this.set_rethrown = function(r) { | ||
r = r ? 1 : 0, U[this.ptr + 13 >> 0] = r; | ||
}, this.get_rethrown = function() { | ||
return U[this.ptr + 13 >> 0] != 0; | ||
}, this.init = function(r, t) { | ||
this.set_adjusted_ptr(0), this.set_type(r), this.set_destructor(t), this.set_refcount(0), this.set_caught(!1), this.set_rethrown(!1); | ||
}, this.add_ref = function() { | ||
var r = T[this.ptr >> 2]; | ||
T[this.ptr >> 2] = r + 1; | ||
}, this.release_ref = function() { | ||
var r = T[this.ptr >> 2]; | ||
return T[this.ptr >> 2] = r - 1, r === 1; | ||
}, this.set_adjusted_ptr = function(r) { | ||
F[this.ptr + 16 >> 2] = r; | ||
}, this.get_adjusted_ptr = function() { | ||
return F[this.ptr + 16 >> 2]; | ||
}, this.get_exception_ptr = function() { | ||
var r = Rr(this.get_type()); | ||
if (r) | ||
return F[this.excPtr >> 2]; | ||
var t = this.get_adjusted_ptr(); | ||
return t !== 0 ? t : this.excPtr; | ||
}; | ||
} | ||
function et(e) { | ||
throw Q || (Q = e), e; | ||
} | ||
function je() { | ||
var e = Q; | ||
if (!e) | ||
return ve(0), 0; | ||
var r = new be(e); | ||
r.set_adjusted_ptr(e); | ||
var t = r.get_type(); | ||
if (!t) | ||
return ve(0), e; | ||
for (var n = 0; n < arguments.length; n++) { | ||
var i = arguments[n]; | ||
if (i === 0 || i === t) | ||
break; | ||
var a = r.ptr + 16; | ||
if (Sr(i, t, a)) | ||
return ve(i), e; | ||
} | ||
return ve(t), e; | ||
} | ||
var rt = je, tt = je, nt = je; | ||
function it(e) { | ||
return new be(e).get_exception_ptr(); | ||
} | ||
function at() { | ||
var e = ye.pop(); | ||
e || K("no exception to throw"); | ||
var r = e.excPtr; | ||
throw e.get_rethrown() || (ye.push(e), e.set_rethrown(!0), e.set_caught(!1), me++), Q = r, r; | ||
} | ||
function ot(e, r, t) { | ||
var n = new be(e); | ||
throw n.init(r, t), Q = e, me++, e; | ||
} | ||
function st() { | ||
return me; | ||
} | ||
var Pe = {}; | ||
function Ue(e) { | ||
for (; e.length; ) { | ||
var r = e.pop(), t = e.pop(); | ||
t(r); | ||
} | ||
} | ||
function oe(e) { | ||
return this.fromWireType(T[e >> 2]); | ||
} | ||
var ee = {}, X = {}, Ce = {}, ut = 48, ft = 57; | ||
function He(e) { | ||
if (e === void 0) | ||
return "_unknown"; | ||
e = e.replace(/[^a-zA-Z0-9_]/g, "$"); | ||
var r = e.charCodeAt(0); | ||
return r >= ut && r <= ft ? "_" + e : e; | ||
} | ||
function Me(e, r) { | ||
return e = He(e), { [e]: function() { | ||
return r.apply(this, arguments); | ||
} }[e]; | ||
} | ||
function Ie(e, r) { | ||
var t = Me(r, function(n) { | ||
this.name = r, this.message = n; | ||
var i = new Error(n).stack; | ||
i !== void 0 && (this.stack = this.toString() + ` | ||
` + i.replace(/^Error(:[^\n]*)?\n/, "")); | ||
}); | ||
return t.prototype = Object.create(e.prototype), t.prototype.constructor = t, t.prototype.toString = function() { | ||
return this.message === void 0 ? this.name : this.name + ": " + this.message; | ||
}, t; | ||
} | ||
var lr = void 0; | ||
function Te(e) { | ||
throw new lr(e); | ||
} | ||
function M(e, r, t) { | ||
e.forEach(function(o) { | ||
Ce[o] = r; | ||
}); | ||
function n(o) { | ||
var f = t(o); | ||
f.length !== e.length && Te("Mismatched type converter count"); | ||
for (var c = 0; c < e.length; ++c) | ||
I(e[c], f[c]); | ||
} | ||
var i = new Array(r.length), a = [], s = 0; | ||
r.forEach((o, f) => { | ||
X.hasOwnProperty(o) ? i[f] = X[o] : (a.push(o), ee.hasOwnProperty(o) || (ee[o] = []), ee[o].push(() => { | ||
i[f] = X[o], ++s, s === a.length && n(i); | ||
})); | ||
}), a.length === 0 && n(i); | ||
} | ||
function ct(e) { | ||
var r = Pe[e]; | ||
delete Pe[e]; | ||
var t = r.rawConstructor, n = r.rawDestructor, i = r.fields, a = i.map((s) => s.getterReturnType).concat(i.map((s) => s.setterArgumentType)); | ||
M([e], a, (s) => { | ||
var o = {}; | ||
return i.forEach((f, c) => { | ||
var v = f.fieldName, d = s[c], h = f.getter, _ = f.getterContext, P = s[c + i.length], A = f.setter, $ = f.setterContext; | ||
o[v] = { read: (C) => d.fromWireType(h(_, C)), write: (C, l) => { | ||
var p = []; | ||
A($, C, P.toWireType(p, l)), Ue(p); | ||
} }; | ||
}), [{ name: r.name, fromWireType: function(f) { | ||
var c = {}; | ||
for (var v in o) | ||
c[v] = o[v].read(f); | ||
return n(f), c; | ||
}, toWireType: function(f, c) { | ||
for (var v in o) | ||
if (!(v in c)) | ||
throw new TypeError('Missing field: "' + v + '"'); | ||
var d = t(); | ||
for (v in o) | ||
o[v].write(d, c[v]); | ||
return f !== null && f.push(n, d), d; | ||
}, argPackAdvance: 8, readValueFromPointer: oe, destructorFunction: n }]; | ||
}); | ||
} | ||
function lt(e, r, t, n, i) { | ||
} | ||
function xe(e) { | ||
switch (e) { | ||
case 1: | ||
return 0; | ||
case 2: | ||
return 1; | ||
case 4: | ||
return 2; | ||
case 8: | ||
return 3; | ||
default: | ||
throw new TypeError("Unknown type size: " + e); | ||
} | ||
} | ||
function vt() { | ||
for (var e = new Array(256), r = 0; r < 256; ++r) | ||
e[r] = String.fromCharCode(r); | ||
vr = e; | ||
} | ||
var vr = void 0; | ||
function S(e) { | ||
for (var r = "", t = e; k[t]; ) | ||
r += vr[k[t++]]; | ||
return r; | ||
} | ||
var re = void 0; | ||
function g(e) { | ||
throw new re(e); | ||
} | ||
function I(e, r, t = {}) { | ||
if (!("argPackAdvance" in r)) | ||
throw new TypeError("registerType registeredInstance requires argPackAdvance"); | ||
var n = r.name; | ||
if (e || g('type "' + n + '" must have a positive integer typeid pointer'), X.hasOwnProperty(e)) { | ||
if (t.ignoreDuplicateRegistrations) | ||
return; | ||
g("Cannot register type '" + n + "' twice"); | ||
} | ||
if (X[e] = r, delete Ce[e], ee.hasOwnProperty(e)) { | ||
var i = ee[e]; | ||
delete ee[e], i.forEach((a) => a()); | ||
} | ||
} | ||
function dt(e, r, t, n, i) { | ||
var a = xe(t); | ||
r = S(r), I(e, { name: r, fromWireType: function(s) { | ||
return !!s; | ||
}, toWireType: function(s, o) { | ||
return o ? n : i; | ||
}, argPackAdvance: 8, readValueFromPointer: function(s) { | ||
var o; | ||
if (t === 1) | ||
o = U; | ||
else if (t === 2) | ||
o = J; | ||
else if (t === 4) | ||
o = T; | ||
else | ||
throw new TypeError("Unknown boolean type size: " + r); | ||
return this.fromWireType(o[s >> a]); | ||
}, destructorFunction: null }); | ||
} | ||
function pt(e) { | ||
if (!(this instanceof B) || !(e instanceof B)) | ||
return !1; | ||
for (var r = this.$$.ptrType.registeredClass, t = this.$$.ptr, n = e.$$.ptrType.registeredClass, i = e.$$.ptr; r.baseClass; ) | ||
t = r.upcast(t), r = r.baseClass; | ||
for (; n.baseClass; ) | ||
i = n.upcast(i), n = n.baseClass; | ||
return r === n && t === i; | ||
} | ||
function ht(e) { | ||
return { count: e.count, deleteScheduled: e.deleteScheduled, preservePointerOnDelete: e.preservePointerOnDelete, ptr: e.ptr, ptrType: e.ptrType, smartPtr: e.smartPtr, smartPtrType: e.smartPtrType }; | ||
} | ||
function Ye(e) { | ||
function r(t) { | ||
return t.$$.ptrType.registeredClass.name; | ||
} | ||
g(r(e) + " instance already deleted"); | ||
} | ||
var Ve = !1; | ||
function dr(e) { | ||
} | ||
function _t(e) { | ||
e.smartPtr ? e.smartPtrType.rawDestructor(e.smartPtr) : e.ptrType.registeredClass.rawDestructor(e.ptr); | ||
} | ||
function pr(e) { | ||
e.count.value -= 1; | ||
var r = e.count.value === 0; | ||
r && _t(e); | ||
} | ||
function hr(e, r, t) { | ||
if (r === t) | ||
return e; | ||
if (t.baseClass === void 0) | ||
return null; | ||
var n = hr(e, r, t.baseClass); | ||
return n === null ? null : t.downcast(n); | ||
} | ||
var _r = {}; | ||
function gt() { | ||
return Object.keys(fe).length; | ||
} | ||
function yt() { | ||
var e = []; | ||
for (var r in fe) | ||
fe.hasOwnProperty(r) && e.push(fe[r]); | ||
return e; | ||
} | ||
var se = []; | ||
function Be() { | ||
for (; se.length; ) { | ||
var e = se.pop(); | ||
e.$$.deleteScheduled = !1, e.delete(); | ||
} | ||
} | ||
var ue = void 0; | ||
function mt(e) { | ||
ue = e, se.length && ue && ue(Be); | ||
} | ||
function wt() { | ||
u.getInheritedInstanceCount = gt, u.getLiveInheritedInstances = yt, u.flushPendingDeletes = Be, u.setDelayFunction = mt; | ||
} | ||
var fe = {}; | ||
function bt(e, r) { | ||
for (r === void 0 && g("ptr should not be undefined"); e.baseClass; ) | ||
r = e.upcast(r), e = e.baseClass; | ||
return r; | ||
} | ||
function Pt(e, r) { | ||
return r = bt(e, r), fe[r]; | ||
} | ||
function $e(e, r) { | ||
(!r.ptrType || !r.ptr) && Te("makeClassHandle requires ptr and ptrType"); | ||
var t = !!r.smartPtrType, n = !!r.smartPtr; | ||
return t !== n && Te("Both smartPtrType and smartPtr must be specified"), r.count = { value: 1 }, ce(Object.create(e, { $$: { value: r } })); | ||
} | ||
function Ct(e) { | ||
var r = this.getPointee(e); | ||
if (!r) | ||
return this.destructor(e), null; | ||
var t = Pt(this.registeredClass, r); | ||
if (t !== void 0) { | ||
if (t.$$.count.value === 0) | ||
return t.$$.ptr = r, t.$$.smartPtr = e, t.clone(); | ||
var n = t.clone(); | ||
return this.destructor(e), n; | ||
} | ||
function i() { | ||
return this.isSmartPointer ? $e(this.registeredClass.instancePrototype, { ptrType: this.pointeeType, ptr: r, smartPtrType: this, smartPtr: e }) : $e(this.registeredClass.instancePrototype, { ptrType: this, ptr: e }); | ||
} | ||
var a = this.registeredClass.getActualType(r), s = _r[a]; | ||
if (!s) | ||
return i.call(this); | ||
var o; | ||
this.isConst ? o = s.constPointerType : o = s.pointerType; | ||
var f = hr(r, this.registeredClass, o.registeredClass); | ||
return f === null ? i.call(this) : this.isSmartPointer ? $e(o.registeredClass.instancePrototype, { ptrType: o, ptr: f, smartPtrType: this, smartPtr: e }) : $e(o.registeredClass.instancePrototype, { ptrType: o, ptr: f }); | ||
} | ||
function ce(e) { | ||
return typeof FinalizationRegistry > "u" ? (ce = (r) => r, e) : (Ve = new FinalizationRegistry((r) => { | ||
pr(r.$$); | ||
}), ce = (r) => { | ||
var t = r.$$, n = !!t.smartPtr; | ||
if (n) { | ||
var i = { $$: t }; | ||
Ve.register(r, i, r); | ||
} | ||
return r; | ||
}, dr = (r) => Ve.unregister(r), ce(e)); | ||
} | ||
function Tt() { | ||
if (this.$$.ptr || Ye(this), this.$$.preservePointerOnDelete) | ||
return this.$$.count.value += 1, this; | ||
var e = ce(Object.create(Object.getPrototypeOf(this), { $$: { value: ht(this.$$) } })); | ||
return e.$$.count.value += 1, e.$$.deleteScheduled = !1, e; | ||
} | ||
function $t() { | ||
this.$$.ptr || Ye(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && g("Object already scheduled for deletion"), dr(this), pr(this.$$), this.$$.preservePointerOnDelete || (this.$$.smartPtr = void 0, this.$$.ptr = void 0); | ||
} | ||
function At() { | ||
return !this.$$.ptr; | ||
} | ||
function Ft() { | ||
return this.$$.ptr || Ye(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && g("Object already scheduled for deletion"), se.push(this), se.length === 1 && ue && ue(Be), this.$$.deleteScheduled = !0, this; | ||
} | ||
function Et() { | ||
B.prototype.isAliasOf = pt, B.prototype.clone = Tt, B.prototype.delete = $t, B.prototype.isDeleted = At, B.prototype.deleteLater = Ft; | ||
} | ||
function B() { | ||
} | ||
function gr(e, r, t) { | ||
if (e[r].overloadTable === void 0) { | ||
var n = e[r]; | ||
e[r] = function() { | ||
return e[r].overloadTable.hasOwnProperty(arguments.length) || g("Function '" + t + "' called with an invalid number of arguments (" + arguments.length + ") - expects one of (" + e[r].overloadTable + ")!"), e[r].overloadTable[arguments.length].apply(this, arguments); | ||
}, e[r].overloadTable = [], e[r].overloadTable[n.argCount] = n; | ||
} | ||
} | ||
function yr(e, r, t) { | ||
u.hasOwnProperty(e) ? ((t === void 0 || u[e].overloadTable !== void 0 && u[e].overloadTable[t] !== void 0) && g("Cannot register public name '" + e + "' twice"), gr(u, e, e), u.hasOwnProperty(t) && g("Cannot register multiple overloads of a function with the same number of arguments (" + t + ")!"), u[e].overloadTable[t] = r) : (u[e] = r, t !== void 0 && (u[e].numArguments = t)); | ||
} | ||
function St(e, r, t, n, i, a, s, o) { | ||
this.name = e, this.constructor = r, this.instancePrototype = t, this.rawDestructor = n, this.baseClass = i, this.getActualType = a, this.upcast = s, this.downcast = o, this.pureVirtualFunctions = []; | ||
} | ||
function Ae(e, r, t) { | ||
for (; r !== t; ) | ||
r.upcast || g("Expected null or instance of " + t.name + ", got an instance of " + r.name), e = r.upcast(e), r = r.baseClass; | ||
return e; | ||
} | ||
function Rt(e, r) { | ||
if (r === null) | ||
return this.isReference && g("null is not a valid " + this.name), 0; | ||
r.$$ || g('Cannot pass "' + Xe(r) + '" as a ' + this.name), r.$$.ptr || g("Cannot pass deleted object as a pointer of type " + this.name); | ||
var t = r.$$.ptrType.registeredClass, n = Ae(r.$$.ptr, t, this.registeredClass); | ||
return n; | ||
} | ||
function kt(e, r) { | ||
var t; | ||
if (r === null) | ||
return this.isReference && g("null is not a valid " + this.name), this.isSmartPointer ? (t = this.rawConstructor(), e !== null && e.push(this.rawDestructor, t), t) : 0; | ||
r.$$ || g('Cannot pass "' + Xe(r) + '" as a ' + this.name), r.$$.ptr || g("Cannot pass deleted object as a pointer of type " + this.name), !this.isConst && r.$$.ptrType.isConst && g("Cannot convert argument of type " + (r.$$.smartPtrType ? r.$$.smartPtrType.name : r.$$.ptrType.name) + " to parameter type " + this.name); | ||
var n = r.$$.ptrType.registeredClass; | ||
if (t = Ae(r.$$.ptr, n, this.registeredClass), this.isSmartPointer) | ||
switch (r.$$.smartPtr === void 0 && g("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) { | ||
case 0: | ||
r.$$.smartPtrType === this ? t = r.$$.smartPtr : g("Cannot convert argument of type " + (r.$$.smartPtrType ? r.$$.smartPtrType.name : r.$$.ptrType.name) + " to parameter type " + this.name); | ||
break; | ||
case 1: | ||
t = r.$$.smartPtr; | ||
break; | ||
case 2: | ||
if (r.$$.smartPtrType === this) | ||
t = r.$$.smartPtr; | ||
else { | ||
var i = r.clone(); | ||
t = this.rawShare(t, Fe.toHandle(function() { | ||
i.delete(); | ||
})), e !== null && e.push(this.rawDestructor, t); | ||
} | ||
break; | ||
default: | ||
g("Unsupporting sharing policy"); | ||
} | ||
return t; | ||
} | ||
function Dt(e, r) { | ||
if (r === null) | ||
return this.isReference && g("null is not a valid " + this.name), 0; | ||
r.$$ || g('Cannot pass "' + Xe(r) + '" as a ' + this.name), r.$$.ptr || g("Cannot pass deleted object as a pointer of type " + this.name), r.$$.ptrType.isConst && g("Cannot convert argument of type " + r.$$.ptrType.name + " to parameter type " + this.name); | ||
var t = r.$$.ptrType.registeredClass, n = Ae(r.$$.ptr, t, this.registeredClass); | ||
return n; | ||
} | ||
function Ot(e) { | ||
return this.rawGetPointee && (e = this.rawGetPointee(e)), e; | ||
} | ||
function Wt(e) { | ||
this.rawDestructor && this.rawDestructor(e); | ||
} | ||
function jt(e) { | ||
e !== null && e.delete(); | ||
} | ||
function Ut() { | ||
x.prototype.getPointee = Ot, x.prototype.destructor = Wt, x.prototype.argPackAdvance = 8, x.prototype.readValueFromPointer = oe, x.prototype.deleteObject = jt, x.prototype.fromWireType = Ct; | ||
} | ||
function x(e, r, t, n, i, a, s, o, f, c, v) { | ||
this.name = e, this.registeredClass = r, this.isReference = t, this.isConst = n, this.isSmartPointer = i, this.pointeeType = a, this.sharingPolicy = s, this.rawGetPointee = o, this.rawConstructor = f, this.rawShare = c, this.rawDestructor = v, !i && r.baseClass === void 0 ? n ? (this.toWireType = Rt, this.destructorFunction = null) : (this.toWireType = Dt, this.destructorFunction = null) : this.toWireType = kt; | ||
} | ||
function mr(e, r, t) { | ||
u.hasOwnProperty(e) || Te("Replacing nonexistant public symbol"), u[e].overloadTable !== void 0 && t !== void 0 ? u[e].overloadTable[t] = r : (u[e] = r, u[e].argCount = t); | ||
} | ||
function Ht(e, r, t) { | ||
var n = u["dynCall_" + e]; | ||
return t && t.length ? n.apply(null, [r].concat(t)) : n.call(null, r); | ||
} | ||
function Mt(e, r, t) { | ||
if (e.includes("j")) | ||
return Ht(e, r, t); | ||
var n = m(r).apply(null, t); | ||
return n; | ||
} | ||
function It(e, r) { | ||
var t = []; | ||
return function() { | ||
return t.length = 0, Object.assign(t, arguments), Mt(e, r, t); | ||
}; | ||
} | ||
function D(e, r) { | ||
e = S(e); | ||
function t() { | ||
return e.includes("j") ? It(e, r) : m(r); | ||
} | ||
var n = t(); | ||
return typeof n != "function" && g("unknown function pointer with signature " + e + ": " + r), n; | ||
} | ||
var wr = void 0; | ||
function br(e) { | ||
var r = Er(e), t = S(r); | ||
return Y(r), t; | ||
} | ||
function te(e, r) { | ||
var t = [], n = {}; | ||
function i(a) { | ||
if (!n[a] && !X[a]) { | ||
if (Ce[a]) { | ||
Ce[a].forEach(i); | ||
return; | ||
} | ||
t.push(a), n[a] = !0; | ||
} | ||
} | ||
throw r.forEach(i), new wr(e + ": " + t.map(br).join([", "])); | ||
} | ||
function xt(e, r, t, n, i, a, s, o, f, c, v, d, h) { | ||
v = S(v), a = D(i, a), o && (o = D(s, o)), c && (c = D(f, c)), h = D(d, h); | ||
var _ = He(v); | ||
yr(_, function() { | ||
te("Cannot construct " + v + " due to unbound types", [n]); | ||
}), M([e, r, t], n ? [n] : [], function(P) { | ||
P = P[0]; | ||
var A, $; | ||
n ? (A = P.registeredClass, $ = A.instancePrototype) : $ = B.prototype; | ||
var C = Me(_, function() { | ||
if (Object.getPrototypeOf(this) !== l) | ||
throw new re("Use 'new' to construct " + v); | ||
if (p.constructor_body === void 0) | ||
throw new re(v + " has no accessible constructor"); | ||
var Re = p.constructor_body[arguments.length]; | ||
if (Re === void 0) | ||
throw new re("Tried to invoke ctor of " + v + " with invalid number of parameters (" + arguments.length + ") - expected (" + Object.keys(p.constructor_body).toString() + ") parameters instead!"); | ||
return Re.apply(this, arguments); | ||
}), l = Object.create($, { constructor: { value: C } }); | ||
C.prototype = l; | ||
var p = new St(v, C, l, h, A, a, o, c), R = new x(v, p, !0, !1, !1), E = new x(v + "*", p, !1, !1, !1), Z = new x(v + " const*", p, !1, !0, !1); | ||
return _r[e] = { pointerType: E, constPointerType: Z }, mr(_, C), [R, E, Z]; | ||
}); | ||
} | ||
function Le(e, r) { | ||
for (var t = [], n = 0; n < e; n++) | ||
t.push(F[r + n * 4 >> 2]); | ||
return t; | ||
} | ||
function Yt(e, r) { | ||
if (!(e instanceof Function)) | ||
throw new TypeError("new_ called with constructor type " + typeof e + " which is not a function"); | ||
var t = Me(e.name || "unknownFunctionName", function() { | ||
}); | ||
t.prototype = e.prototype; | ||
var n = new t(), i = e.apply(n, r); | ||
return i instanceof Object ? i : n; | ||
} | ||
function Ne(e, r, t, n, i, a) { | ||
var s = r.length; | ||
s < 2 && g("argTypes array size mismatch! Must at least get return value and 'this' types!"); | ||
for (var o = r[1] !== null && t !== null, f = !1, c = 1; c < r.length; ++c) | ||
if (r[c] !== null && r[c].destructorFunction === void 0) { | ||
f = !0; | ||
break; | ||
} | ||
for (var v = r[0].name !== "void", d = "", h = "", c = 0; c < s - 2; ++c) | ||
d += (c !== 0 ? ", " : "") + "arg" + c, h += (c !== 0 ? ", " : "") + "arg" + c + "Wired"; | ||
var _ = "return function " + He(e) + "(" + d + `) { | ||
if (arguments.length !== ` + (s - 2) + `) { | ||
throwBindingError('function ` + e + " called with ' + arguments.length + ' arguments, expected " + (s - 2) + ` args!'); | ||
} | ||
async function B(r, { | ||
tryHarder: o = e.tryHarder, | ||
formats: t = e.formats, | ||
maxNumberOfSymbols: m = e.maxNumberOfSymbols | ||
} = e) { | ||
return s( | ||
r, | ||
`; | ||
f && (_ += `var destructors = []; | ||
`); | ||
var P = f ? "destructors" : "null", A = ["throwBindingError", "invoker", "fn", "runDestructors", "retType", "classParam"], $ = [g, n, i, Ue, r[0], r[1]]; | ||
o && (_ += "var thisWired = classParam.toWireType(" + P + `, this); | ||
`); | ||
for (var c = 0; c < s - 2; ++c) | ||
_ += "var arg" + c + "Wired = argType" + c + ".toWireType(" + P + ", arg" + c + "); // " + r[c + 2].name + ` | ||
`, A.push("argType" + c), $.push(r[c + 2]); | ||
if (o && (h = "thisWired" + (h.length > 0 ? ", " : "") + h), _ += (v || a ? "var rv = " : "") + "invoker(fn" + (h.length > 0 ? ", " : "") + h + `); | ||
`, f) | ||
_ += `runDestructors(destructors); | ||
`; | ||
else | ||
for (var c = o ? 1 : 2; c < r.length; ++c) { | ||
var C = c === 1 ? "thisWired" : "arg" + (c - 2) + "Wired"; | ||
r[c].destructorFunction !== null && (_ += C + "_dtor(" + C + "); // " + r[c].name + ` | ||
`, A.push(C + "_dtor"), $.push(r[c].destructorFunction)); | ||
} | ||
v && (_ += `var ret = retType.fromWireType(rv); | ||
return ret; | ||
`), _ += `} | ||
`, A.push(_); | ||
var l = Yt(Function, A).apply(null, $); | ||
return l; | ||
} | ||
function Vt(e, r, t, n, i, a) { | ||
jr(r > 0); | ||
var s = Le(r, t); | ||
i = D(n, i), M([], [e], function(o) { | ||
o = o[0]; | ||
var f = "constructor " + o.name; | ||
if (o.registeredClass.constructor_body === void 0 && (o.registeredClass.constructor_body = []), o.registeredClass.constructor_body[r - 1] !== void 0) | ||
throw new re("Cannot register multiple constructors with identical number of parameters (" + (r - 1) + ") for class '" + o.name + "'! Overload resolution is currently only performed using the parameter count, not actual type info!"); | ||
return o.registeredClass.constructor_body[r - 1] = () => { | ||
te("Cannot construct " + o.name + " due to unbound types", s); | ||
}, M([], s, function(c) { | ||
return c.splice(1, 0, null), o.registeredClass.constructor_body[r - 1] = Ne(f, c, null, i, a), []; | ||
}), []; | ||
}); | ||
} | ||
function Bt(e, r, t, n, i, a, s, o, f) { | ||
var c = Le(t, n); | ||
r = S(r), a = D(i, a), M([], [e], function(v) { | ||
v = v[0]; | ||
var d = v.name + "." + r; | ||
r.startsWith("@@") && (r = Symbol[r.substring(2)]), o && v.registeredClass.pureVirtualFunctions.push(r); | ||
function h() { | ||
te("Cannot call " + d + " due to unbound types", c); | ||
} | ||
var _ = v.registeredClass.instancePrototype, P = _[r]; | ||
return P === void 0 || P.overloadTable === void 0 && P.className !== v.name && P.argCount === t - 2 ? (h.argCount = t - 2, h.className = v.name, _[r] = h) : (gr(_, r, d), _[r].overloadTable[t - 2] = h), M([], c, function(A) { | ||
var $ = Ne(d, A, v, a, s, f); | ||
return _[r].overloadTable === void 0 ? ($.argCount = t - 2, _[r] = $) : _[r].overloadTable[t - 2] = $, []; | ||
}), []; | ||
}); | ||
} | ||
function Pr(e, r, t) { | ||
return e instanceof Object || g(t + ' with invalid "this": ' + e), e instanceof r.registeredClass.constructor || g(t + ' incompatible with "this" of type ' + e.constructor.name), e.$$.ptr || g("cannot call emscripten binding method " + t + " on deleted object"), Ae(e.$$.ptr, e.$$.ptrType.registeredClass, r.registeredClass); | ||
} | ||
function Lt(e, r, t, n, i, a, s, o, f, c) { | ||
r = S(r), i = D(n, i), M([], [e], function(v) { | ||
v = v[0]; | ||
var d = v.name + "." + r, h = { get: function() { | ||
te("Cannot access " + d + " due to unbound types", [t, s]); | ||
}, enumerable: !0, configurable: !0 }; | ||
return f ? h.set = () => { | ||
te("Cannot access " + d + " due to unbound types", [t, s]); | ||
} : h.set = (_) => { | ||
g(d + " is a read-only property"); | ||
}, Object.defineProperty(v.registeredClass.instancePrototype, r, h), M([], f ? [t, s] : [t], function(_) { | ||
var P = _[0], A = { get: function() { | ||
var C = Pr(this, v, d + " getter"); | ||
return P.fromWireType(i(a, C)); | ||
}, enumerable: !0 }; | ||
if (f) { | ||
f = D(o, f); | ||
var $ = _[1]; | ||
A.set = function(C) { | ||
var l = Pr(this, v, d + " setter"), p = []; | ||
f(c, l, $.toWireType(p, C)), Ue(p); | ||
}; | ||
} | ||
return Object.defineProperty(v.registeredClass.instancePrototype, r, A), []; | ||
}), []; | ||
}); | ||
} | ||
var ze = [], O = [{}, { value: void 0 }, { value: null }, { value: !0 }, { value: !1 }]; | ||
function Cr(e) { | ||
e > 4 && --O[e].refcount === 0 && (O[e] = void 0, ze.push(e)); | ||
} | ||
function Nt() { | ||
for (var e = 0, r = 5; r < O.length; ++r) | ||
O[r] !== void 0 && ++e; | ||
return e; | ||
} | ||
function zt() { | ||
for (var e = 5; e < O.length; ++e) | ||
if (O[e] !== void 0) | ||
return O[e]; | ||
return null; | ||
} | ||
function Xt() { | ||
u.count_emval_handles = Nt, u.get_first_emval = zt; | ||
} | ||
var Fe = { toValue: (e) => (e || g("Cannot use deleted val. handle = " + e), O[e].value), toHandle: (e) => { | ||
switch (e) { | ||
case void 0: | ||
return 1; | ||
case null: | ||
return 2; | ||
case !0: | ||
return 3; | ||
case !1: | ||
return 4; | ||
default: { | ||
var r = ze.length ? ze.pop() : O.length; | ||
return O[r] = { refcount: 1, value: e }, r; | ||
} | ||
} | ||
} }; | ||
function Zt(e, r) { | ||
r = S(r), I(e, { name: r, fromWireType: function(t) { | ||
var n = Fe.toValue(t); | ||
return Cr(t), n; | ||
}, toWireType: function(t, n) { | ||
return Fe.toHandle(n); | ||
}, argPackAdvance: 8, readValueFromPointer: oe, destructorFunction: null }); | ||
} | ||
function Xe(e) { | ||
if (e === null) | ||
return "null"; | ||
var r = typeof e; | ||
return r === "object" || r === "array" || r === "function" ? e.toString() : "" + e; | ||
} | ||
function Gt(e, r) { | ||
switch (r) { | ||
case 2: | ||
return function(t) { | ||
return this.fromWireType(rr[t >> 2]); | ||
}; | ||
case 3: | ||
return function(t) { | ||
return this.fromWireType(tr[t >> 3]); | ||
}; | ||
default: | ||
throw new TypeError("Unknown float type: " + e); | ||
} | ||
} | ||
function qt(e, r, t) { | ||
var n = xe(t); | ||
r = S(r), I(e, { name: r, fromWireType: function(i) { | ||
return i; | ||
}, toWireType: function(i, a) { | ||
return a; | ||
}, argPackAdvance: 8, readValueFromPointer: Gt(r, n), destructorFunction: null }); | ||
} | ||
function Jt(e, r, t, n, i, a, s) { | ||
var o = Le(r, t); | ||
e = S(e), i = D(n, i), yr(e, function() { | ||
te("Cannot call " + e + " due to unbound types", o); | ||
}, r - 1), M([], o, function(f) { | ||
var c = [f[0], null].concat(f.slice(1)); | ||
return mr(e, Ne(e, c, null, i, a, s), r - 1), []; | ||
}); | ||
} | ||
function Kt(e, r, t) { | ||
switch (r) { | ||
case 0: | ||
return t ? function(i) { | ||
return U[i]; | ||
} : function(i) { | ||
return k[i]; | ||
}; | ||
case 1: | ||
return t ? function(i) { | ||
return J[i >> 1]; | ||
} : function(i) { | ||
return ge[i >> 1]; | ||
}; | ||
case 2: | ||
return t ? function(i) { | ||
return T[i >> 2]; | ||
} : function(i) { | ||
return F[i >> 2]; | ||
}; | ||
default: | ||
throw new TypeError("Unknown integer type: " + e); | ||
} | ||
} | ||
function Qt(e, r, t, n, i) { | ||
r = S(r); | ||
var a = xe(t), s = (d) => d; | ||
if (n === 0) { | ||
var o = 32 - 8 * t; | ||
s = (d) => d << o >>> o; | ||
} | ||
var f = r.includes("unsigned"), c = (d, h) => { | ||
}, v; | ||
f ? v = function(d, h) { | ||
return c(h, this.name), h >>> 0; | ||
} : v = function(d, h) { | ||
return c(h, this.name), h; | ||
}, I(e, { name: r, fromWireType: s, toWireType: v, argPackAdvance: 8, readValueFromPointer: Kt(r, a, n !== 0), destructorFunction: null }); | ||
} | ||
function en(e, r, t) { | ||
var n = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], i = n[r]; | ||
function a(s) { | ||
s = s >> 2; | ||
var o = F, f = o[s], c = o[s + 1]; | ||
return new i(o.buffer, c, f); | ||
} | ||
t = S(t), I(e, { name: t, fromWireType: a, argPackAdvance: 8, readValueFromPointer: a }, { ignoreDuplicateRegistrations: !0 }); | ||
} | ||
function rn(e, r) { | ||
r = S(r); | ||
var t = r === "std::string"; | ||
I(e, { name: r, fromWireType: function(n) { | ||
var i = F[n >> 2], a = n + 4, s; | ||
if (t) | ||
for (var o = a, f = 0; f <= i; ++f) { | ||
var c = a + f; | ||
if (f == i || k[c] == 0) { | ||
var v = c - o, d = Oe(o, v); | ||
s === void 0 ? s = d : (s += String.fromCharCode(0), s += d), o = c + 1; | ||
} | ||
} | ||
else { | ||
for (var h = new Array(i), f = 0; f < i; ++f) | ||
h[f] = String.fromCharCode(k[a + f]); | ||
s = h.join(""); | ||
} | ||
return Y(n), s; | ||
}, toWireType: function(n, i) { | ||
i instanceof ArrayBuffer && (i = new Uint8Array(i)); | ||
var a, s = typeof i == "string"; | ||
s || i instanceof Uint8Array || i instanceof Uint8ClampedArray || i instanceof Int8Array || g("Cannot pass non-string to std::string"), t && s ? a = er(i) : a = i.length; | ||
var o = Ge(4 + a + 1), f = o + 4; | ||
if (F[o >> 2] = a, t && s) | ||
Hr(i, f, a + 1); | ||
else if (s) | ||
for (var c = 0; c < a; ++c) { | ||
var v = i.charCodeAt(c); | ||
v > 255 && (Y(f), g("String has UTF-16 code units that do not fit in 8 bits")), k[f + c] = v; | ||
} | ||
else | ||
for (var c = 0; c < a; ++c) | ||
k[f + c] = i[c]; | ||
return n !== null && n.push(Y, o), o; | ||
}, argPackAdvance: 8, readValueFromPointer: oe, destructorFunction: function(n) { | ||
Y(n); | ||
} }); | ||
} | ||
var Tr = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0; | ||
function tn(e, r) { | ||
for (var t = e, n = t >> 1, i = n + r / 2; !(n >= i) && ge[n]; ) | ||
++n; | ||
if (t = n << 1, t - e > 32 && Tr) | ||
return Tr.decode(k.subarray(e, t)); | ||
for (var a = "", s = 0; !(s >= r / 2); ++s) { | ||
var o = J[e + s * 2 >> 1]; | ||
if (o == 0) | ||
break; | ||
a += String.fromCharCode(o); | ||
} | ||
return a; | ||
} | ||
function nn(e, r, t) { | ||
if (t === void 0 && (t = 2147483647), t < 2) | ||
return 0; | ||
t -= 2; | ||
for (var n = r, i = t < e.length * 2 ? t / 2 : e.length, a = 0; a < i; ++a) { | ||
var s = e.charCodeAt(a); | ||
J[r >> 1] = s, r += 2; | ||
} | ||
return J[r >> 1] = 0, r - n; | ||
} | ||
function an(e) { | ||
return e.length * 2; | ||
} | ||
function on(e, r) { | ||
for (var t = 0, n = ""; !(t >= r / 4); ) { | ||
var i = T[e + t * 4 >> 2]; | ||
if (i == 0) | ||
break; | ||
if (++t, i >= 65536) { | ||
var a = i - 65536; | ||
n += String.fromCharCode(55296 | a >> 10, 56320 | a & 1023); | ||
} else | ||
n += String.fromCharCode(i); | ||
} | ||
return n; | ||
} | ||
function sn(e, r, t) { | ||
if (t === void 0 && (t = 2147483647), t < 4) | ||
return 0; | ||
for (var n = r, i = n + t - 4, a = 0; a < e.length; ++a) { | ||
var s = e.charCodeAt(a); | ||
if (s >= 55296 && s <= 57343) { | ||
var o = e.charCodeAt(++a); | ||
s = 65536 + ((s & 1023) << 10) | o & 1023; | ||
} | ||
if (T[r >> 2] = s, r += 4, r + 4 > i) | ||
break; | ||
} | ||
return T[r >> 2] = 0, r - n; | ||
} | ||
function un(e) { | ||
for (var r = 0, t = 0; t < e.length; ++t) { | ||
var n = e.charCodeAt(t); | ||
n >= 55296 && n <= 57343 && ++t, r += 4; | ||
} | ||
return r; | ||
} | ||
function fn(e, r, t) { | ||
t = S(t); | ||
var n, i, a, s, o; | ||
r === 2 ? (n = tn, i = nn, s = an, a = () => ge, o = 1) : r === 4 && (n = on, i = sn, s = un, a = () => F, o = 2), I(e, { name: t, fromWireType: function(f) { | ||
for (var c = F[f >> 2], v = a(), d, h = f + 4, _ = 0; _ <= c; ++_) { | ||
var P = f + 4 + _ * r; | ||
if (_ == c || v[P >> o] == 0) { | ||
var A = P - h, $ = n(h, A); | ||
d === void 0 ? d = $ : (d += String.fromCharCode(0), d += $), h = P + r; | ||
} | ||
} | ||
return Y(f), d; | ||
}, toWireType: function(f, c) { | ||
typeof c != "string" && g("Cannot pass non-string to C++ string type " + t); | ||
var v = s(c), d = Ge(4 + v + r); | ||
return F[d >> 2] = v >> o, i(c, d + 4, v + r), f !== null && f.push(Y, d), d; | ||
}, argPackAdvance: 8, readValueFromPointer: oe, destructorFunction: function(f) { | ||
Y(f); | ||
} }); | ||
} | ||
function cn(e, r, t, n, i, a) { | ||
Pe[e] = { name: S(r), rawConstructor: D(t, n), rawDestructor: D(i, a), fields: [] }; | ||
} | ||
function ln(e, r, t, n, i, a, s, o, f, c) { | ||
Pe[e].fields.push({ fieldName: S(r), getterReturnType: t, getter: D(n, i), getterContext: a, setterArgumentType: s, setter: D(o, f), setterContext: c }); | ||
} | ||
function vn(e, r) { | ||
r = S(r), I(e, { isVoid: !0, name: r, argPackAdvance: 0, fromWireType: function() { | ||
}, toWireType: function(t, n) { | ||
} }); | ||
} | ||
function dn(e) { | ||
e > 4 && (O[e].refcount += 1); | ||
} | ||
function pn(e, r) { | ||
var t = X[e]; | ||
return t === void 0 && g(r + " has unknown type " + br(e)), t; | ||
} | ||
function hn(e, r) { | ||
e = pn(e, "_emval_take_value"); | ||
var t = e.readValueFromPointer(r); | ||
return Fe.toHandle(t); | ||
} | ||
function _n() { | ||
K(""); | ||
} | ||
function gn(e, r, t) { | ||
k.copyWithin(e, r, r + t); | ||
} | ||
function yn() { | ||
return 2147483648; | ||
} | ||
function mn(e) { | ||
var r = _e.buffer; | ||
try { | ||
return _e.grow(e - r.byteLength + 65535 >>> 16), nr(), 1; | ||
} catch { | ||
} | ||
} | ||
function wn(e) { | ||
var r = k.length; | ||
e = e >>> 0; | ||
var t = yn(); | ||
if (e > t) | ||
return !1; | ||
let n = (f, c) => f + (c - f % c) % c; | ||
for (var i = 1; i <= 4; i *= 2) { | ||
var a = r * (1 + 0.2 / i); | ||
a = Math.min(a, e + 100663296); | ||
var s = Math.min(t, n(Math.max(e, a), 65536)), o = mn(s); | ||
if (o) | ||
return !0; | ||
} | ||
return !1; | ||
} | ||
var Ze = {}; | ||
function bn() { | ||
return pe || "./this.program"; | ||
} | ||
function le() { | ||
if (!le.strings) { | ||
var e = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", r = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: e, _: bn() }; | ||
for (var t in Ze) | ||
Ze[t] === void 0 ? delete r[t] : r[t] = Ze[t]; | ||
var n = []; | ||
for (var t in r) | ||
n.push(t + "=" + r[t]); | ||
le.strings = n; | ||
} | ||
return le.strings; | ||
} | ||
function Pn(e, r, t) { | ||
for (var n = 0; n < e.length; ++n) | ||
U[r++ >> 0] = e.charCodeAt(n); | ||
t || (U[r >> 0] = 0); | ||
} | ||
function Cn(e, r) { | ||
var t = 0; | ||
return le().forEach(function(n, i) { | ||
var a = r + t; | ||
F[e + i * 4 >> 2] = a, Pn(n, a), t += n.length + 1; | ||
}), 0; | ||
} | ||
function Tn(e, r) { | ||
var t = le(); | ||
F[e >> 2] = t.length; | ||
var n = 0; | ||
return t.forEach(function(i) { | ||
n += i.length + 1; | ||
}), F[r >> 2] = n, 0; | ||
} | ||
function $n(e) { | ||
return e; | ||
} | ||
function Ee(e) { | ||
return e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0); | ||
} | ||
function An(e, r) { | ||
for (var t = 0, n = 0; n <= r; t += e[n++]) | ||
; | ||
return t; | ||
} | ||
var $r = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Ar = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; | ||
function Fn(e, r) { | ||
for (var t = new Date(e.getTime()); r > 0; ) { | ||
var n = Ee(t.getFullYear()), i = t.getMonth(), a = (n ? $r : Ar)[i]; | ||
if (r > a - t.getDate()) | ||
r -= a - t.getDate() + 1, t.setDate(1), i < 11 ? t.setMonth(i + 1) : (t.setMonth(0), t.setFullYear(t.getFullYear() + 1)); | ||
else | ||
return t.setDate(t.getDate() + r), t; | ||
} | ||
return t; | ||
} | ||
function En(e, r, t) { | ||
var n = t > 0 ? t : er(e) + 1, i = new Array(n), a = Qe(e, i, 0, i.length); | ||
return r && (i.length = a), i; | ||
} | ||
function Sn(e, r) { | ||
U.set(e, r); | ||
} | ||
function Rn(e, r, t, n) { | ||
var i = T[n + 40 >> 2], a = { tm_sec: T[n >> 2], tm_min: T[n + 4 >> 2], tm_hour: T[n + 8 >> 2], tm_mday: T[n + 12 >> 2], tm_mon: T[n + 16 >> 2], tm_year: T[n + 20 >> 2], tm_wday: T[n + 24 >> 2], tm_yday: T[n + 28 >> 2], tm_isdst: T[n + 32 >> 2], tm_gmtoff: T[n + 36 >> 2], tm_zone: i ? Oe(i) : "" }, s = Oe(t), o = { "%c": "%a %b %d %H:%M:%S %Y", "%D": "%m/%d/%y", "%F": "%Y-%m-%d", "%h": "%b", "%r": "%I:%M:%S %p", "%R": "%H:%M", "%T": "%H:%M:%S", "%x": "%m/%d/%y", "%X": "%H:%M:%S", "%Ec": "%c", "%EC": "%C", "%Ex": "%m/%d/%y", "%EX": "%H:%M:%S", "%Ey": "%y", "%EY": "%Y", "%Od": "%d", "%Oe": "%e", "%OH": "%H", "%OI": "%I", "%Om": "%m", "%OM": "%M", "%OS": "%S", "%Ou": "%u", "%OU": "%U", "%OV": "%V", "%Ow": "%w", "%OW": "%W", "%Oy": "%y" }; | ||
for (var f in o) | ||
s = s.replace(new RegExp(f, "g"), o[f]); | ||
var c = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], v = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; | ||
function d(l, p, R) { | ||
for (var E = typeof l == "number" ? l.toString() : l || ""; E.length < p; ) | ||
E = R[0] + E; | ||
return E; | ||
} | ||
function h(l, p) { | ||
return d(l, p, "0"); | ||
} | ||
function _(l, p) { | ||
function R(Z) { | ||
return Z < 0 ? -1 : Z > 0 ? 1 : 0; | ||
} | ||
var E; | ||
return (E = R(l.getFullYear() - p.getFullYear())) === 0 && (E = R(l.getMonth() - p.getMonth())) === 0 && (E = R(l.getDate() - p.getDate())), E; | ||
} | ||
function P(l) { | ||
switch (l.getDay()) { | ||
case 0: | ||
return new Date(l.getFullYear() - 1, 11, 29); | ||
case 1: | ||
return l; | ||
case 2: | ||
return new Date(l.getFullYear(), 0, 3); | ||
case 3: | ||
return new Date(l.getFullYear(), 0, 2); | ||
case 4: | ||
return new Date(l.getFullYear(), 0, 1); | ||
case 5: | ||
return new Date(l.getFullYear() - 1, 11, 31); | ||
case 6: | ||
return new Date(l.getFullYear() - 1, 11, 30); | ||
} | ||
} | ||
function A(l) { | ||
var p = Fn(new Date(l.tm_year + 1900, 0, 1), l.tm_yday), R = new Date(p.getFullYear(), 0, 4), E = new Date(p.getFullYear() + 1, 0, 4), Z = P(R), Re = P(E); | ||
return _(Z, p) <= 0 ? _(Re, p) <= 0 ? p.getFullYear() + 1 : p.getFullYear() : p.getFullYear() - 1; | ||
} | ||
var $ = { "%a": function(l) { | ||
return c[l.tm_wday].substring(0, 3); | ||
}, "%A": function(l) { | ||
return c[l.tm_wday]; | ||
}, "%b": function(l) { | ||
return v[l.tm_mon].substring(0, 3); | ||
}, "%B": function(l) { | ||
return v[l.tm_mon]; | ||
}, "%C": function(l) { | ||
var p = l.tm_year + 1900; | ||
return h(p / 100 | 0, 2); | ||
}, "%d": function(l) { | ||
return h(l.tm_mday, 2); | ||
}, "%e": function(l) { | ||
return d(l.tm_mday, 2, " "); | ||
}, "%g": function(l) { | ||
return A(l).toString().substring(2); | ||
}, "%G": function(l) { | ||
return A(l); | ||
}, "%H": function(l) { | ||
return h(l.tm_hour, 2); | ||
}, "%I": function(l) { | ||
var p = l.tm_hour; | ||
return p == 0 ? p = 12 : p > 12 && (p -= 12), h(p, 2); | ||
}, "%j": function(l) { | ||
return h(l.tm_mday + An(Ee(l.tm_year + 1900) ? $r : Ar, l.tm_mon - 1), 3); | ||
}, "%m": function(l) { | ||
return h(l.tm_mon + 1, 2); | ||
}, "%M": function(l) { | ||
return h(l.tm_min, 2); | ||
}, "%n": function() { | ||
return ` | ||
`; | ||
}, "%p": function(l) { | ||
return l.tm_hour >= 0 && l.tm_hour < 12 ? "AM" : "PM"; | ||
}, "%S": function(l) { | ||
return h(l.tm_sec, 2); | ||
}, "%t": function() { | ||
return " "; | ||
}, "%u": function(l) { | ||
return l.tm_wday || 7; | ||
}, "%U": function(l) { | ||
var p = l.tm_yday + 7 - l.tm_wday; | ||
return h(Math.floor(p / 7), 2); | ||
}, "%V": function(l) { | ||
var p = Math.floor((l.tm_yday + 7 - (l.tm_wday + 6) % 7) / 7); | ||
if ((l.tm_wday + 371 - l.tm_yday - 2) % 7 <= 2 && p++, p) { | ||
if (p == 53) { | ||
var E = (l.tm_wday + 371 - l.tm_yday) % 7; | ||
E != 4 && (E != 3 || !Ee(l.tm_year)) && (p = 1); | ||
} | ||
} else { | ||
p = 52; | ||
var R = (l.tm_wday + 7 - l.tm_yday - 1) % 7; | ||
(R == 4 || R == 5 && Ee(l.tm_year % 400 - 1)) && p++; | ||
} | ||
return h(p, 2); | ||
}, "%w": function(l) { | ||
return l.tm_wday; | ||
}, "%W": function(l) { | ||
var p = l.tm_yday + 7 - (l.tm_wday + 6) % 7; | ||
return h(Math.floor(p / 7), 2); | ||
}, "%y": function(l) { | ||
return (l.tm_year + 1900).toString().substring(2); | ||
}, "%Y": function(l) { | ||
return l.tm_year + 1900; | ||
}, "%z": function(l) { | ||
var p = l.tm_gmtoff, R = p >= 0; | ||
return p = Math.abs(p) / 60, p = p / 60 * 100 + p % 60, (R ? "+" : "-") + ("0000" + p).slice(-4); | ||
}, "%Z": function(l) { | ||
return l.tm_zone; | ||
}, "%%": function() { | ||
return "%"; | ||
} }; | ||
s = s.replace(/%%/g, "\0\0"); | ||
for (var f in $) | ||
s.includes(f) && (s = s.replace(new RegExp(f, "g"), $[f](a))); | ||
s = s.replace(/\0\0/g, "%"); | ||
var C = En(s, !1); | ||
return C.length > r ? 0 : (Sn(C, e), C.length - 1); | ||
} | ||
function kn(e, r, t, n, i) { | ||
return Rn(e, r, t, n); | ||
} | ||
lr = u.InternalError = Ie(Error, "InternalError"), vt(), re = u.BindingError = Ie(Error, "BindingError"), Et(), wt(), Ut(), wr = u.UnboundTypeError = Ie(Error, "UnboundTypeError"), Xt(); | ||
var Dn = { r: Jr, u: Qr, a: rt, i: tt, n: nt, I: it, U: at, o: ot, ba: st, d: et, ma: ct, Y: lt, fa: dt, W: xt, la: Vt, D: Bt, T: Lt, ea: Zt, R: qt, N: Jt, x: Qt, s: en, Q: rn, K: fn, O: cn, na: ln, ga: vn, ja: Cr, ka: dn, V: hn, J: _n, da: gn, ca: wn, $: Cn, aa: Tn, H: Jn, P: ai, B: Kn, q: Gn, b: On, C: qn, ha: ei, c: Hn, h: Nn, j: Xn, l: zn, w: Zn, G: ti, M: ni, A: Qn, F: oi, Z: ui, X: fi, k: Mn, g: Un, e: jn, f: Wn, L: ii, m: In, p: xn, ia: Vn, t: Bn, S: Ln, z: ri, v: Yn, E: si, y: $n, _: kn }; | ||
Gr(); | ||
var Y = u._free = function() { | ||
return (Y = u._free = u.asm.qa).apply(null, arguments); | ||
}, Ge = u._malloc = function() { | ||
return (Ge = u._malloc = u.asm.ra).apply(null, arguments); | ||
}, Fr = function() { | ||
return (Fr = u.asm.sa).apply(null, arguments); | ||
}, Er = u.___getTypeName = function() { | ||
return (Er = u.___getTypeName = u.asm.ua).apply(null, arguments); | ||
}; | ||
u.__embind_initialize_bindings = function() { | ||
return (u.__embind_initialize_bindings = u.asm.va).apply(null, arguments); | ||
}; | ||
var y = function() { | ||
return (y = u.asm.wa).apply(null, arguments); | ||
}, ve = function() { | ||
return (ve = u.asm.xa).apply(null, arguments); | ||
}, w = function() { | ||
return (w = u.asm.ya).apply(null, arguments); | ||
}, b = function() { | ||
return (b = u.asm.za).apply(null, arguments); | ||
}, Sr = function() { | ||
return (Sr = u.asm.Aa).apply(null, arguments); | ||
}, Rr = function() { | ||
return (Rr = u.asm.Ba).apply(null, arguments); | ||
}; | ||
u.dynCall_viijii = function() { | ||
return (u.dynCall_viijii = u.asm.Ca).apply(null, arguments); | ||
}; | ||
var kr = u.dynCall_jiii = function() { | ||
return (kr = u.dynCall_jiii = u.asm.Da).apply(null, arguments); | ||
}, Dr = u.dynCall_jiiii = function() { | ||
return (Dr = u.dynCall_jiiii = u.asm.Ea).apply(null, arguments); | ||
}; | ||
u.dynCall_iiiiij = function() { | ||
return (u.dynCall_iiiiij = u.asm.Fa).apply(null, arguments); | ||
}, u.dynCall_iiiiijj = function() { | ||
return (u.dynCall_iiiiijj = u.asm.Ga).apply(null, arguments); | ||
}, u.dynCall_iiiiiijj = function() { | ||
return (u.dynCall_iiiiiijj = u.asm.Ha).apply(null, arguments); | ||
}; | ||
function On(e, r) { | ||
var t = w(); | ||
try { | ||
return m(e)(r); | ||
} catch (n) { | ||
if (b(t), n !== n + 0) | ||
throw n; | ||
y(1, 0); | ||
} | ||
} | ||
function Wn(e, r, t, n) { | ||
var i = w(); | ||
try { | ||
m(e)(r, t, n); | ||
} catch (a) { | ||
if (b(i), a !== a + 0) | ||
throw a; | ||
y(1, 0); | ||
} | ||
} | ||
function jn(e, r, t) { | ||
var n = w(); | ||
try { | ||
m(e)(r, t); | ||
} catch (i) { | ||
if (b(n), i !== i + 0) | ||
throw i; | ||
y(1, 0); | ||
} | ||
} | ||
function Un(e, r) { | ||
var t = w(); | ||
try { | ||
m(e)(r); | ||
} catch (n) { | ||
if (b(t), n !== n + 0) | ||
throw n; | ||
y(1, 0); | ||
} | ||
} | ||
function Hn(e, r, t) { | ||
var n = w(); | ||
try { | ||
return m(e)(r, t); | ||
} catch (i) { | ||
if (b(n), i !== i + 0) | ||
throw i; | ||
y(1, 0); | ||
} | ||
} | ||
function Mn(e) { | ||
var r = w(); | ||
try { | ||
m(e)(); | ||
} catch (t) { | ||
if (b(r), t !== t + 0) | ||
throw t; | ||
y(1, 0); | ||
} | ||
} | ||
function In(e, r, t, n, i) { | ||
var a = w(); | ||
try { | ||
m(e)(r, t, n, i); | ||
} catch (s) { | ||
if (b(a), s !== s + 0) | ||
throw s; | ||
y(1, 0); | ||
} | ||
} | ||
function xn(e, r, t, n, i, a) { | ||
var s = w(); | ||
try { | ||
m(e)(r, t, n, i, a); | ||
} catch (o) { | ||
if (b(s), o !== o + 0) | ||
throw o; | ||
y(1, 0); | ||
} | ||
} | ||
function Yn(e, r, t, n, i, a, s, o, f, c, v) { | ||
var d = w(); | ||
try { | ||
m(e)(r, t, n, i, a, s, o, f, c, v); | ||
} catch (h) { | ||
if (b(d), h !== h + 0) | ||
throw h; | ||
y(1, 0); | ||
} | ||
} | ||
function Vn(e, r, t, n, i, a, s) { | ||
var o = w(); | ||
try { | ||
m(e)(r, t, n, i, a, s); | ||
} catch (f) { | ||
if (b(o), f !== f + 0) | ||
throw f; | ||
y(1, 0); | ||
} | ||
} | ||
function Bn(e, r, t, n, i, a, s, o) { | ||
var f = w(); | ||
try { | ||
m(e)(r, t, n, i, a, s, o); | ||
} catch (c) { | ||
if (b(f), c !== c + 0) | ||
throw c; | ||
y(1, 0); | ||
} | ||
} | ||
function Ln(e, r, t, n, i, a, s, o, f) { | ||
var c = w(); | ||
try { | ||
m(e)(r, t, n, i, a, s, o, f); | ||
} catch (v) { | ||
if (b(c), v !== v + 0) | ||
throw v; | ||
y(1, 0); | ||
} | ||
} | ||
function Nn(e, r, t, n) { | ||
var i = w(); | ||
try { | ||
return m(e)(r, t, n); | ||
} catch (a) { | ||
if (b(i), a !== a + 0) | ||
throw a; | ||
y(1, 0); | ||
} | ||
} | ||
function zn(e, r, t, n, i, a) { | ||
var s = w(); | ||
try { | ||
return m(e)(r, t, n, i, a); | ||
} catch (o) { | ||
if (b(s), o !== o + 0) | ||
throw o; | ||
y(1, 0); | ||
} | ||
} | ||
function Xn(e, r, t, n, i) { | ||
var a = w(); | ||
try { | ||
return m(e)(r, t, n, i); | ||
} catch (s) { | ||
if (b(a), s !== s + 0) | ||
throw s; | ||
y(1, 0); | ||
} | ||
} | ||
function Zn(e, r, t, n, i, a, s) { | ||
var o = w(); | ||
try { | ||
return m(e)(r, t, n, i, a, s); | ||
} catch (f) { | ||
if (b(o), f !== f + 0) | ||
throw f; | ||
y(1, 0); | ||
} | ||
} | ||
function Gn(e) { | ||
var r = w(); | ||
try { | ||
return m(e)(); | ||
} catch (t) { | ||
if (b(r), t !== t + 0) | ||
throw t; | ||
y(1, 0); | ||
} | ||
} | ||
function qn(e, r, t, n) { | ||
var i = w(); | ||
try { | ||
return m(e)(r, t, n); | ||
} catch (a) { | ||
if (b(i), a !== a + 0) | ||
throw a; | ||
y(1, 0); | ||
} | ||
} | ||
function Jn(e, r, t, n) { | ||
var i = w(); | ||
try { | ||
return m(e)(r, t, n); | ||
} catch (a) { | ||
if (b(i), a !== a + 0) | ||
throw a; | ||
y(1, 0); | ||
} | ||
} | ||
function Kn(e, r, t, n, i, a) { | ||
var s = w(); | ||
try { | ||
return m(e)(r, t, n, i, a); | ||
} catch (o) { | ||
if (b(s), o !== o + 0) | ||
throw o; | ||
y(1, 0); | ||
} | ||
} | ||
function Qn(e, r, t, n, i, a, s, o, f, c) { | ||
var v = w(); | ||
try { | ||
return m(e)(r, t, n, i, a, s, o, f, c); | ||
} catch (d) { | ||
if (b(v), d !== d + 0) | ||
throw d; | ||
y(1, 0); | ||
} | ||
} | ||
function ei(e, r, t) { | ||
var n = w(); | ||
try { | ||
return m(e)(r, t); | ||
} catch (i) { | ||
if (b(n), i !== i + 0) | ||
throw i; | ||
y(1, 0); | ||
} | ||
} | ||
function ri(e, r, t, n, i, a, s, o, f, c) { | ||
var v = w(); | ||
try { | ||
m(e)(r, t, n, i, a, s, o, f, c); | ||
} catch (d) { | ||
if (b(v), d !== d + 0) | ||
throw d; | ||
y(1, 0); | ||
} | ||
} | ||
function ti(e, r, t, n, i, a, s, o) { | ||
var f = w(); | ||
try { | ||
return m(e)(r, t, n, i, a, s, o); | ||
} catch (c) { | ||
if (b(f), c !== c + 0) | ||
throw c; | ||
y(1, 0); | ||
} | ||
} | ||
function ni(e, r, t, n, i, a, s, o, f) { | ||
var c = w(); | ||
try { | ||
return m(e)(r, t, n, i, a, s, o, f); | ||
} catch (v) { | ||
if (b(c), v !== v + 0) | ||
throw v; | ||
y(1, 0); | ||
} | ||
} | ||
function ii(e, r, t, n, i, a, s) { | ||
var o = w(); | ||
try { | ||
m(e)(r, t, n, i, a, s); | ||
} catch (f) { | ||
if (b(o), f !== f + 0) | ||
throw f; | ||
y(1, 0); | ||
} | ||
} | ||
function ai(e, r, t, n) { | ||
var i = w(); | ||
try { | ||
return m(e)(r, t, n); | ||
} catch (a) { | ||
if (b(i), a !== a + 0) | ||
throw a; | ||
y(1, 0); | ||
} | ||
} | ||
function oi(e, r, t, n, i, a, s, o, f, c, v, d) { | ||
var h = w(); | ||
try { | ||
return m(e)(r, t, n, i, a, s, o, f, c, v, d); | ||
} catch (_) { | ||
if (b(h), _ !== _ + 0) | ||
throw _; | ||
y(1, 0); | ||
} | ||
} | ||
function si(e, r, t, n, i, a, s, o, f, c, v, d, h, _, P, A) { | ||
var $ = w(); | ||
try { | ||
m(e)(r, t, n, i, a, s, o, f, c, v, d, h, _, P, A); | ||
} catch (C) { | ||
if (b($), C !== C + 0) | ||
throw C; | ||
y(1, 0); | ||
} | ||
} | ||
function ui(e, r, t, n) { | ||
var i = w(); | ||
try { | ||
return kr(e, r, t, n); | ||
} catch (a) { | ||
if (b(i), a !== a + 0) | ||
throw a; | ||
y(1, 0); | ||
} | ||
} | ||
function fi(e, r, t, n, i) { | ||
var a = w(); | ||
try { | ||
return Dr(e, r, t, n, i); | ||
} catch (s) { | ||
if (b(a), s !== s + 0) | ||
throw s; | ||
y(1, 0); | ||
} | ||
} | ||
var Se; | ||
ae = function e() { | ||
Se || Or(), Se || (ae = e); | ||
}; | ||
function Or() { | ||
if (N > 0 || (Mr(), N > 0)) | ||
return; | ||
function e() { | ||
Se || (Se = !0, u.calledRun = !0, !Je && (Ir(), V(u), u.onRuntimeInitialized && u.onRuntimeInitialized(), xr())); | ||
} | ||
u.setStatus ? (u.setStatus("Running..."), setTimeout(function() { | ||
setTimeout(function() { | ||
u.setStatus(""); | ||
}, 1), e(); | ||
}, 1)) : e(); | ||
} | ||
if (u.preInit) | ||
for (typeof u.preInit == "function" && (u.preInit = [u.preInit]); u.preInit.length > 0; ) | ||
u.preInit.pop()(); | ||
return Or(), H.ready; | ||
}; | ||
})(); | ||
function hi(W) { | ||
return ci(ke, W); | ||
} | ||
async function _i(W, { | ||
tryHarder: H = L.tryHarder, | ||
formats: u = L.formats, | ||
maxNumberOfSymbols: V = L.maxNumberOfSymbols | ||
} = L) { | ||
return li( | ||
W, | ||
{ | ||
tryHarder: o, | ||
formats: t, | ||
maxNumberOfSymbols: m | ||
tryHarder: H, | ||
formats: u, | ||
maxNumberOfSymbols: V | ||
}, | ||
n | ||
ke | ||
); | ||
} | ||
async function Z(r, { | ||
tryHarder: o = e.tryHarder, | ||
formats: t = e.formats, | ||
maxNumberOfSymbols: m = e.maxNumberOfSymbols | ||
} = e) { | ||
return f( | ||
r, | ||
async function gi(W, { | ||
tryHarder: H = L.tryHarder, | ||
formats: u = L.formats, | ||
maxNumberOfSymbols: V = L.maxNumberOfSymbols | ||
} = L) { | ||
return vi( | ||
W, | ||
{ | ||
tryHarder: o, | ||
formats: t, | ||
maxNumberOfSymbols: m | ||
tryHarder: H, | ||
formats: u, | ||
maxNumberOfSymbols: V | ||
}, | ||
n | ||
ke | ||
); | ||
} | ||
async function X(r, { | ||
format: o = a.format, | ||
charset: t = a.charset, | ||
quietZone: m = a.quietZone, | ||
width: i = a.width, | ||
height: c = a.height, | ||
eccLevel: d = a.eccLevel | ||
} = a) { | ||
return I( | ||
r, | ||
async function yi(W, { | ||
format: H = G.format, | ||
charset: u = G.charset, | ||
quietZone: V = G.quietZone, | ||
width: q = G.width, | ||
height: de = G.height, | ||
eccLevel: pe = G.eccLevel | ||
} = G) { | ||
return di( | ||
W, | ||
{ | ||
format: o, | ||
charset: t, | ||
quietZone: m, | ||
width: i, | ||
height: c, | ||
eccLevel: d | ||
format: H, | ||
charset: u, | ||
quietZone: V, | ||
width: q, | ||
height: de, | ||
eccLevel: pe | ||
}, | ||
n | ||
ke | ||
); | ||
} | ||
export { | ||
p as ZXING_BARCODE_FORMAT_NAMES, | ||
A as ZXING_CHARACTOR_SET_NAMES, | ||
e as defaultZXingReadOptions, | ||
a as defaultZXingWriteOptions, | ||
l as getZXingInstance, | ||
Z as readBarcodeFromImageData, | ||
B as readBarcodeFromImageFile, | ||
X as writeBarcodeToImageFile | ||
bi as ZXING_BARCODE_FORMAT_NAMES, | ||
Pi as ZXING_CHARACTOR_SET_NAMES, | ||
L as defaultZXingReadOptions, | ||
G as defaultZXingWriteOptions, | ||
hi as getZXingModule, | ||
Ci as purgeZXingModule, | ||
gi as readBarcodeFromImageData, | ||
_i as readBarcodeFromImageFile, | ||
Ti as setZXingModuleOverrides, | ||
yi as writeBarcodeToImageFile | ||
}; |
@@ -1,3 +0,3 @@ | ||
import { ZXingWasm } from "../ZXing.js"; | ||
declare var ZXing: ZXingWasm; | ||
import { ZXingModuleFactory } from "../core.js"; | ||
declare var ZXing: ZXingModuleFactory<"reader" | "writer">; | ||
export default ZXing; |
@@ -1,5 +0,5 @@ | ||
import { ZXingReadOptions, ZXingReadResult } from "../ZXing.js"; | ||
export declare function getZXingInstance(): Promise<import("../ZXing.js").ZXingInstance>; | ||
export declare function readBarcodeFromImageFile(imageFile: Blob | File, { tryHarder, formats, maxNumberOfSymbols, }?: ZXingReadOptions): Promise<ZXingReadResult[]>; | ||
export declare function readBarcodeFromImageData(imageData: ImageData, { tryHarder, formats, maxNumberOfSymbols, }?: ZXingReadOptions): Promise<ZXingReadResult[]>; | ||
import zxingModuleFactory from "./zxing_reader.js"; | ||
import { ZXingModuleFactoryTypeExtractor, ZXingModuleOverrides, getZXingModule as _getZXingModule, ZXingReadOptions, ZXingReadOutput } from "../core.js"; | ||
export declare function getZXingModule(zxingModuleOverrides?: ZXingModuleOverrides<ZXingModuleFactoryTypeExtractor<typeof zxingModuleFactory>>): ReturnType<typeof _getZXingModule>; | ||
export declare function readBarcodeFromImageFile(imageFile: Blob | File, { tryHarder, formats, maxNumberOfSymbols, }?: ZXingReadOptions): Promise<ZXingReadOutput[]>; | ||
export * from "../exposed.js"; |
@@ -1,45 +0,1715 @@ | ||
import m from "./zxing_reader.js"; | ||
import { getZXingInstance as n, readBarcodeFromImageFile as d, defaultZXingReadOptions as r, readBarcodeFromImageData as i } from "../ZXing.js"; | ||
import { ZXING_BARCODE_FORMAT_NAMES as X, ZXING_CHARACTOR_SET_NAMES as Z, defaultZXingWriteOptions as l } from "../ZXing.js"; | ||
function s() { | ||
return n(m); | ||
import { g as si, r as ui, d as Ae } from "../core-9bc51fdd.js"; | ||
import { Z as pi, a as hi, b as _i, p as gi, s as yi } from "../core-9bc51fdd.js"; | ||
var kr = (() => { | ||
var L = import.meta.url; | ||
return function(J = {}) { | ||
var u = typeof J < "u" ? J : {}, ue, fe; | ||
u.ready = new Promise(function(e, r) { | ||
ue = e, fe = r; | ||
}); | ||
var Le = Object.assign({}, u), ze = "./this.program", Xe = typeof window == "object", ce = typeof importScripts == "function"; | ||
typeof process == "object" && typeof process.versions == "object" && process.versions.node; | ||
var W = ""; | ||
function Dr(e) { | ||
return u.locateFile ? u.locateFile(e, W) : W + e; | ||
} | ||
var Fe; | ||
(Xe || ce) && (ce ? W = self.location.href : typeof document < "u" && document.currentScript && (W = document.currentScript.src), L && (W = L), W.indexOf("blob:") !== 0 ? W = W.substr(0, W.replace(/[?#].*/, "").lastIndexOf("/") + 1) : W = "", ce && (Fe = (e) => { | ||
var r = new XMLHttpRequest(); | ||
return r.open("GET", e, !1), r.responseType = "arraybuffer", r.send(null), new Uint8Array(r.response); | ||
})), u.print || console.log.bind(console); | ||
var K = u.printErr || console.warn.bind(console); | ||
Object.assign(u, Le), Le = null, u.arguments && u.arguments, u.thisProgram && (ze = u.thisProgram), u.quit && u.quit; | ||
var Q; | ||
u.wasmBinary && (Q = u.wasmBinary), u.noExitRuntime, typeof WebAssembly != "object" && X("no native wasm support detected"); | ||
var le, Ze = !1; | ||
function Or(e, r) { | ||
e || X(r); | ||
} | ||
var Ge = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0; | ||
function Wr(e, r, t) { | ||
for (var n = r + t, i = r; e[i] && !(i >= n); ) | ||
++i; | ||
if (i - r > 16 && e.buffer && Ge) | ||
return Ge.decode(e.subarray(r, i)); | ||
for (var a = ""; r < i; ) { | ||
var s = e[r++]; | ||
if (!(s & 128)) { | ||
a += String.fromCharCode(s); | ||
continue; | ||
} | ||
var o = e[r++] & 63; | ||
if ((s & 224) == 192) { | ||
a += String.fromCharCode((s & 31) << 6 | o); | ||
continue; | ||
} | ||
var c = e[r++] & 63; | ||
if ((s & 240) == 224 ? s = (s & 15) << 12 | o << 6 | c : s = (s & 7) << 18 | o << 12 | c << 6 | e[r++] & 63, s < 65536) | ||
a += String.fromCharCode(s); | ||
else { | ||
var f = s - 65536; | ||
a += String.fromCharCode(55296 | f >> 10, 56320 | f & 1023); | ||
} | ||
} | ||
return a; | ||
} | ||
function Ee(e, r) { | ||
return e ? Wr(k, e, r) : ""; | ||
} | ||
function qe(e, r, t, n) { | ||
if (!(n > 0)) | ||
return 0; | ||
for (var i = t, a = t + n - 1, s = 0; s < e.length; ++s) { | ||
var o = e.charCodeAt(s); | ||
if (o >= 55296 && o <= 57343) { | ||
var c = e.charCodeAt(++s); | ||
o = 65536 + ((o & 1023) << 10) | c & 1023; | ||
} | ||
if (o <= 127) { | ||
if (t >= a) | ||
break; | ||
r[t++] = o; | ||
} else if (o <= 2047) { | ||
if (t + 1 >= a) | ||
break; | ||
r[t++] = 192 | o >> 6, r[t++] = 128 | o & 63; | ||
} else if (o <= 65535) { | ||
if (t + 2 >= a) | ||
break; | ||
r[t++] = 224 | o >> 12, r[t++] = 128 | o >> 6 & 63, r[t++] = 128 | o & 63; | ||
} else { | ||
if (t + 3 >= a) | ||
break; | ||
r[t++] = 240 | o >> 18, r[t++] = 128 | o >> 12 & 63, r[t++] = 128 | o >> 6 & 63, r[t++] = 128 | o & 63; | ||
} | ||
} | ||
return r[t] = 0, t - i; | ||
} | ||
function jr(e, r, t) { | ||
return qe(e, k, r, t); | ||
} | ||
function Je(e) { | ||
for (var r = 0, t = 0; t < e.length; ++t) { | ||
var n = e.charCodeAt(t); | ||
n <= 127 ? r++ : n <= 2047 ? r += 2 : n >= 55296 && n <= 57343 ? (r += 4, ++t) : r += 3; | ||
} | ||
return r; | ||
} | ||
var j, k, z, ve, P, A, Ke, Qe; | ||
function er() { | ||
var e = le.buffer; | ||
u.HEAP8 = j = new Int8Array(e), u.HEAP16 = z = new Int16Array(e), u.HEAP32 = P = new Int32Array(e), u.HEAPU8 = k = new Uint8Array(e), u.HEAPU16 = ve = new Uint16Array(e), u.HEAPU32 = A = new Uint32Array(e), u.HEAPF32 = Ke = new Float32Array(e), u.HEAPF64 = Qe = new Float64Array(e); | ||
} | ||
var rr, tr = [], nr = [], ir = []; | ||
function Ur() { | ||
if (u.preRun) | ||
for (typeof u.preRun == "function" && (u.preRun = [u.preRun]); u.preRun.length; ) | ||
Ir(u.preRun.shift()); | ||
Re(tr); | ||
} | ||
function Mr() { | ||
Re(nr); | ||
} | ||
function Hr() { | ||
if (u.postRun) | ||
for (typeof u.postRun == "function" && (u.postRun = [u.postRun]); u.postRun.length; ) | ||
Yr(u.postRun.shift()); | ||
Re(ir); | ||
} | ||
function Ir(e) { | ||
tr.unshift(e); | ||
} | ||
function xr(e) { | ||
nr.unshift(e); | ||
} | ||
function Yr(e) { | ||
ir.unshift(e); | ||
} | ||
var x = 0, ee = null; | ||
function Vr(e) { | ||
x++, u.monitorRunDependencies && u.monitorRunDependencies(x); | ||
} | ||
function Br(e) { | ||
if (x--, u.monitorRunDependencies && u.monitorRunDependencies(x), x == 0 && ee) { | ||
var r = ee; | ||
ee = null, r(); | ||
} | ||
} | ||
function X(e) { | ||
u.onAbort && u.onAbort(e), e = "Aborted(" + e + ")", K(e), Ze = !0, e += ". Build with -sASSERTIONS for more info."; | ||
var r = new WebAssembly.RuntimeError(e); | ||
throw fe(r), r; | ||
} | ||
var Nr = "data:application/octet-stream;base64,"; | ||
function ar(e) { | ||
return e.startsWith(Nr); | ||
} | ||
var Y; | ||
u.locateFile ? (Y = "zxing_reader.wasm", ar(Y) || (Y = Dr(Y))) : Y = new URL("/reader/zxing_reader.wasm", self.location).href; | ||
function or(e) { | ||
try { | ||
if (e == Y && Q) | ||
return new Uint8Array(Q); | ||
if (Fe) | ||
return Fe(e); | ||
throw "both async and sync fetching of the wasm failed"; | ||
} catch (r) { | ||
X(r); | ||
} | ||
} | ||
function Lr(e) { | ||
return !Q && (Xe || ce) && typeof fetch == "function" ? fetch(e, { credentials: "same-origin" }).then(function(r) { | ||
if (!r.ok) | ||
throw "failed to load wasm binary file at '" + e + "'"; | ||
return r.arrayBuffer(); | ||
}).catch(function() { | ||
return or(e); | ||
}) : Promise.resolve().then(function() { | ||
return or(e); | ||
}); | ||
} | ||
function sr(e, r, t) { | ||
return Lr(e).then(function(n) { | ||
return WebAssembly.instantiate(n, r); | ||
}).then(function(n) { | ||
return n; | ||
}).then(t, function(n) { | ||
K("failed to asynchronously prepare wasm: " + n), X(n); | ||
}); | ||
} | ||
function zr(e, r, t, n) { | ||
return !e && typeof WebAssembly.instantiateStreaming == "function" && !ar(r) && typeof fetch == "function" ? fetch(r, { credentials: "same-origin" }).then(function(i) { | ||
var a = WebAssembly.instantiateStreaming(i, t); | ||
return a.then(n, function(s) { | ||
return K("wasm streaming compile failed: " + s), K("falling back to ArrayBuffer instantiation"), sr(r, t, n); | ||
}); | ||
}) : sr(r, t, n); | ||
} | ||
function Xr() { | ||
var e = { a: Rn }; | ||
function r(n, i) { | ||
var a = n.exports; | ||
return u.asm = a, le = u.asm.na, er(), rr = u.asm.sa, xr(u.asm.oa), Br(), a; | ||
} | ||
Vr(); | ||
function t(n) { | ||
r(n.instance); | ||
} | ||
if (u.instantiateWasm) | ||
try { | ||
return u.instantiateWasm(e, r); | ||
} catch (n) { | ||
K("Module.instantiateWasm callback failed with error: " + n), fe(n); | ||
} | ||
return zr(Q, Y, e, t).catch(fe), {}; | ||
} | ||
function Re(e) { | ||
for (; e.length > 0; ) | ||
e.shift()(u); | ||
} | ||
var de = []; | ||
function Zr(e) { | ||
e.add_ref(); | ||
} | ||
var pe = 0; | ||
function Gr(e) { | ||
var r = new _e(e); | ||
return r.get_caught() || (r.set_caught(!0), pe--), r.set_rethrown(!1), de.push(r), Zr(r), r.get_exception_ptr(); | ||
} | ||
var Z = 0, he = []; | ||
function y(e) { | ||
var r = he[e]; | ||
return r || (e >= he.length && (he.length = e + 1), he[e] = r = rr.get(e)), r; | ||
} | ||
function qr(e) { | ||
if (e.release_ref() && !e.get_rethrown()) { | ||
var r = e.get_destructor(); | ||
r && y(r)(e.excPtr), Tr(e.excPtr); | ||
} | ||
} | ||
function Jr() { | ||
g(0); | ||
var e = de.pop(); | ||
qr(e), Z = 0; | ||
} | ||
function _e(e) { | ||
this.excPtr = e, this.ptr = e - 24, this.set_type = function(r) { | ||
A[this.ptr + 4 >> 2] = r; | ||
}, this.get_type = function() { | ||
return A[this.ptr + 4 >> 2]; | ||
}, this.set_destructor = function(r) { | ||
A[this.ptr + 8 >> 2] = r; | ||
}, this.get_destructor = function() { | ||
return A[this.ptr + 8 >> 2]; | ||
}, this.set_refcount = function(r) { | ||
P[this.ptr >> 2] = r; | ||
}, this.set_caught = function(r) { | ||
r = r ? 1 : 0, j[this.ptr + 12 >> 0] = r; | ||
}, this.get_caught = function() { | ||
return j[this.ptr + 12 >> 0] != 0; | ||
}, this.set_rethrown = function(r) { | ||
r = r ? 1 : 0, j[this.ptr + 13 >> 0] = r; | ||
}, this.get_rethrown = function() { | ||
return j[this.ptr + 13 >> 0] != 0; | ||
}, this.init = function(r, t) { | ||
this.set_adjusted_ptr(0), this.set_type(r), this.set_destructor(t), this.set_refcount(0), this.set_caught(!1), this.set_rethrown(!1); | ||
}, this.add_ref = function() { | ||
var r = P[this.ptr >> 2]; | ||
P[this.ptr >> 2] = r + 1; | ||
}, this.release_ref = function() { | ||
var r = P[this.ptr >> 2]; | ||
return P[this.ptr >> 2] = r - 1, r === 1; | ||
}, this.set_adjusted_ptr = function(r) { | ||
A[this.ptr + 16 >> 2] = r; | ||
}, this.get_adjusted_ptr = function() { | ||
return A[this.ptr + 16 >> 2]; | ||
}, this.get_exception_ptr = function() { | ||
var r = Fr(this.get_type()); | ||
if (r) | ||
return A[this.excPtr >> 2]; | ||
var t = this.get_adjusted_ptr(); | ||
return t !== 0 ? t : this.excPtr; | ||
}; | ||
} | ||
function Kr(e) { | ||
throw Z || (Z = e), e; | ||
} | ||
function Se() { | ||
var e = Z; | ||
if (!e) | ||
return se(0), 0; | ||
var r = new _e(e); | ||
r.set_adjusted_ptr(e); | ||
var t = r.get_type(); | ||
if (!t) | ||
return se(0), e; | ||
for (var n = 0; n < arguments.length; n++) { | ||
var i = arguments[n]; | ||
if (i === 0 || i === t) | ||
break; | ||
var a = r.ptr + 16; | ||
if (Ar(i, t, a)) | ||
return se(i), e; | ||
} | ||
return se(t), e; | ||
} | ||
var Qr = Se, et = Se, rt = Se; | ||
function tt(e) { | ||
return new _e(e).get_exception_ptr(); | ||
} | ||
function nt() { | ||
var e = de.pop(); | ||
e || X("no exception to throw"); | ||
var r = e.excPtr; | ||
throw e.get_rethrown() || (de.push(e), e.set_rethrown(!0), e.set_caught(!1), pe++), Z = r, r; | ||
} | ||
function it(e, r, t) { | ||
var n = new _e(e); | ||
throw n.init(r, t), Z = e, pe++, e; | ||
} | ||
function at() { | ||
return pe; | ||
} | ||
var ge = {}; | ||
function ur(e) { | ||
for (; e.length; ) { | ||
var r = e.pop(), t = e.pop(); | ||
t(r); | ||
} | ||
} | ||
function re(e) { | ||
return this.fromWireType(P[e >> 2]); | ||
} | ||
var G = {}, V = {}, ye = {}, ot = 48, st = 57; | ||
function ke(e) { | ||
if (e === void 0) | ||
return "_unknown"; | ||
e = e.replace(/[^a-zA-Z0-9_]/g, "$"); | ||
var r = e.charCodeAt(0); | ||
return r >= ot && r <= st ? "_" + e : e; | ||
} | ||
function De(e, r) { | ||
return e = ke(e), { [e]: function() { | ||
return r.apply(this, arguments); | ||
} }[e]; | ||
} | ||
function Oe(e, r) { | ||
var t = De(r, function(n) { | ||
this.name = r, this.message = n; | ||
var i = new Error(n).stack; | ||
i !== void 0 && (this.stack = this.toString() + ` | ||
` + i.replace(/^Error(:[^\n]*)?\n/, "")); | ||
}); | ||
return t.prototype = Object.create(e.prototype), t.prototype.constructor = t, t.prototype.toString = function() { | ||
return this.message === void 0 ? this.name : this.name + ": " + this.message; | ||
}, t; | ||
} | ||
var fr = void 0; | ||
function me(e) { | ||
throw new fr(e); | ||
} | ||
function B(e, r, t) { | ||
e.forEach(function(o) { | ||
ye[o] = r; | ||
}); | ||
function n(o) { | ||
var c = t(o); | ||
c.length !== e.length && me("Mismatched type converter count"); | ||
for (var f = 0; f < e.length; ++f) | ||
U(e[f], c[f]); | ||
} | ||
var i = new Array(r.length), a = [], s = 0; | ||
r.forEach((o, c) => { | ||
V.hasOwnProperty(o) ? i[c] = V[o] : (a.push(o), G.hasOwnProperty(o) || (G[o] = []), G[o].push(() => { | ||
i[c] = V[o], ++s, s === a.length && n(i); | ||
})); | ||
}), a.length === 0 && n(i); | ||
} | ||
function ut(e) { | ||
var r = ge[e]; | ||
delete ge[e]; | ||
var t = r.rawConstructor, n = r.rawDestructor, i = r.fields, a = i.map((s) => s.getterReturnType).concat(i.map((s) => s.setterArgumentType)); | ||
B([e], a, (s) => { | ||
var o = {}; | ||
return i.forEach((c, f) => { | ||
var v = c.fieldName, p = s[f], h = c.getter, _ = c.getterContext, C = s[f + i.length], F = c.setter, T = c.setterContext; | ||
o[v] = { read: ($) => p.fromWireType(h(_, $)), write: ($, l) => { | ||
var d = []; | ||
F(T, $, C.toWireType(d, l)), ur(d); | ||
} }; | ||
}), [{ name: r.name, fromWireType: function(c) { | ||
var f = {}; | ||
for (var v in o) | ||
f[v] = o[v].read(c); | ||
return n(c), f; | ||
}, toWireType: function(c, f) { | ||
for (var v in o) | ||
if (!(v in f)) | ||
throw new TypeError('Missing field: "' + v + '"'); | ||
var p = t(); | ||
for (v in o) | ||
o[v].write(p, f[v]); | ||
return c !== null && c.push(n, p), p; | ||
}, argPackAdvance: 8, readValueFromPointer: re, destructorFunction: n }]; | ||
}); | ||
} | ||
function ft(e, r, t, n, i) { | ||
} | ||
function We(e) { | ||
switch (e) { | ||
case 1: | ||
return 0; | ||
case 2: | ||
return 1; | ||
case 4: | ||
return 2; | ||
case 8: | ||
return 3; | ||
default: | ||
throw new TypeError("Unknown type size: " + e); | ||
} | ||
} | ||
function ct() { | ||
for (var e = new Array(256), r = 0; r < 256; ++r) | ||
e[r] = String.fromCharCode(r); | ||
cr = e; | ||
} | ||
var cr = void 0; | ||
function R(e) { | ||
for (var r = "", t = e; k[t]; ) | ||
r += cr[k[t++]]; | ||
return r; | ||
} | ||
var q = void 0; | ||
function m(e) { | ||
throw new q(e); | ||
} | ||
function U(e, r, t = {}) { | ||
if (!("argPackAdvance" in r)) | ||
throw new TypeError("registerType registeredInstance requires argPackAdvance"); | ||
var n = r.name; | ||
if (e || m('type "' + n + '" must have a positive integer typeid pointer'), V.hasOwnProperty(e)) { | ||
if (t.ignoreDuplicateRegistrations) | ||
return; | ||
m("Cannot register type '" + n + "' twice"); | ||
} | ||
if (V[e] = r, delete ye[e], G.hasOwnProperty(e)) { | ||
var i = G[e]; | ||
delete G[e], i.forEach((a) => a()); | ||
} | ||
} | ||
function lt(e, r, t, n, i) { | ||
var a = We(t); | ||
r = R(r), U(e, { name: r, fromWireType: function(s) { | ||
return !!s; | ||
}, toWireType: function(s, o) { | ||
return o ? n : i; | ||
}, argPackAdvance: 8, readValueFromPointer: function(s) { | ||
var o; | ||
if (t === 1) | ||
o = j; | ||
else if (t === 2) | ||
o = z; | ||
else if (t === 4) | ||
o = P; | ||
else | ||
throw new TypeError("Unknown boolean type size: " + r); | ||
return this.fromWireType(o[s >> a]); | ||
}, destructorFunction: null }); | ||
} | ||
function vt(e) { | ||
if (!(this instanceof I) || !(e instanceof I)) | ||
return !1; | ||
for (var r = this.$$.ptrType.registeredClass, t = this.$$.ptr, n = e.$$.ptrType.registeredClass, i = e.$$.ptr; r.baseClass; ) | ||
t = r.upcast(t), r = r.baseClass; | ||
for (; n.baseClass; ) | ||
i = n.upcast(i), n = n.baseClass; | ||
return r === n && t === i; | ||
} | ||
function dt(e) { | ||
return { count: e.count, deleteScheduled: e.deleteScheduled, preservePointerOnDelete: e.preservePointerOnDelete, ptr: e.ptr, ptrType: e.ptrType, smartPtr: e.smartPtr, smartPtrType: e.smartPtrType }; | ||
} | ||
function je(e) { | ||
function r(t) { | ||
return t.$$.ptrType.registeredClass.name; | ||
} | ||
m(r(e) + " instance already deleted"); | ||
} | ||
var Ue = !1; | ||
function lr(e) { | ||
} | ||
function pt(e) { | ||
e.smartPtr ? e.smartPtrType.rawDestructor(e.smartPtr) : e.ptrType.registeredClass.rawDestructor(e.ptr); | ||
} | ||
function vr(e) { | ||
e.count.value -= 1; | ||
var r = e.count.value === 0; | ||
r && pt(e); | ||
} | ||
function dr(e, r, t) { | ||
if (r === t) | ||
return e; | ||
if (t.baseClass === void 0) | ||
return null; | ||
var n = dr(e, r, t.baseClass); | ||
return n === null ? null : t.downcast(n); | ||
} | ||
var pr = {}; | ||
function ht() { | ||
return Object.keys(ie).length; | ||
} | ||
function _t() { | ||
var e = []; | ||
for (var r in ie) | ||
ie.hasOwnProperty(r) && e.push(ie[r]); | ||
return e; | ||
} | ||
var te = []; | ||
function Me() { | ||
for (; te.length; ) { | ||
var e = te.pop(); | ||
e.$$.deleteScheduled = !1, e.delete(); | ||
} | ||
} | ||
var ne = void 0; | ||
function gt(e) { | ||
ne = e, te.length && ne && ne(Me); | ||
} | ||
function yt() { | ||
u.getInheritedInstanceCount = ht, u.getLiveInheritedInstances = _t, u.flushPendingDeletes = Me, u.setDelayFunction = gt; | ||
} | ||
var ie = {}; | ||
function mt(e, r) { | ||
for (r === void 0 && m("ptr should not be undefined"); e.baseClass; ) | ||
r = e.upcast(r), e = e.baseClass; | ||
return r; | ||
} | ||
function wt(e, r) { | ||
return r = mt(e, r), ie[r]; | ||
} | ||
function we(e, r) { | ||
(!r.ptrType || !r.ptr) && me("makeClassHandle requires ptr and ptrType"); | ||
var t = !!r.smartPtrType, n = !!r.smartPtr; | ||
return t !== n && me("Both smartPtrType and smartPtr must be specified"), r.count = { value: 1 }, ae(Object.create(e, { $$: { value: r } })); | ||
} | ||
function bt(e) { | ||
var r = this.getPointee(e); | ||
if (!r) | ||
return this.destructor(e), null; | ||
var t = wt(this.registeredClass, r); | ||
if (t !== void 0) { | ||
if (t.$$.count.value === 0) | ||
return t.$$.ptr = r, t.$$.smartPtr = e, t.clone(); | ||
var n = t.clone(); | ||
return this.destructor(e), n; | ||
} | ||
function i() { | ||
return this.isSmartPointer ? we(this.registeredClass.instancePrototype, { ptrType: this.pointeeType, ptr: r, smartPtrType: this, smartPtr: e }) : we(this.registeredClass.instancePrototype, { ptrType: this, ptr: e }); | ||
} | ||
var a = this.registeredClass.getActualType(r), s = pr[a]; | ||
if (!s) | ||
return i.call(this); | ||
var o; | ||
this.isConst ? o = s.constPointerType : o = s.pointerType; | ||
var c = dr(r, this.registeredClass, o.registeredClass); | ||
return c === null ? i.call(this) : this.isSmartPointer ? we(o.registeredClass.instancePrototype, { ptrType: o, ptr: c, smartPtrType: this, smartPtr: e }) : we(o.registeredClass.instancePrototype, { ptrType: o, ptr: c }); | ||
} | ||
function ae(e) { | ||
return typeof FinalizationRegistry > "u" ? (ae = (r) => r, e) : (Ue = new FinalizationRegistry((r) => { | ||
vr(r.$$); | ||
}), ae = (r) => { | ||
var t = r.$$, n = !!t.smartPtr; | ||
if (n) { | ||
var i = { $$: t }; | ||
Ue.register(r, i, r); | ||
} | ||
return r; | ||
}, lr = (r) => Ue.unregister(r), ae(e)); | ||
} | ||
function Pt() { | ||
if (this.$$.ptr || je(this), this.$$.preservePointerOnDelete) | ||
return this.$$.count.value += 1, this; | ||
var e = ae(Object.create(Object.getPrototypeOf(this), { $$: { value: dt(this.$$) } })); | ||
return e.$$.count.value += 1, e.$$.deleteScheduled = !1, e; | ||
} | ||
function Ct() { | ||
this.$$.ptr || je(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && m("Object already scheduled for deletion"), lr(this), vr(this.$$), this.$$.preservePointerOnDelete || (this.$$.smartPtr = void 0, this.$$.ptr = void 0); | ||
} | ||
function Tt() { | ||
return !this.$$.ptr; | ||
} | ||
function $t() { | ||
return this.$$.ptr || je(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && m("Object already scheduled for deletion"), te.push(this), te.length === 1 && ne && ne(Me), this.$$.deleteScheduled = !0, this; | ||
} | ||
function At() { | ||
I.prototype.isAliasOf = vt, I.prototype.clone = Pt, I.prototype.delete = Ct, I.prototype.isDeleted = Tt, I.prototype.deleteLater = $t; | ||
} | ||
function I() { | ||
} | ||
function hr(e, r, t) { | ||
if (e[r].overloadTable === void 0) { | ||
var n = e[r]; | ||
e[r] = function() { | ||
return e[r].overloadTable.hasOwnProperty(arguments.length) || m("Function '" + t + "' called with an invalid number of arguments (" + arguments.length + ") - expects one of (" + e[r].overloadTable + ")!"), e[r].overloadTable[arguments.length].apply(this, arguments); | ||
}, e[r].overloadTable = [], e[r].overloadTable[n.argCount] = n; | ||
} | ||
} | ||
function _r(e, r, t) { | ||
u.hasOwnProperty(e) ? ((t === void 0 || u[e].overloadTable !== void 0 && u[e].overloadTable[t] !== void 0) && m("Cannot register public name '" + e + "' twice"), hr(u, e, e), u.hasOwnProperty(t) && m("Cannot register multiple overloads of a function with the same number of arguments (" + t + ")!"), u[e].overloadTable[t] = r) : (u[e] = r, t !== void 0 && (u[e].numArguments = t)); | ||
} | ||
function Ft(e, r, t, n, i, a, s, o) { | ||
this.name = e, this.constructor = r, this.instancePrototype = t, this.rawDestructor = n, this.baseClass = i, this.getActualType = a, this.upcast = s, this.downcast = o, this.pureVirtualFunctions = []; | ||
} | ||
function He(e, r, t) { | ||
for (; r !== t; ) | ||
r.upcast || m("Expected null or instance of " + t.name + ", got an instance of " + r.name), e = r.upcast(e), r = r.baseClass; | ||
return e; | ||
} | ||
function Et(e, r) { | ||
if (r === null) | ||
return this.isReference && m("null is not a valid " + this.name), 0; | ||
r.$$ || m('Cannot pass "' + Ve(r) + '" as a ' + this.name), r.$$.ptr || m("Cannot pass deleted object as a pointer of type " + this.name); | ||
var t = r.$$.ptrType.registeredClass, n = He(r.$$.ptr, t, this.registeredClass); | ||
return n; | ||
} | ||
function Rt(e, r) { | ||
var t; | ||
if (r === null) | ||
return this.isReference && m("null is not a valid " + this.name), this.isSmartPointer ? (t = this.rawConstructor(), e !== null && e.push(this.rawDestructor, t), t) : 0; | ||
r.$$ || m('Cannot pass "' + Ve(r) + '" as a ' + this.name), r.$$.ptr || m("Cannot pass deleted object as a pointer of type " + this.name), !this.isConst && r.$$.ptrType.isConst && m("Cannot convert argument of type " + (r.$$.smartPtrType ? r.$$.smartPtrType.name : r.$$.ptrType.name) + " to parameter type " + this.name); | ||
var n = r.$$.ptrType.registeredClass; | ||
if (t = He(r.$$.ptr, n, this.registeredClass), this.isSmartPointer) | ||
switch (r.$$.smartPtr === void 0 && m("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) { | ||
case 0: | ||
r.$$.smartPtrType === this ? t = r.$$.smartPtr : m("Cannot convert argument of type " + (r.$$.smartPtrType ? r.$$.smartPtrType.name : r.$$.ptrType.name) + " to parameter type " + this.name); | ||
break; | ||
case 1: | ||
t = r.$$.smartPtr; | ||
break; | ||
case 2: | ||
if (r.$$.smartPtrType === this) | ||
t = r.$$.smartPtr; | ||
else { | ||
var i = r.clone(); | ||
t = this.rawShare(t, Pe.toHandle(function() { | ||
i.delete(); | ||
})), e !== null && e.push(this.rawDestructor, t); | ||
} | ||
break; | ||
default: | ||
m("Unsupporting sharing policy"); | ||
} | ||
return t; | ||
} | ||
function St(e, r) { | ||
if (r === null) | ||
return this.isReference && m("null is not a valid " + this.name), 0; | ||
r.$$ || m('Cannot pass "' + Ve(r) + '" as a ' + this.name), r.$$.ptr || m("Cannot pass deleted object as a pointer of type " + this.name), r.$$.ptrType.isConst && m("Cannot convert argument of type " + r.$$.ptrType.name + " to parameter type " + this.name); | ||
var t = r.$$.ptrType.registeredClass, n = He(r.$$.ptr, t, this.registeredClass); | ||
return n; | ||
} | ||
function kt(e) { | ||
return this.rawGetPointee && (e = this.rawGetPointee(e)), e; | ||
} | ||
function Dt(e) { | ||
this.rawDestructor && this.rawDestructor(e); | ||
} | ||
function Ot(e) { | ||
e !== null && e.delete(); | ||
} | ||
function Wt() { | ||
M.prototype.getPointee = kt, M.prototype.destructor = Dt, M.prototype.argPackAdvance = 8, M.prototype.readValueFromPointer = re, M.prototype.deleteObject = Ot, M.prototype.fromWireType = bt; | ||
} | ||
function M(e, r, t, n, i, a, s, o, c, f, v) { | ||
this.name = e, this.registeredClass = r, this.isReference = t, this.isConst = n, this.isSmartPointer = i, this.pointeeType = a, this.sharingPolicy = s, this.rawGetPointee = o, this.rawConstructor = c, this.rawShare = f, this.rawDestructor = v, !i && r.baseClass === void 0 ? n ? (this.toWireType = Et, this.destructorFunction = null) : (this.toWireType = St, this.destructorFunction = null) : this.toWireType = Rt; | ||
} | ||
function gr(e, r, t) { | ||
u.hasOwnProperty(e) || me("Replacing nonexistant public symbol"), u[e].overloadTable !== void 0 && t !== void 0 ? u[e].overloadTable[t] = r : (u[e] = r, u[e].argCount = t); | ||
} | ||
function jt(e, r, t) { | ||
var n = u["dynCall_" + e]; | ||
return t && t.length ? n.apply(null, [r].concat(t)) : n.call(null, r); | ||
} | ||
function Ut(e, r, t) { | ||
if (e.includes("j")) | ||
return jt(e, r, t); | ||
var n = y(r).apply(null, t); | ||
return n; | ||
} | ||
function Mt(e, r) { | ||
var t = []; | ||
return function() { | ||
return t.length = 0, Object.assign(t, arguments), Ut(e, r, t); | ||
}; | ||
} | ||
function D(e, r) { | ||
e = R(e); | ||
function t() { | ||
return e.includes("j") ? Mt(e, r) : y(r); | ||
} | ||
var n = t(); | ||
return typeof n != "function" && m("unknown function pointer with signature " + e + ": " + r), n; | ||
} | ||
var yr = void 0; | ||
function mr(e) { | ||
var r = $r(e), t = R(r); | ||
return H(r), t; | ||
} | ||
function be(e, r) { | ||
var t = [], n = {}; | ||
function i(a) { | ||
if (!n[a] && !V[a]) { | ||
if (ye[a]) { | ||
ye[a].forEach(i); | ||
return; | ||
} | ||
t.push(a), n[a] = !0; | ||
} | ||
} | ||
throw r.forEach(i), new yr(e + ": " + t.map(mr).join([", "])); | ||
} | ||
function Ht(e, r, t, n, i, a, s, o, c, f, v, p, h) { | ||
v = R(v), a = D(i, a), o && (o = D(s, o)), f && (f = D(c, f)), h = D(p, h); | ||
var _ = ke(v); | ||
_r(_, function() { | ||
be("Cannot construct " + v + " due to unbound types", [n]); | ||
}), B([e, r, t], n ? [n] : [], function(C) { | ||
C = C[0]; | ||
var F, T; | ||
n ? (F = C.registeredClass, T = F.instancePrototype) : T = I.prototype; | ||
var $ = De(_, function() { | ||
if (Object.getPrototypeOf(this) !== l) | ||
throw new q("Use 'new' to construct " + v); | ||
if (d.constructor_body === void 0) | ||
throw new q(v + " has no accessible constructor"); | ||
var $e = d.constructor_body[arguments.length]; | ||
if ($e === void 0) | ||
throw new q("Tried to invoke ctor of " + v + " with invalid number of parameters (" + arguments.length + ") - expected (" + Object.keys(d.constructor_body).toString() + ") parameters instead!"); | ||
return $e.apply(this, arguments); | ||
}), l = Object.create(T, { constructor: { value: $ } }); | ||
$.prototype = l; | ||
var d = new Ft(v, $, l, h, F, a, o, f), S = new M(v, d, !0, !1, !1), E = new M(v + "*", d, !1, !1, !1), N = new M(v + " const*", d, !1, !0, !1); | ||
return pr[e] = { pointerType: E, constPointerType: N }, gr(_, $), [S, E, N]; | ||
}); | ||
} | ||
function Ie(e, r) { | ||
for (var t = [], n = 0; n < e; n++) | ||
t.push(A[r + n * 4 >> 2]); | ||
return t; | ||
} | ||
function It(e, r) { | ||
if (!(e instanceof Function)) | ||
throw new TypeError("new_ called with constructor type " + typeof e + " which is not a function"); | ||
var t = De(e.name || "unknownFunctionName", function() { | ||
}); | ||
t.prototype = e.prototype; | ||
var n = new t(), i = e.apply(n, r); | ||
return i instanceof Object ? i : n; | ||
} | ||
function xe(e, r, t, n, i, a) { | ||
var s = r.length; | ||
s < 2 && m("argTypes array size mismatch! Must at least get return value and 'this' types!"); | ||
for (var o = r[1] !== null && t !== null, c = !1, f = 1; f < r.length; ++f) | ||
if (r[f] !== null && r[f].destructorFunction === void 0) { | ||
c = !0; | ||
break; | ||
} | ||
for (var v = r[0].name !== "void", p = "", h = "", f = 0; f < s - 2; ++f) | ||
p += (f !== 0 ? ", " : "") + "arg" + f, h += (f !== 0 ? ", " : "") + "arg" + f + "Wired"; | ||
var _ = "return function " + ke(e) + "(" + p + `) { | ||
if (arguments.length !== ` + (s - 2) + `) { | ||
throwBindingError('function ` + e + " called with ' + arguments.length + ' arguments, expected " + (s - 2) + ` args!'); | ||
} | ||
async function f(a, { | ||
tryHarder: e = r.tryHarder, | ||
formats: o = r.formats, | ||
maxNumberOfSymbols: t = r.maxNumberOfSymbols | ||
} = r) { | ||
return d( | ||
a, | ||
{ | ||
tryHarder: e, | ||
formats: o, | ||
maxNumberOfSymbols: t | ||
}, | ||
m | ||
); | ||
`; | ||
c && (_ += `var destructors = []; | ||
`); | ||
var C = c ? "destructors" : "null", F = ["throwBindingError", "invoker", "fn", "runDestructors", "retType", "classParam"], T = [m, n, i, ur, r[0], r[1]]; | ||
o && (_ += "var thisWired = classParam.toWireType(" + C + `, this); | ||
`); | ||
for (var f = 0; f < s - 2; ++f) | ||
_ += "var arg" + f + "Wired = argType" + f + ".toWireType(" + C + ", arg" + f + "); // " + r[f + 2].name + ` | ||
`, F.push("argType" + f), T.push(r[f + 2]); | ||
if (o && (h = "thisWired" + (h.length > 0 ? ", " : "") + h), _ += (v || a ? "var rv = " : "") + "invoker(fn" + (h.length > 0 ? ", " : "") + h + `); | ||
`, c) | ||
_ += `runDestructors(destructors); | ||
`; | ||
else | ||
for (var f = o ? 1 : 2; f < r.length; ++f) { | ||
var $ = f === 1 ? "thisWired" : "arg" + (f - 2) + "Wired"; | ||
r[f].destructorFunction !== null && (_ += $ + "_dtor(" + $ + "); // " + r[f].name + ` | ||
`, F.push($ + "_dtor"), T.push(r[f].destructorFunction)); | ||
} | ||
v && (_ += `var ret = retType.fromWireType(rv); | ||
return ret; | ||
`), _ += `} | ||
`, F.push(_); | ||
var l = It(Function, F).apply(null, T); | ||
return l; | ||
} | ||
function xt(e, r, t, n, i, a) { | ||
Or(r > 0); | ||
var s = Ie(r, t); | ||
i = D(n, i), B([], [e], function(o) { | ||
o = o[0]; | ||
var c = "constructor " + o.name; | ||
if (o.registeredClass.constructor_body === void 0 && (o.registeredClass.constructor_body = []), o.registeredClass.constructor_body[r - 1] !== void 0) | ||
throw new q("Cannot register multiple constructors with identical number of parameters (" + (r - 1) + ") for class '" + o.name + "'! Overload resolution is currently only performed using the parameter count, not actual type info!"); | ||
return o.registeredClass.constructor_body[r - 1] = () => { | ||
be("Cannot construct " + o.name + " due to unbound types", s); | ||
}, B([], s, function(f) { | ||
return f.splice(1, 0, null), o.registeredClass.constructor_body[r - 1] = xe(c, f, null, i, a), []; | ||
}), []; | ||
}); | ||
} | ||
function Yt(e, r, t, n, i, a, s, o, c) { | ||
var f = Ie(t, n); | ||
r = R(r), a = D(i, a), B([], [e], function(v) { | ||
v = v[0]; | ||
var p = v.name + "." + r; | ||
r.startsWith("@@") && (r = Symbol[r.substring(2)]), o && v.registeredClass.pureVirtualFunctions.push(r); | ||
function h() { | ||
be("Cannot call " + p + " due to unbound types", f); | ||
} | ||
var _ = v.registeredClass.instancePrototype, C = _[r]; | ||
return C === void 0 || C.overloadTable === void 0 && C.className !== v.name && C.argCount === t - 2 ? (h.argCount = t - 2, h.className = v.name, _[r] = h) : (hr(_, r, p), _[r].overloadTable[t - 2] = h), B([], f, function(F) { | ||
var T = xe(p, F, v, a, s, c); | ||
return _[r].overloadTable === void 0 ? (T.argCount = t - 2, _[r] = T) : _[r].overloadTable[t - 2] = T, []; | ||
}), []; | ||
}); | ||
} | ||
var Ye = [], O = [{}, { value: void 0 }, { value: null }, { value: !0 }, { value: !1 }]; | ||
function wr(e) { | ||
e > 4 && --O[e].refcount === 0 && (O[e] = void 0, Ye.push(e)); | ||
} | ||
function Vt() { | ||
for (var e = 0, r = 5; r < O.length; ++r) | ||
O[r] !== void 0 && ++e; | ||
return e; | ||
} | ||
function Bt() { | ||
for (var e = 5; e < O.length; ++e) | ||
if (O[e] !== void 0) | ||
return O[e]; | ||
return null; | ||
} | ||
function Nt() { | ||
u.count_emval_handles = Vt, u.get_first_emval = Bt; | ||
} | ||
var Pe = { toValue: (e) => (e || m("Cannot use deleted val. handle = " + e), O[e].value), toHandle: (e) => { | ||
switch (e) { | ||
case void 0: | ||
return 1; | ||
case null: | ||
return 2; | ||
case !0: | ||
return 3; | ||
case !1: | ||
return 4; | ||
default: { | ||
var r = Ye.length ? Ye.pop() : O.length; | ||
return O[r] = { refcount: 1, value: e }, r; | ||
} | ||
} | ||
} }; | ||
function Lt(e, r) { | ||
r = R(r), U(e, { name: r, fromWireType: function(t) { | ||
var n = Pe.toValue(t); | ||
return wr(t), n; | ||
}, toWireType: function(t, n) { | ||
return Pe.toHandle(n); | ||
}, argPackAdvance: 8, readValueFromPointer: re, destructorFunction: null }); | ||
} | ||
function Ve(e) { | ||
if (e === null) | ||
return "null"; | ||
var r = typeof e; | ||
return r === "object" || r === "array" || r === "function" ? e.toString() : "" + e; | ||
} | ||
function zt(e, r) { | ||
switch (r) { | ||
case 2: | ||
return function(t) { | ||
return this.fromWireType(Ke[t >> 2]); | ||
}; | ||
case 3: | ||
return function(t) { | ||
return this.fromWireType(Qe[t >> 3]); | ||
}; | ||
default: | ||
throw new TypeError("Unknown float type: " + e); | ||
} | ||
} | ||
function Xt(e, r, t) { | ||
var n = We(t); | ||
r = R(r), U(e, { name: r, fromWireType: function(i) { | ||
return i; | ||
}, toWireType: function(i, a) { | ||
return a; | ||
}, argPackAdvance: 8, readValueFromPointer: zt(r, n), destructorFunction: null }); | ||
} | ||
function Zt(e, r, t, n, i, a, s) { | ||
var o = Ie(r, t); | ||
e = R(e), i = D(n, i), _r(e, function() { | ||
be("Cannot call " + e + " due to unbound types", o); | ||
}, r - 1), B([], o, function(c) { | ||
var f = [c[0], null].concat(c.slice(1)); | ||
return gr(e, xe(e, f, null, i, a, s), r - 1), []; | ||
}); | ||
} | ||
function Gt(e, r, t) { | ||
switch (r) { | ||
case 0: | ||
return t ? function(i) { | ||
return j[i]; | ||
} : function(i) { | ||
return k[i]; | ||
}; | ||
case 1: | ||
return t ? function(i) { | ||
return z[i >> 1]; | ||
} : function(i) { | ||
return ve[i >> 1]; | ||
}; | ||
case 2: | ||
return t ? function(i) { | ||
return P[i >> 2]; | ||
} : function(i) { | ||
return A[i >> 2]; | ||
}; | ||
default: | ||
throw new TypeError("Unknown integer type: " + e); | ||
} | ||
} | ||
function qt(e, r, t, n, i) { | ||
r = R(r); | ||
var a = We(t), s = (p) => p; | ||
if (n === 0) { | ||
var o = 32 - 8 * t; | ||
s = (p) => p << o >>> o; | ||
} | ||
var c = r.includes("unsigned"), f = (p, h) => { | ||
}, v; | ||
c ? v = function(p, h) { | ||
return f(h, this.name), h >>> 0; | ||
} : v = function(p, h) { | ||
return f(h, this.name), h; | ||
}, U(e, { name: r, fromWireType: s, toWireType: v, argPackAdvance: 8, readValueFromPointer: Gt(r, a, n !== 0), destructorFunction: null }); | ||
} | ||
function Jt(e, r, t) { | ||
var n = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], i = n[r]; | ||
function a(s) { | ||
s = s >> 2; | ||
var o = A, c = o[s], f = o[s + 1]; | ||
return new i(o.buffer, f, c); | ||
} | ||
t = R(t), U(e, { name: t, fromWireType: a, argPackAdvance: 8, readValueFromPointer: a }, { ignoreDuplicateRegistrations: !0 }); | ||
} | ||
function Kt(e, r) { | ||
r = R(r); | ||
var t = r === "std::string"; | ||
U(e, { name: r, fromWireType: function(n) { | ||
var i = A[n >> 2], a = n + 4, s; | ||
if (t) | ||
for (var o = a, c = 0; c <= i; ++c) { | ||
var f = a + c; | ||
if (c == i || k[f] == 0) { | ||
var v = f - o, p = Ee(o, v); | ||
s === void 0 ? s = p : (s += String.fromCharCode(0), s += p), o = f + 1; | ||
} | ||
} | ||
else { | ||
for (var h = new Array(i), c = 0; c < i; ++c) | ||
h[c] = String.fromCharCode(k[a + c]); | ||
s = h.join(""); | ||
} | ||
return H(n), s; | ||
}, toWireType: function(n, i) { | ||
i instanceof ArrayBuffer && (i = new Uint8Array(i)); | ||
var a, s = typeof i == "string"; | ||
s || i instanceof Uint8Array || i instanceof Uint8ClampedArray || i instanceof Int8Array || m("Cannot pass non-string to std::string"), t && s ? a = Je(i) : a = i.length; | ||
var o = Ne(4 + a + 1), c = o + 4; | ||
if (A[o >> 2] = a, t && s) | ||
jr(i, c, a + 1); | ||
else if (s) | ||
for (var f = 0; f < a; ++f) { | ||
var v = i.charCodeAt(f); | ||
v > 255 && (H(c), m("String has UTF-16 code units that do not fit in 8 bits")), k[c + f] = v; | ||
} | ||
else | ||
for (var f = 0; f < a; ++f) | ||
k[c + f] = i[f]; | ||
return n !== null && n.push(H, o), o; | ||
}, argPackAdvance: 8, readValueFromPointer: re, destructorFunction: function(n) { | ||
H(n); | ||
} }); | ||
} | ||
var br = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0; | ||
function Qt(e, r) { | ||
for (var t = e, n = t >> 1, i = n + r / 2; !(n >= i) && ve[n]; ) | ||
++n; | ||
if (t = n << 1, t - e > 32 && br) | ||
return br.decode(k.subarray(e, t)); | ||
for (var a = "", s = 0; !(s >= r / 2); ++s) { | ||
var o = z[e + s * 2 >> 1]; | ||
if (o == 0) | ||
break; | ||
a += String.fromCharCode(o); | ||
} | ||
return a; | ||
} | ||
function en(e, r, t) { | ||
if (t === void 0 && (t = 2147483647), t < 2) | ||
return 0; | ||
t -= 2; | ||
for (var n = r, i = t < e.length * 2 ? t / 2 : e.length, a = 0; a < i; ++a) { | ||
var s = e.charCodeAt(a); | ||
z[r >> 1] = s, r += 2; | ||
} | ||
return z[r >> 1] = 0, r - n; | ||
} | ||
function rn(e) { | ||
return e.length * 2; | ||
} | ||
function tn(e, r) { | ||
for (var t = 0, n = ""; !(t >= r / 4); ) { | ||
var i = P[e + t * 4 >> 2]; | ||
if (i == 0) | ||
break; | ||
if (++t, i >= 65536) { | ||
var a = i - 65536; | ||
n += String.fromCharCode(55296 | a >> 10, 56320 | a & 1023); | ||
} else | ||
n += String.fromCharCode(i); | ||
} | ||
return n; | ||
} | ||
function nn(e, r, t) { | ||
if (t === void 0 && (t = 2147483647), t < 4) | ||
return 0; | ||
for (var n = r, i = n + t - 4, a = 0; a < e.length; ++a) { | ||
var s = e.charCodeAt(a); | ||
if (s >= 55296 && s <= 57343) { | ||
var o = e.charCodeAt(++a); | ||
s = 65536 + ((s & 1023) << 10) | o & 1023; | ||
} | ||
if (P[r >> 2] = s, r += 4, r + 4 > i) | ||
break; | ||
} | ||
return P[r >> 2] = 0, r - n; | ||
} | ||
function an(e) { | ||
for (var r = 0, t = 0; t < e.length; ++t) { | ||
var n = e.charCodeAt(t); | ||
n >= 55296 && n <= 57343 && ++t, r += 4; | ||
} | ||
return r; | ||
} | ||
function on(e, r, t) { | ||
t = R(t); | ||
var n, i, a, s, o; | ||
r === 2 ? (n = Qt, i = en, s = rn, a = () => ve, o = 1) : r === 4 && (n = tn, i = nn, s = an, a = () => A, o = 2), U(e, { name: t, fromWireType: function(c) { | ||
for (var f = A[c >> 2], v = a(), p, h = c + 4, _ = 0; _ <= f; ++_) { | ||
var C = c + 4 + _ * r; | ||
if (_ == f || v[C >> o] == 0) { | ||
var F = C - h, T = n(h, F); | ||
p === void 0 ? p = T : (p += String.fromCharCode(0), p += T), h = C + r; | ||
} | ||
} | ||
return H(c), p; | ||
}, toWireType: function(c, f) { | ||
typeof f != "string" && m("Cannot pass non-string to C++ string type " + t); | ||
var v = s(f), p = Ne(4 + v + r); | ||
return A[p >> 2] = v >> o, i(f, p + 4, v + r), c !== null && c.push(H, p), p; | ||
}, argPackAdvance: 8, readValueFromPointer: re, destructorFunction: function(c) { | ||
H(c); | ||
} }); | ||
} | ||
function sn(e, r, t, n, i, a) { | ||
ge[e] = { name: R(r), rawConstructor: D(t, n), rawDestructor: D(i, a), fields: [] }; | ||
} | ||
function un(e, r, t, n, i, a, s, o, c, f) { | ||
ge[e].fields.push({ fieldName: R(r), getterReturnType: t, getter: D(n, i), getterContext: a, setterArgumentType: s, setter: D(o, c), setterContext: f }); | ||
} | ||
function fn(e, r) { | ||
r = R(r), U(e, { isVoid: !0, name: r, argPackAdvance: 0, fromWireType: function() { | ||
}, toWireType: function(t, n) { | ||
} }); | ||
} | ||
function cn(e) { | ||
e > 4 && (O[e].refcount += 1); | ||
} | ||
function ln(e, r) { | ||
var t = V[e]; | ||
return t === void 0 && m(r + " has unknown type " + mr(e)), t; | ||
} | ||
function vn(e, r) { | ||
e = ln(e, "_emval_take_value"); | ||
var t = e.readValueFromPointer(r); | ||
return Pe.toHandle(t); | ||
} | ||
function dn() { | ||
X(""); | ||
} | ||
function pn(e, r, t) { | ||
k.copyWithin(e, r, r + t); | ||
} | ||
function hn() { | ||
return 2147483648; | ||
} | ||
function _n(e) { | ||
var r = le.buffer; | ||
try { | ||
return le.grow(e - r.byteLength + 65535 >>> 16), er(), 1; | ||
} catch { | ||
} | ||
} | ||
function gn(e) { | ||
var r = k.length; | ||
e = e >>> 0; | ||
var t = hn(); | ||
if (e > t) | ||
return !1; | ||
let n = (c, f) => c + (f - c % f) % f; | ||
for (var i = 1; i <= 4; i *= 2) { | ||
var a = r * (1 + 0.2 / i); | ||
a = Math.min(a, e + 100663296); | ||
var s = Math.min(t, n(Math.max(e, a), 65536)), o = _n(s); | ||
if (o) | ||
return !0; | ||
} | ||
return !1; | ||
} | ||
var Be = {}; | ||
function yn() { | ||
return ze || "./this.program"; | ||
} | ||
function oe() { | ||
if (!oe.strings) { | ||
var e = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", r = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: e, _: yn() }; | ||
for (var t in Be) | ||
Be[t] === void 0 ? delete r[t] : r[t] = Be[t]; | ||
var n = []; | ||
for (var t in r) | ||
n.push(t + "=" + r[t]); | ||
oe.strings = n; | ||
} | ||
return oe.strings; | ||
} | ||
function mn(e, r, t) { | ||
for (var n = 0; n < e.length; ++n) | ||
j[r++ >> 0] = e.charCodeAt(n); | ||
t || (j[r >> 0] = 0); | ||
} | ||
function wn(e, r) { | ||
var t = 0; | ||
return oe().forEach(function(n, i) { | ||
var a = r + t; | ||
A[e + i * 4 >> 2] = a, mn(n, a), t += n.length + 1; | ||
}), 0; | ||
} | ||
function bn(e, r) { | ||
var t = oe(); | ||
A[e >> 2] = t.length; | ||
var n = 0; | ||
return t.forEach(function(i) { | ||
n += i.length + 1; | ||
}), A[r >> 2] = n, 0; | ||
} | ||
function Pn(e) { | ||
return e; | ||
} | ||
function Ce(e) { | ||
return e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0); | ||
} | ||
function Cn(e, r) { | ||
for (var t = 0, n = 0; n <= r; t += e[n++]) | ||
; | ||
return t; | ||
} | ||
var Pr = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Cr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; | ||
function Tn(e, r) { | ||
for (var t = new Date(e.getTime()); r > 0; ) { | ||
var n = Ce(t.getFullYear()), i = t.getMonth(), a = (n ? Pr : Cr)[i]; | ||
if (r > a - t.getDate()) | ||
r -= a - t.getDate() + 1, t.setDate(1), i < 11 ? t.setMonth(i + 1) : (t.setMonth(0), t.setFullYear(t.getFullYear() + 1)); | ||
else | ||
return t.setDate(t.getDate() + r), t; | ||
} | ||
return t; | ||
} | ||
function $n(e, r, t) { | ||
var n = t > 0 ? t : Je(e) + 1, i = new Array(n), a = qe(e, i, 0, i.length); | ||
return r && (i.length = a), i; | ||
} | ||
function An(e, r) { | ||
j.set(e, r); | ||
} | ||
function Fn(e, r, t, n) { | ||
var i = P[n + 40 >> 2], a = { tm_sec: P[n >> 2], tm_min: P[n + 4 >> 2], tm_hour: P[n + 8 >> 2], tm_mday: P[n + 12 >> 2], tm_mon: P[n + 16 >> 2], tm_year: P[n + 20 >> 2], tm_wday: P[n + 24 >> 2], tm_yday: P[n + 28 >> 2], tm_isdst: P[n + 32 >> 2], tm_gmtoff: P[n + 36 >> 2], tm_zone: i ? Ee(i) : "" }, s = Ee(t), o = { "%c": "%a %b %d %H:%M:%S %Y", "%D": "%m/%d/%y", "%F": "%Y-%m-%d", "%h": "%b", "%r": "%I:%M:%S %p", "%R": "%H:%M", "%T": "%H:%M:%S", "%x": "%m/%d/%y", "%X": "%H:%M:%S", "%Ec": "%c", "%EC": "%C", "%Ex": "%m/%d/%y", "%EX": "%H:%M:%S", "%Ey": "%y", "%EY": "%Y", "%Od": "%d", "%Oe": "%e", "%OH": "%H", "%OI": "%I", "%Om": "%m", "%OM": "%M", "%OS": "%S", "%Ou": "%u", "%OU": "%U", "%OV": "%V", "%Ow": "%w", "%OW": "%W", "%Oy": "%y" }; | ||
for (var c in o) | ||
s = s.replace(new RegExp(c, "g"), o[c]); | ||
var f = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], v = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; | ||
function p(l, d, S) { | ||
for (var E = typeof l == "number" ? l.toString() : l || ""; E.length < d; ) | ||
E = S[0] + E; | ||
return E; | ||
} | ||
function h(l, d) { | ||
return p(l, d, "0"); | ||
} | ||
function _(l, d) { | ||
function S(N) { | ||
return N < 0 ? -1 : N > 0 ? 1 : 0; | ||
} | ||
var E; | ||
return (E = S(l.getFullYear() - d.getFullYear())) === 0 && (E = S(l.getMonth() - d.getMonth())) === 0 && (E = S(l.getDate() - d.getDate())), E; | ||
} | ||
function C(l) { | ||
switch (l.getDay()) { | ||
case 0: | ||
return new Date(l.getFullYear() - 1, 11, 29); | ||
case 1: | ||
return l; | ||
case 2: | ||
return new Date(l.getFullYear(), 0, 3); | ||
case 3: | ||
return new Date(l.getFullYear(), 0, 2); | ||
case 4: | ||
return new Date(l.getFullYear(), 0, 1); | ||
case 5: | ||
return new Date(l.getFullYear() - 1, 11, 31); | ||
case 6: | ||
return new Date(l.getFullYear() - 1, 11, 30); | ||
} | ||
} | ||
function F(l) { | ||
var d = Tn(new Date(l.tm_year + 1900, 0, 1), l.tm_yday), S = new Date(d.getFullYear(), 0, 4), E = new Date(d.getFullYear() + 1, 0, 4), N = C(S), $e = C(E); | ||
return _(N, d) <= 0 ? _($e, d) <= 0 ? d.getFullYear() + 1 : d.getFullYear() : d.getFullYear() - 1; | ||
} | ||
var T = { "%a": function(l) { | ||
return f[l.tm_wday].substring(0, 3); | ||
}, "%A": function(l) { | ||
return f[l.tm_wday]; | ||
}, "%b": function(l) { | ||
return v[l.tm_mon].substring(0, 3); | ||
}, "%B": function(l) { | ||
return v[l.tm_mon]; | ||
}, "%C": function(l) { | ||
var d = l.tm_year + 1900; | ||
return h(d / 100 | 0, 2); | ||
}, "%d": function(l) { | ||
return h(l.tm_mday, 2); | ||
}, "%e": function(l) { | ||
return p(l.tm_mday, 2, " "); | ||
}, "%g": function(l) { | ||
return F(l).toString().substring(2); | ||
}, "%G": function(l) { | ||
return F(l); | ||
}, "%H": function(l) { | ||
return h(l.tm_hour, 2); | ||
}, "%I": function(l) { | ||
var d = l.tm_hour; | ||
return d == 0 ? d = 12 : d > 12 && (d -= 12), h(d, 2); | ||
}, "%j": function(l) { | ||
return h(l.tm_mday + Cn(Ce(l.tm_year + 1900) ? Pr : Cr, l.tm_mon - 1), 3); | ||
}, "%m": function(l) { | ||
return h(l.tm_mon + 1, 2); | ||
}, "%M": function(l) { | ||
return h(l.tm_min, 2); | ||
}, "%n": function() { | ||
return ` | ||
`; | ||
}, "%p": function(l) { | ||
return l.tm_hour >= 0 && l.tm_hour < 12 ? "AM" : "PM"; | ||
}, "%S": function(l) { | ||
return h(l.tm_sec, 2); | ||
}, "%t": function() { | ||
return " "; | ||
}, "%u": function(l) { | ||
return l.tm_wday || 7; | ||
}, "%U": function(l) { | ||
var d = l.tm_yday + 7 - l.tm_wday; | ||
return h(Math.floor(d / 7), 2); | ||
}, "%V": function(l) { | ||
var d = Math.floor((l.tm_yday + 7 - (l.tm_wday + 6) % 7) / 7); | ||
if ((l.tm_wday + 371 - l.tm_yday - 2) % 7 <= 2 && d++, d) { | ||
if (d == 53) { | ||
var E = (l.tm_wday + 371 - l.tm_yday) % 7; | ||
E != 4 && (E != 3 || !Ce(l.tm_year)) && (d = 1); | ||
} | ||
} else { | ||
d = 52; | ||
var S = (l.tm_wday + 7 - l.tm_yday - 1) % 7; | ||
(S == 4 || S == 5 && Ce(l.tm_year % 400 - 1)) && d++; | ||
} | ||
return h(d, 2); | ||
}, "%w": function(l) { | ||
return l.tm_wday; | ||
}, "%W": function(l) { | ||
var d = l.tm_yday + 7 - (l.tm_wday + 6) % 7; | ||
return h(Math.floor(d / 7), 2); | ||
}, "%y": function(l) { | ||
return (l.tm_year + 1900).toString().substring(2); | ||
}, "%Y": function(l) { | ||
return l.tm_year + 1900; | ||
}, "%z": function(l) { | ||
var d = l.tm_gmtoff, S = d >= 0; | ||
return d = Math.abs(d) / 60, d = d / 60 * 100 + d % 60, (S ? "+" : "-") + ("0000" + d).slice(-4); | ||
}, "%Z": function(l) { | ||
return l.tm_zone; | ||
}, "%%": function() { | ||
return "%"; | ||
} }; | ||
s = s.replace(/%%/g, "\0\0"); | ||
for (var c in T) | ||
s.includes(c) && (s = s.replace(new RegExp(c, "g"), T[c](a))); | ||
s = s.replace(/\0\0/g, "%"); | ||
var $ = $n(s, !1); | ||
return $.length > r ? 0 : (An($, e), $.length - 1); | ||
} | ||
function En(e, r, t, n, i) { | ||
return Fn(e, r, t, n); | ||
} | ||
fr = u.InternalError = Oe(Error, "InternalError"), ct(), q = u.BindingError = Oe(Error, "BindingError"), At(), yt(), Wt(), yr = u.UnboundTypeError = Oe(Error, "UnboundTypeError"), Nt(); | ||
var Rn = { q: Gr, v: Jr, a: Qr, h: et, m: rt, I: tt, R: nt, n: it, Z: at, d: Kr, la: ut, U: ft, ba: lt, ka: Ht, ja: xt, D: Yt, aa: Lt, Q: Xt, S: Zt, x: qt, s: Jt, P: Kt, K: on, N: sn, ma: un, ca: fn, ga: wr, ha: cn, ia: vn, J: dn, $: pn, _: gn, X: wn, Y: bn, H: Xn, O: ti, B: Zn, o: Ln, b: Sn, C: zn, ea: qn, c: Wn, i: Yn, j: Bn, r: Vn, w: Nn, G: Kn, M: Qn, A: Gn, F: ni, V: ai, T: oi, k: jn, g: On, e: Dn, f: kn, L: ri, l: Un, p: Mn, fa: In, t: xn, da: ei, z: Jn, u: Hn, E: ii, y: Pn, W: En }; | ||
Xr(); | ||
var H = u._free = function() { | ||
return (H = u._free = u.asm.pa).apply(null, arguments); | ||
}, Ne = u._malloc = function() { | ||
return (Ne = u._malloc = u.asm.qa).apply(null, arguments); | ||
}, Tr = function() { | ||
return (Tr = u.asm.ra).apply(null, arguments); | ||
}, $r = u.___getTypeName = function() { | ||
return ($r = u.___getTypeName = u.asm.ta).apply(null, arguments); | ||
}; | ||
u.__embind_initialize_bindings = function() { | ||
return (u.__embind_initialize_bindings = u.asm.ua).apply(null, arguments); | ||
}; | ||
var g = function() { | ||
return (g = u.asm.va).apply(null, arguments); | ||
}, se = function() { | ||
return (se = u.asm.wa).apply(null, arguments); | ||
}, w = function() { | ||
return (w = u.asm.xa).apply(null, arguments); | ||
}, b = function() { | ||
return (b = u.asm.ya).apply(null, arguments); | ||
}, Ar = function() { | ||
return (Ar = u.asm.za).apply(null, arguments); | ||
}, Fr = function() { | ||
return (Fr = u.asm.Aa).apply(null, arguments); | ||
}; | ||
u.dynCall_viijii = function() { | ||
return (u.dynCall_viijii = u.asm.Ba).apply(null, arguments); | ||
}; | ||
var Er = u.dynCall_jiii = function() { | ||
return (Er = u.dynCall_jiii = u.asm.Ca).apply(null, arguments); | ||
}, Rr = u.dynCall_jiiii = function() { | ||
return (Rr = u.dynCall_jiiii = u.asm.Da).apply(null, arguments); | ||
}; | ||
u.dynCall_iiiiij = function() { | ||
return (u.dynCall_iiiiij = u.asm.Ea).apply(null, arguments); | ||
}, u.dynCall_iiiiijj = function() { | ||
return (u.dynCall_iiiiijj = u.asm.Fa).apply(null, arguments); | ||
}, u.dynCall_iiiiiijj = function() { | ||
return (u.dynCall_iiiiiijj = u.asm.Ga).apply(null, arguments); | ||
}; | ||
function Sn(e, r) { | ||
var t = w(); | ||
try { | ||
return y(e)(r); | ||
} catch (n) { | ||
if (b(t), n !== n + 0) | ||
throw n; | ||
g(1, 0); | ||
} | ||
} | ||
function kn(e, r, t, n) { | ||
var i = w(); | ||
try { | ||
y(e)(r, t, n); | ||
} catch (a) { | ||
if (b(i), a !== a + 0) | ||
throw a; | ||
g(1, 0); | ||
} | ||
} | ||
function Dn(e, r, t) { | ||
var n = w(); | ||
try { | ||
y(e)(r, t); | ||
} catch (i) { | ||
if (b(n), i !== i + 0) | ||
throw i; | ||
g(1, 0); | ||
} | ||
} | ||
function On(e, r) { | ||
var t = w(); | ||
try { | ||
y(e)(r); | ||
} catch (n) { | ||
if (b(t), n !== n + 0) | ||
throw n; | ||
g(1, 0); | ||
} | ||
} | ||
function Wn(e, r, t) { | ||
var n = w(); | ||
try { | ||
return y(e)(r, t); | ||
} catch (i) { | ||
if (b(n), i !== i + 0) | ||
throw i; | ||
g(1, 0); | ||
} | ||
} | ||
function jn(e) { | ||
var r = w(); | ||
try { | ||
y(e)(); | ||
} catch (t) { | ||
if (b(r), t !== t + 0) | ||
throw t; | ||
g(1, 0); | ||
} | ||
} | ||
function Un(e, r, t, n, i) { | ||
var a = w(); | ||
try { | ||
y(e)(r, t, n, i); | ||
} catch (s) { | ||
if (b(a), s !== s + 0) | ||
throw s; | ||
g(1, 0); | ||
} | ||
} | ||
function Mn(e, r, t, n, i, a) { | ||
var s = w(); | ||
try { | ||
y(e)(r, t, n, i, a); | ||
} catch (o) { | ||
if (b(s), o !== o + 0) | ||
throw o; | ||
g(1, 0); | ||
} | ||
} | ||
function Hn(e, r, t, n, i, a, s, o, c, f, v) { | ||
var p = w(); | ||
try { | ||
y(e)(r, t, n, i, a, s, o, c, f, v); | ||
} catch (h) { | ||
if (b(p), h !== h + 0) | ||
throw h; | ||
g(1, 0); | ||
} | ||
} | ||
function In(e, r, t, n, i, a, s) { | ||
var o = w(); | ||
try { | ||
y(e)(r, t, n, i, a, s); | ||
} catch (c) { | ||
if (b(o), c !== c + 0) | ||
throw c; | ||
g(1, 0); | ||
} | ||
} | ||
function xn(e, r, t, n, i, a, s, o) { | ||
var c = w(); | ||
try { | ||
y(e)(r, t, n, i, a, s, o); | ||
} catch (f) { | ||
if (b(c), f !== f + 0) | ||
throw f; | ||
g(1, 0); | ||
} | ||
} | ||
function Yn(e, r, t, n) { | ||
var i = w(); | ||
try { | ||
return y(e)(r, t, n); | ||
} catch (a) { | ||
if (b(i), a !== a + 0) | ||
throw a; | ||
g(1, 0); | ||
} | ||
} | ||
function Vn(e, r, t, n, i, a) { | ||
var s = w(); | ||
try { | ||
return y(e)(r, t, n, i, a); | ||
} catch (o) { | ||
if (b(s), o !== o + 0) | ||
throw o; | ||
g(1, 0); | ||
} | ||
} | ||
function Bn(e, r, t, n, i) { | ||
var a = w(); | ||
try { | ||
return y(e)(r, t, n, i); | ||
} catch (s) { | ||
if (b(a), s !== s + 0) | ||
throw s; | ||
g(1, 0); | ||
} | ||
} | ||
function Nn(e, r, t, n, i, a, s) { | ||
var o = w(); | ||
try { | ||
return y(e)(r, t, n, i, a, s); | ||
} catch (c) { | ||
if (b(o), c !== c + 0) | ||
throw c; | ||
g(1, 0); | ||
} | ||
} | ||
function Ln(e) { | ||
var r = w(); | ||
try { | ||
return y(e)(); | ||
} catch (t) { | ||
if (b(r), t !== t + 0) | ||
throw t; | ||
g(1, 0); | ||
} | ||
} | ||
function zn(e, r, t, n) { | ||
var i = w(); | ||
try { | ||
return y(e)(r, t, n); | ||
} catch (a) { | ||
if (b(i), a !== a + 0) | ||
throw a; | ||
g(1, 0); | ||
} | ||
} | ||
function Xn(e, r, t, n) { | ||
var i = w(); | ||
try { | ||
return y(e)(r, t, n); | ||
} catch (a) { | ||
if (b(i), a !== a + 0) | ||
throw a; | ||
g(1, 0); | ||
} | ||
} | ||
function Zn(e, r, t, n, i, a) { | ||
var s = w(); | ||
try { | ||
return y(e)(r, t, n, i, a); | ||
} catch (o) { | ||
if (b(s), o !== o + 0) | ||
throw o; | ||
g(1, 0); | ||
} | ||
} | ||
function Gn(e, r, t, n, i, a, s, o, c, f) { | ||
var v = w(); | ||
try { | ||
return y(e)(r, t, n, i, a, s, o, c, f); | ||
} catch (p) { | ||
if (b(v), p !== p + 0) | ||
throw p; | ||
g(1, 0); | ||
} | ||
} | ||
function qn(e, r, t) { | ||
var n = w(); | ||
try { | ||
return y(e)(r, t); | ||
} catch (i) { | ||
if (b(n), i !== i + 0) | ||
throw i; | ||
g(1, 0); | ||
} | ||
} | ||
function Jn(e, r, t, n, i, a, s, o, c, f) { | ||
var v = w(); | ||
try { | ||
y(e)(r, t, n, i, a, s, o, c, f); | ||
} catch (p) { | ||
if (b(v), p !== p + 0) | ||
throw p; | ||
g(1, 0); | ||
} | ||
} | ||
function Kn(e, r, t, n, i, a, s, o) { | ||
var c = w(); | ||
try { | ||
return y(e)(r, t, n, i, a, s, o); | ||
} catch (f) { | ||
if (b(c), f !== f + 0) | ||
throw f; | ||
g(1, 0); | ||
} | ||
} | ||
function Qn(e, r, t, n, i, a, s, o, c) { | ||
var f = w(); | ||
try { | ||
return y(e)(r, t, n, i, a, s, o, c); | ||
} catch (v) { | ||
if (b(f), v !== v + 0) | ||
throw v; | ||
g(1, 0); | ||
} | ||
} | ||
function ei(e, r, t, n, i, a, s, o, c) { | ||
var f = w(); | ||
try { | ||
y(e)(r, t, n, i, a, s, o, c); | ||
} catch (v) { | ||
if (b(f), v !== v + 0) | ||
throw v; | ||
g(1, 0); | ||
} | ||
} | ||
function ri(e, r, t, n, i, a, s) { | ||
var o = w(); | ||
try { | ||
y(e)(r, t, n, i, a, s); | ||
} catch (c) { | ||
if (b(o), c !== c + 0) | ||
throw c; | ||
g(1, 0); | ||
} | ||
} | ||
function ti(e, r, t, n) { | ||
var i = w(); | ||
try { | ||
return y(e)(r, t, n); | ||
} catch (a) { | ||
if (b(i), a !== a + 0) | ||
throw a; | ||
g(1, 0); | ||
} | ||
} | ||
function ni(e, r, t, n, i, a, s, o, c, f, v, p) { | ||
var h = w(); | ||
try { | ||
return y(e)(r, t, n, i, a, s, o, c, f, v, p); | ||
} catch (_) { | ||
if (b(h), _ !== _ + 0) | ||
throw _; | ||
g(1, 0); | ||
} | ||
} | ||
function ii(e, r, t, n, i, a, s, o, c, f, v, p, h, _, C, F) { | ||
var T = w(); | ||
try { | ||
y(e)(r, t, n, i, a, s, o, c, f, v, p, h, _, C, F); | ||
} catch ($) { | ||
if (b(T), $ !== $ + 0) | ||
throw $; | ||
g(1, 0); | ||
} | ||
} | ||
function ai(e, r, t, n) { | ||
var i = w(); | ||
try { | ||
return Er(e, r, t, n); | ||
} catch (a) { | ||
if (b(i), a !== a + 0) | ||
throw a; | ||
g(1, 0); | ||
} | ||
} | ||
function oi(e, r, t, n, i) { | ||
var a = w(); | ||
try { | ||
return Rr(e, r, t, n, i); | ||
} catch (s) { | ||
if (b(a), s !== s + 0) | ||
throw s; | ||
g(1, 0); | ||
} | ||
} | ||
var Te; | ||
ee = function e() { | ||
Te || Sr(), Te || (ee = e); | ||
}; | ||
function Sr() { | ||
if (x > 0 || (Ur(), x > 0)) | ||
return; | ||
function e() { | ||
Te || (Te = !0, u.calledRun = !0, !Ze && (Mr(), ue(u), u.onRuntimeInitialized && u.onRuntimeInitialized(), Hr())); | ||
} | ||
u.setStatus ? (u.setStatus("Running..."), setTimeout(function() { | ||
setTimeout(function() { | ||
u.setStatus(""); | ||
}, 1), e(); | ||
}, 1)) : e(); | ||
} | ||
if (u.preInit) | ||
for (typeof u.preInit == "function" && (u.preInit = [u.preInit]); u.preInit.length > 0; ) | ||
u.preInit.pop()(); | ||
return Sr(), J.ready; | ||
}; | ||
})(); | ||
function ci(L) { | ||
return si(kr, L); | ||
} | ||
async function I(a, { | ||
tryHarder: e = r.tryHarder, | ||
formats: o = r.formats, | ||
maxNumberOfSymbols: t = r.maxNumberOfSymbols | ||
} = r) { | ||
return i( | ||
a, | ||
async function li(L, { | ||
tryHarder: J = Ae.tryHarder, | ||
formats: u = Ae.formats, | ||
maxNumberOfSymbols: ue = Ae.maxNumberOfSymbols | ||
} = Ae) { | ||
return ui( | ||
L, | ||
{ | ||
tryHarder: e, | ||
formats: o, | ||
maxNumberOfSymbols: t | ||
tryHarder: J, | ||
formats: u, | ||
maxNumberOfSymbols: ue | ||
}, | ||
m | ||
kr | ||
); | ||
} | ||
export { | ||
X as ZXING_BARCODE_FORMAT_NAMES, | ||
Z as ZXING_CHARACTOR_SET_NAMES, | ||
r as defaultZXingReadOptions, | ||
l as defaultZXingWriteOptions, | ||
s as getZXingInstance, | ||
I as readBarcodeFromImageData, | ||
f as readBarcodeFromImageFile | ||
pi as ZXING_BARCODE_FORMAT_NAMES, | ||
hi as ZXING_CHARACTOR_SET_NAMES, | ||
Ae as defaultZXingReadOptions, | ||
_i as defaultZXingWriteOptions, | ||
ci as getZXingModule, | ||
gi as purgeZXingModule, | ||
li as readBarcodeFromImageFile, | ||
yi as setZXingModuleOverrides | ||
}; |
@@ -1,3 +0,3 @@ | ||
import { ZXingWasm } from "../ZXing.js"; | ||
declare var ZXing: ZXingWasm; | ||
import { ZXingModuleFactory } from "../core.js"; | ||
declare var ZXing: ZXingModuleFactory<"reader">; | ||
export default ZXing; |
@@ -1,4 +0,5 @@ | ||
import { ZXingWriteOptions, ZXingWriteResult } from "../ZXing.js"; | ||
export declare function getZXingInstance(): Promise<import("../ZXing.js").ZXingInstance>; | ||
export declare function writeBarcodeToImageFile(text: string, { format, charset, quietZone, width, height, eccLevel, }?: ZXingWriteOptions): Promise<ZXingWriteResult>; | ||
import zxingModuleFactory from "./zxing_writer.js"; | ||
import { ZXingModuleFactoryTypeExtractor, ZXingModuleOverrides, getZXingModule as _getZXingModule, ZXingWriteOptions, ZXingWriteOutput } from "../core.js"; | ||
export declare function getZXingModule(zxingModuleOverrides?: ZXingModuleOverrides<ZXingModuleFactoryTypeExtractor<typeof zxingModuleFactory>>): ReturnType<typeof _getZXingModule>; | ||
export declare function writeBarcodeToImageFile(text: string, { format, charset, quietZone, width, height, eccLevel, }?: ZXingWriteOptions): Promise<ZXingWriteOutput>; | ||
export * from "../exposed.js"; |
@@ -1,35 +0,1301 @@ | ||
import t from "./zxing_writer.js"; | ||
import { getZXingInstance as m, writeBarcodeToImageFile as s, defaultZXingWriteOptions as e } from "../ZXing.js"; | ||
import { ZXING_BARCODE_FORMAT_NAMES as l, ZXING_CHARACTOR_SET_NAMES as p, defaultZXingReadOptions as A } from "../ZXing.js"; | ||
function I() { | ||
return m(t); | ||
import { g as yn, w as mn, b as V } from "../core-9bc51fdd.js"; | ||
import { Z as $n, a as An, d as Rn, p as Fn, s as En } from "../core-9bc51fdd.js"; | ||
var ht = (() => { | ||
var B = import.meta.url; | ||
return function(z = {}) { | ||
var o = typeof z < "u" ? z : {}, ie, L; | ||
o.ready = new Promise(function(e, t) { | ||
ie = e, L = t; | ||
}); | ||
var ae = Object.assign({}, o), oe = typeof window == "object", se = typeof importScripts == "function"; | ||
typeof process == "object" && typeof process.versions == "object" && process.versions.node; | ||
var E = ""; | ||
function gt(e) { | ||
return o.locateFile ? o.locateFile(e, E) : E + e; | ||
} | ||
var Pe; | ||
(oe || se) && (se ? E = self.location.href : typeof document < "u" && document.currentScript && (E = document.currentScript.src), B && (E = B), E.indexOf("blob:") !== 0 ? E = E.substr(0, E.replace(/[?#].*/, "").lastIndexOf("/") + 1) : E = "", se && (Pe = (e) => { | ||
var t = new XMLHttpRequest(); | ||
return t.open("GET", e, !1), t.responseType = "arraybuffer", t.send(null), new Uint8Array(t.response); | ||
})), o.print || console.log.bind(console); | ||
var q = o.printErr || console.warn.bind(console); | ||
Object.assign(o, ae), ae = null, o.arguments && o.arguments, o.thisProgram && o.thisProgram, o.quit && o.quit; | ||
var G; | ||
o.wasmBinary && (G = o.wasmBinary), o.noExitRuntime, typeof WebAssembly != "object" && Q("no native wasm support detected"); | ||
var ue, Ue = !1, Ie = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0; | ||
function _t(e, t, r) { | ||
for (var n = t + r, i = t; e[i] && !(i >= n); ) | ||
++i; | ||
if (i - t > 16 && e.buffer && Ie) | ||
return Ie.decode(e.subarray(t, i)); | ||
for (var a = ""; t < i; ) { | ||
var u = e[t++]; | ||
if (!(u & 128)) { | ||
a += String.fromCharCode(u); | ||
continue; | ||
} | ||
var s = e[t++] & 63; | ||
if ((u & 224) == 192) { | ||
a += String.fromCharCode((u & 31) << 6 | s); | ||
continue; | ||
} | ||
var c = e[t++] & 63; | ||
if ((u & 240) == 224 ? u = (u & 15) << 12 | s << 6 | c : u = (u & 7) << 18 | s << 12 | c << 6 | e[t++] & 63, u < 65536) | ||
a += String.fromCharCode(u); | ||
else { | ||
var f = u - 65536; | ||
a += String.fromCharCode(55296 | f >> 10, 56320 | f & 1023); | ||
} | ||
} | ||
return a; | ||
} | ||
function yt(e, t) { | ||
return e ? _t(P, e, t) : ""; | ||
} | ||
function mt(e, t, r, n) { | ||
if (!(n > 0)) | ||
return 0; | ||
for (var i = r, a = r + n - 1, u = 0; u < e.length; ++u) { | ||
var s = e.charCodeAt(u); | ||
if (s >= 55296 && s <= 57343) { | ||
var c = e.charCodeAt(++u); | ||
s = 65536 + ((s & 1023) << 10) | c & 1023; | ||
} | ||
if (s <= 127) { | ||
if (r >= a) | ||
break; | ||
t[r++] = s; | ||
} else if (s <= 2047) { | ||
if (r + 1 >= a) | ||
break; | ||
t[r++] = 192 | s >> 6, t[r++] = 128 | s & 63; | ||
} else if (s <= 65535) { | ||
if (r + 2 >= a) | ||
break; | ||
t[r++] = 224 | s >> 12, t[r++] = 128 | s >> 6 & 63, t[r++] = 128 | s & 63; | ||
} else { | ||
if (r + 3 >= a) | ||
break; | ||
t[r++] = 240 | s >> 18, t[r++] = 128 | s >> 12 & 63, t[r++] = 128 | s >> 6 & 63, t[r++] = 128 | s & 63; | ||
} | ||
} | ||
return t[r] = 0, r - i; | ||
} | ||
function wt(e, t, r) { | ||
return mt(e, P, t, r); | ||
} | ||
function Pt(e) { | ||
for (var t = 0, r = 0; r < e.length; ++r) { | ||
var n = e.charCodeAt(r); | ||
n <= 127 ? t++ : n <= 2047 ? t += 2 : n >= 55296 && n <= 57343 ? (t += 4, ++r) : t += 3; | ||
} | ||
return t; | ||
} | ||
var U, P, N, fe, C, _, je, He; | ||
function Me() { | ||
var e = ue.buffer; | ||
o.HEAP8 = U = new Int8Array(e), o.HEAP16 = N = new Int16Array(e), o.HEAP32 = C = new Int32Array(e), o.HEAPU8 = P = new Uint8Array(e), o.HEAPU16 = fe = new Uint16Array(e), o.HEAPU32 = _ = new Uint32Array(e), o.HEAPF32 = je = new Float32Array(e), o.HEAPF64 = He = new Float64Array(e); | ||
} | ||
var xe, Ve = [], Be = [], Le = []; | ||
function bt() { | ||
if (o.preRun) | ||
for (typeof o.preRun == "function" && (o.preRun = [o.preRun]); o.preRun.length; ) | ||
$t(o.preRun.shift()); | ||
be(Ve); | ||
} | ||
function Tt() { | ||
be(Be); | ||
} | ||
function Ct() { | ||
if (o.postRun) | ||
for (typeof o.postRun == "function" && (o.postRun = [o.postRun]); o.postRun.length; ) | ||
Rt(o.postRun.shift()); | ||
be(Le); | ||
} | ||
function $t(e) { | ||
Ve.unshift(e); | ||
} | ||
function At(e) { | ||
Be.unshift(e); | ||
} | ||
function Rt(e) { | ||
Le.unshift(e); | ||
} | ||
var I = 0, K = null; | ||
function Ft(e) { | ||
I++, o.monitorRunDependencies && o.monitorRunDependencies(I); | ||
} | ||
function Et(e) { | ||
if (I--, o.monitorRunDependencies && o.monitorRunDependencies(I), I == 0 && K) { | ||
var t = K; | ||
K = null, t(); | ||
} | ||
} | ||
function Q(e) { | ||
o.onAbort && o.onAbort(e), e = "Aborted(" + e + ")", q(e), Ue = !0, e += ". Build with -sASSERTIONS for more info."; | ||
var t = new WebAssembly.RuntimeError(e); | ||
throw L(t), t; | ||
} | ||
var kt = "data:application/octet-stream;base64,"; | ||
function Ne(e) { | ||
return e.startsWith(kt); | ||
} | ||
var j; | ||
o.locateFile ? (j = "zxing_writer.wasm", Ne(j) || (j = gt(j))) : j = new URL("/writer/zxing_writer.wasm", self.location).href; | ||
function Ze(e) { | ||
try { | ||
if (e == j && G) | ||
return new Uint8Array(G); | ||
if (Pe) | ||
return Pe(e); | ||
throw "both async and sync fetching of the wasm failed"; | ||
} catch (t) { | ||
Q(t); | ||
} | ||
} | ||
function St(e) { | ||
return !G && (oe || se) && typeof fetch == "function" ? fetch(e, { credentials: "same-origin" }).then(function(t) { | ||
if (!t.ok) | ||
throw "failed to load wasm binary file at '" + e + "'"; | ||
return t.arrayBuffer(); | ||
}).catch(function() { | ||
return Ze(e); | ||
}) : Promise.resolve().then(function() { | ||
return Ze(e); | ||
}); | ||
} | ||
function Xe(e, t, r) { | ||
return St(e).then(function(n) { | ||
return WebAssembly.instantiate(n, t); | ||
}).then(function(n) { | ||
return n; | ||
}).then(r, function(n) { | ||
q("failed to asynchronously prepare wasm: " + n), Q(n); | ||
}); | ||
} | ||
function Ot(e, t, r, n) { | ||
return !e && typeof WebAssembly.instantiateStreaming == "function" && !Ne(t) && typeof fetch == "function" ? fetch(t, { credentials: "same-origin" }).then(function(i) { | ||
var a = WebAssembly.instantiateStreaming(i, r); | ||
return a.then(n, function(u) { | ||
return q("wasm streaming compile failed: " + u), q("falling back to ArrayBuffer instantiation"), Xe(t, r, n); | ||
}); | ||
}) : Xe(t, r, n); | ||
} | ||
function Dt() { | ||
var e = { a: tn }; | ||
function t(n, i) { | ||
var a = n.exports; | ||
return o.asm = a, ue = o.asm.P, Me(), xe = o.asm.U, At(o.asm.Q), Et(), a; | ||
} | ||
Ft(); | ||
function r(n) { | ||
t(n.instance); | ||
} | ||
if (o.instantiateWasm) | ||
try { | ||
return o.instantiateWasm(e, t); | ||
} catch (n) { | ||
q("Module.instantiateWasm callback failed with error: " + n), L(n); | ||
} | ||
return Ot(G, j, e, r).catch(L), {}; | ||
} | ||
function be(e) { | ||
for (; e.length > 0; ) | ||
e.shift()(o); | ||
} | ||
var ce = []; | ||
function Wt(e) { | ||
e.add_ref(); | ||
} | ||
function Ut(e) { | ||
var t = new Te(e); | ||
return t.get_caught() || t.set_caught(!0), t.set_rethrown(!1), ce.push(t), Wt(t), t.get_exception_ptr(); | ||
} | ||
var Z = 0, le = []; | ||
function g(e) { | ||
var t = le[e]; | ||
return t || (e >= le.length && (le.length = e + 1), le[e] = t = xe.get(e)), t; | ||
} | ||
function It(e) { | ||
if (e.release_ref() && !e.get_rethrown()) { | ||
var t = e.get_destructor(); | ||
t && g(t)(e.excPtr), st(e.excPtr); | ||
} | ||
} | ||
function jt() { | ||
y(0); | ||
var e = ce.pop(); | ||
It(e), Z = 0; | ||
} | ||
function Te(e) { | ||
this.excPtr = e, this.ptr = e - 24, this.set_type = function(t) { | ||
_[this.ptr + 4 >> 2] = t; | ||
}, this.get_type = function() { | ||
return _[this.ptr + 4 >> 2]; | ||
}, this.set_destructor = function(t) { | ||
_[this.ptr + 8 >> 2] = t; | ||
}, this.get_destructor = function() { | ||
return _[this.ptr + 8 >> 2]; | ||
}, this.set_refcount = function(t) { | ||
C[this.ptr >> 2] = t; | ||
}, this.set_caught = function(t) { | ||
t = t ? 1 : 0, U[this.ptr + 12 >> 0] = t; | ||
}, this.get_caught = function() { | ||
return U[this.ptr + 12 >> 0] != 0; | ||
}, this.set_rethrown = function(t) { | ||
t = t ? 1 : 0, U[this.ptr + 13 >> 0] = t; | ||
}, this.get_rethrown = function() { | ||
return U[this.ptr + 13 >> 0] != 0; | ||
}, this.init = function(t, r) { | ||
this.set_adjusted_ptr(0), this.set_type(t), this.set_destructor(r), this.set_refcount(0), this.set_caught(!1), this.set_rethrown(!1); | ||
}, this.add_ref = function() { | ||
var t = C[this.ptr >> 2]; | ||
C[this.ptr >> 2] = t + 1; | ||
}, this.release_ref = function() { | ||
var t = C[this.ptr >> 2]; | ||
return C[this.ptr >> 2] = t - 1, t === 1; | ||
}, this.set_adjusted_ptr = function(t) { | ||
_[this.ptr + 16 >> 2] = t; | ||
}, this.get_adjusted_ptr = function() { | ||
return _[this.ptr + 16 >> 2]; | ||
}, this.get_exception_ptr = function() { | ||
var t = ct(this.get_type()); | ||
if (t) | ||
return _[this.excPtr >> 2]; | ||
var r = this.get_adjusted_ptr(); | ||
return r !== 0 ? r : this.excPtr; | ||
}; | ||
} | ||
function Ht(e) { | ||
throw Z || (Z = e), e; | ||
} | ||
function Ce() { | ||
var e = Z; | ||
if (!e) | ||
return ne(0), 0; | ||
var t = new Te(e); | ||
t.set_adjusted_ptr(e); | ||
var r = t.get_type(); | ||
if (!r) | ||
return ne(0), e; | ||
for (var n = 0; n < arguments.length; n++) { | ||
var i = arguments[n]; | ||
if (i === 0 || i === r) | ||
break; | ||
var a = t.ptr + 16; | ||
if (ft(i, r, a)) | ||
return ne(i), e; | ||
} | ||
return ne(r), e; | ||
} | ||
var Mt = Ce, xt = Ce, Vt = Ce; | ||
function Bt() { | ||
var e = ce.pop(); | ||
e || Q("no exception to throw"); | ||
var t = e.excPtr; | ||
throw e.get_rethrown() || (ce.push(e), e.set_rethrown(!0), e.set_caught(!1)), Z = t, t; | ||
} | ||
function Lt(e, t, r) { | ||
var n = new Te(e); | ||
throw n.init(t, r), Z = e, e; | ||
} | ||
function Nt(e, t, r, n, i) { | ||
} | ||
function $e(e) { | ||
switch (e) { | ||
case 1: | ||
return 0; | ||
case 2: | ||
return 1; | ||
case 4: | ||
return 2; | ||
case 8: | ||
return 3; | ||
default: | ||
throw new TypeError("Unknown type size: " + e); | ||
} | ||
} | ||
function Zt() { | ||
for (var e = new Array(256), t = 0; t < 256; ++t) | ||
e[t] = String.fromCharCode(t); | ||
ze = e; | ||
} | ||
var ze = void 0; | ||
function b(e) { | ||
for (var t = "", r = e; P[r]; ) | ||
t += ze[P[r++]]; | ||
return t; | ||
} | ||
var X = {}, H = {}, pe = {}, Xt = 48, zt = 57; | ||
function Ae(e) { | ||
if (e === void 0) | ||
return "_unknown"; | ||
e = e.replace(/[^a-zA-Z0-9_]/g, "$"); | ||
var t = e.charCodeAt(0); | ||
return t >= Xt && t <= zt ? "_" + e : e; | ||
} | ||
function Re(e, t) { | ||
return e = Ae(e), { [e]: function() { | ||
return t.apply(this, arguments); | ||
} }[e]; | ||
} | ||
function Fe(e, t) { | ||
var r = Re(t, function(n) { | ||
this.name = t, this.message = n; | ||
var i = new Error(n).stack; | ||
i !== void 0 && (this.stack = this.toString() + ` | ||
` + i.replace(/^Error(:[^\n]*)?\n/, "")); | ||
}); | ||
return r.prototype = Object.create(e.prototype), r.prototype.constructor = r, r.prototype.toString = function() { | ||
return this.message === void 0 ? this.name : this.name + ": " + this.message; | ||
}, r; | ||
} | ||
var J = void 0; | ||
function p(e) { | ||
throw new J(e); | ||
} | ||
var qe = void 0; | ||
function de(e) { | ||
throw new qe(e); | ||
} | ||
function ve(e, t, r) { | ||
e.forEach(function(s) { | ||
pe[s] = t; | ||
}); | ||
function n(s) { | ||
var c = r(s); | ||
c.length !== e.length && de("Mismatched type converter count"); | ||
for (var f = 0; f < e.length; ++f) | ||
k(e[f], c[f]); | ||
} | ||
var i = new Array(t.length), a = [], u = 0; | ||
t.forEach((s, c) => { | ||
H.hasOwnProperty(s) ? i[c] = H[s] : (a.push(s), X.hasOwnProperty(s) || (X[s] = []), X[s].push(() => { | ||
i[c] = H[s], ++u, u === a.length && n(i); | ||
})); | ||
}), a.length === 0 && n(i); | ||
} | ||
function k(e, t, r = {}) { | ||
if (!("argPackAdvance" in t)) | ||
throw new TypeError("registerType registeredInstance requires argPackAdvance"); | ||
var n = t.name; | ||
if (e || p('type "' + n + '" must have a positive integer typeid pointer'), H.hasOwnProperty(e)) { | ||
if (r.ignoreDuplicateRegistrations) | ||
return; | ||
p("Cannot register type '" + n + "' twice"); | ||
} | ||
if (H[e] = t, delete pe[e], X.hasOwnProperty(e)) { | ||
var i = X[e]; | ||
delete X[e], i.forEach((a) => a()); | ||
} | ||
} | ||
function qt(e, t, r, n, i) { | ||
var a = $e(r); | ||
t = b(t), k(e, { name: t, fromWireType: function(u) { | ||
return !!u; | ||
}, toWireType: function(u, s) { | ||
return s ? n : i; | ||
}, argPackAdvance: 8, readValueFromPointer: function(u) { | ||
var s; | ||
if (r === 1) | ||
s = U; | ||
else if (r === 2) | ||
s = N; | ||
else if (r === 4) | ||
s = C; | ||
else | ||
throw new TypeError("Unknown boolean type size: " + t); | ||
return this.fromWireType(s[u >> a]); | ||
}, destructorFunction: null }); | ||
} | ||
function Gt(e) { | ||
if (!(this instanceof W) || !(e instanceof W)) | ||
return !1; | ||
for (var t = this.$$.ptrType.registeredClass, r = this.$$.ptr, n = e.$$.ptrType.registeredClass, i = e.$$.ptr; t.baseClass; ) | ||
r = t.upcast(r), t = t.baseClass; | ||
for (; n.baseClass; ) | ||
i = n.upcast(i), n = n.baseClass; | ||
return t === n && r === i; | ||
} | ||
function Kt(e) { | ||
return { count: e.count, deleteScheduled: e.deleteScheduled, preservePointerOnDelete: e.preservePointerOnDelete, ptr: e.ptr, ptrType: e.ptrType, smartPtr: e.smartPtr, smartPtrType: e.smartPtrType }; | ||
} | ||
function Ee(e) { | ||
function t(r) { | ||
return r.$$.ptrType.registeredClass.name; | ||
} | ||
p(t(e) + " instance already deleted"); | ||
} | ||
var ke = !1; | ||
function Ge(e) { | ||
} | ||
function Qt(e) { | ||
e.smartPtr ? e.smartPtrType.rawDestructor(e.smartPtr) : e.ptrType.registeredClass.rawDestructor(e.ptr); | ||
} | ||
function Ke(e) { | ||
e.count.value -= 1; | ||
var t = e.count.value === 0; | ||
t && Qt(e); | ||
} | ||
function Qe(e, t, r) { | ||
if (t === r) | ||
return e; | ||
if (r.baseClass === void 0) | ||
return null; | ||
var n = Qe(e, t, r.baseClass); | ||
return n === null ? null : r.downcast(n); | ||
} | ||
var Je = {}; | ||
function Jt() { | ||
return Object.keys(te).length; | ||
} | ||
function Yt() { | ||
var e = []; | ||
for (var t in te) | ||
te.hasOwnProperty(t) && e.push(te[t]); | ||
return e; | ||
} | ||
var Y = []; | ||
function Se() { | ||
for (; Y.length; ) { | ||
var e = Y.pop(); | ||
e.$$.deleteScheduled = !1, e.delete(); | ||
} | ||
} | ||
var ee = void 0; | ||
function er(e) { | ||
ee = e, Y.length && ee && ee(Se); | ||
} | ||
function tr() { | ||
o.getInheritedInstanceCount = Jt, o.getLiveInheritedInstances = Yt, o.flushPendingDeletes = Se, o.setDelayFunction = er; | ||
} | ||
var te = {}; | ||
function rr(e, t) { | ||
for (t === void 0 && p("ptr should not be undefined"); e.baseClass; ) | ||
t = e.upcast(t), e = e.baseClass; | ||
return t; | ||
} | ||
function nr(e, t) { | ||
return t = rr(e, t), te[t]; | ||
} | ||
function he(e, t) { | ||
(!t.ptrType || !t.ptr) && de("makeClassHandle requires ptr and ptrType"); | ||
var r = !!t.smartPtrType, n = !!t.smartPtr; | ||
return r !== n && de("Both smartPtrType and smartPtr must be specified"), t.count = { value: 1 }, re(Object.create(e, { $$: { value: t } })); | ||
} | ||
function ir(e) { | ||
var t = this.getPointee(e); | ||
if (!t) | ||
return this.destructor(e), null; | ||
var r = nr(this.registeredClass, t); | ||
if (r !== void 0) { | ||
if (r.$$.count.value === 0) | ||
return r.$$.ptr = t, r.$$.smartPtr = e, r.clone(); | ||
var n = r.clone(); | ||
return this.destructor(e), n; | ||
} | ||
function i() { | ||
return this.isSmartPointer ? he(this.registeredClass.instancePrototype, { ptrType: this.pointeeType, ptr: t, smartPtrType: this, smartPtr: e }) : he(this.registeredClass.instancePrototype, { ptrType: this, ptr: e }); | ||
} | ||
var a = this.registeredClass.getActualType(t), u = Je[a]; | ||
if (!u) | ||
return i.call(this); | ||
var s; | ||
this.isConst ? s = u.constPointerType : s = u.pointerType; | ||
var c = Qe(t, this.registeredClass, s.registeredClass); | ||
return c === null ? i.call(this) : this.isSmartPointer ? he(s.registeredClass.instancePrototype, { ptrType: s, ptr: c, smartPtrType: this, smartPtr: e }) : he(s.registeredClass.instancePrototype, { ptrType: s, ptr: c }); | ||
} | ||
function re(e) { | ||
return typeof FinalizationRegistry > "u" ? (re = (t) => t, e) : (ke = new FinalizationRegistry((t) => { | ||
Ke(t.$$); | ||
}), re = (t) => { | ||
var r = t.$$, n = !!r.smartPtr; | ||
if (n) { | ||
var i = { $$: r }; | ||
ke.register(t, i, t); | ||
} | ||
return t; | ||
}, Ge = (t) => ke.unregister(t), re(e)); | ||
} | ||
function ar() { | ||
if (this.$$.ptr || Ee(this), this.$$.preservePointerOnDelete) | ||
return this.$$.count.value += 1, this; | ||
var e = re(Object.create(Object.getPrototypeOf(this), { $$: { value: Kt(this.$$) } })); | ||
return e.$$.count.value += 1, e.$$.deleteScheduled = !1, e; | ||
} | ||
function or() { | ||
this.$$.ptr || Ee(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && p("Object already scheduled for deletion"), Ge(this), Ke(this.$$), this.$$.preservePointerOnDelete || (this.$$.smartPtr = void 0, this.$$.ptr = void 0); | ||
} | ||
function sr() { | ||
return !this.$$.ptr; | ||
} | ||
function ur() { | ||
return this.$$.ptr || Ee(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && p("Object already scheduled for deletion"), Y.push(this), Y.length === 1 && ee && ee(Se), this.$$.deleteScheduled = !0, this; | ||
} | ||
function fr() { | ||
W.prototype.isAliasOf = Gt, W.prototype.clone = ar, W.prototype.delete = or, W.prototype.isDeleted = sr, W.prototype.deleteLater = ur; | ||
} | ||
function W() { | ||
} | ||
function cr(e, t, r) { | ||
if (e[t].overloadTable === void 0) { | ||
var n = e[t]; | ||
e[t] = function() { | ||
return e[t].overloadTable.hasOwnProperty(arguments.length) || p("Function '" + r + "' called with an invalid number of arguments (" + arguments.length + ") - expects one of (" + e[t].overloadTable + ")!"), e[t].overloadTable[arguments.length].apply(this, arguments); | ||
}, e[t].overloadTable = [], e[t].overloadTable[n.argCount] = n; | ||
} | ||
} | ||
function Ye(e, t, r) { | ||
o.hasOwnProperty(e) ? ((r === void 0 || o[e].overloadTable !== void 0 && o[e].overloadTable[r] !== void 0) && p("Cannot register public name '" + e + "' twice"), cr(o, e, e), o.hasOwnProperty(r) && p("Cannot register multiple overloads of a function with the same number of arguments (" + r + ")!"), o[e].overloadTable[r] = t) : (o[e] = t, r !== void 0 && (o[e].numArguments = r)); | ||
} | ||
function lr(e, t, r, n, i, a, u, s) { | ||
this.name = e, this.constructor = t, this.instancePrototype = r, this.rawDestructor = n, this.baseClass = i, this.getActualType = a, this.upcast = u, this.downcast = s, this.pureVirtualFunctions = []; | ||
} | ||
function ge(e, t, r) { | ||
for (; t !== r; ) | ||
t.upcast || p("Expected null or instance of " + r.name + ", got an instance of " + t.name), e = t.upcast(e), t = t.baseClass; | ||
return e; | ||
} | ||
function pr(e, t) { | ||
if (t === null) | ||
return this.isReference && p("null is not a valid " + this.name), 0; | ||
t.$$ || p('Cannot pass "' + De(t) + '" as a ' + this.name), t.$$.ptr || p("Cannot pass deleted object as a pointer of type " + this.name); | ||
var r = t.$$.ptrType.registeredClass, n = ge(t.$$.ptr, r, this.registeredClass); | ||
return n; | ||
} | ||
function dr(e, t) { | ||
var r; | ||
if (t === null) | ||
return this.isReference && p("null is not a valid " + this.name), this.isSmartPointer ? (r = this.rawConstructor(), e !== null && e.push(this.rawDestructor, r), r) : 0; | ||
t.$$ || p('Cannot pass "' + De(t) + '" as a ' + this.name), t.$$.ptr || p("Cannot pass deleted object as a pointer of type " + this.name), !this.isConst && t.$$.ptrType.isConst && p("Cannot convert argument of type " + (t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name) + " to parameter type " + this.name); | ||
var n = t.$$.ptrType.registeredClass; | ||
if (r = ge(t.$$.ptr, n, this.registeredClass), this.isSmartPointer) | ||
switch (t.$$.smartPtr === void 0 && p("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) { | ||
case 0: | ||
t.$$.smartPtrType === this ? r = t.$$.smartPtr : p("Cannot convert argument of type " + (t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name) + " to parameter type " + this.name); | ||
break; | ||
case 1: | ||
r = t.$$.smartPtr; | ||
break; | ||
case 2: | ||
if (t.$$.smartPtrType === this) | ||
r = t.$$.smartPtr; | ||
else { | ||
var i = t.clone(); | ||
r = this.rawShare(r, me.toHandle(function() { | ||
i.delete(); | ||
})), e !== null && e.push(this.rawDestructor, r); | ||
} | ||
break; | ||
default: | ||
p("Unsupporting sharing policy"); | ||
} | ||
return r; | ||
} | ||
function vr(e, t) { | ||
if (t === null) | ||
return this.isReference && p("null is not a valid " + this.name), 0; | ||
t.$$ || p('Cannot pass "' + De(t) + '" as a ' + this.name), t.$$.ptr || p("Cannot pass deleted object as a pointer of type " + this.name), t.$$.ptrType.isConst && p("Cannot convert argument of type " + t.$$.ptrType.name + " to parameter type " + this.name); | ||
var r = t.$$.ptrType.registeredClass, n = ge(t.$$.ptr, r, this.registeredClass); | ||
return n; | ||
} | ||
function _e(e) { | ||
return this.fromWireType(C[e >> 2]); | ||
} | ||
function hr(e) { | ||
return this.rawGetPointee && (e = this.rawGetPointee(e)), e; | ||
} | ||
function gr(e) { | ||
this.rawDestructor && this.rawDestructor(e); | ||
} | ||
function _r(e) { | ||
e !== null && e.delete(); | ||
} | ||
function yr() { | ||
S.prototype.getPointee = hr, S.prototype.destructor = gr, S.prototype.argPackAdvance = 8, S.prototype.readValueFromPointer = _e, S.prototype.deleteObject = _r, S.prototype.fromWireType = ir; | ||
} | ||
function S(e, t, r, n, i, a, u, s, c, f, l) { | ||
this.name = e, this.registeredClass = t, this.isReference = r, this.isConst = n, this.isSmartPointer = i, this.pointeeType = a, this.sharingPolicy = u, this.rawGetPointee = s, this.rawConstructor = c, this.rawShare = f, this.rawDestructor = l, !i && t.baseClass === void 0 ? n ? (this.toWireType = pr, this.destructorFunction = null) : (this.toWireType = vr, this.destructorFunction = null) : this.toWireType = dr; | ||
} | ||
function et(e, t, r) { | ||
o.hasOwnProperty(e) || de("Replacing nonexistant public symbol"), o[e].overloadTable !== void 0 && r !== void 0 ? o[e].overloadTable[r] = t : (o[e] = t, o[e].argCount = r); | ||
} | ||
function mr(e, t, r) { | ||
var n = o["dynCall_" + e]; | ||
return r && r.length ? n.apply(null, [t].concat(r)) : n.call(null, t); | ||
} | ||
function wr(e, t, r) { | ||
if (e.includes("j")) | ||
return mr(e, t, r); | ||
var n = g(t).apply(null, r); | ||
return n; | ||
} | ||
function Pr(e, t) { | ||
var r = []; | ||
return function() { | ||
return r.length = 0, Object.assign(r, arguments), wr(e, t, r); | ||
}; | ||
} | ||
function M(e, t) { | ||
e = b(e); | ||
function r() { | ||
return e.includes("j") ? Pr(e, t) : g(t); | ||
} | ||
var n = r(); | ||
return typeof n != "function" && p("unknown function pointer with signature " + e + ": " + t), n; | ||
} | ||
var tt = void 0; | ||
function rt(e) { | ||
var t = ut(e), r = b(t); | ||
return O(t), r; | ||
} | ||
function ye(e, t) { | ||
var r = [], n = {}; | ||
function i(a) { | ||
if (!n[a] && !H[a]) { | ||
if (pe[a]) { | ||
pe[a].forEach(i); | ||
return; | ||
} | ||
r.push(a), n[a] = !0; | ||
} | ||
} | ||
throw t.forEach(i), new tt(e + ": " + r.map(rt).join([", "])); | ||
} | ||
function br(e, t, r, n, i, a, u, s, c, f, l, d, v) { | ||
l = b(l), a = M(i, a), s && (s = M(u, s)), f && (f = M(c, f)), v = M(d, v); | ||
var h = Ae(l); | ||
Ye(h, function() { | ||
ye("Cannot construct " + l + " due to unbound types", [n]); | ||
}), ve([e, t, r], n ? [n] : [], function($) { | ||
$ = $[0]; | ||
var T, A; | ||
n ? (T = $.registeredClass, A = T.instancePrototype) : A = W.prototype; | ||
var R = Re(h, function() { | ||
if (Object.getPrototypeOf(this) !== x) | ||
throw new J("Use 'new' to construct " + l); | ||
if (D.constructor_body === void 0) | ||
throw new J(l + " has no accessible constructor"); | ||
var vt = D.constructor_body[arguments.length]; | ||
if (vt === void 0) | ||
throw new J("Tried to invoke ctor of " + l + " with invalid number of parameters (" + arguments.length + ") - expected (" + Object.keys(D.constructor_body).toString() + ") parameters instead!"); | ||
return vt.apply(this, arguments); | ||
}), x = Object.create(A, { constructor: { value: R } }); | ||
R.prototype = x; | ||
var D = new lr(l, R, x, v, T, a, s, f), _n = new S(l, D, !0, !1, !1), pt = new S(l + "*", D, !1, !1, !1), dt = new S(l + " const*", D, !1, !0, !1); | ||
return Je[e] = { pointerType: pt, constPointerType: dt }, et(h, R), [_n, pt, dt]; | ||
}); | ||
} | ||
function nt(e) { | ||
for (; e.length; ) { | ||
var t = e.pop(), r = e.pop(); | ||
r(t); | ||
} | ||
} | ||
function it(e, t, r) { | ||
return e instanceof Object || p(r + ' with invalid "this": ' + e), e instanceof t.registeredClass.constructor || p(r + ' incompatible with "this" of type ' + e.constructor.name), e.$$.ptr || p("cannot call emscripten binding method " + r + " on deleted object"), ge(e.$$.ptr, e.$$.ptrType.registeredClass, t.registeredClass); | ||
} | ||
function Tr(e, t, r, n, i, a, u, s, c, f) { | ||
t = b(t), i = M(n, i), ve([], [e], function(l) { | ||
l = l[0]; | ||
var d = l.name + "." + t, v = { get: function() { | ||
ye("Cannot access " + d + " due to unbound types", [r, u]); | ||
}, enumerable: !0, configurable: !0 }; | ||
return c ? v.set = () => { | ||
ye("Cannot access " + d + " due to unbound types", [r, u]); | ||
} : v.set = (h) => { | ||
p(d + " is a read-only property"); | ||
}, Object.defineProperty(l.registeredClass.instancePrototype, t, v), ve([], c ? [r, u] : [r], function(h) { | ||
var $ = h[0], T = { get: function() { | ||
var R = it(this, l, d + " getter"); | ||
return $.fromWireType(i(a, R)); | ||
}, enumerable: !0 }; | ||
if (c) { | ||
c = M(s, c); | ||
var A = h[1]; | ||
T.set = function(R) { | ||
var x = it(this, l, d + " setter"), D = []; | ||
c(f, x, A.toWireType(D, R)), nt(D); | ||
}; | ||
} | ||
return Object.defineProperty(l.registeredClass.instancePrototype, t, T), []; | ||
}), []; | ||
}); | ||
} | ||
var Oe = [], F = [{}, { value: void 0 }, { value: null }, { value: !0 }, { value: !1 }]; | ||
function at(e) { | ||
e > 4 && --F[e].refcount === 0 && (F[e] = void 0, Oe.push(e)); | ||
} | ||
function Cr() { | ||
for (var e = 0, t = 5; t < F.length; ++t) | ||
F[t] !== void 0 && ++e; | ||
return e; | ||
} | ||
function $r() { | ||
for (var e = 5; e < F.length; ++e) | ||
if (F[e] !== void 0) | ||
return F[e]; | ||
return null; | ||
} | ||
function Ar() { | ||
o.count_emval_handles = Cr, o.get_first_emval = $r; | ||
} | ||
var me = { toValue: (e) => (e || p("Cannot use deleted val. handle = " + e), F[e].value), toHandle: (e) => { | ||
switch (e) { | ||
case void 0: | ||
return 1; | ||
case null: | ||
return 2; | ||
case !0: | ||
return 3; | ||
case !1: | ||
return 4; | ||
default: { | ||
var t = Oe.length ? Oe.pop() : F.length; | ||
return F[t] = { refcount: 1, value: e }, t; | ||
} | ||
} | ||
} }; | ||
function Rr(e, t) { | ||
t = b(t), k(e, { name: t, fromWireType: function(r) { | ||
var n = me.toValue(r); | ||
return at(r), n; | ||
}, toWireType: function(r, n) { | ||
return me.toHandle(n); | ||
}, argPackAdvance: 8, readValueFromPointer: _e, destructorFunction: null }); | ||
} | ||
function De(e) { | ||
if (e === null) | ||
return "null"; | ||
var t = typeof e; | ||
return t === "object" || t === "array" || t === "function" ? e.toString() : "" + e; | ||
} | ||
function Fr(e, t) { | ||
switch (t) { | ||
case 2: | ||
return function(r) { | ||
return this.fromWireType(je[r >> 2]); | ||
}; | ||
case 3: | ||
return function(r) { | ||
return this.fromWireType(He[r >> 3]); | ||
}; | ||
default: | ||
throw new TypeError("Unknown float type: " + e); | ||
} | ||
} | ||
function Er(e, t, r) { | ||
var n = $e(r); | ||
t = b(t), k(e, { name: t, fromWireType: function(i) { | ||
return i; | ||
}, toWireType: function(i, a) { | ||
return a; | ||
}, argPackAdvance: 8, readValueFromPointer: Fr(t, n), destructorFunction: null }); | ||
} | ||
function kr(e, t) { | ||
if (!(e instanceof Function)) | ||
throw new TypeError("new_ called with constructor type " + typeof e + " which is not a function"); | ||
var r = Re(e.name || "unknownFunctionName", function() { | ||
}); | ||
r.prototype = e.prototype; | ||
var n = new r(), i = e.apply(n, t); | ||
return i instanceof Object ? i : n; | ||
} | ||
function Sr(e, t, r, n, i, a) { | ||
var u = t.length; | ||
u < 2 && p("argTypes array size mismatch! Must at least get return value and 'this' types!"); | ||
for (var s = t[1] !== null && r !== null, c = !1, f = 1; f < t.length; ++f) | ||
if (t[f] !== null && t[f].destructorFunction === void 0) { | ||
c = !0; | ||
break; | ||
} | ||
for (var l = t[0].name !== "void", d = "", v = "", f = 0; f < u - 2; ++f) | ||
d += (f !== 0 ? ", " : "") + "arg" + f, v += (f !== 0 ? ", " : "") + "arg" + f + "Wired"; | ||
var h = "return function " + Ae(e) + "(" + d + `) { | ||
if (arguments.length !== ` + (u - 2) + `) { | ||
throwBindingError('function ` + e + " called with ' + arguments.length + ' arguments, expected " + (u - 2) + ` args!'); | ||
} | ||
async function X(i, { | ||
format: n = e.format, | ||
charset: r = e.charset, | ||
quietZone: o = e.quietZone, | ||
width: a = e.width, | ||
height: g = e.height, | ||
eccLevel: c = e.eccLevel | ||
} = e) { | ||
return s( | ||
i, | ||
`; | ||
c && (h += `var destructors = []; | ||
`); | ||
var $ = c ? "destructors" : "null", T = ["throwBindingError", "invoker", "fn", "runDestructors", "retType", "classParam"], A = [p, n, i, nt, t[0], t[1]]; | ||
s && (h += "var thisWired = classParam.toWireType(" + $ + `, this); | ||
`); | ||
for (var f = 0; f < u - 2; ++f) | ||
h += "var arg" + f + "Wired = argType" + f + ".toWireType(" + $ + ", arg" + f + "); // " + t[f + 2].name + ` | ||
`, T.push("argType" + f), A.push(t[f + 2]); | ||
if (s && (v = "thisWired" + (v.length > 0 ? ", " : "") + v), h += (l || a ? "var rv = " : "") + "invoker(fn" + (v.length > 0 ? ", " : "") + v + `); | ||
`, c) | ||
h += `runDestructors(destructors); | ||
`; | ||
else | ||
for (var f = s ? 1 : 2; f < t.length; ++f) { | ||
var R = f === 1 ? "thisWired" : "arg" + (f - 2) + "Wired"; | ||
t[f].destructorFunction !== null && (h += R + "_dtor(" + R + "); // " + t[f].name + ` | ||
`, T.push(R + "_dtor"), A.push(t[f].destructorFunction)); | ||
} | ||
l && (h += `var ret = retType.fromWireType(rv); | ||
return ret; | ||
`), h += `} | ||
`, T.push(h); | ||
var x = kr(Function, T).apply(null, A); | ||
return x; | ||
} | ||
function Or(e, t) { | ||
for (var r = [], n = 0; n < e; n++) | ||
r.push(_[t + n * 4 >> 2]); | ||
return r; | ||
} | ||
function Dr(e, t, r, n, i, a, u) { | ||
var s = Or(t, r); | ||
e = b(e), i = M(n, i), Ye(e, function() { | ||
ye("Cannot call " + e + " due to unbound types", s); | ||
}, t - 1), ve([], s, function(c) { | ||
var f = [c[0], null].concat(c.slice(1)); | ||
return et(e, Sr(e, f, null, i, a, u), t - 1), []; | ||
}); | ||
} | ||
function Wr(e, t, r) { | ||
switch (t) { | ||
case 0: | ||
return r ? function(i) { | ||
return U[i]; | ||
} : function(i) { | ||
return P[i]; | ||
}; | ||
case 1: | ||
return r ? function(i) { | ||
return N[i >> 1]; | ||
} : function(i) { | ||
return fe[i >> 1]; | ||
}; | ||
case 2: | ||
return r ? function(i) { | ||
return C[i >> 2]; | ||
} : function(i) { | ||
return _[i >> 2]; | ||
}; | ||
default: | ||
throw new TypeError("Unknown integer type: " + e); | ||
} | ||
} | ||
function Ur(e, t, r, n, i) { | ||
t = b(t); | ||
var a = $e(r), u = (d) => d; | ||
if (n === 0) { | ||
var s = 32 - 8 * r; | ||
u = (d) => d << s >>> s; | ||
} | ||
var c = t.includes("unsigned"), f = (d, v) => { | ||
}, l; | ||
c ? l = function(d, v) { | ||
return f(v, this.name), v >>> 0; | ||
} : l = function(d, v) { | ||
return f(v, this.name), v; | ||
}, k(e, { name: t, fromWireType: u, toWireType: l, argPackAdvance: 8, readValueFromPointer: Wr(t, a, n !== 0), destructorFunction: null }); | ||
} | ||
function Ir(e, t, r) { | ||
var n = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], i = n[t]; | ||
function a(u) { | ||
u = u >> 2; | ||
var s = _, c = s[u], f = s[u + 1]; | ||
return new i(s.buffer, f, c); | ||
} | ||
r = b(r), k(e, { name: r, fromWireType: a, argPackAdvance: 8, readValueFromPointer: a }, { ignoreDuplicateRegistrations: !0 }); | ||
} | ||
function jr(e, t) { | ||
t = b(t); | ||
var r = t === "std::string"; | ||
k(e, { name: t, fromWireType: function(n) { | ||
var i = _[n >> 2], a = n + 4, u; | ||
if (r) | ||
for (var s = a, c = 0; c <= i; ++c) { | ||
var f = a + c; | ||
if (c == i || P[f] == 0) { | ||
var l = f - s, d = yt(s, l); | ||
u === void 0 ? u = d : (u += String.fromCharCode(0), u += d), s = f + 1; | ||
} | ||
} | ||
else { | ||
for (var v = new Array(i), c = 0; c < i; ++c) | ||
v[c] = String.fromCharCode(P[a + c]); | ||
u = v.join(""); | ||
} | ||
return O(n), u; | ||
}, toWireType: function(n, i) { | ||
i instanceof ArrayBuffer && (i = new Uint8Array(i)); | ||
var a, u = typeof i == "string"; | ||
u || i instanceof Uint8Array || i instanceof Uint8ClampedArray || i instanceof Int8Array || p("Cannot pass non-string to std::string"), r && u ? a = Pt(i) : a = i.length; | ||
var s = We(4 + a + 1), c = s + 4; | ||
if (_[s >> 2] = a, r && u) | ||
wt(i, c, a + 1); | ||
else if (u) | ||
for (var f = 0; f < a; ++f) { | ||
var l = i.charCodeAt(f); | ||
l > 255 && (O(c), p("String has UTF-16 code units that do not fit in 8 bits")), P[c + f] = l; | ||
} | ||
else | ||
for (var f = 0; f < a; ++f) | ||
P[c + f] = i[f]; | ||
return n !== null && n.push(O, s), s; | ||
}, argPackAdvance: 8, readValueFromPointer: _e, destructorFunction: function(n) { | ||
O(n); | ||
} }); | ||
} | ||
var ot = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0; | ||
function Hr(e, t) { | ||
for (var r = e, n = r >> 1, i = n + t / 2; !(n >= i) && fe[n]; ) | ||
++n; | ||
if (r = n << 1, r - e > 32 && ot) | ||
return ot.decode(P.subarray(e, r)); | ||
for (var a = "", u = 0; !(u >= t / 2); ++u) { | ||
var s = N[e + u * 2 >> 1]; | ||
if (s == 0) | ||
break; | ||
a += String.fromCharCode(s); | ||
} | ||
return a; | ||
} | ||
function Mr(e, t, r) { | ||
if (r === void 0 && (r = 2147483647), r < 2) | ||
return 0; | ||
r -= 2; | ||
for (var n = t, i = r < e.length * 2 ? r / 2 : e.length, a = 0; a < i; ++a) { | ||
var u = e.charCodeAt(a); | ||
N[t >> 1] = u, t += 2; | ||
} | ||
return N[t >> 1] = 0, t - n; | ||
} | ||
function xr(e) { | ||
return e.length * 2; | ||
} | ||
function Vr(e, t) { | ||
for (var r = 0, n = ""; !(r >= t / 4); ) { | ||
var i = C[e + r * 4 >> 2]; | ||
if (i == 0) | ||
break; | ||
if (++r, i >= 65536) { | ||
var a = i - 65536; | ||
n += String.fromCharCode(55296 | a >> 10, 56320 | a & 1023); | ||
} else | ||
n += String.fromCharCode(i); | ||
} | ||
return n; | ||
} | ||
function Br(e, t, r) { | ||
if (r === void 0 && (r = 2147483647), r < 4) | ||
return 0; | ||
for (var n = t, i = n + r - 4, a = 0; a < e.length; ++a) { | ||
var u = e.charCodeAt(a); | ||
if (u >= 55296 && u <= 57343) { | ||
var s = e.charCodeAt(++a); | ||
u = 65536 + ((u & 1023) << 10) | s & 1023; | ||
} | ||
if (C[t >> 2] = u, t += 4, t + 4 > i) | ||
break; | ||
} | ||
return C[t >> 2] = 0, t - n; | ||
} | ||
function Lr(e) { | ||
for (var t = 0, r = 0; r < e.length; ++r) { | ||
var n = e.charCodeAt(r); | ||
n >= 55296 && n <= 57343 && ++r, t += 4; | ||
} | ||
return t; | ||
} | ||
function Nr(e, t, r) { | ||
r = b(r); | ||
var n, i, a, u, s; | ||
t === 2 ? (n = Hr, i = Mr, u = xr, a = () => fe, s = 1) : t === 4 && (n = Vr, i = Br, u = Lr, a = () => _, s = 2), k(e, { name: r, fromWireType: function(c) { | ||
for (var f = _[c >> 2], l = a(), d, v = c + 4, h = 0; h <= f; ++h) { | ||
var $ = c + 4 + h * t; | ||
if (h == f || l[$ >> s] == 0) { | ||
var T = $ - v, A = n(v, T); | ||
d === void 0 ? d = A : (d += String.fromCharCode(0), d += A), v = $ + t; | ||
} | ||
} | ||
return O(c), d; | ||
}, toWireType: function(c, f) { | ||
typeof f != "string" && p("Cannot pass non-string to C++ string type " + r); | ||
var l = u(f), d = We(4 + l + t); | ||
return _[d >> 2] = l >> s, i(f, d + 4, l + t), c !== null && c.push(O, d), d; | ||
}, argPackAdvance: 8, readValueFromPointer: _e, destructorFunction: function(c) { | ||
O(c); | ||
} }); | ||
} | ||
function Zr(e, t) { | ||
t = b(t), k(e, { isVoid: !0, name: t, argPackAdvance: 0, fromWireType: function() { | ||
}, toWireType: function(r, n) { | ||
} }); | ||
} | ||
function Xr(e) { | ||
e > 4 && (F[e].refcount += 1); | ||
} | ||
function zr(e, t) { | ||
var r = H[e]; | ||
return r === void 0 && p(t + " has unknown type " + rt(e)), r; | ||
} | ||
function qr(e, t) { | ||
e = zr(e, "_emval_take_value"); | ||
var r = e.readValueFromPointer(t); | ||
return me.toHandle(r); | ||
} | ||
function Gr() { | ||
Q(""); | ||
} | ||
function Kr(e, t, r) { | ||
P.copyWithin(e, t, t + r); | ||
} | ||
function Qr() { | ||
return 2147483648; | ||
} | ||
function Jr(e) { | ||
var t = ue.buffer; | ||
try { | ||
return ue.grow(e - t.byteLength + 65535 >>> 16), Me(), 1; | ||
} catch { | ||
} | ||
} | ||
function Yr(e) { | ||
var t = P.length; | ||
e = e >>> 0; | ||
var r = Qr(); | ||
if (e > r) | ||
return !1; | ||
let n = (c, f) => c + (f - c % f) % f; | ||
for (var i = 1; i <= 4; i *= 2) { | ||
var a = t * (1 + 0.2 / i); | ||
a = Math.min(a, e + 100663296); | ||
var u = Math.min(r, n(Math.max(e, a), 65536)), s = Jr(u); | ||
if (s) | ||
return !0; | ||
} | ||
return !1; | ||
} | ||
function en(e) { | ||
return e; | ||
} | ||
Zt(), J = o.BindingError = Fe(Error, "BindingError"), qe = o.InternalError = Fe(Error, "InternalError"), fr(), tr(), yr(), tt = o.UnboundTypeError = Fe(Error, "UnboundTypeError"), Ar(); | ||
var tn = { r: Ut, u: jt, a: Mt, m: xt, t: Vt, I: Bt, l: Lt, f: Ht, B: Nt, F: qt, O: br, z: Tr, E: Rr, y: Er, N: Dr, q: Ur, p: Ir, x: jr, v: Nr, G: Zr, K: at, L: Xr, M: qr, w: Gr, D: Kr, C: Yr, s: hn, b: rn, c: sn, i: pn, j: gn, h: dn, H: vn, k: un, d: fn, g: ln, e: nn, o: on, n: an, J: cn, A: en }; | ||
Dt(); | ||
var We = o._malloc = function() { | ||
return (We = o._malloc = o.asm.R).apply(null, arguments); | ||
}, O = o._free = function() { | ||
return (O = o._free = o.asm.S).apply(null, arguments); | ||
}, st = function() { | ||
return (st = o.asm.T).apply(null, arguments); | ||
}, ut = o.___getTypeName = function() { | ||
return (ut = o.___getTypeName = o.asm.V).apply(null, arguments); | ||
}; | ||
o.__embind_initialize_bindings = function() { | ||
return (o.__embind_initialize_bindings = o.asm.W).apply(null, arguments); | ||
}; | ||
var y = function() { | ||
return (y = o.asm.X).apply(null, arguments); | ||
}, ne = function() { | ||
return (ne = o.asm.Y).apply(null, arguments); | ||
}, m = function() { | ||
return (m = o.asm.Z).apply(null, arguments); | ||
}, w = function() { | ||
return (w = o.asm._).apply(null, arguments); | ||
}, ft = function() { | ||
return (ft = o.asm.$).apply(null, arguments); | ||
}, ct = function() { | ||
return (ct = o.asm.aa).apply(null, arguments); | ||
}; | ||
function rn(e, t) { | ||
var r = m(); | ||
try { | ||
return g(e)(t); | ||
} catch (n) { | ||
if (w(r), n !== n + 0) | ||
throw n; | ||
y(1, 0); | ||
} | ||
} | ||
function nn(e, t, r, n) { | ||
var i = m(); | ||
try { | ||
g(e)(t, r, n); | ||
} catch (a) { | ||
if (w(i), a !== a + 0) | ||
throw a; | ||
y(1, 0); | ||
} | ||
} | ||
function an(e, t, r, n, i, a) { | ||
var u = m(); | ||
try { | ||
g(e)(t, r, n, i, a); | ||
} catch (s) { | ||
if (w(u), s !== s + 0) | ||
throw s; | ||
y(1, 0); | ||
} | ||
} | ||
function on(e, t, r, n, i) { | ||
var a = m(); | ||
try { | ||
g(e)(t, r, n, i); | ||
} catch (u) { | ||
if (w(a), u !== u + 0) | ||
throw u; | ||
y(1, 0); | ||
} | ||
} | ||
function sn(e, t, r) { | ||
var n = m(); | ||
try { | ||
return g(e)(t, r); | ||
} catch (i) { | ||
if (w(n), i !== i + 0) | ||
throw i; | ||
y(1, 0); | ||
} | ||
} | ||
function un(e) { | ||
var t = m(); | ||
try { | ||
g(e)(); | ||
} catch (r) { | ||
if (w(t), r !== r + 0) | ||
throw r; | ||
y(1, 0); | ||
} | ||
} | ||
function fn(e, t) { | ||
var r = m(); | ||
try { | ||
g(e)(t); | ||
} catch (n) { | ||
if (w(r), n !== n + 0) | ||
throw n; | ||
y(1, 0); | ||
} | ||
} | ||
function cn(e, t, r, n, i, a, u, s, c) { | ||
var f = m(); | ||
try { | ||
g(e)(t, r, n, i, a, u, s, c); | ||
} catch (l) { | ||
if (w(f), l !== l + 0) | ||
throw l; | ||
y(1, 0); | ||
} | ||
} | ||
function ln(e, t, r) { | ||
var n = m(); | ||
try { | ||
g(e)(t, r); | ||
} catch (i) { | ||
if (w(n), i !== i + 0) | ||
throw i; | ||
y(1, 0); | ||
} | ||
} | ||
function pn(e, t, r, n) { | ||
var i = m(); | ||
try { | ||
return g(e)(t, r, n); | ||
} catch (a) { | ||
if (w(i), a !== a + 0) | ||
throw a; | ||
y(1, 0); | ||
} | ||
} | ||
function dn(e, t, r, n, i, a) { | ||
var u = m(); | ||
try { | ||
return g(e)(t, r, n, i, a); | ||
} catch (s) { | ||
if (w(u), s !== s + 0) | ||
throw s; | ||
y(1, 0); | ||
} | ||
} | ||
function vn(e, t, r, n, i, a, u) { | ||
var s = m(); | ||
try { | ||
return g(e)(t, r, n, i, a, u); | ||
} catch (c) { | ||
if (w(s), c !== c + 0) | ||
throw c; | ||
y(1, 0); | ||
} | ||
} | ||
function hn(e) { | ||
var t = m(); | ||
try { | ||
return g(e)(); | ||
} catch (r) { | ||
if (w(t), r !== r + 0) | ||
throw r; | ||
y(1, 0); | ||
} | ||
} | ||
function gn(e, t, r, n, i) { | ||
var a = m(); | ||
try { | ||
return g(e)(t, r, n, i); | ||
} catch (u) { | ||
if (w(a), u !== u + 0) | ||
throw u; | ||
y(1, 0); | ||
} | ||
} | ||
var we; | ||
K = function e() { | ||
we || lt(), we || (K = e); | ||
}; | ||
function lt() { | ||
if (I > 0 || (bt(), I > 0)) | ||
return; | ||
function e() { | ||
we || (we = !0, o.calledRun = !0, !Ue && (Tt(), ie(o), o.onRuntimeInitialized && o.onRuntimeInitialized(), Ct())); | ||
} | ||
o.setStatus ? (o.setStatus("Running..."), setTimeout(function() { | ||
setTimeout(function() { | ||
o.setStatus(""); | ||
}, 1), e(); | ||
}, 1)) : e(); | ||
} | ||
if (o.preInit) | ||
for (typeof o.preInit == "function" && (o.preInit = [o.preInit]); o.preInit.length > 0; ) | ||
o.preInit.pop()(); | ||
return lt(), z.ready; | ||
}; | ||
})(); | ||
function Pn(B) { | ||
return yn(ht, B); | ||
} | ||
async function bn(B, { | ||
format: z = V.format, | ||
charset: o = V.charset, | ||
quietZone: ie = V.quietZone, | ||
width: L = V.width, | ||
height: ae = V.height, | ||
eccLevel: oe = V.eccLevel | ||
} = V) { | ||
return mn( | ||
B, | ||
{ | ||
format: n, | ||
charset: r, | ||
quietZone: o, | ||
width: a, | ||
height: g, | ||
eccLevel: c | ||
format: z, | ||
charset: o, | ||
quietZone: ie, | ||
width: L, | ||
height: ae, | ||
eccLevel: oe | ||
}, | ||
t | ||
ht | ||
); | ||
} | ||
export { | ||
l as ZXING_BARCODE_FORMAT_NAMES, | ||
p as ZXING_CHARACTOR_SET_NAMES, | ||
A as defaultZXingReadOptions, | ||
e as defaultZXingWriteOptions, | ||
I as getZXingInstance, | ||
X as writeBarcodeToImageFile | ||
$n as ZXING_BARCODE_FORMAT_NAMES, | ||
An as ZXING_CHARACTOR_SET_NAMES, | ||
Rn as defaultZXingReadOptions, | ||
V as defaultZXingWriteOptions, | ||
Pn as getZXingModule, | ||
Fn as purgeZXingModule, | ||
En as setZXingModuleOverrides, | ||
bn as writeBarcodeToImageFile | ||
}; |
@@ -1,3 +0,3 @@ | ||
import { ZXingWasm } from "../ZXing.js"; | ||
declare var ZXing: ZXingWasm; | ||
import { ZXingModuleFactory } from "../core.js"; | ||
declare var ZXing: ZXingModuleFactory<"writer">; | ||
export default ZXing; |
{ | ||
"name": "@sec-ant/zxing-wasm", | ||
"private": false, | ||
"version": "0.0.5", | ||
"version": "1.0.0", | ||
"type": "module", | ||
@@ -27,3 +27,2 @@ "files": [ | ||
"build": "tsc && vite build", | ||
"postbuild": "node replace-output.js", | ||
"prepublishOnly": "npm run build", | ||
@@ -58,3 +57,7 @@ "preview": "vite preview" | ||
"vite-plugin-dts": "^2.1.0" | ||
}, | ||
"dependencies": { | ||
"@types/emscripten": "^1.39.6", | ||
"zustand": "^4.3.7" | ||
} | ||
} |
@@ -23,7 +23,7 @@ # @sec-ant/zxing-wasm | ||
This package exports 3 subpaths: full, reader and writer. You can choose whichever fits your needs. | ||
This package exports 3 subpaths: full, reader and writer. You can choose whichever fits your needs. However, bear in mind that [subpath imports needs a `moduleResolution` of `node16` or `nodenext` in your `tsconfig.json` file](https://github.com/microsoft/TypeScript/issues/44848#issuecomment-1212826554). | ||
### `@sec-ant/zxing-wasm` or `@sec-ant/zxing-wasm/full` | ||
These paths includes functions to both read and write barcodes. The wasm binary size is ~1.25 MB. | ||
These imports includes functions to both read and write barcodes. The wasm binary size is ~1.25 MB. | ||
@@ -113,8 +113,8 @@ ```ts | ||
The return result of these 2 functions is a `Promise` of an array of `ZXingReadResult`: | ||
The return result of these 2 functions is a `Promise` of an array of `ZXingReadOutput`: | ||
```ts | ||
interface ZXingReadResult { | ||
interface ZXingReadOutput { | ||
/* detected barcode format */ | ||
format: ZXingReadResultBarcodeFormat; | ||
format: ZXingReadOutputBarcodeFormat; | ||
/* detected barcode text */ | ||
@@ -158,3 +158,3 @@ text: string; | ||
const imageFileReadResult = await readBarcodeFromImageFile( | ||
const imageFileReadOutputs = await readBarcodeFromImageFile( | ||
imageFile, | ||
@@ -164,3 +164,3 @@ zxingReadOptions | ||
console.log(imageFileReadResult[0].text); // Hello world! | ||
console.log(imageFileReadOutputs[0].text); // Hello world! | ||
@@ -179,3 +179,3 @@ /** | ||
const imageDataReadResult = await readBarcodeFromImageData( | ||
const imageDataReadOutputs = await readBarcodeFromImageData( | ||
imageData, | ||
@@ -185,3 +185,3 @@ zxingReadOptions | ||
console.log(imageDataReadResult[0].text); // Hello world! | ||
console.log(imageDataReadOutputs[0].text); // Hello world! | ||
``` | ||
@@ -208,10 +208,10 @@ | ||
/* (E)rror (C)orrection (C)apability level, -1 ~ 8, default = -1 (default) */ | ||
eccLevel?: ZXingEccLevel; | ||
eccLevel?: ZXingECCLevel; | ||
} | ||
``` | ||
The return result of this function is a `Promise` of `ZXingWriteResult`: | ||
The return result of this function is a `Promise` of `ZXingWriteOutput`: | ||
```ts | ||
interface ZXingWriteResult { | ||
interface ZXingWriteOutput { | ||
/* a png image blob, or null */ | ||
@@ -229,3 +229,3 @@ image: Blob | null; | ||
const writeResult = await writeBarcodeToImageFile("Hello world!", { | ||
const writeOutput = await writeBarcodeToImageFile("Hello world!", { | ||
format: "QRCode", | ||
@@ -239,3 +239,3 @@ charset: "UTF-8", | ||
console.log(writeResult.image); | ||
console.log(writeOutput.image); | ||
``` | ||
@@ -245,9 +245,29 @@ | ||
When using this package, the wasm binary needs to be served along with the JS glue code. In order to provide a smooth dev experience, the wasm binary serve path is automatically replaced with [jsDelivr CDN](https://cdn.jsdelivr.net/npm/@sec-ant/zxing-wasm/) urls after build. Further customization will be considered to provide a more flexible opt-in option. | ||
When using this package, the wasm binary needs to be served along with the JS glue code. In order to provide a smooth dev experience, the wasm binary serve path is automatically assigned the [jsDelivr CDN](https://cdn.jsdelivr.net/npm/@sec-ant/zxing-wasm/) url upon build. | ||
The wasm binary won't be downloaded and instantiated unless a [read](#readbarcodefromimagefile-and-readbarcodefromimagedata) or [write](#writebarcodetoimagefile) function is firstly called, and will only be instantiated once. So there'll be a cold start in the first function call (or several calls if they appear in a very short period). If you want to manully trigger the download and instantiation of the wasm binary prior to any read or write functions, you can call the exported function `getZXingInstance`, this function will also return a `Promise` that resolves to a `ZXingInstance`, which this wrapper library is built upon. | ||
If you would like to change the serve path (to one of your local network hosts or other CDNs), please use `setZXingModuleOverrides` to override the [`locateFile`](https://emscripten.org/docs/api_reference/module.html?highlight=locatefile#Module.locateFile) function in advance. `locateFile` is one of the [Emscripten `Module` attribute hooks](https://emscripten.org/docs/api_reference/module.html?highlight=locatefile#affecting-execution) that can affect the code execution of the `Module` object during its lifecycles. | ||
```ts | ||
import { getZXingInstance } from "@sec-ant/zxing-wasm/reader"; | ||
import { | ||
setZXingModuleOverrides, | ||
writeBarcodeToImageFile, | ||
} from "@sec-ant/zxing-wasm"; | ||
// override the locateFile function | ||
setZXingModuleOverrides({ | ||
locateFile: (path, prefix) => | ||
path.endsWith(".wasm") | ||
? "https://www.your-custom-host.com/path/" + path | ||
: prefix + path, | ||
}); | ||
// call read or write functions afterwards | ||
const writeOutput = await writeBarcodeToImageFile("Hello world!"); | ||
``` | ||
The wasm binary won't be fetched or instantiated unless a [read](#readbarcodefromimagefile-and-readbarcodefromimagedata) or [write](#writebarcodetoimagefile) function is firstly called, and will only be instantiated once given the same module overrides. So there'll be a cold start in the first function call (or several calls if they appear in a very short period). If you want to manully trigger the download and instantiation of the wasm binary prior to any read or write functions, you can use `getZXingModule`. This function will also return a `Promise` that resolves to a `ZXingModule`, the wasm `Module` object this wrapper library is built upon. | ||
```ts | ||
import { getZXingModule } from "@sec-ant/zxing-wasm"; | ||
/** | ||
@@ -257,7 +277,24 @@ * This function will trigger the download and | ||
*/ | ||
getZXingInstance(); | ||
zxingModulePromise1 = getZXingModule(); | ||
zxingModulePromise2 = getZXingModule(); | ||
console.log(zxingModulePromise1 === zxingModulePromise2); // true | ||
``` | ||
`getZXingModule` can also optionally accept a `ZXingModuleOverrides` argument. | ||
```ts | ||
import { getZXingModule } from "@sec-ant/zxing-wasm"; | ||
getZXingModule({ | ||
locateFile: (path, prefix) => | ||
path.endsWith(".wasm") | ||
? "https://www.your-custom-host.com/path/" + path | ||
: prefix + path, | ||
}); | ||
``` | ||
## License | ||
MIT |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2867209
5166
0
290
2
18
13
+ Added@types/emscripten@^1.39.6
+ Addedzustand@^4.3.7
+ Added@types/emscripten@1.39.13(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedreact@18.3.1(transitive)
+ Addeduse-sync-external-store@1.2.2(transitive)
+ Addedzustand@4.5.5(transitive)