vue-qrcode-reader
Version:
A set of Vue.js components for detecting and decoding QR codes.
1,550 lines (1,549 loc) • 108 kB
JavaScript
import { defineComponent as Lt, ref as we, watch as We, onMounted as vo, onUnmounted as yo, computed as Ut, createElementBlock as jt, openBlock as Ht, createElementVNode as ot, withDirectives as go, normalizeStyle as wo, vShow as bo, renderSlot as Mr, withModifiers as it } from "vue";
var Dr = (r, o, i) => {
if (!o.has(r))
throw TypeError("Cannot " + i);
}, br = (r, o, i) => (Dr(r, o, "read from private field"), i ? i.call(r) : o.get(r)), Co = (r, o, i) => {
if (o.has(r))
throw TypeError("Cannot add the same private member more than once");
o instanceof WeakSet ? o.add(r) : o.set(r, i);
}, $o = (r, o, i, c) => (Dr(r, o, "write to private field"), o.set(r, i), i);
const Ar = [
["aztec", "Aztec"],
["code_128", "Code128"],
["code_39", "Code39"],
["code_93", "Code93"],
["codabar", "Codabar"],
["databar", "DataBar"],
["databar_expanded", "DataBarExpanded"],
["data_matrix", "DataMatrix"],
["dx_film_edge", "DXFilmEdge"],
["ean_13", "EAN-13"],
["ean_8", "EAN-8"],
["itf", "ITF"],
["maxi_code", "MaxiCode"],
["micro_qr_code", "MicroQRCode"],
["pdf417", "PDF417"],
["qr_code", "QRCode"],
["rm_qr_code", "rMQRCode"],
["upc_a", "UPC-A"],
["upc_e", "UPC-E"],
["linear_codes", "Linear-Codes"],
["matrix_codes", "Matrix-Codes"]
], _o = [...Ar, ["unknown"]].map((r) => r[0]), ct = new Map(
Ar
);
function So(r) {
for (const [o, i] of ct)
if (r === i)
return o;
return "unknown";
}
function Po(r) {
if (xr(r))
return {
width: r.naturalWidth,
height: r.naturalHeight
};
if (Rr(r))
return {
width: r.width.baseVal.value,
height: r.height.baseVal.value
};
if (kr(r))
return {
width: r.videoWidth,
height: r.videoHeight
};
if (Fr(r))
return {
width: r.width,
height: r.height
};
if (Wr(r))
return {
width: r.displayWidth,
height: r.displayHeight
};
if (Ir(r))
return {
width: r.width,
height: r.height
};
if (Ur(r))
return {
width: r.width,
height: r.height
};
throw new TypeError(
"The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'."
);
}
function xr(r) {
try {
return r instanceof HTMLImageElement;
} catch (o) {
return !1;
}
}
function Rr(r) {
try {
return r instanceof SVGImageElement;
} catch (o) {
return !1;
}
}
function kr(r) {
try {
return r instanceof HTMLVideoElement;
} catch (o) {
return !1;
}
}
function Ir(r) {
try {
return r instanceof HTMLCanvasElement;
} catch (o) {
return !1;
}
}
function Fr(r) {
try {
return r instanceof ImageBitmap;
} catch (o) {
return !1;
}
}
function Ur(r) {
try {
return r instanceof OffscreenCanvas;
} catch (o) {
return !1;
}
}
function Wr(r) {
try {
return r instanceof VideoFrame;
} catch (o) {
return !1;
}
}
function Lr(r) {
try {
return r instanceof Blob;
} catch (o) {
return !1;
}
}
function To(r) {
try {
return r instanceof ImageData;
} catch (o) {
return !1;
}
}
function Eo(r, o) {
try {
const i = new OffscreenCanvas(r, o);
if (i.getContext("2d") instanceof OffscreenCanvasRenderingContext2D)
return i;
throw void 0;
} catch (i) {
const c = document.createElement("canvas");
return c.width = r, c.height = o, c;
}
}
async function jr(r) {
if (xr(r) && !await Ao(r))
throw new DOMException(
"Failed to load or decode HTMLImageElement.",
"InvalidStateError"
);
if (Rr(r) && !await xo(r))
throw new DOMException(
"Failed to load or decode SVGImageElement.",
"InvalidStateError"
);
if (Wr(r) && Ro(r))
throw new DOMException("VideoFrame is closed.", "InvalidStateError");
if (kr(r) && (r.readyState === 0 || r.readyState === 1))
throw new DOMException("Invalid element or state.", "InvalidStateError");
if (Fr(r) && Io(r))
throw new DOMException(
"The image source is detached.",
"InvalidStateError"
);
const { width: o, height: i } = Po(r);
if (o === 0 || i === 0)
return null;
const c = Eo(o, i).getContext("2d");
c.drawImage(r, 0, 0);
try {
return c.getImageData(0, 0, o, i);
} catch (l) {
throw new DOMException("Source would taint origin.", "SecurityError");
}
}
async function Oo(r) {
let o;
try {
if (globalThis.createImageBitmap)
o = await createImageBitmap(r);
else if (globalThis.Image) {
o = new Image();
let i = "";
try {
i = URL.createObjectURL(r), o.src = i, await o.decode();
} finally {
URL.revokeObjectURL(i);
}
} else
return r;
} catch (i) {
throw new DOMException(
"Failed to load or decode Blob.",
"InvalidStateError"
);
}
return await jr(o);
}
function Mo(r) {
const { width: o, height: i } = r;
if (o === 0 || i === 0)
return null;
const c = r.getContext("2d");
try {
return c.getImageData(0, 0, o, i);
} catch (l) {
throw new DOMException("Source would taint origin.", "SecurityError");
}
}
async function Do(r) {
if (Lr(r))
return await Oo(r);
if (To(r)) {
if (ko(r))
throw new DOMException(
"The image data has been detached.",
"InvalidStateError"
);
return r;
}
return Ir(r) || Ur(r) ? Mo(r) : await jr(r);
}
async function Ao(r) {
try {
return await r.decode(), !0;
} catch (o) {
return !1;
}
}
async function xo(r) {
var o;
try {
return await ((o = r.decode) == null ? void 0 : o.call(r)), !0;
} catch (i) {
return !1;
}
}
function Ro(r) {
return r.format === null;
}
function ko(r) {
return r.data.buffer.byteLength === 0;
}
function Io(r) {
return r.width === 0 && r.height === 0;
}
function Cr(r, o) {
return r instanceof DOMException ? new DOMException(`${o}: ${r.message}`, r.name) : r instanceof Error ? new r.constructor(`${o}: ${r.message}`) : new Error(`${o}: ${r}`);
}
const $r = [
"Aztec",
"Codabar",
"Code128",
"Code39",
"Code93",
"DataBar",
"DataBarExpanded",
"DataMatrix",
"DXFilmEdge",
"EAN-13",
"EAN-8",
"ITF",
"Linear-Codes",
"Matrix-Codes",
"MaxiCode",
"MicroQRCode",
"None",
"PDF417",
"QRCode",
"rMQRCode",
"UPC-A",
"UPC-E"
];
function Fo(r) {
return r.join("|");
}
function Uo(r) {
const o = _r(r);
let i = 0, c = $r.length - 1;
for (; i <= c; ) {
const l = Math.floor((i + c) / 2), h = $r[l], v = _r(h);
if (v === o)
return h;
v < o ? i = l + 1 : c = l - 1;
}
return "None";
}
function _r(r) {
return r.toLowerCase().replace(/_-\[\]/g, "");
}
function Wo(r, o) {
return r.Binarizer[o];
}
function Lo(r, o) {
return r.CharacterSet[o];
}
const jo = [
"Text",
"Binary",
"Mixed",
"GS1",
"ISO15434",
"UnknownECI"
];
function Ho(r) {
return jo[r.value];
}
function Bo(r, o) {
return r.EanAddOnSymbol[o];
}
function Vo(r, o) {
return r.TextMode[o];
}
const Ee = {
formats: [],
tryHarder: !0,
tryRotate: !0,
tryInvert: !0,
tryDownscale: !0,
binarizer: "LocalAverage",
isPure: !1,
downscaleFactor: 3,
downscaleThreshold: 500,
minLineCount: 2,
maxNumberOfSymbols: 255,
tryCode39ExtendedMode: !1,
validateCode39CheckSum: !1,
validateITFCheckSum: !1,
returnCodabarStartEnd: !1,
returnErrors: !1,
eanAddOnSymbol: "Read",
textMode: "Plain",
characterSet: "Unknown"
};
function Hr(r, o) {
return {
...o,
formats: Fo(o.formats),
binarizer: Wo(r, o.binarizer),
eanAddOnSymbol: Bo(
r,
o.eanAddOnSymbol
),
textMode: Vo(r, o.textMode),
characterSet: Lo(
r,
o.characterSet
)
};
}
function Br(r) {
return {
...r,
format: Uo(r.format),
eccLevel: r.eccLevel,
contentType: Ho(r.contentType)
};
}
const qo = {
locateFile: (r, o) => {
const i = r.match(/_(.+?)\.wasm$/);
return i ? `https://fastly.jsdelivr.net/npm/zxing-wasm@1.1.3/dist/${i[1]}/${r}` : o + r;
}
};
let Wt = /* @__PURE__ */ new WeakMap();
function Bt(r, o) {
var i;
const c = Wt.get(r);
if (c != null && c.modulePromise && o === void 0)
return c.modulePromise;
const l = (i = c == null ? void 0 : c.moduleOverrides) != null ? i : qo, h = r({
...l
});
return Wt.set(r, {
moduleOverrides: l,
modulePromise: h
}), h;
}
function No(r, o) {
Wt.set(r, {
moduleOverrides: o
});
}
async function zo(r, o, i = Ee) {
const c = {
...Ee,
...i
}, l = await Bt(r), { size: h } = o, v = new Uint8Array(await o.arrayBuffer()), g = l._malloc(h);
l.HEAPU8.set(v, g);
const b = l.readBarcodesFromImage(
g,
h,
Hr(l, c)
);
l._free(g);
const p = [];
for (let C = 0; C < b.size(); ++C)
p.push(
Br(b.get(C))
);
return p;
}
async function Go(r, o, i = Ee) {
const c = {
...Ee,
...i
}, l = await Bt(r), {
data: h,
width: v,
height: g,
data: { byteLength: b }
} = o, p = l._malloc(b);
l.HEAPU8.set(h, p);
const C = l.readBarcodesFromPixmap(
p,
v,
g,
Hr(l, c)
);
l._free(p);
const S = [];
for (let $ = 0; $ < C.size(); ++$)
S.push(
Br(C.get($))
);
return S;
}
({
...Ee,
formats: [...Ee.formats]
});
var dt = (() => {
var r = typeof document < "u" && document.currentScript ? document.currentScript.src : void 0;
return function(o = {}) {
var i = o, c, l;
i.ready = new Promise((e, t) => {
c = e, l = t;
});
var h = Object.assign({}, i), v = "./this.program", g = typeof window == "object", b = typeof importScripts == "function";
typeof process == "object" && typeof process.versions == "object" && process.versions.node;
var p = "";
function C(e) {
return i.locateFile ? i.locateFile(e, p) : p + e;
}
var S;
(g || b) && (b ? p = self.location.href : typeof document < "u" && document.currentScript && (p = document.currentScript.src), r && (p = r), p.indexOf("blob:") !== 0 ? p = p.substr(0, p.replace(/[?#].*/, "").lastIndexOf("/") + 1) : p = "", b && (S = (e) => {
var t = new XMLHttpRequest();
return t.open("GET", e, !1), t.responseType = "arraybuffer", t.send(null), new Uint8Array(t.response);
})), i.print || console.log.bind(console);
var $ = i.printErr || console.error.bind(console);
Object.assign(i, h), h = null, i.arguments && i.arguments, i.thisProgram && (v = i.thisProgram), i.quit && i.quit;
var F;
i.wasmBinary && (F = i.wasmBinary), typeof WebAssembly != "object" && Z("no native wasm support detected");
var U, W = !1, R, A, X, k, M, D, le, ie;
function be() {
var e = U.buffer;
i.HEAP8 = R = new Int8Array(e), i.HEAP16 = X = new Int16Array(e), i.HEAPU8 = A = new Uint8Array(e), i.HEAPU16 = k = new Uint16Array(e), i.HEAP32 = M = new Int32Array(e), i.HEAPU32 = D = new Uint32Array(e), i.HEAPF32 = le = new Float32Array(e), i.HEAPF64 = ie = new Float64Array(e);
}
var Ce = [], Oe = [], Me = [];
function He() {
if (i.preRun)
for (typeof i.preRun == "function" && (i.preRun = [i.preRun]); i.preRun.length; )
pt(i.preRun.shift());
gt(Ce);
}
function ft() {
gt(Oe);
}
function ht() {
if (i.postRun)
for (typeof i.postRun == "function" && (i.postRun = [i.postRun]); i.postRun.length; )
De(i.postRun.shift());
gt(Me);
}
function pt(e) {
Ce.unshift(e);
}
function mt(e) {
Oe.unshift(e);
}
function De(e) {
Me.unshift(e);
}
var te = 0, ve = null;
function Be(e) {
var t;
te++, (t = i.monitorRunDependencies) === null || t === void 0 || t.call(i, te);
}
function de(e) {
var t;
if (te--, (t = i.monitorRunDependencies) === null || t === void 0 || t.call(i, te), te == 0 && ve) {
var n = ve;
ve = null, n();
}
}
function Z(e) {
var t;
(t = i.onAbort) === null || t === void 0 || t.call(i, e), e = "Aborted(" + e + ")", $(e), W = !0, e += ". Build with -sASSERTIONS for more info.";
var n = new WebAssembly.RuntimeError(e);
throw l(n), n;
}
var vt = "data:application/octet-stream;base64,", Ve = (e) => e.startsWith(vt), fe;
fe = "zxing_reader.wasm", Ve(fe) || (fe = C(fe));
function qe(e) {
if (e == fe && F)
return new Uint8Array(F);
if (S)
return S(e);
throw "both async and sync fetching of the wasm failed";
}
function yt(e) {
return !F && (g || b) && typeof fetch == "function" ? fetch(e, {
credentials: "same-origin"
}).then((t) => {
if (!t.ok)
throw "failed to load wasm binary file at '" + e + "'";
return t.arrayBuffer();
}).catch(() => qe(e)) : Promise.resolve().then(() => qe(e));
}
function Ne(e, t, n) {
return yt(e).then((a) => WebAssembly.instantiate(a, t)).then((a) => a).then(n, (a) => {
$(`failed to asynchronously prepare wasm: ${a}`), Z(a);
});
}
function an(e, t, n, a) {
return !e && typeof WebAssembly.instantiateStreaming == "function" && !Ve(t) && typeof fetch == "function" ? fetch(t, {
credentials: "same-origin"
}).then((s) => {
var u = WebAssembly.instantiateStreaming(s, n);
return u.then(a, function(d) {
return $(`wasm streaming compile failed: ${d}`), $("falling back to ArrayBuffer instantiation"), Ne(t, n, a);
});
}) : Ne(t, n, a);
}
function on() {
var e = {
a: Ga
};
function t(a, s) {
return z = a.exports, U = z.ia, be(), Kt = z.ma, mt(z.ja), de(), z;
}
Be();
function n(a) {
t(a.instance);
}
if (i.instantiateWasm)
try {
return i.instantiateWasm(e, t);
} catch (a) {
$(`Module.instantiateWasm callback failed with error: ${a}`), l(a);
}
return an(F, fe, e, n).catch(l), {};
}
var gt = (e) => {
for (; e.length > 0; )
e.shift()(i);
};
i.noExitRuntime;
var ze = [], Ge = 0, sn = (e) => {
var t = new wt(e);
return t.get_caught() || (t.set_caught(!0), Ge--), t.set_rethrown(!1), ze.push(t), hr(t.excPtr), t.get_exception_ptr();
}, se = 0, cn = () => {
L(0, 0);
var e = ze.pop();
fr(e.excPtr), se = 0;
};
function wt(e) {
this.excPtr = e, this.ptr = e - 24, this.set_type = function(t) {
D[this.ptr + 4 >> 2] = t;
}, this.get_type = function() {
return D[this.ptr + 4 >> 2];
}, this.set_destructor = function(t) {
D[this.ptr + 8 >> 2] = t;
}, this.get_destructor = function() {
return D[this.ptr + 8 >> 2];
}, this.set_caught = function(t) {
t = t ? 1 : 0, R[this.ptr + 12 >> 0] = t;
}, this.get_caught = function() {
return R[this.ptr + 12 >> 0] != 0;
}, this.set_rethrown = function(t) {
t = t ? 1 : 0, R[this.ptr + 13 >> 0] = t;
}, this.get_rethrown = function() {
return R[this.ptr + 13 >> 0] != 0;
}, this.init = function(t, n) {
this.set_adjusted_ptr(0), this.set_type(t), this.set_destructor(n);
}, this.set_adjusted_ptr = function(t) {
D[this.ptr + 16 >> 2] = t;
}, this.get_adjusted_ptr = function() {
return D[this.ptr + 16 >> 2];
}, this.get_exception_ptr = function() {
var t = mr(this.get_type());
if (t)
return D[this.excPtr >> 2];
var n = this.get_adjusted_ptr();
return n !== 0 ? n : this.excPtr;
};
}
var un = (e) => {
throw se || (se = e), se;
}, bt = (e) => {
var t = se;
if (!t)
return Ue(0), 0;
var n = new wt(t);
n.set_adjusted_ptr(t);
var a = n.get_type();
if (!a)
return Ue(0), t;
for (var s in e) {
var u = e[s];
if (u === 0 || u === a)
break;
var d = n.ptr + 16;
if (pr(u, a, d))
return Ue(u), t;
}
return Ue(a), t;
}, ln = () => bt([]), dn = (e) => bt([e]), fn = (e, t) => bt([e, t]), hn = () => {
var e = ze.pop();
e || Z("no exception to throw");
var t = e.excPtr;
throw e.get_rethrown() || (ze.push(e), e.set_rethrown(!0), e.set_caught(!1), Ge++), se = t, se;
}, pn = (e, t, n) => {
var a = new wt(e);
throw a.init(t, n), se = e, Ge++, se;
}, mn = () => Ge, Ye = {}, Ct = (e) => {
for (; e.length; ) {
var t = e.pop(), n = e.pop();
n(t);
}
};
function $t(e) {
return this.fromWireType(M[e >> 2]);
}
var $e = {}, ye = {}, Je = {}, qt, Qe = (e) => {
throw new qt(e);
}, ge = (e, t, n) => {
e.forEach(function(f) {
Je[f] = t;
});
function a(f) {
var m = n(f);
m.length !== e.length && Qe("Mismatched type converter count");
for (var w = 0; w < e.length; ++w)
re(e[w], m[w]);
}
var s = new Array(t.length), u = [], d = 0;
t.forEach((f, m) => {
ye.hasOwnProperty(f) ? s[m] = ye[f] : (u.push(f), $e.hasOwnProperty(f) || ($e[f] = []), $e[f].push(() => {
s[m] = ye[f], ++d, d === u.length && a(s);
}));
}), u.length === 0 && a(s);
}, vn = (e) => {
var t = Ye[e];
delete Ye[e];
var n = t.rawConstructor, a = t.rawDestructor, s = t.fields, u = s.map((d) => d.getterReturnType).concat(s.map((d) => d.setterArgumentType));
ge([e], u, (d) => {
var f = {};
return s.forEach((m, w) => {
var _ = m.fieldName, T = d[w], E = m.getter, O = m.getterContext, j = d[w + s.length], q = m.setter, I = m.setterContext;
f[_] = {
read: (J) => T.fromWireType(E(O, J)),
write: (J, y) => {
var P = [];
q(I, J, j.toWireType(P, y)), Ct(P);
}
};
}), [{
name: t.name,
fromWireType: (m) => {
var w = {};
for (var _ in f)
w[_] = f[_].read(m);
return a(m), w;
},
toWireType: (m, w) => {
for (var _ in f)
if (!(_ in w))
throw new TypeError(`Missing field: "${_}"`);
var T = n();
for (_ in f)
f[_].write(T, w[_]);
return m !== null && m.push(a, T), T;
},
argPackAdvance: ne,
readValueFromPointer: $t,
destructorFunction: a
}];
});
}, yn = (e, t, n, a, s) => {
}, gn = () => {
for (var e = new Array(256), t = 0; t < 256; ++t)
e[t] = String.fromCharCode(t);
Nt = e;
}, Nt, Y = (e) => {
for (var t = "", n = e; A[n]; )
t += Nt[A[n++]];
return t;
}, _e, x = (e) => {
throw new _e(e);
};
function wn(e, t) {
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
var a = t.name;
if (e || x(`type "${a}" must have a positive integer typeid pointer`), ye.hasOwnProperty(e)) {
if (n.ignoreDuplicateRegistrations)
return;
x(`Cannot register type '${a}' twice`);
}
if (ye[e] = t, delete Je[e], $e.hasOwnProperty(e)) {
var s = $e[e];
delete $e[e], s.forEach((u) => u());
}
}
function re(e, t) {
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
if (!("argPackAdvance" in t))
throw new TypeError("registerType registeredInstance requires argPackAdvance");
return wn(e, t, n);
}
var ne = 8, bn = (e, t, n, a) => {
t = Y(t), re(e, {
name: t,
fromWireType: function(s) {
return !!s;
},
toWireType: function(s, u) {
return u ? n : a;
},
argPackAdvance: ne,
readValueFromPointer: function(s) {
return this.fromWireType(A[s]);
},
destructorFunction: null
});
}, Cn = (e) => ({
count: e.count,
deleteScheduled: e.deleteScheduled,
preservePointerOnDelete: e.preservePointerOnDelete,
ptr: e.ptr,
ptrType: e.ptrType,
smartPtr: e.smartPtr,
smartPtrType: e.smartPtrType
}), _t = (e) => {
function t(n) {
return n.$$.ptrType.registeredClass.name;
}
x(t(e) + " instance already deleted");
}, St = !1, zt = (e) => {
}, $n = (e) => {
e.smartPtr ? e.smartPtrType.rawDestructor(e.smartPtr) : e.ptrType.registeredClass.rawDestructor(e.ptr);
}, Gt = (e) => {
e.count.value -= 1;
var t = e.count.value === 0;
t && $n(e);
}, Yt = (e, t, n) => {
if (t === n)
return e;
if (n.baseClass === void 0)
return null;
var a = Yt(e, t, n.baseClass);
return a === null ? null : n.downcast(a);
}, Jt = {}, _n = () => Object.keys(Re).length, Sn = () => {
var e = [];
for (var t in Re)
Re.hasOwnProperty(t) && e.push(Re[t]);
return e;
}, Ae = [], Pt = () => {
for (; Ae.length; ) {
var e = Ae.pop();
e.$$.deleteScheduled = !1, e.delete();
}
}, xe, Pn = (e) => {
xe = e, Ae.length && xe && xe(Pt);
}, Tn = () => {
i.getInheritedInstanceCount = _n, i.getLiveInheritedInstances = Sn, i.flushPendingDeletes = Pt, i.setDelayFunction = Pn;
}, Re = {}, En = (e, t) => {
for (t === void 0 && x("ptr should not be undefined"); e.baseClass; )
t = e.upcast(t), e = e.baseClass;
return t;
}, On = (e, t) => (t = En(e, t), Re[t]), Xe = (e, t) => {
(!t.ptrType || !t.ptr) && Qe("makeClassHandle requires ptr and ptrType");
var n = !!t.smartPtrType, a = !!t.smartPtr;
return n !== a && Qe("Both smartPtrType and smartPtr must be specified"), t.count = {
value: 1
}, ke(Object.create(e, {
$$: {
value: t,
writable: !0
}
}));
};
function Mn(e) {
var t = this.getPointee(e);
if (!t)
return this.destructor(e), null;
var n = On(this.registeredClass, t);
if (n !== void 0) {
if (n.$$.count.value === 0)
return n.$$.ptr = t, n.$$.smartPtr = e, n.clone();
var a = n.clone();
return this.destructor(e), a;
}
function s() {
return this.isSmartPointer ? Xe(this.registeredClass.instancePrototype, {
ptrType: this.pointeeType,
ptr: t,
smartPtrType: this,
smartPtr: e
}) : Xe(this.registeredClass.instancePrototype, {
ptrType: this,
ptr: e
});
}
var u = this.registeredClass.getActualType(t), d = Jt[u];
if (!d)
return s.call(this);
var f;
this.isConst ? f = d.constPointerType : f = d.pointerType;
var m = Yt(t, this.registeredClass, f.registeredClass);
return m === null ? s.call(this) : this.isSmartPointer ? Xe(f.registeredClass.instancePrototype, {
ptrType: f,
ptr: m,
smartPtrType: this,
smartPtr: e
}) : Xe(f.registeredClass.instancePrototype, {
ptrType: f,
ptr: m
});
}
var ke = (e) => typeof FinalizationRegistry > "u" ? (ke = (t) => t, e) : (St = new FinalizationRegistry((t) => {
Gt(t.$$);
}), ke = (t) => {
var n = t.$$, a = !!n.smartPtr;
if (a) {
var s = {
$$: n
};
St.register(t, s, t);
}
return t;
}, zt = (t) => St.unregister(t), ke(e)), Dn = () => {
Object.assign(Ze.prototype, {
isAliasOf(e) {
if (!(this instanceof Ze) || !(e instanceof Ze))
return !1;
var t = this.$$.ptrType.registeredClass, n = this.$$.ptr;
e.$$ = e.$$;
for (var a = e.$$.ptrType.registeredClass, s = e.$$.ptr; t.baseClass; )
n = t.upcast(n), t = t.baseClass;
for (; a.baseClass; )
s = a.upcast(s), a = a.baseClass;
return t === a && n === s;
},
clone() {
if (this.$$.ptr || _t(this), this.$$.preservePointerOnDelete)
return this.$$.count.value += 1, this;
var e = ke(Object.create(Object.getPrototypeOf(this), {
$$: {
value: Cn(this.$$)
}
}));
return e.$$.count.value += 1, e.$$.deleteScheduled = !1, e;
},
delete() {
this.$$.ptr || _t(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && x("Object already scheduled for deletion"), zt(this), Gt(this.$$), this.$$.preservePointerOnDelete || (this.$$.smartPtr = void 0, this.$$.ptr = void 0);
},
isDeleted() {
return !this.$$.ptr;
},
deleteLater() {
return this.$$.ptr || _t(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && x("Object already scheduled for deletion"), Ae.push(this), Ae.length === 1 && xe && xe(Pt), this.$$.deleteScheduled = !0, this;
}
});
};
function Ze() {
}
var Ie = (e, t) => Object.defineProperty(t, "name", {
value: e
}), Qt = (e, t, n) => {
if (e[t].overloadTable === void 0) {
var a = e[t];
e[t] = function() {
return e[t].overloadTable.hasOwnProperty(arguments.length) || x(`Function '${n}' 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[a.argCount] = a;
}
}, Tt = (e, t, n) => {
i.hasOwnProperty(e) ? ((n === void 0 || i[e].overloadTable !== void 0 && i[e].overloadTable[n] !== void 0) && x(`Cannot register public name '${e}' twice`), Qt(i, e, e), i.hasOwnProperty(n) && x(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`), i[e].overloadTable[n] = t) : (i[e] = t, n !== void 0 && (i[e].numArguments = n));
}, An = 48, xn = 57, Rn = (e) => {
if (e === void 0)
return "_unknown";
e = e.replace(/[^a-zA-Z0-9_]/g, "$");
var t = e.charCodeAt(0);
return t >= An && t <= xn ? `_${e}` : e;
};
function kn(e, t, n, a, s, u, d, f) {
this.name = e, this.constructor = t, this.instancePrototype = n, this.rawDestructor = a, this.baseClass = s, this.getActualType = u, this.upcast = d, this.downcast = f, this.pureVirtualFunctions = [];
}
var Et = (e, t, n) => {
for (; t !== n; )
t.upcast || x(`Expected null or instance of ${n.name}, got an instance of ${t.name}`), e = t.upcast(e), t = t.baseClass;
return e;
};
function In(e, t) {
if (t === null)
return this.isReference && x(`null is not a valid ${this.name}`), 0;
t.$$ || x(`Cannot pass "${xt(t)}" as a ${this.name}`), t.$$.ptr || x(`Cannot pass deleted object as a pointer of type ${this.name}`);
var n = t.$$.ptrType.registeredClass, a = Et(t.$$.ptr, n, this.registeredClass);
return a;
}
function Fn(e, t) {
var n;
if (t === null)
return this.isReference && x(`null is not a valid ${this.name}`), this.isSmartPointer ? (n = this.rawConstructor(), e !== null && e.push(this.rawDestructor, n), n) : 0;
(!t || !t.$$) && x(`Cannot pass "${xt(t)}" as a ${this.name}`), t.$$.ptr || x(`Cannot pass deleted object as a pointer of type ${this.name}`), !this.isConst && t.$$.ptrType.isConst && x(`Cannot convert argument of type ${t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name} to parameter type ${this.name}`);
var a = t.$$.ptrType.registeredClass;
if (n = Et(t.$$.ptr, a, this.registeredClass), this.isSmartPointer)
switch (t.$$.smartPtr === void 0 && x("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) {
case 0:
t.$$.smartPtrType === this ? n = t.$$.smartPtr : x(`Cannot convert argument of type ${t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name} to parameter type ${this.name}`);
break;
case 1:
n = t.$$.smartPtr;
break;
case 2:
if (t.$$.smartPtrType === this)
n = t.$$.smartPtr;
else {
var s = t.clone();
n = this.rawShare(n, ce.toHandle(() => s.delete())), e !== null && e.push(this.rawDestructor, n);
}
break;
default:
x("Unsupporting sharing policy");
}
return n;
}
function Un(e, t) {
if (t === null)
return this.isReference && x(`null is not a valid ${this.name}`), 0;
t.$$ || x(`Cannot pass "${xt(t)}" as a ${this.name}`), t.$$.ptr || x(`Cannot pass deleted object as a pointer of type ${this.name}`), t.$$.ptrType.isConst && x(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);
var n = t.$$.ptrType.registeredClass, a = Et(t.$$.ptr, n, this.registeredClass);
return a;
}
function Xt(e) {
return this.fromWireType(D[e >> 2]);
}
var Wn = () => {
Object.assign(Ke.prototype, {
getPointee(e) {
return this.rawGetPointee && (e = this.rawGetPointee(e)), e;
},
destructor(e) {
var t;
(t = this.rawDestructor) === null || t === void 0 || t.call(this, e);
},
argPackAdvance: ne,
readValueFromPointer: Xt,
deleteObject(e) {
e !== null && e.delete();
},
fromWireType: Mn
});
};
function Ke(e, t, n, a, s, u, d, f, m, w, _) {
this.name = e, this.registeredClass = t, this.isReference = n, this.isConst = a, this.isSmartPointer = s, this.pointeeType = u, this.sharingPolicy = d, this.rawGetPointee = f, this.rawConstructor = m, this.rawShare = w, this.rawDestructor = _, !s && t.baseClass === void 0 ? a ? (this.toWireType = In, this.destructorFunction = null) : (this.toWireType = Un, this.destructorFunction = null) : this.toWireType = Fn;
}
var Zt = (e, t, n) => {
i.hasOwnProperty(e) || Qe("Replacing nonexistant public symbol"), i[e].overloadTable !== void 0 && n !== void 0 ? i[e].overloadTable[n] = t : (i[e] = t, i[e].argCount = n);
}, Ln = (e, t, n) => {
var a = i["dynCall_" + e];
return n && n.length ? a.apply(null, [t].concat(n)) : a.call(null, t);
}, et = [], Kt, H = (e) => {
var t = et[e];
return t || (e >= et.length && (et.length = e + 1), et[e] = t = Kt.get(e)), t;
}, jn = (e, t, n) => {
if (e.includes("j"))
return Ln(e, t, n);
var a = H(t).apply(null, n);
return a;
}, Hn = (e, t) => {
var n = [];
return function() {
return n.length = 0, Object.assign(n, arguments), jn(e, t, n);
};
}, ee = (e, t) => {
e = Y(e);
function n() {
return e.includes("j") ? Hn(e, t) : H(t);
}
var a = n();
return typeof a != "function" && x(`unknown function pointer with signature ${e}: ${t}`), a;
}, Bn = (e, t) => {
var n = Ie(t, function(a) {
this.name = t, this.message = a;
var s = new Error(a).stack;
s !== void 0 && (this.stack = this.toString() + `
` + s.replace(/^Error(:[^\n]*)?\n/, ""));
});
return n.prototype = Object.create(e.prototype), n.prototype.constructor = n, n.prototype.toString = function() {
return this.message === void 0 ? this.name : `${this.name}: ${this.message}`;
}, n;
}, er, tr = (e) => {
var t = dr(e), n = Y(t);
return ue(t), n;
}, tt = (e, t) => {
var n = [], a = {};
function s(u) {
if (!a[u] && !ye[u]) {
if (Je[u]) {
Je[u].forEach(s);
return;
}
n.push(u), a[u] = !0;
}
}
throw t.forEach(s), new er(`${e}: ` + n.map(tr).join([", "]));
}, Vn = (e, t, n, a, s, u, d, f, m, w, _, T, E) => {
_ = Y(_), u = ee(s, u), f && (f = ee(d, f)), w && (w = ee(m, w)), E = ee(T, E);
var O = Rn(_);
Tt(O, function() {
tt(`Cannot construct ${_} due to unbound types`, [a]);
}), ge([e, t, n], a ? [a] : [], function(j) {
j = j[0];
var q, I;
a ? (q = j.registeredClass, I = q.instancePrototype) : I = Ze.prototype;
var J = Ie(_, function() {
if (Object.getPrototypeOf(this) !== y)
throw new _e("Use 'new' to construct " + _);
if (P.constructor_body === void 0)
throw new _e(_ + " has no accessible constructor");
var wr = P.constructor_body[arguments.length];
if (wr === void 0)
throw new _e(`Tried to invoke ctor of ${_} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(P.constructor_body).toString()}) parameters instead!`);
return wr.apply(this, arguments);
}), y = Object.create(I, {
constructor: {
value: J
}
});
J.prototype = y;
var P = new kn(_, J, y, E, q, u, f, w);
if (P.baseClass) {
var N, G;
(G = (N = P.baseClass).__derivedClasses) !== null && G !== void 0 || (N.__derivedClasses = []), P.baseClass.__derivedClasses.push(P);
}
var Se = new Ke(_, P, !0, !1, !1), at = new Ke(_ + "*", P, !1, !1, !1), gr = new Ke(_ + " const*", P, !1, !0, !1);
return Jt[e] = {
pointerType: at,
constPointerType: gr
}, Zt(O, J), [Se, at, gr];
});
}, Ot = (e, t) => {
for (var n = [], a = 0; a < e; a++)
n.push(D[t + a * 4 >> 2]);
return n;
};
function qn(e) {
for (var t = 1; t < e.length; ++t)
if (e[t] !== null && e[t].destructorFunction === void 0)
return !0;
return !1;
}
function Mt(e, t, n, a, s, u) {
var d = t.length;
d < 2 && x("argTypes array size mismatch! Must at least get return value and 'this' types!");
var f = t[1] !== null && n !== null, m = qn(t), w = t[0].name !== "void", _ = d - 2, T = new Array(_), E = [], O = [], j = function() {
arguments.length !== _ && x(`function ${e} called with ${arguments.length} arguments, expected ${_}`), O.length = 0;
var q;
E.length = f ? 2 : 1, E[0] = s, f && (q = t[1].toWireType(O, this), E[1] = q);
for (var I = 0; I < _; ++I)
T[I] = t[I + 2].toWireType(O, arguments[I]), E.push(T[I]);
var J = a.apply(null, E);
function y(P) {
if (m)
Ct(O);
else
for (var N = f ? 1 : 2; N < t.length; N++) {
var G = N === 1 ? q : T[N - 2];
t[N].destructorFunction !== null && t[N].destructorFunction(G);
}
if (w)
return t[0].fromWireType(P);
}
return y(J);
};
return Ie(e, j);
}
var Nn = (e, t, n, a, s, u) => {
var d = Ot(t, n);
s = ee(a, s), ge([], [e], function(f) {
f = f[0];
var m = `constructor ${f.name}`;
if (f.registeredClass.constructor_body === void 0 && (f.registeredClass.constructor_body = []), f.registeredClass.constructor_body[t - 1] !== void 0)
throw new _e(`Cannot register multiple constructors with identical number of parameters (${t - 1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
return f.registeredClass.constructor_body[t - 1] = () => {
tt(`Cannot construct ${f.name} due to unbound types`, d);
}, ge([], d, (w) => (w.splice(1, 0, null), f.registeredClass.constructor_body[t - 1] = Mt(m, w, null, s, u), [])), [];
});
}, rr = (e) => {
e = e.trim();
const t = e.indexOf("(");
return t !== -1 ? e.substr(0, t) : e;
}, zn = (e, t, n, a, s, u, d, f, m) => {
var w = Ot(n, a);
t = Y(t), t = rr(t), u = ee(s, u), ge([], [e], function(_) {
_ = _[0];
var T = `${_.name}.${t}`;
t.startsWith("@@") && (t = Symbol[t.substring(2)]), f && _.registeredClass.pureVirtualFunctions.push(t);
function E() {
tt(`Cannot call ${T} due to unbound types`, w);
}
var O = _.registeredClass.instancePrototype, j = O[t];
return j === void 0 || j.overloadTable === void 0 && j.className !== _.name && j.argCount === n - 2 ? (E.argCount = n - 2, E.className = _.name, O[t] = E) : (Qt(O, t, T), O[t].overloadTable[n - 2] = E), ge([], w, function(q) {
var I = Mt(T, q, _, u, d);
return O[t].overloadTable === void 0 ? (I.argCount = n - 2, O[t] = I) : O[t].overloadTable[n - 2] = I, [];
}), [];
});
};
function Gn() {
Object.assign(nr.prototype, {
get(e) {
return this.allocated[e];
},
has(e) {
return this.allocated[e] !== void 0;
},
allocate(e) {
var t = this.freelist.pop() || this.allocated.length;
return this.allocated[t] = e, t;
},
free(e) {
this.allocated[e] = void 0, this.freelist.push(e);
}
});
}
function nr() {
this.allocated = [void 0], this.freelist = [];
}
var K = new nr(), Dt = (e) => {
e >= K.reserved && --K.get(e).refcount === 0 && K.free(e);
}, Yn = () => {
for (var e = 0, t = K.reserved; t < K.allocated.length; ++t)
K.allocated[t] !== void 0 && ++e;
return e;
}, Jn = () => {
K.allocated.push({
value: void 0
}, {
value: null
}, {
value: !0
}, {
value: !1
}), K.reserved = K.allocated.length, i.count_emval_handles = Yn;
}, ce = {
toValue: (e) => (e || x("Cannot use deleted val. handle = " + e), K.get(e).value),
toHandle: (e) => {
switch (e) {
case void 0:
return 1;
case null:
return 2;
case !0:
return 3;
case !1:
return 4;
default:
return K.allocate({
refcount: 1,
value: e
});
}
}
}, Qn = (e, t) => {
t = Y(t), re(e, {
name: t,
fromWireType: (n) => {
var a = ce.toValue(n);
return Dt(n), a;
},
toWireType: (n, a) => ce.toHandle(a),
argPackAdvance: ne,
readValueFromPointer: $t,
destructorFunction: null
});
}, Xn = (e, t, n) => {
switch (t) {
case 1:
return n ? function(a) {
return this.fromWireType(R[a >> 0]);
} : function(a) {
return this.fromWireType(A[a >> 0]);
};
case 2:
return n ? function(a) {
return this.fromWireType(X[a >> 1]);
} : function(a) {
return this.fromWireType(k[a >> 1]);
};
case 4:
return n ? function(a) {
return this.fromWireType(M[a >> 2]);
} : function(a) {
return this.fromWireType(D[a >> 2]);
};
default:
throw new TypeError(`invalid integer width (${t}): ${e}`);
}
}, Zn = (e, t, n, a) => {
t = Y(t);
function s() {
}
s.values = {}, re(e, {
name: t,
constructor: s,
fromWireType: function(u) {
return this.constructor.values[u];
},
toWireType: (u, d) => d.value,
argPackAdvance: ne,
readValueFromPointer: Xn(t, n, a),
destructorFunction: null
}), Tt(t, s);
}, At = (e, t) => {
var n = ye[e];
return n === void 0 && x(t + " has unknown type " + tr(e)), n;
}, Kn = (e, t, n) => {
var a = At(e, "enum");
t = Y(t);
var s = a.constructor, u = Object.create(a.constructor.prototype, {
value: {
value: n
},
constructor: {
value: Ie(`${a.name}_${t}`, function() {
})
}
});
s.values[n] = u, s[t] = u;
}, xt = (e) => {
if (e === null)
return "null";
var t = typeof e;
return t === "object" || t === "array" || t === "function" ? e.toString() : "" + e;
}, ea = (e, t) => {
switch (t) {
case 4:
return function(n) {
return this.fromWireType(le[n >> 2]);
};
case 8:
return function(n) {
return this.fromWireType(ie[n >> 3]);
};
default:
throw new TypeError(`invalid float width (${t}): ${e}`);
}
}, ta = (e, t, n) => {
t = Y(t), re(e, {
name: t,
fromWireType: (a) => a,
toWireType: (a, s) => s,
argPackAdvance: ne,
readValueFromPointer: ea(t, n),
destructorFunction: null
});
}, ra = (e, t, n, a, s, u, d) => {
var f = Ot(t, n);
e = Y(e), e = rr(e), s = ee(a, s), Tt(e, function() {
tt(`Cannot call ${e} due to unbound types`, f);
}, t - 1), ge([], f, function(m) {
var w = [m[0], null].concat(m.slice(1));
return Zt(e, Mt(e, w, null, s, u), t - 1), [];
});
}, na = (e, t, n) => {
switch (t) {
case 1:
return n ? (a) => R[a >> 0] : (a) => A[a >> 0];
case 2:
return n ? (a) => X[a >> 1] : (a) => k[a >> 1];
case 4:
return n ? (a) => M[a >> 2] : (a) => D[a >> 2];
default:
throw new TypeError(`invalid integer width (${t}): ${e}`);
}
}, aa = (e, t, n, a, s) => {
t = Y(t);
var u = (_) => _;
if (a === 0) {
var d = 32 - 8 * n;
u = (_) => _ << d >>> d;
}
var f = t.includes("unsigned"), m = (_, T) => {
}, w;
f ? w = function(_, T) {
return m(T, this.name), T >>> 0;
} : w = function(_, T) {
return m(T, this.name), T;
}, re(e, {
name: t,
fromWireType: u,
toWireType: w,
argPackAdvance: ne,
readValueFromPointer: na(t, n, a !== 0),
destructorFunction: null
});
}, oa = (e, t, n) => {
var a = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], s = a[t];
function u(d) {
var f = D[d >> 2], m = D[d + 4 >> 2];
return new s(R.buffer, m, f);
}
n = Y(n), re(e, {
name: n,
fromWireType: u,
argPackAdvance: ne,
readValueFromPointer: u
}, {
ignoreDuplicateRegistrations: !0
});
}, ar = (e, t, n, a) => {
if (!(a > 0))
return 0;
for (var s = n, u = n + a - 1, d = 0; d < e.length; ++d) {
var f = e.charCodeAt(d);
if (f >= 55296 && f <= 57343) {
var m = e.charCodeAt(++d);
f = 65536 + ((f & 1023) << 10) | m & 1023;
}
if (f <= 127) {
if (n >= u)
break;
t[n++] = f;
} else if (f <= 2047) {
if (n + 1 >= u)
break;
t[n++] = 192 | f >> 6, t[n++] = 128 | f & 63;
} else if (f <= 65535) {
if (n + 2 >= u)
break;
t[n++] = 224 | f >> 12, t[n++] = 128 | f >> 6 & 63, t[n++] = 128 | f & 63;
} else {
if (n + 3 >= u)
break;
t[n++] = 240 | f >> 18, t[n++] = 128 | f >> 12 & 63, t[n++] = 128 | f >> 6 & 63, t[n++] = 128 | f & 63;
}
}
return t[n] = 0, n - s;
}, ia = (e, t, n) => ar(e, A, t, n), or = (e) => {
for (var t = 0, n = 0; n < e.length; ++n) {
var a = e.charCodeAt(n);
a <= 127 ? t++ : a <= 2047 ? t += 2 : a >= 55296 && a <= 57343 ? (t += 4, ++n) : t += 3;
}
return t;
}, ir = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0, sa = (e, t, n) => {
for (var a = t + n, s = t; e[s] && !(s >= a); )
++s;
if (s - t > 16 && e.buffer && ir)
return ir.decode(e.subarray(t, s));
for (var u = ""; t < s; ) {
var d = e[t++];
if (!(d & 128)) {
u += String.fromCharCode(d);
continue;
}
var f = e[t++] & 63;
if ((d & 224) == 192) {
u += String.fromCharCode((d & 31) << 6 | f);
continue;
}
var m = e[t++] & 63;
if ((d & 240) == 224 ? d = (d & 15) << 12 | f << 6 | m : d = (d & 7) << 18 | f << 12 | m << 6 | e[t++] & 63, d < 65536)
u += String.fromCharCode(d);
else {
var w = d - 65536;
u += String.fromCharCode(55296 | w >> 10, 56320 | w & 1023);
}
}
return u;
}, Rt = (e, t) => e ? sa(A, e, t) : "", ca = (e, t) => {
t = Y(t);
var n = t === "std::string";
re(e, {
name: t,
fromWireType(a) {
var s = D[a >> 2], u = a + 4, d;
if (n)
for (var f = u, m = 0; m <= s; ++m) {
var w = u + m;
if (m == s || A[w] == 0) {
var _ = w - f, T = Rt(f, _);
d === void 0 ? d = T : (d += "\0", d += T), f = w + 1;
}
}
else {
for (var E = new Array(s), m = 0; m < s; ++m)
E[m] = String.fromCharCode(A[u + m]);
d = E.join("");
}
return ue(a), d;
},
toWireType(a, s) {
s instanceof ArrayBuffer && (s = new Uint8Array(s));
var u, d = typeof s == "string";
d || s instanceof Uint8Array || s instanceof Uint8ClampedArray || s instanceof Int8Array || x("Cannot pass non-string to std::string"), n && d ? u = or(s) : u = s.length;
var f = Ft(4 + u + 1), m = f + 4;
if (D[f >> 2] = u, n && d)
ia(s, m, u + 1);
else if (d)
for (var w = 0; w < u; ++w) {
var _ = s.charCodeAt(w);
_ > 255 && (ue(m), x("String has UTF-16 code units that do not fit in 8 bits")), A[m + w] = _;
}
else
for (var w = 0; w < u; ++w)
A[m + w] = s[w];
return a !== null && a.push(ue, f), f;
},
argPackAdvance: ne,
readValueFromPointer: Xt,
destructorFunction(a) {
ue(a);
}
});
}, sr = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0, ua = (e, t) => {
for (var n = e, a = n >> 1, s = a + t / 2; !(a >= s) && k[a]; )
++a;
if (n = a << 1, n - e > 32 && sr)
return sr.decode(A.subarray(e, n));
for (var u = "", d = 0; !(d >= t / 2); ++d) {
var f = X[e + d * 2 >> 1];
if (f == 0)
break;
u += String.fromCharCode(f);
}
return u;
}, la = (e, t, n) => {
var a;
if ((a = n) !== null && a !== void 0 || (n = 2147483647), n < 2)
return 0;
n -= 2;
for (var s = t, u = n < e.length * 2 ? n / 2 : e.length, d = 0; d < u; ++d) {
var f = e.charCodeAt(d);
X[t >> 1] = f, t += 2;
}
return X[t >> 1] = 0, t - s;
}, da = (e) => e.length * 2, fa = (e, t) => {
for (var n = 0, a = ""; !(n >= t / 4); ) {
var s = M[e + n * 4 >> 2];
if (s == 0)
break;
if (++n, s >= 65536) {
var u = s - 65536;
a += String.fromCharCode(55296 | u >> 10, 56320 | u & 1023);
} else
a += String.fromCharCode(s);
}
return a;
}, ha = (e, t, n) => {
var a;
if ((a = n) !== null && a !== void 0 || (n = 2147483647), n < 4)
return 0;
for (var s = t, u = s + n - 4, d = 0; d < e.length; ++d) {
var f = e.charCodeAt(d);
if (f >= 55296 && f <= 57343) {
var m = e.charCodeAt(++d);
f = 65536 + ((f & 1023) << 10) | m & 1023;
}
if (M[t >> 2] = f, t += 4, t + 4 > u)
break;
}
return M[t >> 2] = 0, t - s;
}, pa = (e) => {
for (var t = 0, n = 0; n < e.length; ++n) {
var a = e.charCodeAt(n);
a >= 55296 && a <= 57343 && ++n, t += 4;
}
return t;
}, ma = (e, t, n) => {
n = Y(n);
var a, s, u, d, f;
t === 2 ? (a = ua, s = la, d = da, u = () => k, f = 1) : t === 4 && (a = fa, s = ha, d = pa, u = () => D, f = 2), re(e, {
name: n,
fromWireType: (m) => {
for (var w = D[m >> 2], _ = u(), T, E = m + 4, O = 0; O <= w; ++O) {
var j = m + 4 + O * t;
if (O == w || _[j >> f] == 0) {
var q = j - E, I = a(E, q);
T === void 0 ? T = I : (T += "\0", T += I), E = j + t;
}
}
return ue(m), T;
},
toWireType: (m, w) => {
typeof w != "string" && x(`Cannot pass non-string to C++ string type ${n}`);
var _ = d(w), T = Ft(4 + _ + t);
return D[T >> 2] = _ >> f, s(w, T + 4, _ + t), m !== null && m.push(ue, T), T;
},
argPackAdvance: ne,
readValueFromPointer: $t,
destructorFunction(m) {
ue(m);
}
});
}, va = (e, t, n, a, s, u) => {
Ye[e] = {
name: Y(t),
rawConstructor: ee(n, a),
rawDestructor: ee(s, u),
fields: []
};
}, ya = (e, t, n, a, s, u, d, f, m, w) => {
Ye[e].fields.push({
fieldName: Y(t),
getterReturnType: n,
getter: ee(a, s),
getterContext: u,
setterArgumentType: d,
setter: ee(f, m),
setterContext: w
});
}, ga = (e, t) => {
t = Y(t), re(e, {
isVoid: !0,
name: t,
argPackAdvance: 0,
fromWireType: () => {
},
toWireType: (n, a) => {
}
});
}, kt = [], wa = (e, t, n, a) => (e = kt[e], t = ce.toValue(t), e(null, t, n, a)), ba = {}, Ca = (e) => {
var t = ba[e];
return t === void 0 ? Y(e) : t;
}, cr = () => {
if (typeof globalThis == "object")
return globalThis;
function e(t) {