UNPKG

@innovatrics/dot-document-auto-capture

Version:
1,426 lines 390 kB
const Ir = /* @__PURE__ */ Symbol("Comlink.proxy"), Co = /* @__PURE__ */ Symbol("Comlink.endpoint"), ko = /* @__PURE__ */ Symbol("Comlink.releaseProxy"), We = /* @__PURE__ */ Symbol("Comlink.finalizer"), Ve = /* @__PURE__ */ Symbol("Comlink.thrown"), jr = (g) => typeof g == "object" && g !== null || typeof g == "function", Ao = { canHandle: (g) => jr(g) && g[Ir], serialize(g) { const { port1: s, port2: r } = new MessageChannel(); return gt(g, s), [r, [r]]; }, deserialize(g) { return g.start(), Mo(g); } }, To = { canHandle: (g) => jr(g) && Ve in g, serialize({ value: g }) { let s; return g instanceof Error ? s = { isError: !0, value: { message: g.message, name: g.name, stack: g.stack } } : s = { isError: !1, value: g }, [s, []]; }, deserialize(g) { throw g.isError ? Object.assign(new Error(g.value.message), g.value) : g.value; } }, Sr = /* @__PURE__ */ new Map([ ["proxy", Ao], ["throw", To] ]); function Do(g, s) { for (const r of g) if (s === r || r === "*" || r instanceof RegExp && r.test(s)) return !0; return !1; } function gt(g, s = globalThis, r = ["*"]) { s.addEventListener("message", function t(e) { if (!e || !e.data) return; if (!Do(r, e.origin)) { console.warn(`Invalid origin '${e.origin}' for comlink proxy`); return; } const { id: n, type: o, path: u } = Object.assign({ path: [] }, e.data), a = (e.data.argumentList || []).map(ce); let y; try { const j = u.slice(0, -1).reduce((v, I) => v[I], g), h = u.reduce((v, I) => v[I], g); switch (o) { case "GET": y = h; break; case "SET": j[u.slice(-1)[0]] = ce(e.data.value), y = !0; break; case "APPLY": y = h.apply(j, a); break; case "CONSTRUCT": { const v = new h(...a); y = xo(v); } break; case "ENDPOINT": { const { port1: v, port2: I } = new MessageChannel(); gt(g, I), y = Fo(v, [v]); } break; case "RELEASE": y = void 0; break; default: return; } } catch (j) { y = { value: j, [Ve]: 0 }; } Promise.resolve(y).catch((j) => ({ value: j, [Ve]: 0 })).then((j) => { const [h, v] = Ge(j); s.postMessage(Object.assign(Object.assign({}, h), { id: n }), v), o === "RELEASE" && (s.removeEventListener("message", t), Cr(s), We in g && typeof g[We] == "function" && g[We]()); }).catch((j) => { const [h, v] = Ge({ value: new TypeError("Unserializable return value"), [Ve]: 0 }); s.postMessage(Object.assign(Object.assign({}, h), { id: n }), v); }); }), s.start && s.start(); } function Eo(g) { return g.constructor.name === "MessagePort"; } function Cr(g) { Eo(g) && g.close(); } function Mo(g, s) { const r = /* @__PURE__ */ new Map(); return g.addEventListener("message", function(e) { const { data: n } = e; if (!n || !n.id) return; const o = r.get(n.id); if (o) try { o(n); } finally { r.delete(n.id); } }), mt(g, r, [], s); } function Fe(g) { if (g) throw new Error("Proxy has been released and is not useable"); } function kr(g) { return ye(g, /* @__PURE__ */ new Map(), { type: "RELEASE" }).then(() => { Cr(g); }); } const ze = /* @__PURE__ */ new WeakMap(), Ue = "FinalizationRegistry" in globalThis && new FinalizationRegistry((g) => { const s = (ze.get(g) || 0) - 1; ze.set(g, s), s === 0 && kr(g); }); function Ro(g, s) { const r = (ze.get(s) || 0) + 1; ze.set(s, r), Ue && Ue.register(g, s, g); } function Lo(g) { Ue && Ue.unregister(g); } function mt(g, s, r = [], t = function() { }) { let e = !1; const n = new Proxy(t, { get(o, u) { if (Fe(e), u === ko) return () => { Lo(n), kr(g), s.clear(), e = !0; }; if (u === "then") { if (r.length === 0) return { then: () => n }; const a = ye(g, s, { type: "GET", path: r.map((y) => y.toString()) }).then(ce); return a.then.bind(a); } return mt(g, s, [...r, u]); }, set(o, u, a) { Fe(e); const [y, j] = Ge(a); return ye(g, s, { type: "SET", path: [...r, u].map((h) => h.toString()), value: y }, j).then(ce); }, apply(o, u, a) { Fe(e); const y = r[r.length - 1]; if (y === Co) return ye(g, s, { type: "ENDPOINT" }).then(ce); if (y === "bind") return mt(g, s, r.slice(0, -1)); const [j, h] = Kt(a); return ye(g, s, { type: "APPLY", path: r.map((v) => v.toString()), argumentList: j }, h).then(ce); }, construct(o, u) { Fe(e); const [a, y] = Kt(u); return ye(g, s, { type: "CONSTRUCT", path: r.map((j) => j.toString()), argumentList: a }, y).then(ce); } }); return Ro(n, g), n; } function _o(g) { return Array.prototype.concat.apply([], g); } function Kt(g) { const s = g.map(Ge); return [s.map((r) => r[0]), _o(s.map((r) => r[1]))]; } const Ar = /* @__PURE__ */ new WeakMap(); function Fo(g, s) { return Ar.set(g, s), g; } function xo(g) { return Object.assign(g, { [Ir]: !0 }); } function Ge(g) { for (const [s, r] of Sr) if (r.canHandle(g)) { const [t, e] = r.serialize(g); return [ { type: "HANDLER", name: s, value: t }, e ]; } return [ { type: "RAW", value: g }, Ar.get(g) || [] ]; } function ce(g) { switch (g.type) { case "HANDLER": return Sr.get(g.name).deserialize(g.value); case "RAW": return g.value; } } function ye(g, s, r, t) { return new Promise((e) => { const n = No(); s.set(n, e), g.start && g.start(), g.postMessage(Object.assign({ id: n }, r), t); }); } function No() { return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-"); } const xe = 1e3, qt = { simd: "sam_simd.wasm", sam: "sam.wasm" }, Wo = async () => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11])); class $ extends Error { cause; constructor(s, r) { super(s), this.name = "AutoCaptureError", this.cause = r; } // Change this to Decorator when they will be in stable release static logError(s) { } static fromCameraError(s) { if (this.logError(s), s instanceof $) return s; let r; switch (s.name) { case "OverconstrainedError": r = "Minimum quality requirements are not met by your camera"; break; case "NotReadableError": case "AbortError": r = "The webcam is already in use by another application"; break; case "NotAllowedError": r = "To use your camera, you must allow permissions"; break; case "NotFoundError": r = "There is no camera available to you"; break; default: r = "An unknown camera error has occurred"; break; } return new $(r, s); } static fromError(s) { if (this.logError(s), s instanceof $) return s; const r = "An unexpected error has occurred"; return new $(r); } } const Vo = { RGBA: "RGBA" }; class zo { #e; #t; #r; constructor(s, r) { this.#e = s, this.#t = this.allocate(r.length * r.BYTES_PER_ELEMENT), this.#r = this.allocate(r.length * r.BYTES_PER_ELEMENT); } get rgbaImagePointer() { return this.#t; } get bgr0ImagePointer() { return this.#r; } allocate(s) { return this.#e._malloc(s); } free() { this.#e._free(this.#t), this.#e._free(this.#r); } writeDataToMemory(s) { this.#e.HEAPU8.set(s, this.#t); } } class Uo { samWasmModule; getOverriddenModules(s, r) { return { locateFile: (t) => new URL(r || t, s).href }; } async handleMissingOrInvalidSamModule(s, r) { try { const t = await fetch(s); if (!t.ok) throw new $( `The path to ${r} is incorrect or the module is missing. Please check provided path to wasm files. Current path is ${s}` ); const e = await t.arrayBuffer(); if (!WebAssembly.validate(e)) throw new $( `The provided ${r} is not a valid WASM module. Please check provided path to wasm files. Current path is ${s}` ); } catch (t) { if (t instanceof $) throw console.error( "You can find more information about how to host wasm files here: https://developers.innovatrics.com/digital-onboarding/technical/remote/dot-web-document/latest/documentation/#_hosting_sam_wasm" ), t; } } async getSamWasmFileName() { return await Wo() ? qt.simd : qt.sam; } async initSamModule(s, r) { if (this.samWasmModule) return; const t = await this.getSamWasmFileName(), e = this.getSamWasmFilePath(r, t); try { this.samWasmModule = await this.fetchSamModule(this.getOverriddenModules(s, e)), this.samWasmModule.init(); } catch { throw await this.handleMissingOrInvalidSamModule(e, t), new $("Could not init detector."); } } terminateSamModule() { this.samWasmModule?.terminate(); } async getSamVersion() { return (await this.samWasmModule?.getInfoString())?.trim(); } /* * In TS 5.2.0 was added special keyword "using" which could be perfect for this case. * Unfortunately, vite preact plugin does not support this version of TS yet. * Check possibility of using "using" keyword when vite preact plugin updates */ writeImageToMemory(s) { if (!this.samWasmModule) throw new $("SAM WASM module is not initialized"); const r = new zo(this.samWasmModule, s); return r.writeDataToMemory(s), r; } convertToSamColorImage(s, r) { if (!this.samWasmModule) throw new $("SAM WASM module is not initialized"); const t = this.writeImageToMemory(s); return this.samWasmModule.convertToSamColorImage( r.width, r.height, t.rgbaImagePointer, Vo.RGBA, t.bgr0ImagePointer ), t; } async getOptimalRegionForCompressionDetectionFromDetectionCorners(s, r, t) { if (!this.samWasmModule) throw new $("SAM WASM module is not initialized"); const e = this.convertToSamColorImage(s, r), { bottomLeft: n, topLeft: o, topRight: u } = t, a = [ o.x, // x o.y, // y u.x - o.x, // width n.y - o.y // height ], { height: y, width: j, x: h, y: v } = await this.samWasmModule.selectDetailRegion( r.width, r.height, e.bgr0ImagePointer, a ); return e.free(), { height: y, width: j, shiftX: h, shiftY: v }; } [We]() { this.terminateSamModule(); } } const Ne = (g, s) => Math.hypot(s.x - g.x, s.y - g.y), Go = (g) => { const { bottomLeft: s, bottomRight: r, topLeft: t, topRight: e } = g, n = Ne(t, e), o = Ne(e, r), u = Ne(s, r), a = Ne(t, s); return Math.min(n, o, u, a); }; var ge = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Xt = {}, rt = {}, nt, Qt; function $o() { if (Qt) return nt; Qt = 1, nt = g; function g(s, r) { for (var t = new Array(arguments.length - 1), e = 0, n = 2, o = !0; n < arguments.length; ) t[e++] = arguments[n++]; return new Promise(function(u, a) { t[e] = function(y) { if (o) if (o = !1, y) a(y); else { for (var j = new Array(arguments.length - 1), h = 0; h < j.length; ) j[h++] = arguments[h]; u.apply(null, j); } }; try { s.apply(r || null, t); } catch (y) { o && (o = !1, a(y)); } }); } return nt; } var er = {}, tr; function Bo() { return tr || (tr = 1, (function(g) { var s = g; s.length = function(o) { var u = o.length; if (!u) return 0; for (var a = 0; --u % 4 > 1 && o.charAt(u) === "="; ) ++a; return Math.ceil(o.length * 3) / 4 - a; }; for (var r = new Array(64), t = new Array(123), e = 0; e < 64; ) t[r[e] = e < 26 ? e + 65 : e < 52 ? e + 71 : e < 62 ? e - 4 : e - 59 | 43] = e++; s.encode = function(o, u, a) { for (var y = null, j = [], h = 0, v = 0, I; u < a; ) { var S = o[u++]; switch (v) { case 0: j[h++] = r[S >> 2], I = (S & 3) << 4, v = 1; break; case 1: j[h++] = r[I | S >> 4], I = (S & 15) << 2, v = 2; break; case 2: j[h++] = r[I | S >> 6], j[h++] = r[S & 63], v = 0; break; } h > 8191 && ((y || (y = [])).push(String.fromCharCode.apply(String, j)), h = 0); } return v && (j[h++] = r[I], j[h++] = 61, v === 1 && (j[h++] = 61)), y ? (h && y.push(String.fromCharCode.apply(String, j.slice(0, h))), y.join("")) : String.fromCharCode.apply(String, j.slice(0, h)); }; var n = "invalid encoding"; s.decode = function(o, u, a) { for (var y = a, j = 0, h, v = 0; v < o.length; ) { var I = o.charCodeAt(v++); if (I === 61 && j > 1) break; if ((I = t[I]) === void 0) throw Error(n); switch (j) { case 0: h = I, j = 1; break; case 1: u[a++] = h << 2 | (I & 48) >> 4, h = I, j = 2; break; case 2: u[a++] = (h & 15) << 4 | (I & 60) >> 2, h = I, j = 3; break; case 3: u[a++] = (h & 3) << 6 | I, j = 0; break; } } if (j === 1) throw Error(n); return a - y; }, s.test = function(o) { return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o); }; })(er)), er; } var ot, rr; function Ho() { if (rr) return ot; rr = 1, ot = g; function g() { this._listeners = {}; } return g.prototype.on = function(s, r, t) { return (this._listeners[s] || (this._listeners[s] = [])).push({ fn: r, ctx: t || this }), this; }, g.prototype.off = function(s, r) { if (s === void 0) this._listeners = {}; else if (r === void 0) this._listeners[s] = []; else for (var t = this._listeners[s], e = 0; e < t.length; ) t[e].fn === r ? t.splice(e, 1) : ++e; return this; }, g.prototype.emit = function(s) { var r = this._listeners[s]; if (r) { for (var t = [], e = 1; e < arguments.length; ) t.push(arguments[e++]); for (e = 0; e < r.length; ) r[e].fn.apply(r[e++].ctx, t); } return this; }, ot; } var it, nr; function Yo() { if (nr) return it; nr = 1, it = g(g); function g(n) { return typeof Float32Array < "u" ? (function() { var o = new Float32Array([-0]), u = new Uint8Array(o.buffer), a = u[3] === 128; function y(I, S, R) { o[0] = I, S[R] = u[0], S[R + 1] = u[1], S[R + 2] = u[2], S[R + 3] = u[3]; } function j(I, S, R) { o[0] = I, S[R] = u[3], S[R + 1] = u[2], S[R + 2] = u[1], S[R + 3] = u[0]; } n.writeFloatLE = a ? y : j, n.writeFloatBE = a ? j : y; function h(I, S) { return u[0] = I[S], u[1] = I[S + 1], u[2] = I[S + 2], u[3] = I[S + 3], o[0]; } function v(I, S) { return u[3] = I[S], u[2] = I[S + 1], u[1] = I[S + 2], u[0] = I[S + 3], o[0]; } n.readFloatLE = a ? h : v, n.readFloatBE = a ? v : h; })() : (function() { function o(a, y, j, h) { var v = y < 0 ? 1 : 0; if (v && (y = -y), y === 0) a(1 / y > 0 ? ( /* positive */ 0 ) : ( /* negative 0 */ 2147483648 ), j, h); else if (isNaN(y)) a(2143289344, j, h); else if (y > 34028234663852886e22) a((v << 31 | 2139095040) >>> 0, j, h); else if (y < 11754943508222875e-54) a((v << 31 | Math.round(y / 1401298464324817e-60)) >>> 0, j, h); else { var I = Math.floor(Math.log(y) / Math.LN2), S = Math.round(y * Math.pow(2, -I) * 8388608) & 8388607; a((v << 31 | I + 127 << 23 | S) >>> 0, j, h); } } n.writeFloatLE = o.bind(null, s), n.writeFloatBE = o.bind(null, r); function u(a, y, j) { var h = a(y, j), v = (h >> 31) * 2 + 1, I = h >>> 23 & 255, S = h & 8388607; return I === 255 ? S ? NaN : v * (1 / 0) : I === 0 ? v * 1401298464324817e-60 * S : v * Math.pow(2, I - 150) * (S + 8388608); } n.readFloatLE = u.bind(null, t), n.readFloatBE = u.bind(null, e); })(), typeof Float64Array < "u" ? (function() { var o = new Float64Array([-0]), u = new Uint8Array(o.buffer), a = u[7] === 128; function y(I, S, R) { o[0] = I, S[R] = u[0], S[R + 1] = u[1], S[R + 2] = u[2], S[R + 3] = u[3], S[R + 4] = u[4], S[R + 5] = u[5], S[R + 6] = u[6], S[R + 7] = u[7]; } function j(I, S, R) { o[0] = I, S[R] = u[7], S[R + 1] = u[6], S[R + 2] = u[5], S[R + 3] = u[4], S[R + 4] = u[3], S[R + 5] = u[2], S[R + 6] = u[1], S[R + 7] = u[0]; } n.writeDoubleLE = a ? y : j, n.writeDoubleBE = a ? j : y; function h(I, S) { return u[0] = I[S], u[1] = I[S + 1], u[2] = I[S + 2], u[3] = I[S + 3], u[4] = I[S + 4], u[5] = I[S + 5], u[6] = I[S + 6], u[7] = I[S + 7], o[0]; } function v(I, S) { return u[7] = I[S], u[6] = I[S + 1], u[5] = I[S + 2], u[4] = I[S + 3], u[3] = I[S + 4], u[2] = I[S + 5], u[1] = I[S + 6], u[0] = I[S + 7], o[0]; } n.readDoubleLE = a ? h : v, n.readDoubleBE = a ? v : h; })() : (function() { function o(a, y, j, h, v, I) { var S = h < 0 ? 1 : 0; if (S && (h = -h), h === 0) a(0, v, I + y), a(1 / h > 0 ? ( /* positive */ 0 ) : ( /* negative 0 */ 2147483648 ), v, I + j); else if (isNaN(h)) a(0, v, I + y), a(2146959360, v, I + j); else if (h > 17976931348623157e292) a(0, v, I + y), a((S << 31 | 2146435072) >>> 0, v, I + j); else { var R; if (h < 22250738585072014e-324) R = h / 5e-324, a(R >>> 0, v, I + y), a((S << 31 | R / 4294967296) >>> 0, v, I + j); else { var P = Math.floor(Math.log(h) / Math.LN2); P === 1024 && (P = 1023), R = h * Math.pow(2, -P), a(R * 4503599627370496 >>> 0, v, I + y), a((S << 31 | P + 1023 << 20 | R * 1048576 & 1048575) >>> 0, v, I + j); } } } n.writeDoubleLE = o.bind(null, s, 0, 4), n.writeDoubleBE = o.bind(null, r, 4, 0); function u(a, y, j, h, v) { var I = a(h, v + y), S = a(h, v + j), R = (S >> 31) * 2 + 1, P = S >>> 20 & 2047, T = 4294967296 * (S & 1048575) + I; return P === 2047 ? T ? NaN : R * (1 / 0) : P === 0 ? R * 5e-324 * T : R * Math.pow(2, P - 1075) * (T + 4503599627370496); } n.readDoubleLE = u.bind(null, t, 0, 4), n.readDoubleBE = u.bind(null, e, 4, 0); })(), n; } function s(n, o, u) { o[u] = n & 255, o[u + 1] = n >>> 8 & 255, o[u + 2] = n >>> 16 & 255, o[u + 3] = n >>> 24; } function r(n, o, u) { o[u] = n >>> 24, o[u + 1] = n >>> 16 & 255, o[u + 2] = n >>> 8 & 255, o[u + 3] = n & 255; } function t(n, o) { return (n[o] | n[o + 1] << 8 | n[o + 2] << 16 | n[o + 3] << 24) >>> 0; } function e(n, o) { return (n[o] << 24 | n[o + 1] << 16 | n[o + 2] << 8 | n[o + 3]) >>> 0; } return it; } function or(g) { throw new Error('Could not dynamically require "' + g + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var at, ir; function Jo() { if (ir) return at; ir = 1, at = g; function g(s) { try { if (typeof or != "function") return null; var r = or(s); return r && (r.length || Object.keys(r).length) ? r : null; } catch { return null; } } return at; } var ar = {}, sr; function Zo() { return sr || (sr = 1, (function(g) { var s = g; s.length = function(r) { for (var t = 0, e = 0, n = 0; n < r.length; ++n) e = r.charCodeAt(n), e < 128 ? t += 1 : e < 2048 ? t += 2 : (e & 64512) === 55296 && (r.charCodeAt(n + 1) & 64512) === 56320 ? (++n, t += 4) : t += 3; return t; }, s.read = function(r, t, e) { var n = e - t; if (n < 1) return ""; for (var o = null, u = [], a = 0, y; t < e; ) y = r[t++], y < 128 ? u[a++] = y : y > 191 && y < 224 ? u[a++] = (y & 31) << 6 | r[t++] & 63 : y > 239 && y < 365 ? (y = ((y & 7) << 18 | (r[t++] & 63) << 12 | (r[t++] & 63) << 6 | r[t++] & 63) - 65536, u[a++] = 55296 + (y >> 10), u[a++] = 56320 + (y & 1023)) : u[a++] = (y & 15) << 12 | (r[t++] & 63) << 6 | r[t++] & 63, a > 8191 && ((o || (o = [])).push(String.fromCharCode.apply(String, u)), a = 0); return o ? (a && o.push(String.fromCharCode.apply(String, u.slice(0, a))), o.join("")) : String.fromCharCode.apply(String, u.slice(0, a)); }, s.write = function(r, t, e) { for (var n = e, o, u, a = 0; a < r.length; ++a) o = r.charCodeAt(a), o < 128 ? t[e++] = o : o < 2048 ? (t[e++] = o >> 6 | 192, t[e++] = o & 63 | 128) : (o & 64512) === 55296 && ((u = r.charCodeAt(a + 1)) & 64512) === 56320 ? (o = 65536 + ((o & 1023) << 10) + (u & 1023), ++a, t[e++] = o >> 18 | 240, t[e++] = o >> 12 & 63 | 128, t[e++] = o >> 6 & 63 | 128, t[e++] = o & 63 | 128) : (t[e++] = o >> 12 | 224, t[e++] = o >> 6 & 63 | 128, t[e++] = o & 63 | 128); return e - n; }; })(ar)), ar; } var st, lr; function Ko() { if (lr) return st; lr = 1, st = g; function g(s, r, t) { var e = t || 8192, n = e >>> 1, o = null, u = e; return function(a) { if (a < 1 || a > n) return s(a); u + a > e && (o = s(e), u = 0); var y = r.call(o, u, u += a); return u & 7 && (u = (u | 7) + 1), y; }; } return st; } var lt, cr; function qo() { if (cr) return lt; cr = 1, lt = s; var g = ue(); function s(n, o) { this.lo = n >>> 0, this.hi = o >>> 0; } var r = s.zero = new s(0, 0); r.toNumber = function() { return 0; }, r.zzEncode = r.zzDecode = function() { return this; }, r.length = function() { return 1; }; var t = s.zeroHash = "\0\0\0\0\0\0\0\0"; s.fromNumber = function(n) { if (n === 0) return r; var o = n < 0; o && (n = -n); var u = n >>> 0, a = (n - u) / 4294967296 >>> 0; return o && (a = ~a >>> 0, u = ~u >>> 0, ++u > 4294967295 && (u = 0, ++a > 4294967295 && (a = 0))), new s(u, a); }, s.from = function(n) { if (typeof n == "number") return s.fromNumber(n); if (g.isString(n)) if (g.Long) n = g.Long.fromString(n); else return s.fromNumber(parseInt(n, 10)); return n.low || n.high ? new s(n.low >>> 0, n.high >>> 0) : r; }, s.prototype.toNumber = function(n) { if (!n && this.hi >>> 31) { var o = ~this.lo + 1 >>> 0, u = ~this.hi >>> 0; return o || (u = u + 1 >>> 0), -(o + u * 4294967296); } return this.lo + this.hi * 4294967296; }, s.prototype.toLong = function(n) { return g.Long ? new g.Long(this.lo | 0, this.hi | 0, !!n) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!n }; }; var e = String.prototype.charCodeAt; return s.fromHash = function(n) { return n === t ? r : new s( (e.call(n, 0) | e.call(n, 1) << 8 | e.call(n, 2) << 16 | e.call(n, 3) << 24) >>> 0, (e.call(n, 4) | e.call(n, 5) << 8 | e.call(n, 6) << 16 | e.call(n, 7) << 24) >>> 0 ); }, s.prototype.toHash = function() { return String.fromCharCode( this.lo & 255, this.lo >>> 8 & 255, this.lo >>> 16 & 255, this.lo >>> 24, this.hi & 255, this.hi >>> 8 & 255, this.hi >>> 16 & 255, this.hi >>> 24 ); }, s.prototype.zzEncode = function() { var n = this.hi >> 31; return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ n) >>> 0, this.lo = (this.lo << 1 ^ n) >>> 0, this; }, s.prototype.zzDecode = function() { var n = -(this.lo & 1); return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ n) >>> 0, this.hi = (this.hi >>> 1 ^ n) >>> 0, this; }, s.prototype.length = function() { var n = this.lo, o = (this.lo >>> 28 | this.hi << 4) >>> 0, u = this.hi >>> 24; return u === 0 ? o === 0 ? n < 16384 ? n < 128 ? 1 : 2 : n < 2097152 ? 3 : 4 : o < 16384 ? o < 128 ? 5 : 6 : o < 2097152 ? 7 : 8 : u < 128 ? 9 : 10; }, lt; } var ur; function ue() { return ur || (ur = 1, (function(g) { var s = g; s.asPromise = $o(), s.base64 = Bo(), s.EventEmitter = Ho(), s.float = Yo(), s.inquire = Jo(), s.utf8 = Zo(), s.pool = Ko(), s.LongBits = qo(), s.isNode = !!(typeof ge < "u" && ge && ge.process && ge.process.versions && ge.process.versions.node), s.global = s.isNode && ge || typeof window < "u" && window || typeof self < "u" && self || rt, s.emptyArray = Object.freeze ? Object.freeze([]) : ( /* istanbul ignore next */ [] ), s.emptyObject = Object.freeze ? Object.freeze({}) : ( /* istanbul ignore next */ {} ), s.isInteger = Number.isInteger || /* istanbul ignore next */ function(e) { return typeof e == "number" && isFinite(e) && Math.floor(e) === e; }, s.isString = function(e) { return typeof e == "string" || e instanceof String; }, s.isObject = function(e) { return e && typeof e == "object"; }, s.isset = /** * Checks if a property on a message is considered to be present. * @param {Object} obj Plain object or message instance * @param {string} prop Property name * @returns {boolean} `true` if considered to be present, otherwise `false` */ s.isSet = function(e, n) { var o = e[n]; return o != null && e.hasOwnProperty(n) ? typeof o != "object" || (Array.isArray(o) ? o.length : Object.keys(o).length) > 0 : !1; }, s.Buffer = (function() { try { var e = s.inquire("buffer").Buffer; return e.prototype.utf8Write ? e : ( /* istanbul ignore next */ null ); } catch { return null; } })(), s._Buffer_from = null, s._Buffer_allocUnsafe = null, s.newBuffer = function(e) { return typeof e == "number" ? s.Buffer ? s._Buffer_allocUnsafe(e) : new s.Array(e) : s.Buffer ? s._Buffer_from(e) : typeof Uint8Array > "u" ? e : new Uint8Array(e); }, s.Array = typeof Uint8Array < "u" ? Uint8Array : Array, s.Long = /* istanbul ignore next */ s.global.dcodeIO && /* istanbul ignore next */ s.global.dcodeIO.Long || /* istanbul ignore next */ s.global.Long || s.inquire("long"), s.key2Re = /^true|false|0|1$/, s.key32Re = /^-?(?:0|[1-9][0-9]*)$/, s.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/, s.longToHash = function(e) { return e ? s.LongBits.from(e).toHash() : s.LongBits.zeroHash; }, s.longFromHash = function(e, n) { var o = s.LongBits.fromHash(e); return s.Long ? s.Long.fromBits(o.lo, o.hi, n) : o.toNumber(!!n); }; function r(e, n, o) { for (var u = Object.keys(n), a = 0; a < u.length; ++a) (e[u[a]] === void 0 || !o) && (e[u[a]] = n[u[a]]); return e; } s.merge = r, s.lcFirst = function(e) { return e.charAt(0).toLowerCase() + e.substring(1); }; function t(e) { function n(o, u) { if (!(this instanceof n)) return new n(o, u); Object.defineProperty(this, "message", { get: function() { return o; } }), Error.captureStackTrace ? Error.captureStackTrace(this, n) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), u && r(this, u); } return n.prototype = Object.create(Error.prototype, { constructor: { value: n, writable: !0, enumerable: !1, configurable: !0 }, name: { get: function() { return e; }, set: void 0, enumerable: !1, // configurable: false would accurately preserve the behavior of // the original, but I'm guessing that was not intentional. // For an actual error subclass, this property would // be configurable. configurable: !0 }, toString: { value: function() { return this.name + ": " + this.message; }, writable: !0, enumerable: !1, configurable: !0 } }), n; } s.newError = t, s.ProtocolError = t("ProtocolError"), s.oneOfGetter = function(e) { for (var n = {}, o = 0; o < e.length; ++o) n[e[o]] = 1; return function() { for (var u = Object.keys(this), a = u.length - 1; a > -1; --a) if (n[u[a]] === 1 && this[u[a]] !== void 0 && this[u[a]] !== null) return u[a]; }; }, s.oneOfSetter = function(e) { return function(n) { for (var o = 0; o < e.length; ++o) e[o] !== n && delete this[e[o]]; }; }, s.toJSONOptions = { longs: String, enums: String, bytes: String, json: !0 }, s._configure = function() { var e = s.Buffer; if (!e) { s._Buffer_from = s._Buffer_allocUnsafe = null; return; } s._Buffer_from = e.from !== Uint8Array.from && e.from || /* istanbul ignore next */ function(n, o) { return new e(n, o); }, s._Buffer_allocUnsafe = e.allocUnsafe || /* istanbul ignore next */ function(n) { return new e(n); }; }; })(rt)), rt; } var ct, dr; function Tr() { if (dr) return ct; dr = 1, ct = a; var g = ue(), s, r = g.LongBits, t = g.base64, e = g.utf8; function n(P, T, F) { this.fn = P, this.len = T, this.next = void 0, this.val = F; } function o() { } function u(P) { this.head = P.head, this.tail = P.tail, this.len = P.len, this.next = P.states; } function a() { this.len = 0, this.head = new n(o, 0, 0), this.tail = this.head, this.states = null; } var y = function() { return g.Buffer ? function() { return (a.create = function() { return new s(); })(); } : function() { return new a(); }; }; a.create = y(), a.alloc = function(P) { return new g.Array(P); }, g.Array !== Array && (a.alloc = g.pool(a.alloc, g.Array.prototype.subarray)), a.prototype._push = function(P, T, F) { return this.tail = this.tail.next = new n(P, T, F), this.len += T, this; }; function j(P, T, F) { T[F] = P & 255; } function h(P, T, F) { for (; P > 127; ) T[F++] = P & 127 | 128, P >>>= 7; T[F] = P; } function v(P, T) { this.len = P, this.next = void 0, this.val = T; } v.prototype = Object.create(n.prototype), v.prototype.fn = h, a.prototype.uint32 = function(P) { return this.len += (this.tail = this.tail.next = new v( (P = P >>> 0) < 128 ? 1 : P < 16384 ? 2 : P < 2097152 ? 3 : P < 268435456 ? 4 : 5, P )).len, this; }, a.prototype.int32 = function(P) { return P < 0 ? this._push(I, 10, r.fromNumber(P)) : this.uint32(P); }, a.prototype.sint32 = function(P) { return this.uint32((P << 1 ^ P >> 31) >>> 0); }; function I(P, T, F) { for (; P.hi; ) T[F++] = P.lo & 127 | 128, P.lo = (P.lo >>> 7 | P.hi << 25) >>> 0, P.hi >>>= 7; for (; P.lo > 127; ) T[F++] = P.lo & 127 | 128, P.lo = P.lo >>> 7; T[F++] = P.lo; } a.prototype.uint64 = function(P) { var T = r.from(P); return this._push(I, T.length(), T); }, a.prototype.int64 = a.prototype.uint64, a.prototype.sint64 = function(P) { var T = r.from(P).zzEncode(); return this._push(I, T.length(), T); }, a.prototype.bool = function(P) { return this._push(j, 1, P ? 1 : 0); }; function S(P, T, F) { T[F] = P & 255, T[F + 1] = P >>> 8 & 255, T[F + 2] = P >>> 16 & 255, T[F + 3] = P >>> 24; } a.prototype.fixed32 = function(P) { return this._push(S, 4, P >>> 0); }, a.prototype.sfixed32 = a.prototype.fixed32, a.prototype.fixed64 = function(P) { var T = r.from(P); return this._push(S, 4, T.lo)._push(S, 4, T.hi); }, a.prototype.sfixed64 = a.prototype.fixed64, a.prototype.float = function(P) { return this._push(g.float.writeFloatLE, 4, P); }, a.prototype.double = function(P) { return this._push(g.float.writeDoubleLE, 8, P); }; var R = g.Array.prototype.set ? function(P, T, F) { T.set(P, F); } : function(P, T, F) { for (var B = 0; B < P.length; ++B) T[F + B] = P[B]; }; return a.prototype.bytes = function(P) { var T = P.length >>> 0; if (!T) return this._push(j, 1, 0); if (g.isString(P)) { var F = a.alloc(T = t.length(P)); t.decode(P, F, 0), P = F; } return this.uint32(T)._push(R, T, P); }, a.prototype.string = function(P) { var T = e.length(P); return T ? this.uint32(T)._push(e.write, T, P) : this._push(j, 1, 0); }, a.prototype.fork = function() { return this.states = new u(this), this.head = this.tail = new n(o, 0, 0), this.len = 0, this; }, a.prototype.reset = function() { return this.states ? (this.head = this.states.head, this.tail = this.states.tail, this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new n(o, 0, 0), this.len = 0), this; }, a.prototype.ldelim = function() { var P = this.head, T = this.tail, F = this.len; return this.reset().uint32(F), F && (this.tail.next = P.next, this.tail = T, this.len += F), this; }, a.prototype.finish = function() { for (var P = this.head.next, T = this.constructor.alloc(this.len), F = 0; P; ) P.fn(P.val, T, F), F += P.len, P = P.next; return T; }, a._configure = function(P) { s = P, a.create = y(), s._configure(); }, ct; } var ut, pr; function Xo() { if (pr) return ut; pr = 1, ut = r; var g = Tr(); (r.prototype = Object.create(g.prototype)).constructor = r; var s = ue(); function r() { g.call(this); } r._configure = function() { r.alloc = s._Buffer_allocUnsafe, r.writeBytesBuffer = s.Buffer && s.Buffer.prototype instanceof Uint8Array && s.Buffer.prototype.set.name === "set" ? function(e, n, o) { n.set(e, o); } : function(e, n, o) { if (e.copy) e.copy(n, o, 0, e.length); else for (var u = 0; u < e.length; ) n[o++] = e[u++]; }; }, r.prototype.bytes = function(e) { s.isString(e) && (e = s._Buffer_from(e, "base64")); var n = e.length >>> 0; return this.uint32(n), n && this._push(r.writeBytesBuffer, n, e), this; }; function t(e, n, o) { e.length < 40 ? s.utf8.write(e, n, o) : n.utf8Write ? n.utf8Write(e, o) : n.write(e, o); } return r.prototype.string = function(e) { var n = s.Buffer.byteLength(e); return this.uint32(n), n && this._push(t, n, e), this; }, r._configure(), ut; } var dt, fr; function Dr() { if (fr) return dt; fr = 1, dt = n; var g = ue(), s, r = g.LongBits, t = g.utf8; function e(h, v) { return RangeError("index out of range: " + h.pos + " + " + (v || 1) + " > " + h.len); } function n(h) { this.buf = h, this.pos = 0, this.len = h.length; } var o = typeof Uint8Array < "u" ? function(h) { if (h instanceof Uint8Array || Array.isArray(h)) return new n(h); throw Error("illegal buffer"); } : function(h) { if (Array.isArray(h)) return new n(h); throw Error("illegal buffer"); }, u = function() { return g.Buffer ? function(h) { return (n.create = function(v) { return g.Buffer.isBuffer(v) ? new s(v) : o(v); })(h); } : o; }; n.create = u(), n.prototype._slice = g.Array.prototype.subarray || /* istanbul ignore next */ g.Array.prototype.slice, n.prototype.uint32 = /* @__PURE__ */ (function() { var h = 4294967295; return function() { if (h = (this.buf[this.pos] & 127) >>> 0, this.buf[this.pos++] < 128 || (h = (h | (this.buf[this.pos] & 127) << 7) >>> 0, this.buf[this.pos++] < 128) || (h = (h | (this.buf[this.pos] & 127) << 14) >>> 0, this.buf[this.pos++] < 128) || (h = (h | (this.buf[this.pos] & 127) << 21) >>> 0, this.buf[this.pos++] < 128) || (h = (h | (this.buf[this.pos] & 15) << 28) >>> 0, this.buf[this.pos++] < 128)) return h; if ((this.pos += 5) > this.len) throw this.pos = this.len, e(this, 10); return h; }; })(), n.prototype.int32 = function() { return this.uint32() | 0; }, n.prototype.sint32 = function() { var h = this.uint32(); return h >>> 1 ^ -(h & 1) | 0; }; function a() { var h = new r(0, 0), v = 0; if (this.len - this.pos > 4) { for (; v < 4; ++v) if (h.lo = (h.lo | (this.buf[this.pos] & 127) << v * 7) >>> 0, this.buf[this.pos++] < 128) return h; if (h.lo = (h.lo | (this.buf[this.pos] & 127) << 28) >>> 0, h.hi = (h.hi | (this.buf[this.pos] & 127) >> 4) >>> 0, this.buf[this.pos++] < 128) return h; v = 0; } else { for (; v < 3; ++v) { if (this.pos >= this.len) throw e(this); if (h.lo = (h.lo | (this.buf[this.pos] & 127) << v * 7) >>> 0, this.buf[this.pos++] < 128) return h; } return h.lo = (h.lo | (this.buf[this.pos++] & 127) << v * 7) >>> 0, h; } if (this.len - this.pos > 4) { for (; v < 5; ++v) if (h.hi = (h.hi | (this.buf[this.pos] & 127) << v * 7 + 3) >>> 0, this.buf[this.pos++] < 128) return h; } else for (; v < 5; ++v) { if (this.pos >= this.len) throw e(this); if (h.hi = (h.hi | (this.buf[this.pos] & 127) << v * 7 + 3) >>> 0, this.buf[this.pos++] < 128) return h; } throw Error("invalid varint encoding"); } n.prototype.bool = function() { return this.uint32() !== 0; }; function y(h, v) { return (h[v - 4] | h[v - 3] << 8 | h[v - 2] << 16 | h[v - 1] << 24) >>> 0; } n.prototype.fixed32 = function() { if (this.pos + 4 > this.len) throw e(this, 4); return y(this.buf, this.pos += 4); }, n.prototype.sfixed32 = function() { if (this.pos + 4 > this.len) throw e(this, 4); return y(this.buf, this.pos += 4) | 0; }; function j() { if (this.pos + 8 > this.len) throw e(this, 8); return new r(y(this.buf, this.pos += 4), y(this.buf, this.pos += 4)); } return n.prototype.float = function() { if (this.pos + 4 > this.len) throw e(this, 4); var h = g.float.readFloatLE(this.buf, this.pos); return this.pos += 4, h; }, n.prototype.double = function() { if (this.pos + 8 > this.len) throw e(this, 4); var h = g.float.readDoubleLE(this.buf, this.pos); return this.pos += 8, h; }, n.prototype.bytes = function() { var h = this.uint32(), v = this.pos, I = this.pos + h; if (I > this.len) throw e(this, h); if (this.pos += h, Array.isArray(this.buf)) return this.buf.slice(v, I); if (v === I) { var S = g.Buffer; return S ? S.alloc(0) : new this.buf.constructor(0); } return this._slice.call(this.buf, v, I); }, n.prototype.string = function() { var h = this.bytes(); return t.read(h, 0, h.length); }, n.prototype.skip = function(h) { if (typeof h == "number") { if (this.pos + h > this.len) throw e(this, h); this.pos += h; } else do if (this.pos >= this.len) throw e(this); while (this.buf[this.pos++] & 128); return this; }, n.prototype.skipType = function(h) { switch (h) { case 0: this.skip(); break; case 1: this.skip(8); break; case 2: this.skip(this.uint32()); break; case 3: for (; (h = this.uint32() & 7) !== 4; ) this.skipType(h); break; case 5: this.skip(4); break; /* istanbul ignore next */ default: throw Error("invalid wire type " + h + " at offset " + this.pos); } return this; }, n._configure = function(h) { s = h, n.create = u(), s._configure(); var v = g.Long ? "toLong" : ( /* istanbul ignore next */ "toNumber" ); g.merge(n.prototype, { int64: function() { return a.call(this)[v](!1); }, uint64: function() { return a.call(this)[v](!0); }, sint64: function() { return a.call(this).zzDecode()[v](!1); }, fixed64: function() { return j.call(this)[v](!0); }, sfixed64: function() { return j.call(this)[v](!1); } }); }, dt; } var pt, mr; function Qo() { if (mr) return pt; mr = 1, pt = r; var g = Dr(); (r.prototype = Object.create(g.prototype)).constructor = r; var s = ue(); function r(t) { g.call(this, t); } return r._configure = function() { s.Buffer && (r.prototype._slice = s.Buffer.prototype.slice); }, r.prototype.string = function() { var t = this.uint32(); return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + t, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + t, this.len)); }, r._configure(), pt; } var gr = {}, ft, yr; function ei() { if (yr) return ft; yr = 1, ft = s; var g = ue(); (s.prototype = Object.create(g.EventEmitter.prototype)).constructor = s; function s(r, t, e) { if (typeof r != "function") throw TypeError("rpcImpl must be a function"); g.EventEmitter.call(this), this.rpcImpl = r, this.requestDelimited = !!t, this.responseDelimited = !!e; } return s.prototype.rpcCall = function r(t, e, n, o, u) { if (!o) throw TypeError("request must be specified"); var a = this; if (!u) return g.asPromise(r, a, t, e, n, o); if (!a.rpcImpl) { setTimeout(function() { u(Error("already ended")); }, 0); return; } try { return a.rpcImpl( t, e[a.requestDelimited ? "encodeDelimited" : "encode"](o).finish(), function(y, j) { if (y) return a.emit("error", y, t), u(y); if (j === null) { a.end( /* endedByRPC */ !0 ); return; } if (!(j instanceof n)) try { j = n[a.responseDelimited ? "decodeDelimited" : "decode"](j); } catch (h) { return a.emit("error", h, t), u(h); } return a.emit("data", j, t), u(null, j); } ); } catch (y) { a.emit("error", y, t), setTimeout(function() { u(y); }, 0); return; } }, s.prototype.end = function(r) { return this.rpcImpl && (r || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this; }, ft; } var hr; function ti() { return hr || (hr = 1, (function(g) { var s = g; s.Service = ei(); })(gr)), gr; } var br, vr; function ri() { return vr || (vr = 1, br = {}), br; } var Or; function ni() { return Or || (Or = 1, (function(g) { var s = g; s.build = "minimal", s.Writer = Tr(), s.BufferWriter = Xo(), s.Reader = Dr(), s.BufferReader = Qo(), s.util = ue(), s.rpc = ti(), s.roots = ri(), s.configure = r; function r() { s.util._configure(), s.Writer._configure(s.BufferWriter), s.Reader._configure(s.BufferReader); } r(); })(Xt)), Xt; } var wr, Pr; function oi() { return Pr || (Pr = 1, wr = ni()), wr; } var A = oi(); const f = A.Reader, E = A.Writer, d = A.util, i = A.roots.default || (A.roots.default = {}); i.dot = (() => { const g = {}; return g.Content = (function() { function s(r) { if (r) for (let t = Object.keys(r), e = 0; e < t.length; ++e) r[t[e]] != null && (this[t[e]] = r[t[e]]); } return s.prototype.token = d.newBuffer([]), s.prototype.iv = d.newBuffer([]), s.prototype.schemaVersion = 0, s.prototype.bytes = d.newBuffer([]), s.create = function(r) { return new s(r); }, s.encode = function(r, t) { return t || (t = E.create()), r.token != null && Object.hasOwnProperty.call(r, "token") && t.uint32( /* id 1, wireType 2 =*/ 10 ).bytes(r.token), r.iv != null && Object.hasOwnProperty.call(r, "iv") && t.uint32( /* id 2, wireType 2 =*/ 18 ).bytes(r.iv), r.schemaVersion != null && Object.hasOwnProperty.call(r, "schemaVersion") && t.uint32( /* id 3, wireType 0 =*/ 24 ).int32(r.schemaVersion), r.bytes != null && Object.hasOwnProperty.call(r, "bytes") && t.uint32( /* id 4, wireType 2 =*/ 34 ).bytes(r.bytes), t; }, s.encodeDelimited = function(r, t) { return this.encode(r, t).ldelim(); }, s.decode = function(r, t, e) { r instanceof f || (r = f.create(r)); let n = t === void 0 ? r.len : r.pos + t, o = new i.dot.Content(); for (; r.pos < n; ) { let u = r.uint32(); if (u === e) break; switch (u >>> 3) { case 1: { o.token = r.bytes(); break; } case 2: { o.iv = r.bytes(); break; } case 3: { o.schemaVersion = r.int32(); break; } case 4: { o.bytes = r.bytes(); break; } default: r.skipType(u & 7); break; } } return o; }, s.decodeDelimited = function(r) { return r instanceof f || (r = new f(r)), this.decode(r, r.uint32()); }, s.verify = function(r) { return typeof r != "object" || r === null ? "object expected" : r.token != null && r.hasOwnProperty("token") && !(r.token && typeof r.token.length == "number" || d.isString(r.token)) ? "token: buffer expected" : r.iv != null && r.hasOwnProperty("iv") && !(r.iv && typeof r.iv.length == "number" || d.isString(r.iv)) ? "iv: buffer expected" : r.schemaVersion != null && r.hasOwnProperty("schemaVersion") && !d.isInteger(r.schemaVersion) ? "schemaVersion: integer expected" : r.bytes != null && r.hasOwnProperty("bytes") && !(r.bytes && typeof r.bytes.length == "number" || d.isString(r.bytes)) ? "bytes: buffer expected" : null; }, s.fromObject = function(r) { if (r instanceof i.dot.Content) return r; let t = new i.dot.Content(); return r.token != null && (typeof r.token == "string" ? d.base64.decode(r.token, t.token = d.newBuffer(d.base64.length(r.token)), 0) : r.token.length >= 0 && (t.token = r.token)), r.iv != null && (typeof r.iv == "string" ? d.base64.decode(r.iv, t.iv = d.newBuffer(d.base64.length(r.iv)), 0) : r.iv.length >= 0 && (t.iv = r.iv)), r.schemaVersion != null && (t.schemaVersion = r.schemaVersion | 0), r.bytes != null && (typeof r.bytes == "string" ? d.base64.decode(r.bytes, t.bytes = d.newBuffer(d.base64.length(r.bytes)), 0) : r.bytes.length >= 0 && (t.bytes = r.bytes)), t; }, s.toObject = function(r, t) { t || (t = {}); let e = {}; return t.defaults && (t.bytes === String ? e.token = "" : (e.token = [], t.bytes !== Array && (e.token = d.newBuffer(e.token))), t.bytes === String ? e.iv = "" : (e.iv = [], t.bytes !== Array && (e.iv = d.newBuffer(e.iv))), e.schemaVersion = 0, t.bytes === String ? e.bytes = "" : (e.bytes = [], t.bytes !== Array && (e.bytes = d.newBuffer(e.bytes)))), r.token != null && r.hasOwnProperty("token") && (e.token = t.bytes === String ? d.base64.encode(r.token, 0, r.token.length) : t.bytes === Array ? Array.prototype.slice.call(r.token) : r.token), r.iv != null && r.hasOwnProperty("iv") && (e.iv = t.bytes === String ? d.base64.encode(r.iv, 0, r.iv.length) : t.bytes === Array ? Array.prototype.slice.call(r.iv) : r.iv), r.schemaVersion != null && r.hasOwnProperty("schemaVersion") && (e.schemaVersion = r.schemaVersion), r.bytes != null && r.hasOwnProperty("bytes") && (e.bytes = t.bytes === String ? d.base64.encode(r.bytes, 0, r.bytes.length) : t.bytes === Array ? Array.prototype.slice.call(r.bytes) : r.bytes), e; }, s.prototype.toJSON = function() { return this.constructor.toObject(this, A.util.toJSONOptions); }, s.getTypeUrl = function(r) { return r === void 0 && (r = "type.googleapis.com"), r + "/dot.Content"; }, s; })(), g.v4 = (function() { const s = {}; return s.MagnifEyeLivenessContent = (function() { function r(e) { if (this.images = [], e) for (let n = Object.keys(e), o = 0; o < n.length; ++o) e[n[o]] != null && (this[n[o]] = e[n[o]]); } r.prototype.images = d.emptyArray, r.prototype.video = null, r.prototype.metadata = null; let t; return Object.defineProperty(r.prototype, "_video", { get: d.oneOfGetter(t = ["video"]), set: d.oneOfSetter(t) }), r.create = function(e) { return new r(e); }, r.encode = function(e, n) { if (n || (n = E.create()), e.images != null && e.images.length) for (let o = 0; o < e.images.length; ++o) i.dot.Image.encode(e.images[o], n.uint32( /* id 1, wireType 2 =*/ 10 ).fork()).ldelim(); return e.metadata != null && Object.hasOwnProperty.call(e, "metadata") && i.dot.v4.Metadata.encode(e.metadata, n.uint32( /* id 2, wireType 2 =*/ 18 ).fork()).ldelim(), e.video != null && Object.hasOwnProperty.call(e, "video") && i.dot.Video.encode(e.video, n.uint32( /* id 3, wireType 2 =*/ 26 ).fork()).ldelim(), n; }, r.encodeDelimited = function(e, n) { return this.encode(e, n).ldelim(); }, r.de