@innovatrics/dot-face-auto-capture
Version:
Digital onboarding selfie capture
1,429 lines • 390 kB
JavaScript
const wr = /* @__PURE__ */ Symbol("Comlink.proxy"), Po = /* @__PURE__ */ Symbol("Comlink.endpoint"), Io = /* @__PURE__ */ Symbol("Comlink.releaseProxy"), Fe = /* @__PURE__ */ Symbol("Comlink.finalizer"), xe = /* @__PURE__ */ Symbol("Comlink.thrown"), Pr = (m) => typeof m == "object" && m !== null || typeof m == "function", jo = {
canHandle: (m) => Pr(m) && m[wr],
serialize(m) {
const { port1: s, port2: r } = new MessageChannel();
return ft(m, s), [r, [r]];
},
deserialize(m) {
return m.start(), To(m);
}
}, So = {
canHandle: (m) => Pr(m) && xe in m,
serialize({ value: m }) {
let s;
return m instanceof Error ? s = {
isError: !0,
value: {
message: m.message,
name: m.name,
stack: m.stack
}
} : s = { isError: !1, value: m }, [s, []];
},
deserialize(m) {
throw m.isError ? Object.assign(new Error(m.value.message), m.value) : m.value;
}
}, Ir = /* @__PURE__ */ new Map([
["proxy", jo],
["throw", So]
]);
function Co(m, s) {
for (const r of m)
if (s === r || r === "*" || r instanceof RegExp && r.test(s))
return !0;
return !1;
}
function ft(m, s = globalThis, r = ["*"]) {
s.addEventListener("message", function t(e) {
if (!e || !e.data)
return;
if (!Co(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 h;
try {
const S = u.slice(0, -1).reduce((O, I) => O[I], m), g = u.reduce((O, I) => O[I], m);
switch (o) {
case "GET":
h = g;
break;
case "SET":
S[u.slice(-1)[0]] = ce(e.data.value), h = !0;
break;
case "APPLY":
h = g.apply(S, a);
break;
case "CONSTRUCT":
{
const O = new g(...a);
h = Ro(O);
}
break;
case "ENDPOINT":
{
const { port1: O, port2: I } = new MessageChannel();
ft(m, I), h = Mo(O, [O]);
}
break;
case "RELEASE":
h = void 0;
break;
default:
return;
}
} catch (S) {
h = { value: S, [xe]: 0 };
}
Promise.resolve(h).catch((S) => ({ value: S, [xe]: 0 })).then((S) => {
const [g, O] = Ve(S);
s.postMessage(Object.assign(Object.assign({}, g), { id: n }), O), o === "RELEASE" && (s.removeEventListener("message", t), jr(s), Fe in m && typeof m[Fe] == "function" && m[Fe]());
}).catch((S) => {
const [g, O] = Ve({
value: new TypeError("Unserializable return value"),
[xe]: 0
});
s.postMessage(Object.assign(Object.assign({}, g), { id: n }), O);
});
}), s.start && s.start();
}
function ko(m) {
return m.constructor.name === "MessagePort";
}
function jr(m) {
ko(m) && m.close();
}
function To(m, s) {
const r = /* @__PURE__ */ new Map();
return m.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);
}
}), dt(m, r, [], s);
}
function _e(m) {
if (m)
throw new Error("Proxy has been released and is not useable");
}
function Sr(m) {
return ge(m, /* @__PURE__ */ new Map(), {
type: "RELEASE"
}).then(() => {
jr(m);
});
}
const Ne = /* @__PURE__ */ new WeakMap(), We = "FinalizationRegistry" in globalThis && new FinalizationRegistry((m) => {
const s = (Ne.get(m) || 0) - 1;
Ne.set(m, s), s === 0 && Sr(m);
});
function Ao(m, s) {
const r = (Ne.get(s) || 0) + 1;
Ne.set(s, r), We && We.register(m, s, m);
}
function Do(m) {
We && We.unregister(m);
}
function dt(m, s, r = [], t = function() {
}) {
let e = !1;
const n = new Proxy(t, {
get(o, u) {
if (_e(e), u === Io)
return () => {
Do(n), Sr(m), s.clear(), e = !0;
};
if (u === "then") {
if (r.length === 0)
return { then: () => n };
const a = ge(m, s, {
type: "GET",
path: r.map((h) => h.toString())
}).then(ce);
return a.then.bind(a);
}
return dt(m, s, [...r, u]);
},
set(o, u, a) {
_e(e);
const [h, S] = Ve(a);
return ge(m, s, {
type: "SET",
path: [...r, u].map((g) => g.toString()),
value: h
}, S).then(ce);
},
apply(o, u, a) {
_e(e);
const h = r[r.length - 1];
if (h === Po)
return ge(m, s, {
type: "ENDPOINT"
}).then(ce);
if (h === "bind")
return dt(m, s, r.slice(0, -1));
const [S, g] = Jt(a);
return ge(m, s, {
type: "APPLY",
path: r.map((O) => O.toString()),
argumentList: S
}, g).then(ce);
},
construct(o, u) {
_e(e);
const [a, h] = Jt(u);
return ge(m, s, {
type: "CONSTRUCT",
path: r.map((S) => S.toString()),
argumentList: a
}, h).then(ce);
}
});
return Ao(n, m), n;
}
function Eo(m) {
return Array.prototype.concat.apply([], m);
}
function Jt(m) {
const s = m.map(Ve);
return [s.map((r) => r[0]), Eo(s.map((r) => r[1]))];
}
const Cr = /* @__PURE__ */ new WeakMap();
function Mo(m, s) {
return Cr.set(m, s), m;
}
function Ro(m) {
return Object.assign(m, { [wr]: !0 });
}
function Ve(m) {
for (const [s, r] of Ir)
if (r.canHandle(m)) {
const [t, e] = r.serialize(m);
return [
{
type: "HANDLER",
name: s,
value: t
},
e
];
}
return [
{
type: "RAW",
value: m
},
Cr.get(m) || []
];
}
function ce(m) {
switch (m.type) {
case "HANDLER":
return Ir.get(m.name).deserialize(m.value);
case "RAW":
return m.value;
}
}
function ge(m, s, r, t) {
return new Promise((e) => {
const n = Lo();
s.set(n, e), m.start && m.start(), m.postMessage(Object.assign({ id: n }, r), t);
});
}
function Lo() {
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
}
const Pe = 1e3, Zt = {
simd: "sam_simd.wasm",
sam: "sam.wasm"
}, _o = 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 Fo = {
RGBA: "RGBA"
};
class xo {
#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 No {
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 _o() ? Zt.simd : Zt.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 xo(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,
Fo.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: h, width: S, x: g, y: O } = await this.samWasmModule.selectDetailRegion(
r.width,
r.height,
e.bgr0ImagePointer,
a
);
return e.free(), {
height: h,
width: S,
shiftX: g,
shiftY: O
};
}
[Fe]() {
this.terminateSamModule();
}
}
const pt = (m) => Number.parseFloat(m.toFixed(3)), kr = (m, s) => Math.min(m, s);
function Wo(m, s) {
const r = kr(s.width, s.height);
return pt(m * r);
}
const Vo = (m) => JSON.parse(
JSON.stringify(m, (s, r) => typeof r == "number" ? pt(r) : r)
);
var ye = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Kt = {}, Xe = {}, Qe, qt;
function zo() {
if (qt) return Qe;
qt = 1, Qe = m;
function m(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(h) {
if (o)
if (o = !1, h)
a(h);
else {
for (var S = new Array(arguments.length - 1), g = 0; g < S.length; )
S[g++] = arguments[g];
u.apply(null, S);
}
};
try {
s.apply(r || null, t);
} catch (h) {
o && (o = !1, a(h));
}
});
}
return Qe;
}
var Xt = {}, Qt;
function Uo() {
return Qt || (Qt = 1, (function(m) {
var s = m;
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 h = null, S = [], g = 0, O = 0, I; u < a; ) {
var j = o[u++];
switch (O) {
case 0:
S[g++] = r[j >> 2], I = (j & 3) << 4, O = 1;
break;
case 1:
S[g++] = r[I | j >> 4], I = (j & 15) << 2, O = 2;
break;
case 2:
S[g++] = r[I | j >> 6], S[g++] = r[j & 63], O = 0;
break;
}
g > 8191 && ((h || (h = [])).push(String.fromCharCode.apply(String, S)), g = 0);
}
return O && (S[g++] = r[I], S[g++] = 61, O === 1 && (S[g++] = 61)), h ? (g && h.push(String.fromCharCode.apply(String, S.slice(0, g))), h.join("")) : String.fromCharCode.apply(String, S.slice(0, g));
};
var n = "invalid encoding";
s.decode = function(o, u, a) {
for (var h = a, S = 0, g, O = 0; O < o.length; ) {
var I = o.charCodeAt(O++);
if (I === 61 && S > 1)
break;
if ((I = t[I]) === void 0)
throw Error(n);
switch (S) {
case 0:
g = I, S = 1;
break;
case 1:
u[a++] = g << 2 | (I & 48) >> 4, g = I, S = 2;
break;
case 2:
u[a++] = (g & 15) << 4 | (I & 60) >> 2, g = I, S = 3;
break;
case 3:
u[a++] = (g & 3) << 6 | I, S = 0;
break;
}
}
if (S === 1)
throw Error(n);
return a - h;
}, s.test = function(o) {
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o);
};
})(Xt)), Xt;
}
var et, er;
function Go() {
if (er) return et;
er = 1, et = m;
function m() {
this._listeners = {};
}
return m.prototype.on = function(s, r, t) {
return (this._listeners[s] || (this._listeners[s] = [])).push({
fn: r,
ctx: t || this
}), this;
}, m.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;
}, m.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;
}, et;
}
var tt, tr;
function $o() {
if (tr) return tt;
tr = 1, tt = m(m);
function m(n) {
return typeof Float32Array < "u" ? (function() {
var o = new Float32Array([-0]), u = new Uint8Array(o.buffer), a = u[3] === 128;
function h(I, j, R) {
o[0] = I, j[R] = u[0], j[R + 1] = u[1], j[R + 2] = u[2], j[R + 3] = u[3];
}
function S(I, j, R) {
o[0] = I, j[R] = u[3], j[R + 1] = u[2], j[R + 2] = u[1], j[R + 3] = u[0];
}
n.writeFloatLE = a ? h : S, n.writeFloatBE = a ? S : h;
function g(I, j) {
return u[0] = I[j], u[1] = I[j + 1], u[2] = I[j + 2], u[3] = I[j + 3], o[0];
}
function O(I, j) {
return u[3] = I[j], u[2] = I[j + 1], u[1] = I[j + 2], u[0] = I[j + 3], o[0];
}
n.readFloatLE = a ? g : O, n.readFloatBE = a ? O : g;
})() : (function() {
function o(a, h, S, g) {
var O = h < 0 ? 1 : 0;
if (O && (h = -h), h === 0)
a(1 / h > 0 ? (
/* positive */
0
) : (
/* negative 0 */
2147483648
), S, g);
else if (isNaN(h))
a(2143289344, S, g);
else if (h > 34028234663852886e22)
a((O << 31 | 2139095040) >>> 0, S, g);
else if (h < 11754943508222875e-54)
a((O << 31 | Math.round(h / 1401298464324817e-60)) >>> 0, S, g);
else {
var I = Math.floor(Math.log(h) / Math.LN2), j = Math.round(h * Math.pow(2, -I) * 8388608) & 8388607;
a((O << 31 | I + 127 << 23 | j) >>> 0, S, g);
}
}
n.writeFloatLE = o.bind(null, s), n.writeFloatBE = o.bind(null, r);
function u(a, h, S) {
var g = a(h, S), O = (g >> 31) * 2 + 1, I = g >>> 23 & 255, j = g & 8388607;
return I === 255 ? j ? NaN : O * (1 / 0) : I === 0 ? O * 1401298464324817e-60 * j : O * Math.pow(2, I - 150) * (j + 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 h(I, j, R) {
o[0] = I, j[R] = u[0], j[R + 1] = u[1], j[R + 2] = u[2], j[R + 3] = u[3], j[R + 4] = u[4], j[R + 5] = u[5], j[R + 6] = u[6], j[R + 7] = u[7];
}
function S(I, j, R) {
o[0] = I, j[R] = u[7], j[R + 1] = u[6], j[R + 2] = u[5], j[R + 3] = u[4], j[R + 4] = u[3], j[R + 5] = u[2], j[R + 6] = u[1], j[R + 7] = u[0];
}
n.writeDoubleLE = a ? h : S, n.writeDoubleBE = a ? S : h;
function g(I, j) {
return u[0] = I[j], u[1] = I[j + 1], u[2] = I[j + 2], u[3] = I[j + 3], u[4] = I[j + 4], u[5] = I[j + 5], u[6] = I[j + 6], u[7] = I[j + 7], o[0];
}
function O(I, j) {
return u[7] = I[j], u[6] = I[j + 1], u[5] = I[j + 2], u[4] = I[j + 3], u[3] = I[j + 4], u[2] = I[j + 5], u[1] = I[j + 6], u[0] = I[j + 7], o[0];
}
n.readDoubleLE = a ? g : O, n.readDoubleBE = a ? O : g;
})() : (function() {
function o(a, h, S, g, O, I) {
var j = g < 0 ? 1 : 0;
if (j && (g = -g), g === 0)
a(0, O, I + h), a(1 / g > 0 ? (
/* positive */
0
) : (
/* negative 0 */
2147483648
), O, I + S);
else if (isNaN(g))
a(0, O, I + h), a(2146959360, O, I + S);
else if (g > 17976931348623157e292)
a(0, O, I + h), a((j << 31 | 2146435072) >>> 0, O, I + S);
else {
var R;
if (g < 22250738585072014e-324)
R = g / 5e-324, a(R >>> 0, O, I + h), a((j << 31 | R / 4294967296) >>> 0, O, I + S);
else {
var w = Math.floor(Math.log(g) / Math.LN2);
w === 1024 && (w = 1023), R = g * Math.pow(2, -w), a(R * 4503599627370496 >>> 0, O, I + h), a((j << 31 | w + 1023 << 20 | R * 1048576 & 1048575) >>> 0, O, I + S);
}
}
}
n.writeDoubleLE = o.bind(null, s, 0, 4), n.writeDoubleBE = o.bind(null, r, 4, 0);
function u(a, h, S, g, O) {
var I = a(g, O + h), j = a(g, O + S), R = (j >> 31) * 2 + 1, w = j >>> 20 & 2047, A = 4294967296 * (j & 1048575) + I;
return w === 2047 ? A ? NaN : R * (1 / 0) : w === 0 ? R * 5e-324 * A : R * Math.pow(2, w - 1075) * (A + 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 tt;
}
function rr(m) {
throw new Error('Could not dynamically require "' + m + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var rt, nr;
function Bo() {
if (nr) return rt;
nr = 1, rt = m;
function m(s) {
try {
if (typeof rr != "function")
return null;
var r = rr(s);
return r && (r.length || Object.keys(r).length) ? r : null;
} catch {
return null;
}
}
return rt;
}
var or = {}, ir;
function Ho() {
return ir || (ir = 1, (function(m) {
var s = m;
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, h; t < e; )
h = r[t++], h < 128 ? u[a++] = h : h > 191 && h < 224 ? u[a++] = (h & 31) << 6 | r[t++] & 63 : h > 239 && h < 365 ? (h = ((h & 7) << 18 | (r[t++] & 63) << 12 | (r[t++] & 63) << 6 | r[t++] & 63) - 65536, u[a++] = 55296 + (h >> 10), u[a++] = 56320 + (h & 1023)) : u[a++] = (h & 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;
};
})(or)), or;
}
var nt, ar;
function Yo() {
if (ar) return nt;
ar = 1, nt = m;
function m(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 h = r.call(o, u, u += a);
return u & 7 && (u = (u | 7) + 1), h;
};
}
return nt;
}
var ot, sr;
function Jo() {
if (sr) return ot;
sr = 1, ot = s;
var m = 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 (m.isString(n))
if (m.Long)
n = m.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 m.Long ? new m.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;
}, ot;
}
var lr;
function ue() {
return lr || (lr = 1, (function(m) {
var s = m;
s.asPromise = zo(), s.base64 = Uo(), s.EventEmitter = Go(), s.float = $o(), s.inquire = Bo(), s.utf8 = Ho(), s.pool = Yo(), s.LongBits = Jo(), s.isNode = !!(typeof ye < "u" && ye && ye.process && ye.process.versions && ye.process.versions.node), s.global = s.isNode && ye || typeof window < "u" && window || typeof self < "u" && self || Xe, 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);
};
};
})(Xe)), Xe;
}
var it, cr;
function Tr() {
if (cr) return it;
cr = 1, it = a;
var m = ue(), s, r = m.LongBits, t = m.base64, e = m.utf8;
function n(w, A, _) {
this.fn = w, this.len = A, this.next = void 0, this.val = _;
}
function o() {
}
function u(w) {
this.head = w.head, this.tail = w.tail, this.len = w.len, this.next = w.states;
}
function a() {
this.len = 0, this.head = new n(o, 0, 0), this.tail = this.head, this.states = null;
}
var h = function() {
return m.Buffer ? function() {
return (a.create = function() {
return new s();
})();
} : function() {
return new a();
};
};
a.create = h(), a.alloc = function(w) {
return new m.Array(w);
}, m.Array !== Array && (a.alloc = m.pool(a.alloc, m.Array.prototype.subarray)), a.prototype._push = function(w, A, _) {
return this.tail = this.tail.next = new n(w, A, _), this.len += A, this;
};
function S(w, A, _) {
A[_] = w & 255;
}
function g(w, A, _) {
for (; w > 127; )
A[_++] = w & 127 | 128, w >>>= 7;
A[_] = w;
}
function O(w, A) {
this.len = w, this.next = void 0, this.val = A;
}
O.prototype = Object.create(n.prototype), O.prototype.fn = g, a.prototype.uint32 = function(w) {
return this.len += (this.tail = this.tail.next = new O(
(w = w >>> 0) < 128 ? 1 : w < 16384 ? 2 : w < 2097152 ? 3 : w < 268435456 ? 4 : 5,
w
)).len, this;
}, a.prototype.int32 = function(w) {
return w < 0 ? this._push(I, 10, r.fromNumber(w)) : this.uint32(w);
}, a.prototype.sint32 = function(w) {
return this.uint32((w << 1 ^ w >> 31) >>> 0);
};
function I(w, A, _) {
for (; w.hi; )
A[_++] = w.lo & 127 | 128, w.lo = (w.lo >>> 7 | w.hi << 25) >>> 0, w.hi >>>= 7;
for (; w.lo > 127; )
A[_++] = w.lo & 127 | 128, w.lo = w.lo >>> 7;
A[_++] = w.lo;
}
a.prototype.uint64 = function(w) {
var A = r.from(w);
return this._push(I, A.length(), A);
}, a.prototype.int64 = a.prototype.uint64, a.prototype.sint64 = function(w) {
var A = r.from(w).zzEncode();
return this._push(I, A.length(), A);
}, a.prototype.bool = function(w) {
return this._push(S, 1, w ? 1 : 0);
};
function j(w, A, _) {
A[_] = w & 255, A[_ + 1] = w >>> 8 & 255, A[_ + 2] = w >>> 16 & 255, A[_ + 3] = w >>> 24;
}
a.prototype.fixed32 = function(w) {
return this._push(j, 4, w >>> 0);
}, a.prototype.sfixed32 = a.prototype.fixed32, a.prototype.fixed64 = function(w) {
var A = r.from(w);
return this._push(j, 4, A.lo)._push(j, 4, A.hi);
}, a.prototype.sfixed64 = a.prototype.fixed64, a.prototype.float = function(w) {
return this._push(m.float.writeFloatLE, 4, w);
}, a.prototype.double = function(w) {
return this._push(m.float.writeDoubleLE, 8, w);
};
var R = m.Array.prototype.set ? function(w, A, _) {
A.set(w, _);
} : function(w, A, _) {
for (var X = 0; X < w.length; ++X)
A[_ + X] = w[X];
};
return a.prototype.bytes = function(w) {
var A = w.length >>> 0;
if (!A)
return this._push(S, 1, 0);
if (m.isString(w)) {
var _ = a.alloc(A = t.length(w));
t.decode(w, _, 0), w = _;
}
return this.uint32(A)._push(R, A, w);
}, a.prototype.string = function(w) {
var A = e.length(w);
return A ? this.uint32(A)._push(e.write, A, w) : this._push(S, 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 w = this.head, A = this.tail, _ = this.len;
return this.reset().uint32(_), _ && (this.tail.next = w.next, this.tail = A, this.len += _), this;
}, a.prototype.finish = function() {
for (var w = this.head.next, A = this.constructor.alloc(this.len), _ = 0; w; )
w.fn(w.val, A, _), _ += w.len, w = w.next;
return A;
}, a._configure = function(w) {
s = w, a.create = h(), s._configure();
}, it;
}
var at, ur;
function Zo() {
if (ur) return at;
ur = 1, at = r;
var m = Tr();
(r.prototype = Object.create(m.prototype)).constructor = r;
var s = ue();
function r() {
m.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(), at;
}
var st, dr;
function Ar() {
if (dr) return st;
dr = 1, st = n;
var m = ue(), s, r = m.LongBits, t = m.utf8;
function e(g, O) {
return RangeError("index out of range: " + g.pos + " + " + (O || 1) + " > " + g.len);
}
function n(g) {
this.buf = g, this.pos = 0, this.len = g.length;
}
var o = typeof Uint8Array < "u" ? function(g) {
if (g instanceof Uint8Array || Array.isArray(g))
return new n(g);
throw Error("illegal buffer");
} : function(g) {
if (Array.isArray(g))
return new n(g);
throw Error("illegal buffer");
}, u = function() {
return m.Buffer ? function(g) {
return (n.create = function(O) {
return m.Buffer.isBuffer(O) ? new s(O) : o(O);
})(g);
} : o;
};
n.create = u(), n.prototype._slice = m.Array.prototype.subarray || /* istanbul ignore next */
m.Array.prototype.slice, n.prototype.uint32 = /* @__PURE__ */ (function() {
var g = 4294967295;
return function() {
if (g = (this.buf[this.pos] & 127) >>> 0, this.buf[this.pos++] < 128 || (g = (g | (this.buf[this.pos] & 127) << 7) >>> 0, this.buf[this.pos++] < 128) || (g = (g | (this.buf[this.pos] & 127) << 14) >>> 0, this.buf[this.pos++] < 128) || (g = (g | (this.buf[this.pos] & 127) << 21) >>> 0, this.buf[this.pos++] < 128) || (g = (g | (this.buf[this.pos] & 15) << 28) >>> 0, this.buf[this.pos++] < 128)) return g;
if ((this.pos += 5) > this.len)
throw this.pos = this.len, e(this, 10);
return g;
};
})(), n.prototype.int32 = function() {
return this.uint32() | 0;
}, n.prototype.sint32 = function() {
var g = this.uint32();
return g >>> 1 ^ -(g & 1) | 0;
};
function a() {
var g = new r(0, 0), O = 0;
if (this.len - this.pos > 4) {
for (; O < 4; ++O)
if (g.lo = (g.lo | (this.buf[this.pos] & 127) << O * 7) >>> 0, this.buf[this.pos++] < 128)
return g;
if (g.lo = (g.lo | (this.buf[this.pos] & 127) << 28) >>> 0, g.hi = (g.hi | (this.buf[this.pos] & 127) >> 4) >>> 0, this.buf[this.pos++] < 128)
return g;
O = 0;
} else {
for (; O < 3; ++O) {
if (this.pos >= this.len)
throw e(this);
if (g.lo = (g.lo | (this.buf[this.pos] & 127) << O * 7) >>> 0, this.buf[this.pos++] < 128)
return g;
}
return g.lo = (g.lo | (this.buf[this.pos++] & 127) << O * 7) >>> 0, g;
}
if (this.len - this.pos > 4) {
for (; O < 5; ++O)
if (g.hi = (g.hi | (this.buf[this.pos] & 127) << O * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
return g;
} else
for (; O < 5; ++O) {
if (this.pos >= this.len)
throw e(this);
if (g.hi = (g.hi | (this.buf[this.pos] & 127) << O * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
return g;
}
throw Error("invalid varint encoding");
}
n.prototype.bool = function() {
return this.uint32() !== 0;
};
function h(g, O) {
return (g[O - 4] | g[O - 3] << 8 | g[O - 2] << 16 | g[O - 1] << 24) >>> 0;
}
n.prototype.fixed32 = function() {
if (this.pos + 4 > this.len)
throw e(this, 4);
return h(this.buf, this.pos += 4);
}, n.prototype.sfixed32 = function() {
if (this.pos + 4 > this.len)
throw e(this, 4);
return h(this.buf, this.pos += 4) | 0;
};
function S() {
if (this.pos + 8 > this.len)
throw e(this, 8);
return new r(h(this.buf, this.pos += 4), h(this.buf, this.pos += 4));
}
return n.prototype.float = function() {
if (this.pos + 4 > this.len)
throw e(this, 4);
var g = m.float.readFloatLE(this.buf, this.pos);
return this.pos += 4, g;
}, n.prototype.double = function() {
if (this.pos + 8 > this.len)
throw e(this, 4);
var g = m.float.readDoubleLE(this.buf, this.pos);
return this.pos += 8, g;
}, n.prototype.bytes = function() {
var g = this.uint32(), O = this.pos, I = this.pos + g;
if (I > this.len)
throw e(this, g);
if (this.pos += g, Array.isArray(this.buf))
return this.buf.slice(O, I);
if (O === I) {
var j = m.Buffer;
return j ? j.alloc(0) : new this.buf.constructor(0);
}
return this._slice.call(this.buf, O, I);
}, n.prototype.string = function() {
var g = this.bytes();
return t.read(g, 0, g.length);
}, n.prototype.skip = function(g) {
if (typeof g == "number") {
if (this.pos + g > this.len)
throw e(this, g);
this.pos += g;
} else
do
if (this.pos >= this.len)
throw e(this);
while (this.buf[this.pos++] & 128);
return this;
}, n.prototype.skipType = function(g) {
switch (g) {
case 0:
this.skip();
break;
case 1:
this.skip(8);
break;
case 2:
this.skip(this.uint32());
break;
case 3:
for (; (g = this.uint32() & 7) !== 4; )
this.skipType(g);
break;
case 5:
this.skip(4);
break;
/* istanbul ignore next */
default:
throw Error("invalid wire type " + g + " at offset " + this.pos);
}
return this;
}, n._configure = function(g) {
s = g, n.create = u(), s._configure();
var O = m.Long ? "toLong" : (
/* istanbul ignore next */
"toNumber"
);
m.merge(n.prototype, {
int64: function() {
return a.call(this)[O](!1);
},
uint64: function() {
return a.call(this)[O](!0);
},
sint64: function() {
return a.call(this).zzDecode()[O](!1);
},
fixed64: function() {
return S.call(this)[O](!0);
},
sfixed64: function() {
return S.call(this)[O](!1);
}
});
}, st;
}
var lt, fr;
function Ko() {
if (fr) return lt;
fr = 1, lt = r;
var m = Ar();
(r.prototype = Object.create(m.prototype)).constructor = r;
var s = ue();
function r(t) {
m.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(), lt;
}
var pr = {}, ct, mr;
function qo() {
if (mr) return ct;
mr = 1, ct = s;
var m = ue();
(s.prototype = Object.create(m.EventEmitter.prototype)).constructor = s;
function s(r, t, e) {
if (typeof r != "function")
throw TypeError("rpcImpl must be a function");
m.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 m.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(h, S) {
if (h)
return a.emit("error", h, t), u(h);
if (S === null) {
a.end(
/* endedByRPC */
!0
);
return;
}
if (!(S instanceof n))
try {
S = n[a.responseDelimited ? "decodeDelimited" : "decode"](S);
} catch (g) {
return a.emit("error", g, t), u(g);
}
return a.emit("data", S, t), u(null, S);
}
);
} catch (h) {
a.emit("error", h, t), setTimeout(function() {
u(h);
}, 0);
return;
}
}, s.prototype.end = function(r) {
return this.rpcImpl && (r || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this;
}, ct;
}
var yr;
function Xo() {
return yr || (yr = 1, (function(m) {
var s = m;
s.Service = qo();
})(pr)), pr;
}
var gr, hr;
function Qo() {
return hr || (hr = 1, gr = {}), gr;
}
var br;
function ei() {
return br || (br = 1, (function(m) {
var s = m;
s.build = "minimal", s.Writer = Tr(), s.BufferWriter = Zo(), s.Reader = Ar(), s.BufferReader = Ko(), s.util = ue(), s.rpc = Xo(), s.roots = Qo(), s.configure = r;
function r() {
s.util._configure(), s.Writer._configure(s.BufferWriter), s.Reader._configure(s.BufferReader);
}
r();
})(Kt)), Kt;
}
var vr, Or;
function ti() {
return Or || (Or = 1, vr = ei()), vr;
}
var T = ti();
const p = T.Reader, E = T.Writer, d = T.util, i = T.roots.default || (T.roots.default = {});
i.dot = (() => {
const m = {};
return m.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 p || (r = p.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 p || (r = new p(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, T.util.toJSONOptions);
}, s.getTypeUrl = function(r) {
return r === void 0 && (r = "type.googleapis.com"), r + "/dot.Content";
}, s;
})(), m.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