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