@innovatrics/dot-document-auto-capture
Version:
Digital onboarding document capture
1,307 lines (1,306 loc) • 313 kB
JavaScript
var Fo = Object.defineProperty;
var nr = (p) => {
throw TypeError(p);
};
var _o = (p, c, n) => c in p ? Fo(p, c, { enumerable: !0, configurable: !0, writable: !0, value: n }) : p[c] = n;
var We = (p, c, n) => _o(p, typeof c != "symbol" ? c + "" : c, n), or = (p, c, n) => c.has(p) || nr("Cannot " + n);
var X = (p, c, n) => (or(p, c, "read from private field"), n ? n.call(p) : c.get(p)), ze = (p, c, n) => c.has(p) ? nr("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(p) : c.set(p, n), Ue = (p, c, n, t) => (or(p, c, "write to private field"), t ? t.call(p, n) : c.set(p, n), n);
const ir = {
simd: "sam_simd.wasm",
sam: "sam.wasm"
}, Mo = 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 H extends Error {
constructor(n, t) {
super(n);
We(this, "cause");
this.name = "AutoCaptureError", this.cause = t;
}
// Change this to Decorator when they will be in stable release
static logError(n) {
}
static fromCameraError(n) {
if (this.logError(n), n instanceof H)
return n;
let t;
switch (n.name) {
case "OverconstrainedError":
t = "Minimum quality requirements are not met by your camera";
break;
case "NotReadableError":
case "AbortError":
t = "The webcam is already in use by another application";
break;
case "NotAllowedError":
t = "To use your camera, you must allow permissions";
break;
case "NotFoundError":
t = "There is no camera available to you";
break;
default:
t = "An unknown camera error has occurred";
break;
}
return new H(t, n);
}
static fromError(n) {
if (this.logError(n), n instanceof H)
return n;
const t = "An unexpected error has occurred";
return new H(t);
}
}
const Ro = {
RGBA: "RGBA"
};
var se, fe, ve;
class Lo {
constructor(c, n) {
ze(this, se);
ze(this, fe);
ze(this, ve);
Ue(this, se, c), Ue(this, fe, this.allocate(n.length * n.BYTES_PER_ELEMENT)), Ue(this, ve, this.allocate(n.length * n.BYTES_PER_ELEMENT));
}
get rgbaImagePointer() {
return X(this, fe);
}
get bgr0ImagePointer() {
return X(this, ve);
}
allocate(c) {
return X(this, se)._malloc(c);
}
free() {
X(this, se)._free(X(this, fe)), X(this, se)._free(X(this, ve));
}
writeDataToMemory(c) {
X(this, se).HEAPU8.set(c, X(this, fe));
}
}
se = new WeakMap(), fe = new WeakMap(), ve = new WeakMap();
class xo {
constructor() {
We(this, "samWasmModule");
}
getOverriddenModules(c, n) {
return {
locateFile: (t) => new URL(n || t, c).href
};
}
async handleMissingOrInvalidSamModule(c, n) {
try {
const t = await fetch(c);
if (!t.ok)
throw new H(
`The path to ${n} is incorrect or the module is missing. Please check provided path to wasm files. Current path is ${c}`
);
const e = await t.arrayBuffer();
if (!WebAssembly.validate(e))
throw new H(
`The provided ${n} is not a valid WASM module. Please check provided path to wasm files. Current path is ${c}`
);
} catch (t) {
if (t instanceof H)
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 Mo() ? ir.simd : ir.sam;
}
async initSamModule(c, n) {
if (this.samWasmModule)
return;
const t = await this.getSamWasmFileName(), e = this.getSamWasmFilePath(n, t);
try {
this.samWasmModule = await this.fetchSamModule(this.getOverriddenModules(c, e)), this.samWasmModule.init();
} catch {
throw await this.handleMissingOrInvalidSamModule(e, t), new H("Could not init detector.");
}
}
terminateSamModule() {
var c;
(c = this.samWasmModule) == null || c.terminate();
}
async getSamVersion() {
var n;
const c = await ((n = this.samWasmModule) == null ? void 0 : n.getInfoString());
return c == null ? void 0 : c.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(c) {
if (!this.samWasmModule)
throw new H("SAM WASM module is not initialized");
const n = new Lo(this.samWasmModule, c);
return n.writeDataToMemory(c), n;
}
convertToSamColorImage(c, n) {
if (!this.samWasmModule)
throw new H("SAM WASM module is not initialized");
const t = this.writeImageToMemory(c);
return this.samWasmModule.convertToSamColorImage(
n.width,
n.height,
t.rgbaImagePointer,
Ro.RGBA,
t.bgr0ImagePointer
), t;
}
}
const $e = (p, c) => Math.hypot(c.x - p.x, c.y - p.y), No = (p) => {
const { bottomLeft: c, bottomRight: n, topLeft: t, topRight: e } = p, r = $e(t, e), o = $e(e, n), d = $e(c, n), l = $e(t, c);
return Math.min(r, o, d, l);
};
var ge = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ar = {}, it = {}, at, sr;
function Wo() {
if (sr) return at;
sr = 1, at = p;
function p(c, n) {
for (var t = new Array(arguments.length - 1), e = 0, r = 2, o = !0; r < arguments.length; )
t[e++] = arguments[r++];
return new Promise(function(d, l) {
t[e] = function(y) {
if (o)
if (o = !1, y)
l(y);
else {
for (var S = new Array(arguments.length - 1), h = 0; h < S.length; )
S[h++] = arguments[h];
d.apply(null, S);
}
};
try {
c.apply(n || null, t);
} catch (y) {
o && (o = !1, l(y));
}
});
}
return at;
}
var lr = {}, cr;
function zo() {
return cr || (cr = 1, function(p) {
var c = p;
c.length = function(o) {
var d = o.length;
if (!d)
return 0;
for (var l = 0; --d % 4 > 1 && o.charAt(d) === "="; )
++l;
return Math.ceil(o.length * 3) / 4 - l;
};
for (var n = new Array(64), t = new Array(123), e = 0; e < 64; )
t[n[e] = e < 26 ? e + 65 : e < 52 ? e + 71 : e < 62 ? e - 4 : e - 59 | 43] = e++;
c.encode = function(o, d, l) {
for (var y = null, S = [], h = 0, O = 0, j; d < l; ) {
var I = o[d++];
switch (O) {
case 0:
S[h++] = n[I >> 2], j = (I & 3) << 4, O = 1;
break;
case 1:
S[h++] = n[j | I >> 4], j = (I & 15) << 2, O = 2;
break;
case 2:
S[h++] = n[j | I >> 6], S[h++] = n[I & 63], O = 0;
break;
}
h > 8191 && ((y || (y = [])).push(String.fromCharCode.apply(String, S)), h = 0);
}
return O && (S[h++] = n[j], S[h++] = 61, O === 1 && (S[h++] = 61)), y ? (h && y.push(String.fromCharCode.apply(String, S.slice(0, h))), y.join("")) : String.fromCharCode.apply(String, S.slice(0, h));
};
var r = "invalid encoding";
c.decode = function(o, d, l) {
for (var y = l, S = 0, h, O = 0; O < o.length; ) {
var j = o.charCodeAt(O++);
if (j === 61 && S > 1)
break;
if ((j = t[j]) === void 0)
throw Error(r);
switch (S) {
case 0:
h = j, S = 1;
break;
case 1:
d[l++] = h << 2 | (j & 48) >> 4, h = j, S = 2;
break;
case 2:
d[l++] = (h & 15) << 4 | (j & 60) >> 2, h = j, S = 3;
break;
case 3:
d[l++] = (h & 3) << 6 | j, S = 0;
break;
}
}
if (S === 1)
throw Error(r);
return l - y;
}, c.test = function(o) {
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o);
};
}(lr)), lr;
}
var st, dr;
function Uo() {
if (dr) return st;
dr = 1, st = p;
function p() {
this._listeners = {};
}
return p.prototype.on = function(c, n, t) {
return (this._listeners[c] || (this._listeners[c] = [])).push({
fn: n,
ctx: t || this
}), this;
}, p.prototype.off = function(c, n) {
if (c === void 0)
this._listeners = {};
else if (n === void 0)
this._listeners[c] = [];
else
for (var t = this._listeners[c], e = 0; e < t.length; )
t[e].fn === n ? t.splice(e, 1) : ++e;
return this;
}, p.prototype.emit = function(c) {
var n = this._listeners[c];
if (n) {
for (var t = [], e = 1; e < arguments.length; )
t.push(arguments[e++]);
for (e = 0; e < n.length; )
n[e].fn.apply(n[e++].ctx, t);
}
return this;
}, st;
}
var lt, ur;
function $o() {
if (ur) return lt;
ur = 1, lt = p(p);
function p(r) {
return typeof Float32Array < "u" ? function() {
var o = new Float32Array([-0]), d = new Uint8Array(o.buffer), l = d[3] === 128;
function y(j, I, E) {
o[0] = j, I[E] = d[0], I[E + 1] = d[1], I[E + 2] = d[2], I[E + 3] = d[3];
}
function S(j, I, E) {
o[0] = j, I[E] = d[3], I[E + 1] = d[2], I[E + 2] = d[1], I[E + 3] = d[0];
}
r.writeFloatLE = l ? y : S, r.writeFloatBE = l ? S : y;
function h(j, I) {
return d[0] = j[I], d[1] = j[I + 1], d[2] = j[I + 2], d[3] = j[I + 3], o[0];
}
function O(j, I) {
return d[3] = j[I], d[2] = j[I + 1], d[1] = j[I + 2], d[0] = j[I + 3], o[0];
}
r.readFloatLE = l ? h : O, r.readFloatBE = l ? O : h;
}() : function() {
function o(l, y, S, h) {
var O = y < 0 ? 1 : 0;
if (O && (y = -y), y === 0)
l(1 / y > 0 ? (
/* positive */
0
) : (
/* negative 0 */
2147483648
), S, h);
else if (isNaN(y))
l(2143289344, S, h);
else if (y > 34028234663852886e22)
l((O << 31 | 2139095040) >>> 0, S, h);
else if (y < 11754943508222875e-54)
l((O << 31 | Math.round(y / 1401298464324817e-60)) >>> 0, S, h);
else {
var j = Math.floor(Math.log(y) / Math.LN2), I = Math.round(y * Math.pow(2, -j) * 8388608) & 8388607;
l((O << 31 | j + 127 << 23 | I) >>> 0, S, h);
}
}
r.writeFloatLE = o.bind(null, c), r.writeFloatBE = o.bind(null, n);
function d(l, y, S) {
var h = l(y, S), O = (h >> 31) * 2 + 1, j = h >>> 23 & 255, I = h & 8388607;
return j === 255 ? I ? NaN : O * (1 / 0) : j === 0 ? O * 1401298464324817e-60 * I : O * Math.pow(2, j - 150) * (I + 8388608);
}
r.readFloatLE = d.bind(null, t), r.readFloatBE = d.bind(null, e);
}(), typeof Float64Array < "u" ? function() {
var o = new Float64Array([-0]), d = new Uint8Array(o.buffer), l = d[7] === 128;
function y(j, I, E) {
o[0] = j, I[E] = d[0], I[E + 1] = d[1], I[E + 2] = d[2], I[E + 3] = d[3], I[E + 4] = d[4], I[E + 5] = d[5], I[E + 6] = d[6], I[E + 7] = d[7];
}
function S(j, I, E) {
o[0] = j, I[E] = d[7], I[E + 1] = d[6], I[E + 2] = d[5], I[E + 3] = d[4], I[E + 4] = d[3], I[E + 5] = d[2], I[E + 6] = d[1], I[E + 7] = d[0];
}
r.writeDoubleLE = l ? y : S, r.writeDoubleBE = l ? S : y;
function h(j, I) {
return d[0] = j[I], d[1] = j[I + 1], d[2] = j[I + 2], d[3] = j[I + 3], d[4] = j[I + 4], d[5] = j[I + 5], d[6] = j[I + 6], d[7] = j[I + 7], o[0];
}
function O(j, I) {
return d[7] = j[I], d[6] = j[I + 1], d[5] = j[I + 2], d[4] = j[I + 3], d[3] = j[I + 4], d[2] = j[I + 5], d[1] = j[I + 6], d[0] = j[I + 7], o[0];
}
r.readDoubleLE = l ? h : O, r.readDoubleBE = l ? O : h;
}() : function() {
function o(l, y, S, h, O, j) {
var I = h < 0 ? 1 : 0;
if (I && (h = -h), h === 0)
l(0, O, j + y), l(1 / h > 0 ? (
/* positive */
0
) : (
/* negative 0 */
2147483648
), O, j + S);
else if (isNaN(h))
l(0, O, j + y), l(2146959360, O, j + S);
else if (h > 17976931348623157e292)
l(0, O, j + y), l((I << 31 | 2146435072) >>> 0, O, j + S);
else {
var E;
if (h < 22250738585072014e-324)
E = h / 5e-324, l(E >>> 0, O, j + y), l((I << 31 | E / 4294967296) >>> 0, O, j + S);
else {
var w = Math.floor(Math.log(h) / Math.LN2);
w === 1024 && (w = 1023), E = h * Math.pow(2, -w), l(E * 4503599627370496 >>> 0, O, j + y), l((I << 31 | w + 1023 << 20 | E * 1048576 & 1048575) >>> 0, O, j + S);
}
}
}
r.writeDoubleLE = o.bind(null, c, 0, 4), r.writeDoubleBE = o.bind(null, n, 4, 0);
function d(l, y, S, h, O) {
var j = l(h, O + y), I = l(h, O + S), E = (I >> 31) * 2 + 1, w = I >>> 20 & 2047, T = 4294967296 * (I & 1048575) + j;
return w === 2047 ? T ? NaN : E * (1 / 0) : w === 0 ? E * 5e-324 * T : E * Math.pow(2, w - 1075) * (T + 4503599627370496);
}
r.readDoubleLE = d.bind(null, t, 0, 4), r.readDoubleBE = d.bind(null, e, 4, 0);
}(), r;
}
function c(r, o, d) {
o[d] = r & 255, o[d + 1] = r >>> 8 & 255, o[d + 2] = r >>> 16 & 255, o[d + 3] = r >>> 24;
}
function n(r, o, d) {
o[d] = r >>> 24, o[d + 1] = r >>> 16 & 255, o[d + 2] = r >>> 8 & 255, o[d + 3] = r & 255;
}
function t(r, o) {
return (r[o] | r[o + 1] << 8 | r[o + 2] << 16 | r[o + 3] << 24) >>> 0;
}
function e(r, o) {
return (r[o] << 24 | r[o + 1] << 16 | r[o + 2] << 8 | r[o + 3]) >>> 0;
}
return lt;
}
function fr(p) {
throw new Error('Could not dynamically require "' + p + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var ct, pr;
function Go() {
if (pr) return ct;
pr = 1, ct = p;
function p(c) {
try {
if (typeof fr != "function")
return null;
var n = fr(c);
return n && (n.length || Object.keys(n).length) ? n : null;
} catch {
return null;
}
}
return ct;
}
var mr = {}, hr;
function Bo() {
return hr || (hr = 1, function(p) {
var c = p;
c.length = function(n) {
for (var t = 0, e = 0, r = 0; r < n.length; ++r)
e = n.charCodeAt(r), e < 128 ? t += 1 : e < 2048 ? t += 2 : (e & 64512) === 55296 && (n.charCodeAt(r + 1) & 64512) === 56320 ? (++r, t += 4) : t += 3;
return t;
}, c.read = function(n, t, e) {
var r = e - t;
if (r < 1)
return "";
for (var o = null, d = [], l = 0, y; t < e; )
y = n[t++], y < 128 ? d[l++] = y : y > 191 && y < 224 ? d[l++] = (y & 31) << 6 | n[t++] & 63 : y > 239 && y < 365 ? (y = ((y & 7) << 18 | (n[t++] & 63) << 12 | (n[t++] & 63) << 6 | n[t++] & 63) - 65536, d[l++] = 55296 + (y >> 10), d[l++] = 56320 + (y & 1023)) : d[l++] = (y & 15) << 12 | (n[t++] & 63) << 6 | n[t++] & 63, l > 8191 && ((o || (o = [])).push(String.fromCharCode.apply(String, d)), l = 0);
return o ? (l && o.push(String.fromCharCode.apply(String, d.slice(0, l))), o.join("")) : String.fromCharCode.apply(String, d.slice(0, l));
}, c.write = function(n, t, e) {
for (var r = e, o, d, l = 0; l < n.length; ++l)
o = n.charCodeAt(l), o < 128 ? t[e++] = o : o < 2048 ? (t[e++] = o >> 6 | 192, t[e++] = o & 63 | 128) : (o & 64512) === 55296 && ((d = n.charCodeAt(l + 1)) & 64512) === 56320 ? (o = 65536 + ((o & 1023) << 10) + (d & 1023), ++l, 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 - r;
};
}(mr)), mr;
}
var dt, yr;
function Vo() {
if (yr) return dt;
yr = 1, dt = p;
function p(c, n, t) {
var e = t || 8192, r = e >>> 1, o = null, d = e;
return function(l) {
if (l < 1 || l > r)
return c(l);
d + l > e && (o = c(e), d = 0);
var y = n.call(o, d, d += l);
return d & 7 && (d = (d | 7) + 1), y;
};
}
return dt;
}
var ut, gr;
function Ho() {
if (gr) return ut;
gr = 1, ut = c;
var p = pe();
function c(r, o) {
this.lo = r >>> 0, this.hi = o >>> 0;
}
var n = c.zero = new c(0, 0);
n.toNumber = function() {
return 0;
}, n.zzEncode = n.zzDecode = function() {
return this;
}, n.length = function() {
return 1;
};
var t = c.zeroHash = "\0\0\0\0\0\0\0\0";
c.fromNumber = function(r) {
if (r === 0)
return n;
var o = r < 0;
o && (r = -r);
var d = r >>> 0, l = (r - d) / 4294967296 >>> 0;
return o && (l = ~l >>> 0, d = ~d >>> 0, ++d > 4294967295 && (d = 0, ++l > 4294967295 && (l = 0))), new c(d, l);
}, c.from = function(r) {
if (typeof r == "number")
return c.fromNumber(r);
if (p.isString(r))
if (p.Long)
r = p.Long.fromString(r);
else
return c.fromNumber(parseInt(r, 10));
return r.low || r.high ? new c(r.low >>> 0, r.high >>> 0) : n;
}, c.prototype.toNumber = function(r) {
if (!r && this.hi >>> 31) {
var o = ~this.lo + 1 >>> 0, d = ~this.hi >>> 0;
return o || (d = d + 1 >>> 0), -(o + d * 4294967296);
}
return this.lo + this.hi * 4294967296;
}, c.prototype.toLong = function(r) {
return p.Long ? new p.Long(this.lo | 0, this.hi | 0, !!r) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!r };
};
var e = String.prototype.charCodeAt;
return c.fromHash = function(r) {
return r === t ? n : new c(
(e.call(r, 0) | e.call(r, 1) << 8 | e.call(r, 2) << 16 | e.call(r, 3) << 24) >>> 0,
(e.call(r, 4) | e.call(r, 5) << 8 | e.call(r, 6) << 16 | e.call(r, 7) << 24) >>> 0
);
}, c.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
);
}, c.prototype.zzEncode = function() {
var r = this.hi >> 31;
return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ r) >>> 0, this.lo = (this.lo << 1 ^ r) >>> 0, this;
}, c.prototype.zzDecode = function() {
var r = -(this.lo & 1);
return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ r) >>> 0, this.hi = (this.hi >>> 1 ^ r) >>> 0, this;
}, c.prototype.length = function() {
var r = this.lo, o = (this.lo >>> 28 | this.hi << 4) >>> 0, d = this.hi >>> 24;
return d === 0 ? o === 0 ? r < 16384 ? r < 128 ? 1 : 2 : r < 2097152 ? 3 : 4 : o < 16384 ? o < 128 ? 5 : 6 : o < 2097152 ? 7 : 8 : d < 128 ? 9 : 10;
}, ut;
}
var br;
function pe() {
return br || (br = 1, function(p) {
var c = p;
c.asPromise = Wo(), c.base64 = zo(), c.EventEmitter = Uo(), c.float = $o(), c.inquire = Go(), c.utf8 = Bo(), c.pool = Vo(), c.LongBits = Ho(), c.isNode = !!(typeof ge < "u" && ge && ge.process && ge.process.versions && ge.process.versions.node), c.global = c.isNode && ge || typeof window < "u" && window || typeof self < "u" && self || it, c.emptyArray = Object.freeze ? Object.freeze([]) : (
/* istanbul ignore next */
[]
), c.emptyObject = Object.freeze ? Object.freeze({}) : (
/* istanbul ignore next */
{}
), c.isInteger = Number.isInteger || /* istanbul ignore next */
function(e) {
return typeof e == "number" && isFinite(e) && Math.floor(e) === e;
}, c.isString = function(e) {
return typeof e == "string" || e instanceof String;
}, c.isObject = function(e) {
return e && typeof e == "object";
}, c.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`
*/
c.isSet = function(e, r) {
var o = e[r];
return o != null && e.hasOwnProperty(r) ? typeof o != "object" || (Array.isArray(o) ? o.length : Object.keys(o).length) > 0 : !1;
}, c.Buffer = function() {
try {
var e = c.inquire("buffer").Buffer;
return e.prototype.utf8Write ? e : (
/* istanbul ignore next */
null
);
} catch {
return null;
}
}(), c._Buffer_from = null, c._Buffer_allocUnsafe = null, c.newBuffer = function(e) {
return typeof e == "number" ? c.Buffer ? c._Buffer_allocUnsafe(e) : new c.Array(e) : c.Buffer ? c._Buffer_from(e) : typeof Uint8Array > "u" ? e : new Uint8Array(e);
}, c.Array = typeof Uint8Array < "u" ? Uint8Array : Array, c.Long = /* istanbul ignore next */
c.global.dcodeIO && /* istanbul ignore next */
c.global.dcodeIO.Long || /* istanbul ignore next */
c.global.Long || c.inquire("long"), c.key2Re = /^true|false|0|1$/, c.key32Re = /^-?(?:0|[1-9][0-9]*)$/, c.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/, c.longToHash = function(e) {
return e ? c.LongBits.from(e).toHash() : c.LongBits.zeroHash;
}, c.longFromHash = function(e, r) {
var o = c.LongBits.fromHash(e);
return c.Long ? c.Long.fromBits(o.lo, o.hi, r) : o.toNumber(!!r);
};
function n(e, r, o) {
for (var d = Object.keys(r), l = 0; l < d.length; ++l)
(e[d[l]] === void 0 || !o) && (e[d[l]] = r[d[l]]);
return e;
}
c.merge = n, c.lcFirst = function(e) {
return e.charAt(0).toLowerCase() + e.substring(1);
};
function t(e) {
function r(o, d) {
if (!(this instanceof r))
return new r(o, d);
Object.defineProperty(this, "message", { get: function() {
return o;
} }), Error.captureStackTrace ? Error.captureStackTrace(this, r) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), d && n(this, d);
}
return r.prototype = Object.create(Error.prototype, {
constructor: {
value: r,
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
}
}), r;
}
c.newError = t, c.ProtocolError = t("ProtocolError"), c.oneOfGetter = function(e) {
for (var r = {}, o = 0; o < e.length; ++o)
r[e[o]] = 1;
return function() {
for (var d = Object.keys(this), l = d.length - 1; l > -1; --l)
if (r[d[l]] === 1 && this[d[l]] !== void 0 && this[d[l]] !== null)
return d[l];
};
}, c.oneOfSetter = function(e) {
return function(r) {
for (var o = 0; o < e.length; ++o)
e[o] !== r && delete this[e[o]];
};
}, c.toJSONOptions = {
longs: String,
enums: String,
bytes: String,
json: !0
}, c._configure = function() {
var e = c.Buffer;
if (!e) {
c._Buffer_from = c._Buffer_allocUnsafe = null;
return;
}
c._Buffer_from = e.from !== Uint8Array.from && e.from || /* istanbul ignore next */
function(r, o) {
return new e(r, o);
}, c._Buffer_allocUnsafe = e.allocUnsafe || /* istanbul ignore next */
function(r) {
return new e(r);
};
};
}(it)), it;
}
var ft, vr;
function Fr() {
if (vr) return ft;
vr = 1, ft = l;
var p = pe(), c, n = p.LongBits, t = p.base64, e = p.utf8;
function r(w, T, R) {
this.fn = w, this.len = T, this.next = void 0, this.val = R;
}
function o() {
}
function d(w) {
this.head = w.head, this.tail = w.tail, this.len = w.len, this.next = w.states;
}
function l() {
this.len = 0, this.head = new r(o, 0, 0), this.tail = this.head, this.states = null;
}
var y = function() {
return p.Buffer ? function() {
return (l.create = function() {
return new c();
})();
} : function() {
return new l();
};
};
l.create = y(), l.alloc = function(w) {
return new p.Array(w);
}, p.Array !== Array && (l.alloc = p.pool(l.alloc, p.Array.prototype.subarray)), l.prototype._push = function(w, T, R) {
return this.tail = this.tail.next = new r(w, T, R), this.len += T, this;
};
function S(w, T, R) {
T[R] = w & 255;
}
function h(w, T, R) {
for (; w > 127; )
T[R++] = w & 127 | 128, w >>>= 7;
T[R] = w;
}
function O(w, T) {
this.len = w, this.next = void 0, this.val = T;
}
O.prototype = Object.create(r.prototype), O.prototype.fn = h, l.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;
}, l.prototype.int32 = function(w) {
return w < 0 ? this._push(j, 10, n.fromNumber(w)) : this.uint32(w);
}, l.prototype.sint32 = function(w) {
return this.uint32((w << 1 ^ w >> 31) >>> 0);
};
function j(w, T, R) {
for (; w.hi; )
T[R++] = w.lo & 127 | 128, w.lo = (w.lo >>> 7 | w.hi << 25) >>> 0, w.hi >>>= 7;
for (; w.lo > 127; )
T[R++] = w.lo & 127 | 128, w.lo = w.lo >>> 7;
T[R++] = w.lo;
}
l.prototype.uint64 = function(w) {
var T = n.from(w);
return this._push(j, T.length(), T);
}, l.prototype.int64 = l.prototype.uint64, l.prototype.sint64 = function(w) {
var T = n.from(w).zzEncode();
return this._push(j, T.length(), T);
}, l.prototype.bool = function(w) {
return this._push(S, 1, w ? 1 : 0);
};
function I(w, T, R) {
T[R] = w & 255, T[R + 1] = w >>> 8 & 255, T[R + 2] = w >>> 16 & 255, T[R + 3] = w >>> 24;
}
l.prototype.fixed32 = function(w) {
return this._push(I, 4, w >>> 0);
}, l.prototype.sfixed32 = l.prototype.fixed32, l.prototype.fixed64 = function(w) {
var T = n.from(w);
return this._push(I, 4, T.lo)._push(I, 4, T.hi);
}, l.prototype.sfixed64 = l.prototype.fixed64, l.prototype.float = function(w) {
return this._push(p.float.writeFloatLE, 4, w);
}, l.prototype.double = function(w) {
return this._push(p.float.writeDoubleLE, 8, w);
};
var E = p.Array.prototype.set ? function(w, T, R) {
T.set(w, R);
} : function(w, T, R) {
for (var G = 0; G < w.length; ++G)
T[R + G] = w[G];
};
return l.prototype.bytes = function(w) {
var T = w.length >>> 0;
if (!T)
return this._push(S, 1, 0);
if (p.isString(w)) {
var R = l.alloc(T = t.length(w));
t.decode(w, R, 0), w = R;
}
return this.uint32(T)._push(E, T, w);
}, l.prototype.string = function(w) {
var T = e.length(w);
return T ? this.uint32(T)._push(e.write, T, w) : this._push(S, 1, 0);
}, l.prototype.fork = function() {
return this.states = new d(this), this.head = this.tail = new r(o, 0, 0), this.len = 0, this;
}, l.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 r(o, 0, 0), this.len = 0), this;
}, l.prototype.ldelim = function() {
var w = this.head, T = this.tail, R = this.len;
return this.reset().uint32(R), R && (this.tail.next = w.next, this.tail = T, this.len += R), this;
}, l.prototype.finish = function() {
for (var w = this.head.next, T = this.constructor.alloc(this.len), R = 0; w; )
w.fn(w.val, T, R), R += w.len, w = w.next;
return T;
}, l._configure = function(w) {
c = w, l.create = y(), c._configure();
}, ft;
}
var pt, Or;
function Jo() {
if (Or) return pt;
Or = 1, pt = n;
var p = Fr();
(n.prototype = Object.create(p.prototype)).constructor = n;
var c = pe();
function n() {
p.call(this);
}
n._configure = function() {
n.alloc = c._Buffer_allocUnsafe, n.writeBytesBuffer = c.Buffer && c.Buffer.prototype instanceof Uint8Array && c.Buffer.prototype.set.name === "set" ? function(e, r, o) {
r.set(e, o);
} : function(e, r, o) {
if (e.copy)
e.copy(r, o, 0, e.length);
else for (var d = 0; d < e.length; )
r[o++] = e[d++];
};
}, n.prototype.bytes = function(e) {
c.isString(e) && (e = c._Buffer_from(e, "base64"));
var r = e.length >>> 0;
return this.uint32(r), r && this._push(n.writeBytesBuffer, r, e), this;
};
function t(e, r, o) {
e.length < 40 ? c.utf8.write(e, r, o) : r.utf8Write ? r.utf8Write(e, o) : r.write(e, o);
}
return n.prototype.string = function(e) {
var r = c.Buffer.byteLength(e);
return this.uint32(r), r && this._push(t, r, e), this;
}, n._configure(), pt;
}
var mt, wr;
function _r() {
if (wr) return mt;
wr = 1, mt = r;
var p = pe(), c, n = p.LongBits, t = p.utf8;
function e(h, O) {
return RangeError("index out of range: " + h.pos + " + " + (O || 1) + " > " + h.len);
}
function r(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 r(h);
throw Error("illegal buffer");
} : function(h) {
if (Array.isArray(h))
return new r(h);
throw Error("illegal buffer");
}, d = function() {
return p.Buffer ? function(h) {
return (r.create = function(O) {
return p.Buffer.isBuffer(O) ? new c(O) : o(O);
})(h);
} : o;
};
r.create = d(), r.prototype._slice = p.Array.prototype.subarray || /* istanbul ignore next */
p.Array.prototype.slice, r.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;
};
}(), r.prototype.int32 = function() {
return this.uint32() | 0;
}, r.prototype.sint32 = function() {
var h = this.uint32();
return h >>> 1 ^ -(h & 1) | 0;
};
function l() {
var h = new n(0, 0), O = 0;
if (this.len - this.pos > 4) {
for (; O < 4; ++O)
if (h.lo = (h.lo | (this.buf[this.pos] & 127) << O * 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;
O = 0;
} else {
for (; O < 3; ++O) {
if (this.pos >= this.len)
throw e(this);
if (h.lo = (h.lo | (this.buf[this.pos] & 127) << O * 7) >>> 0, this.buf[this.pos++] < 128)
return h;
}
return h.lo = (h.lo | (this.buf[this.pos++] & 127) << O * 7) >>> 0, h;
}
if (this.len - this.pos > 4) {
for (; O < 5; ++O)
if (h.hi = (h.hi | (this.buf[this.pos] & 127) << O * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
return h;
} else
for (; O < 5; ++O) {
if (this.pos >= this.len)
throw e(this);
if (h.hi = (h.hi | (this.buf[this.pos] & 127) << O * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
return h;
}
throw Error("invalid varint encoding");
}
r.prototype.bool = function() {
return this.uint32() !== 0;
};
function y(h, O) {
return (h[O - 4] | h[O - 3] << 8 | h[O - 2] << 16 | h[O - 1] << 24) >>> 0;
}
r.prototype.fixed32 = function() {
if (this.pos + 4 > this.len)
throw e(this, 4);
return y(this.buf, this.pos += 4);
}, r.prototype.sfixed32 = function() {
if (this.pos + 4 > this.len)
throw e(this, 4);
return y(this.buf, this.pos += 4) | 0;
};
function S() {
if (this.pos + 8 > this.len)
throw e(this, 8);
return new n(y(this.buf, this.pos += 4), y(this.buf, this.pos += 4));
}
return r.prototype.float = function() {
if (this.pos + 4 > this.len)
throw e(this, 4);
var h = p.float.readFloatLE(this.buf, this.pos);
return this.pos += 4, h;
}, r.prototype.double = function() {
if (this.pos + 8 > this.len)
throw e(this, 4);
var h = p.float.readDoubleLE(this.buf, this.pos);
return this.pos += 8, h;
}, r.prototype.bytes = function() {
var h = this.uint32(), O = this.pos, j = this.pos + h;
if (j > this.len)
throw e(this, h);
if (this.pos += h, Array.isArray(this.buf))
return this.buf.slice(O, j);
if (O === j) {
var I = p.Buffer;
return I ? I.alloc(0) : new this.buf.constructor(0);
}
return this._slice.call(this.buf, O, j);
}, r.prototype.string = function() {
var h = this.bytes();
return t.read(h, 0, h.length);
}, r.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;
}, r.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;
}, r._configure = function(h) {
c = h, r.create = d(), c._configure();
var O = p.Long ? "toLong" : (
/* istanbul ignore next */
"toNumber"
);
p.merge(r.prototype, {
int64: function() {
return l.call(this)[O](!1);
},
uint64: function() {
return l.call(this)[O](!0);
},
sint64: function() {
return l.call(this).zzDecode()[O](!1);
},
fixed64: function() {
return S.call(this)[O](!0);
},
sfixed64: function() {
return S.call(this)[O](!1);
}
});
}, mt;
}
var ht, Pr;
function Yo() {
if (Pr) return ht;
Pr = 1, ht = n;
var p = _r();
(n.prototype = Object.create(p.prototype)).constructor = n;
var c = pe();
function n(t) {
p.call(this, t);
}
return n._configure = function() {
c.Buffer && (n.prototype._slice = c.Buffer.prototype.slice);
}, n.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));
}, n._configure(), ht;
}
var jr = {}, yt, Ir;
function Zo() {
if (Ir) return yt;
Ir = 1, yt = c;
var p = pe();
(c.prototype = Object.create(p.EventEmitter.prototype)).constructor = c;
function c(n, t, e) {
if (typeof n != "function")
throw TypeError("rpcImpl must be a function");
p.EventEmitter.call(this), this.rpcImpl = n, this.requestDelimited = !!t, this.responseDelimited = !!e;
}
return c.prototype.rpcCall = function n(t, e, r, o, d) {
if (!o)
throw TypeError("request must be specified");
var l = this;
if (!d)
return p.asPromise(n, l, t, e, r, o);
if (!l.rpcImpl) {
setTimeout(function() {
d(Error("already ended"));
}, 0);
return;
}
try {
return l.rpcImpl(
t,
e[l.requestDelimited ? "encodeDelimited" : "encode"](o).finish(),
function(y, S) {
if (y)
return l.emit("error", y, t), d(y);
if (S === null) {
l.end(
/* endedByRPC */
!0
);
return;
}
if (!(S instanceof r))
try {
S = r[l.responseDelimited ? "decodeDelimited" : "decode"](S);
} catch (h) {
return l.emit("error", h, t), d(h);
}
return l.emit("data", S, t), d(null, S);
}
);
} catch (y) {
l.emit("error", y, t), setTimeout(function() {
d(y);
}, 0);
return;
}
}, c.prototype.end = function(n) {
return this.rpcImpl && (n || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this;
}, yt;
}
var Sr;
function Ko() {
return Sr || (Sr = 1, function(p) {
var c = p;
c.Service = Zo();
}(jr)), jr;
}
var Cr, Ar;
function qo() {
return Ar || (Ar = 1, Cr = {}), Cr;
}
var Tr;
function Xo() {
return Tr || (Tr = 1, function(p) {
var c = p;
c.build = "minimal", c.Writer = Fr(), c.BufferWriter = Jo(), c.Reader = _r(), c.BufferReader = Yo(), c.util = pe(), c.rpc = Ko(), c.roots = qo(), c.configure = n;
function n() {
c.util._configure(), c.Writer._configure(c.BufferWriter), c.Reader._configure(c.BufferReader);
}
n();
}(ar)), ar;
}
var Dr, kr;
function Qo() {
return kr || (kr = 1, Dr = Xo()), Dr;
}
var _ = Qo();
const g = _.Reader, L = _.Writer, u = _.util, i = _.roots.default || (_.roots.default = {});
i.dot = (() => {
const p = {};
return p.Content = function() {
function c(n) {
if (n)
for (let t = Object.keys(n), e = 0; e < t.length; ++e)
n[t[e]] != null && (this[t[e]] = n[t[e]]);
}
return c.prototype.token = u.newBuffer([]), c.prototype.iv = u.newBuffer([]), c.prototype.schemaVersion = 0, c.prototype.bytes = u.newBuffer([]), c.create = function(n) {
return new c(n);
}, c.encode = function(n, t) {
return t || (t = L.create()), n.token != null && Object.hasOwnProperty.call(n, "token") && t.uint32(
/* id 1, wireType 2 =*/
10
).bytes(n.token), n.iv != null && Object.hasOwnProperty.call(n, "iv") && t.uint32(
/* id 2, wireType 2 =*/
18
).bytes(n.iv), n.schemaVersion != null && Object.hasOwnProperty.call(n, "schemaVersion") && t.uint32(
/* id 3, wireType 0 =*/
24
).int32(n.schemaVersion), n.bytes != null && Object.hasOwnProperty.call(n, "bytes") && t.uint32(
/* id 4, wireType 2 =*/
34
).bytes(n.bytes), t;
}, c.encodeDelimited = function(n, t) {
return this.encode(n, t).ldelim();
}, c.decode = function(n, t, e) {
n instanceof g || (n = g.create(n));
let r = t === void 0 ? n.len : n.pos + t, o = new i.dot.Content();
for (; n.pos < r; ) {
let d = n.uint32();
if (d === e)
break;
switch (d >>> 3) {
case 1: {
o.token = n.bytes();
break;
}
case 2: {
o.iv = n.bytes();
break;
}
case 3: {
o.schemaVersion = n.int32();
break;
}
case 4: {
o.bytes = n.bytes();
break;
}
default:
n.skipType(d & 7);
break;
}
}
return o;
}, c.decodeDelimited = function(n) {
return n instanceof g || (n = new g(n)), this.decode(n, n.uint32());
}, c.verify = function(n) {
return typeof n != "object" || n === null ? "object expected" : n.token != null && n.hasOwnProperty("token") && !(n.token && typeof n.token.length == "number" || u.isString(n.token)) ? "token: buffer expected" : n.iv != null && n.hasOwnProperty("iv") && !(n.iv && typeof n.iv.length == "number" || u.isString(n.iv)) ? "iv: buffer expected" : n.schemaVersion != null && n.hasOwnProperty("schemaVersion") && !u.isInteger(n.schemaVersion) ? "schemaVersion: integer expected" : n.bytes != null && n.hasOwnProperty("bytes") && !(n.bytes && typeof n.bytes.length == "number" || u.isString(n.bytes)) ? "bytes: buffer expected" : null;
}, c.fromObject = function(n) {
if (n instanceof i.dot.Content)
return n;
let t = new i.dot.Content();
return n.token != null && (typeof n.token == "string" ? u.base64.decode(n.token, t.token = u.newBuffer(u.base64.length(n.token)), 0) : n.token.length >= 0 && (t.token = n.token)), n.iv != null && (typeof n.iv == "string" ? u.base64.decode(n.iv, t.iv = u.newBuffer(u.base64.length(n.iv)), 0) : n.iv.length >= 0 && (t.iv = n.iv)), n.schemaVersion != null && (t.schemaVersion = n.schemaVersion | 0), n.bytes != null && (typeof n.bytes == "string" ? u.base64.decode(n.bytes, t.bytes = u.newBuffer(u.base64.length(n.bytes)), 0) : n.bytes.length >= 0 && (t.bytes = n.bytes)), t;
}, c.toObject = function(n, t) {
t || (t = {});
let e = {};
return t.defaults && (t.bytes === String ? e.token = "" : (e.token = [], t.bytes !== Array && (e.token = u.newBuffer(e.token))), t.bytes === String ? e.iv = "" : (e.iv = [], t.bytes !== Array && (e.iv = u.newBuffer(e.iv))), e.schemaVersion = 0, t.bytes === String ? e.bytes = "" : (e.bytes = [], t.bytes !== Array && (e.bytes = u.newBuffer(e.bytes)))), n.token != null && n.hasOwnProperty("token") && (e.token = t.bytes === String ? u.base64.encode(n.token, 0, n.token.length) : t.bytes === Array ? Array.prototype.slice.call(n.token) : n.token), n.iv != null && n.hasOwnProperty("iv") && (e.iv = t.bytes === String ? u.base64.encode(n.iv, 0, n.iv.length) : t.bytes === Array ? Array.prototype.slice.call(n.iv) : n.iv), n.schemaVersion != null && n.hasOwnProperty("schemaVersion") && (e.schemaVersion = n.schemaVersion), n.bytes != null && n.hasOwnProperty("bytes") && (e.bytes = t.bytes === String ? u.base64.encode(n.bytes, 0, n.bytes.length) : t.bytes === Array ? Array.prototype.slice.call(n.bytes) : n.bytes), e;
}, c.prototype.toJSON = function() {
return this.constructor.toObject(this, _.util.toJSONOptions);
}, c.getTypeUrl = function(n) {
return n === void 0 && (n = "type.googleapis.com"), n + "/dot.Content";
}, c;
}(), p.v4 = function() {
const c = {};
return c.MagnifEyeLivenessContent = function() {
function n(e) {
if (this.images = [], e)
for (let r = Object.keys(e), o = 0; o < r.length; ++o)
e[r[o]] != null && (this[r[o]] = e[r[o]]);
}
n.prototype.images = u.emptyArray, n.prototype.video = null, n.prototype.metadata = null;
let t;
return Object.defineProperty(n.prototype, "_video", {
get: u.oneOfGetter(t = ["video"]),
set: u.oneOfSetter(t)
}), n.create = function(e) {
return new n(e);
}, n.encode = function(e, r) {
if (r || (r = L.create()), e.images != null && e.images.length)
for (let o = 0; o < e.images.length; ++o)
i.dot.Image.encode(e.images[o], r.uint32(
/* id 1, wireType 2 =*/
10
).fork()).ldelim();
return e.metadata != null && Object.hasOwnProperty.call(e, "metadata") && i.dot.v4.Metadata.encode(e.metadata, r.uint32(
/* id 2, wireType 2 =*/
18
).fork()).ldelim(), e.video != null && Object.hasOwnProperty.call(e, "video") && i.dot.Video.encode(e.video, r.uint32(
/* id 3, wireType 2 =*/
26
).fork()).ldelim(), r;
}, n.encodeDelimited = function(e, r) {
return this.encode(e, r).ldelim();
}, n.decode = function(e, r, o) {
e instanceof g || (e = g.create(e));
let d = r === void 0 ? e.len : e.pos + r, l = new i.dot.v4.MagnifEyeLivenessContent();
for (; e.pos < d; ) {
let y = e.uint32();
if (y === o)
break;
switch (y >>> 3) {
case 1: {
l.images && l.images.length || (l.images = []), l.images.push(i.dot.Image.decode(e, e.uint32()));
break;
}
case 3: {
l.video = i.dot.Video.decode(e, e.uint32());
break;
}
case 2: {
l.metadata = i.dot.v4.Metadata.decode(e, e.uint32());
break;
}
default:
e.skipType(y & 7);
break;
}
}
return l;
}, n.decodeDelimited = function(e) {
return e instanceof g || (e = new g(e)), this.decode(e, e.uint32());
}, n.verify = function(e) {
if (typeof e != "object" || e === null)
return "object expected";
if (e.images != null && e.hasOwnProperty("images")) {
if (!Array.isArray(e.images))
return "images: array expected";
for (let r = 0; r < e.images.length; ++r) {
let o = i.dot.Image.verify(e.images[r]);
if (o)
return "images." + o;
}
}
if (e.video != null && e.hasOwnProperty("video")) {
let r = i.dot.Video.verify(e.video);
if (r)
return "video." + r;
}
if (e.metadata != null && e.hasOwnProperty("metadata")) {
let r = i.dot.v4.Metadata.verify(e.metadata);
if (r)
return "metadata." + r;
}
return null;
}, n.fromObject = function(e) {
if (e instanceof i.dot.v4.MagnifEyeLivenessContent)
return e;
let r = new i.dot.v4.MagnifEyeLivenessContent();
if (e.images) {
if (!Array.isArray(e.images))
throw TypeError(".dot.v4.MagnifEyeLivenessContent.images: array expected");
r.images = [];
for (let o = 0; o < e.images.length; ++o) {
if (typeof e.images[o] != "object")
throw TypeError(".dot.v4.MagnifEyeLivenessContent.images: object expected");
r.images[o] = i.dot.Image.fromObject(e.images[o]);
}
}
if (e.video != null) {
if (typeof e.video != "object")
throw TypeError(".dot.v4.MagnifEyeLivenessContent.video: object expected");
r.video = i.dot.Video.fromObject(e.video);
}
if (e.metadata != null) {
if (typeof e.metadata != "object")
throw TypeError(".dot.v4.MagnifEyeLivenessContent.metadata: object expected");
r.metadata = i.dot.v4.Metadata.fromObject(e.metadata);
}
return r;
}, n.toObject = function(e, r) {
r || (r = {});
let o = {};
if ((r.arrays || r.defaults) && (o.images = []), r.defaults && (o.metadata = null), e.images && e.images.length) {
o.images = [];
for (let d = 0; d < e.images.length; ++d)
o.images[d] = i.dot.Image.toObject(e.images[d], r);
}
return e.metadata != null && e.hasOwnProperty("metadata") && (o.metadata = i.dot.v4.Metadata.toObject(e.metadata, r)), e.video != null && e.hasOwnProperty("video") && (o.video = i.dot.Video.toObject(e.video, r), r.oneofs && (o._video = "video")), o;
}, n.prototype.toJSON = function() {
return this.constructor.toObject(this, _.util.toJSONOptions);
}, n.getTypeUrl = function(e) {
return e === void 0 && (e = "type.googleapis.com"), e + "/dot.v4.MagnifEyeLivenessContent";
}, n;
}(), c.Metadata = function() {
function n(e) {
if (e)
for (let r = Object.keys(e), o = 0; o < r.length; ++o)
e[r[o]] != null && (this[r[o]] = e[r[o]]);
}
n.prototype.platform = 0, n.prototype.sessionToken = null, n.prototype.componentVersion = "", n.prototype.web = null, n.prototype.android = null, n.prototype.ios = null;
let t;
return Object.defineProperty(n.prototype, "_sessionToken", {
get: u.oneOfGetter(t = ["sessionToken"]),
set: u.oneOfSetter(t)
}), Object.defineProperty(n.prototype, "metadata", {
get: u.oneOfGetter(t = ["web", "android", "ios"]),
set: u.oneOfSetter(t)
}), n.create = function(e) {
return new n(e);
}, n.encode = function(e, r) {
return r || (r = L.create()), e.platform != null && Object.hasOwnProperty.call(e, "platform") && r.uint32(
/* id 1, wireType 0 =*/
8
).int32(e.platform), e.web != null && Object.hasOwnProperty.call(e, "web") && i.dot.v4.WebMetadata.encode(e.web, r.uint32(
/* id 2, wireType 2 =*/
18
).fork()).ldelim(), e.android != null && Object.hasOwnProperty.call(e, "android") && i.dot.v4.AndroidMetadata.encode(e.android, r.uint32(
/* id 3, wireType 2 =*/
26
).fork()).ldelim(), e.ios != null && Object.hasOwnProperty.call(e, "ios") && i.dot.v4.IosMetadata.encode(e.ios, r.uint32(
/* id 4, wireType 2 =*/
34
).fork()).ldelim(), e.sessionToken != null && Object.hasOwnProperty.call(e, "sessionToken") && r.uint32(
/* id 5, wireType 2 =*/
42
).string(e.sessionToken), e.componentVersion != null && Object.hasOwnProperty.call(e, "componentVersion") && r.uint32(
/* id 6, wireType 2 =*/
50
).string(e.componentVersion), r;
}, n.encodeDelimited = function(e, r) {
return this.encode(e, r).ldelim();
}, n.decode = function(e, r, o) {
e instanceof g || (e = g.create(e));
let d = r === void 0 ? e.len : e.pos + r, l = new i.dot.v4.Metadata();
for (; e.pos < d; ) {
let y = e.uint32();
if (y === o)
break;
switch (y >>> 3) {