@richard.fadiora/liveness-detection 4.0.1 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,3789 +1,554 @@
1
- var va = Object.defineProperty;
2
- var wa = (t, e, n) => e in t ? va(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var ls = (t, e, n) => wa(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { useState as ba, useRef as fs, useEffect as ds, useCallback as ps } from "react";
5
- const f1 = async (t, e, n) => {
6
- const r = new FormData();
7
- e.forEach((i, o) => {
8
- r.append("files", i, `frame_${o}.jpg`);
9
- }), r.append("challenge", n);
10
- const s = await fetch(`${t}/v1/verify`, {
1
+ import { FilesetResolver as re, FaceLandmarker as se, HandLandmarker as ne } from "@mediapipe/tasks-vision";
2
+ import ae, { useState as ie, useRef as q, useEffect as Y, useCallback as V } from "react";
3
+ import oe from "react-webcam";
4
+ const ce = async (p, t, c) => {
5
+ const i = new FormData();
6
+ t.forEach((n, a) => {
7
+ i.append("files", n, `frame_${a}.jpg`);
8
+ }), i.append("challenge", JSON.stringify(c));
9
+ const r = await fetch(`${p}/v1/verify`, {
11
10
  method: "POST",
12
- body: r
11
+ body: i
13
12
  });
14
- if (!s.ok) throw new Error("Network response was not ok");
15
- return await s.json();
16
- };
17
- var ue = typeof self < "u" ? self : {};
18
- function Ve(t, e) {
19
- t: {
20
- for (var n = ["CLOSURE_FLAGS"], r = ue, s = 0; s < n.length; s++) if ((r = r[n[s]]) == null) {
21
- n = null;
22
- break t;
23
- }
24
- n = r;
25
- }
26
- return (t = n && n[t]) != null ? t : e;
27
- }
28
- function Ht() {
29
- throw Error("Invalid UTF8");
30
- }
31
- function gs(t, e) {
32
- return e = String.fromCharCode.apply(null, e), t == null ? e : t + e;
33
- }
34
- let en, jn;
35
- const Aa = typeof TextDecoder < "u";
36
- let Ea;
37
- const ka = typeof TextEncoder < "u";
38
- function yi(t) {
39
- if (ka) t = (Ea || (Ea = new TextEncoder())).encode(t);
40
- else {
41
- let n = 0;
42
- const r = new Uint8Array(3 * t.length);
43
- for (let s = 0; s < t.length; s++) {
44
- var e = t.charCodeAt(s);
45
- if (e < 128) r[n++] = e;
46
- else {
47
- if (e < 2048) r[n++] = e >> 6 | 192;
48
- else {
49
- if (e >= 55296 && e <= 57343) {
50
- if (e <= 56319 && s < t.length) {
51
- const i = t.charCodeAt(++s);
52
- if (i >= 56320 && i <= 57343) {
53
- e = 1024 * (e - 55296) + i - 56320 + 65536, r[n++] = e >> 18 | 240, r[n++] = e >> 12 & 63 | 128, r[n++] = e >> 6 & 63 | 128, r[n++] = 63 & e | 128;
54
- continue;
55
- }
56
- s--;
57
- }
58
- e = 65533;
59
- }
60
- r[n++] = e >> 12 | 224, r[n++] = e >> 6 & 63 | 128;
61
- }
62
- r[n++] = 63 & e | 128;
63
- }
64
- }
65
- t = n === r.length ? r : r.subarray(0, n);
66
- }
67
- return t;
68
- }
69
- function vi(t) {
70
- ue.setTimeout(() => {
71
- throw t;
72
- }, 0);
73
- }
74
- var Yn, Sa = Ve(610401301, !1), ms = Ve(748402147, !0), pr = Ve(824648567, !0), gr = Ve(824656860, Ve(1, !0));
75
- function _s() {
76
- var t = ue.navigator;
77
- return t && (t = t.userAgent) ? t : "";
78
- }
79
- const ys = ue.navigator;
80
- function gn(t) {
81
- return gn[" "](t), t;
82
- }
83
- Yn = ys && ys.userAgentData || null, gn[" "] = function() {
84
- };
85
- const wi = {};
86
- let Be = null;
87
- function Ta(t) {
88
- const e = t.length;
89
- let n = 3 * e / 4;
90
- n % 3 ? n = Math.floor(n) : "=.".indexOf(t[e - 1]) != -1 && (n = "=.".indexOf(t[e - 2]) != -1 ? n - 2 : n - 1);
91
- const r = new Uint8Array(n);
92
- let s = 0;
93
- return function(i, o) {
94
- function a(u) {
95
- for (; c < i.length; ) {
96
- const h = i.charAt(c++), f = Be[h];
97
- if (f != null) return f;
98
- if (!/^[\s\xa0]*$/.test(h)) throw Error("Unknown base64 encoding at char: " + h);
99
- }
100
- return u;
101
- }
102
- bi();
103
- let c = 0;
104
- for (; ; ) {
105
- const u = a(-1), h = a(0), f = a(64), y = a(64);
106
- if (y === 64 && u === -1) break;
107
- o(u << 2 | h >> 4), f != 64 && (o(h << 4 & 240 | f >> 2), y != 64 && o(f << 6 & 192 | y));
108
- }
109
- }(t, function(i) {
110
- r[s++] = i;
111
- }), s !== n ? r.subarray(0, s) : r;
112
- }
113
- function bi() {
114
- if (!Be) {
115
- Be = {};
116
- var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""), e = ["+/=", "+/", "-_=", "-_.", "-_"];
117
- for (let n = 0; n < 5; n++) {
118
- const r = t.concat(e[n].split(""));
119
- wi[n] = r;
120
- for (let s = 0; s < r.length; s++) {
121
- const i = r[s];
122
- Be[i] === void 0 && (Be[i] = s);
123
- }
124
- }
125
- }
126
- }
127
- var La = typeof Uint8Array < "u", Ai = !(!(Sa && Yn && Yn.brands.length > 0) && (_s().indexOf("Trident") != -1 || _s().indexOf("MSIE") != -1)) && typeof btoa == "function";
128
- const vs = /[-_.]/g, Fa = { "-": "+", _: "/", ".": "=" };
129
- function Ma(t) {
130
- return Fa[t] || "";
131
- }
132
- function Ei(t) {
133
- if (!Ai) return Ta(t);
134
- t = vs.test(t) ? t.replace(vs, Ma) : t, t = atob(t);
135
- const e = new Uint8Array(t.length);
136
- for (let n = 0; n < t.length; n++) e[n] = t.charCodeAt(n);
137
- return e;
138
- }
139
- function mr(t) {
140
- return La && t != null && t instanceof Uint8Array;
141
- }
142
- var le = {};
143
- function Zt() {
144
- return Pa || (Pa = new Et(null, le));
145
- }
146
- function _r(t) {
147
- ki(le);
148
- var e = t.g;
149
- return (e = e == null || mr(e) ? e : typeof e == "string" ? Ei(e) : null) == null ? e : t.g = e;
150
- }
151
- var Et = class {
152
- h() {
153
- return new Uint8Array(_r(this) || 0);
154
- }
155
- constructor(t, e) {
156
- if (ki(e), this.g = t, t != null && t.length === 0) throw Error("ByteString should be constructed with non-empty values");
157
- }
158
- };
159
- let Pa, Oa;
160
- function ki(t) {
161
- if (t !== le) throw Error("illegal external caller");
162
- }
163
- function Si(t, e) {
164
- t.__closure__error__context__984382 || (t.__closure__error__context__984382 = {}), t.__closure__error__context__984382.severity = e;
165
- }
166
- function $n(t) {
167
- return Si(t = Error(t), "warning"), t;
168
- }
169
- function fe(t, e) {
170
- if (t != null) {
171
- var n = Oa ?? (Oa = {}), r = n[t] || 0;
172
- r >= e || (n[t] = r + 1, Si(t = Error(), "incident"), vi(t));
173
- }
174
- }
175
- function Ae() {
176
- return typeof BigInt == "function";
177
- }
178
- var Ee = typeof Symbol == "function" && typeof Symbol() == "symbol";
179
- function kt(t, e, n = !1) {
180
- return typeof Symbol == "function" && typeof Symbol() == "symbol" ? n && Symbol.for && t ? Symbol.for(t) : t != null ? Symbol(t) : Symbol() : e;
181
- }
182
- var xa = kt("jas", void 0, !0), ws = kt(void 0, "0di"), Ce = kt(void 0, "1oa"), nt = kt(void 0, Symbol()), Ia = kt(void 0, "0ub"), Na = kt(void 0, "0ubs"), Jn = kt(void 0, "0ubsb"), Ca = kt(void 0, "0actk"), de = kt("m_m", "Pa", !0), bs = kt();
183
- const Ti = { Ga: { value: 0, configurable: !0, writable: !0, enumerable: !1 } }, Li = Object.defineProperties, d = Ee ? xa : "Ga";
184
- var ee;
185
- const As = [];
186
- function qe(t, e) {
187
- Ee || d in t || Li(t, Ti), t[d] |= e;
188
- }
189
- function V(t, e) {
190
- Ee || d in t || Li(t, Ti), t[d] = e;
191
- }
192
- function Xe(t) {
193
- return qe(t, 34), t;
194
- }
195
- function He(t) {
196
- return qe(t, 8192), t;
197
- }
198
- V(As, 7), ee = Object.freeze(As);
199
- var pe = {};
200
- function st(t, e) {
201
- return e === void 0 ? t.h !== Qt && !!(2 & (0 | t.v[d])) : !!(2 & e) && t.h !== Qt;
202
- }
203
- const Qt = {};
204
- function yr(t, e) {
205
- if (t != null) {
206
- if (typeof t == "string") t = t ? new Et(t, le) : Zt();
207
- else if (t.constructor !== Et) if (mr(t)) t = t.length ? new Et(new Uint8Array(t), le) : Zt();
208
- else {
209
- if (!e) throw Error();
210
- t = void 0;
211
- }
212
- }
213
- return t;
214
- }
215
- class Es {
216
- constructor(e, n, r) {
217
- this.g = e, this.h = n, this.l = r;
218
- }
219
- next() {
220
- const e = this.g.next();
221
- return e.done || (e.value = this.h.call(this.l, e.value)), e;
222
- }
223
- [Symbol.iterator]() {
224
- return this;
225
- }
226
- }
227
- var Ra = Object.freeze({});
228
- function Fi(t, e, n) {
229
- const r = 128 & e ? 0 : -1, s = t.length;
230
- var i;
231
- (i = !!s) && (i = (i = t[s - 1]) != null && typeof i == "object" && i.constructor === Object);
232
- const o = s + (i ? -1 : 0);
233
- for (e = 128 & e ? 1 : 0; e < o; e++) n(e - r, t[e]);
234
- if (i) {
235
- t = t[s - 1];
236
- for (const a in t) !isNaN(a) && n(+a, t[a]);
237
- }
238
- }
239
- var Mi = {};
240
- function ke(t) {
241
- return 128 & t ? Mi : void 0;
242
- }
243
- function mn(t) {
244
- return t.Na = !0, t;
245
- }
246
- var Ba = mn((t) => typeof t == "number"), ks = mn((t) => typeof t == "string"), Da = mn((t) => typeof t == "boolean"), _n = typeof ue.BigInt == "function" && typeof ue.BigInt(0) == "bigint";
247
- function rt(t) {
248
- var e = t;
249
- if (ks(e)) {
250
- if (!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e)) throw Error(String(e));
251
- } else if (Ba(e) && !Number.isSafeInteger(e)) throw Error(String(e));
252
- return _n ? BigInt(t) : t = Da(t) ? t ? "1" : "0" : ks(t) ? t.trim() || "0" : String(t);
253
- }
254
- var Zn = mn((t) => _n ? t >= ja && t <= Va : t[0] === "-" ? Ss(t, Ua) : Ss(t, Ga));
255
- const Ua = Number.MIN_SAFE_INTEGER.toString(), ja = _n ? BigInt(Number.MIN_SAFE_INTEGER) : void 0, Ga = Number.MAX_SAFE_INTEGER.toString(), Va = _n ? BigInt(Number.MAX_SAFE_INTEGER) : void 0;
256
- function Ss(t, e) {
257
- if (t.length > e.length) return !1;
258
- if (t.length < e.length || t === e) return !0;
259
- for (let n = 0; n < t.length; n++) {
260
- const r = t[n], s = e[n];
261
- if (r > s) return !1;
262
- if (r < s) return !0;
263
- }
264
- }
265
- const Ha = typeof Uint8Array.prototype.slice == "function";
266
- let Wa, P = 0, B = 0;
267
- function Ts(t) {
268
- const e = t >>> 0;
269
- P = e, B = (t - e) / 4294967296 >>> 0;
270
- }
271
- function ge(t) {
272
- if (t < 0) {
273
- Ts(-t);
274
- const [e, n] = Ar(P, B);
275
- P = e >>> 0, B = n >>> 0;
276
- } else Ts(t);
277
- }
278
- function vr(t) {
279
- const e = Wa || (Wa = new DataView(new ArrayBuffer(8)));
280
- e.setFloat32(0, +t, !0), B = 0, P = e.getUint32(0, !0);
281
- }
282
- function Qn(t, e) {
283
- const n = 4294967296 * e + (t >>> 0);
284
- return Number.isSafeInteger(n) ? n : We(t, e);
285
- }
286
- function Ka(t, e) {
287
- return rt(Ae() ? BigInt.asUintN(64, (BigInt(e >>> 0) << BigInt(32)) + BigInt(t >>> 0)) : We(t, e));
288
- }
289
- function wr(t, e) {
290
- const n = 2147483648 & e;
291
- return n && (e = ~e >>> 0, (t = 1 + ~t >>> 0) == 0 && (e = e + 1 >>> 0)), typeof (t = Qn(t, e)) == "number" ? n ? -t : t : n ? "-" + t : t;
292
- }
293
- function Pi(t, e) {
294
- return Ae() ? rt(BigInt.asIntN(64, (BigInt.asUintN(32, BigInt(e)) << BigInt(32)) + BigInt.asUintN(32, BigInt(t)))) : rt(br(t, e));
295
- }
296
- function We(t, e) {
297
- if (t >>>= 0, (e >>>= 0) <= 2097151) var n = "" + (4294967296 * e + t);
298
- else Ae() ? n = "" + (BigInt(e) << BigInt(32) | BigInt(t)) : (t = (16777215 & t) + 6777216 * (n = 16777215 & (t >>> 24 | e << 8)) + 6710656 * (e = e >> 16 & 65535), n += 8147497 * e, e *= 2, t >= 1e7 && (n += t / 1e7 >>> 0, t %= 1e7), n >= 1e7 && (e += n / 1e7 >>> 0, n %= 1e7), n = e + Ls(n) + Ls(t));
299
- return n;
300
- }
301
- function Ls(t) {
302
- return t = String(t), "0000000".slice(t.length) + t;
303
- }
304
- function br(t, e) {
305
- if (2147483648 & e) if (Ae()) t = "" + (BigInt(0 | e) << BigInt(32) | BigInt(t >>> 0));
306
- else {
307
- const [n, r] = Ar(t, e);
308
- t = "-" + We(n, r);
309
- }
310
- else t = We(t, e);
311
- return t;
312
- }
313
- function yn(t) {
314
- if (t.length < 16) ge(Number(t));
315
- else if (Ae()) t = BigInt(t), P = Number(t & BigInt(4294967295)) >>> 0, B = Number(t >> BigInt(32) & BigInt(4294967295));
316
- else {
317
- const e = +(t[0] === "-");
318
- B = P = 0;
319
- const n = t.length;
320
- for (let r = e, s = (n - e) % 6 + e; s <= n; r = s, s += 6) {
321
- const i = Number(t.slice(r, s));
322
- B *= 1e6, P = 1e6 * P + i, P >= 4294967296 && (B += Math.trunc(P / 4294967296), B >>>= 0, P >>>= 0);
323
- }
324
- if (e) {
325
- const [r, s] = Ar(P, B);
326
- P = r, B = s;
327
- }
328
- }
329
- }
330
- function Ar(t, e) {
331
- return e = ~e, t ? t = 1 + ~t : e += 1, [t, e];
332
- }
333
- function mt(t) {
334
- return Array.prototype.slice.call(t);
335
- }
336
- const Ye = typeof BigInt == "function" ? BigInt.asIntN : void 0, za = typeof BigInt == "function" ? BigInt.asUintN : void 0, te = Number.isSafeInteger, vn = Number.isFinite, me = Math.trunc, qa = rt(0);
337
- function De(t) {
338
- if (t != null && typeof t != "number") throw Error(`Value of float/double field must be a number, found ${typeof t}: ${t}`);
339
- return t;
340
- }
341
- function At(t) {
342
- return t == null || typeof t == "number" ? t : t === "NaN" || t === "Infinity" || t === "-Infinity" ? Number(t) : void 0;
343
- }
344
- function Ke(t) {
345
- if (t != null && typeof t != "boolean") {
346
- var e = typeof t;
347
- throw Error(`Expected boolean but got ${e != "object" ? e : t ? Array.isArray(t) ? "array" : e : "null"}: ${t}`);
348
- }
349
- return t;
350
- }
351
- function Oi(t) {
352
- return t == null || typeof t == "boolean" ? t : typeof t == "number" ? !!t : void 0;
353
- }
354
- const Xa = /^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;
355
- function $e(t) {
356
- switch (typeof t) {
357
- case "bigint":
358
- return !0;
359
- case "number":
360
- return vn(t);
361
- case "string":
362
- return Xa.test(t);
363
- default:
364
- return !1;
365
- }
366
- }
367
- function Se(t) {
368
- if (t == null) return t;
369
- if (typeof t == "string" && t) t = +t;
370
- else if (typeof t != "number") return;
371
- return vn(t) ? 0 | t : void 0;
372
- }
373
- function xi(t) {
374
- if (t == null) return t;
375
- if (typeof t == "string" && t) t = +t;
376
- else if (typeof t != "number") return;
377
- return vn(t) ? t >>> 0 : void 0;
378
- }
379
- function Ii(t) {
380
- const e = t.length;
381
- return (t[0] === "-" ? e < 20 || e === 20 && t <= "-9223372036854775808" : e < 19 || e === 19 && t <= "9223372036854775807") ? t : (yn(t), br(P, B));
382
- }
383
- function Er(t) {
384
- return t = me(t), te(t) || (ge(t), t = wr(P, B)), t;
385
- }
386
- function Ni(t) {
387
- var e = me(Number(t));
388
- return te(e) ? String(e) : ((e = t.indexOf(".")) !== -1 && (t = t.substring(0, e)), Ii(t));
389
- }
390
- function Ci(t) {
391
- var e = me(Number(t));
392
- return te(e) ? rt(e) : ((e = t.indexOf(".")) !== -1 && (t = t.substring(0, e)), Ae() ? rt(Ye(64, BigInt(t))) : rt(Ii(t)));
393
- }
394
- function Ri(t) {
395
- return te(t) ? t = rt(Er(t)) : (t = me(t), te(t) ? t = String(t) : (ge(t), t = br(P, B)), t = rt(t)), t;
396
- }
397
- function Ya(t) {
398
- return t == null ? t : typeof t == "bigint" ? (Zn(t) ? t = Number(t) : (t = Ye(64, t), t = Zn(t) ? Number(t) : String(t)), t) : $e(t) ? typeof t == "number" ? Er(t) : Ni(t) : void 0;
399
- }
400
- function cn(t) {
401
- const e = typeof t;
402
- return t == null ? t : e === "bigint" ? rt(Ye(64, t)) : $e(t) ? e === "string" ? Ci(t) : Ri(t) : void 0;
403
- }
404
- function Bi(t) {
405
- if (typeof t != "string") throw Error();
406
- return t;
407
- }
408
- function Je(t) {
409
- if (t != null && typeof t != "string") throw Error();
410
- return t;
411
- }
412
- function q(t) {
413
- return t == null || typeof t == "string" ? t : void 0;
414
- }
415
- function kr(t, e, n, r) {
416
- return t != null && t[de] === pe ? t : Array.isArray(t) ? ((r = (n = 0 | t[d]) | 32 & r | 2 & r) !== n && V(t, r), new e(t)) : (n ? 2 & r ? ((t = e[ws]) || (Xe((t = new e()).v), t = e[ws] = t), e = t) : e = new e() : e = void 0, e);
417
- }
418
- function $a(t, e, n) {
419
- if (e) t: {
420
- if (!$e(e = t)) throw $n("int64");
421
- switch (typeof e) {
422
- case "string":
423
- e = Ci(e);
424
- break t;
425
- case "bigint":
426
- e = rt(Ye(64, e));
427
- break t;
428
- default:
429
- e = Ri(e);
430
- }
431
- }
432
- else e = cn(t);
433
- return (t = e) == null ? n ? qa : void 0 : t;
434
- }
435
- const Ja = {};
436
- let Za = function() {
437
- try {
438
- return gn(new class extends Map {
439
- constructor() {
440
- super();
441
- }
442
- }()), !1;
443
- } catch {
444
- return !0;
445
- }
446
- }();
447
- class Gn {
448
- constructor() {
449
- this.g = /* @__PURE__ */ new Map();
450
- }
451
- get(e) {
452
- return this.g.get(e);
453
- }
454
- set(e, n) {
455
- return this.g.set(e, n), this.size = this.g.size, this;
456
- }
457
- delete(e) {
458
- return e = this.g.delete(e), this.size = this.g.size, e;
459
- }
460
- clear() {
461
- this.g.clear(), this.size = this.g.size;
462
- }
463
- has(e) {
464
- return this.g.has(e);
465
- }
466
- entries() {
467
- return this.g.entries();
468
- }
469
- keys() {
470
- return this.g.keys();
471
- }
472
- values() {
473
- return this.g.values();
474
- }
475
- forEach(e, n) {
476
- return this.g.forEach(e, n);
477
- }
478
- [Symbol.iterator]() {
479
- return this.entries();
480
- }
481
- }
482
- const Qa = Za ? (Object.setPrototypeOf(Gn.prototype, Map.prototype), Object.defineProperties(Gn.prototype, { size: { value: 0, configurable: !0, enumerable: !0, writable: !0 } }), Gn) : class extends Map {
483
- constructor() {
484
- super();
485
- }
486
- };
487
- function Fs(t) {
488
- return t;
489
- }
490
- function Vn(t) {
491
- if (2 & t.J) throw Error("Cannot mutate an immutable Map");
492
- }
493
- var Pt = class extends Qa {
494
- constructor(t, e, n = Fs, r = Fs) {
495
- super(), this.J = 0 | t[d], this.K = e, this.S = n, this.fa = this.K ? t2 : r;
496
- for (let s = 0; s < t.length; s++) {
497
- const i = t[s], o = n(i[0], !1, !0);
498
- let a = i[1];
499
- e ? a === void 0 && (a = null) : a = r(i[1], !1, !0, void 0, void 0, this.J), super.set(o, a);
500
- }
501
- }
502
- V(t) {
503
- return He(Array.from(super.entries(), t));
504
- }
505
- clear() {
506
- Vn(this), super.clear();
507
- }
508
- delete(t) {
509
- return Vn(this), super.delete(this.S(t, !0, !1));
510
- }
511
- entries() {
512
- if (this.K) {
513
- var t = super.keys();
514
- t = new Es(t, e2, this);
515
- } else t = super.entries();
516
- return t;
517
- }
518
- values() {
519
- if (this.K) {
520
- var t = super.keys();
521
- t = new Es(t, Pt.prototype.get, this);
522
- } else t = super.values();
523
- return t;
524
- }
525
- forEach(t, e) {
526
- this.K ? super.forEach((n, r, s) => {
527
- t.call(e, s.get(r), r, s);
528
- }) : super.forEach(t, e);
529
- }
530
- set(t, e) {
531
- return Vn(this), (t = this.S(t, !0, !1)) == null ? this : e == null ? (super.delete(t), this) : super.set(t, this.fa(e, !0, !0, this.K, !1, this.J));
532
- }
533
- Ma(t) {
534
- const e = this.S(t[0], !1, !0);
535
- t = t[1], t = this.K ? t === void 0 ? null : t : this.fa(t, !1, !0, void 0, !1, this.J), super.set(e, t);
536
- }
537
- has(t) {
538
- return super.has(this.S(t, !1, !1));
539
- }
540
- get(t) {
541
- t = this.S(t, !1, !1);
542
- const e = super.get(t);
543
- if (e !== void 0) {
544
- var n = this.K;
545
- return n ? ((n = this.fa(e, !1, !0, n, this.ra, this.J)) !== e && super.set(t, n), n) : e;
546
- }
547
- }
548
- [Symbol.iterator]() {
549
- return this.entries();
550
- }
551
- };
552
- function t2(t, e, n, r, s, i) {
553
- return t = kr(t, r, n, i), s && (t = Tr(t)), t;
554
- }
555
- function e2(t) {
556
- return [t, this.get(t)];
557
- }
558
- let n2;
559
- function Ms() {
560
- return n2 || (n2 = new Pt(Xe([]), void 0, void 0, void 0, Ja));
561
- }
562
- function wn(t) {
563
- return nt ? t[nt] : void 0;
564
- }
565
- function hn(t, e) {
566
- for (const n in t) !isNaN(n) && e(t, +n, t[n]);
567
- }
568
- Pt.prototype.toJSON = void 0;
569
- var tr = class {
570
- };
571
- const r2 = { Ka: !0 };
572
- function s2(t, e) {
573
- e < 100 || fe(Na, 1);
574
- }
575
- function bn(t, e, n, r) {
576
- const s = r !== void 0;
577
- r = !!r;
578
- var i, o = nt;
579
- !s && Ee && o && (i = t[o]) && hn(i, s2), o = [];
580
- var a = t.length;
581
- let c;
582
- i = 4294967295;
583
- let u = !1;
584
- const h = !!(64 & e), f = h ? 128 & e ? 0 : -1 : void 0;
585
- 1 & e || (c = a && t[a - 1], c != null && typeof c == "object" && c.constructor === Object ? i = --a : c = void 0, !h || 128 & e || s || (u = !0, i = i - f + f)), e = void 0;
586
- for (var y = 0; y < a; y++) {
587
- let v = t[y];
588
- if (v != null && (v = n(v, r)) != null) if (h && y >= i) {
589
- const x = y - f;
590
- (e ?? (e = {}))[x] = v;
591
- } else o[y] = v;
592
- }
593
- if (c) for (let v in c) {
594
- if ((a = c[v]) == null || (a = n(a, r)) == null) continue;
595
- let x;
596
- y = +v, h && !Number.isNaN(y) && (x = y + f) < i ? o[x] = a : (e ?? (e = {}))[v] = a;
597
- }
598
- return e && (u ? o.push(e) : o[i] = e), s && nt && (t = wn(t)) && t instanceof tr && (o[nt] = function(v) {
599
- const x = new tr();
600
- return hn(v, (Dn, se, Ne) => {
601
- x[se] = mt(Ne);
602
- }), x.da = v.da, x;
603
- }(t)), o;
604
- }
605
- function i2(t) {
606
- return t[0] = ze(t[0]), t[1] = ze(t[1]), t;
607
- }
608
- function ze(t) {
609
- switch (typeof t) {
610
- case "number":
611
- return Number.isFinite(t) ? t : "" + t;
612
- case "bigint":
613
- return Zn(t) ? Number(t) : "" + t;
614
- case "boolean":
615
- return t ? 1 : 0;
616
- case "object":
617
- if (Array.isArray(t)) {
618
- var e = 0 | t[d];
619
- return t.length === 0 && 1 & e ? void 0 : bn(t, e, ze);
620
- }
621
- if (t != null && t[de] === pe) return Di(t);
622
- if (t instanceof Et) {
623
- if ((e = t.g) == null) t = "";
624
- else if (typeof e == "string") t = e;
625
- else {
626
- if (Ai) {
627
- for (var n = "", r = 0, s = e.length - 10240; r < s; ) n += String.fromCharCode.apply(null, e.subarray(r, r += 10240));
628
- n += String.fromCharCode.apply(null, r ? e.subarray(r) : e), e = btoa(n);
629
- } else {
630
- n === void 0 && (n = 0), bi(), n = wi[n], r = Array(Math.floor(e.length / 3)), s = n[64] || "";
631
- let u = 0, h = 0;
632
- for (; u < e.length - 2; u += 3) {
633
- var i = e[u], o = e[u + 1], a = e[u + 2], c = n[i >> 2];
634
- i = n[(3 & i) << 4 | o >> 4], o = n[(15 & o) << 2 | a >> 6], a = n[63 & a], r[h++] = c + i + o + a;
635
- }
636
- switch (c = 0, a = s, e.length - u) {
637
- case 2:
638
- a = n[(15 & (c = e[u + 1])) << 2] || s;
639
- case 1:
640
- e = e[u], r[h] = n[e >> 2] + n[(3 & e) << 4 | c >> 4] + a + s;
641
- }
642
- e = r.join("");
643
- }
644
- t = t.g = e;
645
- }
646
- return t;
647
- }
648
- return t instanceof Pt ? t = t.size !== 0 ? t.V(i2) : void 0 : void 0;
649
- }
650
- return t;
651
- }
652
- function Di(t) {
653
- return bn(t = t.v, 0 | t[d], ze);
654
- }
655
- let o2, a2;
656
- function qt(t, e) {
657
- return Ui(t, e[0], e[1]);
658
- }
659
- function Ui(t, e, n, r = 0) {
660
- if (t == null) {
661
- var s = 32;
662
- n ? (t = [n], s |= 128) : t = [], e && (s = -16760833 & s | (1023 & e) << 14);
663
- } else {
664
- if (!Array.isArray(t)) throw Error("narr");
665
- if (s = 0 | t[d], ms && 1 & s) throw Error("rfarr");
666
- if (2048 & s && !(2 & s) && function() {
667
- if (ms) throw Error("carr");
668
- fe(Ca, 5);
669
- }(), 256 & s) throw Error("farr");
670
- if (64 & s) return (s | r) !== s && V(t, s | r), t;
671
- if (n && (s |= 128, n !== t[0])) throw Error("mid");
672
- t: {
673
- s |= 64;
674
- var i = (n = t).length;
675
- if (i) {
676
- var o = i - 1;
677
- const c = n[o];
678
- if (c != null && typeof c == "object" && c.constructor === Object) {
679
- if ((o -= e = 128 & s ? 0 : -1) >= 1024) throw Error("pvtlmt");
680
- for (var a in c) (i = +a) < o && (n[i + e] = c[a], delete c[a]);
681
- s = -16760833 & s | (1023 & o) << 14;
682
- break t;
683
- }
684
- }
685
- if (e) {
686
- if ((a = Math.max(e, i - (128 & s ? 0 : -1))) > 1024) throw Error("spvt");
687
- s = -16760833 & s | (1023 & a) << 14;
688
- }
689
- }
690
- }
691
- return V(t, 64 | s | r), t;
692
- }
693
- function c2(t, e) {
694
- if (typeof t != "object") return t;
695
- if (Array.isArray(t)) {
696
- var n = 0 | t[d];
697
- return t.length === 0 && 1 & n ? void 0 : Ps(t, n, e);
698
- }
699
- if (t != null && t[de] === pe) return Os(t);
700
- if (t instanceof Pt) {
701
- if (2 & (e = t.J)) return t;
702
- if (!t.size) return;
703
- if (n = Xe(t.V()), t.K) for (t = 0; t < n.length; t++) {
704
- const r = n[t];
705
- let s = r[1];
706
- s = s == null || typeof s != "object" ? void 0 : s != null && s[de] === pe ? Os(s) : Array.isArray(s) ? Ps(s, 0 | s[d], !!(32 & e)) : void 0, r[1] = s;
707
- }
708
- return n;
709
- }
710
- return t instanceof Et ? t : void 0;
711
- }
712
- function Ps(t, e, n) {
713
- return 2 & e || (!n || 4096 & e || 16 & e ? t = Te(t, e, !1, n && !(16 & e)) : (qe(t, 34), 4 & e && Object.freeze(t))), t;
714
- }
715
- function Sr(t, e, n) {
716
- return t = new t.constructor(e), n && (t.h = Qt), t.m = Qt, t;
717
- }
718
- function Os(t) {
719
- const e = t.v, n = 0 | e[d];
720
- return st(t, n) ? t : Lr(t, e, n) ? Sr(t, e) : Te(e, n);
721
- }
722
- function Te(t, e, n, r) {
723
- return r ?? (r = !!(34 & e)), t = bn(t, e, c2, r), r = 32, n && (r |= 2), V(t, e = 16769217 & e | r), t;
724
- }
725
- function Tr(t) {
726
- const e = t.v, n = 0 | e[d];
727
- return st(t, n) ? Lr(t, e, n) ? Sr(t, e, !0) : new t.constructor(Te(e, n, !1)) : t;
728
- }
729
- function Le(t) {
730
- if (t.h !== Qt) return !1;
731
- var e = t.v;
732
- return qe(e = Te(e, 0 | e[d]), 2048), t.v = e, t.h = void 0, t.m = void 0, !0;
733
- }
734
- function Fe(t) {
735
- if (!Le(t) && st(t, 0 | t.v[d])) throw Error();
736
- }
737
- function ne(t, e) {
738
- e === void 0 && (e = 0 | t[d]), 32 & e && !(4096 & e) && V(t, 4096 | e);
739
- }
740
- function Lr(t, e, n) {
741
- return !!(2 & n) || !(!(32 & n) || 4096 & n) && (V(e, 2 | n), t.h = Qt, !0);
742
- }
743
- const h2 = rt(0), Ct = {};
744
- function L(t, e, n, r, s) {
745
- if ((e = Ot(t.v, e, n, s)) !== null || r && t.m !== Qt) return e;
746
- }
747
- function Ot(t, e, n, r) {
748
- if (e === -1) return null;
749
- const s = e + (n ? 0 : -1), i = t.length - 1;
750
- let o, a;
751
- if (!(i < 1 + (n ? 0 : -1))) {
752
- if (s >= i) if (o = t[i], o != null && typeof o == "object" && o.constructor === Object) n = o[e], a = !0;
753
- else {
754
- if (s !== i) return;
755
- n = o;
756
- }
757
- else n = t[s];
758
- if (r && n != null) {
759
- if ((r = r(n)) == null) return r;
760
- if (!Object.is(r, n)) return a ? o[e] = r : t[s] = r, r;
761
- }
762
- return n;
763
- }
764
- }
765
- function k(t, e, n, r) {
766
- Fe(t), j(t = t.v, 0 | t[d], e, n, r);
767
- }
768
- function j(t, e, n, r, s) {
769
- const i = n + (s ? 0 : -1);
770
- var o = t.length - 1;
771
- if (o >= 1 + (s ? 0 : -1) && i >= o) {
772
- const a = t[o];
773
- if (a != null && typeof a == "object" && a.constructor === Object) return a[n] = r, e;
774
- }
775
- return i <= o ? (t[i] = r, e) : (r !== void 0 && (n >= (o = (e ?? (e = 0 | t[d])) >> 14 & 1023 || 536870912) ? r != null && (t[o + (s ? 0 : -1)] = { [n]: r }) : t[i] = r), e);
776
- }
777
- function Kt() {
778
- return Ra === void 0 ? 2 : 4;
779
- }
780
- function zt(t, e, n, r, s) {
781
- let i = t.v, o = 0 | i[d];
782
- r = st(t, o) ? 1 : r, s = !!s || r === 3, r === 2 && Le(t) && (i = t.v, o = 0 | i[d]);
783
- let a = (t = Fr(i, e)) === ee ? 7 : 0 | t[d], c = Mr(a, o);
784
- var u = !(4 & c);
785
- if (u) {
786
- 4 & c && (t = mt(t), a = 0, c = Yt(c, o), o = j(i, o, e, t));
787
- let h = 0, f = 0;
788
- for (; h < t.length; h++) {
789
- const y = n(t[h]);
790
- y != null && (t[f++] = y);
791
- }
792
- f < h && (t.length = f), n = -513 & (4 | c), c = n &= -1025, c &= -4097;
793
- }
794
- return c !== a && (V(t, c), 2 & c && Object.freeze(t)), ji(t, c, i, o, e, r, u, s);
795
- }
796
- function ji(t, e, n, r, s, i, o, a) {
797
- let c = e;
798
- return i === 1 || i === 4 && (2 & e || !(16 & e) && 32 & r) ? Xt(e) || ((e |= !t.length || o && !(4096 & e) || 32 & r && !(4096 & e || 16 & e) ? 2 : 256) !== c && V(t, e), Object.freeze(t)) : (i === 2 && Xt(e) && (t = mt(t), c = 0, e = Yt(e, r), r = j(n, r, s, t)), Xt(e) || (a || (e |= 16), e !== c && V(t, e))), 2 & e || !(4096 & e || 16 & e) || ne(n, r), t;
799
- }
800
- function Fr(t, e, n) {
801
- return t = Ot(t, e, n), Array.isArray(t) ? t : ee;
802
- }
803
- function Mr(t, e) {
804
- return 2 & e && (t |= 2), 1 | t;
805
- }
806
- function Xt(t) {
807
- return !!(2 & t) && !!(4 & t) || !!(256 & t);
808
- }
809
- function Gi(t) {
810
- return yr(t, !0);
811
- }
812
- function Vi(t) {
813
- t = mt(t);
814
- for (let e = 0; e < t.length; e++) {
815
- const n = t[e] = mt(t[e]);
816
- Array.isArray(n[1]) && (n[1] = Xe(n[1]));
817
- }
818
- return He(t);
819
- }
820
- function Bt(t, e, n, r) {
821
- Fe(t), j(t = t.v, 0 | t[d], e, (r === "0" ? Number(n) === 0 : n === r) ? void 0 : n);
822
- }
823
- function Me(t, e, n) {
824
- if (2 & e) throw Error();
825
- const r = ke(e);
826
- let s = Fr(t, n, r), i = s === ee ? 7 : 0 | s[d], o = Mr(i, e);
827
- return (2 & o || Xt(o) || 16 & o) && (o === i || Xt(o) || V(s, o), s = mt(s), i = 0, o = Yt(o, e), j(t, e, n, s, r)), o &= -13, o !== i && V(s, o), s;
828
- }
829
- function Hn(t, e) {
830
- var n = Co;
831
- return Or(Pr(t = t.v), t, void 0, n) === e ? e : -1;
832
- }
833
- function Pr(t) {
834
- if (Ee) return t[Ce] ?? (t[Ce] = /* @__PURE__ */ new Map());
835
- if (Ce in t) return t[Ce];
836
- const e = /* @__PURE__ */ new Map();
837
- return Object.defineProperty(t, Ce, { value: e }), e;
838
- }
839
- function Hi(t, e, n, r, s) {
840
- const i = Pr(t), o = Or(i, t, e, n, s);
841
- return o !== r && (o && (e = j(t, e, o, void 0, s)), i.set(n, r)), e;
842
- }
843
- function Or(t, e, n, r, s) {
844
- let i = t.get(r);
845
- if (i != null) return i;
846
- i = 0;
847
- for (let o = 0; o < r.length; o++) {
848
- const a = r[o];
849
- Ot(e, a, s) != null && (i !== 0 && (n = j(e, n, i, void 0, s)), i = a);
850
- }
851
- return t.set(r, i), i;
852
- }
853
- function xr(t, e, n) {
854
- let r = 0 | t[d];
855
- const s = ke(r), i = Ot(t, n, s);
856
- let o;
857
- if (i != null && i[de] === pe) {
858
- if (!st(i)) return Le(i), i.v;
859
- o = i.v;
860
- } else Array.isArray(i) && (o = i);
861
- if (o) {
862
- const a = 0 | o[d];
863
- 2 & a && (o = Te(o, a));
864
- }
865
- return o = qt(o, e), o !== i && j(t, r, n, o, s), o;
866
- }
867
- function Wi(t, e, n, r, s) {
868
- let i = !1;
869
- if ((r = Ot(t, r, s, (o) => {
870
- const a = kr(o, n, !1, e);
871
- return i = a !== o && a != null, a;
872
- })) != null) return i && !st(r) && ne(t, e), r;
873
- }
874
- function A(t, e, n, r) {
875
- let s = t.v, i = 0 | s[d];
876
- if ((e = Wi(s, i, e, n, r)) == null) return e;
877
- if (i = 0 | s[d], !st(t, i)) {
878
- const o = Tr(e);
879
- o !== e && (Le(t) && (s = t.v, i = 0 | s[d]), i = j(s, i, n, e = o, r), ne(s, i));
880
- }
881
- return e;
882
- }
883
- function Ki(t, e, n, r, s, i, o, a) {
884
- var c = st(t, n);
885
- i = c ? 1 : i, o = !!o || i === 3, c = a && !c, (i === 2 || c) && Le(t) && (n = 0 | (e = t.v)[d]);
886
- var u = (t = Fr(e, s)) === ee ? 7 : 0 | t[d], h = Mr(u, n);
887
- if (a = !(4 & h)) {
888
- var f = t, y = n;
889
- const v = !!(2 & h);
890
- v && (y |= 2);
891
- let x = !v, Dn = !0, se = 0, Ne = 0;
892
- for (; se < f.length; se++) {
893
- const Un = kr(f[se], r, !1, y);
894
- if (Un instanceof r) {
895
- if (!v) {
896
- const us = st(Un);
897
- x && (x = !us), Dn && (Dn = us);
898
- }
899
- f[Ne++] = Un;
900
- }
901
- }
902
- Ne < se && (f.length = Ne), h |= 4, h = Dn ? -4097 & h : 4096 | h, h = x ? 8 | h : -9 & h;
903
- }
904
- if (h !== u && (V(t, h), 2 & h && Object.freeze(t)), c && !(8 & h || !t.length && (i === 1 || i === 4 && (2 & h || !(16 & h) && 32 & n)))) {
905
- for (Xt(h) && (t = mt(t), h = Yt(h, n), n = j(e, n, s, t)), r = t, c = h, u = 0; u < r.length; u++) (f = r[u]) !== (h = Tr(f)) && (r[u] = h);
906
- c |= 8, V(t, h = c = r.length ? 4096 | c : -4097 & c);
907
- }
908
- return ji(t, h, e, n, s, i, a, o);
909
- }
910
- function xt(t, e, n) {
911
- const r = t.v;
912
- return Ki(t, r, 0 | r[d], e, n, Kt(), !1, !0);
913
- }
914
- function zi(t) {
915
- return t == null && (t = void 0), t;
916
- }
917
- function _(t, e, n, r, s) {
918
- return k(t, n, r = zi(r), s), r && !st(r) && ne(t.v), t;
919
- }
920
- function Ue(t, e, n, r) {
921
- t: {
922
- var s = r = zi(r);
923
- Fe(t);
924
- const i = t.v;
925
- let o = 0 | i[d];
926
- if (s == null) {
927
- const a = Pr(i);
928
- if (Or(a, i, o, n) !== e) break t;
929
- a.set(n, 0);
930
- } else o = Hi(i, o, n, e);
931
- j(i, o, e, s);
932
- }
933
- r && !st(r) && ne(t.v);
934
- }
935
- function Yt(t, e) {
936
- return -273 & (2 & e ? 2 | t : -3 & t);
937
- }
938
- function Ir(t, e, n, r) {
939
- var s = r;
940
- Fe(t), t = Ki(t, r = t.v, 0 | r[d], n, e, 2, !0), s = s ?? new n(), t.push(s), e = n = t === ee ? 7 : 0 | t[d], (s = st(s)) ? (n &= -9, t.length === 1 && (n &= -4097)) : n |= 4096, n !== e && V(t, n), s || ne(r);
941
- }
942
- function dt(t, e, n) {
943
- return Se(L(t, e, void 0, n));
944
- }
945
- function qi(t) {
946
- return (gr ? L(t, 2, void 0, void 0, cn) : cn(L(t, 2))) ?? h2;
947
- }
948
- function C(t, e) {
949
- return L(t, e, void 0, void 0, At) ?? 0;
950
- }
951
- function It(t, e, n) {
952
- if (n != null) {
953
- if (typeof n != "number" || !vn(n)) throw $n("int32");
954
- n |= 0;
955
- }
956
- k(t, e, n);
957
- }
958
- function m(t, e, n) {
959
- k(t, e, De(n));
960
- }
961
- function it(t, e, n) {
962
- Bt(t, e, Je(n), "");
963
- }
964
- function un(t, e, n) {
965
- {
966
- Fe(t);
967
- const o = t.v;
968
- let a = 0 | o[d];
969
- if (n == null) j(o, a, e);
970
- else {
971
- var r = t = n === ee ? 7 : 0 | n[d], s = Xt(t), i = s || Object.isFrozen(n);
972
- for (s || (t = 0), i || (n = mt(n), r = 0, t = Yt(t, a), i = !1), t |= 5, t |= (4 & t ? 512 & t ? 512 : 1024 & t ? 1024 : 0 : void 0) ?? (gr ? 1024 : 0), s = 0; s < n.length; s++) {
973
- const c = n[s], u = Bi(c);
974
- Object.is(c, u) || (i && (n = mt(n), r = 0, t = Yt(t, a), i = !1), n[s] = u);
975
- }
976
- t !== r && (i && (n = mt(n), t = Yt(t, a)), V(n, t)), j(o, a, e, n);
977
- }
978
- }
979
- }
980
- function An(t, e, n) {
981
- Fe(t), zt(t, e, q, 2, !0).push(Bi(n));
982
- }
983
- var ie = class {
984
- constructor(t, e, n) {
985
- if (this.buffer = t, n && !e) throw Error();
986
- this.g = e;
987
- }
988
- };
989
- function Nr(t, e) {
990
- if (typeof t == "string") return new ie(Ei(t), e);
991
- if (Array.isArray(t)) return new ie(new Uint8Array(t), e);
992
- if (t.constructor === Uint8Array) return new ie(t, !1);
993
- if (t.constructor === ArrayBuffer) return t = new Uint8Array(t), new ie(t, !1);
994
- if (t.constructor === Et) return e = _r(t) || new Uint8Array(0), new ie(e, !0, t);
995
- if (t instanceof Uint8Array) return t = t.constructor === Uint8Array ? t : new Uint8Array(t.buffer, t.byteOffset, t.byteLength), new ie(t, !1);
996
- throw Error();
997
- }
998
- function _e(t, e) {
999
- let n, r = 0, s = 0, i = 0;
1000
- const o = t.h;
1001
- let a = t.g;
1002
- do
1003
- n = o[a++], r |= (127 & n) << i, i += 7;
1004
- while (i < 32 && 128 & n);
1005
- if (i > 32) for (s |= (127 & n) >> 4, i = 3; i < 32 && 128 & n; i += 7) n = o[a++], s |= (127 & n) << i;
1006
- if ($t(t, a), !(128 & n)) return e(r >>> 0, s >>> 0);
1007
- throw Error();
1008
- }
1009
- function Cr(t) {
1010
- let e = 0, n = t.g;
1011
- const r = n + 10, s = t.h;
1012
- for (; n < r; ) {
1013
- const i = s[n++];
1014
- if (e |= i, (128 & i) == 0) return $t(t, n), !!(127 & e);
1015
- }
1016
- throw Error();
1017
- }
1018
- function jt(t) {
1019
- const e = t.h;
1020
- let n = t.g, r = e[n++], s = 127 & r;
1021
- if (128 & r && (r = e[n++], s |= (127 & r) << 7, 128 & r && (r = e[n++], s |= (127 & r) << 14, 128 & r && (r = e[n++], s |= (127 & r) << 21, 128 & r && (r = e[n++], s |= r << 28, 128 & r && 128 & e[n++] && 128 & e[n++] && 128 & e[n++] && 128 & e[n++] && 128 & e[n++]))))) throw Error();
1022
- return $t(t, n), s;
1023
- }
1024
- function Nt(t) {
1025
- return jt(t) >>> 0;
1026
- }
1027
- function ln(t) {
1028
- var e = t.h;
1029
- const n = t.g;
1030
- var r = e[n], s = e[n + 1];
1031
- const i = e[n + 2];
1032
- return e = e[n + 3], $t(t, t.g + 4), t = 2 * ((s = (r << 0 | s << 8 | i << 16 | e << 24) >>> 0) >> 31) + 1, r = s >>> 23 & 255, s &= 8388607, r == 255 ? s ? NaN : t * (1 / 0) : r == 0 ? 1401298464324817e-60 * t * s : t * Math.pow(2, r - 150) * (s + 8388608);
1033
- }
1034
- function u2(t) {
1035
- return jt(t);
1036
- }
1037
- function $t(t, e) {
1038
- if (t.g = e, e > t.l) throw Error();
1039
- }
1040
- function Xi(t, e) {
1041
- if (e < 0) throw Error();
1042
- const n = t.g;
1043
- if ((e = n + e) > t.l) throw Error();
1044
- return t.g = e, n;
1045
- }
1046
- function Yi(t, e) {
1047
- if (e == 0) return Zt();
1048
- var n = Xi(t, e);
1049
- return t.Y && t.j ? n = t.h.subarray(n, n + e) : (t = t.h, n = n === (e = n + e) ? new Uint8Array(0) : Ha ? t.slice(n, e) : new Uint8Array(t.subarray(n, e))), n.length == 0 ? Zt() : new Et(n, le);
1050
- }
1051
- var xs = [];
1052
- function $i(t, e, n, r) {
1053
- if (fn.length) {
1054
- const s = fn.pop();
1055
- return s.o(r), s.g.init(t, e, n, r), s;
1056
- }
1057
- return new l2(t, e, n, r);
1058
- }
1059
- function Ji(t) {
1060
- t.g.clear(), t.l = -1, t.h = -1, fn.length < 100 && fn.push(t);
1061
- }
1062
- function Zi(t) {
1063
- var e = t.g;
1064
- if (e.g == e.l) return !1;
1065
- t.m = t.g.g;
1066
- var n = Nt(t.g);
1067
- if (e = n >>> 3, !((n &= 7) >= 0 && n <= 5) || e < 1) throw Error();
1068
- return t.l = e, t.h = n, !0;
1069
- }
1070
- function on(t) {
1071
- switch (t.h) {
1072
- case 0:
1073
- t.h != 0 ? on(t) : Cr(t.g);
1074
- break;
1075
- case 1:
1076
- $t(t = t.g, t.g + 8);
1077
- break;
1078
- case 2:
1079
- if (t.h != 2) on(t);
1080
- else {
1081
- var e = Nt(t.g);
1082
- $t(t = t.g, t.g + e);
1083
- }
1084
- break;
1085
- case 5:
1086
- $t(t = t.g, t.g + 4);
1087
- break;
1088
- case 3:
1089
- for (e = t.l; ; ) {
1090
- if (!Zi(t)) throw Error();
1091
- if (t.h == 4) {
1092
- if (t.l != e) throw Error();
1093
- break;
1094
- }
1095
- on(t);
1096
- }
1097
- break;
1098
- default:
1099
- throw Error();
1100
- }
1101
- }
1102
- function Ze(t, e, n) {
1103
- const r = t.g.l;
1104
- var s = Nt(t.g);
1105
- let i = (s = t.g.g + s) - r;
1106
- if (i <= 0 && (t.g.l = s, n(e, t, void 0, void 0, void 0), i = s - t.g.g), i) throw Error();
1107
- return t.g.g = s, t.g.l = r, e;
1108
- }
1109
- function Rr(t) {
1110
- var e = Nt(t.g), n = Xi(t = t.g, e);
1111
- if (t = t.h, Aa) {
1112
- var r, s = t;
1113
- (r = jn) || (r = jn = new TextDecoder("utf-8", { fatal: !0 })), e = n + e, s = n === 0 && e === s.length ? s : s.subarray(n, e);
1114
- try {
1115
- var i = r.decode(s);
1116
- } catch (a) {
1117
- if (en === void 0) {
1118
- try {
1119
- r.decode(new Uint8Array([128]));
1120
- } catch {
1121
- }
1122
- try {
1123
- r.decode(new Uint8Array([97])), en = !0;
1124
- } catch {
1125
- en = !1;
1126
- }
1127
- }
1128
- throw !en && (jn = void 0), a;
1129
- }
1130
- } else {
1131
- e = (i = n) + e, n = [];
1132
- let a, c = null;
1133
- for (; i < e; ) {
1134
- var o = t[i++];
1135
- o < 128 ? n.push(o) : o < 224 ? i >= e ? Ht() : (a = t[i++], o < 194 || (192 & a) != 128 ? (i--, Ht()) : n.push((31 & o) << 6 | 63 & a)) : o < 240 ? i >= e - 1 ? Ht() : (a = t[i++], (192 & a) != 128 || o === 224 && a < 160 || o === 237 && a >= 160 || (192 & (r = t[i++])) != 128 ? (i--, Ht()) : n.push((15 & o) << 12 | (63 & a) << 6 | 63 & r)) : o <= 244 ? i >= e - 2 ? Ht() : (a = t[i++], (192 & a) != 128 || a - 144 + (o << 28) >> 30 || (192 & (r = t[i++])) != 128 || (192 & (s = t[i++])) != 128 ? (i--, Ht()) : (o = (7 & o) << 18 | (63 & a) << 12 | (63 & r) << 6 | 63 & s, o -= 65536, n.push(55296 + (o >> 10 & 1023), 56320 + (1023 & o)))) : Ht(), n.length >= 8192 && (c = gs(c, n), n.length = 0);
1136
- }
1137
- i = gs(c, n);
1138
- }
1139
- return i;
1140
- }
1141
- function Qi(t) {
1142
- const e = Nt(t.g);
1143
- return Yi(t.g, e);
1144
- }
1145
- function En(t, e, n) {
1146
- var r = Nt(t.g);
1147
- for (r = t.g.g + r; t.g.g < r; ) n.push(e(t.g));
1148
- }
1149
- var l2 = class {
1150
- constructor(t, e, n, r) {
1151
- if (xs.length) {
1152
- const s = xs.pop();
1153
- s.init(t, e, n, r), t = s;
1154
- } else t = new class {
1155
- constructor(s, i, o, a) {
1156
- this.h = null, this.j = !1, this.g = this.l = this.m = 0, this.init(s, i, o, a);
1157
- }
1158
- init(s, i, o, { Y: a = !1, ea: c = !1 } = {}) {
1159
- this.Y = a, this.ea = c, s && (s = Nr(s, this.ea), this.h = s.buffer, this.j = s.g, this.m = i || 0, this.l = o !== void 0 ? this.m + o : this.h.length, this.g = this.m);
1160
- }
1161
- clear() {
1162
- this.h = null, this.j = !1, this.g = this.l = this.m = 0, this.Y = !1;
1163
- }
1164
- }(t, e, n, r);
1165
- this.g = t, this.m = this.g.g, this.h = this.l = -1, this.o(r);
1166
- }
1167
- o({ ha: t = !1 } = {}) {
1168
- this.ha = t;
1169
- }
1170
- }, fn = [];
1171
- function Is(t) {
1172
- return t ? /^\d+$/.test(t) ? (yn(t), new er(P, B)) : null : f2 || (f2 = new er(0, 0));
1173
- }
1174
- var er = class {
1175
- constructor(t, e) {
1176
- this.h = t >>> 0, this.g = e >>> 0;
1177
- }
1178
- };
1179
- let f2;
1180
- function Ns(t) {
1181
- return t ? /^-?\d+$/.test(t) ? (yn(t), new nr(P, B)) : null : d2 || (d2 = new nr(0, 0));
1182
- }
1183
- var nr = class {
1184
- constructor(t, e) {
1185
- this.h = t >>> 0, this.g = e >>> 0;
1186
- }
1187
- };
1188
- let d2;
1189
- function ce(t, e, n) {
1190
- for (; n > 0 || e > 127; ) t.g.push(127 & e | 128), e = (e >>> 7 | n << 25) >>> 0, n >>>= 7;
1191
- t.g.push(e);
1192
- }
1193
- function Pe(t, e) {
1194
- for (; e > 127; ) t.g.push(127 & e | 128), e >>>= 7;
1195
- t.g.push(e);
1196
- }
1197
- function kn(t, e) {
1198
- if (e >= 0) Pe(t, e);
1199
- else {
1200
- for (let n = 0; n < 9; n++) t.g.push(127 & e | 128), e >>= 7;
1201
- t.g.push(1);
1202
- }
1203
- }
1204
- function Br(t) {
1205
- var e = P;
1206
- t.g.push(e >>> 0 & 255), t.g.push(e >>> 8 & 255), t.g.push(e >>> 16 & 255), t.g.push(e >>> 24 & 255);
1207
- }
1208
- function ye(t, e) {
1209
- e.length !== 0 && (t.l.push(e), t.h += e.length);
1210
- }
1211
- function pt(t, e, n) {
1212
- Pe(t.g, 8 * e + n);
1213
- }
1214
- function Dr(t, e) {
1215
- return pt(t, e, 2), e = t.g.end(), ye(t, e), e.push(t.h), e;
1216
- }
1217
- function Ur(t, e) {
1218
- var n = e.pop();
1219
- for (n = t.h + t.g.length() - n; n > 127; ) e.push(127 & n | 128), n >>>= 7, t.h++;
1220
- e.push(n), t.h++;
1221
- }
1222
- function Sn(t, e, n) {
1223
- pt(t, e, 2), Pe(t.g, n.length), ye(t, t.g.end()), ye(t, n);
1224
- }
1225
- function dn(t, e, n, r) {
1226
- n != null && (e = Dr(t, e), r(n, t), Ur(t, e));
1227
- }
1228
- function St() {
1229
- const t = class {
1230
- constructor() {
1231
- throw Error();
1232
- }
1233
- };
1234
- return Object.setPrototypeOf(t, t.prototype), t;
1235
- }
1236
- var jr = St(), to = St(), Gr = St(), Vr = St(), eo = St(), no = St(), p2 = St(), Tn = St(), ro = St(), so = St();
1237
- function Tt(t, e, n) {
1238
- var r = t.v;
1239
- nt && nt in r && (r = r[nt]) && delete r[e.g], e.h ? e.j(t, e.h, e.g, n, e.l) : e.j(t, e.g, n, e.l);
1240
- }
1241
- var p = class {
1242
- constructor(t, e) {
1243
- this.v = Ui(t, e, void 0, 2048);
1244
- }
1245
- toJSON() {
1246
- return Di(this);
1247
- }
1248
- j() {
1249
- var s;
1250
- var t = $2, e = this.v, n = t.g, r = nt;
1251
- if (Ee && r && ((s = e[r]) == null ? void 0 : s[n]) != null && fe(Ia, 3), e = t.g, bs && nt && bs === void 0 && (r = (n = this.v)[nt]) && (r = r.da)) try {
1252
- r(n, e, r2);
1253
- } catch (i) {
1254
- vi(i);
1255
- }
1256
- return t.h ? t.m(this, t.h, t.g, t.l) : t.m(this, t.g, t.defaultValue, t.l);
1257
- }
1258
- clone() {
1259
- const t = this.v, e = 0 | t[d];
1260
- return Lr(this, t, e) ? Sr(this, t, !0) : new this.constructor(Te(t, e, !1));
1261
- }
1262
- };
1263
- p.prototype[de] = pe, p.prototype.toString = function() {
1264
- return this.v.toString();
1265
- };
1266
- var Oe = class {
1267
- constructor(t, e, n) {
1268
- this.g = t, this.h = e, t = jr, this.l = !!t && n === t || !1;
1269
- }
1270
- };
1271
- function Ln(t, e) {
1272
- return new Oe(t, e, jr);
1273
- }
1274
- function io(t, e, n, r, s) {
1275
- dn(t, n, ho(e, r), s);
1276
- }
1277
- const g2 = Ln(function(t, e, n, r, s) {
1278
- return t.h === 2 && (Ze(t, xr(e, r, n), s), !0);
1279
- }, io), m2 = Ln(function(t, e, n, r, s) {
1280
- return t.h === 2 && (Ze(t, xr(e, r, n), s), !0);
1281
- }, io);
1282
- var Fn = Symbol(), Mn = Symbol(), rr = Symbol(), Cs = Symbol(), Rs = Symbol();
1283
- let oo, ao;
1284
- function re(t, e, n, r) {
1285
- var s = r[t];
1286
- if (s) return s;
1287
- (s = {}).qa = r, s.T = function(f) {
1288
- switch (typeof f) {
1289
- case "boolean":
1290
- return o2 || (o2 = [0, void 0, !0]);
1291
- case "number":
1292
- return f > 0 ? void 0 : f === 0 ? a2 || (a2 = [0, void 0]) : [-f, void 0];
1293
- case "string":
1294
- return [0, f];
1295
- case "object":
1296
- return f;
1297
- }
1298
- }(r[0]);
1299
- var i = r[1];
1300
- let o = 1;
1301
- i && i.constructor === Object && (s.ba = i, typeof (i = r[++o]) == "function" && (s.ma = !0, oo ?? (oo = i), ao ?? (ao = r[o + 1]), i = r[o += 2]));
1302
- const a = {};
1303
- for (; i && Array.isArray(i) && i.length && typeof i[0] == "number" && i[0] > 0; ) {
1304
- for (var c = 0; c < i.length; c++) a[i[c]] = i;
1305
- i = r[++o];
1306
- }
1307
- for (c = 1; i !== void 0; ) {
1308
- let f;
1309
- typeof i == "number" && (c += i, i = r[++o]);
1310
- var u = void 0;
1311
- if (i instanceof Oe ? f = i : (f = g2, o--), f == null ? void 0 : f.l) {
1312
- i = r[++o], u = r;
1313
- var h = o;
1314
- typeof i == "function" && (i = i(), u[h] = i), u = i;
1315
- }
1316
- for (h = c + 1, typeof (i = r[++o]) == "number" && i < 0 && (h -= i, i = r[++o]); c < h; c++) {
1317
- const y = a[c];
1318
- u ? n(s, c, f, u, y) : e(s, c, f, y);
1319
- }
1320
- }
1321
- return r[t] = s;
1322
- }
1323
- function co(t) {
1324
- return Array.isArray(t) ? t[0] instanceof Oe ? t : [m2, t] : [t, void 0];
1325
- }
1326
- function ho(t, e) {
1327
- return t instanceof p ? t.v : Array.isArray(t) ? qt(t, e) : void 0;
1328
- }
1329
- function Hr(t, e, n, r) {
1330
- const s = n.g;
1331
- t[e] = r ? (i, o, a) => s(i, o, a, r) : s;
1332
- }
1333
- function Wr(t, e, n, r, s) {
1334
- const i = n.g;
1335
- let o, a;
1336
- t[e] = (c, u, h) => i(c, u, h, a || (a = re(Mn, Hr, Wr, r).T), o || (o = Kr(r)), s);
1337
- }
1338
- function Kr(t) {
1339
- let e = t[rr];
1340
- if (e != null) return e;
1341
- const n = re(Mn, Hr, Wr, t);
1342
- return e = n.ma ? (r, s) => oo(r, s, n) : (r, s) => {
1343
- for (; Zi(s) && s.h != 4; ) {
1344
- var i = s.l, o = n[i];
1345
- if (o == null) {
1346
- var a = n.ba;
1347
- a && (a = a[i]) && (a = y2(a)) != null && (o = n[i] = a);
1348
- }
1349
- if (o == null || !o(s, r, i)) {
1350
- if (o = (a = s).m, on(a), a.ha) var c = void 0;
1351
- else c = a.g.g - o, a.g.g = o, c = Yi(a.g, c);
1352
- o = void 0, a = r, c && ((o = a[nt] ?? (a[nt] = new tr()))[i] ?? (o[i] = [])).push(c);
1353
- }
1354
- }
1355
- return (r = wn(r)) && (r.da = n.qa[Rs]), !0;
1356
- }, t[rr] = e, t[Rs] = _2.bind(t), e;
1357
- }
1358
- function _2(t, e, n, r) {
1359
- var s = this[Mn];
1360
- const i = this[rr], o = qt(void 0, s.T), a = wn(t);
1361
- if (a) {
1362
- var c = !1, u = s.ba;
1363
- if (u) {
1364
- if (s = (h, f, y) => {
1365
- if (y.length !== 0) if (u[f]) for (const v of y) {
1366
- h = $i(v);
1367
- try {
1368
- c = !0, i(o, h);
1369
- } finally {
1370
- Ji(h);
1371
- }
1372
- }
1373
- else r == null || r(t, f, y);
1374
- }, e == null) hn(a, s);
1375
- else if (a != null) {
1376
- const h = a[e];
1377
- h && s(a, e, h);
1378
- }
1379
- if (c) {
1380
- let h = 0 | t[d];
1381
- if (2 & h && 2048 & h && !(n != null && n.Ka)) throw Error();
1382
- const f = ke(h), y = (v, x) => {
1383
- if (Ot(t, v, f) != null) {
1384
- if ((n == null ? void 0 : n.Qa) === 1) return;
1385
- throw Error();
1386
- }
1387
- x != null && (h = j(t, h, v, x, f)), delete a[v];
1388
- };
1389
- e == null ? Fi(o, 0 | o[d], (v, x) => {
1390
- y(v, x);
1391
- }) : y(e, Ot(o, e, f));
1392
- }
1393
- }
1394
- }
1395
- }
1396
- function y2(t) {
1397
- const e = (t = co(t))[0].g;
1398
- if (t = t[1]) {
1399
- const n = Kr(t), r = re(Mn, Hr, Wr, t).T;
1400
- return (s, i, o) => e(s, i, o, r, n);
1401
- }
1402
- return e;
1403
- }
1404
- function Pn(t, e, n) {
1405
- t[e] = n.h;
1406
- }
1407
- function On(t, e, n, r) {
1408
- let s, i;
1409
- const o = n.h;
1410
- t[e] = (a, c, u) => o(a, c, u, i || (i = re(Fn, Pn, On, r).T), s || (s = uo(r)));
1411
- }
1412
- function uo(t) {
1413
- let e = t[Cs];
1414
- if (!e) {
1415
- const n = re(Fn, Pn, On, t);
1416
- e = (r, s) => lo(r, s, n), t[Cs] = e;
1417
- }
1418
- return e;
1419
- }
1420
- function lo(t, e, n) {
1421
- Fi(t, 0 | t[d], (r, s) => {
1422
- if (s != null) {
1423
- var i = function(o, a) {
1424
- var c = o[a];
1425
- if (c) return c;
1426
- if ((c = o.ba) && (c = c[a])) {
1427
- var u = (c = co(c))[0].h;
1428
- if (c = c[1]) {
1429
- const h = uo(c), f = re(Fn, Pn, On, c).T;
1430
- c = o.ma ? ao(f, h) : (y, v, x) => u(y, v, x, f, h);
1431
- } else c = u;
1432
- return o[a] = c;
1433
- }
1434
- }(n, r);
1435
- i ? i(e, s, r) : r < 500 || fe(Jn, 3);
1436
- }
1437
- }), (t = wn(t)) && hn(t, (r, s, i) => {
1438
- for (ye(e, e.g.end()), r = 0; r < i.length; r++) ye(e, _r(i[r]) || new Uint8Array(0));
1439
- });
1440
- }
1441
- const v2 = rt(0);
1442
- function xe(t, e) {
1443
- if (Array.isArray(e)) {
1444
- var n = 0 | e[d];
1445
- if (4 & n) return e;
1446
- for (var r = 0, s = 0; r < e.length; r++) {
1447
- const i = t(e[r]);
1448
- i != null && (e[s++] = i);
1449
- }
1450
- return s < r && (e.length = s), (t = -1537 & (5 | n)) !== n && V(e, t), 2 & t && Object.freeze(e), e;
1451
- }
1452
- }
1453
- function Y(t, e, n) {
1454
- return new Oe(t, e, n);
1455
- }
1456
- function Ie(t, e, n) {
1457
- return new Oe(t, e, n);
1458
- }
1459
- function z(t, e, n) {
1460
- j(t, 0 | t[d], e, n, ke(0 | t[d]));
1461
- }
1462
- var w2 = Ln(function(t, e, n, r, s) {
1463
- if (t.h !== 2) return !1;
1464
- if (t = mt(t = Ze(t, qt([void 0, void 0], r), s)), s = ke(r = 0 | e[d]), 2 & r) throw Error();
1465
- let i = Ot(e, n, s);
1466
- if (i instanceof Pt) 2 & i.J ? (i = i.V(), i.push(t), j(e, r, n, i, s)) : i.Ma(t);
1467
- else if (Array.isArray(i)) {
1468
- var o = 0 | i[d];
1469
- 8192 & o || V(i, o |= 8192), 2 & o && (i = Vi(i), j(e, r, n, i, s)), i.push(t);
1470
- } else j(e, r, n, He([t]), s);
1471
- return !0;
1472
- }, function(t, e, n, r, s) {
1473
- if (e instanceof Pt) e.forEach((i, o) => {
1474
- dn(t, n, qt([o, i], r), s);
1475
- });
1476
- else if (Array.isArray(e)) {
1477
- for (let i = 0; i < e.length; i++) {
1478
- const o = e[i];
1479
- Array.isArray(o) && dn(t, n, qt(o, r), s);
1480
- }
1481
- He(e);
1482
- }
1483
- });
1484
- function fo(t, e, n) {
1485
- (e = At(e)) != null && (pt(t, n, 5), t = t.g, vr(e), Br(t));
1486
- }
1487
- function po(t, e, n) {
1488
- if (e = function(r) {
1489
- if (r == null) return r;
1490
- const s = typeof r;
1491
- if (s === "bigint") return String(Ye(64, r));
1492
- if ($e(r)) {
1493
- if (s === "string") return Ni(r);
1494
- if (s === "number") return Er(r);
1495
- }
1496
- }(e), e != null && (typeof e == "string" && Ns(e), e != null))
1497
- switch (pt(t, n, 0), typeof e) {
1498
- case "number":
1499
- t = t.g, ge(e), ce(t, P, B);
1500
- break;
1501
- case "bigint":
1502
- n = BigInt.asUintN(64, e), n = new nr(Number(n & BigInt(4294967295)), Number(n >> BigInt(32))), ce(t.g, n.h, n.g);
1503
- break;
1504
- default:
1505
- n = Ns(e), ce(t.g, n.h, n.g);
1506
- }
1507
- }
1508
- function go(t, e, n) {
1509
- (e = Se(e)) != null && e != null && (pt(t, n, 0), kn(t.g, e));
1510
- }
1511
- function mo(t, e, n) {
1512
- (e = Oi(e)) != null && (pt(t, n, 0), t.g.g.push(e ? 1 : 0));
1513
- }
1514
- function _o(t, e, n) {
1515
- (e = q(e)) != null && Sn(t, n, yi(e));
1516
- }
1517
- function yo(t, e, n, r, s) {
1518
- dn(t, n, ho(e, r), s);
1519
- }
1520
- function vo(t, e, n) {
1521
- (e = e == null || typeof e == "string" || e instanceof Et ? e : void 0) != null && Sn(t, n, Nr(e, !0).buffer);
1522
- }
1523
- function wo(t, e, n) {
1524
- return (t.h === 5 || t.h === 2) && (e = Me(e, 0 | e[d], n), t.h == 2 ? En(t, ln, e) : e.push(ln(t.g)), !0);
1525
- }
1526
- var D = Y(function(t, e, n) {
1527
- return t.h === 5 && (z(e, n, ln(t.g)), !0);
1528
- }, fo, Tn), b2 = Ie(wo, function(t, e, n) {
1529
- if ((e = xe(At, e)) != null) for (let o = 0; o < e.length; o++) {
1530
- var r = t, s = n, i = e[o];
1531
- i != null && (pt(r, s, 5), r = r.g, vr(i), Br(r));
1532
- }
1533
- }, Tn), zr = Ie(wo, function(t, e, n) {
1534
- if ((e = xe(At, e)) != null && e.length) {
1535
- pt(t, n, 2), Pe(t.g, 4 * e.length);
1536
- for (let r = 0; r < e.length; r++) n = t.g, vr(e[r]), Br(n);
1537
- }
1538
- }, Tn), A2 = Y(function(t, e, n) {
1539
- return t.h === 5 && (z(e, n, (t = ln(t.g)) === 0 ? void 0 : t), !0);
1540
- }, fo, Tn), Gt = Y(function(t, e, n) {
1541
- return pr ? (t.h !== 0 ? t = !1 : (z(e, n, _e(t.g, Pi)), t = !0), t) : t.h === 0 && (z(e, n, _e(t.g, wr)), !0);
1542
- }, po, no), Wn = Y(function(t, e, n) {
1543
- return pr ? (t.h !== 0 ? e = !1 : (z(e, n, (t = _e(t.g, Pi)) === v2 ? void 0 : t), e = !0), e) : t.h === 0 && (z(e, n, (t = _e(t.g, wr)) === 0 ? void 0 : t), !0);
1544
- }, po, no), E2 = Y(function(t, e, n) {
1545
- return pr ? (t.h !== 0 ? t = !1 : (z(e, n, _e(t.g, Ka)), t = !0), t) : t.h === 0 && (z(e, n, _e(t.g, Qn)), !0);
1546
- }, function(t, e, n) {
1547
- if (e = function(r) {
1548
- if (r == null) return r;
1549
- var s = typeof r;
1550
- if (s === "bigint") return String(za(64, r));
1551
- if ($e(r)) {
1552
- if (s === "string") return s = me(Number(r)), te(s) && s >= 0 ? r = String(s) : ((s = r.indexOf(".")) !== -1 && (r = r.substring(0, s)), (s = r[0] !== "-" && ((s = r.length) < 20 || s === 20 && r <= "18446744073709551615")) || (yn(r), r = We(P, B))), r;
1553
- if (s === "number") return (r = me(r)) >= 0 && te(r) || (ge(r), r = Qn(P, B)), r;
1554
- }
1555
- }(e), e != null && (typeof e == "string" && Is(e), e != null))
1556
- switch (pt(t, n, 0), typeof e) {
1557
- case "number":
1558
- t = t.g, ge(e), ce(t, P, B);
1559
- break;
1560
- case "bigint":
1561
- n = BigInt.asUintN(64, e), n = new er(Number(n & BigInt(4294967295)), Number(n >> BigInt(32))), ce(t.g, n.h, n.g);
1562
- break;
1563
- default:
1564
- n = Is(e), ce(t.g, n.h, n.g);
1565
- }
1566
- }, p2), K = Y(function(t, e, n) {
1567
- return t.h === 0 && (z(e, n, jt(t.g)), !0);
1568
- }, go, Vr), Qe = Ie(function(t, e, n) {
1569
- return (t.h === 0 || t.h === 2) && (e = Me(e, 0 | e[d], n), t.h == 2 ? En(t, jt, e) : e.push(jt(t.g)), !0);
1570
- }, function(t, e, n) {
1571
- if ((e = xe(Se, e)) != null && e.length) {
1572
- n = Dr(t, n);
1573
- for (let r = 0; r < e.length; r++) kn(t.g, e[r]);
1574
- Ur(t, n);
1575
- }
1576
- }, Vr), ae = Y(function(t, e, n) {
1577
- return t.h === 0 && (z(e, n, (t = jt(t.g)) === 0 ? void 0 : t), !0);
1578
- }, go, Vr), R = Y(function(t, e, n) {
1579
- return t.h === 0 && (z(e, n, Cr(t.g)), !0);
1580
- }, mo, to), Jt = Y(function(t, e, n) {
1581
- return t.h === 0 && (z(e, n, (t = Cr(t.g)) === !1 ? void 0 : t), !0);
1582
- }, mo, to), X = Ie(function(t, e, n) {
1583
- return t.h === 2 && (t = Rr(t), Me(e, 0 | e[d], n).push(t), !0);
1584
- }, function(t, e, n) {
1585
- if ((e = xe(q, e)) != null) for (let o = 0; o < e.length; o++) {
1586
- var r = t, s = n, i = e[o];
1587
- i != null && Sn(r, s, yi(i));
1588
- }
1589
- }, Gr), Dt = Y(function(t, e, n) {
1590
- return t.h === 2 && (z(e, n, (t = Rr(t)) === "" ? void 0 : t), !0);
1591
- }, _o, Gr), S = Y(function(t, e, n) {
1592
- return t.h === 2 && (z(e, n, Rr(t)), !0);
1593
- }, _o, Gr), W = function(t, e, n = jr) {
1594
- return new Oe(t, e, n);
1595
- }(function(t, e, n, r, s) {
1596
- return t.h === 2 && (r = qt(void 0, r), Me(e, 0 | e[d], n).push(r), Ze(t, r, s), !0);
1597
- }, function(t, e, n, r, s) {
1598
- if (Array.isArray(e)) {
1599
- for (let i = 0; i < e.length; i++) yo(t, e[i], n, r, s);
1600
- 1 & (t = 0 | e[d]) || V(e, 1 | t);
1601
- }
1602
- }), N = Ln(function(t, e, n, r, s, i) {
1603
- if (t.h !== 2) return !1;
1604
- let o = 0 | e[d];
1605
- return Hi(e, o, i, n, ke(o)), Ze(t, e = xr(e, r, n), s), !0;
1606
- }, yo), bo = Y(function(t, e, n) {
1607
- return t.h === 2 && (z(e, n, Qi(t)), !0);
1608
- }, vo, ro), k2 = Ie(function(t, e, n) {
1609
- return (t.h === 0 || t.h === 2) && (e = Me(e, 0 | e[d], n), t.h == 2 ? En(t, Nt, e) : e.push(Nt(t.g)), !0);
1610
- }, function(t, e, n) {
1611
- if ((e = xe(xi, e)) != null) for (let o = 0; o < e.length; o++) {
1612
- var r = t, s = n, i = e[o];
1613
- i != null && (pt(r, s, 0), Pe(r.g, i));
1614
- }
1615
- }, eo), S2 = Y(function(t, e, n) {
1616
- return t.h === 0 && (z(e, n, (t = Nt(t.g)) === 0 ? void 0 : t), !0);
1617
- }, function(t, e, n) {
1618
- (e = xi(e)) != null && e != null && (pt(t, n, 0), Pe(t.g, e));
1619
- }, eo), ot = Y(function(t, e, n) {
1620
- return t.h === 0 && (z(e, n, jt(t.g)), !0);
1621
- }, function(t, e, n) {
1622
- (e = Se(e)) != null && (e = parseInt(e, 10), pt(t, n, 0), kn(t.g, e));
1623
- }, so);
1624
- class T2 {
1625
- constructor(e, n) {
1626
- var r = ct;
1627
- this.g = e, this.h = n, this.m = A, this.j = _, this.defaultValue = void 0, this.l = r.Oa != null ? Mi : void 0;
1628
- }
1629
- register() {
1630
- gn(this);
1631
- }
1632
- }
1633
- function Lt(t, e) {
1634
- return new T2(t, e);
1635
- }
1636
- function Vt(t, e) {
1637
- return (n, r) => {
1638
- {
1639
- const i = { ea: !0 };
1640
- r && Object.assign(i, r), n = $i(n, void 0, void 0, i);
1641
- try {
1642
- const o = new t(), a = o.v;
1643
- Kr(e)(a, n);
1644
- var s = o;
1645
- } finally {
1646
- Ji(n);
1647
- }
1648
- }
1649
- return s;
1650
- };
1651
- }
1652
- function xn(t) {
1653
- return function() {
1654
- const e = new class {
1655
- constructor() {
1656
- this.l = [], this.h = 0, this.g = new class {
1657
- constructor() {
1658
- this.g = [];
1659
- }
1660
- length() {
1661
- return this.g.length;
1662
- }
1663
- end() {
1664
- const o = this.g;
1665
- return this.g = [], o;
1666
- }
1667
- }();
1668
- }
1669
- }();
1670
- lo(this.v, e, re(Fn, Pn, On, t)), ye(e, e.g.end());
1671
- const n = new Uint8Array(e.h), r = e.l, s = r.length;
1672
- let i = 0;
1673
- for (let o = 0; o < s; o++) {
1674
- const a = r[o];
1675
- n.set(a, i), i += a.length;
1676
- }
1677
- return e.l = [n], n;
1678
- };
1679
- }
1680
- var Bs = class extends p {
1681
- constructor(t) {
1682
- super(t);
1683
- }
1684
- }, Ds = [0, Dt, Y(function(t, e, n) {
1685
- return t.h === 2 && (z(e, n, (t = Qi(t)) === Zt() ? void 0 : t), !0);
1686
- }, function(t, e, n) {
1687
- if (e != null) {
1688
- if (e instanceof p) {
1689
- const r = e.Ra;
1690
- return void (r ? (e = r(e), e != null && Sn(t, n, Nr(e, !0).buffer)) : fe(Jn, 3));
1691
- }
1692
- if (Array.isArray(e)) return void fe(Jn, 3);
1693
- }
1694
- vo(t, e, n);
1695
- }, ro)];
1696
- let Kn, Us = globalThis.trustedTypes;
1697
- function js(t) {
1698
- var e;
1699
- return Kn === void 0 && (Kn = function() {
1700
- let n = null;
1701
- if (!Us) return n;
1702
- try {
1703
- const r = (s) => s;
1704
- n = Us.createPolicy("goog#html", { createHTML: r, createScript: r, createScriptURL: r });
1705
- } catch {
1706
- }
1707
- return n;
1708
- }()), t = (e = Kn) ? e.createScriptURL(t) : t, new class {
1709
- constructor(n) {
1710
- this.g = n;
1711
- }
1712
- toString() {
1713
- return this.g + "";
1714
- }
1715
- }(t);
1716
- }
1717
- function L2(t, ...e) {
1718
- if (e.length === 0) return js(t[0]);
1719
- let n = t[0];
1720
- for (let r = 0; r < e.length; r++) n += encodeURIComponent(e[r]) + t[r + 1];
1721
- return js(n);
1722
- }
1723
- var Ao = [0, K, ot, R, -1, Qe, ot, -1, R], F2 = class extends p {
1724
- constructor(t) {
1725
- super(t);
1726
- }
1727
- }, Eo = [0, R, S, R, ot, -1, Ie(function(t, e, n) {
1728
- return (t.h === 0 || t.h === 2) && (e = Me(e, 0 | e[d], n), t.h == 2 ? En(t, u2, e) : e.push(jt(t.g)), !0);
1729
- }, function(t, e, n) {
1730
- if ((e = xe(Se, e)) != null && e.length) {
1731
- n = Dr(t, n);
1732
- for (let r = 0; r < e.length; r++) kn(t.g, e[r]);
1733
- Ur(t, n);
1734
- }
1735
- }, so), S, -1, [0, R, -1], ot, R, -1], ko = [0, 3, R, -1, 2, [0, K], [0, ot, R], [0, S, -1], [0]], So = [0, S, -2], Gs = class extends p {
1736
- constructor(t) {
1737
- super(t);
1738
- }
1739
- }, To = [0], Lo = [0, K, R, 1, R, -4], ct = class extends p {
1740
- constructor(t) {
1741
- super(t, 2);
1742
- }
1743
- }, G = {};
1744
- G[336783863] = [0, S, R, -1, K, [0, [1, 2, 3, 4, 5, 6, 7, 8, 9], N, To, N, Eo, N, So, N, Lo, N, Ao, N, [0, S, -2], N, [0, S, ot], N, ko, N, [0, ot, -1, R]], [0, S], R, [0, [1, 3], [2, 4], N, [0, Qe], -1, N, [0, X], -1, W, [0, S, -1]], S];
1745
- var Vs = [0, Wn, -1, Jt, -3, Wn, Qe, Dt, ae, Wn, -1, Jt, ae, Jt, -2, Dt];
1746
- function F(t, e) {
1747
- An(t, 3, e);
1748
- }
1749
- function w(t, e) {
1750
- An(t, 4, e);
1751
- }
1752
- var Z = class extends p {
1753
- constructor(t) {
1754
- super(t, 500);
1755
- }
1756
- o(t) {
1757
- return _(this, 0, 7, t);
1758
- }
1759
- }, je = [-1, {}], Hs = [0, S, 1, je], Ws = [0, S, X, je];
1760
- function gt(t, e) {
1761
- Ir(t, 1, Z, e);
1762
- }
1763
- function O(t, e) {
1764
- An(t, 10, e);
1765
- }
1766
- function E(t, e) {
1767
- An(t, 15, e);
1768
- }
1769
- var ht = class extends p {
1770
- constructor(t) {
1771
- super(t, 500);
1772
- }
1773
- o(t) {
1774
- return _(this, 0, 1001, t);
1775
- }
1776
- }, Fo = [-500, W, [-500, Dt, -1, X, -3, [-2, G, R], W, Ds, ae, -1, Hs, Ws, W, [0, Dt, Jt], Dt, Vs, ae, X, 987, X], 4, W, [-500, S, -1, [-1, {}], 998, S], W, [-500, S, X, -1, [-2, {}, R], 997, X, -1], ae, W, [-500, S, X, je, 998, X], X, ae, Hs, Ws, W, [0, Dt, -1, je], X, -2, Vs, Dt, -1, Jt, [0, Jt, S2], 978, je, W, Ds];
1777
- ht.prototype.g = xn(Fo);
1778
- var M2 = Vt(ht, Fo), P2 = class extends p {
1779
- constructor(t) {
1780
- super(t);
1781
- }
1782
- }, Mo = class extends p {
1783
- constructor(t) {
1784
- super(t);
1785
- }
1786
- g() {
1787
- return xt(this, P2, 1);
1788
- }
1789
- }, Po = [0, W, [0, K, D, S, -1]], In = Vt(Mo, Po), O2 = class extends p {
1790
- constructor(t) {
1791
- super(t);
1792
- }
1793
- }, x2 = class extends p {
1794
- constructor(t) {
1795
- super(t);
1796
- }
1797
- }, zn = class extends p {
1798
- constructor(t) {
1799
- super(t);
1800
- }
1801
- l() {
1802
- return A(this, O2, 2);
1803
- }
1804
- g() {
1805
- return xt(this, x2, 5);
1806
- }
1807
- }, Oo = Vt(class extends p {
1808
- constructor(t) {
1809
- super(t);
1810
- }
1811
- }, [0, X, Qe, zr, [0, ot, [0, K, -3], [0, D, -3], [0, K, -1, [0, W, [0, K, -2]]], W, [0, D, -1, S, D]], S, -1, Gt, W, [0, K, D], X, Gt]), xo = class extends p {
1812
- constructor(t) {
1813
- super(t);
1814
- }
1815
- }, he = Vt(class extends p {
1816
- constructor(t) {
1817
- super(t);
1818
- }
1819
- }, [0, W, [0, D, -4]]), Io = class extends p {
1820
- constructor(t) {
1821
- super(t);
1822
- }
1823
- }, tn = Vt(class extends p {
1824
- constructor(t) {
1825
- super(t);
1826
- }
1827
- }, [0, W, [0, D, -4]]), I2 = class extends p {
1828
- constructor(t) {
1829
- super(t);
1830
- }
1831
- }, N2 = [0, K, -1, zr, ot], No = class extends p {
1832
- constructor(t) {
1833
- super(t);
1834
- }
1835
- };
1836
- No.prototype.g = xn([0, D, -4, Gt]);
1837
- var C2 = class extends p {
1838
- constructor(t) {
1839
- super(t);
1840
- }
1841
- }, R2 = Vt(class extends p {
1842
- constructor(t) {
1843
- super(t);
1844
- }
1845
- }, [0, W, [0, 1, K, S, Po], Gt]), Ks = class extends p {
1846
- constructor(t) {
1847
- super(t);
1848
- }
1849
- }, B2 = class extends p {
1850
- constructor(t) {
1851
- super(t);
1852
- }
1853
- na() {
1854
- const t = L(this, 1, void 0, void 0, Gi);
1855
- return t ?? Zt();
1856
- }
1857
- }, D2 = class extends p {
1858
- constructor(t) {
1859
- super(t);
1860
- }
1861
- }, Co = [1, 2], U2 = Vt(class extends p {
1862
- constructor(t) {
1863
- super(t);
1864
- }
1865
- }, [0, W, [0, Co, N, [0, zr], N, [0, bo], K, S], Gt]), qr = class extends p {
1866
- constructor(t) {
1867
- super(t);
1868
- }
1869
- }, Ro = [0, S, K, D, X, -1], zs = class extends p {
1870
- constructor(t) {
1871
- super(t);
1872
- }
1873
- }, j2 = [0, R, -1], qs = class extends p {
1874
- constructor(t) {
1875
- super(t);
1876
- }
1877
- }, an = [1, 2, 3, 4, 5, 6], pn = class extends p {
1878
- constructor(t) {
1879
- super(t);
1880
- }
1881
- g() {
1882
- return L(this, 1, void 0, void 0, Gi) != null;
1883
- }
1884
- l() {
1885
- return q(L(this, 2)) != null;
1886
- }
1887
- }, I = class extends p {
1888
- constructor(t) {
1889
- super(t);
1890
- }
1891
- g() {
1892
- return Oi(L(this, 2)) ?? !1;
1893
- }
1894
- }, Bo = [0, bo, S, [0, K, Gt, -1], [0, E2, Gt]], U = [0, Bo, R, [0, an, N, Lo, N, Eo, N, Ao, N, To, N, So, N, ko], ot], Nn = class extends p {
1895
- constructor(t) {
1896
- super(t);
1897
- }
1898
- }, Xr = [0, U, D, -1, K], G2 = Lt(502141897, Nn);
1899
- G[502141897] = Xr;
1900
- var V2 = Vt(class extends p {
1901
- constructor(t) {
1902
- super(t);
1903
- }
1904
- }, [0, [0, ot, -1, b2, k2], N2]), Do = class extends p {
1905
- constructor(t) {
1906
- super(t);
1907
- }
1908
- }, Uo = class extends p {
1909
- constructor(t) {
1910
- super(t);
1911
- }
1912
- }, sr = [0, U, D, [0, U], R], H2 = Lt(508968150, Uo);
1913
- G[508968150] = [0, U, Xr, sr, D, [0, [0, Bo]]], G[508968149] = sr;
1914
- var oe = class extends p {
1915
- constructor(t) {
1916
- super(t);
1917
- }
1918
- l() {
1919
- return A(this, qr, 2);
1920
- }
1921
- g() {
1922
- k(this, 2);
1923
- }
1924
- }, jo = [0, U, Ro];
1925
- G[478825465] = jo;
1926
- var W2 = class extends p {
1927
- constructor(t) {
1928
- super(t);
1929
- }
1930
- }, Go = class extends p {
1931
- constructor(t) {
1932
- super(t);
1933
- }
1934
- }, Yr = class extends p {
1935
- constructor(t) {
1936
- super(t);
1937
- }
1938
- }, $r = class extends p {
1939
- constructor(t) {
1940
- super(t);
1941
- }
1942
- }, Vo = class extends p {
1943
- constructor(t) {
1944
- super(t);
1945
- }
1946
- }, Xs = [0, U, [0, U], jo, -1], Ho = [0, U, D, K], Jr = [0, U, D], Wo = [0, U, Ho, Jr, D], K2 = Lt(479097054, Vo);
1947
- G[479097054] = [0, U, Wo, Xs], G[463370452] = Xs, G[464864288] = Ho;
1948
- var z2 = Lt(462713202, $r);
1949
- G[462713202] = Wo, G[474472470] = Jr;
1950
- var q2 = class extends p {
1951
- constructor(t) {
1952
- super(t);
1953
- }
1954
- }, Ko = class extends p {
1955
- constructor(t) {
1956
- super(t);
1957
- }
1958
- }, zo = class extends p {
1959
- constructor(t) {
1960
- super(t);
1961
- }
1962
- }, qo = class extends p {
1963
- constructor(t) {
1964
- super(t);
1965
- }
1966
- }, Zr = [0, U, D, -1, K], ir = [0, U, D, R];
1967
- qo.prototype.g = xn([0, U, Jr, [0, U], Xr, sr, Zr, ir]);
1968
- var Xo = class extends p {
1969
- constructor(t) {
1970
- super(t);
1971
- }
1972
- }, X2 = Lt(456383383, Xo);
1973
- G[456383383] = [0, U, Ro];
1974
- var Yo = class extends p {
1975
- constructor(t) {
1976
- super(t);
1977
- }
1978
- }, Y2 = Lt(476348187, Yo);
1979
- G[476348187] = [0, U, j2];
1980
- var $o = class extends p {
1981
- constructor(t) {
1982
- super(t);
1983
- }
1984
- }, Ys = class extends p {
1985
- constructor(t) {
1986
- super(t);
1987
- }
1988
- }, Jo = [0, ot, -1], $2 = Lt(458105876, class extends p {
1989
- constructor(t) {
1990
- super(t);
1991
- }
1992
- g() {
1993
- let t;
1994
- var e = this.v;
1995
- const n = 0 | e[d];
1996
- return t = st(this, n), e = function(r, s, i, o) {
1997
- var a = Ys;
1998
- !o && Le(r) && (i = 0 | (s = r.v)[d]);
1999
- var c = Ot(s, 2);
2000
- if (r = !1, c == null) {
2001
- if (o) return Ms();
2002
- c = [];
2003
- } else if (c.constructor === Pt) {
2004
- if (!(2 & c.J) || o) return c;
2005
- c = c.V();
2006
- } else Array.isArray(c) ? r = !!(2 & (0 | c[d])) : c = [];
2007
- if (o) {
2008
- if (!c.length) return Ms();
2009
- r || (r = !0, Xe(c));
2010
- } else r && (r = !1, He(c), c = Vi(c));
2011
- return !r && 32 & i && qe(c, 32), i = j(s, i, 2, o = new Pt(c, a, $a, void 0)), r || ne(s, i), o;
2012
- }(this, e, n, t), !t && Ys && (e.ra = !0), e;
2013
- }
2014
- });
2015
- G[458105876] = [0, Jo, w2, [!0, Gt, [0, S, -1, X]], [0, Qe, R, ot]];
2016
- var Qr = class extends p {
2017
- constructor(t) {
2018
- super(t);
2019
- }
2020
- }, Zo = Lt(458105758, Qr);
2021
- G[458105758] = [0, U, S, Jo];
2022
- var qn = class extends p {
2023
- constructor(t) {
2024
- super(t);
2025
- }
2026
- }, $s = [0, A2, -1, Jt], J2 = class extends p {
2027
- constructor(t) {
2028
- super(t);
2029
- }
2030
- }, Qo = class extends p {
2031
- constructor(t) {
2032
- super(t);
2033
- }
2034
- }, or = [1, 2];
2035
- Qo.prototype.g = xn([0, or, N, $s, N, [0, W, $s]]);
2036
- var ta = class extends p {
2037
- constructor(t) {
2038
- super(t);
2039
- }
2040
- }, Z2 = Lt(443442058, ta);
2041
- G[443442058] = [0, U, S, K, D, X, -1, R, D], G[514774813] = Zr;
2042
- var ea = class extends p {
2043
- constructor(t) {
2044
- super(t);
2045
- }
2046
- }, Q2 = Lt(516587230, ea);
2047
- function ar(t, e) {
2048
- return e = e ? e.clone() : new qr(), t.displayNamesLocale !== void 0 ? k(e, 1, Je(t.displayNamesLocale)) : t.displayNamesLocale === void 0 && k(e, 1), t.maxResults !== void 0 ? It(e, 2, t.maxResults) : "maxResults" in t && k(e, 2), t.scoreThreshold !== void 0 ? m(e, 3, t.scoreThreshold) : "scoreThreshold" in t && k(e, 3), t.categoryAllowlist !== void 0 ? un(e, 4, t.categoryAllowlist) : "categoryAllowlist" in t && k(e, 4), t.categoryDenylist !== void 0 ? un(e, 5, t.categoryDenylist) : "categoryDenylist" in t && k(e, 5), e;
2049
- }
2050
- function na(t) {
2051
- const e = Number(t);
2052
- return Number.isSafeInteger(e) ? e : String(t);
2053
- }
2054
- function ts(t, e = -1, n = "") {
2055
- return { categories: t.map((r) => ({ index: dt(r, 1) ?? 0 ?? -1, score: C(r, 2) ?? 0, categoryName: q(L(r, 3)) ?? "" ?? "", displayName: q(L(r, 4)) ?? "" ?? "" })), headIndex: e, headName: n };
2056
- }
2057
- function t1(t) {
2058
- const e = { classifications: xt(t, C2, 1).map((n) => {
2059
- var r;
2060
- return ts(((r = A(n, Mo, 4)) == null ? void 0 : r.g()) ?? [], dt(n, 2) ?? 0, q(L(n, 3)) ?? "");
2061
- }) };
2062
- return function(n) {
2063
- return Ya(gr ? L(n, 2, void 0, void 0, cn) : L(n, 2));
2064
- }(t) != null && (e.timestampMs = na(qi(t))), e;
2065
- }
2066
- function ra(t) {
2067
- var o, a;
2068
- var e = zt(t, 3, At, Kt()), n = zt(t, 2, Se, Kt()), r = zt(t, 1, q, Kt()), s = zt(t, 9, q, Kt());
2069
- const i = { categories: [], keypoints: [] };
2070
- for (let c = 0; c < e.length; c++) i.categories.push({ score: e[c], index: n[c] ?? -1, categoryName: r[c] ?? "", displayName: s[c] ?? "" });
2071
- if ((e = (o = A(t, zn, 4)) == null ? void 0 : o.l()) && (i.boundingBox = { originX: dt(e, 1, Ct) ?? 0, originY: dt(e, 2, Ct) ?? 0, width: dt(e, 3, Ct) ?? 0, height: dt(e, 4, Ct) ?? 0, angle: 0 }), (a = A(t, zn, 4)) == null ? void 0 : a.g().length) for (const c of A(t, zn, 4).g()) i.keypoints.push({ x: L(c, 1, void 0, Ct, At) ?? 0, y: L(c, 2, void 0, Ct, At) ?? 0, score: L(c, 4, void 0, Ct, At) ?? 0, label: q(L(c, 3, void 0, Ct)) ?? "" });
2072
- return i;
2073
- }
2074
- function Cn(t) {
2075
- const e = [];
2076
- for (const n of xt(t, Io, 1)) e.push({ x: C(n, 1) ?? 0, y: C(n, 2) ?? 0, z: C(n, 3) ?? 0, visibility: C(n, 4) ?? 0 });
2077
- return e;
2078
- }
2079
- function Ge(t) {
2080
- const e = [];
2081
- for (const n of xt(t, xo, 1)) e.push({ x: C(n, 1) ?? 0, y: C(n, 2) ?? 0, z: C(n, 3) ?? 0, visibility: C(n, 4) ?? 0 });
2082
- return e;
2083
- }
2084
- function Js(t) {
2085
- return Array.from(t, (e) => e > 127 ? e - 256 : e);
2086
- }
2087
- function Zs(t, e) {
2088
- if (t.length !== e.length) throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);
2089
- let n = 0, r = 0, s = 0;
2090
- for (let i = 0; i < t.length; i++) n += t[i] * e[i], r += t[i] * t[i], s += e[i] * e[i];
2091
- if (r <= 0 || s <= 0) throw Error("Cannot compute cosine similarity on embedding with 0 norm.");
2092
- return n / Math.sqrt(r * s);
2093
- }
2094
- let nn;
2095
- G[516587230] = [0, U, Zr, ir, D], G[518928384] = ir;
2096
- const e1 = 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]);
2097
- async function sa() {
2098
- if (nn === void 0) try {
2099
- await WebAssembly.instantiate(e1), nn = !0;
2100
- } catch {
2101
- nn = !1;
2102
- }
2103
- return nn;
2104
- }
2105
- async function Re(t, e = L2``) {
2106
- const n = await sa() ? "wasm_internal" : "wasm_nosimd_internal";
2107
- return { wasmLoaderPath: `${e}/${t}_${n}.js`, wasmBinaryPath: `${e}/${t}_${n}.wasm` };
2108
- }
2109
- var Wt = class {
2110
- };
2111
- function ia() {
2112
- var t = navigator;
2113
- return typeof OffscreenCanvas < "u" && (!function(e = navigator) {
2114
- return (e = e.userAgent).includes("Safari") && !e.includes("Chrome");
2115
- }(t) || !!((t = t.userAgent.match(/Version\/([\d]+).*Safari/)) && t.length >= 1 && Number(t[1]) >= 17));
2116
- }
2117
- async function Qs(t) {
2118
- if (typeof importScripts != "function") {
2119
- const e = document.createElement("script");
2120
- return e.src = t.toString(), e.crossOrigin = "anonymous", new Promise((n, r) => {
2121
- e.addEventListener("load", () => {
2122
- n();
2123
- }, !1), e.addEventListener("error", (s) => {
2124
- r(s);
2125
- }, !1), document.body.appendChild(e);
2126
- });
2127
- }
2128
- try {
2129
- importScripts(t.toString());
2130
- } catch (e) {
2131
- if (!(e instanceof TypeError)) throw e;
2132
- await self.import(t.toString());
2133
- }
2134
- }
2135
- function oa(t) {
2136
- return t.videoWidth !== void 0 ? [t.videoWidth, t.videoHeight] : t.naturalWidth !== void 0 ? [t.naturalWidth, t.naturalHeight] : t.displayWidth !== void 0 ? [t.displayWidth, t.displayHeight] : [t.width, t.height];
2137
- }
2138
- function g(t, e, n) {
2139
- t.m || console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"), n(e = t.i.stringToNewUTF8(e)), t.i._free(e);
2140
- }
2141
- function ti(t, e, n) {
2142
- if (!t.i.canvas) throw Error("No OpenGL canvas configured.");
2143
- if (n ? t.i._bindTextureToStream(n) : t.i._bindTextureToCanvas(), !(n = t.i.canvas.getContext("webgl2") || t.i.canvas.getContext("webgl"))) throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");
2144
- t.i.gpuOriginForWebTexturesIsBottomLeft && n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, !0), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, e), t.i.gpuOriginForWebTexturesIsBottomLeft && n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, !1);
2145
- const [r, s] = oa(e);
2146
- return !t.l || r === t.i.canvas.width && s === t.i.canvas.height || (t.i.canvas.width = r, t.i.canvas.height = s), [r, s];
2147
- }
2148
- function ei(t, e, n) {
2149
- t.m || console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");
2150
- const r = new Uint32Array(e.length);
2151
- for (let s = 0; s < e.length; s++) r[s] = t.i.stringToNewUTF8(e[s]);
2152
- e = t.i._malloc(4 * r.length), t.i.HEAPU32.set(r, e >> 2), n(e);
2153
- for (const s of r) t.i._free(s);
2154
- t.i._free(e);
2155
- }
2156
- function wt(t, e, n) {
2157
- t.i.simpleListeners = t.i.simpleListeners || {}, t.i.simpleListeners[e] = n;
2158
- }
2159
- function Rt(t, e, n) {
2160
- let r = [];
2161
- t.i.simpleListeners = t.i.simpleListeners || {}, t.i.simpleListeners[e] = (s, i, o) => {
2162
- i ? (n(r, o), r = []) : r.push(s);
2163
- };
2164
- }
2165
- Wt.forVisionTasks = function(t) {
2166
- return Re("vision", t);
2167
- }, Wt.forTextTasks = function(t) {
2168
- return Re("text", t);
2169
- }, Wt.forGenAiExperimentalTasks = function(t) {
2170
- return Re("genai_experimental", t);
2171
- }, Wt.forGenAiTasks = function(t) {
2172
- return Re("genai", t);
2173
- }, Wt.forAudioTasks = function(t) {
2174
- return Re("audio", t);
2175
- }, Wt.isSimdSupported = function() {
2176
- return sa();
2177
- };
2178
- async function n1(t, e, n, r) {
2179
- return t = await (async (s, i, o, a, c) => {
2180
- if (i && await Qs(i), !self.ModuleFactory || o && (await Qs(o), !self.ModuleFactory)) throw Error("ModuleFactory not set.");
2181
- return self.Module && c && ((i = self.Module).locateFile = c.locateFile, c.mainScriptUrlOrBlob && (i.mainScriptUrlOrBlob = c.mainScriptUrlOrBlob)), c = await self.ModuleFactory(self.Module || c), self.ModuleFactory = self.Module = void 0, new s(c, a);
2182
- })(t, n.wasmLoaderPath, n.assetLoaderPath, e, { locateFile: (s) => s.endsWith(".wasm") ? n.wasmBinaryPath.toString() : n.assetBinaryPath && s.endsWith(".data") ? n.assetBinaryPath.toString() : s }), await t.o(r), t;
2183
- }
2184
- function Xn(t, e) {
2185
- const n = A(t.baseOptions, pn, 1) || new pn();
2186
- typeof e == "string" ? (k(n, 2, Je(e)), k(n, 1)) : e instanceof Uint8Array && (k(n, 1, yr(e, !1)), k(n, 2)), _(t.baseOptions, 0, 1, n);
2187
- }
2188
- function ni(t) {
2189
- try {
2190
- const e = t.H.length;
2191
- if (e === 1) throw Error(t.H[0].message);
2192
- if (e > 1) throw Error("Encountered multiple errors: " + t.H.map((n) => n.message).join(", "));
2193
- } finally {
2194
- t.H = [];
2195
- }
2196
- }
2197
- function l(t, e) {
2198
- t.C = Math.max(t.C, e);
2199
- }
2200
- function Rn(t, e) {
2201
- t.B = new Z(), it(t.B, 2, "PassThroughCalculator"), F(t.B, "free_memory"), w(t.B, "free_memory_unused_out"), O(e, "free_memory"), gt(e, t.B);
2202
- }
2203
- function ve(t, e) {
2204
- F(t.B, e), w(t.B, e + "_unused_out");
2205
- }
2206
- function Bn(t) {
2207
- t.g.addBoolToStream(!0, "free_memory", t.C);
2208
- }
2209
- var cr = class {
2210
- constructor(t) {
2211
- this.g = t, this.H = [], this.C = 0, this.g.setAutoRenderToScreen(!1);
2212
- }
2213
- l(t, e = !0) {
2214
- var n, r, s, i, o, a;
2215
- if (e) {
2216
- const c = t.baseOptions || {};
2217
- if ((n = t.baseOptions) != null && n.modelAssetBuffer && ((r = t.baseOptions) != null && r.modelAssetPath)) throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");
2218
- if (!((s = A(this.baseOptions, pn, 1)) != null && s.g() || (i = A(this.baseOptions, pn, 1)) != null && i.l() || (o = t.baseOptions) != null && o.modelAssetBuffer || (a = t.baseOptions) != null && a.modelAssetPath)) throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");
2219
- if (function(u, h) {
2220
- let f = A(u.baseOptions, qs, 3);
2221
- if (!f) {
2222
- var y = f = new qs(), v = new Gs();
2223
- Ue(y, 4, an, v);
2224
- }
2225
- "delegate" in h && (h.delegate === "GPU" ? (h = f, y = new F2(), Ue(h, 2, an, y)) : (h = f, y = new Gs(), Ue(h, 4, an, y))), _(u.baseOptions, 0, 3, f);
2226
- }(this, c), c.modelAssetPath) return fetch(c.modelAssetPath.toString()).then((u) => {
2227
- if (u.ok) return u.arrayBuffer();
2228
- throw Error(`Failed to fetch model: ${c.modelAssetPath} (${u.status})`);
2229
- }).then((u) => {
2230
- try {
2231
- this.g.i.FS_unlink("/model.dat");
2232
- } catch {
2233
- }
2234
- this.g.i.FS_createDataFile("/", "model.dat", new Uint8Array(u), !0, !1, !1), Xn(this, "/model.dat"), this.m(), this.L();
2235
- });
2236
- if (c.modelAssetBuffer instanceof Uint8Array) Xn(this, c.modelAssetBuffer);
2237
- else if (c.modelAssetBuffer) return async function(u) {
2238
- const h = [];
2239
- for (var f = 0; ; ) {
2240
- const { done: y, value: v } = await u.read();
2241
- if (y) break;
2242
- h.push(v), f += v.length;
2243
- }
2244
- if (h.length === 0) return new Uint8Array(0);
2245
- if (h.length === 1) return h[0];
2246
- u = new Uint8Array(f), f = 0;
2247
- for (const y of h) u.set(y, f), f += y.length;
2248
- return u;
2249
- }(c.modelAssetBuffer).then((u) => {
2250
- Xn(this, u), this.m(), this.L();
2251
- });
2252
- }
2253
- return this.m(), this.L(), Promise.resolve();
2254
- }
2255
- L() {
2256
- }
2257
- ca() {
2258
- let t;
2259
- if (this.g.ca((e) => {
2260
- t = M2(e);
2261
- }), !t) throw Error("Failed to retrieve CalculatorGraphConfig");
2262
- return t;
2263
- }
2264
- setGraph(t, e) {
2265
- this.g.attachErrorListener((n, r) => {
2266
- this.H.push(Error(r));
2267
- }), this.g.Ja(), this.g.setGraph(t, e), this.B = void 0, ni(this);
2268
- }
2269
- finishProcessing() {
2270
- this.g.finishProcessing(), ni(this);
2271
- }
2272
- close() {
2273
- this.B = void 0, this.g.closeGraph();
2274
- }
2275
- };
2276
- function Ut(t, e) {
2277
- if (!t) throw Error(`Unable to obtain required WebGL resource: ${e}`);
2278
- return t;
2279
- }
2280
- cr.prototype.close = cr.prototype.close;
2281
- class r1 {
2282
- constructor(e, n, r, s) {
2283
- this.g = e, this.h = n, this.m = r, this.l = s;
2284
- }
2285
- bind() {
2286
- this.g.bindVertexArray(this.h);
2287
- }
2288
- close() {
2289
- this.g.deleteVertexArray(this.h), this.g.deleteBuffer(this.m), this.g.deleteBuffer(this.l);
2290
- }
2291
- }
2292
- function ri(t, e, n) {
2293
- const r = t.g;
2294
- if (n = Ut(r.createShader(n), "Failed to create WebGL shader"), r.shaderSource(n, e), r.compileShader(n), !r.getShaderParameter(n, r.COMPILE_STATUS)) throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);
2295
- return r.attachShader(t.h, n), n;
2296
- }
2297
- function si(t, e) {
2298
- const n = t.g, r = Ut(n.createVertexArray(), "Failed to create vertex array");
2299
- n.bindVertexArray(r);
2300
- const s = Ut(n.createBuffer(), "Failed to create buffer");
2301
- n.bindBuffer(n.ARRAY_BUFFER, s), n.enableVertexAttribArray(t.O), n.vertexAttribPointer(t.O, 2, n.FLOAT, !1, 0, 0), n.bufferData(n.ARRAY_BUFFER, new Float32Array([-1, -1, -1, 1, 1, 1, 1, -1]), n.STATIC_DRAW);
2302
- const i = Ut(n.createBuffer(), "Failed to create buffer");
2303
- return n.bindBuffer(n.ARRAY_BUFFER, i), n.enableVertexAttribArray(t.L), n.vertexAttribPointer(t.L, 2, n.FLOAT, !1, 0, 0), n.bufferData(n.ARRAY_BUFFER, new Float32Array(e ? [0, 1, 0, 0, 1, 0, 1, 1] : [0, 0, 0, 1, 1, 1, 1, 0]), n.STATIC_DRAW), n.bindBuffer(n.ARRAY_BUFFER, null), n.bindVertexArray(null), new r1(n, r, s, i);
2304
- }
2305
- function es(t, e) {
2306
- if (t.g) {
2307
- if (e !== t.g) throw Error("Cannot change GL context once initialized");
2308
- } else t.g = e;
2309
- }
2310
- function s1(t, e, n, r) {
2311
- return es(t, e), t.h || (t.m(), t.D()), n ? (t.u || (t.u = si(t, !0)), n = t.u) : (t.A || (t.A = si(t, !1)), n = t.A), e.useProgram(t.h), n.bind(), t.l(), t = r(), n.g.bindVertexArray(null), t;
2312
- }
2313
- function aa(t, e, n) {
2314
- return es(t, e), t = Ut(e.createTexture(), "Failed to create texture"), e.bindTexture(e.TEXTURE_2D, t), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, n ?? e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, n ?? e.LINEAR), e.bindTexture(e.TEXTURE_2D, null), t;
2315
- }
2316
- function ca(t, e, n) {
2317
- es(t, e), t.B || (t.B = Ut(e.createFramebuffer(), "Failed to create framebuffe.")), e.bindFramebuffer(e.FRAMEBUFFER, t.B), e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, n, 0);
2318
- }
2319
- function i1(t) {
2320
- var e;
2321
- (e = t.g) == null || e.bindFramebuffer(t.g.FRAMEBUFFER, null);
2322
- }
2323
- var ha = class {
2324
- H() {
2325
- return `
2326
- precision mediump float;
2327
- varying vec2 vTex;
2328
- uniform sampler2D inputTexture;
2329
- void main() {
2330
- gl_FragColor = texture2D(inputTexture, vTex);
2331
- }
2332
- `;
2333
- }
2334
- m() {
2335
- const t = this.g;
2336
- if (this.h = Ut(t.createProgram(), "Failed to create WebGL program"), this.X = ri(this, `
2337
- attribute vec2 aVertex;
2338
- attribute vec2 aTex;
2339
- varying vec2 vTex;
2340
- void main(void) {
2341
- gl_Position = vec4(aVertex, 0.0, 1.0);
2342
- vTex = aTex;
2343
- }`, t.VERTEX_SHADER), this.W = ri(this, this.H(), t.FRAGMENT_SHADER), t.linkProgram(this.h), !t.getProgramParameter(this.h, t.LINK_STATUS)) throw Error(`Error during program linking: ${t.getProgramInfoLog(this.h)}`);
2344
- this.O = t.getAttribLocation(this.h, "aVertex"), this.L = t.getAttribLocation(this.h, "aTex");
2345
- }
2346
- D() {
2347
- }
2348
- l() {
2349
- }
2350
- close() {
2351
- if (this.h) {
2352
- const t = this.g;
2353
- t.deleteProgram(this.h), t.deleteShader(this.X), t.deleteShader(this.W);
2354
- }
2355
- this.B && this.g.deleteFramebuffer(this.B), this.A && this.A.close(), this.u && this.u.close();
2356
- }
2357
- };
2358
- function Mt(t, e) {
2359
- switch (e) {
2360
- case 0:
2361
- return t.g.find((n) => n instanceof Uint8Array);
2362
- case 1:
2363
- return t.g.find((n) => n instanceof Float32Array);
2364
- case 2:
2365
- return t.g.find((n) => typeof WebGLTexture < "u" && n instanceof WebGLTexture);
2366
- default:
2367
- throw Error(`Type is not supported: ${e}`);
2368
- }
2369
- }
2370
- function hr(t) {
2371
- var e = Mt(t, 1);
2372
- if (!e) {
2373
- if (e = Mt(t, 0)) e = new Float32Array(e).map((r) => r / 255);
2374
- else {
2375
- e = new Float32Array(t.width * t.height);
2376
- const r = we(t);
2377
- var n = ns(t);
2378
- if (ca(n, r, ua(t)), "iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform) || navigator.userAgent.includes("Mac") && "document" in self && "ontouchend" in self.document) {
2379
- n = new Float32Array(t.width * t.height * 4), r.readPixels(0, 0, t.width, t.height, r.RGBA, r.FLOAT, n);
2380
- for (let s = 0, i = 0; s < e.length; ++s, i += 4) e[s] = n[i];
2381
- } else r.readPixels(0, 0, t.width, t.height, r.RED, r.FLOAT, e);
2382
- }
2383
- t.g.push(e);
2384
- }
2385
- return e;
2386
- }
2387
- function ua(t) {
2388
- let e = Mt(t, 2);
2389
- if (!e) {
2390
- const n = we(t);
2391
- e = fa(t);
2392
- const r = hr(t), s = la(t);
2393
- n.texImage2D(n.TEXTURE_2D, 0, s, t.width, t.height, 0, n.RED, n.FLOAT, r), ur(t);
2394
- }
2395
- return e;
2396
- }
2397
- function we(t) {
2398
- if (!t.canvas) throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");
2399
- return t.h || (t.h = Ut(t.canvas.getContext("webgl2"), "You cannot use a canvas that is already bound to a different type of rendering context.")), t.h;
2400
- }
2401
- function la(t) {
2402
- if (t = we(t), !rn) if (t.getExtension("EXT_color_buffer_float") && t.getExtension("OES_texture_float_linear") && t.getExtension("EXT_float_blend")) rn = t.R32F;
2403
- else {
2404
- if (!t.getExtension("EXT_color_buffer_half_float")) throw Error("GPU does not fully support 4-channel float32 or float16 formats");
2405
- rn = t.R16F;
2406
- }
2407
- return rn;
2408
- }
2409
- function ns(t) {
2410
- return t.l || (t.l = new ha()), t.l;
2411
- }
2412
- function fa(t) {
2413
- const e = we(t);
2414
- e.viewport(0, 0, t.width, t.height), e.activeTexture(e.TEXTURE0);
2415
- let n = Mt(t, 2);
2416
- return n || (n = aa(ns(t), e, t.m ? e.LINEAR : e.NEAREST), t.g.push(n), t.j = !0), e.bindTexture(e.TEXTURE_2D, n), n;
2417
- }
2418
- function ur(t) {
2419
- t.h.bindTexture(t.h.TEXTURE_2D, null);
2420
- }
2421
- var rn, H = class {
2422
- constructor(t, e, n, r, s, i, o) {
2423
- this.g = t, this.m = e, this.j = n, this.canvas = r, this.l = s, this.width = i, this.height = o, this.j && --ii === 0 && console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.");
2424
- }
2425
- Fa() {
2426
- return !!Mt(this, 0);
2427
- }
2428
- ka() {
2429
- return !!Mt(this, 1);
2430
- }
2431
- R() {
2432
- return !!Mt(this, 2);
2433
- }
2434
- ja() {
2435
- return (e = Mt(t = this, 0)) || (e = hr(t), e = new Uint8Array(e.map((n) => Math.round(255 * n))), t.g.push(e)), e;
2436
- var t, e;
2437
- }
2438
- ia() {
2439
- return hr(this);
2440
- }
2441
- N() {
2442
- return ua(this);
2443
- }
2444
- clone() {
2445
- const t = [];
2446
- for (const e of this.g) {
2447
- let n;
2448
- if (e instanceof Uint8Array) n = new Uint8Array(e);
2449
- else if (e instanceof Float32Array) n = new Float32Array(e);
2450
- else {
2451
- if (!(e instanceof WebGLTexture)) throw Error(`Type is not supported: ${e}`);
2452
- {
2453
- const r = we(this), s = ns(this);
2454
- r.activeTexture(r.TEXTURE1), n = aa(s, r, this.m ? r.LINEAR : r.NEAREST), r.bindTexture(r.TEXTURE_2D, n);
2455
- const i = la(this);
2456
- r.texImage2D(r.TEXTURE_2D, 0, i, this.width, this.height, 0, r.RED, r.FLOAT, null), r.bindTexture(r.TEXTURE_2D, null), ca(s, r, n), s1(s, r, !1, () => {
2457
- fa(this), r.clearColor(0, 0, 0, 0), r.clear(r.COLOR_BUFFER_BIT), r.drawArrays(r.TRIANGLE_FAN, 0, 4), ur(this);
2458
- }), i1(s), ur(this);
2459
- }
2460
- }
2461
- t.push(n);
2462
- }
2463
- return new H(t, this.m, this.R(), this.canvas, this.l, this.width, this.height);
2464
- }
2465
- close() {
2466
- this.j && we(this).deleteTexture(Mt(this, 2)), ii = -1;
2467
- }
2468
- };
2469
- H.prototype.close = H.prototype.close, H.prototype.clone = H.prototype.clone, H.prototype.getAsWebGLTexture = H.prototype.N, H.prototype.getAsFloat32Array = H.prototype.ia, H.prototype.getAsUint8Array = H.prototype.ja, H.prototype.hasWebGLTexture = H.prototype.R, H.prototype.hasFloat32Array = H.prototype.ka, H.prototype.hasUint8Array = H.prototype.Fa;
2470
- var ii = 250;
2471
- function _t(...t) {
2472
- return t.map(([e, n]) => ({ start: e, end: n }));
2473
- }
2474
- const o1 = /* @__PURE__ */ function(t) {
2475
- return class extends t {
2476
- Ja() {
2477
- this.i._registerModelResourcesGraphService();
2478
- }
2479
- };
2480
- }((oi = class {
2481
- constructor(t, e) {
2482
- this.l = !0, this.i = t, this.g = null, this.h = 0, this.m = typeof this.i._addIntToInputStream == "function", e !== void 0 ? this.i.canvas = e : ia() ? this.i.canvas = new OffscreenCanvas(1, 1) : (console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."), this.i.canvas = document.createElement("canvas"));
2483
- }
2484
- async initializeGraph(t) {
2485
- const e = await (await fetch(t)).arrayBuffer();
2486
- t = !(t.endsWith(".pbtxt") || t.endsWith(".textproto")), this.setGraph(new Uint8Array(e), t);
2487
- }
2488
- setGraphFromString(t) {
2489
- this.setGraph(new TextEncoder().encode(t), !1);
2490
- }
2491
- setGraph(t, e) {
2492
- const n = t.length, r = this.i._malloc(n);
2493
- this.i.HEAPU8.set(t, r), e ? this.i._changeBinaryGraph(n, r) : this.i._changeTextGraph(n, r), this.i._free(r);
2494
- }
2495
- configureAudio(t, e, n, r, s) {
2496
- this.i._configureAudio || console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'), g(this, r || "input_audio", (i) => {
2497
- g(this, s = s || "audio_header", (o) => {
2498
- this.i._configureAudio(i, o, t, e ?? 0, n);
2499
- });
2500
- });
2501
- }
2502
- setAutoResizeCanvas(t) {
2503
- this.l = t;
2504
- }
2505
- setAutoRenderToScreen(t) {
2506
- this.i._setAutoRenderToScreen(t);
2507
- }
2508
- setGpuBufferVerticalFlip(t) {
2509
- this.i.gpuOriginForWebTexturesIsBottomLeft = t;
2510
- }
2511
- ca(t) {
2512
- wt(this, "__graph_config__", (e) => {
2513
- t(e);
2514
- }), g(this, "__graph_config__", (e) => {
2515
- this.i._getGraphConfig(e, void 0);
2516
- }), delete this.i.simpleListeners.__graph_config__;
2517
- }
2518
- attachErrorListener(t) {
2519
- this.i.errorListener = t;
2520
- }
2521
- attachEmptyPacketListener(t, e) {
2522
- this.i.emptyPacketListeners = this.i.emptyPacketListeners || {}, this.i.emptyPacketListeners[t] = e;
2523
- }
2524
- addAudioToStream(t, e, n) {
2525
- this.addAudioToStreamWithShape(t, 0, 0, e, n);
2526
- }
2527
- addAudioToStreamWithShape(t, e, n, r, s) {
2528
- const i = 4 * t.length;
2529
- this.h !== i && (this.g && this.i._free(this.g), this.g = this.i._malloc(i), this.h = i), this.i.HEAPF32.set(t, this.g / 4), g(this, r, (o) => {
2530
- this.i._addAudioToInputStream(this.g, e, n, o, s);
2531
- });
2532
- }
2533
- addGpuBufferToStream(t, e, n) {
2534
- g(this, e, (r) => {
2535
- const [s, i] = ti(this, t, r);
2536
- this.i._addBoundTextureToStream(r, s, i, n);
2537
- });
2538
- }
2539
- addBoolToStream(t, e, n) {
2540
- g(this, e, (r) => {
2541
- this.i._addBoolToInputStream(t, r, n);
2542
- });
2543
- }
2544
- addDoubleToStream(t, e, n) {
2545
- g(this, e, (r) => {
2546
- this.i._addDoubleToInputStream(t, r, n);
2547
- });
2548
- }
2549
- addFloatToStream(t, e, n) {
2550
- g(this, e, (r) => {
2551
- this.i._addFloatToInputStream(t, r, n);
2552
- });
2553
- }
2554
- addIntToStream(t, e, n) {
2555
- g(this, e, (r) => {
2556
- this.i._addIntToInputStream(t, r, n);
2557
- });
2558
- }
2559
- addUintToStream(t, e, n) {
2560
- g(this, e, (r) => {
2561
- this.i._addUintToInputStream(t, r, n);
2562
- });
2563
- }
2564
- addStringToStream(t, e, n) {
2565
- g(this, e, (r) => {
2566
- g(this, t, (s) => {
2567
- this.i._addStringToInputStream(s, r, n);
2568
- });
2569
- });
2570
- }
2571
- addStringRecordToStream(t, e, n) {
2572
- g(this, e, (r) => {
2573
- ei(this, Object.keys(t), (s) => {
2574
- ei(this, Object.values(t), (i) => {
2575
- this.i._addFlatHashMapToInputStream(s, i, Object.keys(t).length, r, n);
2576
- });
2577
- });
2578
- });
2579
- }
2580
- addProtoToStream(t, e, n, r) {
2581
- g(this, n, (s) => {
2582
- g(this, e, (i) => {
2583
- const o = this.i._malloc(t.length);
2584
- this.i.HEAPU8.set(t, o), this.i._addProtoToInputStream(o, t.length, i, s, r), this.i._free(o);
2585
- });
2586
- });
2587
- }
2588
- addEmptyPacketToStream(t, e) {
2589
- g(this, t, (n) => {
2590
- this.i._addEmptyPacketToInputStream(n, e);
2591
- });
2592
- }
2593
- addBoolVectorToStream(t, e, n) {
2594
- g(this, e, (r) => {
2595
- const s = this.i._allocateBoolVector(t.length);
2596
- if (!s) throw Error("Unable to allocate new bool vector on heap.");
2597
- for (const i of t) this.i._addBoolVectorEntry(s, i);
2598
- this.i._addBoolVectorToInputStream(s, r, n);
2599
- });
2600
- }
2601
- addDoubleVectorToStream(t, e, n) {
2602
- g(this, e, (r) => {
2603
- const s = this.i._allocateDoubleVector(t.length);
2604
- if (!s) throw Error("Unable to allocate new double vector on heap.");
2605
- for (const i of t) this.i._addDoubleVectorEntry(s, i);
2606
- this.i._addDoubleVectorToInputStream(s, r, n);
2607
- });
2608
- }
2609
- addFloatVectorToStream(t, e, n) {
2610
- g(this, e, (r) => {
2611
- const s = this.i._allocateFloatVector(t.length);
2612
- if (!s) throw Error("Unable to allocate new float vector on heap.");
2613
- for (const i of t) this.i._addFloatVectorEntry(s, i);
2614
- this.i._addFloatVectorToInputStream(s, r, n);
2615
- });
2616
- }
2617
- addIntVectorToStream(t, e, n) {
2618
- g(this, e, (r) => {
2619
- const s = this.i._allocateIntVector(t.length);
2620
- if (!s) throw Error("Unable to allocate new int vector on heap.");
2621
- for (const i of t) this.i._addIntVectorEntry(s, i);
2622
- this.i._addIntVectorToInputStream(s, r, n);
2623
- });
2624
- }
2625
- addUintVectorToStream(t, e, n) {
2626
- g(this, e, (r) => {
2627
- const s = this.i._allocateUintVector(t.length);
2628
- if (!s) throw Error("Unable to allocate new unsigned int vector on heap.");
2629
- for (const i of t) this.i._addUintVectorEntry(s, i);
2630
- this.i._addUintVectorToInputStream(s, r, n);
2631
- });
2632
- }
2633
- addStringVectorToStream(t, e, n) {
2634
- g(this, e, (r) => {
2635
- const s = this.i._allocateStringVector(t.length);
2636
- if (!s) throw Error("Unable to allocate new string vector on heap.");
2637
- for (const i of t) g(this, i, (o) => {
2638
- this.i._addStringVectorEntry(s, o);
2639
- });
2640
- this.i._addStringVectorToInputStream(s, r, n);
2641
- });
2642
- }
2643
- addBoolToInputSidePacket(t, e) {
2644
- g(this, e, (n) => {
2645
- this.i._addBoolToInputSidePacket(t, n);
2646
- });
2647
- }
2648
- addDoubleToInputSidePacket(t, e) {
2649
- g(this, e, (n) => {
2650
- this.i._addDoubleToInputSidePacket(t, n);
2651
- });
2652
- }
2653
- addFloatToInputSidePacket(t, e) {
2654
- g(this, e, (n) => {
2655
- this.i._addFloatToInputSidePacket(t, n);
2656
- });
2657
- }
2658
- addIntToInputSidePacket(t, e) {
2659
- g(this, e, (n) => {
2660
- this.i._addIntToInputSidePacket(t, n);
2661
- });
2662
- }
2663
- addUintToInputSidePacket(t, e) {
2664
- g(this, e, (n) => {
2665
- this.i._addUintToInputSidePacket(t, n);
2666
- });
2667
- }
2668
- addStringToInputSidePacket(t, e) {
2669
- g(this, e, (n) => {
2670
- g(this, t, (r) => {
2671
- this.i._addStringToInputSidePacket(r, n);
2672
- });
2673
- });
2674
- }
2675
- addProtoToInputSidePacket(t, e, n) {
2676
- g(this, n, (r) => {
2677
- g(this, e, (s) => {
2678
- const i = this.i._malloc(t.length);
2679
- this.i.HEAPU8.set(t, i), this.i._addProtoToInputSidePacket(i, t.length, s, r), this.i._free(i);
2680
- });
2681
- });
2682
- }
2683
- addBoolVectorToInputSidePacket(t, e) {
2684
- g(this, e, (n) => {
2685
- const r = this.i._allocateBoolVector(t.length);
2686
- if (!r) throw Error("Unable to allocate new bool vector on heap.");
2687
- for (const s of t) this.i._addBoolVectorEntry(r, s);
2688
- this.i._addBoolVectorToInputSidePacket(r, n);
2689
- });
2690
- }
2691
- addDoubleVectorToInputSidePacket(t, e) {
2692
- g(this, e, (n) => {
2693
- const r = this.i._allocateDoubleVector(t.length);
2694
- if (!r) throw Error("Unable to allocate new double vector on heap.");
2695
- for (const s of t) this.i._addDoubleVectorEntry(r, s);
2696
- this.i._addDoubleVectorToInputSidePacket(r, n);
2697
- });
2698
- }
2699
- addFloatVectorToInputSidePacket(t, e) {
2700
- g(this, e, (n) => {
2701
- const r = this.i._allocateFloatVector(t.length);
2702
- if (!r) throw Error("Unable to allocate new float vector on heap.");
2703
- for (const s of t) this.i._addFloatVectorEntry(r, s);
2704
- this.i._addFloatVectorToInputSidePacket(r, n);
2705
- });
2706
- }
2707
- addIntVectorToInputSidePacket(t, e) {
2708
- g(this, e, (n) => {
2709
- const r = this.i._allocateIntVector(t.length);
2710
- if (!r) throw Error("Unable to allocate new int vector on heap.");
2711
- for (const s of t) this.i._addIntVectorEntry(r, s);
2712
- this.i._addIntVectorToInputSidePacket(r, n);
2713
- });
2714
- }
2715
- addUintVectorToInputSidePacket(t, e) {
2716
- g(this, e, (n) => {
2717
- const r = this.i._allocateUintVector(t.length);
2718
- if (!r) throw Error("Unable to allocate new unsigned int vector on heap.");
2719
- for (const s of t) this.i._addUintVectorEntry(r, s);
2720
- this.i._addUintVectorToInputSidePacket(r, n);
2721
- });
2722
- }
2723
- addStringVectorToInputSidePacket(t, e) {
2724
- g(this, e, (n) => {
2725
- const r = this.i._allocateStringVector(t.length);
2726
- if (!r) throw Error("Unable to allocate new string vector on heap.");
2727
- for (const s of t) g(this, s, (i) => {
2728
- this.i._addStringVectorEntry(r, i);
13
+ if (!r.ok)
14
+ throw new Error("Network response was not ok");
15
+ return await r.json();
16
+ }, le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
17
+ __proto__: null,
18
+ verifyLiveness: ce
19
+ }, Symbol.toStringTag, { value: "Module" }));
20
+ class ue {
21
+ constructor(t) {
22
+ this.models = { face: null, hand: null }, this.webcam = null, this.currentStepRef = 0, this.isStepTransitioningRef = !1, this.timerId = null, this.requestId = null, this.offscreenCanvas = document.createElement("canvas"), this.CHALLENGE_POOL = ["Smile", "Blink", "Turn_Head", "Thumbs_Up"], this.attachVideo = (c) => {
23
+ this.webcam = c, console.log("[LivenessEngine] Video stream attached.");
24
+ }, this.start = () => {
25
+ if (this.state.status !== "ready" || !this.webcam) {
26
+ console.warn("[LivenessEngine] Engine not ready or video missing.");
27
+ return;
28
+ }
29
+ console.log("[LivenessEngine] Session Starting..."), this.state.status = "capturing", this.updateState({ status: "capturing" }), this.startTimer(), this.detectLoop();
30
+ }, this.stop = () => {
31
+ this.timerId && clearInterval(this.timerId), this.requestId && cancelAnimationFrame(this.requestId), this.timerId = null, this.requestId = null;
32
+ }, this.reset = () => {
33
+ this.stop(), this.currentStepRef = 0, this.isStepTransitioningRef = !1, this.generateSequence(), this.updateState({
34
+ status: "ready",
35
+ currentStep: 0,
36
+ timeLeft: this.config.duration,
37
+ isStepTransitioning: !1,
38
+ errorMsg: ""
2729
39
  });
2730
- this.i._addStringVectorToInputSidePacket(r, n);
2731
- });
2732
- }
2733
- attachBoolListener(t, e) {
2734
- wt(this, t, e), g(this, t, (n) => {
2735
- this.i._attachBoolListener(n);
2736
- });
2737
- }
2738
- attachBoolVectorListener(t, e) {
2739
- Rt(this, t, e), g(this, t, (n) => {
2740
- this.i._attachBoolVectorListener(n);
2741
- });
2742
- }
2743
- attachIntListener(t, e) {
2744
- wt(this, t, e), g(this, t, (n) => {
2745
- this.i._attachIntListener(n);
2746
- });
2747
- }
2748
- attachIntVectorListener(t, e) {
2749
- Rt(this, t, e), g(this, t, (n) => {
2750
- this.i._attachIntVectorListener(n);
2751
- });
2752
- }
2753
- attachUintListener(t, e) {
2754
- wt(this, t, e), g(this, t, (n) => {
2755
- this.i._attachUintListener(n);
2756
- });
2757
- }
2758
- attachUintVectorListener(t, e) {
2759
- Rt(this, t, e), g(this, t, (n) => {
2760
- this.i._attachUintVectorListener(n);
2761
- });
2762
- }
2763
- attachDoubleListener(t, e) {
2764
- wt(this, t, e), g(this, t, (n) => {
2765
- this.i._attachDoubleListener(n);
2766
- });
2767
- }
2768
- attachDoubleVectorListener(t, e) {
2769
- Rt(this, t, e), g(this, t, (n) => {
2770
- this.i._attachDoubleVectorListener(n);
2771
- });
2772
- }
2773
- attachFloatListener(t, e) {
2774
- wt(this, t, e), g(this, t, (n) => {
2775
- this.i._attachFloatListener(n);
2776
- });
2777
- }
2778
- attachFloatVectorListener(t, e) {
2779
- Rt(this, t, e), g(this, t, (n) => {
2780
- this.i._attachFloatVectorListener(n);
2781
- });
2782
- }
2783
- attachStringListener(t, e) {
2784
- wt(this, t, e), g(this, t, (n) => {
2785
- this.i._attachStringListener(n);
2786
- });
2787
- }
2788
- attachStringVectorListener(t, e) {
2789
- Rt(this, t, e), g(this, t, (n) => {
2790
- this.i._attachStringVectorListener(n);
2791
- });
2792
- }
2793
- attachProtoListener(t, e, n) {
2794
- wt(this, t, e), g(this, t, (r) => {
2795
- this.i._attachProtoListener(r, n || !1);
2796
- });
2797
- }
2798
- attachProtoVectorListener(t, e, n) {
2799
- Rt(this, t, e), g(this, t, (r) => {
2800
- this.i._attachProtoVectorListener(r, n || !1);
2801
- });
2802
- }
2803
- attachAudioListener(t, e, n) {
2804
- this.i._attachAudioListener || console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'), wt(this, t, (r, s) => {
2805
- r = new Float32Array(r.buffer, r.byteOffset, r.length / 4), e(r, s);
2806
- }), g(this, t, (r) => {
2807
- this.i._attachAudioListener(r, n || !1);
2808
- });
2809
- }
2810
- finishProcessing() {
2811
- this.i._waitUntilIdle();
2812
- }
2813
- closeGraph() {
2814
- this.i._closeGraph(), this.i.simpleListeners = void 0, this.i.emptyPacketListeners = void 0;
2815
- }
2816
- }, class extends oi {
2817
- get ga() {
2818
- return this.i;
2819
- }
2820
- pa(t, e, n) {
2821
- g(this, e, (r) => {
2822
- const [s, i] = ti(this, t, r);
2823
- this.ga._addBoundTextureAsImageToStream(r, s, i, n);
2824
- });
2825
- }
2826
- Z(t, e) {
2827
- wt(this, t, e), g(this, t, (n) => {
2828
- this.ga._attachImageListener(n);
2829
- });
2830
- }
2831
- aa(t, e) {
2832
- Rt(this, t, e), g(this, t, (n) => {
2833
- this.ga._attachImageVectorListener(n);
2834
- });
2835
- }
2836
- }));
2837
- var oi, yt = class extends o1 {
2838
- };
2839
- async function b(t, e, n) {
2840
- return async function(r, s, i, o) {
2841
- return n1(r, s, i, o);
2842
- }(t, n.canvas ?? (ia() ? void 0 : document.createElement("canvas")), e, n);
2843
- }
2844
- function da(t, e, n, r) {
2845
- if (t.U) {
2846
- const i = new No();
2847
- if (n != null && n.regionOfInterest) {
2848
- if (!t.oa) throw Error("This task doesn't support region-of-interest.");
2849
- var s = n.regionOfInterest;
2850
- if (s.left >= s.right || s.top >= s.bottom) throw Error("Expected RectF with left < right and top < bottom.");
2851
- if (s.left < 0 || s.top < 0 || s.right > 1 || s.bottom > 1) throw Error("Expected RectF values to be in [0,1].");
2852
- m(i, 1, (s.left + s.right) / 2), m(i, 2, (s.top + s.bottom) / 2), m(i, 4, s.right - s.left), m(i, 3, s.bottom - s.top);
2853
- } else m(i, 1, 0.5), m(i, 2, 0.5), m(i, 4, 1), m(i, 3, 1);
2854
- if (n != null && n.rotationDegrees) {
2855
- if ((n == null ? void 0 : n.rotationDegrees) % 90 != 0) throw Error("Expected rotation to be a multiple of 90°.");
2856
- if (m(i, 5, -Math.PI * n.rotationDegrees / 180), (n == null ? void 0 : n.rotationDegrees) % 180 != 0) {
2857
- const [o, a] = oa(e);
2858
- n = C(i, 3) * a / o, s = C(i, 4) * o / a, m(i, 4, n), m(i, 3, s);
2859
- }
2860
- }
2861
- t.g.addProtoToStream(i.g(), "mediapipe.NormalizedRect", t.U, r);
2862
- }
2863
- t.g.pa(e, t.X, r ?? performance.now()), t.finishProcessing();
2864
- }
2865
- function vt(t, e, n) {
2866
- var r;
2867
- if ((r = t.baseOptions) != null && r.g()) throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");
2868
- da(t, e, n, t.C + 1);
2869
- }
2870
- function Ft(t, e, n, r) {
2871
- var s;
2872
- if (!((s = t.baseOptions) != null && s.g())) throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");
2873
- da(t, e, n, r);
2874
- }
2875
- function be(t, e, n, r) {
2876
- var s = e.data;
2877
- const i = e.width, o = i * (e = e.height);
2878
- if ((s instanceof Uint8Array || s instanceof Float32Array) && s.length !== o) throw Error("Unsupported channel count: " + s.length / o);
2879
- return t = new H([s], n, !1, t.g.i.canvas, t.P, i, e), r ? t.clone() : t;
2880
- }
2881
- var at = class extends cr {
2882
- constructor(t, e, n, r) {
2883
- super(t), this.g = t, this.X = e, this.U = n, this.oa = r, this.P = new ha();
2884
- }
2885
- l(t, e = !0) {
2886
- if ("runningMode" in t && k(this.baseOptions, 2, Ke(!!t.runningMode && t.runningMode !== "IMAGE")), t.canvas !== void 0 && this.g.i.canvas !== t.canvas) throw Error("You must create a new task to reset the canvas.");
2887
- return super.l(t, e);
2888
- }
2889
- close() {
2890
- this.P.close(), super.close();
2891
- }
2892
- };
2893
- at.prototype.close = at.prototype.close;
2894
- var ut = class extends at {
2895
- constructor(t, e) {
2896
- super(new yt(t, e), "image_in", "norm_rect_in", !1), this.j = { detections: [] }, _(t = this.h = new Nn(), 0, 1, e = new I()), m(this.h, 2, 0.5), m(this.h, 3, 0.3);
2897
- }
2898
- get baseOptions() {
2899
- return A(this.h, I, 1);
2900
- }
2901
- set baseOptions(t) {
2902
- _(this.h, 0, 1, t);
2903
- }
2904
- o(t) {
2905
- return "minDetectionConfidence" in t && m(this.h, 2, t.minDetectionConfidence ?? 0.5), "minSuppressionThreshold" in t && m(this.h, 3, t.minSuppressionThreshold ?? 0.3), this.l(t);
2906
- }
2907
- F(t, e) {
2908
- return this.j = { detections: [] }, vt(this, t, e), this.j;
2909
- }
2910
- G(t, e, n) {
2911
- return this.j = { detections: [] }, Ft(this, t, n, e), this.j;
2912
- }
2913
- m() {
2914
- var t = new ht();
2915
- O(t, "image_in"), O(t, "norm_rect_in"), E(t, "detections");
2916
- const e = new ct();
2917
- Tt(e, G2, this.h);
2918
- const n = new Z();
2919
- it(n, 2, "mediapipe.tasks.vision.face_detector.FaceDetectorGraph"), F(n, "IMAGE:image_in"), F(n, "NORM_RECT:norm_rect_in"), w(n, "DETECTIONS:detections"), n.o(e), gt(t, n), this.g.attachProtoVectorListener("detections", (r, s) => {
2920
- for (const i of r) r = Oo(i), this.j.detections.push(ra(r));
2921
- l(this, s);
2922
- }), this.g.attachEmptyPacketListener("detections", (r) => {
2923
- l(this, r);
2924
- }), t = t.g(), this.setGraph(new Uint8Array(t), !0);
2925
- }
2926
- };
2927
- ut.prototype.detectForVideo = ut.prototype.G, ut.prototype.detect = ut.prototype.F, ut.prototype.setOptions = ut.prototype.o, ut.createFromModelPath = async function(t, e) {
2928
- return b(ut, t, { baseOptions: { modelAssetPath: e } });
2929
- }, ut.createFromModelBuffer = function(t, e) {
2930
- return b(ut, t, { baseOptions: { modelAssetBuffer: e } });
2931
- }, ut.createFromOptions = function(t, e) {
2932
- return b(ut, t, e);
2933
- };
2934
- var rs = _t([61, 146], [146, 91], [91, 181], [181, 84], [84, 17], [17, 314], [314, 405], [405, 321], [321, 375], [375, 291], [61, 185], [185, 40], [40, 39], [39, 37], [37, 0], [0, 267], [267, 269], [269, 270], [270, 409], [409, 291], [78, 95], [95, 88], [88, 178], [178, 87], [87, 14], [14, 317], [317, 402], [402, 318], [318, 324], [324, 308], [78, 191], [191, 80], [80, 81], [81, 82], [82, 13], [13, 312], [312, 311], [311, 310], [310, 415], [415, 308]), ss = _t([263, 249], [249, 390], [390, 373], [373, 374], [374, 380], [380, 381], [381, 382], [382, 362], [263, 466], [466, 388], [388, 387], [387, 386], [386, 385], [385, 384], [384, 398], [398, 362]), is = _t([276, 283], [283, 282], [282, 295], [295, 285], [300, 293], [293, 334], [334, 296], [296, 336]), pa = _t([474, 475], [475, 476], [476, 477], [477, 474]), os = _t([33, 7], [7, 163], [163, 144], [144, 145], [145, 153], [153, 154], [154, 155], [155, 133], [33, 246], [246, 161], [161, 160], [160, 159], [159, 158], [158, 157], [157, 173], [173, 133]), as = _t([46, 53], [53, 52], [52, 65], [65, 55], [70, 63], [63, 105], [105, 66], [66, 107]), ga = _t([469, 470], [470, 471], [471, 472], [472, 469]), cs = _t([10, 338], [338, 297], [297, 332], [332, 284], [284, 251], [251, 389], [389, 356], [356, 454], [454, 323], [323, 361], [361, 288], [288, 397], [397, 365], [365, 379], [379, 378], [378, 400], [400, 377], [377, 152], [152, 148], [148, 176], [176, 149], [149, 150], [150, 136], [136, 172], [172, 58], [58, 132], [132, 93], [93, 234], [234, 127], [127, 162], [162, 21], [21, 54], [54, 103], [103, 67], [67, 109], [109, 10]), ma = [...rs, ...ss, ...is, ...os, ...as, ...cs], _a = _t([127, 34], [34, 139], [139, 127], [11, 0], [0, 37], [37, 11], [232, 231], [231, 120], [120, 232], [72, 37], [37, 39], [39, 72], [128, 121], [121, 47], [47, 128], [232, 121], [121, 128], [128, 232], [104, 69], [69, 67], [67, 104], [175, 171], [171, 148], [148, 175], [118, 50], [50, 101], [101, 118], [73, 39], [39, 40], [40, 73], [9, 151], [151, 108], [108, 9], [48, 115], [115, 131], [131, 48], [194, 204], [204, 211], [211, 194], [74, 40], [40, 185], [185, 74], [80, 42], [42, 183], [183, 80], [40, 92], [92, 186], [186, 40], [230, 229], [229, 118], [118, 230], [202, 212], [212, 214], [214, 202], [83, 18], [18, 17], [17, 83], [76, 61], [61, 146], [146, 76], [160, 29], [29, 30], [30, 160], [56, 157], [157, 173], [173, 56], [106, 204], [204, 194], [194, 106], [135, 214], [214, 192], [192, 135], [203, 165], [165, 98], [98, 203], [21, 71], [71, 68], [68, 21], [51, 45], [45, 4], [4, 51], [144, 24], [24, 23], [23, 144], [77, 146], [146, 91], [91, 77], [205, 50], [50, 187], [187, 205], [201, 200], [200, 18], [18, 201], [91, 106], [106, 182], [182, 91], [90, 91], [91, 181], [181, 90], [85, 84], [84, 17], [17, 85], [206, 203], [203, 36], [36, 206], [148, 171], [171, 140], [140, 148], [92, 40], [40, 39], [39, 92], [193, 189], [189, 244], [244, 193], [159, 158], [158, 28], [28, 159], [247, 246], [246, 161], [161, 247], [236, 3], [3, 196], [196, 236], [54, 68], [68, 104], [104, 54], [193, 168], [168, 8], [8, 193], [117, 228], [228, 31], [31, 117], [189, 193], [193, 55], [55, 189], [98, 97], [97, 99], [99, 98], [126, 47], [47, 100], [100, 126], [166, 79], [79, 218], [218, 166], [155, 154], [154, 26], [26, 155], [209, 49], [49, 131], [131, 209], [135, 136], [136, 150], [150, 135], [47, 126], [126, 217], [217, 47], [223, 52], [52, 53], [53, 223], [45, 51], [51, 134], [134, 45], [211, 170], [170, 140], [140, 211], [67, 69], [69, 108], [108, 67], [43, 106], [106, 91], [91, 43], [230, 119], [119, 120], [120, 230], [226, 130], [130, 247], [247, 226], [63, 53], [53, 52], [52, 63], [238, 20], [20, 242], [242, 238], [46, 70], [70, 156], [156, 46], [78, 62], [62, 96], [96, 78], [46, 53], [53, 63], [63, 46], [143, 34], [34, 227], [227, 143], [123, 117], [117, 111], [111, 123], [44, 125], [125, 19], [19, 44], [236, 134], [134, 51], [51, 236], [216, 206], [206, 205], [205, 216], [154, 153], [153, 22], [22, 154], [39, 37], [37, 167], [167, 39], [200, 201], [201, 208], [208, 200], [36, 142], [142, 100], [100, 36], [57, 212], [212, 202], [202, 57], [20, 60], [60, 99], [99, 20], [28, 158], [158, 157], [157, 28], [35, 226], [226, 113], [113, 35], [160, 159], [159, 27], [27, 160], [204, 202], [202, 210], [210, 204], [113, 225], [225, 46], [46, 113], [43, 202], [202, 204], [204, 43], [62, 76], [76, 77], [77, 62], [137, 123], [123, 116], [116, 137], [41, 38], [38, 72], [72, 41], [203, 129], [129, 142], [142, 203], [64, 98], [98, 240], [240, 64], [49, 102], [102, 64], [64, 49], [41, 73], [73, 74], [74, 41], [212, 216], [216, 207], [207, 212], [42, 74], [74, 184], [184, 42], [169, 170], [170, 211], [211, 169], [170, 149], [149, 176], [176, 170], [105, 66], [66, 69], [69, 105], [122, 6], [6, 168], [168, 122], [123, 147], [147, 187], [187, 123], [96, 77], [77, 90], [90, 96], [65, 55], [55, 107], [107, 65], [89, 90], [90, 180], [180, 89], [101, 100], [100, 120], [120, 101], [63, 105], [105, 104], [104, 63], [93, 137], [137, 227], [227, 93], [15, 86], [86, 85], [85, 15], [129, 102], [102, 49], [49, 129], [14, 87], [87, 86], [86, 14], [55, 8], [8, 9], [9, 55], [100, 47], [47, 121], [121, 100], [145, 23], [23, 22], [22, 145], [88, 89], [89, 179], [179, 88], [6, 122], [122, 196], [196, 6], [88, 95], [95, 96], [96, 88], [138, 172], [172, 136], [136, 138], [215, 58], [58, 172], [172, 215], [115, 48], [48, 219], [219, 115], [42, 80], [80, 81], [81, 42], [195, 3], [3, 51], [51, 195], [43, 146], [146, 61], [61, 43], [171, 175], [175, 199], [199, 171], [81, 82], [82, 38], [38, 81], [53, 46], [46, 225], [225, 53], [144, 163], [163, 110], [110, 144], [52, 65], [65, 66], [66, 52], [229, 228], [228, 117], [117, 229], [34, 127], [127, 234], [234, 34], [107, 108], [108, 69], [69, 107], [109, 108], [108, 151], [151, 109], [48, 64], [64, 235], [235, 48], [62, 78], [78, 191], [191, 62], [129, 209], [209, 126], [126, 129], [111, 35], [35, 143], [143, 111], [117, 123], [123, 50], [50, 117], [222, 65], [65, 52], [52, 222], [19, 125], [125, 141], [141, 19], [221, 55], [55, 65], [65, 221], [3, 195], [195, 197], [197, 3], [25, 7], [7, 33], [33, 25], [220, 237], [237, 44], [44, 220], [70, 71], [71, 139], [139, 70], [122, 193], [193, 245], [245, 122], [247, 130], [130, 33], [33, 247], [71, 21], [21, 162], [162, 71], [170, 169], [169, 150], [150, 170], [188, 174], [174, 196], [196, 188], [216, 186], [186, 92], [92, 216], [2, 97], [97, 167], [167, 2], [141, 125], [125, 241], [241, 141], [164, 167], [167, 37], [37, 164], [72, 38], [38, 12], [12, 72], [38, 82], [82, 13], [13, 38], [63, 68], [68, 71], [71, 63], [226, 35], [35, 111], [111, 226], [101, 50], [50, 205], [205, 101], [206, 92], [92, 165], [165, 206], [209, 198], [198, 217], [217, 209], [165, 167], [167, 97], [97, 165], [220, 115], [115, 218], [218, 220], [133, 112], [112, 243], [243, 133], [239, 238], [238, 241], [241, 239], [214, 135], [135, 169], [169, 214], [190, 173], [173, 133], [133, 190], [171, 208], [208, 32], [32, 171], [125, 44], [44, 237], [237, 125], [86, 87], [87, 178], [178, 86], [85, 86], [86, 179], [179, 85], [84, 85], [85, 180], [180, 84], [83, 84], [84, 181], [181, 83], [201, 83], [83, 182], [182, 201], [137, 93], [93, 132], [132, 137], [76, 62], [62, 183], [183, 76], [61, 76], [76, 184], [184, 61], [57, 61], [61, 185], [185, 57], [212, 57], [57, 186], [186, 212], [214, 207], [207, 187], [187, 214], [34, 143], [143, 156], [156, 34], [79, 239], [239, 237], [237, 79], [123, 137], [137, 177], [177, 123], [44, 1], [1, 4], [4, 44], [201, 194], [194, 32], [32, 201], [64, 102], [102, 129], [129, 64], [213, 215], [215, 138], [138, 213], [59, 166], [166, 219], [219, 59], [242, 99], [99, 97], [97, 242], [2, 94], [94, 141], [141, 2], [75, 59], [59, 235], [235, 75], [24, 110], [110, 228], [228, 24], [25, 130], [130, 226], [226, 25], [23, 24], [24, 229], [229, 23], [22, 23], [23, 230], [230, 22], [26, 22], [22, 231], [231, 26], [112, 26], [26, 232], [232, 112], [189, 190], [190, 243], [243, 189], [221, 56], [56, 190], [190, 221], [28, 56], [56, 221], [221, 28], [27, 28], [28, 222], [222, 27], [29, 27], [27, 223], [223, 29], [30, 29], [29, 224], [224, 30], [247, 30], [30, 225], [225, 247], [238, 79], [79, 20], [20, 238], [166, 59], [59, 75], [75, 166], [60, 75], [75, 240], [240, 60], [147, 177], [177, 215], [215, 147], [20, 79], [79, 166], [166, 20], [187, 147], [147, 213], [213, 187], [112, 233], [233, 244], [244, 112], [233, 128], [128, 245], [245, 233], [128, 114], [114, 188], [188, 128], [114, 217], [217, 174], [174, 114], [131, 115], [115, 220], [220, 131], [217, 198], [198, 236], [236, 217], [198, 131], [131, 134], [134, 198], [177, 132], [132, 58], [58, 177], [143, 35], [35, 124], [124, 143], [110, 163], [163, 7], [7, 110], [228, 110], [110, 25], [25, 228], [356, 389], [389, 368], [368, 356], [11, 302], [302, 267], [267, 11], [452, 350], [350, 349], [349, 452], [302, 303], [303, 269], [269, 302], [357, 343], [343, 277], [277, 357], [452, 453], [453, 357], [357, 452], [333, 332], [332, 297], [297, 333], [175, 152], [152, 377], [377, 175], [347, 348], [348, 330], [330, 347], [303, 304], [304, 270], [270, 303], [9, 336], [336, 337], [337, 9], [278, 279], [279, 360], [360, 278], [418, 262], [262, 431], [431, 418], [304, 408], [408, 409], [409, 304], [310, 415], [415, 407], [407, 310], [270, 409], [409, 410], [410, 270], [450, 348], [348, 347], [347, 450], [422, 430], [430, 434], [434, 422], [313, 314], [314, 17], [17, 313], [306, 307], [307, 375], [375, 306], [387, 388], [388, 260], [260, 387], [286, 414], [414, 398], [398, 286], [335, 406], [406, 418], [418, 335], [364, 367], [367, 416], [416, 364], [423, 358], [358, 327], [327, 423], [251, 284], [284, 298], [298, 251], [281, 5], [5, 4], [4, 281], [373, 374], [374, 253], [253, 373], [307, 320], [320, 321], [321, 307], [425, 427], [427, 411], [411, 425], [421, 313], [313, 18], [18, 421], [321, 405], [405, 406], [406, 321], [320, 404], [404, 405], [405, 320], [315, 16], [16, 17], [17, 315], [426, 425], [425, 266], [266, 426], [377, 400], [400, 369], [369, 377], [322, 391], [391, 269], [269, 322], [417, 465], [465, 464], [464, 417], [386, 257], [257, 258], [258, 386], [466, 260], [260, 388], [388, 466], [456, 399], [399, 419], [419, 456], [284, 332], [332, 333], [333, 284], [417, 285], [285, 8], [8, 417], [346, 340], [340, 261], [261, 346], [413, 441], [441, 285], [285, 413], [327, 460], [460, 328], [328, 327], [355, 371], [371, 329], [329, 355], [392, 439], [439, 438], [438, 392], [382, 341], [341, 256], [256, 382], [429, 420], [420, 360], [360, 429], [364, 394], [394, 379], [379, 364], [277, 343], [343, 437], [437, 277], [443, 444], [444, 283], [283, 443], [275, 440], [440, 363], [363, 275], [431, 262], [262, 369], [369, 431], [297, 338], [338, 337], [337, 297], [273, 375], [375, 321], [321, 273], [450, 451], [451, 349], [349, 450], [446, 342], [342, 467], [467, 446], [293, 334], [334, 282], [282, 293], [458, 461], [461, 462], [462, 458], [276, 353], [353, 383], [383, 276], [308, 324], [324, 325], [325, 308], [276, 300], [300, 293], [293, 276], [372, 345], [345, 447], [447, 372], [352, 345], [345, 340], [340, 352], [274, 1], [1, 19], [19, 274], [456, 248], [248, 281], [281, 456], [436, 427], [427, 425], [425, 436], [381, 256], [256, 252], [252, 381], [269, 391], [391, 393], [393, 269], [200, 199], [199, 428], [428, 200], [266, 330], [330, 329], [329, 266], [287, 273], [273, 422], [422, 287], [250, 462], [462, 328], [328, 250], [258, 286], [286, 384], [384, 258], [265, 353], [353, 342], [342, 265], [387, 259], [259, 257], [257, 387], [424, 431], [431, 430], [430, 424], [342, 353], [353, 276], [276, 342], [273, 335], [335, 424], [424, 273], [292, 325], [325, 307], [307, 292], [366, 447], [447, 345], [345, 366], [271, 303], [303, 302], [302, 271], [423, 266], [266, 371], [371, 423], [294, 455], [455, 460], [460, 294], [279, 278], [278, 294], [294, 279], [271, 272], [272, 304], [304, 271], [432, 434], [434, 427], [427, 432], [272, 407], [407, 408], [408, 272], [394, 430], [430, 431], [431, 394], [395, 369], [369, 400], [400, 395], [334, 333], [333, 299], [299, 334], [351, 417], [417, 168], [168, 351], [352, 280], [280, 411], [411, 352], [325, 319], [319, 320], [320, 325], [295, 296], [296, 336], [336, 295], [319, 403], [403, 404], [404, 319], [330, 348], [348, 349], [349, 330], [293, 298], [298, 333], [333, 293], [323, 454], [454, 447], [447, 323], [15, 16], [16, 315], [315, 15], [358, 429], [429, 279], [279, 358], [14, 15], [15, 316], [316, 14], [285, 336], [336, 9], [9, 285], [329, 349], [349, 350], [350, 329], [374, 380], [380, 252], [252, 374], [318, 402], [402, 403], [403, 318], [6, 197], [197, 419], [419, 6], [318, 319], [319, 325], [325, 318], [367, 364], [364, 365], [365, 367], [435, 367], [367, 397], [397, 435], [344, 438], [438, 439], [439, 344], [272, 271], [271, 311], [311, 272], [195, 5], [5, 281], [281, 195], [273, 287], [287, 291], [291, 273], [396, 428], [428, 199], [199, 396], [311, 271], [271, 268], [268, 311], [283, 444], [444, 445], [445, 283], [373, 254], [254, 339], [339, 373], [282, 334], [334, 296], [296, 282], [449, 347], [347, 346], [346, 449], [264, 447], [447, 454], [454, 264], [336, 296], [296, 299], [299, 336], [338, 10], [10, 151], [151, 338], [278, 439], [439, 455], [455, 278], [292, 407], [407, 415], [415, 292], [358, 371], [371, 355], [355, 358], [340, 345], [345, 372], [372, 340], [346, 347], [347, 280], [280, 346], [442, 443], [443, 282], [282, 442], [19, 94], [94, 370], [370, 19], [441, 442], [442, 295], [295, 441], [248, 419], [419, 197], [197, 248], [263, 255], [255, 359], [359, 263], [440, 275], [275, 274], [274, 440], [300, 383], [383, 368], [368, 300], [351, 412], [412, 465], [465, 351], [263, 467], [467, 466], [466, 263], [301, 368], [368, 389], [389, 301], [395, 378], [378, 379], [379, 395], [412, 351], [351, 419], [419, 412], [436, 426], [426, 322], [322, 436], [2, 164], [164, 393], [393, 2], [370, 462], [462, 461], [461, 370], [164, 0], [0, 267], [267, 164], [302, 11], [11, 12], [12, 302], [268, 12], [12, 13], [13, 268], [293, 300], [300, 301], [301, 293], [446, 261], [261, 340], [340, 446], [330, 266], [266, 425], [425, 330], [426, 423], [423, 391], [391, 426], [429, 355], [355, 437], [437, 429], [391, 327], [327, 326], [326, 391], [440, 457], [457, 438], [438, 440], [341, 382], [382, 362], [362, 341], [459, 457], [457, 461], [461, 459], [434, 430], [430, 394], [394, 434], [414, 463], [463, 362], [362, 414], [396, 369], [369, 262], [262, 396], [354, 461], [461, 457], [457, 354], [316, 403], [403, 402], [402, 316], [315, 404], [404, 403], [403, 315], [314, 405], [405, 404], [404, 314], [313, 406], [406, 405], [405, 313], [421, 418], [418, 406], [406, 421], [366, 401], [401, 361], [361, 366], [306, 408], [408, 407], [407, 306], [291, 409], [409, 408], [408, 291], [287, 410], [410, 409], [409, 287], [432, 436], [436, 410], [410, 432], [434, 416], [416, 411], [411, 434], [264, 368], [368, 383], [383, 264], [309, 438], [438, 457], [457, 309], [352, 376], [376, 401], [401, 352], [274, 275], [275, 4], [4, 274], [421, 428], [428, 262], [262, 421], [294, 327], [327, 358], [358, 294], [433, 416], [416, 367], [367, 433], [289, 455], [455, 439], [439, 289], [462, 370], [370, 326], [326, 462], [2, 326], [326, 370], [370, 2], [305, 460], [460, 455], [455, 305], [254, 449], [449, 448], [448, 254], [255, 261], [261, 446], [446, 255], [253, 450], [450, 449], [449, 253], [252, 451], [451, 450], [450, 252], [256, 452], [452, 451], [451, 256], [341, 453], [453, 452], [452, 341], [413, 464], [464, 463], [463, 413], [441, 413], [413, 414], [414, 441], [258, 442], [442, 441], [441, 258], [257, 443], [443, 442], [442, 257], [259, 444], [444, 443], [443, 259], [260, 445], [445, 444], [444, 260], [467, 342], [342, 445], [445, 467], [459, 458], [458, 250], [250, 459], [289, 392], [392, 290], [290, 289], [290, 328], [328, 460], [460, 290], [376, 433], [433, 435], [435, 376], [250, 290], [290, 392], [392, 250], [411, 416], [416, 433], [433, 411], [341, 463], [463, 464], [464, 341], [453, 464], [464, 465], [465, 453], [357, 465], [465, 412], [412, 357], [343, 412], [412, 399], [399, 343], [360, 363], [363, 440], [440, 360], [437, 399], [399, 456], [456, 437], [420, 456], [456, 363], [363, 420], [401, 435], [435, 288], [288, 401], [372, 383], [383, 353], [353, 372], [339, 255], [255, 249], [249, 339], [448, 261], [261, 255], [255, 448], [133, 243], [243, 190], [190, 133], [133, 155], [155, 112], [112, 133], [33, 246], [246, 247], [247, 33], [33, 130], [130, 25], [25, 33], [398, 384], [384, 286], [286, 398], [362, 398], [398, 414], [414, 362], [362, 463], [463, 341], [341, 362], [263, 359], [359, 467], [467, 263], [263, 249], [249, 255], [255, 263], [466, 467], [467, 260], [260, 466], [75, 60], [60, 166], [166, 75], [238, 239], [239, 79], [79, 238], [162, 127], [127, 139], [139, 162], [72, 11], [11, 37], [37, 72], [121, 232], [232, 120], [120, 121], [73, 72], [72, 39], [39, 73], [114, 128], [128, 47], [47, 114], [233, 232], [232, 128], [128, 233], [103, 104], [104, 67], [67, 103], [152, 175], [175, 148], [148, 152], [119, 118], [118, 101], [101, 119], [74, 73], [73, 40], [40, 74], [107, 9], [9, 108], [108, 107], [49, 48], [48, 131], [131, 49], [32, 194], [194, 211], [211, 32], [184, 74], [74, 185], [185, 184], [191, 80], [80, 183], [183, 191], [185, 40], [40, 186], [186, 185], [119, 230], [230, 118], [118, 119], [210, 202], [202, 214], [214, 210], [84, 83], [83, 17], [17, 84], [77, 76], [76, 146], [146, 77], [161, 160], [160, 30], [30, 161], [190, 56], [56, 173], [173, 190], [182, 106], [106, 194], [194, 182], [138, 135], [135, 192], [192, 138], [129, 203], [203, 98], [98, 129], [54, 21], [21, 68], [68, 54], [5, 51], [51, 4], [4, 5], [145, 144], [144, 23], [23, 145], [90, 77], [77, 91], [91, 90], [207, 205], [205, 187], [187, 207], [83, 201], [201, 18], [18, 83], [181, 91], [91, 182], [182, 181], [180, 90], [90, 181], [181, 180], [16, 85], [85, 17], [17, 16], [205, 206], [206, 36], [36, 205], [176, 148], [148, 140], [140, 176], [165, 92], [92, 39], [39, 165], [245, 193], [193, 244], [244, 245], [27, 159], [159, 28], [28, 27], [30, 247], [247, 161], [161, 30], [174, 236], [236, 196], [196, 174], [103, 54], [54, 104], [104, 103], [55, 193], [193, 8], [8, 55], [111, 117], [117, 31], [31, 111], [221, 189], [189, 55], [55, 221], [240, 98], [98, 99], [99, 240], [142, 126], [126, 100], [100, 142], [219, 166], [166, 218], [218, 219], [112, 155], [155, 26], [26, 112], [198, 209], [209, 131], [131, 198], [169, 135], [135, 150], [150, 169], [114, 47], [47, 217], [217, 114], [224, 223], [223, 53], [53, 224], [220, 45], [45, 134], [134, 220], [32, 211], [211, 140], [140, 32], [109, 67], [67, 108], [108, 109], [146, 43], [43, 91], [91, 146], [231, 230], [230, 120], [120, 231], [113, 226], [226, 247], [247, 113], [105, 63], [63, 52], [52, 105], [241, 238], [238, 242], [242, 241], [124, 46], [46, 156], [156, 124], [95, 78], [78, 96], [96, 95], [70, 46], [46, 63], [63, 70], [116, 143], [143, 227], [227, 116], [116, 123], [123, 111], [111, 116], [1, 44], [44, 19], [19, 1], [3, 236], [236, 51], [51, 3], [207, 216], [216, 205], [205, 207], [26, 154], [154, 22], [22, 26], [165, 39], [39, 167], [167, 165], [199, 200], [200, 208], [208, 199], [101, 36], [36, 100], [100, 101], [43, 57], [57, 202], [202, 43], [242, 20], [20, 99], [99, 242], [56, 28], [28, 157], [157, 56], [124, 35], [35, 113], [113, 124], [29, 160], [160, 27], [27, 29], [211, 204], [204, 210], [210, 211], [124, 113], [113, 46], [46, 124], [106, 43], [43, 204], [204, 106], [96, 62], [62, 77], [77, 96], [227, 137], [137, 116], [116, 227], [73, 41], [41, 72], [72, 73], [36, 203], [203, 142], [142, 36], [235, 64], [64, 240], [240, 235], [48, 49], [49, 64], [64, 48], [42, 41], [41, 74], [74, 42], [214, 212], [212, 207], [207, 214], [183, 42], [42, 184], [184, 183], [210, 169], [169, 211], [211, 210], [140, 170], [170, 176], [176, 140], [104, 105], [105, 69], [69, 104], [193, 122], [122, 168], [168, 193], [50, 123], [123, 187], [187, 50], [89, 96], [96, 90], [90, 89], [66, 65], [65, 107], [107, 66], [179, 89], [89, 180], [180, 179], [119, 101], [101, 120], [120, 119], [68, 63], [63, 104], [104, 68], [234, 93], [93, 227], [227, 234], [16, 15], [15, 85], [85, 16], [209, 129], [129, 49], [49, 209], [15, 14], [14, 86], [86, 15], [107, 55], [55, 9], [9, 107], [120, 100], [100, 121], [121, 120], [153, 145], [145, 22], [22, 153], [178, 88], [88, 179], [179, 178], [197, 6], [6, 196], [196, 197], [89, 88], [88, 96], [96, 89], [135, 138], [138, 136], [136, 135], [138, 215], [215, 172], [172, 138], [218, 115], [115, 219], [219, 218], [41, 42], [42, 81], [81, 41], [5, 195], [195, 51], [51, 5], [57, 43], [43, 61], [61, 57], [208, 171], [171, 199], [199, 208], [41, 81], [81, 38], [38, 41], [224, 53], [53, 225], [225, 224], [24, 144], [144, 110], [110, 24], [105, 52], [52, 66], [66, 105], [118, 229], [229, 117], [117, 118], [227, 34], [34, 234], [234, 227], [66, 107], [107, 69], [69, 66], [10, 109], [109, 151], [151, 10], [219, 48], [48, 235], [235, 219], [183, 62], [62, 191], [191, 183], [142, 129], [129, 126], [126, 142], [116, 111], [111, 143], [143, 116], [118, 117], [117, 50], [50, 118], [223, 222], [222, 52], [52, 223], [94, 19], [19, 141], [141, 94], [222, 221], [221, 65], [65, 222], [196, 3], [3, 197], [197, 196], [45, 220], [220, 44], [44, 45], [156, 70], [70, 139], [139, 156], [188, 122], [122, 245], [245, 188], [139, 71], [71, 162], [162, 139], [149, 170], [170, 150], [150, 149], [122, 188], [188, 196], [196, 122], [206, 216], [216, 92], [92, 206], [164, 2], [2, 167], [167, 164], [242, 141], [141, 241], [241, 242], [0, 164], [164, 37], [37, 0], [11, 72], [72, 12], [12, 11], [12, 38], [38, 13], [13, 12], [70, 63], [63, 71], [71, 70], [31, 226], [226, 111], [111, 31], [36, 101], [101, 205], [205, 36], [203, 206], [206, 165], [165, 203], [126, 209], [209, 217], [217, 126], [98, 165], [165, 97], [97, 98], [237, 220], [220, 218], [218, 237], [237, 239], [239, 241], [241, 237], [210, 214], [214, 169], [169, 210], [140, 171], [171, 32], [32, 140], [241, 125], [125, 237], [237, 241], [179, 86], [86, 178], [178, 179], [180, 85], [85, 179], [179, 180], [181, 84], [84, 180], [180, 181], [182, 83], [83, 181], [181, 182], [194, 201], [201, 182], [182, 194], [177, 137], [137, 132], [132, 177], [184, 76], [76, 183], [183, 184], [185, 61], [61, 184], [184, 185], [186, 57], [57, 185], [185, 186], [216, 212], [212, 186], [186, 216], [192, 214], [214, 187], [187, 192], [139, 34], [34, 156], [156, 139], [218, 79], [79, 237], [237, 218], [147, 123], [123, 177], [177, 147], [45, 44], [44, 4], [4, 45], [208, 201], [201, 32], [32, 208], [98, 64], [64, 129], [129, 98], [192, 213], [213, 138], [138, 192], [235, 59], [59, 219], [219, 235], [141, 242], [242, 97], [97, 141], [97, 2], [2, 141], [141, 97], [240, 75], [75, 235], [235, 240], [229, 24], [24, 228], [228, 229], [31, 25], [25, 226], [226, 31], [230, 23], [23, 229], [229, 230], [231, 22], [22, 230], [230, 231], [232, 26], [26, 231], [231, 232], [233, 112], [112, 232], [232, 233], [244, 189], [189, 243], [243, 244], [189, 221], [221, 190], [190, 189], [222, 28], [28, 221], [221, 222], [223, 27], [27, 222], [222, 223], [224, 29], [29, 223], [223, 224], [225, 30], [30, 224], [224, 225], [113, 247], [247, 225], [225, 113], [99, 60], [60, 240], [240, 99], [213, 147], [147, 215], [215, 213], [60, 20], [20, 166], [166, 60], [192, 187], [187, 213], [213, 192], [243, 112], [112, 244], [244, 243], [244, 233], [233, 245], [245, 244], [245, 128], [128, 188], [188, 245], [188, 114], [114, 174], [174, 188], [134, 131], [131, 220], [220, 134], [174, 217], [217, 236], [236, 174], [236, 198], [198, 134], [134, 236], [215, 177], [177, 58], [58, 215], [156, 143], [143, 124], [124, 156], [25, 110], [110, 7], [7, 25], [31, 228], [228, 25], [25, 31], [264, 356], [356, 368], [368, 264], [0, 11], [11, 267], [267, 0], [451, 452], [452, 349], [349, 451], [267, 302], [302, 269], [269, 267], [350, 357], [357, 277], [277, 350], [350, 452], [452, 357], [357, 350], [299, 333], [333, 297], [297, 299], [396, 175], [175, 377], [377, 396], [280, 347], [347, 330], [330, 280], [269, 303], [303, 270], [270, 269], [151, 9], [9, 337], [337, 151], [344, 278], [278, 360], [360, 344], [424, 418], [418, 431], [431, 424], [270, 304], [304, 409], [409, 270], [272, 310], [310, 407], [407, 272], [322, 270], [270, 410], [410, 322], [449, 450], [450, 347], [347, 449], [432, 422], [422, 434], [434, 432], [18, 313], [313, 17], [17, 18], [291, 306], [306, 375], [375, 291], [259, 387], [387, 260], [260, 259], [424, 335], [335, 418], [418, 424], [434, 364], [364, 416], [416, 434], [391, 423], [423, 327], [327, 391], [301, 251], [251, 298], [298, 301], [275, 281], [281, 4], [4, 275], [254, 373], [373, 253], [253, 254], [375, 307], [307, 321], [321, 375], [280, 425], [425, 411], [411, 280], [200, 421], [421, 18], [18, 200], [335, 321], [321, 406], [406, 335], [321, 320], [320, 405], [405, 321], [314, 315], [315, 17], [17, 314], [423, 426], [426, 266], [266, 423], [396, 377], [377, 369], [369, 396], [270, 322], [322, 269], [269, 270], [413, 417], [417, 464], [464, 413], [385, 386], [386, 258], [258, 385], [248, 456], [456, 419], [419, 248], [298, 284], [284, 333], [333, 298], [168, 417], [417, 8], [8, 168], [448, 346], [346, 261], [261, 448], [417, 413], [413, 285], [285, 417], [326, 327], [327, 328], [328, 326], [277, 355], [355, 329], [329, 277], [309, 392], [392, 438], [438, 309], [381, 382], [382, 256], [256, 381], [279, 429], [429, 360], [360, 279], [365, 364], [364, 379], [379, 365], [355, 277], [277, 437], [437, 355], [282, 443], [443, 283], [283, 282], [281, 275], [275, 363], [363, 281], [395, 431], [431, 369], [369, 395], [299, 297], [297, 337], [337, 299], [335, 273], [273, 321], [321, 335], [348, 450], [450, 349], [349, 348], [359, 446], [446, 467], [467, 359], [283, 293], [293, 282], [282, 283], [250, 458], [458, 462], [462, 250], [300, 276], [276, 383], [383, 300], [292, 308], [308, 325], [325, 292], [283, 276], [276, 293], [293, 283], [264, 372], [372, 447], [447, 264], [346, 352], [352, 340], [340, 346], [354, 274], [274, 19], [19, 354], [363, 456], [456, 281], [281, 363], [426, 436], [436, 425], [425, 426], [380, 381], [381, 252], [252, 380], [267, 269], [269, 393], [393, 267], [421, 200], [200, 428], [428, 421], [371, 266], [266, 329], [329, 371], [432, 287], [287, 422], [422, 432], [290, 250], [250, 328], [328, 290], [385, 258], [258, 384], [384, 385], [446, 265], [265, 342], [342, 446], [386, 387], [387, 257], [257, 386], [422, 424], [424, 430], [430, 422], [445, 342], [342, 276], [276, 445], [422, 273], [273, 424], [424, 422], [306, 292], [292, 307], [307, 306], [352, 366], [366, 345], [345, 352], [268, 271], [271, 302], [302, 268], [358, 423], [423, 371], [371, 358], [327, 294], [294, 460], [460, 327], [331, 279], [279, 294], [294, 331], [303, 271], [271, 304], [304, 303], [436, 432], [432, 427], [427, 436], [304, 272], [272, 408], [408, 304], [395, 394], [394, 431], [431, 395], [378, 395], [395, 400], [400, 378], [296, 334], [334, 299], [299, 296], [6, 351], [351, 168], [168, 6], [376, 352], [352, 411], [411, 376], [307, 325], [325, 320], [320, 307], [285, 295], [295, 336], [336, 285], [320, 319], [319, 404], [404, 320], [329, 330], [330, 349], [349, 329], [334, 293], [293, 333], [333, 334], [366, 323], [323, 447], [447, 366], [316, 15], [15, 315], [315, 316], [331, 358], [358, 279], [279, 331], [317, 14], [14, 316], [316, 317], [8, 285], [285, 9], [9, 8], [277, 329], [329, 350], [350, 277], [253, 374], [374, 252], [252, 253], [319, 318], [318, 403], [403, 319], [351, 6], [6, 419], [419, 351], [324, 318], [318, 325], [325, 324], [397, 367], [367, 365], [365, 397], [288, 435], [435, 397], [397, 288], [278, 344], [344, 439], [439, 278], [310, 272], [272, 311], [311, 310], [248, 195], [195, 281], [281, 248], [375, 273], [273, 291], [291, 375], [175, 396], [396, 199], [199, 175], [312, 311], [311, 268], [268, 312], [276, 283], [283, 445], [445, 276], [390, 373], [373, 339], [339, 390], [295, 282], [282, 296], [296, 295], [448, 449], [449, 346], [346, 448], [356, 264], [264, 454], [454, 356], [337, 336], [336, 299], [299, 337], [337, 338], [338, 151], [151, 337], [294, 278], [278, 455], [455, 294], [308, 292], [292, 415], [415, 308], [429, 358], [358, 355], [355, 429], [265, 340], [340, 372], [372, 265], [352, 346], [346, 280], [280, 352], [295, 442], [442, 282], [282, 295], [354, 19], [19, 370], [370, 354], [285, 441], [441, 295], [295, 285], [195, 248], [248, 197], [197, 195], [457, 440], [440, 274], [274, 457], [301, 300], [300, 368], [368, 301], [417, 351], [351, 465], [465, 417], [251, 301], [301, 389], [389, 251], [394, 395], [395, 379], [379, 394], [399, 412], [412, 419], [419, 399], [410, 436], [436, 322], [322, 410], [326, 2], [2, 393], [393, 326], [354, 370], [370, 461], [461, 354], [393, 164], [164, 267], [267, 393], [268, 302], [302, 12], [12, 268], [312, 268], [268, 13], [13, 312], [298, 293], [293, 301], [301, 298], [265, 446], [446, 340], [340, 265], [280, 330], [330, 425], [425, 280], [322, 426], [426, 391], [391, 322], [420, 429], [429, 437], [437, 420], [393, 391], [391, 326], [326, 393], [344, 440], [440, 438], [438, 344], [458, 459], [459, 461], [461, 458], [364, 434], [434, 394], [394, 364], [428, 396], [396, 262], [262, 428], [274, 354], [354, 457], [457, 274], [317, 316], [316, 402], [402, 317], [316, 315], [315, 403], [403, 316], [315, 314], [314, 404], [404, 315], [314, 313], [313, 405], [405, 314], [313, 421], [421, 406], [406, 313], [323, 366], [366, 361], [361, 323], [292, 306], [306, 407], [407, 292], [306, 291], [291, 408], [408, 306], [291, 287], [287, 409], [409, 291], [287, 432], [432, 410], [410, 287], [427, 434], [434, 411], [411, 427], [372, 264], [264, 383], [383, 372], [459, 309], [309, 457], [457, 459], [366, 352], [352, 401], [401, 366], [1, 274], [274, 4], [4, 1], [418, 421], [421, 262], [262, 418], [331, 294], [294, 358], [358, 331], [435, 433], [433, 367], [367, 435], [392, 289], [289, 439], [439, 392], [328, 462], [462, 326], [326, 328], [94, 2], [2, 370], [370, 94], [289, 305], [305, 455], [455, 289], [339, 254], [254, 448], [448, 339], [359, 255], [255, 446], [446, 359], [254, 253], [253, 449], [449, 254], [253, 252], [252, 450], [450, 253], [252, 256], [256, 451], [451, 252], [256, 341], [341, 452], [452, 256], [414, 413], [413, 463], [463, 414], [286, 441], [441, 414], [414, 286], [286, 258], [258, 441], [441, 286], [258, 257], [257, 442], [442, 258], [257, 259], [259, 443], [443, 257], [259, 260], [260, 444], [444, 259], [260, 467], [467, 445], [445, 260], [309, 459], [459, 250], [250, 309], [305, 289], [289, 290], [290, 305], [305, 290], [290, 460], [460, 305], [401, 376], [376, 435], [435, 401], [309, 250], [250, 392], [392, 309], [376, 411], [411, 433], [433, 376], [453, 341], [341, 464], [464, 453], [357, 453], [453, 465], [465, 357], [343, 357], [357, 412], [412, 343], [437, 343], [343, 399], [399, 437], [344, 360], [360, 440], [440, 344], [420, 437], [437, 456], [456, 420], [360, 420], [420, 363], [363, 360], [361, 401], [401, 288], [288, 361], [265, 372], [372, 353], [353, 265], [390, 339], [339, 249], [249, 390], [339, 448], [448, 255], [255, 339]);
2935
- function ai(t) {
2936
- t.j = { faceLandmarks: [], faceBlendshapes: [], facialTransformationMatrixes: [] };
2937
- }
2938
- var M = class extends at {
2939
- constructor(t, e) {
2940
- super(new yt(t, e), "image_in", "norm_rect", !1), this.j = { faceLandmarks: [], faceBlendshapes: [], facialTransformationMatrixes: [] }, this.outputFacialTransformationMatrixes = this.outputFaceBlendshapes = !1, _(t = this.h = new Uo(), 0, 1, e = new I()), this.A = new Do(), _(this.h, 0, 3, this.A), this.u = new Nn(), _(this.h, 0, 2, this.u), It(this.u, 4, 1), m(this.u, 2, 0.5), m(this.A, 2, 0.5), m(this.h, 4, 0.5);
2941
- }
2942
- get baseOptions() {
2943
- return A(this.h, I, 1);
2944
- }
2945
- set baseOptions(t) {
2946
- _(this.h, 0, 1, t);
2947
- }
2948
- o(t) {
2949
- return "numFaces" in t && It(this.u, 4, t.numFaces ?? 1), "minFaceDetectionConfidence" in t && m(this.u, 2, t.minFaceDetectionConfidence ?? 0.5), "minTrackingConfidence" in t && m(this.h, 4, t.minTrackingConfidence ?? 0.5), "minFacePresenceConfidence" in t && m(this.A, 2, t.minFacePresenceConfidence ?? 0.5), "outputFaceBlendshapes" in t && (this.outputFaceBlendshapes = !!t.outputFaceBlendshapes), "outputFacialTransformationMatrixes" in t && (this.outputFacialTransformationMatrixes = !!t.outputFacialTransformationMatrixes), this.l(t);
2950
- }
2951
- F(t, e) {
2952
- return ai(this), vt(this, t, e), this.j;
2953
- }
2954
- G(t, e, n) {
2955
- return ai(this), Ft(this, t, n, e), this.j;
2956
- }
2957
- m() {
2958
- var t = new ht();
2959
- O(t, "image_in"), O(t, "norm_rect"), E(t, "face_landmarks");
2960
- const e = new ct();
2961
- Tt(e, H2, this.h);
2962
- const n = new Z();
2963
- it(n, 2, "mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"), F(n, "IMAGE:image_in"), F(n, "NORM_RECT:norm_rect"), w(n, "NORM_LANDMARKS:face_landmarks"), n.o(e), gt(t, n), this.g.attachProtoVectorListener("face_landmarks", (r, s) => {
2964
- for (const i of r) r = tn(i), this.j.faceLandmarks.push(Cn(r));
2965
- l(this, s);
2966
- }), this.g.attachEmptyPacketListener("face_landmarks", (r) => {
2967
- l(this, r);
2968
- }), this.outputFaceBlendshapes && (E(t, "blendshapes"), w(n, "BLENDSHAPES:blendshapes"), this.g.attachProtoVectorListener("blendshapes", (r, s) => {
2969
- if (this.outputFaceBlendshapes) for (const i of r) r = In(i), this.j.faceBlendshapes.push(ts(r.g() ?? []));
2970
- l(this, s);
2971
- }), this.g.attachEmptyPacketListener("blendshapes", (r) => {
2972
- l(this, r);
2973
- })), this.outputFacialTransformationMatrixes && (E(t, "face_geometry"), w(n, "FACE_GEOMETRY:face_geometry"), this.g.attachProtoVectorListener("face_geometry", (r, s) => {
2974
- if (this.outputFacialTransformationMatrixes) for (const i of r) (r = A(r = V2(i), I2, 2)) && this.j.facialTransformationMatrixes.push({ rows: dt(r, 1) ?? 0 ?? 0, columns: dt(r, 2) ?? 0 ?? 0, data: zt(r, 3, At, Kt()).slice() ?? [] });
2975
- l(this, s);
2976
- }), this.g.attachEmptyPacketListener("face_geometry", (r) => {
2977
- l(this, r);
2978
- })), t = t.g(), this.setGraph(new Uint8Array(t), !0);
2979
- }
2980
- };
2981
- M.prototype.detectForVideo = M.prototype.G, M.prototype.detect = M.prototype.F, M.prototype.setOptions = M.prototype.o, M.createFromModelPath = function(t, e) {
2982
- return b(M, t, { baseOptions: { modelAssetPath: e } });
2983
- }, M.createFromModelBuffer = function(t, e) {
2984
- return b(M, t, { baseOptions: { modelAssetBuffer: e } });
2985
- }, M.createFromOptions = function(t, e) {
2986
- return b(M, t, e);
2987
- }, M.FACE_LANDMARKS_LIPS = rs, M.FACE_LANDMARKS_LEFT_EYE = ss, M.FACE_LANDMARKS_LEFT_EYEBROW = is, M.FACE_LANDMARKS_LEFT_IRIS = pa, M.FACE_LANDMARKS_RIGHT_EYE = os, M.FACE_LANDMARKS_RIGHT_EYEBROW = as, M.FACE_LANDMARKS_RIGHT_IRIS = ga, M.FACE_LANDMARKS_FACE_OVAL = cs, M.FACE_LANDMARKS_CONTOURS = ma, M.FACE_LANDMARKS_TESSELATION = _a;
2988
- var hs = _t([0, 1], [1, 2], [2, 3], [3, 4], [0, 5], [5, 6], [6, 7], [7, 8], [5, 9], [9, 10], [10, 11], [11, 12], [9, 13], [13, 14], [14, 15], [15, 16], [13, 17], [0, 17], [17, 18], [18, 19], [19, 20]);
2989
- function ci(t) {
2990
- t.gestures = [], t.landmarks = [], t.worldLandmarks = [], t.handedness = [];
2991
- }
2992
- function hi(t) {
2993
- return t.gestures.length === 0 ? { gestures: [], landmarks: [], worldLandmarks: [], handedness: [], handednesses: [] } : { gestures: t.gestures, landmarks: t.landmarks, worldLandmarks: t.worldLandmarks, handedness: t.handedness, handednesses: t.handedness };
2994
- }
2995
- function ui(t, e = !0) {
2996
- const n = [];
2997
- for (const s of t) {
2998
- var r = In(s);
2999
- t = [];
3000
- for (const i of r.g()) r = e && dt(i, 1) != null ? dt(i, 1) ?? 0 : -1, t.push({ score: C(i, 2) ?? 0, index: r, categoryName: q(L(i, 3)) ?? "" ?? "", displayName: q(L(i, 4)) ?? "" ?? "" });
3001
- n.push(t);
3002
- }
3003
- return n;
3004
- }
3005
- var Q = class extends at {
3006
- constructor(t, e) {
3007
- super(new yt(t, e), "image_in", "norm_rect", !1), this.gestures = [], this.landmarks = [], this.worldLandmarks = [], this.handedness = [], _(t = this.j = new Vo(), 0, 1, e = new I()), this.u = new $r(), _(this.j, 0, 2, this.u), this.D = new Yr(), _(this.u, 0, 3, this.D), this.A = new Go(), _(this.u, 0, 2, this.A), this.h = new W2(), _(this.j, 0, 3, this.h), m(this.A, 2, 0.5), m(this.u, 4, 0.5), m(this.D, 2, 0.5);
3008
- }
3009
- get baseOptions() {
3010
- return A(this.j, I, 1);
3011
- }
3012
- set baseOptions(t) {
3013
- _(this.j, 0, 1, t);
3014
- }
3015
- o(t) {
3016
- var s, i, o, a;
3017
- if (It(this.A, 3, t.numHands ?? 1), "minHandDetectionConfidence" in t && m(this.A, 2, t.minHandDetectionConfidence ?? 0.5), "minTrackingConfidence" in t && m(this.u, 4, t.minTrackingConfidence ?? 0.5), "minHandPresenceConfidence" in t && m(this.D, 2, t.minHandPresenceConfidence ?? 0.5), t.cannedGesturesClassifierOptions) {
3018
- var e = new oe(), n = e, r = ar(t.cannedGesturesClassifierOptions, (s = A(this.h, oe, 3)) == null ? void 0 : s.l());
3019
- _(n, 0, 2, r), _(this.h, 0, 3, e);
3020
- } else t.cannedGesturesClassifierOptions === void 0 && ((i = A(this.h, oe, 3)) == null || i.g());
3021
- return t.customGesturesClassifierOptions ? (_(n = e = new oe(), 0, 2, r = ar(t.customGesturesClassifierOptions, (o = A(this.h, oe, 4)) == null ? void 0 : o.l())), _(this.h, 0, 4, e)) : t.customGesturesClassifierOptions === void 0 && ((a = A(this.h, oe, 4)) == null || a.g()), this.l(t);
3022
- }
3023
- Ha(t, e) {
3024
- return ci(this), vt(this, t, e), hi(this);
3025
- }
3026
- Ia(t, e, n) {
3027
- return ci(this), Ft(this, t, n, e), hi(this);
3028
- }
3029
- m() {
3030
- var t = new ht();
3031
- O(t, "image_in"), O(t, "norm_rect"), E(t, "hand_gestures"), E(t, "hand_landmarks"), E(t, "world_hand_landmarks"), E(t, "handedness");
3032
- const e = new ct();
3033
- Tt(e, K2, this.j);
3034
- const n = new Z();
3035
- it(n, 2, "mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"), F(n, "IMAGE:image_in"), F(n, "NORM_RECT:norm_rect"), w(n, "HAND_GESTURES:hand_gestures"), w(n, "LANDMARKS:hand_landmarks"), w(n, "WORLD_LANDMARKS:world_hand_landmarks"), w(n, "HANDEDNESS:handedness"), n.o(e), gt(t, n), this.g.attachProtoVectorListener("hand_landmarks", (r, s) => {
3036
- for (const i of r) {
3037
- r = tn(i);
3038
- const o = [];
3039
- for (const a of xt(r, Io, 1)) o.push({ x: C(a, 1) ?? 0, y: C(a, 2) ?? 0, z: C(a, 3) ?? 0, visibility: C(a, 4) ?? 0 });
3040
- this.landmarks.push(o);
3041
- }
3042
- l(this, s);
3043
- }), this.g.attachEmptyPacketListener("hand_landmarks", (r) => {
3044
- l(this, r);
3045
- }), this.g.attachProtoVectorListener("world_hand_landmarks", (r, s) => {
3046
- for (const i of r) {
3047
- r = he(i);
3048
- const o = [];
3049
- for (const a of xt(r, xo, 1)) o.push({ x: C(a, 1) ?? 0, y: C(a, 2) ?? 0, z: C(a, 3) ?? 0, visibility: C(a, 4) ?? 0 });
3050
- this.worldLandmarks.push(o);
3051
- }
3052
- l(this, s);
3053
- }), this.g.attachEmptyPacketListener("world_hand_landmarks", (r) => {
3054
- l(this, r);
3055
- }), this.g.attachProtoVectorListener("hand_gestures", (r, s) => {
3056
- this.gestures.push(...ui(r, !1)), l(this, s);
3057
- }), this.g.attachEmptyPacketListener("hand_gestures", (r) => {
3058
- l(this, r);
3059
- }), this.g.attachProtoVectorListener("handedness", (r, s) => {
3060
- this.handedness.push(...ui(r)), l(this, s);
3061
- }), this.g.attachEmptyPacketListener("handedness", (r) => {
3062
- l(this, r);
3063
- }), t = t.g(), this.setGraph(new Uint8Array(t), !0);
3064
- }
3065
- };
3066
- function li(t) {
3067
- return { landmarks: t.landmarks, worldLandmarks: t.worldLandmarks, handednesses: t.handedness, handedness: t.handedness };
3068
- }
3069
- Q.prototype.recognizeForVideo = Q.prototype.Ia, Q.prototype.recognize = Q.prototype.Ha, Q.prototype.setOptions = Q.prototype.o, Q.createFromModelPath = function(t, e) {
3070
- return b(Q, t, { baseOptions: { modelAssetPath: e } });
3071
- }, Q.createFromModelBuffer = function(t, e) {
3072
- return b(Q, t, { baseOptions: { modelAssetBuffer: e } });
3073
- }, Q.createFromOptions = function(t, e) {
3074
- return b(Q, t, e);
3075
- }, Q.HAND_CONNECTIONS = hs;
3076
- var J = class extends at {
3077
- constructor(t, e) {
3078
- super(new yt(t, e), "image_in", "norm_rect", !1), this.landmarks = [], this.worldLandmarks = [], this.handedness = [], _(t = this.h = new $r(), 0, 1, e = new I()), this.u = new Yr(), _(this.h, 0, 3, this.u), this.j = new Go(), _(this.h, 0, 2, this.j), It(this.j, 3, 1), m(this.j, 2, 0.5), m(this.u, 2, 0.5), m(this.h, 4, 0.5);
3079
- }
3080
- get baseOptions() {
3081
- return A(this.h, I, 1);
3082
- }
3083
- set baseOptions(t) {
3084
- _(this.h, 0, 1, t);
3085
- }
3086
- o(t) {
3087
- return "numHands" in t && It(this.j, 3, t.numHands ?? 1), "minHandDetectionConfidence" in t && m(this.j, 2, t.minHandDetectionConfidence ?? 0.5), "minTrackingConfidence" in t && m(this.h, 4, t.minTrackingConfidence ?? 0.5), "minHandPresenceConfidence" in t && m(this.u, 2, t.minHandPresenceConfidence ?? 0.5), this.l(t);
3088
- }
3089
- F(t, e) {
3090
- return this.landmarks = [], this.worldLandmarks = [], this.handedness = [], vt(this, t, e), li(this);
3091
- }
3092
- G(t, e, n) {
3093
- return this.landmarks = [], this.worldLandmarks = [], this.handedness = [], Ft(this, t, n, e), li(this);
3094
- }
3095
- m() {
3096
- var t = new ht();
3097
- O(t, "image_in"), O(t, "norm_rect"), E(t, "hand_landmarks"), E(t, "world_hand_landmarks"), E(t, "handedness");
3098
- const e = new ct();
3099
- Tt(e, z2, this.h);
3100
- const n = new Z();
3101
- it(n, 2, "mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"), F(n, "IMAGE:image_in"), F(n, "NORM_RECT:norm_rect"), w(n, "LANDMARKS:hand_landmarks"), w(n, "WORLD_LANDMARKS:world_hand_landmarks"), w(n, "HANDEDNESS:handedness"), n.o(e), gt(t, n), this.g.attachProtoVectorListener("hand_landmarks", (r, s) => {
3102
- for (const i of r) r = tn(i), this.landmarks.push(Cn(r));
3103
- l(this, s);
3104
- }), this.g.attachEmptyPacketListener("hand_landmarks", (r) => {
3105
- l(this, r);
3106
- }), this.g.attachProtoVectorListener("world_hand_landmarks", (r, s) => {
3107
- for (const i of r) r = he(i), this.worldLandmarks.push(Ge(r));
3108
- l(this, s);
3109
- }), this.g.attachEmptyPacketListener("world_hand_landmarks", (r) => {
3110
- l(this, r);
3111
- }), this.g.attachProtoVectorListener("handedness", (r, s) => {
3112
- var i = this.handedness, o = i.push;
3113
- const a = [];
3114
- for (const c of r) {
3115
- r = In(c);
3116
- const u = [];
3117
- for (const h of r.g()) u.push({ score: C(h, 2) ?? 0, index: dt(h, 1) ?? 0 ?? -1, categoryName: q(L(h, 3)) ?? "" ?? "", displayName: q(L(h, 4)) ?? "" ?? "" });
3118
- a.push(u);
3119
- }
3120
- o.call(i, ...a), l(this, s);
3121
- }), this.g.attachEmptyPacketListener("handedness", (r) => {
3122
- l(this, r);
3123
- }), t = t.g(), this.setGraph(new Uint8Array(t), !0);
3124
- }
3125
- };
3126
- J.prototype.detectForVideo = J.prototype.G, J.prototype.detect = J.prototype.F, J.prototype.setOptions = J.prototype.o, J.createFromModelPath = function(t, e) {
3127
- return b(J, t, { baseOptions: { modelAssetPath: e } });
3128
- }, J.createFromModelBuffer = function(t, e) {
3129
- return b(J, t, { baseOptions: { modelAssetBuffer: e } });
3130
- }, J.createFromOptions = function(t, e) {
3131
- return b(J, t, e);
3132
- }, J.HAND_CONNECTIONS = hs;
3133
- var ya = _t([0, 1], [1, 2], [2, 3], [3, 7], [0, 4], [4, 5], [5, 6], [6, 8], [9, 10], [11, 12], [11, 13], [13, 15], [15, 17], [15, 19], [15, 21], [17, 19], [12, 14], [14, 16], [16, 18], [16, 20], [16, 22], [18, 20], [11, 23], [12, 24], [23, 24], [23, 25], [24, 26], [25, 27], [26, 28], [27, 29], [28, 30], [29, 31], [30, 32], [27, 31], [28, 32]);
3134
- function fi(t) {
3135
- t.h = { faceLandmarks: [], faceBlendshapes: [], poseLandmarks: [], poseWorldLandmarks: [], poseSegmentationMasks: [], leftHandLandmarks: [], leftHandWorldLandmarks: [], rightHandLandmarks: [], rightHandWorldLandmarks: [] };
3136
- }
3137
- function di(t) {
3138
- try {
3139
- if (!t.D) return t.h;
3140
- t.D(t.h);
3141
- } finally {
3142
- Bn(t);
3143
- }
3144
- }
3145
- function sn(t, e) {
3146
- t = tn(t), e.push(Cn(t));
3147
- }
3148
- var T = class extends at {
3149
- constructor(t, e) {
3150
- super(new yt(t, e), "input_frames_image", null, !1), this.h = { faceLandmarks: [], faceBlendshapes: [], poseLandmarks: [], poseWorldLandmarks: [], poseSegmentationMasks: [], leftHandLandmarks: [], leftHandWorldLandmarks: [], rightHandLandmarks: [], rightHandWorldLandmarks: [] }, this.outputPoseSegmentationMasks = this.outputFaceBlendshapes = !1, _(t = this.j = new qo(), 0, 1, e = new I()), this.I = new Yr(), _(this.j, 0, 2, this.I), this.W = new q2(), _(this.j, 0, 3, this.W), this.u = new Nn(), _(this.j, 0, 4, this.u), this.O = new Do(), _(this.j, 0, 5, this.O), this.A = new Ko(), _(this.j, 0, 6, this.A), this.M = new zo(), _(this.j, 0, 7, this.M), m(this.u, 2, 0.5), m(this.u, 3, 0.3), m(this.O, 2, 0.5), m(this.A, 2, 0.5), m(this.A, 3, 0.3), m(this.M, 2, 0.5), m(this.I, 2, 0.5);
3151
- }
3152
- get baseOptions() {
3153
- return A(this.j, I, 1);
3154
- }
3155
- set baseOptions(t) {
3156
- _(this.j, 0, 1, t);
3157
- }
3158
- o(t) {
3159
- return "minFaceDetectionConfidence" in t && m(this.u, 2, t.minFaceDetectionConfidence ?? 0.5), "minFaceSuppressionThreshold" in t && m(this.u, 3, t.minFaceSuppressionThreshold ?? 0.3), "minFacePresenceConfidence" in t && m(this.O, 2, t.minFacePresenceConfidence ?? 0.5), "outputFaceBlendshapes" in t && (this.outputFaceBlendshapes = !!t.outputFaceBlendshapes), "minPoseDetectionConfidence" in t && m(this.A, 2, t.minPoseDetectionConfidence ?? 0.5), "minPoseSuppressionThreshold" in t && m(this.A, 3, t.minPoseSuppressionThreshold ?? 0.3), "minPosePresenceConfidence" in t && m(this.M, 2, t.minPosePresenceConfidence ?? 0.5), "outputPoseSegmentationMasks" in t && (this.outputPoseSegmentationMasks = !!t.outputPoseSegmentationMasks), "minHandLandmarksConfidence" in t && m(this.I, 2, t.minHandLandmarksConfidence ?? 0.5), this.l(t);
3160
- }
3161
- F(t, e, n) {
3162
- const r = typeof e != "function" ? e : {};
3163
- return this.D = typeof e == "function" ? e : n, fi(this), vt(this, t, r), di(this);
3164
- }
3165
- G(t, e, n, r) {
3166
- const s = typeof n != "function" ? n : {};
3167
- return this.D = typeof n == "function" ? n : r, fi(this), Ft(this, t, s, e), di(this);
3168
- }
3169
- m() {
3170
- var t = new ht();
3171
- O(t, "input_frames_image"), E(t, "pose_landmarks"), E(t, "pose_world_landmarks"), E(t, "face_landmarks"), E(t, "left_hand_landmarks"), E(t, "left_hand_world_landmarks"), E(t, "right_hand_landmarks"), E(t, "right_hand_world_landmarks");
3172
- const e = new ct(), n = new Bs();
3173
- it(n, 1, "type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"), function(s, i) {
3174
- if (i != null) if (Array.isArray(i)) k(s, 2, bn(i, 0, ze));
3175
- else {
3176
- if (!(typeof i == "string" || i instanceof Et || mr(i))) throw Error("invalid value in Any.value field: " + i + " expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");
3177
- Bt(s, 2, yr(i, !1), Zt());
3178
- }
3179
- }(n, this.j.g());
3180
- const r = new Z();
3181
- it(r, 2, "mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"), Ir(r, 8, Bs, n), F(r, "IMAGE:input_frames_image"), w(r, "POSE_LANDMARKS:pose_landmarks"), w(r, "POSE_WORLD_LANDMARKS:pose_world_landmarks"), w(r, "FACE_LANDMARKS:face_landmarks"), w(r, "LEFT_HAND_LANDMARKS:left_hand_landmarks"), w(r, "LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"), w(r, "RIGHT_HAND_LANDMARKS:right_hand_landmarks"), w(r, "RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"), r.o(e), gt(t, r), Rn(this, t), this.g.attachProtoListener("pose_landmarks", (s, i) => {
3182
- sn(s, this.h.poseLandmarks), l(this, i);
3183
- }), this.g.attachEmptyPacketListener("pose_landmarks", (s) => {
3184
- l(this, s);
3185
- }), this.g.attachProtoListener("pose_world_landmarks", (s, i) => {
3186
- var o = this.h.poseWorldLandmarks;
3187
- s = he(s), o.push(Ge(s)), l(this, i);
3188
- }), this.g.attachEmptyPacketListener("pose_world_landmarks", (s) => {
3189
- l(this, s);
3190
- }), this.outputPoseSegmentationMasks && (w(r, "POSE_SEGMENTATION_MASK:pose_segmentation_mask"), ve(this, "pose_segmentation_mask"), this.g.Z("pose_segmentation_mask", (s, i) => {
3191
- this.h.poseSegmentationMasks = [be(this, s, !0, !this.D)], l(this, i);
3192
- }), this.g.attachEmptyPacketListener("pose_segmentation_mask", (s) => {
3193
- this.h.poseSegmentationMasks = [], l(this, s);
3194
- })), this.g.attachProtoListener("face_landmarks", (s, i) => {
3195
- sn(s, this.h.faceLandmarks), l(this, i);
3196
- }), this.g.attachEmptyPacketListener("face_landmarks", (s) => {
3197
- l(this, s);
3198
- }), this.outputFaceBlendshapes && (E(t, "extra_blendshapes"), w(r, "FACE_BLENDSHAPES:extra_blendshapes"), this.g.attachProtoListener("extra_blendshapes", (s, i) => {
3199
- var o = this.h.faceBlendshapes;
3200
- this.outputFaceBlendshapes && (s = In(s), o.push(ts(s.g() ?? []))), l(this, i);
3201
- }), this.g.attachEmptyPacketListener("extra_blendshapes", (s) => {
3202
- l(this, s);
3203
- })), this.g.attachProtoListener("left_hand_landmarks", (s, i) => {
3204
- sn(s, this.h.leftHandLandmarks), l(this, i);
3205
- }), this.g.attachEmptyPacketListener("left_hand_landmarks", (s) => {
3206
- l(this, s);
3207
- }), this.g.attachProtoListener("left_hand_world_landmarks", (s, i) => {
3208
- var o = this.h.leftHandWorldLandmarks;
3209
- s = he(s), o.push(Ge(s)), l(this, i);
3210
- }), this.g.attachEmptyPacketListener("left_hand_world_landmarks", (s) => {
3211
- l(this, s);
3212
- }), this.g.attachProtoListener("right_hand_landmarks", (s, i) => {
3213
- sn(s, this.h.rightHandLandmarks), l(this, i);
3214
- }), this.g.attachEmptyPacketListener("right_hand_landmarks", (s) => {
3215
- l(this, s);
3216
- }), this.g.attachProtoListener("right_hand_world_landmarks", (s, i) => {
3217
- var o = this.h.rightHandWorldLandmarks;
3218
- s = he(s), o.push(Ge(s)), l(this, i);
3219
- }), this.g.attachEmptyPacketListener("right_hand_world_landmarks", (s) => {
3220
- l(this, s);
3221
- }), t = t.g(), this.setGraph(new Uint8Array(t), !0);
3222
- }
3223
- };
3224
- T.prototype.detectForVideo = T.prototype.G, T.prototype.detect = T.prototype.F, T.prototype.setOptions = T.prototype.o, T.createFromModelPath = function(t, e) {
3225
- return b(T, t, { baseOptions: { modelAssetPath: e } });
3226
- }, T.createFromModelBuffer = function(t, e) {
3227
- return b(T, t, { baseOptions: { modelAssetBuffer: e } });
3228
- }, T.createFromOptions = function(t, e) {
3229
- return b(T, t, e);
3230
- }, T.HAND_CONNECTIONS = hs, T.POSE_CONNECTIONS = ya, T.FACE_LANDMARKS_LIPS = rs, T.FACE_LANDMARKS_LEFT_EYE = ss, T.FACE_LANDMARKS_LEFT_EYEBROW = is, T.FACE_LANDMARKS_LEFT_IRIS = pa, T.FACE_LANDMARKS_RIGHT_EYE = os, T.FACE_LANDMARKS_RIGHT_EYEBROW = as, T.FACE_LANDMARKS_RIGHT_IRIS = ga, T.FACE_LANDMARKS_FACE_OVAL = cs, T.FACE_LANDMARKS_CONTOURS = ma, T.FACE_LANDMARKS_TESSELATION = _a;
3231
- var lt = class extends at {
3232
- constructor(t, e) {
3233
- super(new yt(t, e), "input_image", "norm_rect", !0), this.j = { classifications: [] }, _(t = this.h = new Xo(), 0, 1, e = new I());
3234
- }
3235
- get baseOptions() {
3236
- return A(this.h, I, 1);
3237
- }
3238
- set baseOptions(t) {
3239
- _(this.h, 0, 1, t);
3240
- }
3241
- o(t) {
3242
- return _(this.h, 0, 2, ar(t, A(this.h, qr, 2))), this.l(t);
3243
- }
3244
- sa(t, e) {
3245
- return this.j = { classifications: [] }, vt(this, t, e), this.j;
3246
- }
3247
- ta(t, e, n) {
3248
- return this.j = { classifications: [] }, Ft(this, t, n, e), this.j;
3249
- }
3250
- m() {
3251
- var t = new ht();
3252
- O(t, "input_image"), O(t, "norm_rect"), E(t, "classifications");
3253
- const e = new ct();
3254
- Tt(e, X2, this.h);
3255
- const n = new Z();
3256
- it(n, 2, "mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"), F(n, "IMAGE:input_image"), F(n, "NORM_RECT:norm_rect"), w(n, "CLASSIFICATIONS:classifications"), n.o(e), gt(t, n), this.g.attachProtoListener("classifications", (r, s) => {
3257
- this.j = t1(R2(r)), l(this, s);
3258
- }), this.g.attachEmptyPacketListener("classifications", (r) => {
3259
- l(this, r);
3260
- }), t = t.g(), this.setGraph(new Uint8Array(t), !0);
3261
- }
3262
- };
3263
- lt.prototype.classifyForVideo = lt.prototype.ta, lt.prototype.classify = lt.prototype.sa, lt.prototype.setOptions = lt.prototype.o, lt.createFromModelPath = function(t, e) {
3264
- return b(lt, t, { baseOptions: { modelAssetPath: e } });
3265
- }, lt.createFromModelBuffer = function(t, e) {
3266
- return b(lt, t, { baseOptions: { modelAssetBuffer: e } });
3267
- }, lt.createFromOptions = function(t, e) {
3268
- return b(lt, t, e);
3269
- };
3270
- var tt = class extends at {
3271
- constructor(t, e) {
3272
- super(new yt(t, e), "image_in", "norm_rect", !0), this.h = new Yo(), this.embeddings = { embeddings: [] }, _(t = this.h, 0, 1, e = new I());
3273
- }
3274
- get baseOptions() {
3275
- return A(this.h, I, 1);
3276
- }
3277
- set baseOptions(t) {
3278
- _(this.h, 0, 1, t);
3279
- }
3280
- o(t) {
3281
- var e = this.h, n = A(this.h, zs, 2);
3282
- return n = n ? n.clone() : new zs(), t.l2Normalize !== void 0 ? k(n, 1, Ke(t.l2Normalize)) : "l2Normalize" in t && k(n, 1), t.quantize !== void 0 ? k(n, 2, Ke(t.quantize)) : "quantize" in t && k(n, 2), _(e, 0, 2, n), this.l(t);
3283
- }
3284
- za(t, e) {
3285
- return vt(this, t, e), this.embeddings;
3286
- }
3287
- Aa(t, e, n) {
3288
- return Ft(this, t, n, e), this.embeddings;
3289
- }
3290
- m() {
3291
- var t = new ht();
3292
- O(t, "image_in"), O(t, "norm_rect"), E(t, "embeddings_out");
3293
- const e = new ct();
3294
- Tt(e, Y2, this.h);
3295
- const n = new Z();
3296
- it(n, 2, "mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"), F(n, "IMAGE:image_in"), F(n, "NORM_RECT:norm_rect"), w(n, "EMBEDDINGS:embeddings_out"), n.o(e), gt(t, n), this.g.attachProtoListener("embeddings_out", (r, s) => {
3297
- r = U2(r), this.embeddings = function(i) {
3298
- return { embeddings: xt(i, D2, 1).map((o) => {
3299
- var u, h;
3300
- const a = { headIndex: dt(o, 3) ?? 0 ?? -1, headName: q(L(o, 4)) ?? "" ?? "" };
3301
- var c = o.v;
3302
- return Wi(c, 0 | c[d], Ks, Hn(o, 1)) !== void 0 ? (o = zt(o = A(o, Ks, Hn(o, 1), void 0), 1, At, Kt()), a.floatEmbedding = o.slice()) : (c = new Uint8Array(0), a.quantizedEmbedding = ((h = (u = A(o, B2, Hn(o, 2), void 0)) == null ? void 0 : u.na()) == null ? void 0 : h.h()) ?? c), a;
3303
- }), timestampMs: na(qi(i)) };
3304
- }(r), l(this, s);
3305
- }), this.g.attachEmptyPacketListener("embeddings_out", (r) => {
3306
- l(this, r);
3307
- }), t = t.g(), this.setGraph(new Uint8Array(t), !0);
3308
- }
3309
- };
3310
- tt.cosineSimilarity = function(t, e) {
3311
- if (t.floatEmbedding && e.floatEmbedding) t = Zs(t.floatEmbedding, e.floatEmbedding);
3312
- else {
3313
- if (!t.quantizedEmbedding || !e.quantizedEmbedding) throw Error("Cannot compute cosine similarity between quantized and float embeddings.");
3314
- t = Zs(Js(t.quantizedEmbedding), Js(e.quantizedEmbedding));
3315
- }
3316
- return t;
3317
- }, tt.prototype.embedForVideo = tt.prototype.Aa, tt.prototype.embed = tt.prototype.za, tt.prototype.setOptions = tt.prototype.o, tt.createFromModelPath = function(t, e) {
3318
- return b(tt, t, { baseOptions: { modelAssetPath: e } });
3319
- }, tt.createFromModelBuffer = function(t, e) {
3320
- return b(tt, t, { baseOptions: { modelAssetBuffer: e } });
3321
- }, tt.createFromOptions = function(t, e) {
3322
- return b(tt, t, e);
3323
- };
3324
- var lr = class {
3325
- constructor(t, e, n) {
3326
- this.confidenceMasks = t, this.categoryMask = e, this.qualityScores = n;
3327
- }
3328
- close() {
3329
- var t, e;
3330
- (t = this.confidenceMasks) == null || t.forEach((n) => {
3331
- n.close();
3332
- }), (e = this.categoryMask) == null || e.close();
3333
- }
3334
- };
3335
- function a1(t) {
3336
- var n, r;
3337
- const e = function(s) {
3338
- return xt(s, Z, 1);
3339
- }(t.ca()).filter((s) => (q(L(s, 1)) ?? "").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));
3340
- if (t.u = [], e.length > 1) throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");
3341
- e.length === 1 && (((r = (n = A(e[0], ct, 7)) == null ? void 0 : n.j()) == null ? void 0 : r.g()) ?? /* @__PURE__ */ new Map()).forEach((s, i) => {
3342
- t.u[Number(i)] = q(L(s, 1)) ?? "";
3343
- });
3344
- }
3345
- function pi(t) {
3346
- t.categoryMask = void 0, t.confidenceMasks = void 0, t.qualityScores = void 0;
3347
- }
3348
- function gi(t) {
3349
- try {
3350
- const e = new lr(t.confidenceMasks, t.categoryMask, t.qualityScores);
3351
- if (!t.j) return e;
3352
- t.j(e);
3353
- } finally {
3354
- Bn(t);
3355
- }
3356
- }
3357
- lr.prototype.close = lr.prototype.close;
3358
- var $ = class extends at {
3359
- constructor(t, e) {
3360
- super(new yt(t, e), "image_in", "norm_rect", !1), this.u = [], this.outputCategoryMask = !1, this.outputConfidenceMasks = !0, this.h = new Qr(), this.A = new $o(), _(this.h, 0, 3, this.A), _(t = this.h, 0, 1, e = new I());
3361
- }
3362
- get baseOptions() {
3363
- return A(this.h, I, 1);
3364
- }
3365
- set baseOptions(t) {
3366
- _(this.h, 0, 1, t);
3367
- }
3368
- o(t) {
3369
- return t.displayNamesLocale !== void 0 ? k(this.h, 2, Je(t.displayNamesLocale)) : "displayNamesLocale" in t && k(this.h, 2), "outputCategoryMask" in t && (this.outputCategoryMask = t.outputCategoryMask ?? !1), "outputConfidenceMasks" in t && (this.outputConfidenceMasks = t.outputConfidenceMasks ?? !0), super.l(t);
3370
- }
3371
- L() {
3372
- a1(this);
3373
- }
3374
- segment(t, e, n) {
3375
- const r = typeof e != "function" ? e : {};
3376
- return this.j = typeof e == "function" ? e : n, pi(this), vt(this, t, r), gi(this);
3377
- }
3378
- La(t, e, n, r) {
3379
- const s = typeof n != "function" ? n : {};
3380
- return this.j = typeof n == "function" ? n : r, pi(this), Ft(this, t, s, e), gi(this);
3381
- }
3382
- Da() {
3383
- return this.u;
3384
- }
3385
- m() {
3386
- var t = new ht();
3387
- O(t, "image_in"), O(t, "norm_rect");
3388
- const e = new ct();
3389
- Tt(e, Zo, this.h);
3390
- const n = new Z();
3391
- it(n, 2, "mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"), F(n, "IMAGE:image_in"), F(n, "NORM_RECT:norm_rect"), n.o(e), gt(t, n), Rn(this, t), this.outputConfidenceMasks && (E(t, "confidence_masks"), w(n, "CONFIDENCE_MASKS:confidence_masks"), ve(this, "confidence_masks"), this.g.aa("confidence_masks", (r, s) => {
3392
- this.confidenceMasks = r.map((i) => be(this, i, !0, !this.j)), l(this, s);
3393
- }), this.g.attachEmptyPacketListener("confidence_masks", (r) => {
3394
- this.confidenceMasks = [], l(this, r);
3395
- })), this.outputCategoryMask && (E(t, "category_mask"), w(n, "CATEGORY_MASK:category_mask"), ve(this, "category_mask"), this.g.Z("category_mask", (r, s) => {
3396
- this.categoryMask = be(this, r, !1, !this.j), l(this, s);
3397
- }), this.g.attachEmptyPacketListener("category_mask", (r) => {
3398
- this.categoryMask = void 0, l(this, r);
3399
- })), E(t, "quality_scores"), w(n, "QUALITY_SCORES:quality_scores"), this.g.attachFloatVectorListener("quality_scores", (r, s) => {
3400
- this.qualityScores = r, l(this, s);
3401
- }), this.g.attachEmptyPacketListener("quality_scores", (r) => {
3402
- this.categoryMask = void 0, l(this, r);
3403
- }), t = t.g(), this.setGraph(new Uint8Array(t), !0);
3404
- }
3405
- };
3406
- $.prototype.getLabels = $.prototype.Da, $.prototype.segmentForVideo = $.prototype.La, $.prototype.segment = $.prototype.segment, $.prototype.setOptions = $.prototype.o, $.createFromModelPath = function(t, e) {
3407
- return b($, t, { baseOptions: { modelAssetPath: e } });
3408
- }, $.createFromModelBuffer = function(t, e) {
3409
- return b($, t, { baseOptions: { modelAssetBuffer: e } });
3410
- }, $.createFromOptions = function(t, e) {
3411
- return b($, t, e);
3412
- };
3413
- var fr = class {
3414
- constructor(t, e, n) {
3415
- this.confidenceMasks = t, this.categoryMask = e, this.qualityScores = n;
3416
- }
3417
- close() {
3418
- var t, e;
3419
- (t = this.confidenceMasks) == null || t.forEach((n) => {
3420
- n.close();
3421
- }), (e = this.categoryMask) == null || e.close();
3422
- }
3423
- };
3424
- fr.prototype.close = fr.prototype.close;
3425
- var bt = class extends at {
3426
- constructor(t, e) {
3427
- super(new yt(t, e), "image_in", "norm_rect_in", !1), this.outputCategoryMask = !1, this.outputConfidenceMasks = !0, this.h = new Qr(), this.u = new $o(), _(this.h, 0, 3, this.u), _(t = this.h, 0, 1, e = new I());
3428
- }
3429
- get baseOptions() {
3430
- return A(this.h, I, 1);
3431
- }
3432
- set baseOptions(t) {
3433
- _(this.h, 0, 1, t);
3434
- }
3435
- o(t) {
3436
- return "outputCategoryMask" in t && (this.outputCategoryMask = t.outputCategoryMask ?? !1), "outputConfidenceMasks" in t && (this.outputConfidenceMasks = t.outputConfidenceMasks ?? !0), super.l(t);
3437
- }
3438
- segment(t, e, n, r) {
3439
- const s = typeof n != "function" ? n : {};
3440
- if (this.j = typeof n == "function" ? n : r, this.qualityScores = this.categoryMask = this.confidenceMasks = void 0, n = this.C + 1, r = new Qo(), e.keypoint && e.scribble) throw Error("Cannot provide both keypoint and scribble.");
3441
- if (e.keypoint) {
3442
- var i = new qn();
3443
- Bt(i, 3, Ke(!0), !1), Bt(i, 1, De(e.keypoint.x), 0), Bt(i, 2, De(e.keypoint.y), 0), Ue(r, 1, or, i);
3444
- } else {
3445
- if (!e.scribble) throw Error("Must provide either a keypoint or a scribble.");
3446
- {
3447
- const a = new J2();
3448
- for (i of e.scribble) Bt(e = new qn(), 3, Ke(!0), !1), Bt(e, 1, De(i.x), 0), Bt(e, 2, De(i.y), 0), Ir(a, 1, qn, e);
3449
- Ue(r, 2, or, a);
3450
- }
3451
- }
3452
- this.g.addProtoToStream(r.g(), "mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest", "roi_in", n), vt(this, t, s);
3453
- t: {
40
+ }, this.detectLoop = () => {
41
+ var i;
42
+ if (this.state.status !== "capturing" || !this.webcam || !this.models.face) return;
43
+ const c = performance.now();
3454
44
  try {
3455
- const a = new fr(this.confidenceMasks, this.categoryMask, this.qualityScores);
3456
- if (!this.j) {
3457
- var o = a;
3458
- break t;
45
+ const r = this.models.face.detectForVideo(this.webcam, c), l = (i = this.models.hand) == null ? void 0 : i.detectForVideo(this.webcam, c), n = this.state.sequence[this.currentStepRef];
46
+ if (this.checkAction(r, l, n)) {
47
+ this.handleStepSuccess();
48
+ return;
3459
49
  }
3460
- this.j(a);
3461
- } finally {
3462
- Bn(this);
3463
- }
3464
- o = void 0;
3465
- }
3466
- return o;
3467
- }
3468
- m() {
3469
- var t = new ht();
3470
- O(t, "image_in"), O(t, "roi_in"), O(t, "norm_rect_in");
3471
- const e = new ct();
3472
- Tt(e, Zo, this.h);
3473
- const n = new Z();
3474
- it(n, 2, "mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"), F(n, "IMAGE:image_in"), F(n, "ROI:roi_in"), F(n, "NORM_RECT:norm_rect_in"), n.o(e), gt(t, n), Rn(this, t), this.outputConfidenceMasks && (E(t, "confidence_masks"), w(n, "CONFIDENCE_MASKS:confidence_masks"), ve(this, "confidence_masks"), this.g.aa("confidence_masks", (r, s) => {
3475
- this.confidenceMasks = r.map((i) => be(this, i, !0, !this.j)), l(this, s);
3476
- }), this.g.attachEmptyPacketListener("confidence_masks", (r) => {
3477
- this.confidenceMasks = [], l(this, r);
3478
- })), this.outputCategoryMask && (E(t, "category_mask"), w(n, "CATEGORY_MASK:category_mask"), ve(this, "category_mask"), this.g.Z("category_mask", (r, s) => {
3479
- this.categoryMask = be(this, r, !1, !this.j), l(this, s);
3480
- }), this.g.attachEmptyPacketListener("category_mask", (r) => {
3481
- this.categoryMask = void 0, l(this, r);
3482
- })), E(t, "quality_scores"), w(n, "QUALITY_SCORES:quality_scores"), this.g.attachFloatVectorListener("quality_scores", (r, s) => {
3483
- this.qualityScores = r, l(this, s);
3484
- }), this.g.attachEmptyPacketListener("quality_scores", (r) => {
3485
- this.categoryMask = void 0, l(this, r);
3486
- }), t = t.g(), this.setGraph(new Uint8Array(t), !0);
3487
- }
3488
- };
3489
- bt.prototype.segment = bt.prototype.segment, bt.prototype.setOptions = bt.prototype.o, bt.createFromModelPath = function(t, e) {
3490
- return b(bt, t, { baseOptions: { modelAssetPath: e } });
3491
- }, bt.createFromModelBuffer = function(t, e) {
3492
- return b(bt, t, { baseOptions: { modelAssetBuffer: e } });
3493
- }, bt.createFromOptions = function(t, e) {
3494
- return b(bt, t, e);
3495
- };
3496
- var ft = class extends at {
3497
- constructor(t, e) {
3498
- super(new yt(t, e), "input_frame_gpu", "norm_rect", !1), this.j = { detections: [] }, _(t = this.h = new ta(), 0, 1, e = new I());
3499
- }
3500
- get baseOptions() {
3501
- return A(this.h, I, 1);
3502
- }
3503
- set baseOptions(t) {
3504
- _(this.h, 0, 1, t);
3505
- }
3506
- o(t) {
3507
- return t.displayNamesLocale !== void 0 ? k(this.h, 2, Je(t.displayNamesLocale)) : "displayNamesLocale" in t && k(this.h, 2), t.maxResults !== void 0 ? It(this.h, 3, t.maxResults) : "maxResults" in t && k(this.h, 3), t.scoreThreshold !== void 0 ? m(this.h, 4, t.scoreThreshold) : "scoreThreshold" in t && k(this.h, 4), t.categoryAllowlist !== void 0 ? un(this.h, 5, t.categoryAllowlist) : "categoryAllowlist" in t && k(this.h, 5), t.categoryDenylist !== void 0 ? un(this.h, 6, t.categoryDenylist) : "categoryDenylist" in t && k(this.h, 6), this.l(t);
3508
- }
3509
- F(t, e) {
3510
- return this.j = { detections: [] }, vt(this, t, e), this.j;
3511
- }
3512
- G(t, e, n) {
3513
- return this.j = { detections: [] }, Ft(this, t, n, e), this.j;
3514
- }
3515
- m() {
3516
- var t = new ht();
3517
- O(t, "input_frame_gpu"), O(t, "norm_rect"), E(t, "detections");
3518
- const e = new ct();
3519
- Tt(e, Z2, this.h);
3520
- const n = new Z();
3521
- it(n, 2, "mediapipe.tasks.vision.ObjectDetectorGraph"), F(n, "IMAGE:input_frame_gpu"), F(n, "NORM_RECT:norm_rect"), w(n, "DETECTIONS:detections"), n.o(e), gt(t, n), this.g.attachProtoVectorListener("detections", (r, s) => {
3522
- for (const i of r) r = Oo(i), this.j.detections.push(ra(r));
3523
- l(this, s);
3524
- }), this.g.attachEmptyPacketListener("detections", (r) => {
3525
- l(this, r);
3526
- }), t = t.g(), this.setGraph(new Uint8Array(t), !0);
3527
- }
3528
- };
3529
- ft.prototype.detectForVideo = ft.prototype.G, ft.prototype.detect = ft.prototype.F, ft.prototype.setOptions = ft.prototype.o, ft.createFromModelPath = async function(t, e) {
3530
- return b(ft, t, { baseOptions: { modelAssetPath: e } });
3531
- }, ft.createFromModelBuffer = function(t, e) {
3532
- return b(ft, t, { baseOptions: { modelAssetBuffer: e } });
3533
- }, ft.createFromOptions = function(t, e) {
3534
- return b(ft, t, e);
3535
- };
3536
- var dr = class {
3537
- constructor(t, e, n) {
3538
- this.landmarks = t, this.worldLandmarks = e, this.segmentationMasks = n;
3539
- }
3540
- close() {
3541
- var t;
3542
- (t = this.segmentationMasks) == null || t.forEach((e) => {
3543
- e.close();
3544
- });
3545
- }
3546
- };
3547
- function mi(t) {
3548
- t.landmarks = [], t.worldLandmarks = [], t.segmentationMasks = void 0;
3549
- }
3550
- function _i(t) {
3551
- try {
3552
- const e = new dr(t.landmarks, t.worldLandmarks, t.segmentationMasks);
3553
- if (!t.u) return e;
3554
- t.u(e);
3555
- } finally {
3556
- Bn(t);
3557
- }
3558
- }
3559
- dr.prototype.close = dr.prototype.close;
3560
- var et = class extends at {
3561
- constructor(t, e) {
3562
- super(new yt(t, e), "image_in", "norm_rect", !1), this.landmarks = [], this.worldLandmarks = [], this.outputSegmentationMasks = !1, _(t = this.h = new ea(), 0, 1, e = new I()), this.A = new zo(), _(this.h, 0, 3, this.A), this.j = new Ko(), _(this.h, 0, 2, this.j), It(this.j, 4, 1), m(this.j, 2, 0.5), m(this.A, 2, 0.5), m(this.h, 4, 0.5);
3563
- }
3564
- get baseOptions() {
3565
- return A(this.h, I, 1);
3566
- }
3567
- set baseOptions(t) {
3568
- _(this.h, 0, 1, t);
3569
- }
3570
- o(t) {
3571
- return "numPoses" in t && It(this.j, 4, t.numPoses ?? 1), "minPoseDetectionConfidence" in t && m(this.j, 2, t.minPoseDetectionConfidence ?? 0.5), "minTrackingConfidence" in t && m(this.h, 4, t.minTrackingConfidence ?? 0.5), "minPosePresenceConfidence" in t && m(this.A, 2, t.minPosePresenceConfidence ?? 0.5), "outputSegmentationMasks" in t && (this.outputSegmentationMasks = t.outputSegmentationMasks ?? !1), this.l(t);
3572
- }
3573
- F(t, e, n) {
3574
- const r = typeof e != "function" ? e : {};
3575
- return this.u = typeof e == "function" ? e : n, mi(this), vt(this, t, r), _i(this);
3576
- }
3577
- G(t, e, n, r) {
3578
- const s = typeof n != "function" ? n : {};
3579
- return this.u = typeof n == "function" ? n : r, mi(this), Ft(this, t, s, e), _i(this);
3580
- }
3581
- m() {
3582
- var t = new ht();
3583
- O(t, "image_in"), O(t, "norm_rect"), E(t, "normalized_landmarks"), E(t, "world_landmarks"), E(t, "segmentation_masks");
3584
- const e = new ct();
3585
- Tt(e, Q2, this.h);
3586
- const n = new Z();
3587
- it(n, 2, "mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"), F(n, "IMAGE:image_in"), F(n, "NORM_RECT:norm_rect"), w(n, "NORM_LANDMARKS:normalized_landmarks"), w(n, "WORLD_LANDMARKS:world_landmarks"), n.o(e), gt(t, n), Rn(this, t), this.g.attachProtoVectorListener("normalized_landmarks", (r, s) => {
3588
- this.landmarks = [];
3589
- for (const i of r) r = tn(i), this.landmarks.push(Cn(r));
3590
- l(this, s);
3591
- }), this.g.attachEmptyPacketListener("normalized_landmarks", (r) => {
3592
- this.landmarks = [], l(this, r);
3593
- }), this.g.attachProtoVectorListener("world_landmarks", (r, s) => {
3594
- this.worldLandmarks = [];
3595
- for (const i of r) r = he(i), this.worldLandmarks.push(Ge(r));
3596
- l(this, s);
3597
- }), this.g.attachEmptyPacketListener("world_landmarks", (r) => {
3598
- this.worldLandmarks = [], l(this, r);
3599
- }), this.outputSegmentationMasks && (w(n, "SEGMENTATION_MASK:segmentation_masks"), ve(this, "segmentation_masks"), this.g.aa("segmentation_masks", (r, s) => {
3600
- this.segmentationMasks = r.map((i) => be(this, i, !0, !this.u)), l(this, s);
3601
- }), this.g.attachEmptyPacketListener("segmentation_masks", (r) => {
3602
- this.segmentationMasks = [], l(this, r);
3603
- })), t = t.g(), this.setGraph(new Uint8Array(t), !0);
3604
- }
3605
- };
3606
- et.prototype.detectForVideo = et.prototype.G, et.prototype.detect = et.prototype.F, et.prototype.setOptions = et.prototype.o, et.createFromModelPath = function(t, e) {
3607
- return b(et, t, { baseOptions: { modelAssetPath: e } });
3608
- }, et.createFromModelBuffer = function(t, e) {
3609
- return b(et, t, { baseOptions: { modelAssetBuffer: e } });
3610
- }, et.createFromOptions = function(t, e) {
3611
- return b(et, t, e);
3612
- }, et.POSE_CONNECTIONS = ya;
3613
- const c1 = ["Smile", "Blink", "Turn_Head", "Thumbs_Up"];
3614
- class h1 {
3615
- constructor(e) {
3616
- ls(this, "_detectLoop", () => {
3617
- var i, o;
3618
- if (this.state.status !== "capturing" || !this.videoElement) return;
3619
- const e = performance.now(), n = (i = this.models.face) == null ? void 0 : i.detectForVideo(this.videoElement, e), r = (o = this.models.hand) == null ? void 0 : o.detectForVideo(this.videoElement, e), s = this.state.sequence[this.state.currentStep];
3620
- this._checkAction(n, r, s) ? this._handleStepCompletion() : this.requestRef = requestAnimationFrame(this._detectLoop);
3621
- });
3622
- this.options = {
3623
- apiUrl: e.apiUrl,
3624
- duration: e.duration || 60,
3625
- smileThreshold: e.smileThreshold || 0.2,
3626
- blinkThreshold: e.blinkThreshold || 0.01,
3627
- minTurnHead: e.minTurnHead || 0.15,
3628
- maxTurnHead: e.maxTurnHead || 0.85,
3629
- onStateChange: e.onStateChange || (() => {
50
+ } catch (r) {
51
+ console.error("[LivenessEngine] Loop detection error:", r);
52
+ }
53
+ this.requestId = requestAnimationFrame(this.detectLoop);
54
+ }, this.config = {
55
+ apiUrl: t.apiUrl,
56
+ duration: t.duration ?? 60,
57
+ smileThreshold: t.smileThreshold ?? 0.2,
58
+ blinkThreshold: t.blinkThreshold ?? 0.012,
59
+ minturnHeadThreshold: t.minturnHeadThreshold ?? 0.15,
60
+ maxturnHeadThreshold: t.maxturnHeadThreshold ?? 0.85,
61
+ onStateChange: t.onStateChange || (() => {
62
+ }),
63
+ onComplete: t.onComplete || (() => {
64
+ }),
65
+ onError: t.onError || (() => {
3630
66
  })
3631
- }, this.models = { face: null, hand: null }, this.state = {
67
+ }, this.state = {
3632
68
  status: "loading",
3633
- // loading, ready, capturing, verifying, success, error, expired
3634
69
  sequence: [],
3635
70
  currentStep: 0,
3636
- timeLeft: this.options.duration,
71
+ timeLeft: this.config.duration,
3637
72
  isStepTransitioning: !1,
3638
73
  errorMsg: ""
3639
- }, this.videoElement = null, this.requestRef = null, this.timerInterval = null;
74
+ }, this.offscreenCanvas.width = 224, this.offscreenCanvas.height = 224;
3640
75
  }
3641
- // --- External Control ---
3642
- async init(e) {
3643
- this.videoElement = e;
76
+ /**
77
+ * Phase 1: Load AI Assets (Call this immediately on mount)
78
+ */
79
+ async loadModels() {
80
+ console.log("[LivenessEngine] Loading AI Models...");
3644
81
  try {
3645
- const n = await Wt.forVisionTasks(
82
+ const t = await re.forVisionTasks(
3646
83
  "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.3/wasm"
3647
84
  );
3648
- this.models.face = await M.createFromOptions(n, {
85
+ this.models.face = await se.createFromOptions(t, {
3649
86
  baseOptions: {
3650
87
  modelAssetPath: "https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task",
3651
88
  delegate: "GPU"
3652
89
  },
3653
90
  outputFaceBlendshapes: !0,
3654
91
  runningMode: "VIDEO"
3655
- }), this.models.hand = await J.createFromOptions(n, {
92
+ }), this.models.hand = await ne.createFromOptions(t, {
3656
93
  baseOptions: {
3657
94
  modelAssetPath: "https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task",
3658
95
  delegate: "GPU"
3659
96
  },
3660
97
  runningMode: "VIDEO",
3661
98
  numHands: 1
3662
- }), this._generateSequence(), this._updateState({ status: "ready" });
3663
- } catch {
3664
- this._updateState({ status: "error", errorMsg: "Failed to load security assets." });
99
+ }), this.generateSequence(), this.updateState({ status: "ready" }), console.log("[LivenessEngine] Models Loaded.");
100
+ } catch (t) {
101
+ console.error("[LivenessEngine] Init Error:", t), this.updateState({ status: "error", errorMsg: "Failed to load security assets." });
3665
102
  }
3666
103
  }
3667
- start() {
3668
- this.state.status === "ready" && (this._updateState({ status: "capturing" }), this._startTimer(), this._detectLoop());
104
+ updateState(t) {
105
+ this.state = { ...this.state, ...t }, this.config.onStateChange(this.state);
3669
106
  }
3670
- reset() {
3671
- this.stop(), this._generateSequence(), this._updateState({
3672
- status: "ready",
3673
- currentStep: 0,
3674
- timeLeft: this.options.duration,
3675
- isStepTransitioning: !1,
3676
- errorMsg: ""
3677
- });
107
+ generateSequence() {
108
+ const t = [...this.CHALLENGE_POOL].sort(() => 0.5 - Math.random()).slice(0, 3);
109
+ return this.state.sequence = t, t;
3678
110
  }
3679
- stop() {
3680
- cancelAnimationFrame(this.requestRef), clearInterval(this.timerInterval);
3681
- }
3682
- // --- Internal Logic ---
3683
- _updateState(e) {
3684
- this.state = { ...this.state, ...e }, this.options.onStateChange(this.state);
3685
- }
3686
- _generateSequence() {
3687
- const e = [...c1].sort(() => 0.5 - Math.random()).slice(0, 3);
3688
- this._updateState({ sequence: e });
3689
- }
3690
- _startTimer() {
3691
- this.timerInterval = setInterval(() => {
3692
- const e = this.state.timeLeft - 1;
3693
- e <= 0 ? (this.stop(), this._updateState({ timeLeft: 0, status: "expired" })) : this._updateState({ timeLeft: e });
111
+ startTimer() {
112
+ this.timerId && clearInterval(this.timerId), this.timerId = setInterval(() => {
113
+ this.state.timeLeft > 0 ? this.updateState({ timeLeft: this.state.timeLeft - 1 }) : (this.stop(), this.updateState({ status: "expired" }));
3694
114
  }, 1e3);
3695
115
  }
3696
- _handleStepCompletion() {
3697
- this.state.isStepTransitioning || (this._updateState({ isStepTransitioning: !0 }), setTimeout(() => {
3698
- this.state.currentStep < this.state.sequence.length - 1 ? (this._updateState({
3699
- currentStep: this.state.currentStep + 1,
116
+ handleStepSuccess() {
117
+ this.isStepTransitioningRef || (this.isStepTransitioningRef = !0, this.updateState({ isStepTransitioning: !0 }), setTimeout(() => {
118
+ this.currentStepRef < this.state.sequence.length - 1 ? (this.currentStepRef++, this.isStepTransitioningRef = !1, this.updateState({
119
+ currentStep: this.currentStepRef,
3700
120
  isStepTransitioning: !1
3701
- }), this._detectLoop()) : this._sendFinalProof();
121
+ }), this.requestId = requestAnimationFrame(this.detectLoop)) : this.sendFinalProof();
3702
122
  }, 1500));
3703
123
  }
3704
- _checkAction(e, n, r) {
3705
- var s, i;
3706
- if (this.state.isStepTransitioning) return !1;
3707
- if (r === "Thumbs_Up" && ((s = n == null ? void 0 : n.landmarks) == null ? void 0 : s.length) > 0) {
3708
- const o = n.landmarks[0];
3709
- return o[4].y < o[2].y && [8, 12, 16, 20].every((a) => o[a].y > o[a - 2].y);
124
+ checkAction(t, c, i) {
125
+ var r, l;
126
+ if (this.isStepTransitioningRef) return !1;
127
+ if (i === "Thumbs_Up" && ((r = c == null ? void 0 : c.landmarks) == null ? void 0 : r.length) > 0) {
128
+ const n = c.landmarks[0];
129
+ return n[4].y < n[2].y && [8, 12, 16, 20].every((a) => n[a].y > n[a - 2].y);
3710
130
  }
3711
- if (((i = e == null ? void 0 : e.faceLandmarks) == null ? void 0 : i.length) > 0) {
3712
- const o = e.faceLandmarks[0];
3713
- switch (r) {
131
+ if (((l = t == null ? void 0 : t.faceLandmarks) == null ? void 0 : l.length) > 0) {
132
+ const n = t.faceLandmarks[0];
133
+ switch (i) {
3714
134
  case "Smile":
3715
- return o[291].x - o[61].x > this.options.smileThreshold;
135
+ return n[291].x - n[61].x > this.config.smileThreshold;
3716
136
  case "Blink":
3717
- return (Math.abs(o[159].y - o[145].y) + Math.abs(o[386].y - o[374].y)) / 2 < this.options.blinkThreshold;
137
+ const a = Math.abs(n[159].y - n[145].y), h = Math.abs(n[386].y - n[374].y);
138
+ return (a + h) / 2 < this.config.blinkThreshold;
3718
139
  case "Turn_Head":
3719
- const c = (o[1].x - o[33].x) / (o[263].x - o[33].x);
3720
- return c < this.options.minTurnHead || c > this.options.maxTurnHead;
140
+ const m = (n[1].x - n[33].x) / (n[263].x - n[33].x);
141
+ return m < this.config.minturnHeadThreshold || m > this.config.maxturnHeadThreshold;
142
+ default:
143
+ return !1;
3721
144
  }
3722
145
  }
3723
146
  return !1;
3724
147
  }
3725
- async _sendFinalProof() {
3726
- this.stop(), this._updateState({ status: "verifying" });
148
+ async sendFinalProof() {
149
+ var t, c;
150
+ this.stop(), this.updateState({ status: "verifying" });
3727
151
  try {
3728
- const e = await this._captureFrames(), n = new FormData();
3729
- for (let i = 0; i < e.length; i++) {
3730
- const o = await (await fetch(e[i])).blob();
3731
- n.append("files", o, `frame_${i}.jpg`);
152
+ const i = [];
153
+ let r = "";
154
+ for (let a = 0; a < 5 && this.webcam; a++) {
155
+ const h = (t = this.models.face) == null ? void 0 : t.detectForVideo(this.webcam, performance.now());
156
+ if ((c = h == null ? void 0 : h.faceLandmarks) != null && c[0]) {
157
+ const m = this.getFaceCrop(this.webcam, h.faceLandmarks[0]), o = await new Promise((g) => m.toBlob(g, "image/jpeg", 0.9));
158
+ o && i.push(o), a === 4 && (r = m.toDataURL("image/jpeg"));
159
+ }
160
+ await new Promise((m) => setTimeout(m, 100));
161
+ }
162
+ const { verifyLiveness: l } = await Promise.resolve().then(() => le), n = await l(this.config.apiUrl, i, this.state.sequence);
163
+ if (n.is_live)
164
+ this.updateState({ status: "success" }), this.config.onComplete({ success: !0, image: r, skinConfidence: n.skin_confidence });
165
+ else {
166
+ const a = n.reason || "Liveness check failed";
167
+ this.updateState({ status: "error", errorMsg: a }), this.config.onError({ success: !1, reason: a });
3732
168
  }
3733
- const s = await (await fetch(`${this.options.apiUrl}/v1/verify`, { method: "POST", body: n })).json();
3734
- s.is_live ? this._updateState({ status: "success" }) : this._updateState({ status: "error", errorMsg: s.reason || "Spoof detected." });
3735
169
  } catch {
3736
- this._updateState({ status: "error", errorMsg: "Server unreachable." });
3737
- }
3738
- }
3739
- async _captureFrames() {
3740
- var n, r;
3741
- const e = [];
3742
- for (let s = 0; s < 5; s++) {
3743
- const i = (n = this.models.face) == null ? void 0 : n.detectForVideo(this.videoElement, performance.now());
3744
- (r = i == null ? void 0 : i.faceLandmarks) != null && r[0] && e.push(this._getFaceCrop(this.videoElement, i.faceLandmarks[0])), await new Promise((o) => setTimeout(o, 60));
3745
- }
3746
- return e;
3747
- }
3748
- _getFaceCrop(e, n) {
3749
- const r = document.createElement("canvas"), s = r.getContext("2d"), i = n.map((x) => x.x * e.videoWidth), o = n.map((x) => x.y * e.videoHeight), a = Math.min(...i), c = Math.max(...i), u = Math.min(...o), h = Math.max(...o), f = c - a, y = h - u, v = f * 0.25;
3750
- return r.width = 224, r.height = 224, s.drawImage(e, a - v, u - v, f + v * 2, y + v * 2, 0, 0, 224, 224), r.toDataURL("image/jpeg", 0.95);
3751
- }
3752
- }
3753
- const d1 = (t) => {
3754
- var i;
3755
- const [e, n] = ba({
170
+ this.updateState({ status: "error", errorMsg: "Verification failed." }), this.config.onError({ success: !1, reason: "Network error" });
171
+ }
172
+ }
173
+ getFaceCrop(t, c) {
174
+ const i = this.offscreenCanvas.getContext("2d"), r = c.map((E) => E.x * t.videoWidth), l = c.map((E) => E.y * t.videoHeight), n = Math.min(...r), a = Math.max(...r), h = Math.min(...l), m = Math.max(...l), o = a - n, g = m - h, S = o * 0.3;
175
+ return i.clearRect(0, 0, 224, 224), i.drawImage(
176
+ t,
177
+ n - S,
178
+ h - S,
179
+ o + S * 2,
180
+ g + S * 2,
181
+ 0,
182
+ 0,
183
+ 224,
184
+ 224
185
+ ), this.offscreenCanvas;
186
+ }
187
+ }
188
+ const de = (p) => {
189
+ const [t, c] = ie({
3756
190
  status: "loading",
3757
191
  sequence: [],
3758
192
  currentStep: 0,
3759
- timeLeft: t.duration || 60,
193
+ timeLeft: p.duration || 60,
3760
194
  isStepTransitioning: !1,
3761
195
  errorMsg: ""
3762
- }), r = fs(null), s = fs(null);
3763
- return ds(() => (r.current = new h1({
196
+ }), i = q(null), r = q(null);
197
+ Y(() => {
198
+ const a = new ue({
199
+ ...p,
200
+ onStateChange: (h) => c({ ...h })
201
+ });
202
+ return i.current = a, a.loadModels(), () => a.stop();
203
+ }, []), Y(() => {
204
+ var a, h;
205
+ if (t.status !== "loading" && t.status !== "error") {
206
+ const m = (a = r.current) == null ? void 0 : a.video;
207
+ if (m && m.readyState >= 2)
208
+ (h = i.current) == null || h.attachVideo(m);
209
+ else {
210
+ const o = setInterval(() => {
211
+ var S, E;
212
+ const g = (S = r.current) == null ? void 0 : S.video;
213
+ g && g.readyState >= 2 && ((E = i.current) == null || E.attachVideo(g), clearInterval(o));
214
+ }, 100);
215
+ return () => clearInterval(o);
216
+ }
217
+ }
218
+ }, [t.status]);
219
+ const l = V(() => {
220
+ var a;
221
+ console.log("[Hook] Start Clicked"), (a = i.current) == null || a.start();
222
+ }, []), n = V(() => {
223
+ var a;
224
+ console.log("[Hook] Reset Clicked"), (a = i.current) == null || a.reset();
225
+ }, []);
226
+ return {
3764
227
  ...t,
3765
- onStateChange: (o) => n(o)
3766
- }), () => {
3767
- var o;
3768
- return (o = r.current) == null ? void 0 : o.stop();
3769
- }), []), ds(() => {
3770
- var o;
3771
- (o = s.current) != null && o.video && e.status === "loading" && r.current.init(s.current.video);
3772
- }, [(i = s.current) == null ? void 0 : i.video]), {
3773
- ...e,
3774
- webcamRef: s,
3775
- start: ps(() => {
3776
- var o;
3777
- return (o = r.current) == null ? void 0 : o.start();
3778
- }, []),
3779
- reset: ps(() => {
3780
- var o;
3781
- return (o = r.current) == null ? void 0 : o.reset();
3782
- }, [])
228
+ webcamRef: r,
229
+ start: l,
230
+ reset: n
3783
231
  };
3784
232
  };
233
+ var A = { exports: {} }, _ = {};
234
+ /**
235
+ * @license React
236
+ * react-jsx-runtime.production.js
237
+ *
238
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
239
+ *
240
+ * This source code is licensed under the MIT license found in the
241
+ * LICENSE file in the root directory of this source tree.
242
+ */
243
+ var D;
244
+ function fe() {
245
+ if (D) return _;
246
+ D = 1;
247
+ var p = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
248
+ function c(i, r, l) {
249
+ var n = null;
250
+ if (l !== void 0 && (n = "" + l), r.key !== void 0 && (n = "" + r.key), "key" in r) {
251
+ l = {};
252
+ for (var a in r)
253
+ a !== "key" && (l[a] = r[a]);
254
+ } else l = r;
255
+ return r = l.ref, {
256
+ $$typeof: p,
257
+ type: i,
258
+ key: n,
259
+ ref: r !== void 0 ? r : null,
260
+ props: l
261
+ };
262
+ }
263
+ return _.Fragment = t, _.jsx = c, _.jsxs = c, _;
264
+ }
265
+ var T = {};
266
+ /**
267
+ * @license React
268
+ * react-jsx-runtime.development.js
269
+ *
270
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
271
+ *
272
+ * This source code is licensed under the MIT license found in the
273
+ * LICENSE file in the root directory of this source tree.
274
+ */
275
+ var $;
276
+ function he() {
277
+ return $ || ($ = 1, process.env.NODE_ENV !== "production" && function() {
278
+ function p(e) {
279
+ if (e == null) return null;
280
+ if (typeof e == "function")
281
+ return e.$$typeof === K ? null : e.displayName || e.name || null;
282
+ if (typeof e == "string") return e;
283
+ switch (e) {
284
+ case y:
285
+ return "Fragment";
286
+ case W:
287
+ return "Profiler";
288
+ case H:
289
+ return "StrictMode";
290
+ case J:
291
+ return "Suspense";
292
+ case X:
293
+ return "SuspenseList";
294
+ case Q:
295
+ return "Activity";
296
+ }
297
+ if (typeof e == "object")
298
+ switch (typeof e.tag == "number" && console.error(
299
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
300
+ ), e.$$typeof) {
301
+ case U:
302
+ return "Portal";
303
+ case z:
304
+ return e.displayName || "Context";
305
+ case G:
306
+ return (e._context.displayName || "Context") + ".Consumer";
307
+ case B:
308
+ var s = e.render;
309
+ return e = e.displayName, e || (e = s.displayName || s.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
310
+ case Z:
311
+ return s = e.displayName || null, s !== null ? s : p(e.type) || "Memo";
312
+ case w:
313
+ s = e._payload, e = e._init;
314
+ try {
315
+ return p(e(s));
316
+ } catch {
317
+ }
318
+ }
319
+ return null;
320
+ }
321
+ function t(e) {
322
+ return "" + e;
323
+ }
324
+ function c(e) {
325
+ try {
326
+ t(e);
327
+ var s = !1;
328
+ } catch {
329
+ s = !0;
330
+ }
331
+ if (s) {
332
+ s = console;
333
+ var u = s.error, d = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
334
+ return u.call(
335
+ s,
336
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
337
+ d
338
+ ), t(e);
339
+ }
340
+ }
341
+ function i(e) {
342
+ if (e === y) return "<>";
343
+ if (typeof e == "object" && e !== null && e.$$typeof === w)
344
+ return "<...>";
345
+ try {
346
+ var s = p(e);
347
+ return s ? "<" + s + ">" : "<...>";
348
+ } catch {
349
+ return "<...>";
350
+ }
351
+ }
352
+ function r() {
353
+ var e = R.A;
354
+ return e === null ? null : e.getOwner();
355
+ }
356
+ function l() {
357
+ return Error("react-stack-top-frame");
358
+ }
359
+ function n(e) {
360
+ if (P.call(e, "key")) {
361
+ var s = Object.getOwnPropertyDescriptor(e, "key").get;
362
+ if (s && s.isReactWarning) return !1;
363
+ }
364
+ return e.key !== void 0;
365
+ }
366
+ function a(e, s) {
367
+ function u() {
368
+ C || (C = !0, console.error(
369
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
370
+ s
371
+ ));
372
+ }
373
+ u.isReactWarning = !0, Object.defineProperty(e, "key", {
374
+ get: u,
375
+ configurable: !0
376
+ });
377
+ }
378
+ function h() {
379
+ var e = p(this.type);
380
+ return I[e] || (I[e] = !0, console.error(
381
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
382
+ )), e = this.props.ref, e !== void 0 ? e : null;
383
+ }
384
+ function m(e, s, u, d, k, O) {
385
+ var f = u.ref;
386
+ return e = {
387
+ $$typeof: L,
388
+ type: e,
389
+ key: s,
390
+ props: u,
391
+ _owner: d
392
+ }, (f !== void 0 ? f : null) !== null ? Object.defineProperty(e, "ref", {
393
+ enumerable: !1,
394
+ get: h
395
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
396
+ configurable: !1,
397
+ enumerable: !1,
398
+ writable: !0,
399
+ value: 0
400
+ }), Object.defineProperty(e, "_debugInfo", {
401
+ configurable: !1,
402
+ enumerable: !1,
403
+ writable: !0,
404
+ value: null
405
+ }), Object.defineProperty(e, "_debugStack", {
406
+ configurable: !1,
407
+ enumerable: !1,
408
+ writable: !0,
409
+ value: k
410
+ }), Object.defineProperty(e, "_debugTask", {
411
+ configurable: !1,
412
+ enumerable: !1,
413
+ writable: !0,
414
+ value: O
415
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
416
+ }
417
+ function o(e, s, u, d, k, O) {
418
+ var f = s.children;
419
+ if (f !== void 0)
420
+ if (d)
421
+ if (ee(f)) {
422
+ for (d = 0; d < f.length; d++)
423
+ g(f[d]);
424
+ Object.freeze && Object.freeze(f);
425
+ } else
426
+ console.error(
427
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
428
+ );
429
+ else g(f);
430
+ if (P.call(s, "key")) {
431
+ f = p(e);
432
+ var b = Object.keys(s).filter(function(te) {
433
+ return te !== "key";
434
+ });
435
+ d = 0 < b.length ? "{key: someKey, " + b.join(": ..., ") + ": ...}" : "{key: someKey}", M[f + d] || (b = 0 < b.length ? "{" + b.join(": ..., ") + ": ...}" : "{}", console.error(
436
+ `A props object containing a "key" prop is being spread into JSX:
437
+ let props = %s;
438
+ <%s {...props} />
439
+ React keys must be passed directly to JSX without using spread:
440
+ let props = %s;
441
+ <%s key={someKey} {...props} />`,
442
+ d,
443
+ f,
444
+ b,
445
+ f
446
+ ), M[f + d] = !0);
447
+ }
448
+ if (f = null, u !== void 0 && (c(u), f = "" + u), n(s) && (c(s.key), f = "" + s.key), "key" in s) {
449
+ u = {};
450
+ for (var j in s)
451
+ j !== "key" && (u[j] = s[j]);
452
+ } else u = s;
453
+ return f && a(
454
+ u,
455
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
456
+ ), m(
457
+ e,
458
+ f,
459
+ u,
460
+ r(),
461
+ k,
462
+ O
463
+ );
464
+ }
465
+ function g(e) {
466
+ S(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === w && (e._payload.status === "fulfilled" ? S(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
467
+ }
468
+ function S(e) {
469
+ return typeof e == "object" && e !== null && e.$$typeof === L;
470
+ }
471
+ var E = ae, L = Symbol.for("react.transitional.element"), U = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), H = Symbol.for("react.strict_mode"), W = Symbol.for("react.profiler"), G = Symbol.for("react.consumer"), z = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), J = Symbol.for("react.suspense"), X = Symbol.for("react.suspense_list"), Z = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), Q = Symbol.for("react.activity"), K = Symbol.for("react.client.reference"), R = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, P = Object.prototype.hasOwnProperty, ee = Array.isArray, x = console.createTask ? console.createTask : function() {
472
+ return null;
473
+ };
474
+ E = {
475
+ react_stack_bottom_frame: function(e) {
476
+ return e();
477
+ }
478
+ };
479
+ var C, I = {}, N = E.react_stack_bottom_frame.bind(
480
+ E,
481
+ l
482
+ )(), F = x(i(l)), M = {};
483
+ T.Fragment = y, T.jsx = function(e, s, u) {
484
+ var d = 1e4 > R.recentlyCreatedOwnerStacks++;
485
+ return o(
486
+ e,
487
+ s,
488
+ u,
489
+ !1,
490
+ d ? Error("react-stack-top-frame") : N,
491
+ d ? x(i(e)) : F
492
+ );
493
+ }, T.jsxs = function(e, s, u) {
494
+ var d = 1e4 > R.recentlyCreatedOwnerStacks++;
495
+ return o(
496
+ e,
497
+ s,
498
+ u,
499
+ !0,
500
+ d ? Error("react-stack-top-frame") : N,
501
+ d ? x(i(e)) : F
502
+ );
503
+ };
504
+ }()), T;
505
+ }
506
+ process.env.NODE_ENV === "production" ? A.exports = fe() : A.exports = he();
507
+ var v = A.exports;
508
+ const ve = ({
509
+ apiUrl: p,
510
+ duration: t,
511
+ onComplete: c,
512
+ onError: i,
513
+ classNames: r = {},
514
+ render: l,
515
+ smileThreshold: n,
516
+ blinkThreshold: a,
517
+ minturnHeadThreshold: h,
518
+ maxturnHeadThreshold: m
519
+ }) => {
520
+ var g;
521
+ const o = de({ apiUrl: p, duration: t, smileThreshold: n, blinkThreshold: a, minturnHeadThreshold: h, maxturnHeadThreshold: m, onComplete: c, onError: i });
522
+ return l ? l(o) : /* @__PURE__ */ v.jsxs("div", { className: r.container, children: [
523
+ o.status === "loading" && /* @__PURE__ */ v.jsx("div", { children: "Initializing..." }),
524
+ ["ready", "capturing", "verifying"].includes(o.status) && /* @__PURE__ */ v.jsxs(v.Fragment, { children: [
525
+ /* @__PURE__ */ v.jsx(
526
+ oe,
527
+ {
528
+ ref: o.webcamRef,
529
+ mirrored: !0,
530
+ screenshotFormat: "image/jpeg",
531
+ className: r.webcam
532
+ }
533
+ ),
534
+ o.status === "capturing" && /* @__PURE__ */ v.jsx("div", { className: "liveness-challenge", children: o.isStepTransitioning ? "Step verified! Get ready for the next..." : `Do this: ${(g = o.sequence[o.currentStep]) == null ? void 0 : g.replace("_", " ")}` }),
535
+ ["capturing", "ready"].includes(o.status) && /* @__PURE__ */ v.jsxs("div", { className: r.timer, children: [
536
+ o.timeLeft,
537
+ "s"
538
+ ] }),
539
+ o.status === "ready" && /* @__PURE__ */ v.jsx("button", { onClick: o.start, className: r.button, children: "Start Challenge" }),
540
+ o.status === "verifying" && /* @__PURE__ */ v.jsx("div", { children: "Analyzing..." })
541
+ ] }),
542
+ o.status === "error" && /* @__PURE__ */ v.jsxs("div", { className: r.error, children: [
543
+ o.errorMsg,
544
+ /* @__PURE__ */ v.jsx("button", { onClick: o.reset, className: r.button, children: "Retry" })
545
+ ] }),
546
+ o.status === "success" && /* @__PURE__ */ v.jsx("div", { className: r.success, children: "Verification Complete" })
547
+ ] });
548
+ };
3785
549
  export {
3786
- h1 as LivenessEngine,
3787
- d1 as useLiveness,
3788
- f1 as verifyLiveness
550
+ ue as LivenessEngine,
551
+ ve as LivenessSDK,
552
+ de as useLiveness,
553
+ ce as verifyLiveness
3789
554
  };