@tradalab/mediakit 1.0.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/worker.js ADDED
@@ -0,0 +1,4538 @@
1
+ "use strict";
2
+ (() => {
3
+ // node_modules/.pnpm/@mediapipe+tasks-vision@0.10.14/node_modules/@mediapipe/tasks-vision/vision_bundle.mjs
4
+ var t = "undefined" != typeof self ? self : {};
5
+ function e(e2) {
6
+ t: {
7
+ for (var n2 = ["CLOSURE_FLAGS"], r2 = t, i2 = 0; i2 < n2.length; i2++) if (null == (r2 = r2[n2[i2]])) {
8
+ n2 = null;
9
+ break t;
10
+ }
11
+ n2 = r2;
12
+ }
13
+ return null != (e2 = n2 && n2[e2]) && e2;
14
+ }
15
+ function n() {
16
+ throw Error("Invalid UTF8");
17
+ }
18
+ function r(t2, e2) {
19
+ return e2 = String.fromCharCode.apply(null, e2), null == t2 ? e2 : t2 + e2;
20
+ }
21
+ var i;
22
+ var s;
23
+ var o = "undefined" != typeof TextDecoder;
24
+ var a;
25
+ var h = "undefined" != typeof TextEncoder;
26
+ function c(t2) {
27
+ if (h) t2 = (a ||= new TextEncoder()).encode(t2);
28
+ else {
29
+ let n2 = 0;
30
+ const r2 = new Uint8Array(3 * t2.length);
31
+ for (let i2 = 0; i2 < t2.length; i2++) {
32
+ var e2 = t2.charCodeAt(i2);
33
+ if (128 > e2) r2[n2++] = e2;
34
+ else {
35
+ if (2048 > e2) r2[n2++] = e2 >> 6 | 192;
36
+ else {
37
+ if (55296 <= e2 && 57343 >= e2) {
38
+ if (56319 >= e2 && i2 < t2.length) {
39
+ const s2 = t2.charCodeAt(++i2);
40
+ if (56320 <= s2 && 57343 >= s2) {
41
+ e2 = 1024 * (e2 - 55296) + s2 - 56320 + 65536, r2[n2++] = e2 >> 18 | 240, r2[n2++] = e2 >> 12 & 63 | 128, r2[n2++] = e2 >> 6 & 63 | 128, r2[n2++] = 63 & e2 | 128;
42
+ continue;
43
+ }
44
+ i2--;
45
+ }
46
+ e2 = 65533;
47
+ }
48
+ r2[n2++] = e2 >> 12 | 224, r2[n2++] = e2 >> 6 & 63 | 128;
49
+ }
50
+ r2[n2++] = 63 & e2 | 128;
51
+ }
52
+ }
53
+ t2 = n2 === r2.length ? r2 : r2.subarray(0, n2);
54
+ }
55
+ return t2;
56
+ }
57
+ var u;
58
+ var l = e(610401301);
59
+ var d = e(188588736);
60
+ var f = t.navigator;
61
+ function p(t2) {
62
+ return !!l && (!!u && u.brands.some((({ brand: e2 }) => e2 && -1 != e2.indexOf(t2))));
63
+ }
64
+ function g(e2) {
65
+ var n2;
66
+ return (n2 = t.navigator) && (n2 = n2.userAgent) || (n2 = ""), -1 != n2.indexOf(e2);
67
+ }
68
+ function m() {
69
+ return !!l && (!!u && 0 < u.brands.length);
70
+ }
71
+ function y() {
72
+ return m() ? p("Chromium") : (g("Chrome") || g("CriOS")) && !(!m() && g("Edge")) || g("Silk");
73
+ }
74
+ function _(t2) {
75
+ return _[" "](t2), t2;
76
+ }
77
+ u = f && f.userAgentData || null, _[" "] = function() {
78
+ };
79
+ var v = !m() && (g("Trident") || g("MSIE"));
80
+ !g("Android") || y(), y(), g("Safari") && (y() || !m() && g("Coast") || !m() && g("Opera") || !m() && g("Edge") || (m() ? p("Microsoft Edge") : g("Edg/")) || m() && p("Opera"));
81
+ var E = {};
82
+ var w = null;
83
+ function T(t2) {
84
+ var e2 = t2.length, n2 = 3 * e2 / 4;
85
+ n2 % 3 ? n2 = Math.floor(n2) : -1 != "=.".indexOf(t2[e2 - 1]) && (n2 = -1 != "=.".indexOf(t2[e2 - 2]) ? n2 - 2 : n2 - 1);
86
+ var r2 = new Uint8Array(n2), i2 = 0;
87
+ return (function(t3, e3) {
88
+ function n3(e4) {
89
+ for (; r3 < t3.length; ) {
90
+ var n4 = t3.charAt(r3++), i4 = w[n4];
91
+ if (null != i4) return i4;
92
+ if (!/^[\s\xa0]*$/.test(n4)) throw Error("Unknown base64 encoding at char: " + n4);
93
+ }
94
+ return e4;
95
+ }
96
+ A();
97
+ for (var r3 = 0; ; ) {
98
+ var i3 = n3(-1), s2 = n3(0), o2 = n3(64), a2 = n3(64);
99
+ if (64 === a2 && -1 === i3) break;
100
+ e3(i3 << 2 | s2 >> 4), 64 != o2 && (e3(s2 << 4 & 240 | o2 >> 2), 64 != a2 && e3(o2 << 6 & 192 | a2));
101
+ }
102
+ })(t2, (function(t3) {
103
+ r2[i2++] = t3;
104
+ })), i2 !== n2 ? r2.subarray(0, i2) : r2;
105
+ }
106
+ function A() {
107
+ if (!w) {
108
+ w = {};
109
+ for (var t2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""), e2 = ["+/=", "+/", "-_=", "-_.", "-_"], n2 = 0; 5 > n2; n2++) {
110
+ var r2 = t2.concat(e2[n2].split(""));
111
+ E[n2] = r2;
112
+ for (var i2 = 0; i2 < r2.length; i2++) {
113
+ var s2 = r2[i2];
114
+ void 0 === w[s2] && (w[s2] = i2);
115
+ }
116
+ }
117
+ }
118
+ }
119
+ var b = "undefined" != typeof Uint8Array;
120
+ var k = !v && "function" == typeof btoa;
121
+ function x(t2) {
122
+ if (!k) {
123
+ var e2;
124
+ void 0 === e2 && (e2 = 0), A(), e2 = E[e2];
125
+ var n2 = Array(Math.floor(t2.length / 3)), r2 = e2[64] || "";
126
+ let h2 = 0, c2 = 0;
127
+ for (; h2 < t2.length - 2; h2 += 3) {
128
+ var i2 = t2[h2], s2 = t2[h2 + 1], o2 = t2[h2 + 2], a2 = e2[i2 >> 2];
129
+ i2 = e2[(3 & i2) << 4 | s2 >> 4], s2 = e2[(15 & s2) << 2 | o2 >> 6], o2 = e2[63 & o2], n2[c2++] = a2 + i2 + s2 + o2;
130
+ }
131
+ switch (a2 = 0, o2 = r2, t2.length - h2) {
132
+ case 2:
133
+ o2 = e2[(15 & (a2 = t2[h2 + 1])) << 2] || r2;
134
+ case 1:
135
+ t2 = t2[h2], n2[c2] = e2[t2 >> 2] + e2[(3 & t2) << 4 | a2 >> 4] + o2 + r2;
136
+ }
137
+ return n2.join("");
138
+ }
139
+ for (e2 = "", n2 = 0, r2 = t2.length - 10240; n2 < r2; ) e2 += String.fromCharCode.apply(null, t2.subarray(n2, n2 += 10240));
140
+ return e2 += String.fromCharCode.apply(null, n2 ? t2.subarray(n2) : t2), btoa(e2);
141
+ }
142
+ var S = /[-_.]/g;
143
+ var L = { "-": "+", _: "/", ".": "=" };
144
+ function F(t2) {
145
+ return L[t2] || "";
146
+ }
147
+ function R(t2) {
148
+ if (!k) return T(t2);
149
+ S.test(t2) && (t2 = t2.replace(S, F)), t2 = atob(t2);
150
+ const e2 = new Uint8Array(t2.length);
151
+ for (let n2 = 0; n2 < t2.length; n2++) e2[n2] = t2.charCodeAt(n2);
152
+ return e2;
153
+ }
154
+ function M(t2) {
155
+ return b && null != t2 && t2 instanceof Uint8Array;
156
+ }
157
+ var P;
158
+ function C() {
159
+ return P ||= new Uint8Array(0);
160
+ }
161
+ var O = {};
162
+ var I;
163
+ function U(t2) {
164
+ if (t2 !== O) throw Error("illegal external caller");
165
+ }
166
+ function D() {
167
+ return I ||= new B(null, O);
168
+ }
169
+ function N(t2) {
170
+ U(O);
171
+ var e2 = t2.g;
172
+ return null == (e2 = null == e2 || M(e2) ? e2 : "string" == typeof e2 ? R(e2) : null) ? e2 : t2.g = e2;
173
+ }
174
+ var B = class {
175
+ constructor(t2, e2) {
176
+ if (U(e2), this.g = t2, null != t2 && 0 === t2.length) throw Error("ByteString should be constructed with non-empty values");
177
+ }
178
+ h() {
179
+ const t2 = N(this);
180
+ return t2 ? new Uint8Array(t2) : C();
181
+ }
182
+ };
183
+ function G(t2, e2) {
184
+ return Error(`Invalid wire type: ${t2} (at position ${e2})`);
185
+ }
186
+ function j() {
187
+ return Error("Failed to read varint, encoding is invalid.");
188
+ }
189
+ function V(t2, e2) {
190
+ return Error(`Tried to read past the end of the data ${e2} > ${t2}`);
191
+ }
192
+ function X(t2) {
193
+ if ("string" == typeof t2) return { buffer: R(t2), P: false };
194
+ if (Array.isArray(t2)) return { buffer: new Uint8Array(t2), P: false };
195
+ if (t2.constructor === Uint8Array) return { buffer: t2, P: false };
196
+ if (t2.constructor === ArrayBuffer) return { buffer: new Uint8Array(t2), P: false };
197
+ if (t2.constructor === B) return { buffer: N(t2) || C(), P: true };
198
+ if (t2 instanceof Uint8Array) return { buffer: new Uint8Array(t2.buffer, t2.byteOffset, t2.byteLength), P: false };
199
+ throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers");
200
+ }
201
+ function H() {
202
+ return "function" == typeof BigInt;
203
+ }
204
+ var W = "function" == typeof Uint8Array.prototype.slice;
205
+ var z;
206
+ var K = 0;
207
+ var Y = 0;
208
+ function $(t2) {
209
+ const e2 = 0 > t2;
210
+ let n2 = (t2 = Math.abs(t2)) >>> 0;
211
+ if (t2 = Math.floor((t2 - n2) / 4294967296), e2) {
212
+ const [e3, r2] = rt(n2, t2);
213
+ t2 = r2, n2 = e3;
214
+ }
215
+ K = n2 >>> 0, Y = t2 >>> 0;
216
+ }
217
+ function q(t2) {
218
+ const e2 = z ||= new DataView(new ArrayBuffer(8));
219
+ e2.setFloat32(0, +t2, true), Y = 0, K = e2.getUint32(0, true);
220
+ }
221
+ function J(t2, e2) {
222
+ return 4294967296 * e2 + (t2 >>> 0);
223
+ }
224
+ function Z(t2, e2) {
225
+ const n2 = 2147483648 & e2;
226
+ return n2 && (e2 = ~e2 >>> 0, 0 == (t2 = 1 + ~t2 >>> 0) && (e2 = e2 + 1 >>> 0)), t2 = J(t2, e2), n2 ? -t2 : t2;
227
+ }
228
+ function Q(t2, e2) {
229
+ if (t2 >>>= 0, 2097151 >= (e2 >>>= 0)) var n2 = "" + (4294967296 * e2 + t2);
230
+ else H() ? n2 = "" + (BigInt(e2) << BigInt(32) | BigInt(t2)) : (t2 = (16777215 & t2) + 6777216 * (n2 = 16777215 & (t2 >>> 24 | e2 << 8)) + 6710656 * (e2 = e2 >> 16 & 65535), n2 += 8147497 * e2, e2 *= 2, 1e7 <= t2 && (n2 += Math.floor(t2 / 1e7), t2 %= 1e7), 1e7 <= n2 && (e2 += Math.floor(n2 / 1e7), n2 %= 1e7), n2 = e2 + tt(n2) + tt(t2));
231
+ return n2;
232
+ }
233
+ function tt(t2) {
234
+ return t2 = String(t2), "0000000".slice(t2.length) + t2;
235
+ }
236
+ function et() {
237
+ var t2 = K, e2 = Y;
238
+ if (2147483648 & e2) if (H()) t2 = "" + (BigInt(0 | e2) << BigInt(32) | BigInt(t2 >>> 0));
239
+ else {
240
+ const [n2, r2] = rt(t2, e2);
241
+ t2 = "-" + Q(n2, r2);
242
+ }
243
+ else t2 = Q(t2, e2);
244
+ return t2;
245
+ }
246
+ function nt(t2) {
247
+ if (16 > t2.length) $(Number(t2));
248
+ else if (H()) t2 = BigInt(t2), K = Number(t2 & BigInt(4294967295)) >>> 0, Y = Number(t2 >> BigInt(32) & BigInt(4294967295));
249
+ else {
250
+ const e2 = +("-" === t2[0]);
251
+ Y = K = 0;
252
+ const n2 = t2.length;
253
+ for (let r2 = e2, i2 = (n2 - e2) % 6 + e2; i2 <= n2; r2 = i2, i2 += 6) {
254
+ const e3 = Number(t2.slice(r2, i2));
255
+ Y *= 1e6, K = 1e6 * K + e3, 4294967296 <= K && (Y += Math.trunc(K / 4294967296), Y >>>= 0, K >>>= 0);
256
+ }
257
+ if (e2) {
258
+ const [t3, e3] = rt(K, Y);
259
+ K = t3, Y = e3;
260
+ }
261
+ }
262
+ }
263
+ function rt(t2, e2) {
264
+ return e2 = ~e2, t2 ? t2 = 1 + ~t2 : e2 += 1, [t2, e2];
265
+ }
266
+ function it(t2, e2) {
267
+ let n2, r2 = 0, i2 = 0, s2 = 0;
268
+ const o2 = t2.h;
269
+ let a2 = t2.g;
270
+ do {
271
+ n2 = o2[a2++], r2 |= (127 & n2) << s2, s2 += 7;
272
+ } while (32 > s2 && 128 & n2);
273
+ for (32 < s2 && (i2 |= (127 & n2) >> 4), s2 = 3; 32 > s2 && 128 & n2; s2 += 7) n2 = o2[a2++], i2 |= (127 & n2) << s2;
274
+ if (dt(t2, a2), 128 > n2) return e2(r2 >>> 0, i2 >>> 0);
275
+ throw j();
276
+ }
277
+ function st(t2) {
278
+ let e2 = 0, n2 = t2.g;
279
+ const r2 = n2 + 10, i2 = t2.h;
280
+ for (; n2 < r2; ) {
281
+ const r3 = i2[n2++];
282
+ if (e2 |= r3, 0 == (128 & r3)) return dt(t2, n2), !!(127 & e2);
283
+ }
284
+ throw j();
285
+ }
286
+ function ot(t2) {
287
+ const e2 = t2.h;
288
+ let n2 = t2.g, r2 = e2[n2++], i2 = 127 & r2;
289
+ if (128 & r2 && (r2 = e2[n2++], i2 |= (127 & r2) << 7, 128 & r2 && (r2 = e2[n2++], i2 |= (127 & r2) << 14, 128 & r2 && (r2 = e2[n2++], i2 |= (127 & r2) << 21, 128 & r2 && (r2 = e2[n2++], i2 |= r2 << 28, 128 & r2 && 128 & e2[n2++] && 128 & e2[n2++] && 128 & e2[n2++] && 128 & e2[n2++] && 128 & e2[n2++]))))) throw j();
290
+ return dt(t2, n2), i2;
291
+ }
292
+ function at(t2) {
293
+ return ot(t2) >>> 0;
294
+ }
295
+ function ht(t2) {
296
+ var e2 = t2.h;
297
+ const n2 = t2.g, r2 = e2[n2], i2 = e2[n2 + 1], s2 = e2[n2 + 2];
298
+ return e2 = e2[n2 + 3], dt(t2, t2.g + 4), (r2 << 0 | i2 << 8 | s2 << 16 | e2 << 24) >>> 0;
299
+ }
300
+ function ct(t2) {
301
+ var e2 = ht(t2);
302
+ t2 = 2 * (e2 >> 31) + 1;
303
+ const n2 = e2 >>> 23 & 255;
304
+ return e2 &= 8388607, 255 == n2 ? e2 ? NaN : 1 / 0 * t2 : 0 == n2 ? t2 * Math.pow(2, -149) * e2 : t2 * Math.pow(2, n2 - 150) * (e2 + Math.pow(2, 23));
305
+ }
306
+ function ut(t2) {
307
+ return ot(t2);
308
+ }
309
+ function lt(t2, e2, { ca: n2 = false } = {}) {
310
+ t2.ca = n2, e2 && (e2 = X(e2), t2.h = e2.buffer, t2.m = e2.P, t2.j = 0, t2.l = t2.h.length, t2.g = t2.j);
311
+ }
312
+ function dt(t2, e2) {
313
+ if (t2.g = e2, e2 > t2.l) throw V(t2.l, e2);
314
+ }
315
+ function ft(t2, e2) {
316
+ if (0 > e2) throw Error(`Tried to read a negative byte length: ${e2}`);
317
+ const n2 = t2.g, r2 = n2 + e2;
318
+ if (r2 > t2.l) throw V(e2, t2.l - n2);
319
+ return t2.g = r2, n2;
320
+ }
321
+ function pt(t2, e2) {
322
+ if (0 == e2) return D();
323
+ var n2 = ft(t2, e2);
324
+ return t2.ca && t2.m ? n2 = t2.h.subarray(n2, n2 + e2) : (t2 = t2.h, n2 = n2 === (e2 = n2 + e2) ? C() : W ? t2.slice(n2, e2) : new Uint8Array(t2.subarray(n2, e2))), 0 == n2.length ? D() : new B(n2, O);
325
+ }
326
+ var gt = [];
327
+ function mt(t2) {
328
+ var e2 = t2.g;
329
+ if (e2.g == e2.l) return false;
330
+ t2.l = t2.g.g;
331
+ var n2 = at(t2.g);
332
+ if (e2 = n2 >>> 3, !(0 <= (n2 &= 7) && 5 >= n2)) throw G(n2, t2.l);
333
+ if (1 > e2) throw Error(`Invalid field number: ${e2} (at position ${t2.l})`);
334
+ return t2.m = e2, t2.h = n2, true;
335
+ }
336
+ function yt(t2) {
337
+ switch (t2.h) {
338
+ case 0:
339
+ 0 != t2.h ? yt(t2) : st(t2.g);
340
+ break;
341
+ case 1:
342
+ dt(t2 = t2.g, t2.g + 8);
343
+ break;
344
+ case 2:
345
+ if (2 != t2.h) yt(t2);
346
+ else {
347
+ var e2 = at(t2.g);
348
+ dt(t2 = t2.g, t2.g + e2);
349
+ }
350
+ break;
351
+ case 5:
352
+ dt(t2 = t2.g, t2.g + 4);
353
+ break;
354
+ case 3:
355
+ for (e2 = t2.m; ; ) {
356
+ if (!mt(t2)) throw Error("Unmatched start-group tag: stream EOF");
357
+ if (4 == t2.h) {
358
+ if (t2.m != e2) throw Error("Unmatched end-group tag");
359
+ break;
360
+ }
361
+ yt(t2);
362
+ }
363
+ break;
364
+ default:
365
+ throw G(t2.h, t2.l);
366
+ }
367
+ }
368
+ function _t(t2, e2, n2) {
369
+ const r2 = t2.g.l, i2 = at(t2.g), s2 = t2.g.g + i2;
370
+ let o2 = s2 - r2;
371
+ if (0 >= o2 && (t2.g.l = s2, n2(e2, t2, void 0, void 0, void 0), o2 = s2 - t2.g.g), o2) throw Error(`Message parsing ended unexpectedly. Expected to read ${i2} bytes, instead read ${i2 - o2} bytes, either the data ended unexpectedly or the message misreported its own length`);
372
+ return t2.g.g = s2, t2.g.l = r2, e2;
373
+ }
374
+ function vt(t2) {
375
+ var e2 = at(t2.g), a2 = ft(t2 = t2.g, e2);
376
+ if (t2 = t2.h, o) {
377
+ var h2, c2 = t2;
378
+ (h2 = s) || (h2 = s = new TextDecoder("utf-8", { fatal: true })), e2 = a2 + e2, c2 = 0 === a2 && e2 === c2.length ? c2 : c2.subarray(a2, e2);
379
+ try {
380
+ var u2 = h2.decode(c2);
381
+ } catch (t3) {
382
+ if (void 0 === i) {
383
+ try {
384
+ h2.decode(new Uint8Array([128]));
385
+ } catch (t4) {
386
+ }
387
+ try {
388
+ h2.decode(new Uint8Array([97])), i = true;
389
+ } catch (t4) {
390
+ i = false;
391
+ }
392
+ }
393
+ throw !i && (s = void 0), t3;
394
+ }
395
+ } else {
396
+ e2 = (u2 = a2) + e2, a2 = [];
397
+ let i2, s2 = null;
398
+ for (; u2 < e2; ) {
399
+ var l2 = t2[u2++];
400
+ 128 > l2 ? a2.push(l2) : 224 > l2 ? u2 >= e2 ? n() : (i2 = t2[u2++], 194 > l2 || 128 != (192 & i2) ? (u2--, n()) : a2.push((31 & l2) << 6 | 63 & i2)) : 240 > l2 ? u2 >= e2 - 1 ? n() : (i2 = t2[u2++], 128 != (192 & i2) || 224 === l2 && 160 > i2 || 237 === l2 && 160 <= i2 || 128 != (192 & (h2 = t2[u2++])) ? (u2--, n()) : a2.push((15 & l2) << 12 | (63 & i2) << 6 | 63 & h2)) : 244 >= l2 ? u2 >= e2 - 2 ? n() : (i2 = t2[u2++], 128 != (192 & i2) || 0 != i2 - 144 + (l2 << 28) >> 30 || 128 != (192 & (h2 = t2[u2++])) || 128 != (192 & (c2 = t2[u2++])) ? (u2--, n()) : (l2 = (7 & l2) << 18 | (63 & i2) << 12 | (63 & h2) << 6 | 63 & c2, l2 -= 65536, a2.push(55296 + (l2 >> 10 & 1023), 56320 + (1023 & l2)))) : n(), 8192 <= a2.length && (s2 = r(s2, a2), a2.length = 0);
401
+ }
402
+ u2 = r(s2, a2);
403
+ }
404
+ return u2;
405
+ }
406
+ function Et(t2) {
407
+ const e2 = at(t2.g);
408
+ return pt(t2.g, e2);
409
+ }
410
+ function wt(t2, e2, n2) {
411
+ var r2 = at(t2.g);
412
+ for (r2 = t2.g.g + r2; t2.g.g < r2; ) n2.push(e2(t2.g));
413
+ }
414
+ var Tt = [];
415
+ function At(t2) {
416
+ return t2 ? /^\d+$/.test(t2) ? (nt(t2), new bt(K, Y)) : null : kt ||= new bt(0, 0);
417
+ }
418
+ var bt = class {
419
+ constructor(t2, e2) {
420
+ this.h = t2 >>> 0, this.g = e2 >>> 0;
421
+ }
422
+ };
423
+ var kt;
424
+ function xt(t2) {
425
+ return t2 ? /^-?\d+$/.test(t2) ? (nt(t2), new St(K, Y)) : null : Lt ||= new St(0, 0);
426
+ }
427
+ var St = class {
428
+ constructor(t2, e2) {
429
+ this.h = t2 >>> 0, this.g = e2 >>> 0;
430
+ }
431
+ };
432
+ var Lt;
433
+ function Ft(t2, e2, n2) {
434
+ for (; 0 < n2 || 127 < e2; ) t2.g.push(127 & e2 | 128), e2 = (e2 >>> 7 | n2 << 25) >>> 0, n2 >>>= 7;
435
+ t2.g.push(e2);
436
+ }
437
+ function Rt(t2, e2) {
438
+ for (; 127 < e2; ) t2.g.push(127 & e2 | 128), e2 >>>= 7;
439
+ t2.g.push(e2);
440
+ }
441
+ function Mt(t2, e2) {
442
+ if (0 <= e2) Rt(t2, e2);
443
+ else {
444
+ for (let n2 = 0; 9 > n2; n2++) t2.g.push(127 & e2 | 128), e2 >>= 7;
445
+ t2.g.push(1);
446
+ }
447
+ }
448
+ function Pt(t2, e2) {
449
+ t2.g.push(e2 >>> 0 & 255), t2.g.push(e2 >>> 8 & 255), t2.g.push(e2 >>> 16 & 255), t2.g.push(e2 >>> 24 & 255);
450
+ }
451
+ function Ct(t2, e2) {
452
+ 0 !== e2.length && (t2.l.push(e2), t2.h += e2.length);
453
+ }
454
+ function Ot(t2, e2, n2) {
455
+ Rt(t2.g, 8 * e2 + n2);
456
+ }
457
+ function It(t2, e2) {
458
+ return Ot(t2, e2, 2), e2 = t2.g.end(), Ct(t2, e2), e2.push(t2.h), e2;
459
+ }
460
+ function Ut(t2, e2) {
461
+ var n2 = e2.pop();
462
+ for (n2 = t2.h + t2.g.length() - n2; 127 < n2; ) e2.push(127 & n2 | 128), n2 >>>= 7, t2.h++;
463
+ e2.push(n2), t2.h++;
464
+ }
465
+ function Dt(t2, e2, n2) {
466
+ Ot(t2, e2, 2), Rt(t2.g, n2.length), Ct(t2, t2.g.end()), Ct(t2, n2);
467
+ }
468
+ function Nt(t2, e2, n2, r2) {
469
+ null != n2 && (e2 = It(t2, e2), r2(n2, t2), Ut(t2, e2));
470
+ }
471
+ var Bt = class {
472
+ constructor(t2, e2, n2, r2) {
473
+ this.g = t2, this.h = e2, this.l = n2, this.pa = r2;
474
+ }
475
+ };
476
+ function Gt(t2) {
477
+ return Array.prototype.slice.call(t2);
478
+ }
479
+ function jt(t2) {
480
+ return "function" == typeof Symbol && "symbol" == typeof /* @__PURE__ */ Symbol() ? /* @__PURE__ */ Symbol() : t2;
481
+ }
482
+ var Vt = jt();
483
+ var Xt = jt("0di");
484
+ var Ht = jt("2ex");
485
+ var Wt = jt("0dg");
486
+ var zt = Vt ? (t2, e2) => {
487
+ t2[Vt] |= e2;
488
+ } : (t2, e2) => {
489
+ void 0 !== t2.g ? t2.g |= e2 : Object.defineProperties(t2, { g: { value: e2, configurable: true, writable: true, enumerable: false } });
490
+ };
491
+ var Kt = Vt ? (t2, e2) => {
492
+ t2[Vt] &= ~e2;
493
+ } : (t2, e2) => {
494
+ void 0 !== t2.g && (t2.g &= ~e2);
495
+ };
496
+ function Yt(t2, e2, n2) {
497
+ return n2 ? t2 | e2 : t2 & ~e2;
498
+ }
499
+ var $t = Vt ? (t2) => 0 | t2[Vt] : (t2) => 0 | t2.g;
500
+ var qt = Vt ? (t2) => t2[Vt] : (t2) => t2.g;
501
+ var Jt = Vt ? (t2, e2) => (t2[Vt] = e2, t2) : (t2, e2) => (void 0 !== t2.g ? t2.g = e2 : Object.defineProperties(t2, { g: { value: e2, configurable: true, writable: true, enumerable: false } }), t2);
502
+ function Zt(t2) {
503
+ return zt(t2, 34), t2;
504
+ }
505
+ function Qt(t2, e2) {
506
+ Jt(e2, -14591 & (0 | t2));
507
+ }
508
+ function te(t2, e2) {
509
+ Jt(e2, -14557 & (34 | t2));
510
+ }
511
+ function ee(t2) {
512
+ return 0 === (t2 = t2 >> 14 & 1023) ? 536870912 : t2;
513
+ }
514
+ var ne;
515
+ var re = {};
516
+ var ie = {};
517
+ function se(t2) {
518
+ return !(!t2 || "object" != typeof t2 || t2.Ja !== ie);
519
+ }
520
+ function oe(t2) {
521
+ return null !== t2 && "object" == typeof t2 && !Array.isArray(t2) && t2.constructor === Object;
522
+ }
523
+ function ae(t2, e2, n2) {
524
+ if (null != t2) {
525
+ if ("string" == typeof t2) t2 = t2 ? new B(t2, O) : D();
526
+ else if (t2.constructor !== B) if (M(t2)) t2 = t2.length ? new B(n2 ? t2 : new Uint8Array(t2), O) : D();
527
+ else {
528
+ if (!e2) throw Error();
529
+ t2 = void 0;
530
+ }
531
+ }
532
+ return t2;
533
+ }
534
+ function he(t2, e2, n2) {
535
+ if (!Array.isArray(t2) || t2.length) return false;
536
+ const r2 = $t(t2);
537
+ return !!(1 & r2) || !(!e2 || !(Array.isArray(e2) ? e2.includes(n2) : e2.has(n2))) && (Jt(t2, 1 | r2), true);
538
+ }
539
+ var ce = [];
540
+ function ue(t2) {
541
+ if (2 & t2) throw Error();
542
+ }
543
+ Jt(ce, 55), ne = Object.freeze(ce);
544
+ var le = class _le {
545
+ constructor(t2, e2, n2) {
546
+ this.l = 0, this.g = t2, this.h = e2, this.m = n2;
547
+ }
548
+ next() {
549
+ if (this.l < this.g.length) {
550
+ const t2 = this.g[this.l++];
551
+ return { done: false, value: this.h ? this.h.call(this.m, t2) : t2 };
552
+ }
553
+ return { done: true, value: void 0 };
554
+ }
555
+ [Symbol.iterator]() {
556
+ return new _le(this.g, this.h, this.m);
557
+ }
558
+ };
559
+ var de;
560
+ var fe;
561
+ var pe;
562
+ function ge(t2, e2) {
563
+ (e2 = de ? e2[de] : void 0) && (t2[de] = Gt(e2));
564
+ }
565
+ function me(t2, e2) {
566
+ t2.__closure__error__context__984382 || (t2.__closure__error__context__984382 = {}), t2.__closure__error__context__984382.severity = e2;
567
+ }
568
+ function ye() {
569
+ const e2 = Error();
570
+ me(e2, "incident"), (function(e3) {
571
+ t.setTimeout((() => {
572
+ throw e3;
573
+ }), 0);
574
+ })(e2);
575
+ }
576
+ function _e(t2) {
577
+ return me(t2 = Error(t2), "warning"), t2;
578
+ }
579
+ function ve(t2) {
580
+ return null == t2 || "number" == typeof t2 ? t2 : "NaN" === t2 || "Infinity" === t2 || "-Infinity" === t2 ? Number(t2) : void 0;
581
+ }
582
+ function Ee(t2) {
583
+ return null == t2 || "boolean" == typeof t2 ? t2 : "number" == typeof t2 ? !!t2 : void 0;
584
+ }
585
+ Object.freeze(new class {
586
+ }()), Object.freeze(new class {
587
+ }());
588
+ var we = /^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;
589
+ function Te(t2) {
590
+ const e2 = typeof t2;
591
+ return "number" === e2 ? Number.isFinite(t2) : "string" === e2 && we.test(t2);
592
+ }
593
+ function Ae(t2) {
594
+ if (null == t2) return t2;
595
+ if ("string" == typeof t2) {
596
+ if (!t2) return;
597
+ t2 = +t2;
598
+ }
599
+ return "number" == typeof t2 && Number.isFinite(t2) ? 0 | t2 : void 0;
600
+ }
601
+ function be(t2) {
602
+ if (null == t2) return t2;
603
+ if ("string" == typeof t2) {
604
+ if (!t2) return;
605
+ t2 = +t2;
606
+ }
607
+ return "number" == typeof t2 && Number.isFinite(t2) ? t2 >>> 0 : void 0;
608
+ }
609
+ function ke(t2) {
610
+ return "-" !== t2[0] && (20 > t2.length || 20 === t2.length && 184467 > Number(t2.substring(0, 6)));
611
+ }
612
+ function xe(t2) {
613
+ return "-" === t2[0] ? 20 > t2.length || 20 === t2.length && -922337 < Number(t2.substring(0, 7)) : 19 > t2.length || 19 === t2.length && 922337 > Number(t2.substring(0, 6));
614
+ }
615
+ function Se(t2) {
616
+ return t2 = Math.trunc(t2), Number.isSafeInteger(t2) || ($(t2), t2 = Z(K, Y)), t2;
617
+ }
618
+ function Le(t2) {
619
+ var e2 = Math.trunc(Number(t2));
620
+ return Number.isSafeInteger(e2) ? String(e2) : (-1 !== (e2 = t2.indexOf(".")) && (t2 = t2.substring(0, e2)), xe(t2) || (nt(t2), t2 = et()), t2);
621
+ }
622
+ function Fe(t2) {
623
+ return null == t2 ? t2 : Te(t2) ? "number" == typeof t2 ? Se(t2) : Le(t2) : void 0;
624
+ }
625
+ function Re(t2) {
626
+ if ("string" != typeof t2) throw Error();
627
+ return t2;
628
+ }
629
+ function Me(t2) {
630
+ if (null != t2 && "string" != typeof t2) throw Error();
631
+ return t2;
632
+ }
633
+ function Pe(t2) {
634
+ return null == t2 || "string" == typeof t2 ? t2 : void 0;
635
+ }
636
+ function Ce(t2, e2, n2, r2) {
637
+ if (null != t2 && "object" == typeof t2 && t2.X === re) return t2;
638
+ if (!Array.isArray(t2)) return n2 ? 2 & r2 ? (t2 = e2[Xt]) ? e2 = t2 : (Zt((t2 = new e2()).s), e2 = e2[Xt] = t2) : e2 = new e2() : e2 = void 0, e2;
639
+ let i2 = n2 = $t(t2);
640
+ return 0 === i2 && (i2 |= 32 & r2), i2 |= 2 & r2, i2 !== n2 && Jt(t2, i2), new e2(t2);
641
+ }
642
+ function Oe(t2, e2, n2) {
643
+ if (e2) {
644
+ var r2 = !!r2;
645
+ if (!Te(e2 = t2)) throw _e("int64");
646
+ "string" == typeof e2 ? r2 = Le(e2) : r2 ? (r2 = Math.trunc(e2), Number.isSafeInteger(r2) ? r2 = String(r2) : xe(e2 = String(r2)) ? r2 = e2 : ($(r2), r2 = et())) : r2 = Se(e2);
647
+ } else r2 = Fe(t2);
648
+ return "string" == typeof (n2 = null == (t2 = r2) ? n2 ? 0 : void 0 : t2) && (r2 = +n2, Number.isSafeInteger(r2)) ? r2 : n2;
649
+ }
650
+ var Ie;
651
+ var Ue;
652
+ var De;
653
+ function Ne(t2) {
654
+ switch (typeof t2) {
655
+ case "boolean":
656
+ return Ue ||= [0, void 0, true];
657
+ case "number":
658
+ return 0 < t2 ? void 0 : 0 === t2 ? De ||= [0, void 0] : [-t2, void 0];
659
+ case "string":
660
+ return [0, t2];
661
+ case "object":
662
+ return t2;
663
+ }
664
+ }
665
+ function Be(t2, e2) {
666
+ return Ge(t2, e2[0], e2[1]);
667
+ }
668
+ function Ge(t2, e2, n2) {
669
+ if (null == t2 && (t2 = Ie), Ie = void 0, null == t2) {
670
+ var r2 = 96;
671
+ n2 ? (t2 = [n2], r2 |= 512) : t2 = [], e2 && (r2 = -16760833 & r2 | (1023 & e2) << 14);
672
+ } else {
673
+ if (!Array.isArray(t2)) throw Error("narr");
674
+ if (2048 & (r2 = $t(t2))) throw Error("farr");
675
+ if (64 & r2) return t2;
676
+ if (r2 |= 64, n2 && (r2 |= 512, n2 !== t2[0])) throw Error("mid");
677
+ t: {
678
+ const i2 = (n2 = t2).length;
679
+ if (i2) {
680
+ const t3 = i2 - 1;
681
+ if (oe(n2[t3])) {
682
+ if (1024 <= (e2 = t3 - (+!!(512 & (r2 |= 256)) - 1))) throw Error("pvtlmt");
683
+ r2 = -16760833 & r2 | (1023 & e2) << 14;
684
+ break t;
685
+ }
686
+ }
687
+ if (e2) {
688
+ if (1024 < (e2 = Math.max(e2, i2 - (+!!(512 & r2) - 1)))) throw Error("spvt");
689
+ r2 = -16760833 & r2 | (1023 & e2) << 14;
690
+ }
691
+ }
692
+ }
693
+ return Jt(t2, r2), t2;
694
+ }
695
+ var je = {};
696
+ var Ve = (function() {
697
+ try {
698
+ return _(new class extends Map {
699
+ constructor() {
700
+ super();
701
+ }
702
+ }()), false;
703
+ } catch {
704
+ return true;
705
+ }
706
+ })();
707
+ var Xe = class {
708
+ constructor() {
709
+ this.g = /* @__PURE__ */ new Map();
710
+ }
711
+ get(t2) {
712
+ return this.g.get(t2);
713
+ }
714
+ set(t2, e2) {
715
+ return this.g.set(t2, e2), this.size = this.g.size, this;
716
+ }
717
+ delete(t2) {
718
+ return t2 = this.g.delete(t2), this.size = this.g.size, t2;
719
+ }
720
+ clear() {
721
+ this.g.clear(), this.size = this.g.size;
722
+ }
723
+ has(t2) {
724
+ return this.g.has(t2);
725
+ }
726
+ entries() {
727
+ return this.g.entries();
728
+ }
729
+ keys() {
730
+ return this.g.keys();
731
+ }
732
+ values() {
733
+ return this.g.values();
734
+ }
735
+ forEach(t2, e2) {
736
+ return this.g.forEach(t2, e2);
737
+ }
738
+ [Symbol.iterator]() {
739
+ return this.entries();
740
+ }
741
+ };
742
+ var He = Ve ? (Object.setPrototypeOf(Xe.prototype, Map.prototype), Object.defineProperties(Xe.prototype, { size: { value: 0, configurable: true, enumerable: true, writable: true } }), Xe) : class extends Map {
743
+ constructor() {
744
+ super();
745
+ }
746
+ };
747
+ function We(t2) {
748
+ return t2;
749
+ }
750
+ function ze(t2) {
751
+ if (2 & t2.N) throw Error("Cannot mutate an immutable Map");
752
+ }
753
+ var Ke = class extends He {
754
+ constructor(t2, e2, n2 = We, r2 = We) {
755
+ super();
756
+ let i2 = $t(t2);
757
+ i2 |= 64, Jt(t2, i2), this.N = i2, this.U = e2, this.S = n2, this.Z = this.U ? Ye : r2;
758
+ for (let s2 = 0; s2 < t2.length; s2++) {
759
+ const o2 = t2[s2], a2 = n2(o2[0], false, true);
760
+ let h2 = o2[1];
761
+ e2 ? void 0 === h2 && (h2 = null) : h2 = r2(o2[1], false, true, void 0, void 0, i2), super.set(a2, h2);
762
+ }
763
+ }
764
+ oa(t2 = $e) {
765
+ if (0 !== this.size) return this.Y(t2);
766
+ }
767
+ Y(t2 = $e) {
768
+ const e2 = [], n2 = super.entries();
769
+ for (var r2; !(r2 = n2.next()).done; ) (r2 = r2.value)[0] = t2(r2[0]), r2[1] = t2(r2[1]), e2.push(r2);
770
+ return e2;
771
+ }
772
+ clear() {
773
+ ze(this), super.clear();
774
+ }
775
+ delete(t2) {
776
+ return ze(this), super.delete(this.S(t2, true, false));
777
+ }
778
+ entries() {
779
+ var t2 = this.na();
780
+ return new le(t2, qe, this);
781
+ }
782
+ keys() {
783
+ return this.Ia();
784
+ }
785
+ values() {
786
+ var t2 = this.na();
787
+ return new le(t2, Ke.prototype.get, this);
788
+ }
789
+ forEach(t2, e2) {
790
+ super.forEach(((n2, r2) => {
791
+ t2.call(e2, this.get(r2), r2, this);
792
+ }));
793
+ }
794
+ set(t2, e2) {
795
+ return ze(this), null == (t2 = this.S(t2, true, false)) ? this : null == e2 ? (super.delete(t2), this) : super.set(t2, this.Z(e2, true, true, this.U, false, this.N));
796
+ }
797
+ Oa(t2) {
798
+ const e2 = this.S(t2[0], false, true);
799
+ t2 = t2[1], t2 = this.U ? void 0 === t2 ? null : t2 : this.Z(t2, false, true, void 0, false, this.N), super.set(e2, t2);
800
+ }
801
+ has(t2) {
802
+ return super.has(this.S(t2, false, false));
803
+ }
804
+ get(t2) {
805
+ t2 = this.S(t2, false, false);
806
+ const e2 = super.get(t2);
807
+ if (void 0 !== e2) {
808
+ var n2 = this.U;
809
+ return n2 ? ((n2 = this.Z(e2, false, true, n2, this.ta, this.N)) !== e2 && super.set(t2, n2), n2) : e2;
810
+ }
811
+ }
812
+ na() {
813
+ return Array.from(super.keys());
814
+ }
815
+ Ia() {
816
+ return super.keys();
817
+ }
818
+ [Symbol.iterator]() {
819
+ return this.entries();
820
+ }
821
+ };
822
+ function Ye(t2, e2, n2, r2, i2, s2) {
823
+ return t2 = Ce(t2, r2, n2, s2), i2 && (t2 = an(t2)), t2;
824
+ }
825
+ function $e(t2) {
826
+ return t2;
827
+ }
828
+ function qe(t2) {
829
+ return [t2, this.get(t2)];
830
+ }
831
+ var Je;
832
+ function Ze() {
833
+ return Je ||= new Ke(Zt([]), void 0, void 0, void 0, je);
834
+ }
835
+ function Qe(t2, e2, n2, r2, i2) {
836
+ if (null != t2) {
837
+ if (Array.isArray(t2)) t2 = he(t2, void 0, 0) ? void 0 : i2 && 2 & $t(t2) ? t2 : tn(t2, e2, n2, void 0 !== r2, i2);
838
+ else if (oe(t2)) {
839
+ const s2 = {};
840
+ for (let o2 in t2) s2[o2] = Qe(t2[o2], e2, n2, r2, i2);
841
+ t2 = s2;
842
+ } else t2 = e2(t2, r2);
843
+ return t2;
844
+ }
845
+ }
846
+ function tn(t2, e2, n2, r2, i2) {
847
+ const s2 = r2 || n2 ? $t(t2) : 0;
848
+ r2 = r2 ? !!(32 & s2) : void 0;
849
+ const o2 = Gt(t2);
850
+ for (let t3 = 0; t3 < o2.length; t3++) o2[t3] = Qe(o2[t3], e2, n2, r2, i2);
851
+ return n2 && (ge(o2, t2), n2(s2, o2)), o2;
852
+ }
853
+ function en(t2) {
854
+ return Qe(t2, nn, void 0, void 0, false);
855
+ }
856
+ function nn(t2) {
857
+ return t2.X === re ? t2.toJSON() : t2 instanceof Ke ? t2.oa(en) : (function(t3) {
858
+ switch (typeof t3) {
859
+ case "number":
860
+ return isFinite(t3) ? t3 : String(t3);
861
+ case "boolean":
862
+ return t3 ? 1 : 0;
863
+ case "object":
864
+ if (t3) if (Array.isArray(t3)) {
865
+ if (he(t3, void 0, 0)) return;
866
+ } else {
867
+ if (M(t3)) return x(t3);
868
+ if (t3 instanceof B) {
869
+ const e2 = t3.g;
870
+ return null == e2 ? "" : "string" == typeof e2 ? e2 : t3.g = x(e2);
871
+ }
872
+ if (t3 instanceof Ke) return t3.oa();
873
+ }
874
+ }
875
+ return t3;
876
+ })(t2);
877
+ }
878
+ function rn(t2, e2, n2 = te) {
879
+ if (null != t2) {
880
+ if (b && t2 instanceof Uint8Array) return e2 ? t2 : new Uint8Array(t2);
881
+ if (Array.isArray(t2)) {
882
+ var r2 = $t(t2);
883
+ return 2 & r2 || (e2 &&= 0 === r2 || !!(32 & r2) && !(64 & r2 || !(16 & r2)), t2 = e2 ? Jt(t2, -12293 & (34 | r2)) : tn(t2, rn, 4 & r2 ? te : n2, true, true)), t2;
884
+ }
885
+ return t2.X === re ? (n2 = t2.s, t2 = 2 & (r2 = qt(n2)) ? t2 : sn(t2, n2, r2, true)) : t2 instanceof Ke && !(2 & t2.N) && (n2 = Zt(t2.Y(rn)), t2 = new Ke(n2, t2.U, t2.S, t2.Z)), t2;
886
+ }
887
+ }
888
+ function sn(t2, e2, n2, r2) {
889
+ return t2 = t2.constructor, Ie = e2 = on(e2, n2, r2), e2 = new t2(e2), Ie = void 0, e2;
890
+ }
891
+ function on(t2, e2, n2) {
892
+ const r2 = n2 || 2 & e2 ? te : Qt, i2 = !!(32 & e2);
893
+ return t2 = (function(t3, e3, n3) {
894
+ const r3 = Gt(t3);
895
+ var i3 = r3.length;
896
+ const s2 = 256 & e3 ? r3[i3 - 1] : void 0;
897
+ for (i3 += s2 ? -1 : 0, e3 = 512 & e3 ? 1 : 0; e3 < i3; e3++) r3[e3] = n3(r3[e3]);
898
+ if (s2) {
899
+ e3 = r3[e3] = {};
900
+ for (const t4 in s2) e3[t4] = n3(s2[t4]);
901
+ }
902
+ return ge(r3, t3), r3;
903
+ })(t2, e2, ((t3) => rn(t3, i2, r2))), zt(t2, 32 | (n2 ? 2 : 0)), t2;
904
+ }
905
+ function an(t2) {
906
+ const e2 = t2.s, n2 = qt(e2);
907
+ return 2 & n2 ? sn(t2, e2, n2, false) : t2;
908
+ }
909
+ function hn(t2, e2, n2, r2) {
910
+ return !(4 & e2) || null != n2 && (!r2 && 0 === n2 && (4096 & e2 || 8192 & e2) && 5 > (t2.constructor[Wt] = 1 + (0 | t2.constructor[Wt])) && ye(), 0 !== n2 && !(n2 & e2));
911
+ }
912
+ function cn(t2, e2) {
913
+ return ln(t2 = t2.s, qt(t2), e2);
914
+ }
915
+ function un(t2, e2, n2, r2) {
916
+ if (!(0 > (e2 = r2 + (+!!(512 & e2) - 1)) || e2 >= t2.length || e2 >= n2)) return t2[e2];
917
+ }
918
+ function ln(t2, e2, n2, r2) {
919
+ if (-1 === n2) return null;
920
+ const i2 = ee(e2);
921
+ if (!(n2 >= i2)) {
922
+ var s2 = t2.length;
923
+ return r2 && 256 & e2 && null != (r2 = t2[s2 - 1][n2]) ? (un(t2, e2, i2, n2) && null != Ht && (4 <= (e2 = (t2 = pe ??= {})[Ht] || 0) || (t2[Ht] = e2 + 1, ye())), r2) : un(t2, e2, i2, n2);
924
+ }
925
+ return 256 & e2 ? t2[t2.length - 1][n2] : void 0;
926
+ }
927
+ function dn(t2, e2, n2, r2) {
928
+ const i2 = t2.s;
929
+ let s2 = qt(i2);
930
+ return ue(s2), fn(i2, s2, e2, n2, r2), t2;
931
+ }
932
+ function fn(t2, e2, n2, r2, i2) {
933
+ const s2 = ee(e2);
934
+ if (n2 >= s2 || i2) {
935
+ let o2 = e2;
936
+ if (256 & e2) i2 = t2[t2.length - 1];
937
+ else {
938
+ if (null == r2) return o2;
939
+ i2 = t2[s2 + (+!!(512 & e2) - 1)] = {}, o2 |= 256;
940
+ }
941
+ return i2[n2] = r2, n2 < s2 && (t2[n2 + (+!!(512 & e2) - 1)] = void 0), o2 !== e2 && Jt(t2, o2), o2;
942
+ }
943
+ return t2[n2 + (+!!(512 & e2) - 1)] = r2, 256 & e2 && (n2 in (t2 = t2[t2.length - 1]) && delete t2[n2]), e2;
944
+ }
945
+ function pn(t2, e2, n2, r2, i2) {
946
+ var s2 = 2 & e2;
947
+ let o2 = ln(t2, e2, n2, i2);
948
+ Array.isArray(o2) || (o2 = ne);
949
+ const a2 = !(2 & r2);
950
+ r2 = !(1 & r2);
951
+ const h2 = !!(32 & e2);
952
+ let c2 = $t(o2);
953
+ return 0 !== c2 || !h2 || s2 || a2 ? 1 & c2 || (c2 |= 1, Jt(o2, c2)) : (c2 |= 33, Jt(o2, c2)), s2 ? (t2 = false, 2 & c2 || (Zt(o2), t2 = !!(4 & c2)), (r2 || t2) && Object.freeze(o2)) : (s2 = !!(2 & c2) || !!(2048 & c2), r2 && s2 ? (o2 = Gt(o2), r2 = 1, h2 && !a2 && (r2 |= 32), Jt(o2, r2), fn(t2, e2, n2, o2, i2)) : a2 && 32 & c2 && !s2 && Kt(o2, 32)), o2;
954
+ }
955
+ function gn(t2, e2) {
956
+ t2 = t2.s;
957
+ let n2 = qt(t2);
958
+ const r2 = ln(t2, n2, e2), i2 = ve(r2);
959
+ return null != i2 && i2 !== r2 && fn(t2, n2, e2, i2), i2;
960
+ }
961
+ function mn(t2) {
962
+ t2 = t2.s;
963
+ let e2 = qt(t2);
964
+ const n2 = ln(t2, e2, 1), r2 = ae(n2, true, !!(34 & e2));
965
+ return null != r2 && r2 !== n2 && fn(t2, e2, 1, r2), r2;
966
+ }
967
+ function yn(t2, e2, n2) {
968
+ const r2 = t2.s;
969
+ let i2 = qt(r2);
970
+ const s2 = 2 & i2 ? 1 : 2;
971
+ let o2 = _n(r2, i2, e2);
972
+ var a2 = $t(o2);
973
+ if (hn(t2, a2, void 0, false)) {
974
+ (4 & a2 || Object.isFrozen(o2)) && (o2 = Gt(o2), a2 = In(a2, i2), i2 = fn(r2, i2, e2, o2));
975
+ let s3 = t2 = 0;
976
+ for (; t2 < o2.length; t2++) {
977
+ const e3 = n2(o2[t2]);
978
+ null != e3 && (o2[s3++] = e3);
979
+ }
980
+ s3 < t2 && (o2.length = s3), a2 = Yt(a2 = vn(a2, i2), 20, true), a2 = Yt(a2, 4096, false), a2 = Yt(a2, 8192, false), Jt(o2, a2), 2 & a2 && Object.freeze(o2);
981
+ }
982
+ return En(a2) || (n2 = a2, (a2 = (t2 = 1 === s2 || 4 === s2 && !!(32 & a2)) ? Yt(a2, 2, true) : Un(a2, i2, false)) !== n2 && Jt(o2, a2), t2 && Object.freeze(o2)), 2 === s2 && En(a2) && (o2 = Gt(o2), a2 = Un(a2 = In(a2, i2), i2, false), Jt(o2, a2), fn(r2, i2, e2, o2)), o2;
983
+ }
984
+ function _n(t2, e2, n2) {
985
+ return t2 = ln(t2, e2, n2), Array.isArray(t2) ? t2 : ne;
986
+ }
987
+ function vn(t2, e2) {
988
+ return 0 === t2 && (t2 = In(t2, e2)), Yt(t2, 1, true);
989
+ }
990
+ function En(t2) {
991
+ return !!(2 & t2) && !!(4 & t2) || !!(2048 & t2);
992
+ }
993
+ function wn(t2) {
994
+ t2 = Gt(t2);
995
+ for (let e2 = 0; e2 < t2.length; e2++) {
996
+ const n2 = t2[e2] = Gt(t2[e2]);
997
+ Array.isArray(n2[1]) && (n2[1] = Zt(n2[1]));
998
+ }
999
+ return t2;
1000
+ }
1001
+ function Tn(t2, e2, n2) {
1002
+ {
1003
+ const a2 = t2.s;
1004
+ let h2 = qt(a2);
1005
+ if (ue(h2), null == n2) fn(a2, h2, e2);
1006
+ else {
1007
+ var r2, i2 = $t(n2), s2 = i2, o2 = !!(2 & i2) || Object.isFrozen(n2);
1008
+ if ((r2 = !o2) && (r2 = false), hn(t2, i2)) for (i2 = 21, o2 && (n2 = Gt(n2), s2 = 0, i2 = Un(i2 = In(i2, h2), h2, true)), t2 = 0; t2 < n2.length; t2++) n2[t2] = Re(n2[t2]);
1009
+ r2 && (n2 = Gt(n2), s2 = 0, i2 = Un(i2 = In(i2, h2), h2, true)), i2 !== s2 && Jt(n2, i2), fn(a2, h2, e2, n2);
1010
+ }
1011
+ }
1012
+ }
1013
+ function An(t2, e2, n2, r2) {
1014
+ t2 = t2.s;
1015
+ let i2 = qt(t2);
1016
+ ue(i2), fn(t2, i2, e2, ("0" === r2 ? 0 === Number(n2) : n2 === r2) ? void 0 : n2);
1017
+ }
1018
+ function bn(t2, e2, n2, r2) {
1019
+ const i2 = qt(t2);
1020
+ ue(i2), t2 = pn(t2, i2, e2, 2), r2 = n2(r2, !!(4 & (e2 = $t(t2))) && !!(4096 & e2)), t2.push(r2);
1021
+ }
1022
+ function kn(t2) {
1023
+ return t2;
1024
+ }
1025
+ function xn(t2, e2) {
1026
+ return Sn(t2 = t2.s, qt(t2), ws) === e2 ? e2 : -1;
1027
+ }
1028
+ function Sn(t2, e2, n2) {
1029
+ let r2 = 0;
1030
+ for (let i2 = 0; i2 < n2.length; i2++) {
1031
+ const s2 = n2[i2];
1032
+ null != ln(t2, e2, s2) && (0 !== r2 && (e2 = fn(t2, e2, r2)), r2 = s2);
1033
+ }
1034
+ return r2;
1035
+ }
1036
+ function Ln(t2, e2, n2, r2) {
1037
+ let i2 = qt(t2);
1038
+ ue(i2);
1039
+ const s2 = ln(t2, i2, n2, r2);
1040
+ let o2;
1041
+ if (null != s2 && s2.X === re) return (e2 = an(s2)) !== s2 && fn(t2, i2, n2, e2, r2), e2.s;
1042
+ if (Array.isArray(s2)) {
1043
+ const t3 = $t(s2);
1044
+ o2 = 2 & t3 ? on(s2, t3, false) : s2, o2 = Be(o2, e2);
1045
+ } else o2 = Be(void 0, e2);
1046
+ return o2 !== s2 && fn(t2, i2, n2, o2, r2), o2;
1047
+ }
1048
+ function Fn(t2, e2, n2, r2) {
1049
+ t2 = t2.s;
1050
+ let i2 = qt(t2);
1051
+ const s2 = ln(t2, i2, n2, r2);
1052
+ return (e2 = Ce(s2, e2, false, i2)) !== s2 && null != e2 && fn(t2, i2, n2, e2, r2), e2;
1053
+ }
1054
+ function Rn(t2, e2, n2, r2 = false) {
1055
+ if (null == (e2 = Fn(t2, e2, n2, r2))) return e2;
1056
+ t2 = t2.s;
1057
+ let i2 = qt(t2);
1058
+ if (!(2 & i2)) {
1059
+ const s2 = an(e2);
1060
+ s2 !== e2 && fn(t2, i2, n2, e2 = s2, r2);
1061
+ }
1062
+ return e2;
1063
+ }
1064
+ function Mn(t2, e2, n2, r2, i2, s2) {
1065
+ var o2 = 2, a2 = !!(2 & e2);
1066
+ o2 = a2 ? 1 : o2, i2 = !!i2, s2 &&= !a2, a2 = _n(t2, e2, r2);
1067
+ var h2 = $t(a2);
1068
+ const c2 = !!(4 & h2);
1069
+ if (!c2) {
1070
+ var u2 = a2, l2 = e2;
1071
+ const t3 = !!(2 & (h2 = vn(h2, e2)));
1072
+ t3 && (l2 = Yt(l2, 2, true));
1073
+ let r3 = !t3, i3 = true, s3 = 0, o3 = 0;
1074
+ for (; s3 < u2.length; s3++) {
1075
+ const e3 = Ce(u2[s3], n2, false, l2);
1076
+ if (e3 instanceof n2) {
1077
+ if (!t3) {
1078
+ const t4 = !!(2 & $t(e3.s));
1079
+ r3 &&= !t4, i3 &&= t4;
1080
+ }
1081
+ u2[o3++] = e3;
1082
+ }
1083
+ }
1084
+ o3 < s3 && (u2.length = o3), h2 = Yt(h2, 4, true), h2 = Yt(h2, 16, i3), h2 = Yt(h2, 8, r3), Jt(u2, h2), t3 && Object.freeze(u2);
1085
+ }
1086
+ if (s2 && !(8 & h2 || !a2.length && (1 === o2 || 4 === o2 && 32 & h2))) {
1087
+ for (En(h2) && (a2 = Gt(a2), h2 = In(h2, e2), e2 = fn(t2, e2, r2, a2)), n2 = a2, s2 = h2, u2 = 0; u2 < n2.length; u2++) (h2 = n2[u2]) !== (l2 = an(h2)) && (n2[u2] = l2);
1088
+ s2 = Yt(s2, 8, true), s2 = Yt(s2, 16, !n2.length), Jt(n2, s2), h2 = s2;
1089
+ }
1090
+ return En(h2) || (n2 = h2, (h2 = (s2 = 1 === o2 || 4 === o2 && !!(32 & h2)) ? Yt(h2, !a2.length || 16 & h2 && (!c2 || 32 & h2) ? 2 : 2048, true) : Un(h2, e2, i2)) !== n2 && Jt(a2, h2), s2 && Object.freeze(a2)), 2 === o2 && En(h2) && (a2 = Gt(a2), h2 = Un(h2 = In(h2, e2), e2, i2), Jt(a2, h2), fn(t2, e2, r2, a2)), a2;
1091
+ }
1092
+ function Pn(t2, e2, n2) {
1093
+ t2 = t2.s;
1094
+ const r2 = qt(t2);
1095
+ return Mn(t2, r2, e2, n2, false, !(2 & r2));
1096
+ }
1097
+ function Cn(t2, e2, n2, r2, i2) {
1098
+ return null == r2 && (r2 = void 0), dn(t2, n2, r2, i2);
1099
+ }
1100
+ function On(t2, e2, n2, r2) {
1101
+ null == r2 && (r2 = void 0), t2 = t2.s;
1102
+ let i2 = qt(t2);
1103
+ ue(i2), (n2 = Sn(t2, i2, n2)) && n2 !== e2 && null != r2 && (i2 = fn(t2, i2, n2)), fn(t2, i2, e2, r2);
1104
+ }
1105
+ function In(t2, e2) {
1106
+ return t2 = Yt(t2, 2, !!(2 & e2)), t2 = Yt(t2, 32, true), Yt(t2, 2048, false);
1107
+ }
1108
+ function Un(t2, e2, n2) {
1109
+ return 32 & e2 && n2 || (t2 = Yt(t2, 32, false)), t2;
1110
+ }
1111
+ function Dn(t2, e2, n2, r2) {
1112
+ t2 = t2.s;
1113
+ const i2 = qt(t2);
1114
+ ue(i2), e2 = Mn(t2, i2, n2, e2, true), n2 = null != r2 ? r2 : new n2(), e2.push(n2), 2 & $t(n2.s) ? Kt(e2, 8) : Kt(e2, 16);
1115
+ }
1116
+ function Nn(t2, e2) {
1117
+ return Ae(cn(t2, e2));
1118
+ }
1119
+ function Bn(t2, e2) {
1120
+ return t2 ?? e2;
1121
+ }
1122
+ function Gn(t2, e2) {
1123
+ return Bn(gn(t2, e2), 0);
1124
+ }
1125
+ function jn(t2, e2) {
1126
+ return Bn(Pe(cn(t2, e2)), "");
1127
+ }
1128
+ function Vn(t2, e2, n2) {
1129
+ if (null != n2 && "boolean" != typeof n2) throw t2 = typeof n2, Error(`Expected boolean but got ${"object" != t2 ? t2 : n2 ? Array.isArray(n2) ? "array" : t2 : "null"}: ${n2}`);
1130
+ dn(t2, e2, n2);
1131
+ }
1132
+ function Xn(t2, e2, n2) {
1133
+ if (null != n2) {
1134
+ if ("number" != typeof n2) throw _e("int32");
1135
+ if (!Number.isFinite(n2)) throw _e("int32");
1136
+ n2 |= 0;
1137
+ }
1138
+ dn(t2, e2, n2);
1139
+ }
1140
+ function Hn(t2, e2, n2) {
1141
+ if (null != n2 && "number" != typeof n2) throw Error(`Value of float/double field must be a number, found ${typeof n2}: ${n2}`);
1142
+ dn(t2, e2, n2);
1143
+ }
1144
+ function Wn(t2, e2, n2) {
1145
+ e2.g ? e2.m(t2, e2.g, e2.h, n2, true) : e2.m(t2, e2.h, n2, true);
1146
+ }
1147
+ Ke.prototype.toJSON = void 0, Ke.prototype.Ja = ie;
1148
+ var zn = class {
1149
+ constructor(t2, e2) {
1150
+ this.s = Ge(t2, e2);
1151
+ }
1152
+ toJSON() {
1153
+ return Kn(this, tn(this.s, nn, void 0, void 0, false), true);
1154
+ }
1155
+ l() {
1156
+ var t2 = ko;
1157
+ return t2.g ? t2.l(this, t2.g, t2.h, true) : t2.l(this, t2.h, t2.defaultValue, true);
1158
+ }
1159
+ clone() {
1160
+ const t2 = this.s;
1161
+ return sn(this, t2, qt(t2), false);
1162
+ }
1163
+ P() {
1164
+ return !!(2 & $t(this.s));
1165
+ }
1166
+ };
1167
+ function Kn(t2, e2, n2) {
1168
+ var r2 = d ? void 0 : t2.constructor.B;
1169
+ const i2 = qt(n2 ? t2.s : e2);
1170
+ if (!(t2 = e2.length)) return e2;
1171
+ let s2, o2;
1172
+ if (oe(n2 = e2[t2 - 1])) {
1173
+ t: {
1174
+ var a2 = n2;
1175
+ let t3 = {}, e3 = false;
1176
+ for (var h2 in a2) {
1177
+ let n3 = a2[h2];
1178
+ if (Array.isArray(n3)) {
1179
+ let t4 = n3;
1180
+ (he(n3, r2, +h2) || se(n3) && 0 === n3.size) && (n3 = null), n3 != t4 && (e3 = true);
1181
+ }
1182
+ null != n3 ? t3[h2] = n3 : e3 = true;
1183
+ }
1184
+ if (e3) {
1185
+ for (var c2 in t3) {
1186
+ a2 = t3;
1187
+ break t;
1188
+ }
1189
+ a2 = null;
1190
+ }
1191
+ }
1192
+ a2 != n2 && (s2 = true), t2--;
1193
+ }
1194
+ for (h2 = +!!(512 & i2) - 1; 0 < t2 && (n2 = e2[c2 = t2 - 1], c2 -= h2, null == n2 || he(n2, r2, c2) || se(n2) && 0 === n2.size); t2--) o2 = true;
1195
+ return s2 || o2 ? (e2 = Array.prototype.slice.call(e2, 0, t2), a2 && e2.push(a2), e2) : e2;
1196
+ }
1197
+ function Yn(t2) {
1198
+ return Array.isArray(t2) ? t2[0] instanceof Bt ? t2 : [$r, t2] : [t2, void 0];
1199
+ }
1200
+ function $n(t2, e2) {
1201
+ if (Array.isArray(e2)) {
1202
+ var n2 = $t(e2);
1203
+ if (4 & n2) return e2;
1204
+ for (var r2 = 0, i2 = 0; r2 < e2.length; r2++) {
1205
+ const n3 = t2(e2[r2]);
1206
+ null != n3 && (e2[i2++] = n3);
1207
+ }
1208
+ return i2 < r2 && (e2.length = i2), Jt(e2, -12289 & (5 | n2)), 2 & n2 && Object.freeze(e2), e2;
1209
+ }
1210
+ }
1211
+ zn.prototype.X = re, zn.prototype.toString = function() {
1212
+ return Kn(this, this.s, false).toString();
1213
+ };
1214
+ var qn = /* @__PURE__ */ Symbol();
1215
+ function Jn(t2) {
1216
+ let e2 = t2[qn];
1217
+ if (!e2) {
1218
+ const n2 = sr(t2), r2 = yr(t2), i2 = r2.l;
1219
+ e2 = i2 ? (t3, e3) => i2(t3, e3, r2) : (t3, e3) => {
1220
+ for (; mt(e3) && 4 != e3.h; ) {
1221
+ var i3 = e3.m, s2 = r2[i3];
1222
+ if (!s2) {
1223
+ var o2 = r2.ea;
1224
+ o2 && (o2 = o2[i3]) && (s2 = r2[i3] = Zn(o2));
1225
+ }
1226
+ s2 && s2(e3, t3, i3) || (i3 = (s2 = e3).l, yt(s2), s2.ia ? s2 = void 0 : (o2 = s2.g.g - i3, s2.g.g = i3, s2 = pt(s2.g, o2)), i3 = t3, s2 && (de ||= /* @__PURE__ */ Symbol(), (o2 = i3[de]) ? o2.push(s2) : i3[de] = [s2]));
1227
+ }
1228
+ n2 === tr || n2 === er || n2.j || (t3[fe ||= /* @__PURE__ */ Symbol()] = n2);
1229
+ }, t2[qn] = e2;
1230
+ }
1231
+ return e2;
1232
+ }
1233
+ function Zn(t2) {
1234
+ const e2 = (t2 = Yn(t2))[0].g;
1235
+ if (t2 = t2[1]) {
1236
+ const n2 = Jn(t2), r2 = yr(t2).T;
1237
+ return (t3, i2, s2) => e2(t3, i2, s2, r2, n2);
1238
+ }
1239
+ return e2;
1240
+ }
1241
+ var Qn = class {
1242
+ };
1243
+ var tr;
1244
+ var er;
1245
+ var nr = /* @__PURE__ */ Symbol();
1246
+ function rr(t2, e2, n2) {
1247
+ const r2 = n2[1];
1248
+ let i2;
1249
+ if (r2) {
1250
+ const n3 = r2[nr];
1251
+ i2 = n3 ? n3.T : Ne(r2[0]), t2[e2] = n3 ?? r2;
1252
+ }
1253
+ i2 && i2 === Ue ? (t2.g || (t2.g = /* @__PURE__ */ new Set())).add(e2) : n2[0] && (t2.h || (t2.h = /* @__PURE__ */ new Set())).add(e2);
1254
+ }
1255
+ function ir(t2, e2) {
1256
+ return [t2.l, !e2 || 0 < e2[0] ? void 0 : e2];
1257
+ }
1258
+ function sr(t2) {
1259
+ var e2 = t2[nr];
1260
+ if (e2) return e2;
1261
+ if (!(e2 = ar(t2, t2[nr] = new Qn(), ir, ir, rr)).ea && !e2.h && !e2.g) {
1262
+ let n2 = true;
1263
+ for (let t3 in e2) isNaN(t3) || (n2 = false);
1264
+ n2 ? (Ne(t2[0]) === Ue ? er ? e2 = er : ((e2 = new Qn()).T = Ne(true), e2 = er = e2) : e2 = tr ||= new Qn(), e2 = t2[nr] = e2) : e2.j = true;
1265
+ }
1266
+ return e2;
1267
+ }
1268
+ function or(t2, e2, n2) {
1269
+ t2[e2] = n2;
1270
+ }
1271
+ function ar(t2, e2, n2, r2, i2 = or) {
1272
+ e2.T = Ne(t2[0]);
1273
+ let s2 = 0;
1274
+ var o2 = t2[++s2];
1275
+ o2 && o2.constructor === Object && (e2.ea = o2, "function" == typeof (o2 = t2[++s2]) && (e2.l = o2, e2.m = t2[++s2], o2 = t2[++s2]));
1276
+ const a2 = {};
1277
+ for (; Array.isArray(o2) && "number" == typeof o2[0] && 0 < o2[0]; ) {
1278
+ for (var h2 = 0; h2 < o2.length; h2++) a2[o2[h2]] = o2;
1279
+ o2 = t2[++s2];
1280
+ }
1281
+ for (h2 = 1; void 0 !== o2; ) {
1282
+ let l2;
1283
+ "number" == typeof o2 && (h2 += o2, o2 = t2[++s2]);
1284
+ var c2 = void 0;
1285
+ if (o2 instanceof Bt ? l2 = o2 : (l2 = qr, s2--), l2.pa) {
1286
+ o2 = t2[++s2], c2 = t2;
1287
+ var u2 = s2;
1288
+ "function" == typeof o2 && (o2 = o2(), c2[u2] = o2), c2 = o2;
1289
+ }
1290
+ for (u2 = h2 + 1, "number" == typeof (o2 = t2[++s2]) && 0 > o2 && (u2 -= o2, o2 = t2[++s2]); h2 < u2; h2++) {
1291
+ const t3 = a2[h2];
1292
+ i2(e2, h2, c2 ? r2(l2, c2, t3) : n2(l2, t3));
1293
+ }
1294
+ }
1295
+ return e2;
1296
+ }
1297
+ var hr = /* @__PURE__ */ Symbol();
1298
+ function cr(t2) {
1299
+ let e2 = t2[hr];
1300
+ if (!e2) {
1301
+ const n2 = fr(t2);
1302
+ e2 = (t3, e3) => Er(t3, e3, n2), t2[hr] = e2;
1303
+ }
1304
+ return e2;
1305
+ }
1306
+ var ur = /* @__PURE__ */ Symbol();
1307
+ function lr(t2) {
1308
+ return t2.h;
1309
+ }
1310
+ function dr(t2, e2) {
1311
+ let n2, r2;
1312
+ const i2 = t2.h;
1313
+ return (t3, s2, o2) => i2(t3, s2, o2, r2 ||= fr(e2).T, n2 ||= cr(e2));
1314
+ }
1315
+ function fr(t2) {
1316
+ let e2 = t2[ur];
1317
+ return e2 || (e2 = ar(t2, t2[ur] = {}, lr, dr), _r(t2), e2);
1318
+ }
1319
+ var pr = /* @__PURE__ */ Symbol();
1320
+ function gr(t2, e2) {
1321
+ const n2 = t2.g;
1322
+ return e2 ? (t3, r2, i2) => n2(t3, r2, i2, e2) : n2;
1323
+ }
1324
+ function mr(t2, e2, n2) {
1325
+ const r2 = t2.g;
1326
+ let i2, s2;
1327
+ return (t3, o2, a2) => r2(t3, o2, a2, s2 ||= yr(e2).T, i2 ||= Jn(e2), n2);
1328
+ }
1329
+ function yr(t2) {
1330
+ let e2 = t2[pr];
1331
+ return e2 || (sr(t2), e2 = ar(t2, t2[pr] = {}, gr, mr), _r(t2), e2);
1332
+ }
1333
+ function _r(t2) {
1334
+ pr in t2 && nr in t2 && ur in t2 && (t2.length = 0);
1335
+ }
1336
+ function vr(t2, e2) {
1337
+ var n2 = t2[e2];
1338
+ if (n2) return n2;
1339
+ if ((n2 = t2.ea) && (n2 = n2[e2])) {
1340
+ var r2 = (n2 = Yn(n2))[0].h;
1341
+ if (n2 = n2[1]) {
1342
+ const e3 = cr(n2), i2 = fr(n2).T;
1343
+ n2 = (n2 = t2.m) ? n2(i2, e3) : (t3, n3, s2) => r2(t3, n3, s2, i2, e3);
1344
+ } else n2 = r2;
1345
+ return t2[e2] = n2;
1346
+ }
1347
+ }
1348
+ function Er(t2, e2, n2) {
1349
+ for (var r2 = qt(t2), i2 = +!!(512 & r2) - 1, s2 = t2.length, o2 = 512 & r2 ? 1 : 0, a2 = s2 + (256 & r2 ? -1 : 0); o2 < a2; o2++) {
1350
+ const r3 = t2[o2];
1351
+ if (null == r3) continue;
1352
+ const s3 = o2 - i2, a3 = vr(n2, s3);
1353
+ a3 && a3(e2, r3, s3);
1354
+ }
1355
+ if (256 & r2) {
1356
+ r2 = t2[s2 - 1];
1357
+ for (let t3 in r2) i2 = +t3, Number.isNaN(i2) || null != (s2 = r2[t3]) && (a2 = vr(n2, i2)) && a2(e2, s2, i2);
1358
+ }
1359
+ if (t2 = de ? t2[de] : void 0) for (Ct(e2, e2.g.end()), n2 = 0; n2 < t2.length; n2++) Ct(e2, N(t2[n2]) || C());
1360
+ }
1361
+ function wr(t2, e2) {
1362
+ return new Bt(t2, e2, false, false);
1363
+ }
1364
+ function Tr(t2, e2) {
1365
+ return new Bt(t2, e2, true, false);
1366
+ }
1367
+ function Ar(t2, e2) {
1368
+ return new Bt(t2, e2, false, true);
1369
+ }
1370
+ function br(t2, e2, n2) {
1371
+ fn(t2, qt(t2), e2, n2);
1372
+ }
1373
+ var kr = Ar((function(t2, e2, n2, r2, i2) {
1374
+ return 2 === t2.h && (t2 = _t(t2, Be([void 0, void 0], r2), i2), ue(r2 = qt(e2)), (i2 = ln(e2, r2, n2)) instanceof Ke ? 0 != (2 & i2.N) ? ((i2 = i2.Y()).push(t2), fn(e2, r2, n2, i2)) : i2.Oa(t2) : Array.isArray(i2) ? (2 & $t(i2) && fn(e2, r2, n2, i2 = wn(i2)), i2.push(t2)) : fn(e2, r2, n2, [t2]), true);
1375
+ }), (function(t2, e2, n2, r2, i2) {
1376
+ if (e2 instanceof Ke) e2.forEach(((e3, s2) => {
1377
+ Nt(t2, n2, Be([s2, e3], r2), i2);
1378
+ }));
1379
+ else if (Array.isArray(e2)) for (let s2 = 0; s2 < e2.length; s2++) {
1380
+ const o2 = e2[s2];
1381
+ Array.isArray(o2) && Nt(t2, n2, Be(o2, r2), i2);
1382
+ }
1383
+ }));
1384
+ function xr(t2, e2, n2) {
1385
+ t: if (null != e2) {
1386
+ if (Te(e2)) {
1387
+ if ("string" == typeof e2) {
1388
+ e2 = Le(e2);
1389
+ break t;
1390
+ }
1391
+ if ("number" == typeof e2) {
1392
+ e2 = Se(e2);
1393
+ break t;
1394
+ }
1395
+ }
1396
+ e2 = void 0;
1397
+ }
1398
+ null != e2 && ("string" == typeof e2 && xt(e2), null != e2 && (Ot(t2, n2, 0), "number" == typeof e2 ? (t2 = t2.g, $(e2), Ft(t2, K, Y)) : (n2 = xt(e2), Ft(t2.g, n2.h, n2.g))));
1399
+ }
1400
+ function Sr(t2, e2, n2) {
1401
+ null != (e2 = Ae(e2)) && null != e2 && (Ot(t2, n2, 0), Mt(t2.g, e2));
1402
+ }
1403
+ function Lr(t2, e2, n2) {
1404
+ null != (e2 = Ee(e2)) && (Ot(t2, n2, 0), t2.g.g.push(e2 ? 1 : 0));
1405
+ }
1406
+ function Fr(t2, e2, n2) {
1407
+ null != (e2 = Pe(e2)) && Dt(t2, n2, c(e2));
1408
+ }
1409
+ function Rr(t2, e2, n2, r2, i2) {
1410
+ Nt(t2, n2, e2 instanceof zn ? e2.s : Array.isArray(e2) ? Be(e2, r2) : void 0, i2);
1411
+ }
1412
+ function Mr(t2, e2, n2) {
1413
+ null != (e2 = null == e2 || "string" == typeof e2 || M(e2) || e2 instanceof B ? e2 : void 0) && Dt(t2, n2, X(e2).buffer);
1414
+ }
1415
+ function Pr(t2, e2, n2) {
1416
+ return (5 === t2.h || 2 === t2.h) && (e2 = pn(e2, qt(e2), n2, 2, false), 2 == t2.h ? wt(t2, ct, e2) : e2.push(ct(t2.g)), true);
1417
+ }
1418
+ var Cr;
1419
+ var Or = wr((function(t2, e2, n2) {
1420
+ if (1 !== t2.h) return false;
1421
+ var r2 = t2.g;
1422
+ t2 = ht(r2);
1423
+ const i2 = ht(r2);
1424
+ r2 = 2 * (i2 >> 31) + 1;
1425
+ const s2 = i2 >>> 20 & 2047;
1426
+ return t2 = 4294967296 * (1048575 & i2) + t2, br(e2, n2, 2047 == s2 ? t2 ? NaN : 1 / 0 * r2 : 0 == s2 ? r2 * Math.pow(2, -1074) * t2 : r2 * Math.pow(2, s2 - 1075) * (t2 + 4503599627370496)), true;
1427
+ }), (function(t2, e2, n2) {
1428
+ null != (e2 = ve(e2)) && (Ot(t2, n2, 1), t2 = t2.g, (n2 = z ||= new DataView(new ArrayBuffer(8))).setFloat64(0, +e2, true), K = n2.getUint32(0, true), Y = n2.getUint32(4, true), Pt(t2, K), Pt(t2, Y));
1429
+ }));
1430
+ var Ir = wr((function(t2, e2, n2) {
1431
+ return 5 === t2.h && (br(e2, n2, ct(t2.g)), true);
1432
+ }), (function(t2, e2, n2) {
1433
+ null != (e2 = ve(e2)) && (Ot(t2, n2, 5), t2 = t2.g, q(e2), Pt(t2, K));
1434
+ }));
1435
+ var Ur = Tr(Pr, (function(t2, e2, n2) {
1436
+ if (null != (e2 = $n(ve, e2))) for (let o2 = 0; o2 < e2.length; o2++) {
1437
+ var r2 = t2, i2 = n2, s2 = e2[o2];
1438
+ null != s2 && (Ot(r2, i2, 5), r2 = r2.g, q(s2), Pt(r2, K));
1439
+ }
1440
+ }));
1441
+ var Dr = Tr(Pr, (function(t2, e2, n2) {
1442
+ if (null != (e2 = $n(ve, e2)) && e2.length) {
1443
+ Ot(t2, n2, 2), Rt(t2.g, 4 * e2.length);
1444
+ for (let r2 = 0; r2 < e2.length; r2++) n2 = t2.g, q(e2[r2]), Pt(n2, K);
1445
+ }
1446
+ }));
1447
+ var Nr = wr((function(t2, e2, n2) {
1448
+ return 0 === t2.h && (br(e2, n2, it(t2.g, Z)), true);
1449
+ }), xr);
1450
+ var Br = wr((function(t2, e2, n2) {
1451
+ return 0 === t2.h && (br(e2, n2, 0 === (t2 = it(t2.g, Z)) ? void 0 : t2), true);
1452
+ }), xr);
1453
+ var Gr = wr((function(t2, e2, n2) {
1454
+ return 0 === t2.h && (br(e2, n2, it(t2.g, J)), true);
1455
+ }), (function(t2, e2, n2) {
1456
+ t: if (null != e2) {
1457
+ if (Te(e2)) {
1458
+ if ("string" == typeof e2) {
1459
+ var r2 = Math.trunc(Number(e2));
1460
+ Number.isSafeInteger(r2) && 0 <= r2 ? e2 = String(r2) : (-1 !== (r2 = e2.indexOf(".")) && (e2 = e2.substring(0, r2)), ke(e2) || (nt(e2), e2 = Q(K, Y)));
1461
+ break t;
1462
+ }
1463
+ if ("number" == typeof e2) {
1464
+ e2 = 0 <= (e2 = Math.trunc(e2)) && Number.isSafeInteger(e2) ? e2 : (function(t3) {
1465
+ if (0 > t3) {
1466
+ $(t3);
1467
+ const e3 = Q(K, Y);
1468
+ return t3 = Number(e3), Number.isSafeInteger(t3) ? t3 : e3;
1469
+ }
1470
+ return ke(String(t3)) ? t3 : ($(t3), J(K, Y));
1471
+ })(e2);
1472
+ break t;
1473
+ }
1474
+ }
1475
+ e2 = void 0;
1476
+ }
1477
+ null != e2 && ("string" == typeof e2 && At(e2), null != e2 && (Ot(t2, n2, 0), "number" == typeof e2 ? (t2 = t2.g, $(e2), Ft(t2, K, Y)) : (n2 = At(e2), Ft(t2.g, n2.h, n2.g))));
1478
+ }));
1479
+ var jr = wr((function(t2, e2, n2) {
1480
+ return 0 === t2.h && (br(e2, n2, ot(t2.g)), true);
1481
+ }), Sr);
1482
+ var Vr = Tr((function(t2, e2, n2) {
1483
+ return (0 === t2.h || 2 === t2.h) && (e2 = pn(e2, qt(e2), n2, 2, false), 2 == t2.h ? wt(t2, ot, e2) : e2.push(ot(t2.g)), true);
1484
+ }), (function(t2, e2, n2) {
1485
+ if (null != (e2 = $n(Ae, e2)) && e2.length) {
1486
+ n2 = It(t2, n2);
1487
+ for (let n3 = 0; n3 < e2.length; n3++) Mt(t2.g, e2[n3]);
1488
+ Ut(t2, n2);
1489
+ }
1490
+ }));
1491
+ var Xr = wr((function(t2, e2, n2) {
1492
+ return 0 === t2.h && (br(e2, n2, 0 === (t2 = ot(t2.g)) ? void 0 : t2), true);
1493
+ }), Sr);
1494
+ var Hr = wr((function(t2, e2, n2) {
1495
+ return 0 === t2.h && (br(e2, n2, st(t2.g)), true);
1496
+ }), Lr);
1497
+ var Wr = wr((function(t2, e2, n2) {
1498
+ return 0 === t2.h && (br(e2, n2, false === (t2 = st(t2.g)) ? void 0 : t2), true);
1499
+ }), Lr);
1500
+ var zr = Tr((function(t2, e2, n2) {
1501
+ return 2 === t2.h && (bn(e2, n2, kn, t2 = vt(t2)), true);
1502
+ }), (function(t2, e2, n2) {
1503
+ if (null != (e2 = $n(Pe, e2))) for (let o2 = 0; o2 < e2.length; o2++) {
1504
+ var r2 = t2, i2 = n2, s2 = e2[o2];
1505
+ null != s2 && Dt(r2, i2, c(s2));
1506
+ }
1507
+ }));
1508
+ var Kr = wr((function(t2, e2, n2) {
1509
+ return 2 === t2.h && (br(e2, n2, "" === (t2 = vt(t2)) ? void 0 : t2), true);
1510
+ }), Fr);
1511
+ var Yr = wr((function(t2, e2, n2) {
1512
+ return 2 === t2.h && (br(e2, n2, vt(t2)), true);
1513
+ }), Fr);
1514
+ var $r = Ar((function(t2, e2, n2, r2, i2) {
1515
+ return 2 === t2.h && (_t(t2, Ln(e2, r2, n2, true), i2), true);
1516
+ }), Rr);
1517
+ var qr = Ar((function(t2, e2, n2, r2, i2) {
1518
+ return 2 === t2.h && (_t(t2, Ln(e2, r2, n2), i2), true);
1519
+ }), Rr);
1520
+ Cr = new Bt((function(t2, e2, n2, r2, i2) {
1521
+ if (2 !== t2.h) return false;
1522
+ r2 = Be(void 0, r2);
1523
+ let s2 = qt(e2);
1524
+ ue(s2);
1525
+ let o2 = pn(e2, s2, n2, 3);
1526
+ return s2 = qt(e2), 4 & $t(o2) && (o2 = Gt(o2), Jt(o2, -2079 & (1 | $t(o2))), fn(e2, s2, n2, o2)), o2.push(r2), _t(t2, r2, i2), true;
1527
+ }), (function(t2, e2, n2, r2, i2) {
1528
+ if (Array.isArray(e2)) for (let s2 = 0; s2 < e2.length; s2++) Rr(t2, e2[s2], n2, r2, i2);
1529
+ }), true, true);
1530
+ var Jr = Ar((function(t2, e2, n2, r2, i2, s2) {
1531
+ if (2 !== t2.h) return false;
1532
+ let o2 = qt(e2);
1533
+ return ue(o2), (s2 = Sn(e2, o2, s2)) && n2 !== s2 && fn(e2, o2, s2), _t(t2, e2 = Ln(e2, r2, n2), i2), true;
1534
+ }), Rr);
1535
+ var Zr = wr((function(t2, e2, n2) {
1536
+ return 2 === t2.h && (br(e2, n2, Et(t2)), true);
1537
+ }), Mr);
1538
+ var Qr = Tr((function(t2, e2, n2) {
1539
+ return (0 === t2.h || 2 === t2.h) && (e2 = pn(e2, qt(e2), n2, 2, false), 2 == t2.h ? wt(t2, at, e2) : e2.push(at(t2.g)), true);
1540
+ }), (function(t2, e2, n2) {
1541
+ if (null != (e2 = $n(be, e2))) for (let o2 = 0; o2 < e2.length; o2++) {
1542
+ var r2 = t2, i2 = n2, s2 = e2[o2];
1543
+ null != s2 && (Ot(r2, i2, 0), Rt(r2.g, s2));
1544
+ }
1545
+ }));
1546
+ var ti = wr((function(t2, e2, n2) {
1547
+ return 0 === t2.h && (br(e2, n2, ot(t2.g)), true);
1548
+ }), (function(t2, e2, n2) {
1549
+ null != (e2 = Ae(e2)) && (e2 = parseInt(e2, 10), Ot(t2, n2, 0), Mt(t2.g, e2));
1550
+ }));
1551
+ var ei = Tr((function(t2, e2, n2) {
1552
+ return (0 === t2.h || 2 === t2.h) && (e2 = pn(e2, qt(e2), n2, 2, false), 2 == t2.h ? wt(t2, ut, e2) : e2.push(ot(t2.g)), true);
1553
+ }), (function(t2, e2, n2) {
1554
+ if (null != (e2 = $n(Ae, e2)) && e2.length) {
1555
+ n2 = It(t2, n2);
1556
+ for (let n3 = 0; n3 < e2.length; n3++) Mt(t2.g, e2[n3]);
1557
+ Ut(t2, n2);
1558
+ }
1559
+ }));
1560
+ var ni = class {
1561
+ constructor(t2, e2) {
1562
+ this.h = t2, this.g = e2, this.l = Rn, this.m = Cn, this.defaultValue = void 0;
1563
+ }
1564
+ };
1565
+ function ri(t2, e2) {
1566
+ return new ni(t2, e2);
1567
+ }
1568
+ function ii(t2, e2) {
1569
+ return (n2, r2) => {
1570
+ if (Tt.length) {
1571
+ const t3 = Tt.pop();
1572
+ t3.o(r2), lt(t3.g, n2, r2), n2 = t3;
1573
+ } else n2 = new class {
1574
+ constructor(t3, e3) {
1575
+ if (gt.length) {
1576
+ const n3 = gt.pop();
1577
+ lt(n3, t3, e3), t3 = n3;
1578
+ } else t3 = new class {
1579
+ constructor(t4, e4) {
1580
+ this.h = null, this.m = false, this.g = this.l = this.j = 0, lt(this, t4, e4);
1581
+ }
1582
+ clear() {
1583
+ this.h = null, this.m = false, this.g = this.l = this.j = 0, this.ca = false;
1584
+ }
1585
+ }(t3, e3);
1586
+ this.g = t3, this.l = this.g.g, this.h = this.m = -1, this.o(e3);
1587
+ }
1588
+ o({ ia: t3 = false } = {}) {
1589
+ this.ia = t3;
1590
+ }
1591
+ }(n2, r2);
1592
+ try {
1593
+ const r3 = new t2(), s2 = r3.s;
1594
+ Jn(e2)(s2, n2);
1595
+ var i2 = r3;
1596
+ } finally {
1597
+ n2.g.clear(), n2.m = -1, n2.h = -1, 100 > Tt.length && Tt.push(n2);
1598
+ }
1599
+ return i2;
1600
+ };
1601
+ }
1602
+ function si(t2) {
1603
+ return function() {
1604
+ const e2 = new class {
1605
+ constructor() {
1606
+ this.l = [], this.h = 0, this.g = new class {
1607
+ constructor() {
1608
+ this.g = [];
1609
+ }
1610
+ length() {
1611
+ return this.g.length;
1612
+ }
1613
+ end() {
1614
+ const t3 = this.g;
1615
+ return this.g = [], t3;
1616
+ }
1617
+ }();
1618
+ }
1619
+ }();
1620
+ Er(this.s, e2, fr(t2)), Ct(e2, e2.g.end());
1621
+ const n2 = new Uint8Array(e2.h), r2 = e2.l, i2 = r2.length;
1622
+ let s2 = 0;
1623
+ for (let t3 = 0; t3 < i2; t3++) {
1624
+ const e3 = r2[t3];
1625
+ n2.set(e3, s2), s2 += e3.length;
1626
+ }
1627
+ return e2.l = [n2], n2;
1628
+ };
1629
+ }
1630
+ var oi = class extends zn {
1631
+ constructor(t2) {
1632
+ super(t2);
1633
+ }
1634
+ };
1635
+ var ai = [0, Kr, wr((function(t2, e2, n2) {
1636
+ return 2 === t2.h && (br(e2, n2, (t2 = Et(t2)) === D() ? void 0 : t2), true);
1637
+ }), (function(t2, e2, n2) {
1638
+ if (null != e2) {
1639
+ if (e2 instanceof zn) {
1640
+ const r2 = e2.Qa;
1641
+ return void (r2 && (e2 = r2(e2), null != e2 && Dt(t2, n2, X(e2).buffer)));
1642
+ }
1643
+ if (Array.isArray(e2)) return;
1644
+ }
1645
+ Mr(t2, e2, n2);
1646
+ }))];
1647
+ var hi = [0, Yr];
1648
+ var ci = [0, jr, ti, Hr, -1, Vr, ti, -1];
1649
+ var ui = [0, Hr, -1];
1650
+ var li = class extends zn {
1651
+ constructor() {
1652
+ super();
1653
+ }
1654
+ };
1655
+ li.B = [6];
1656
+ var di = [0, Hr, Yr, Hr, ti, -1, ei, Yr, -1, ui, ti];
1657
+ var fi = [0, Yr, -2];
1658
+ var pi = class extends zn {
1659
+ constructor() {
1660
+ super();
1661
+ }
1662
+ };
1663
+ var gi = [0];
1664
+ var mi = [0, jr, Hr, -4];
1665
+ var yi = class extends zn {
1666
+ constructor(t2) {
1667
+ super(t2, 2);
1668
+ }
1669
+ };
1670
+ var _i = {};
1671
+ var vi = [-2, _i, Hr];
1672
+ _i[336783863] = [0, Yr, Hr, -1, jr, [0, [1, 2, 3, 4, 5, 6], Jr, gi, Jr, di, Jr, fi, Jr, mi, Jr, ci, Jr, [0, Yr]], hi, Hr, [0, [1, 3], [2, 4], Jr, [0, Vr], -1, Jr, [0, zr], -1, Cr, [0, Yr, -1]], Yr];
1673
+ var Ei = [0, Kr, Wr];
1674
+ var wi = [0, Br, -1, Wr, -3, Br, Vr, Kr, Xr, Br, -1, Wr, Xr, Wr, -2, Kr];
1675
+ var Ti = [-1, {}];
1676
+ var Ai = [0, Yr, 1, Ti];
1677
+ var bi = [0, Yr, zr, Ti];
1678
+ function ki(t2, e2) {
1679
+ An(t2, 2, Me(e2), "");
1680
+ }
1681
+ function xi(t2, e2) {
1682
+ bn(t2.s, 3, Re, e2);
1683
+ }
1684
+ function Si(t2, e2) {
1685
+ bn(t2.s, 4, Re, e2);
1686
+ }
1687
+ var Li = class extends zn {
1688
+ constructor(t2) {
1689
+ super(t2, 500);
1690
+ }
1691
+ o(t2) {
1692
+ return Cn(this, 0, 7, t2);
1693
+ }
1694
+ };
1695
+ Li.B = [3, 4, 5, 6, 8, 13, 17, 1005];
1696
+ var Fi = [-500, Kr, -1, zr, -3, vi, Cr, ai, Xr, -1, Ai, bi, Cr, Ei, Kr, wi, Xr, zr, 987, zr];
1697
+ var Ri = [0, Kr, -1, Ti];
1698
+ var Mi = [-500, Yr, -1, [-1, {}], 998, Yr];
1699
+ var Pi = [-500, Yr, zr, -1, [-2, {}, Hr], 997, zr, -1];
1700
+ var Ci = [-500, Yr, zr, Ti, 998, zr];
1701
+ function Oi(t2, e2) {
1702
+ Dn(t2, 1, Li, e2);
1703
+ }
1704
+ function Ii(t2, e2) {
1705
+ bn(t2.s, 10, Re, e2);
1706
+ }
1707
+ function Ui(t2, e2) {
1708
+ bn(t2.s, 15, Re, e2);
1709
+ }
1710
+ var Di = class extends zn {
1711
+ constructor(t2) {
1712
+ super(t2, 500);
1713
+ }
1714
+ o(t2) {
1715
+ return Cn(this, 0, 1001, t2);
1716
+ }
1717
+ };
1718
+ Di.B = [1, 6, 7, 9, 10, 15, 16, 17, 14, 1002];
1719
+ var Ni = [-500, Cr, Fi, 4, Cr, Mi, Cr, Pi, Xr, Cr, Ci, zr, Xr, Ai, bi, Cr, Ri, zr, -2, wi, Kr, -1, Wr, 979, Ti, Cr, ai];
1720
+ var Bi = ii(Di, Ni);
1721
+ Di.prototype.g = si(Ni);
1722
+ var Gi = [0, Cr, [0, jr, -2]];
1723
+ var ji = class extends zn {
1724
+ constructor(t2) {
1725
+ super(t2);
1726
+ }
1727
+ };
1728
+ var Vi = [0, jr, Ir, Yr, -1];
1729
+ var Xi = class extends zn {
1730
+ constructor(t2) {
1731
+ super(t2);
1732
+ }
1733
+ g() {
1734
+ return Pn(this, ji, 1);
1735
+ }
1736
+ };
1737
+ Xi.B = [1];
1738
+ var Hi = [0, Cr, Vi];
1739
+ var Wi = ii(Xi, Hi);
1740
+ var zi = [0, jr, Ir];
1741
+ var Ki = [0, jr, -1, Gi];
1742
+ var Yi = class extends zn {
1743
+ constructor(t2) {
1744
+ super(t2);
1745
+ }
1746
+ };
1747
+ var $i = [0, jr, -3];
1748
+ var qi = [0, Ir, -3];
1749
+ var Ji = class extends zn {
1750
+ constructor(t2) {
1751
+ super(t2);
1752
+ }
1753
+ };
1754
+ var Zi = [0, Ir, -1, Yr, Ir];
1755
+ var Qi = class extends zn {
1756
+ constructor(t2) {
1757
+ super(t2);
1758
+ }
1759
+ h() {
1760
+ return Rn(this, Yi, 2);
1761
+ }
1762
+ g() {
1763
+ return Pn(this, Ji, 5);
1764
+ }
1765
+ };
1766
+ Qi.B = [5];
1767
+ var ts = [0, ti, $i, qi, Ki, Cr, Zi];
1768
+ var es = class extends zn {
1769
+ constructor(t2) {
1770
+ super(t2);
1771
+ }
1772
+ };
1773
+ es.B = [1, 2, 3, 8, 9];
1774
+ var ns = ii(es, [0, zr, Vr, Dr, ts, Yr, -1, Nr, Cr, zi, zr, Nr]);
1775
+ var rs = class extends zn {
1776
+ constructor(t2) {
1777
+ super(t2);
1778
+ }
1779
+ };
1780
+ var is = [0, Ir, -4];
1781
+ var ss = class extends zn {
1782
+ constructor(t2) {
1783
+ super(t2);
1784
+ }
1785
+ };
1786
+ ss.B = [1];
1787
+ var os = ii(ss, [0, Cr, is]);
1788
+ var as = class extends zn {
1789
+ constructor(t2) {
1790
+ super(t2);
1791
+ }
1792
+ };
1793
+ var hs = [0, Ir, -4];
1794
+ var cs = class extends zn {
1795
+ constructor(t2) {
1796
+ super(t2);
1797
+ }
1798
+ };
1799
+ cs.B = [1];
1800
+ var us = ii(cs, [0, Cr, hs]);
1801
+ var ls = class extends zn {
1802
+ constructor(t2) {
1803
+ super(t2);
1804
+ }
1805
+ };
1806
+ ls.B = [3];
1807
+ var ds = [0, jr, -1, Dr, ti];
1808
+ var fs = class extends zn {
1809
+ constructor() {
1810
+ super();
1811
+ }
1812
+ };
1813
+ fs.prototype.g = si([0, Ir, -4, Nr]);
1814
+ var ps = class extends zn {
1815
+ constructor(t2) {
1816
+ super(t2);
1817
+ }
1818
+ };
1819
+ var gs = [0, 1, jr, Yr, Hi];
1820
+ var ms = class extends zn {
1821
+ constructor(t2) {
1822
+ super(t2);
1823
+ }
1824
+ };
1825
+ ms.B = [1];
1826
+ var ys = ii(ms, [0, Cr, gs, Nr]);
1827
+ var _s = class extends zn {
1828
+ constructor(t2) {
1829
+ super(t2);
1830
+ }
1831
+ };
1832
+ _s.B = [1];
1833
+ var vs = class extends zn {
1834
+ constructor(t2) {
1835
+ super(t2);
1836
+ }
1837
+ qa() {
1838
+ const t2 = mn(this);
1839
+ return null == t2 ? D() : t2;
1840
+ }
1841
+ };
1842
+ var Es = class extends zn {
1843
+ constructor(t2) {
1844
+ super(t2);
1845
+ }
1846
+ };
1847
+ var ws = [1, 2];
1848
+ var Ts = [0, ws, Jr, [0, Dr], Jr, [0, Zr], jr, Yr];
1849
+ var As = class extends zn {
1850
+ constructor(t2) {
1851
+ super(t2);
1852
+ }
1853
+ };
1854
+ As.B = [1];
1855
+ var bs = ii(As, [0, Cr, Ts, Nr]);
1856
+ var ks = class extends zn {
1857
+ constructor(t2) {
1858
+ super(t2);
1859
+ }
1860
+ };
1861
+ ks.B = [4, 5];
1862
+ var xs = [0, Yr, jr, Ir, zr, -1];
1863
+ var Ss = class extends zn {
1864
+ constructor(t2) {
1865
+ super(t2);
1866
+ }
1867
+ };
1868
+ var Ls = [0, Hr, -1];
1869
+ var Fs = class extends zn {
1870
+ constructor(t2) {
1871
+ super(t2);
1872
+ }
1873
+ };
1874
+ var Rs = [1, 2, 3, 4, 5];
1875
+ var Ms = class extends zn {
1876
+ constructor(t2) {
1877
+ super(t2);
1878
+ }
1879
+ g() {
1880
+ return null != mn(this);
1881
+ }
1882
+ h() {
1883
+ return null != Pe(cn(this, 2));
1884
+ }
1885
+ };
1886
+ var Ps = [0, Zr, Yr, [0, jr, Nr, -1], [0, Gr, Nr]];
1887
+ var Cs = class extends zn {
1888
+ constructor(t2) {
1889
+ super(t2);
1890
+ }
1891
+ g() {
1892
+ return Ee(cn(this, 2)) ?? false;
1893
+ }
1894
+ };
1895
+ var Os = [0, Ps, Hr, [0, Rs, Jr, mi, Jr, di, Jr, ci, Jr, gi, Jr, fi], ti];
1896
+ var Is = class extends zn {
1897
+ constructor(t2) {
1898
+ super(t2);
1899
+ }
1900
+ };
1901
+ var Us = [0, Os, Ir, -1, jr];
1902
+ var Ds = ri(502141897, Is);
1903
+ _i[502141897] = Us;
1904
+ var Ns = [0, Ps];
1905
+ _i[512499200] = Ns;
1906
+ var Bs = [0, Ns];
1907
+ _i[515723506] = Bs;
1908
+ var Gs = ii(class extends zn {
1909
+ constructor(t2) {
1910
+ super(t2);
1911
+ }
1912
+ }, [0, [0, ti, -1, Ur, Qr], ds]);
1913
+ var js = [0, Os];
1914
+ _i[508981768] = js;
1915
+ var Vs = class extends zn {
1916
+ constructor(t2) {
1917
+ super(t2);
1918
+ }
1919
+ };
1920
+ var Xs = [0, Os, Ir, js, Hr];
1921
+ var Hs = class extends zn {
1922
+ constructor(t2) {
1923
+ super(t2);
1924
+ }
1925
+ };
1926
+ var Ws = [0, Os, Us, Xs, Ir, Bs];
1927
+ _i[508968149] = Xs;
1928
+ var zs = ri(508968150, Hs);
1929
+ _i[508968150] = Ws;
1930
+ var Ks = class extends zn {
1931
+ constructor(t2) {
1932
+ super(t2);
1933
+ }
1934
+ };
1935
+ var Ys = ri(513916220, Ks);
1936
+ _i[513916220] = [0, Os, Ws, jr];
1937
+ var $s = class extends zn {
1938
+ constructor(t2) {
1939
+ super(t2);
1940
+ }
1941
+ h() {
1942
+ return Rn(this, ks, 2);
1943
+ }
1944
+ g() {
1945
+ dn(this, 2);
1946
+ }
1947
+ };
1948
+ var qs = [0, Os, xs];
1949
+ _i[478825465] = qs;
1950
+ var Js = [0, Os];
1951
+ _i[478825422] = Js;
1952
+ var Zs = class extends zn {
1953
+ constructor(t2) {
1954
+ super(t2);
1955
+ }
1956
+ };
1957
+ var Qs = [0, Os, Js, qs, -1];
1958
+ var to = class extends zn {
1959
+ constructor(t2) {
1960
+ super(t2);
1961
+ }
1962
+ };
1963
+ var eo = [0, Os, Ir, jr];
1964
+ var no = class extends zn {
1965
+ constructor(t2) {
1966
+ super(t2);
1967
+ }
1968
+ };
1969
+ var ro = [0, Os, Ir];
1970
+ var io = class extends zn {
1971
+ constructor(t2) {
1972
+ super(t2);
1973
+ }
1974
+ };
1975
+ var so = [0, Os, eo, ro, Ir];
1976
+ var oo = class extends zn {
1977
+ constructor(t2) {
1978
+ super(t2);
1979
+ }
1980
+ };
1981
+ var ao = [0, Os, so, Qs];
1982
+ _i[463370452] = Qs, _i[464864288] = eo, _i[474472470] = ro;
1983
+ var ho = ri(462713202, io);
1984
+ _i[462713202] = so;
1985
+ var co = ri(479097054, oo);
1986
+ _i[479097054] = ao;
1987
+ var uo = class extends zn {
1988
+ constructor(t2) {
1989
+ super(t2);
1990
+ }
1991
+ };
1992
+ var lo = [0, Os];
1993
+ var fo = class extends zn {
1994
+ constructor(t2) {
1995
+ super(t2);
1996
+ }
1997
+ };
1998
+ var po = [0, Os, Ir, -1, jr];
1999
+ _i[514774813] = po;
2000
+ var go = class extends zn {
2001
+ constructor(t2) {
2002
+ super(t2);
2003
+ }
2004
+ };
2005
+ var mo = [0, Os, Ir, Hr];
2006
+ _i[518928384] = mo;
2007
+ var yo = class extends zn {
2008
+ constructor() {
2009
+ super();
2010
+ }
2011
+ };
2012
+ yo.prototype.g = si([0, Os, ro, lo, Us, Xs, po, mo]);
2013
+ var _o = class extends zn {
2014
+ constructor(t2) {
2015
+ super(t2);
2016
+ }
2017
+ };
2018
+ var vo = ri(456383383, _o);
2019
+ _i[456383383] = [0, Os, xs];
2020
+ var Eo = class extends zn {
2021
+ constructor(t2) {
2022
+ super(t2);
2023
+ }
2024
+ };
2025
+ var wo = ri(476348187, Eo);
2026
+ _i[476348187] = [0, Os, Ls];
2027
+ var To = class extends zn {
2028
+ constructor(t2) {
2029
+ super(t2);
2030
+ }
2031
+ };
2032
+ var Ao = [0, ti, -1];
2033
+ var bo = class extends zn {
2034
+ constructor(t2) {
2035
+ super(t2);
2036
+ }
2037
+ };
2038
+ bo.B = [3];
2039
+ var ko = ri(458105876, class extends zn {
2040
+ constructor(t2) {
2041
+ super(t2);
2042
+ }
2043
+ g() {
2044
+ var t2 = this.s;
2045
+ const e2 = qt(t2);
2046
+ var n2 = 2 & e2;
2047
+ return t2 = (function(t3, e3, n3) {
2048
+ var r2 = bo;
2049
+ const i2 = 2 & e3;
2050
+ let s2 = false;
2051
+ if (null == n3) {
2052
+ if (i2) return Ze();
2053
+ n3 = [];
2054
+ } else if (n3.constructor === Ke) {
2055
+ if (0 == (2 & n3.N) || i2) return n3;
2056
+ n3 = n3.Y();
2057
+ } else Array.isArray(n3) ? s2 = !!(2 & $t(n3)) : n3 = [];
2058
+ if (i2) {
2059
+ if (!n3.length) return Ze();
2060
+ s2 || (s2 = true, Zt(n3));
2061
+ } else s2 && (s2 = false, n3 = wn(n3));
2062
+ return s2 || (64 & $t(n3) ? Kt(n3, 32) : 32 & e3 && zt(n3, 32)), fn(t3, e3, 2, r2 = new Ke(n3, r2, Oe, void 0), false), r2;
2063
+ })(t2, e2, ln(t2, e2, 2)), null == t2 || !n2 && bo && (t2.ta = true), n2 = t2;
2064
+ }
2065
+ });
2066
+ _i[458105876] = [0, Ao, kr, [true, Nr, [0, Yr, -1, zr]]];
2067
+ var xo = class extends zn {
2068
+ constructor(t2) {
2069
+ super(t2);
2070
+ }
2071
+ };
2072
+ var So = ri(458105758, xo);
2073
+ _i[458105758] = [0, Os, Yr, Ao];
2074
+ var Lo = class extends zn {
2075
+ constructor(t2) {
2076
+ super(t2);
2077
+ }
2078
+ };
2079
+ Lo.B = [5, 6];
2080
+ var Fo = ri(443442058, Lo);
2081
+ _i[443442058] = [0, Os, Yr, jr, Ir, zr, -1];
2082
+ var Ro = class extends zn {
2083
+ constructor(t2) {
2084
+ super(t2);
2085
+ }
2086
+ };
2087
+ var Mo = ri(516587230, Ro);
2088
+ function Po(t2, e2) {
2089
+ return e2 = e2 ? e2.clone() : new ks(), void 0 !== t2.displayNamesLocale ? dn(e2, 1, Me(t2.displayNamesLocale)) : void 0 === t2.displayNamesLocale && dn(e2, 1), void 0 !== t2.maxResults ? Xn(e2, 2, t2.maxResults) : "maxResults" in t2 && dn(e2, 2), void 0 !== t2.scoreThreshold ? Hn(e2, 3, t2.scoreThreshold) : "scoreThreshold" in t2 && dn(e2, 3), void 0 !== t2.categoryAllowlist ? Tn(e2, 4, t2.categoryAllowlist) : "categoryAllowlist" in t2 && dn(e2, 4), void 0 !== t2.categoryDenylist ? Tn(e2, 5, t2.categoryDenylist) : "categoryDenylist" in t2 && dn(e2, 5), e2;
2090
+ }
2091
+ function Co(t2, e2 = -1, n2 = "") {
2092
+ return { categories: t2.map(((t3) => ({ index: Bn(Nn(t3, 1), 0) ?? -1, score: Gn(t3, 2) ?? 0, categoryName: jn(t3, 3) ?? "", displayName: jn(t3, 4) ?? "" }))), headIndex: e2, headName: n2 };
2093
+ }
2094
+ function Oo(t2) {
2095
+ var e2 = yn(t2, 3, ve), n2 = yn(t2, 2, Ae), r2 = yn(t2, 1, Pe), i2 = yn(t2, 9, Pe);
2096
+ const s2 = { categories: [], keypoints: [] };
2097
+ for (let t3 = 0; t3 < e2.length; t3++) s2.categories.push({ score: e2[t3], index: n2[t3] ?? -1, categoryName: r2[t3] ?? "", displayName: i2[t3] ?? "" });
2098
+ if ((e2 = Rn(t2, Qi, 4)?.h()) && (s2.boundingBox = { originX: Nn(e2, 1) ?? 0, originY: Nn(e2, 2) ?? 0, width: Nn(e2, 3) ?? 0, height: Nn(e2, 4) ?? 0, angle: 0 }), Rn(t2, Qi, 4)?.g().length) for (const e3 of Rn(t2, Qi, 4).g()) s2.keypoints.push({ x: gn(e3, 1) ?? 0, y: gn(e3, 2) ?? 0, score: gn(e3, 4) ?? 0, label: Pe(cn(e3, 3)) ?? "" });
2099
+ return s2;
2100
+ }
2101
+ function Io(t2) {
2102
+ const e2 = [];
2103
+ for (const n2 of Pn(t2, as, 1)) e2.push({ x: Gn(n2, 1) ?? 0, y: Gn(n2, 2) ?? 0, z: Gn(n2, 3) ?? 0, visibility: Gn(n2, 4) ?? 0 });
2104
+ return e2;
2105
+ }
2106
+ function Uo(t2) {
2107
+ const e2 = [];
2108
+ for (const n2 of Pn(t2, rs, 1)) e2.push({ x: Gn(n2, 1) ?? 0, y: Gn(n2, 2) ?? 0, z: Gn(n2, 3) ?? 0, visibility: Gn(n2, 4) ?? 0 });
2109
+ return e2;
2110
+ }
2111
+ function Do(t2) {
2112
+ return Array.from(t2, ((t3) => 127 < t3 ? t3 - 256 : t3));
2113
+ }
2114
+ function No(t2, e2) {
2115
+ if (t2.length !== e2.length) throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t2.length} vs. ${e2.length}).`);
2116
+ let n2 = 0, r2 = 0, i2 = 0;
2117
+ for (let s2 = 0; s2 < t2.length; s2++) n2 += t2[s2] * e2[s2], r2 += t2[s2] * t2[s2], i2 += e2[s2] * e2[s2];
2118
+ if (0 >= r2 || 0 >= i2) throw Error("Cannot compute cosine similarity on embedding with 0 norm.");
2119
+ return n2 / Math.sqrt(r2 * i2);
2120
+ }
2121
+ var Bo;
2122
+ _i[516587230] = [0, Os, po, mo, Ir];
2123
+ var Go = 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]);
2124
+ async function jo() {
2125
+ if (void 0 === Bo) try {
2126
+ await WebAssembly.instantiate(Go), Bo = true;
2127
+ } catch {
2128
+ Bo = false;
2129
+ }
2130
+ return Bo;
2131
+ }
2132
+ async function Vo(t2, e2 = "") {
2133
+ const n2 = await jo() ? "wasm_internal" : "wasm_nosimd_internal";
2134
+ return { wasmLoaderPath: `${e2}/${t2}_${n2}.js`, wasmBinaryPath: `${e2}/${t2}_${n2}.wasm` };
2135
+ }
2136
+ var Xo = class {
2137
+ };
2138
+ function Ho() {
2139
+ var t2 = navigator;
2140
+ return "undefined" != typeof OffscreenCanvas && (!(function(t3 = navigator) {
2141
+ return (t3 = t3.userAgent).includes("Safari") && !t3.includes("Chrome");
2142
+ })(t2) || !!((t2 = t2.userAgent.match(/Version\/([\d]+).*Safari/)) && 1 <= t2.length && 17 <= Number(t2[1])));
2143
+ }
2144
+ async function Wo(t2) {
2145
+ if ("function" != typeof importScripts) {
2146
+ const e2 = document.createElement("script");
2147
+ return e2.src = t2.toString(), e2.crossOrigin = "anonymous", new Promise(((t3, n2) => {
2148
+ e2.addEventListener("load", (() => {
2149
+ t3();
2150
+ }), false), e2.addEventListener("error", ((t4) => {
2151
+ n2(t4);
2152
+ }), false), document.body.appendChild(e2);
2153
+ }));
2154
+ }
2155
+ importScripts(t2.toString());
2156
+ }
2157
+ function zo(t2) {
2158
+ return void 0 !== t2.videoWidth ? [t2.videoWidth, t2.videoHeight] : void 0 !== t2.naturalWidth ? [t2.naturalWidth, t2.naturalHeight] : void 0 !== t2.displayWidth ? [t2.displayWidth, t2.displayHeight] : [t2.width, t2.height];
2159
+ }
2160
+ function Ko(t2, e2, n2) {
2161
+ t2.m || console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"), n2(e2 = t2.i.stringToNewUTF8(e2)), t2.i._free(e2);
2162
+ }
2163
+ function Yo(t2, e2, n2) {
2164
+ if (!t2.i.canvas) throw Error("No OpenGL canvas configured.");
2165
+ if (n2 ? t2.i._bindTextureToStream(n2) : t2.i._bindTextureToCanvas(), !(n2 = t2.i.canvas.getContext("webgl2") || t2.i.canvas.getContext("webgl"))) throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");
2166
+ t2.i.gpuOriginForWebTexturesIsBottomLeft && n2.pixelStorei(n2.UNPACK_FLIP_Y_WEBGL, true), n2.texImage2D(n2.TEXTURE_2D, 0, n2.RGBA, n2.RGBA, n2.UNSIGNED_BYTE, e2), t2.i.gpuOriginForWebTexturesIsBottomLeft && n2.pixelStorei(n2.UNPACK_FLIP_Y_WEBGL, false);
2167
+ const [r2, i2] = zo(e2);
2168
+ return !t2.l || r2 === t2.i.canvas.width && i2 === t2.i.canvas.height || (t2.i.canvas.width = r2, t2.i.canvas.height = i2), [r2, i2];
2169
+ }
2170
+ function $o(t2, e2, n2) {
2171
+ t2.m || console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");
2172
+ const r2 = new Uint32Array(e2.length);
2173
+ for (let n3 = 0; n3 < e2.length; n3++) r2[n3] = t2.i.stringToNewUTF8(e2[n3]);
2174
+ e2 = t2.i._malloc(4 * r2.length), t2.i.HEAPU32.set(r2, e2 >> 2), n2(e2);
2175
+ for (const e3 of r2) t2.i._free(e3);
2176
+ t2.i._free(e2);
2177
+ }
2178
+ function qo(t2, e2, n2) {
2179
+ t2.i.simpleListeners = t2.i.simpleListeners || {}, t2.i.simpleListeners[e2] = n2;
2180
+ }
2181
+ function Jo(t2, e2, n2) {
2182
+ let r2 = [];
2183
+ t2.i.simpleListeners = t2.i.simpleListeners || {}, t2.i.simpleListeners[e2] = (t3, e3, i2) => {
2184
+ e3 ? (n2(r2, i2), r2 = []) : r2.push(t3);
2185
+ };
2186
+ }
2187
+ Xo.forVisionTasks = function(t2) {
2188
+ return Vo("vision", t2);
2189
+ }, Xo.forTextTasks = function(t2) {
2190
+ return Vo("text", t2);
2191
+ }, Xo.forGenAiExperimentalTasks = function(t2) {
2192
+ return Vo("genai_experimental", t2);
2193
+ }, Xo.forGenAiTasks = function(t2) {
2194
+ return Vo("genai", t2);
2195
+ }, Xo.forAudioTasks = function(t2) {
2196
+ return Vo("audio", t2);
2197
+ }, Xo.isSimdSupported = function() {
2198
+ return jo();
2199
+ };
2200
+ async function Zo(t2, e2, n2, r2) {
2201
+ return t2 = await (async (t3, e3, n3, r3, i2) => {
2202
+ if (e3 && await Wo(e3), !self.ModuleFactory) throw Error("ModuleFactory not set.");
2203
+ if (n3 && (await Wo(n3), !self.ModuleFactory)) throw Error("ModuleFactory not set.");
2204
+ return self.Module && i2 && ((e3 = self.Module).locateFile = i2.locateFile, i2.mainScriptUrlOrBlob && (e3.mainScriptUrlOrBlob = i2.mainScriptUrlOrBlob)), i2 = await self.ModuleFactory(self.Module || i2), self.ModuleFactory = self.Module = void 0, new t3(i2, r3);
2205
+ })(t2, n2.wasmLoaderPath, n2.assetLoaderPath, e2, { locateFile: (t3) => t3.endsWith(".wasm") ? n2.wasmBinaryPath.toString() : n2.assetBinaryPath && t3.endsWith(".data") ? n2.assetBinaryPath.toString() : t3 }), await t2.o(r2), t2;
2206
+ }
2207
+ function Qo(t2, e2) {
2208
+ const n2 = Rn(t2.baseOptions, Ms, 1) || new Ms();
2209
+ "string" == typeof e2 ? (dn(n2, 2, Me(e2)), dn(n2, 1)) : e2 instanceof Uint8Array && (dn(n2, 1, ae(e2, false, false)), dn(n2, 2)), Cn(t2.baseOptions, 0, 1, n2);
2210
+ }
2211
+ function ta(t2) {
2212
+ try {
2213
+ const e2 = t2.K.length;
2214
+ if (1 === e2) throw Error(t2.K[0].message);
2215
+ if (1 < e2) throw Error("Encountered multiple errors: " + t2.K.map(((t3) => t3.message)).join(", "));
2216
+ } finally {
2217
+ t2.K = [];
2218
+ }
2219
+ }
2220
+ function ea(t2, e2) {
2221
+ t2.J = Math.max(t2.J, e2);
2222
+ }
2223
+ function na(t2, e2) {
2224
+ t2.C = new Li(), ki(t2.C, "PassThroughCalculator"), xi(t2.C, "free_memory"), Si(t2.C, "free_memory_unused_out"), Ii(e2, "free_memory"), Oi(e2, t2.C);
2225
+ }
2226
+ function ra(t2, e2) {
2227
+ xi(t2.C, e2), Si(t2.C, e2 + "_unused_out");
2228
+ }
2229
+ function ia(t2) {
2230
+ t2.g.addBoolToStream(true, "free_memory", t2.J);
2231
+ }
2232
+ var sa = class {
2233
+ constructor(t2) {
2234
+ this.g = t2, this.K = [], this.J = 0, this.g.setAutoRenderToScreen(false);
2235
+ }
2236
+ l(t2, e2 = true) {
2237
+ if (e2) {
2238
+ const e3 = t2.baseOptions || {};
2239
+ if (t2.baseOptions?.modelAssetBuffer && t2.baseOptions?.modelAssetPath) throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");
2240
+ if (!(Rn(this.baseOptions, Ms, 1)?.g() || Rn(this.baseOptions, Ms, 1)?.h() || t2.baseOptions?.modelAssetBuffer || t2.baseOptions?.modelAssetPath)) throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");
2241
+ if ((function(t3, e4) {
2242
+ let n2 = Rn(t3.baseOptions, Fs, 3);
2243
+ if (!n2) {
2244
+ var r2 = n2 = new Fs(), i2 = new pi();
2245
+ On(r2, 4, Rs, i2);
2246
+ }
2247
+ "delegate" in e4 && ("GPU" === e4.delegate ? (e4 = n2, r2 = new li(), On(e4, 2, Rs, r2)) : (e4 = n2, r2 = new pi(), On(e4, 4, Rs, r2))), Cn(t3.baseOptions, 0, 3, n2);
2248
+ })(this, e3), e3.modelAssetPath) return fetch(e3.modelAssetPath.toString()).then(((t3) => {
2249
+ if (t3.ok) return t3.arrayBuffer();
2250
+ throw Error(`Failed to fetch model: ${e3.modelAssetPath} (${t3.status})`);
2251
+ })).then(((t3) => {
2252
+ try {
2253
+ this.g.i.FS_unlink("/model.dat");
2254
+ } catch {
2255
+ }
2256
+ this.g.i.FS_createDataFile("/", "model.dat", new Uint8Array(t3), true, false, false), Qo(this, "/model.dat"), this.m(), this.L();
2257
+ }));
2258
+ if (e3.modelAssetBuffer instanceof Uint8Array) Qo(this, e3.modelAssetBuffer);
2259
+ else if (e3.modelAssetBuffer) return (async function(t3) {
2260
+ const e4 = [];
2261
+ for (var n2 = 0; ; ) {
2262
+ const { done: r2, value: i2 } = await t3.read();
2263
+ if (r2) break;
2264
+ e4.push(i2), n2 += i2.length;
2265
+ }
2266
+ if (0 === e4.length) return new Uint8Array(0);
2267
+ if (1 === e4.length) return e4[0];
2268
+ t3 = new Uint8Array(n2), n2 = 0;
2269
+ for (const r2 of e4) t3.set(r2, n2), n2 += r2.length;
2270
+ return t3;
2271
+ })(e3.modelAssetBuffer).then(((t3) => {
2272
+ Qo(this, t3), this.m(), this.L();
2273
+ }));
2274
+ }
2275
+ return this.m(), this.L(), Promise.resolve();
2276
+ }
2277
+ L() {
2278
+ }
2279
+ fa() {
2280
+ let t2;
2281
+ if (this.g.fa(((e2) => {
2282
+ t2 = Bi(e2);
2283
+ })), !t2) throw Error("Failed to retrieve CalculatorGraphConfig");
2284
+ return t2;
2285
+ }
2286
+ setGraph(t2, e2) {
2287
+ this.g.attachErrorListener(((t3, e3) => {
2288
+ this.K.push(Error(e3));
2289
+ })), this.g.Ma(), this.g.setGraph(t2, e2), this.C = void 0, ta(this);
2290
+ }
2291
+ finishProcessing() {
2292
+ this.g.finishProcessing(), ta(this);
2293
+ }
2294
+ close() {
2295
+ this.C = void 0, this.g.closeGraph();
2296
+ }
2297
+ };
2298
+ function oa(t2, e2) {
2299
+ if (!t2) throw Error(`Unable to obtain required WebGL resource: ${e2}`);
2300
+ return t2;
2301
+ }
2302
+ sa.prototype.close = sa.prototype.close, (function(e2, n2) {
2303
+ e2 = e2.split(".");
2304
+ var r2, i2 = t;
2305
+ e2[0] in i2 || void 0 === i2.execScript || i2.execScript("var " + e2[0]);
2306
+ for (; e2.length && (r2 = e2.shift()); ) e2.length || void 0 === n2 ? i2 = i2[r2] && i2[r2] !== Object.prototype[r2] ? i2[r2] : i2[r2] = {} : i2[r2] = n2;
2307
+ })("TaskRunner", sa);
2308
+ var aa = class {
2309
+ constructor(t2, e2, n2, r2) {
2310
+ this.g = t2, this.h = e2, this.m = n2, this.l = r2;
2311
+ }
2312
+ bind() {
2313
+ this.g.bindVertexArray(this.h);
2314
+ }
2315
+ close() {
2316
+ this.g.deleteVertexArray(this.h), this.g.deleteBuffer(this.m), this.g.deleteBuffer(this.l);
2317
+ }
2318
+ };
2319
+ function ha(t2, e2, n2) {
2320
+ const r2 = t2.g;
2321
+ if (n2 = oa(r2.createShader(n2), "Failed to create WebGL shader"), r2.shaderSource(n2, e2), r2.compileShader(n2), !r2.getShaderParameter(n2, r2.COMPILE_STATUS)) throw Error(`Could not compile WebGL shader: ${r2.getShaderInfoLog(n2)}`);
2322
+ return r2.attachShader(t2.h, n2), n2;
2323
+ }
2324
+ function ca(t2, e2) {
2325
+ const n2 = t2.g, r2 = oa(n2.createVertexArray(), "Failed to create vertex array");
2326
+ n2.bindVertexArray(r2);
2327
+ const i2 = oa(n2.createBuffer(), "Failed to create buffer");
2328
+ n2.bindBuffer(n2.ARRAY_BUFFER, i2), n2.enableVertexAttribArray(t2.K), n2.vertexAttribPointer(t2.K, 2, n2.FLOAT, false, 0, 0), n2.bufferData(n2.ARRAY_BUFFER, new Float32Array([-1, -1, -1, 1, 1, 1, 1, -1]), n2.STATIC_DRAW);
2329
+ const s2 = oa(n2.createBuffer(), "Failed to create buffer");
2330
+ return n2.bindBuffer(n2.ARRAY_BUFFER, s2), n2.enableVertexAttribArray(t2.J), n2.vertexAttribPointer(t2.J, 2, n2.FLOAT, false, 0, 0), n2.bufferData(n2.ARRAY_BUFFER, new Float32Array(e2 ? [0, 1, 0, 0, 1, 0, 1, 1] : [0, 0, 0, 1, 1, 1, 1, 0]), n2.STATIC_DRAW), n2.bindBuffer(n2.ARRAY_BUFFER, null), n2.bindVertexArray(null), new aa(n2, r2, i2, s2);
2331
+ }
2332
+ function ua(t2, e2) {
2333
+ if (t2.g) {
2334
+ if (e2 !== t2.g) throw Error("Cannot change GL context once initialized");
2335
+ } else t2.g = e2;
2336
+ }
2337
+ function la(t2, e2, n2, r2) {
2338
+ return ua(t2, e2), t2.h || (t2.m(), t2.D()), n2 ? (t2.v || (t2.v = ca(t2, true)), n2 = t2.v) : (t2.A || (t2.A = ca(t2, false)), n2 = t2.A), e2.useProgram(t2.h), n2.bind(), t2.l(), t2 = r2(), n2.g.bindVertexArray(null), t2;
2339
+ }
2340
+ function da(t2, e2, n2) {
2341
+ return ua(t2, e2), t2 = oa(e2.createTexture(), "Failed to create texture"), e2.bindTexture(e2.TEXTURE_2D, t2), e2.texParameteri(e2.TEXTURE_2D, e2.TEXTURE_WRAP_S, e2.CLAMP_TO_EDGE), e2.texParameteri(e2.TEXTURE_2D, e2.TEXTURE_WRAP_T, e2.CLAMP_TO_EDGE), e2.texParameteri(e2.TEXTURE_2D, e2.TEXTURE_MIN_FILTER, n2 ?? e2.LINEAR), e2.texParameteri(e2.TEXTURE_2D, e2.TEXTURE_MAG_FILTER, n2 ?? e2.LINEAR), e2.bindTexture(e2.TEXTURE_2D, null), t2;
2342
+ }
2343
+ function fa(t2, e2, n2) {
2344
+ ua(t2, e2), t2.u || (t2.u = oa(e2.createFramebuffer(), "Failed to create framebuffe.")), e2.bindFramebuffer(e2.FRAMEBUFFER, t2.u), e2.framebufferTexture2D(e2.FRAMEBUFFER, e2.COLOR_ATTACHMENT0, e2.TEXTURE_2D, n2, 0);
2345
+ }
2346
+ function pa(t2) {
2347
+ t2.g?.bindFramebuffer(t2.g.FRAMEBUFFER, null);
2348
+ }
2349
+ var ga = class {
2350
+ H() {
2351
+ return "\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D inputTexture;\n void main() {\n gl_FragColor = texture2D(inputTexture, vTex);\n }\n ";
2352
+ }
2353
+ m() {
2354
+ const t2 = this.g;
2355
+ if (this.h = oa(t2.createProgram(), "Failed to create WebGL program"), this.ba = ha(this, "\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }", t2.VERTEX_SHADER), this.aa = ha(this, this.H(), t2.FRAGMENT_SHADER), t2.linkProgram(this.h), !t2.getProgramParameter(this.h, t2.LINK_STATUS)) throw Error(`Error during program linking: ${t2.getProgramInfoLog(this.h)}`);
2356
+ this.K = t2.getAttribLocation(this.h, "aVertex"), this.J = t2.getAttribLocation(this.h, "aTex");
2357
+ }
2358
+ D() {
2359
+ }
2360
+ l() {
2361
+ }
2362
+ close() {
2363
+ if (this.h) {
2364
+ const t2 = this.g;
2365
+ t2.deleteProgram(this.h), t2.deleteShader(this.ba), t2.deleteShader(this.aa);
2366
+ }
2367
+ this.u && this.g.deleteFramebuffer(this.u), this.A && this.A.close(), this.v && this.v.close();
2368
+ }
2369
+ };
2370
+ var ma = class extends ga {
2371
+ H() {
2372
+ return "\n precision mediump float;\n uniform sampler2D backgroundTexture;\n uniform sampler2D maskTexture;\n uniform sampler2D colorMappingTexture;\n varying vec2 vTex;\n void main() {\n vec4 backgroundColor = texture2D(backgroundTexture, vTex);\n float category = texture2D(maskTexture, vTex).r;\n vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));\n gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);\n }\n ";
2373
+ }
2374
+ D() {
2375
+ const t2 = this.g;
2376
+ t2.activeTexture(t2.TEXTURE1), this.C = da(this, t2, t2.LINEAR), t2.activeTexture(t2.TEXTURE2), this.j = da(this, t2, t2.NEAREST);
2377
+ }
2378
+ m() {
2379
+ super.m();
2380
+ const t2 = this.g;
2381
+ this.M = oa(t2.getUniformLocation(this.h, "backgroundTexture"), "Uniform location"), this.V = oa(t2.getUniformLocation(this.h, "colorMappingTexture"), "Uniform location"), this.L = oa(t2.getUniformLocation(this.h, "maskTexture"), "Uniform location");
2382
+ }
2383
+ l() {
2384
+ super.l();
2385
+ const t2 = this.g;
2386
+ t2.uniform1i(this.L, 0), t2.uniform1i(this.M, 1), t2.uniform1i(this.V, 2);
2387
+ }
2388
+ close() {
2389
+ this.C && this.g.deleteTexture(this.C), this.j && this.g.deleteTexture(this.j), super.close();
2390
+ }
2391
+ };
2392
+ var ya = class extends ga {
2393
+ H() {
2394
+ return "\n precision mediump float;\n uniform sampler2D maskTexture;\n uniform sampler2D defaultTexture;\n uniform sampler2D overlayTexture;\n varying vec2 vTex;\n void main() {\n float confidence = texture2D(maskTexture, vTex).r;\n vec4 defaultColor = texture2D(defaultTexture, vTex);\n vec4 overlayColor = texture2D(overlayTexture, vTex);\n // Apply the alpha from the overlay and merge in the default color\n overlayColor = mix(defaultColor, overlayColor, overlayColor.a);\n gl_FragColor = mix(defaultColor, overlayColor, confidence);\n }\n ";
2395
+ }
2396
+ D() {
2397
+ const t2 = this.g;
2398
+ t2.activeTexture(t2.TEXTURE1), this.j = da(this, t2), t2.activeTexture(t2.TEXTURE2), this.C = da(this, t2);
2399
+ }
2400
+ m() {
2401
+ super.m();
2402
+ const t2 = this.g;
2403
+ this.L = oa(t2.getUniformLocation(this.h, "defaultTexture"), "Uniform location"), this.M = oa(t2.getUniformLocation(this.h, "overlayTexture"), "Uniform location"), this.I = oa(t2.getUniformLocation(this.h, "maskTexture"), "Uniform location");
2404
+ }
2405
+ l() {
2406
+ super.l();
2407
+ const t2 = this.g;
2408
+ t2.uniform1i(this.I, 0), t2.uniform1i(this.L, 1), t2.uniform1i(this.M, 2);
2409
+ }
2410
+ close() {
2411
+ this.j && this.g.deleteTexture(this.j), this.C && this.g.deleteTexture(this.C), super.close();
2412
+ }
2413
+ };
2414
+ function _a(t2, e2) {
2415
+ switch (e2) {
2416
+ case 0:
2417
+ return t2.g.find(((t3) => t3 instanceof Uint8Array));
2418
+ case 1:
2419
+ return t2.g.find(((t3) => t3 instanceof Float32Array));
2420
+ case 2:
2421
+ return t2.g.find(((t3) => "undefined" != typeof WebGLTexture && t3 instanceof WebGLTexture));
2422
+ default:
2423
+ throw Error(`Type is not supported: ${e2}`);
2424
+ }
2425
+ }
2426
+ function va(t2) {
2427
+ var e2 = _a(t2, 1);
2428
+ if (!e2) {
2429
+ if (e2 = _a(t2, 0)) e2 = new Float32Array(e2).map(((t3) => t3 / 255));
2430
+ else {
2431
+ e2 = new Float32Array(t2.width * t2.height);
2432
+ const r2 = wa(t2);
2433
+ var n2 = Aa(t2);
2434
+ if (fa(n2, r2, Ea(t2)), "iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in self.document) {
2435
+ n2 = new Float32Array(t2.width * t2.height * 4), r2.readPixels(0, 0, t2.width, t2.height, r2.RGBA, r2.FLOAT, n2);
2436
+ for (let t3 = 0, r3 = 0; t3 < e2.length; ++t3, r3 += 4) e2[t3] = n2[r3];
2437
+ } else r2.readPixels(0, 0, t2.width, t2.height, r2.RED, r2.FLOAT, e2);
2438
+ }
2439
+ t2.g.push(e2);
2440
+ }
2441
+ return e2;
2442
+ }
2443
+ function Ea(t2) {
2444
+ let e2 = _a(t2, 2);
2445
+ if (!e2) {
2446
+ const n2 = wa(t2);
2447
+ e2 = ba(t2);
2448
+ const r2 = va(t2), i2 = Ta(t2);
2449
+ n2.texImage2D(n2.TEXTURE_2D, 0, i2, t2.width, t2.height, 0, n2.RED, n2.FLOAT, r2), ka(t2);
2450
+ }
2451
+ return e2;
2452
+ }
2453
+ function wa(t2) {
2454
+ if (!t2.canvas) throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");
2455
+ return t2.h || (t2.h = oa(t2.canvas.getContext("webgl2"), "You cannot use a canvas that is already bound to a different type of rendering context.")), t2.h;
2456
+ }
2457
+ function Ta(t2) {
2458
+ if (t2 = wa(t2), !xa) if (t2.getExtension("EXT_color_buffer_float") && t2.getExtension("OES_texture_float_linear") && t2.getExtension("EXT_float_blend")) xa = t2.R32F;
2459
+ else {
2460
+ if (!t2.getExtension("EXT_color_buffer_half_float")) throw Error("GPU does not fully support 4-channel float32 or float16 formats");
2461
+ xa = t2.R16F;
2462
+ }
2463
+ return xa;
2464
+ }
2465
+ function Aa(t2) {
2466
+ return t2.l || (t2.l = new ga()), t2.l;
2467
+ }
2468
+ function ba(t2) {
2469
+ const e2 = wa(t2);
2470
+ e2.viewport(0, 0, t2.width, t2.height), e2.activeTexture(e2.TEXTURE0);
2471
+ let n2 = _a(t2, 2);
2472
+ return n2 || (n2 = da(Aa(t2), e2, t2.m ? e2.LINEAR : e2.NEAREST), t2.g.push(n2), t2.j = true), e2.bindTexture(e2.TEXTURE_2D, n2), n2;
2473
+ }
2474
+ function ka(t2) {
2475
+ t2.h.bindTexture(t2.h.TEXTURE_2D, null);
2476
+ }
2477
+ var xa;
2478
+ var Sa = class {
2479
+ constructor(t2, e2, n2, r2, i2, s2, o2) {
2480
+ this.g = t2, this.m = e2, this.j = n2, this.canvas = r2, this.l = i2, this.width = s2, this.height = o2, this.j && (0 === --La && console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources."));
2481
+ }
2482
+ Ha() {
2483
+ return !!_a(this, 0);
2484
+ }
2485
+ la() {
2486
+ return !!_a(this, 1);
2487
+ }
2488
+ R() {
2489
+ return !!_a(this, 2);
2490
+ }
2491
+ ka() {
2492
+ return (e2 = _a(t2 = this, 0)) || (e2 = va(t2), e2 = new Uint8Array(e2.map(((t3) => 255 * t3))), t2.g.push(e2)), e2;
2493
+ var t2, e2;
2494
+ }
2495
+ ja() {
2496
+ return va(this);
2497
+ }
2498
+ O() {
2499
+ return Ea(this);
2500
+ }
2501
+ clone() {
2502
+ const t2 = [];
2503
+ for (const e2 of this.g) {
2504
+ let n2;
2505
+ if (e2 instanceof Uint8Array) n2 = new Uint8Array(e2);
2506
+ else if (e2 instanceof Float32Array) n2 = new Float32Array(e2);
2507
+ else {
2508
+ if (!(e2 instanceof WebGLTexture)) throw Error(`Type is not supported: ${e2}`);
2509
+ {
2510
+ const t3 = wa(this), e3 = Aa(this);
2511
+ t3.activeTexture(t3.TEXTURE1), n2 = da(e3, t3, this.m ? t3.LINEAR : t3.NEAREST), t3.bindTexture(t3.TEXTURE_2D, n2);
2512
+ const r2 = Ta(this);
2513
+ t3.texImage2D(t3.TEXTURE_2D, 0, r2, this.width, this.height, 0, t3.RED, t3.FLOAT, null), t3.bindTexture(t3.TEXTURE_2D, null), fa(e3, t3, n2), la(e3, t3, false, (() => {
2514
+ ba(this), t3.clearColor(0, 0, 0, 0), t3.clear(t3.COLOR_BUFFER_BIT), t3.drawArrays(t3.TRIANGLE_FAN, 0, 4), ka(this);
2515
+ })), pa(e3), ka(this);
2516
+ }
2517
+ }
2518
+ t2.push(n2);
2519
+ }
2520
+ return new Sa(t2, this.m, this.R(), this.canvas, this.l, this.width, this.height);
2521
+ }
2522
+ close() {
2523
+ this.j && wa(this).deleteTexture(_a(this, 2)), La = -1;
2524
+ }
2525
+ };
2526
+ Sa.prototype.close = Sa.prototype.close, Sa.prototype.clone = Sa.prototype.clone, Sa.prototype.getAsWebGLTexture = Sa.prototype.O, Sa.prototype.getAsFloat32Array = Sa.prototype.ja, Sa.prototype.getAsUint8Array = Sa.prototype.ka, Sa.prototype.hasWebGLTexture = Sa.prototype.R, Sa.prototype.hasFloat32Array = Sa.prototype.la, Sa.prototype.hasUint8Array = Sa.prototype.Ha;
2527
+ var La = 250;
2528
+ var Fa = { color: "white", lineWidth: 4, radius: 6 };
2529
+ function Ra(t2) {
2530
+ return { ...Fa, fillColor: (t2 = t2 || {}).color, ...t2 };
2531
+ }
2532
+ function Ma(t2, e2) {
2533
+ return t2 instanceof Function ? t2(e2) : t2;
2534
+ }
2535
+ function Pa(t2, e2, n2) {
2536
+ return Math.max(Math.min(e2, n2), Math.min(Math.max(e2, n2), t2));
2537
+ }
2538
+ function Ca(t2) {
2539
+ if (!t2.l) throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");
2540
+ return t2.l;
2541
+ }
2542
+ function Oa(t2) {
2543
+ if (!t2.j) throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");
2544
+ return t2.j;
2545
+ }
2546
+ function Ia(t2, e2, n2) {
2547
+ if (e2.R()) n2(e2.O());
2548
+ else {
2549
+ const r2 = e2.la() ? e2.ja() : e2.ka();
2550
+ t2.m = t2.m ?? new ga();
2551
+ const i2 = Oa(t2);
2552
+ n2((t2 = new Sa([r2], e2.m, false, i2.canvas, t2.m, e2.width, e2.height)).O()), t2.close();
2553
+ }
2554
+ }
2555
+ function Ua(t2, e2, n2, r2) {
2556
+ const i2 = (function(t3) {
2557
+ return t3.g || (t3.g = new ma()), t3.g;
2558
+ })(t2), s2 = Oa(t2), o2 = Array.isArray(n2) ? new ImageData(new Uint8ClampedArray(n2), 1, 1) : n2;
2559
+ la(i2, s2, true, (() => {
2560
+ !(function(t4, e3, n3, r3) {
2561
+ const i3 = t4.g;
2562
+ if (i3.activeTexture(i3.TEXTURE0), i3.bindTexture(i3.TEXTURE_2D, e3), i3.activeTexture(i3.TEXTURE1), i3.bindTexture(i3.TEXTURE_2D, t4.C), i3.texImage2D(i3.TEXTURE_2D, 0, i3.RGBA, i3.RGBA, i3.UNSIGNED_BYTE, n3), t4.I && (function(t5, e4) {
2563
+ if (t5 !== e4) return false;
2564
+ t5 = t5.entries(), e4 = e4.entries();
2565
+ for (const [r4, i4] of t5) {
2566
+ t5 = r4;
2567
+ const s3 = i4;
2568
+ var n4 = e4.next();
2569
+ if (n4.done) return false;
2570
+ const [o3, a2] = n4.value;
2571
+ if (n4 = a2, t5 !== o3 || s3[0] !== n4[0] || s3[1] !== n4[1] || s3[2] !== n4[2] || s3[3] !== n4[3]) return false;
2572
+ }
2573
+ return !!e4.next().done;
2574
+ })(t4.I, r3)) i3.activeTexture(i3.TEXTURE2), i3.bindTexture(i3.TEXTURE_2D, t4.j);
2575
+ else {
2576
+ t4.I = r3;
2577
+ const e4 = Array(1024).fill(0);
2578
+ r3.forEach(((t5, n4) => {
2579
+ if (4 !== t5.length) throw Error(`Color at index ${n4} is not a four-channel value.`);
2580
+ e4[4 * n4] = t5[0], e4[4 * n4 + 1] = t5[1], e4[4 * n4 + 2] = t5[2], e4[4 * n4 + 3] = t5[3];
2581
+ })), i3.activeTexture(i3.TEXTURE2), i3.bindTexture(i3.TEXTURE_2D, t4.j), i3.texImage2D(i3.TEXTURE_2D, 0, i3.RGBA, 256, 1, 0, i3.RGBA, i3.UNSIGNED_BYTE, new Uint8Array(e4));
2582
+ }
2583
+ })(i2, e2, o2, r2), s2.clearColor(0, 0, 0, 0), s2.clear(s2.COLOR_BUFFER_BIT), s2.drawArrays(s2.TRIANGLE_FAN, 0, 4);
2584
+ const t3 = i2.g;
2585
+ t3.activeTexture(t3.TEXTURE0), t3.bindTexture(t3.TEXTURE_2D, null), t3.activeTexture(t3.TEXTURE1), t3.bindTexture(t3.TEXTURE_2D, null), t3.activeTexture(t3.TEXTURE2), t3.bindTexture(t3.TEXTURE_2D, null);
2586
+ }));
2587
+ }
2588
+ function Da(t2, e2, n2, r2) {
2589
+ const i2 = Oa(t2), s2 = (function(t3) {
2590
+ return t3.h || (t3.h = new ya()), t3.h;
2591
+ })(t2), o2 = Array.isArray(n2) ? new ImageData(new Uint8ClampedArray(n2), 1, 1) : n2, a2 = Array.isArray(r2) ? new ImageData(new Uint8ClampedArray(r2), 1, 1) : r2;
2592
+ la(s2, i2, true, (() => {
2593
+ var t3 = s2.g;
2594
+ t3.activeTexture(t3.TEXTURE0), t3.bindTexture(t3.TEXTURE_2D, e2), t3.activeTexture(t3.TEXTURE1), t3.bindTexture(t3.TEXTURE_2D, s2.j), t3.texImage2D(t3.TEXTURE_2D, 0, t3.RGBA, t3.RGBA, t3.UNSIGNED_BYTE, o2), t3.activeTexture(t3.TEXTURE2), t3.bindTexture(t3.TEXTURE_2D, s2.C), t3.texImage2D(t3.TEXTURE_2D, 0, t3.RGBA, t3.RGBA, t3.UNSIGNED_BYTE, a2), i2.clearColor(0, 0, 0, 0), i2.clear(i2.COLOR_BUFFER_BIT), i2.drawArrays(i2.TRIANGLE_FAN, 0, 4), i2.bindTexture(i2.TEXTURE_2D, null), (t3 = s2.g).activeTexture(t3.TEXTURE0), t3.bindTexture(t3.TEXTURE_2D, null), t3.activeTexture(t3.TEXTURE1), t3.bindTexture(t3.TEXTURE_2D, null), t3.activeTexture(t3.TEXTURE2), t3.bindTexture(t3.TEXTURE_2D, null);
2595
+ }));
2596
+ }
2597
+ var Na = class {
2598
+ constructor(t2, e2) {
2599
+ t2 instanceof CanvasRenderingContext2D || t2 instanceof OffscreenCanvasRenderingContext2D ? (this.l = t2, this.j = e2) : this.j = t2;
2600
+ }
2601
+ Aa(t2, e2) {
2602
+ if (t2) {
2603
+ var n2 = Ca(this);
2604
+ e2 = Ra(e2), n2.save();
2605
+ var r2 = n2.canvas, i2 = 0;
2606
+ for (const s2 of t2) n2.fillStyle = Ma(e2.fillColor, { index: i2, from: s2 }), n2.strokeStyle = Ma(e2.color, { index: i2, from: s2 }), n2.lineWidth = Ma(e2.lineWidth, { index: i2, from: s2 }), (t2 = new Path2D()).arc(s2.x * r2.width, s2.y * r2.height, Ma(e2.radius, { index: i2, from: s2 }), 0, 2 * Math.PI), n2.fill(t2), n2.stroke(t2), ++i2;
2607
+ n2.restore();
2608
+ }
2609
+ }
2610
+ za(t2, e2, n2) {
2611
+ if (t2 && e2) {
2612
+ var r2 = Ca(this);
2613
+ n2 = Ra(n2), r2.save();
2614
+ var i2 = r2.canvas, s2 = 0;
2615
+ for (const o2 of e2) {
2616
+ r2.beginPath(), e2 = t2[o2.start];
2617
+ const a2 = t2[o2.end];
2618
+ e2 && a2 && (r2.strokeStyle = Ma(n2.color, { index: s2, from: e2, to: a2 }), r2.lineWidth = Ma(n2.lineWidth, { index: s2, from: e2, to: a2 }), r2.moveTo(e2.x * i2.width, e2.y * i2.height), r2.lineTo(a2.x * i2.width, a2.y * i2.height)), ++s2, r2.stroke();
2619
+ }
2620
+ r2.restore();
2621
+ }
2622
+ }
2623
+ wa(t2, e2) {
2624
+ const n2 = Ca(this);
2625
+ e2 = Ra(e2), n2.save(), n2.beginPath(), n2.lineWidth = Ma(e2.lineWidth, {}), n2.strokeStyle = Ma(e2.color, {}), n2.fillStyle = Ma(e2.fillColor, {}), n2.moveTo(t2.originX, t2.originY), n2.lineTo(t2.originX + t2.width, t2.originY), n2.lineTo(t2.originX + t2.width, t2.originY + t2.height), n2.lineTo(t2.originX, t2.originY + t2.height), n2.lineTo(t2.originX, t2.originY), n2.stroke(), n2.fill(), n2.restore();
2626
+ }
2627
+ xa(t2, e2, n2 = [0, 0, 0, 255]) {
2628
+ this.l ? (function(t3, e3, n3, r2) {
2629
+ const i2 = Oa(t3);
2630
+ Ia(t3, e3, ((e4) => {
2631
+ Ua(t3, e4, n3, r2), (e4 = Ca(t3)).drawImage(i2.canvas, 0, 0, e4.canvas.width, e4.canvas.height);
2632
+ }));
2633
+ })(this, t2, n2, e2) : Ua(this, t2.O(), n2, e2);
2634
+ }
2635
+ ya(t2, e2, n2) {
2636
+ this.l ? (function(t3, e3, n3, r2) {
2637
+ const i2 = Oa(t3);
2638
+ Ia(t3, e3, ((e4) => {
2639
+ Da(t3, e4, n3, r2), (e4 = Ca(t3)).drawImage(i2.canvas, 0, 0, e4.canvas.width, e4.canvas.height);
2640
+ }));
2641
+ })(this, t2, e2, n2) : Da(this, t2.O(), e2, n2);
2642
+ }
2643
+ close() {
2644
+ this.g?.close(), this.g = void 0, this.h?.close(), this.h = void 0, this.m?.close(), this.m = void 0;
2645
+ }
2646
+ };
2647
+ function Ba(t2, e2) {
2648
+ switch (e2) {
2649
+ case 0:
2650
+ return t2.g.find(((t3) => t3 instanceof ImageData));
2651
+ case 1:
2652
+ return t2.g.find(((t3) => "undefined" != typeof ImageBitmap && t3 instanceof ImageBitmap));
2653
+ case 2:
2654
+ return t2.g.find(((t3) => "undefined" != typeof WebGLTexture && t3 instanceof WebGLTexture));
2655
+ default:
2656
+ throw Error(`Type is not supported: ${e2}`);
2657
+ }
2658
+ }
2659
+ function Ga(t2) {
2660
+ var e2 = Ba(t2, 0);
2661
+ if (!e2) {
2662
+ e2 = Va(t2);
2663
+ const n2 = Xa(t2), r2 = new Uint8Array(t2.width * t2.height * 4);
2664
+ fa(n2, e2, ja(t2)), e2.readPixels(0, 0, t2.width, t2.height, e2.RGBA, e2.UNSIGNED_BYTE, r2), pa(n2), e2 = new ImageData(new Uint8ClampedArray(r2.buffer), t2.width, t2.height), t2.g.push(e2);
2665
+ }
2666
+ return e2;
2667
+ }
2668
+ function ja(t2) {
2669
+ let e2 = Ba(t2, 2);
2670
+ if (!e2) {
2671
+ const n2 = Va(t2);
2672
+ e2 = Ha(t2);
2673
+ const r2 = Ba(t2, 1) || Ga(t2);
2674
+ n2.texImage2D(n2.TEXTURE_2D, 0, n2.RGBA, n2.RGBA, n2.UNSIGNED_BYTE, r2), Wa(t2);
2675
+ }
2676
+ return e2;
2677
+ }
2678
+ function Va(t2) {
2679
+ if (!t2.canvas) throw Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");
2680
+ return t2.h || (t2.h = oa(t2.canvas.getContext("webgl2"), "You cannot use a canvas that is already bound to a different type of rendering context.")), t2.h;
2681
+ }
2682
+ function Xa(t2) {
2683
+ return t2.l || (t2.l = new ga()), t2.l;
2684
+ }
2685
+ function Ha(t2) {
2686
+ const e2 = Va(t2);
2687
+ e2.viewport(0, 0, t2.width, t2.height), e2.activeTexture(e2.TEXTURE0);
2688
+ let n2 = Ba(t2, 2);
2689
+ return n2 || (n2 = da(Xa(t2), e2), t2.g.push(n2), t2.m = true), e2.bindTexture(e2.TEXTURE_2D, n2), n2;
2690
+ }
2691
+ function Wa(t2) {
2692
+ t2.h.bindTexture(t2.h.TEXTURE_2D, null);
2693
+ }
2694
+ function za(t2) {
2695
+ const e2 = Va(t2);
2696
+ return la(Xa(t2), e2, true, (() => (function(t3, e3) {
2697
+ const n2 = t3.canvas;
2698
+ if (n2.width === t3.width && n2.height === t3.height) return e3();
2699
+ const r2 = n2.width, i2 = n2.height;
2700
+ return n2.width = t3.width, n2.height = t3.height, t3 = e3(), n2.width = r2, n2.height = i2, t3;
2701
+ })(t2, (() => {
2702
+ if (e2.bindFramebuffer(e2.FRAMEBUFFER, null), e2.clearColor(0, 0, 0, 0), e2.clear(e2.COLOR_BUFFER_BIT), e2.drawArrays(e2.TRIANGLE_FAN, 0, 4), !(t2.canvas instanceof OffscreenCanvas)) throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");
2703
+ return t2.canvas.transferToImageBitmap();
2704
+ }))));
2705
+ }
2706
+ Na.prototype.close = Na.prototype.close, Na.prototype.drawConfidenceMask = Na.prototype.ya, Na.prototype.drawCategoryMask = Na.prototype.xa, Na.prototype.drawBoundingBox = Na.prototype.wa, Na.prototype.drawConnectors = Na.prototype.za, Na.prototype.drawLandmarks = Na.prototype.Aa, Na.lerp = function(t2, e2, n2, r2, i2) {
2707
+ return Pa(r2 * (1 - (t2 - e2) / (n2 - e2)) + i2 * (1 - (n2 - t2) / (n2 - e2)), r2, i2);
2708
+ }, Na.clamp = Pa;
2709
+ var Ka = class {
2710
+ constructor(t2, e2, n2, r2, i2, s2, o2) {
2711
+ this.g = t2, this.j = e2, this.m = n2, this.canvas = r2, this.l = i2, this.width = s2, this.height = o2, (this.j || this.m) && (0 === --Ya && console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources."));
2712
+ }
2713
+ Ga() {
2714
+ return !!Ba(this, 0);
2715
+ }
2716
+ ma() {
2717
+ return !!Ba(this, 1);
2718
+ }
2719
+ R() {
2720
+ return !!Ba(this, 2);
2721
+ }
2722
+ Ea() {
2723
+ return Ga(this);
2724
+ }
2725
+ Da() {
2726
+ var t2 = Ba(this, 1);
2727
+ return t2 || (ja(this), Ha(this), t2 = za(this), Wa(this), this.g.push(t2), this.j = true), t2;
2728
+ }
2729
+ O() {
2730
+ return ja(this);
2731
+ }
2732
+ clone() {
2733
+ const t2 = [];
2734
+ for (const e2 of this.g) {
2735
+ let n2;
2736
+ if (e2 instanceof ImageData) n2 = new ImageData(e2.data, this.width, this.height);
2737
+ else if (e2 instanceof WebGLTexture) {
2738
+ const t3 = Va(this), e3 = Xa(this);
2739
+ t3.activeTexture(t3.TEXTURE1), n2 = da(e3, t3), t3.bindTexture(t3.TEXTURE_2D, n2), t3.texImage2D(t3.TEXTURE_2D, 0, t3.RGBA, this.width, this.height, 0, t3.RGBA, t3.UNSIGNED_BYTE, null), t3.bindTexture(t3.TEXTURE_2D, null), fa(e3, t3, n2), la(e3, t3, false, (() => {
2740
+ Ha(this), t3.clearColor(0, 0, 0, 0), t3.clear(t3.COLOR_BUFFER_BIT), t3.drawArrays(t3.TRIANGLE_FAN, 0, 4), Wa(this);
2741
+ })), pa(e3), Wa(this);
2742
+ } else {
2743
+ if (!(e2 instanceof ImageBitmap)) throw Error(`Type is not supported: ${e2}`);
2744
+ ja(this), Ha(this), n2 = za(this), Wa(this);
2745
+ }
2746
+ t2.push(n2);
2747
+ }
2748
+ return new Ka(t2, this.ma(), this.R(), this.canvas, this.l, this.width, this.height);
2749
+ }
2750
+ close() {
2751
+ this.j && Ba(this, 1).close(), this.m && Va(this).deleteTexture(Ba(this, 2)), Ya = -1;
2752
+ }
2753
+ };
2754
+ Ka.prototype.close = Ka.prototype.close, Ka.prototype.clone = Ka.prototype.clone, Ka.prototype.getAsWebGLTexture = Ka.prototype.O, Ka.prototype.getAsImageBitmap = Ka.prototype.Da, Ka.prototype.getAsImageData = Ka.prototype.Ea, Ka.prototype.hasWebGLTexture = Ka.prototype.R, Ka.prototype.hasImageBitmap = Ka.prototype.ma, Ka.prototype.hasImageData = Ka.prototype.Ga;
2755
+ var Ya = 250;
2756
+ function $a(...t2) {
2757
+ return t2.map((([t3, e2]) => ({ start: t3, end: e2 })));
2758
+ }
2759
+ var qa = /* @__PURE__ */ (function(t2) {
2760
+ return class extends t2 {
2761
+ Ma() {
2762
+ this.i._registerModelResourcesGraphService();
2763
+ }
2764
+ };
2765
+ })((Ja = class {
2766
+ constructor(t2, e2) {
2767
+ this.l = true, this.i = t2, this.g = null, this.h = 0, this.m = "function" == typeof this.i._addIntToInputStream, void 0 !== e2 ? this.i.canvas = e2 : Ho() ? 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"));
2768
+ }
2769
+ async initializeGraph(t2) {
2770
+ const e2 = await (await fetch(t2)).arrayBuffer();
2771
+ t2 = !(t2.endsWith(".pbtxt") || t2.endsWith(".textproto")), this.setGraph(new Uint8Array(e2), t2);
2772
+ }
2773
+ setGraphFromString(t2) {
2774
+ this.setGraph(new TextEncoder().encode(t2), false);
2775
+ }
2776
+ setGraph(t2, e2) {
2777
+ const n2 = t2.length, r2 = this.i._malloc(n2);
2778
+ this.i.HEAPU8.set(t2, r2), e2 ? this.i._changeBinaryGraph(n2, r2) : this.i._changeTextGraph(n2, r2), this.i._free(r2);
2779
+ }
2780
+ configureAudio(t2, e2, n2, r2, i2) {
2781
+ this.i._configureAudio || console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'), Ko(this, r2 || "input_audio", ((r3) => {
2782
+ Ko(this, i2 = i2 || "audio_header", ((i3) => {
2783
+ this.i._configureAudio(r3, i3, t2, e2, n2);
2784
+ }));
2785
+ }));
2786
+ }
2787
+ setAutoResizeCanvas(t2) {
2788
+ this.l = t2;
2789
+ }
2790
+ setAutoRenderToScreen(t2) {
2791
+ this.i._setAutoRenderToScreen(t2);
2792
+ }
2793
+ setGpuBufferVerticalFlip(t2) {
2794
+ this.i.gpuOriginForWebTexturesIsBottomLeft = t2;
2795
+ }
2796
+ fa(t2) {
2797
+ qo(this, "__graph_config__", ((e2) => {
2798
+ t2(e2);
2799
+ })), Ko(this, "__graph_config__", ((t3) => {
2800
+ this.i._getGraphConfig(t3, void 0);
2801
+ })), delete this.i.simpleListeners.__graph_config__;
2802
+ }
2803
+ attachErrorListener(t2) {
2804
+ this.i.errorListener = t2;
2805
+ }
2806
+ attachEmptyPacketListener(t2, e2) {
2807
+ this.i.emptyPacketListeners = this.i.emptyPacketListeners || {}, this.i.emptyPacketListeners[t2] = e2;
2808
+ }
2809
+ addAudioToStream(t2, e2, n2) {
2810
+ this.addAudioToStreamWithShape(t2, 0, 0, e2, n2);
2811
+ }
2812
+ addAudioToStreamWithShape(t2, e2, n2, r2, i2) {
2813
+ const s2 = 4 * t2.length;
2814
+ this.h !== s2 && (this.g && this.i._free(this.g), this.g = this.i._malloc(s2), this.h = s2), this.i.HEAPF32.set(t2, this.g / 4), Ko(this, r2, ((t3) => {
2815
+ this.i._addAudioToInputStream(this.g, e2, n2, t3, i2);
2816
+ }));
2817
+ }
2818
+ addGpuBufferToStream(t2, e2, n2) {
2819
+ Ko(this, e2, ((e3) => {
2820
+ const [r2, i2] = Yo(this, t2, e3);
2821
+ this.i._addBoundTextureToStream(e3, r2, i2, n2);
2822
+ }));
2823
+ }
2824
+ addBoolToStream(t2, e2, n2) {
2825
+ Ko(this, e2, ((e3) => {
2826
+ this.i._addBoolToInputStream(t2, e3, n2);
2827
+ }));
2828
+ }
2829
+ addDoubleToStream(t2, e2, n2) {
2830
+ Ko(this, e2, ((e3) => {
2831
+ this.i._addDoubleToInputStream(t2, e3, n2);
2832
+ }));
2833
+ }
2834
+ addFloatToStream(t2, e2, n2) {
2835
+ Ko(this, e2, ((e3) => {
2836
+ this.i._addFloatToInputStream(t2, e3, n2);
2837
+ }));
2838
+ }
2839
+ addIntToStream(t2, e2, n2) {
2840
+ Ko(this, e2, ((e3) => {
2841
+ this.i._addIntToInputStream(t2, e3, n2);
2842
+ }));
2843
+ }
2844
+ addUintToStream(t2, e2, n2) {
2845
+ Ko(this, e2, ((e3) => {
2846
+ this.i._addUintToInputStream(t2, e3, n2);
2847
+ }));
2848
+ }
2849
+ addStringToStream(t2, e2, n2) {
2850
+ Ko(this, e2, ((e3) => {
2851
+ Ko(this, t2, ((t3) => {
2852
+ this.i._addStringToInputStream(t3, e3, n2);
2853
+ }));
2854
+ }));
2855
+ }
2856
+ addStringRecordToStream(t2, e2, n2) {
2857
+ Ko(this, e2, ((e3) => {
2858
+ $o(this, Object.keys(t2), ((r2) => {
2859
+ $o(this, Object.values(t2), ((i2) => {
2860
+ this.i._addFlatHashMapToInputStream(r2, i2, Object.keys(t2).length, e3, n2);
2861
+ }));
2862
+ }));
2863
+ }));
2864
+ }
2865
+ addProtoToStream(t2, e2, n2, r2) {
2866
+ Ko(this, n2, ((n3) => {
2867
+ Ko(this, e2, ((e3) => {
2868
+ const i2 = this.i._malloc(t2.length);
2869
+ this.i.HEAPU8.set(t2, i2), this.i._addProtoToInputStream(i2, t2.length, e3, n3, r2), this.i._free(i2);
2870
+ }));
2871
+ }));
2872
+ }
2873
+ addEmptyPacketToStream(t2, e2) {
2874
+ Ko(this, t2, ((t3) => {
2875
+ this.i._addEmptyPacketToInputStream(t3, e2);
2876
+ }));
2877
+ }
2878
+ addBoolVectorToStream(t2, e2, n2) {
2879
+ Ko(this, e2, ((e3) => {
2880
+ const r2 = this.i._allocateBoolVector(t2.length);
2881
+ if (!r2) throw Error("Unable to allocate new bool vector on heap.");
2882
+ for (const e4 of t2) this.i._addBoolVectorEntry(r2, e4);
2883
+ this.i._addBoolVectorToInputStream(r2, e3, n2);
2884
+ }));
2885
+ }
2886
+ addDoubleVectorToStream(t2, e2, n2) {
2887
+ Ko(this, e2, ((e3) => {
2888
+ const r2 = this.i._allocateDoubleVector(t2.length);
2889
+ if (!r2) throw Error("Unable to allocate new double vector on heap.");
2890
+ for (const e4 of t2) this.i._addDoubleVectorEntry(r2, e4);
2891
+ this.i._addDoubleVectorToInputStream(r2, e3, n2);
2892
+ }));
2893
+ }
2894
+ addFloatVectorToStream(t2, e2, n2) {
2895
+ Ko(this, e2, ((e3) => {
2896
+ const r2 = this.i._allocateFloatVector(t2.length);
2897
+ if (!r2) throw Error("Unable to allocate new float vector on heap.");
2898
+ for (const e4 of t2) this.i._addFloatVectorEntry(r2, e4);
2899
+ this.i._addFloatVectorToInputStream(r2, e3, n2);
2900
+ }));
2901
+ }
2902
+ addIntVectorToStream(t2, e2, n2) {
2903
+ Ko(this, e2, ((e3) => {
2904
+ const r2 = this.i._allocateIntVector(t2.length);
2905
+ if (!r2) throw Error("Unable to allocate new int vector on heap.");
2906
+ for (const e4 of t2) this.i._addIntVectorEntry(r2, e4);
2907
+ this.i._addIntVectorToInputStream(r2, e3, n2);
2908
+ }));
2909
+ }
2910
+ addUintVectorToStream(t2, e2, n2) {
2911
+ Ko(this, e2, ((e3) => {
2912
+ const r2 = this.i._allocateUintVector(t2.length);
2913
+ if (!r2) throw Error("Unable to allocate new unsigned int vector on heap.");
2914
+ for (const e4 of t2) this.i._addUintVectorEntry(r2, e4);
2915
+ this.i._addUintVectorToInputStream(r2, e3, n2);
2916
+ }));
2917
+ }
2918
+ addStringVectorToStream(t2, e2, n2) {
2919
+ Ko(this, e2, ((e3) => {
2920
+ const r2 = this.i._allocateStringVector(t2.length);
2921
+ if (!r2) throw Error("Unable to allocate new string vector on heap.");
2922
+ for (const e4 of t2) Ko(this, e4, ((t3) => {
2923
+ this.i._addStringVectorEntry(r2, t3);
2924
+ }));
2925
+ this.i._addStringVectorToInputStream(r2, e3, n2);
2926
+ }));
2927
+ }
2928
+ addBoolToInputSidePacket(t2, e2) {
2929
+ Ko(this, e2, ((e3) => {
2930
+ this.i._addBoolToInputSidePacket(t2, e3);
2931
+ }));
2932
+ }
2933
+ addDoubleToInputSidePacket(t2, e2) {
2934
+ Ko(this, e2, ((e3) => {
2935
+ this.i._addDoubleToInputSidePacket(t2, e3);
2936
+ }));
2937
+ }
2938
+ addFloatToInputSidePacket(t2, e2) {
2939
+ Ko(this, e2, ((e3) => {
2940
+ this.i._addFloatToInputSidePacket(t2, e3);
2941
+ }));
2942
+ }
2943
+ addIntToInputSidePacket(t2, e2) {
2944
+ Ko(this, e2, ((e3) => {
2945
+ this.i._addIntToInputSidePacket(t2, e3);
2946
+ }));
2947
+ }
2948
+ addUintToInputSidePacket(t2, e2) {
2949
+ Ko(this, e2, ((e3) => {
2950
+ this.i._addUintToInputSidePacket(t2, e3);
2951
+ }));
2952
+ }
2953
+ addStringToInputSidePacket(t2, e2) {
2954
+ Ko(this, e2, ((e3) => {
2955
+ Ko(this, t2, ((t3) => {
2956
+ this.i._addStringToInputSidePacket(t3, e3);
2957
+ }));
2958
+ }));
2959
+ }
2960
+ addProtoToInputSidePacket(t2, e2, n2) {
2961
+ Ko(this, n2, ((n3) => {
2962
+ Ko(this, e2, ((e3) => {
2963
+ const r2 = this.i._malloc(t2.length);
2964
+ this.i.HEAPU8.set(t2, r2), this.i._addProtoToInputSidePacket(r2, t2.length, e3, n3), this.i._free(r2);
2965
+ }));
2966
+ }));
2967
+ }
2968
+ addBoolVectorToInputSidePacket(t2, e2) {
2969
+ Ko(this, e2, ((e3) => {
2970
+ const n2 = this.i._allocateBoolVector(t2.length);
2971
+ if (!n2) throw Error("Unable to allocate new bool vector on heap.");
2972
+ for (const e4 of t2) this.i._addBoolVectorEntry(n2, e4);
2973
+ this.i._addBoolVectorToInputSidePacket(n2, e3);
2974
+ }));
2975
+ }
2976
+ addDoubleVectorToInputSidePacket(t2, e2) {
2977
+ Ko(this, e2, ((e3) => {
2978
+ const n2 = this.i._allocateDoubleVector(t2.length);
2979
+ if (!n2) throw Error("Unable to allocate new double vector on heap.");
2980
+ for (const e4 of t2) this.i._addDoubleVectorEntry(n2, e4);
2981
+ this.i._addDoubleVectorToInputSidePacket(n2, e3);
2982
+ }));
2983
+ }
2984
+ addFloatVectorToInputSidePacket(t2, e2) {
2985
+ Ko(this, e2, ((e3) => {
2986
+ const n2 = this.i._allocateFloatVector(t2.length);
2987
+ if (!n2) throw Error("Unable to allocate new float vector on heap.");
2988
+ for (const e4 of t2) this.i._addFloatVectorEntry(n2, e4);
2989
+ this.i._addFloatVectorToInputSidePacket(n2, e3);
2990
+ }));
2991
+ }
2992
+ addIntVectorToInputSidePacket(t2, e2) {
2993
+ Ko(this, e2, ((e3) => {
2994
+ const n2 = this.i._allocateIntVector(t2.length);
2995
+ if (!n2) throw Error("Unable to allocate new int vector on heap.");
2996
+ for (const e4 of t2) this.i._addIntVectorEntry(n2, e4);
2997
+ this.i._addIntVectorToInputSidePacket(n2, e3);
2998
+ }));
2999
+ }
3000
+ addUintVectorToInputSidePacket(t2, e2) {
3001
+ Ko(this, e2, ((e3) => {
3002
+ const n2 = this.i._allocateUintVector(t2.length);
3003
+ if (!n2) throw Error("Unable to allocate new unsigned int vector on heap.");
3004
+ for (const e4 of t2) this.i._addUintVectorEntry(n2, e4);
3005
+ this.i._addUintVectorToInputSidePacket(n2, e3);
3006
+ }));
3007
+ }
3008
+ addStringVectorToInputSidePacket(t2, e2) {
3009
+ Ko(this, e2, ((e3) => {
3010
+ const n2 = this.i._allocateStringVector(t2.length);
3011
+ if (!n2) throw Error("Unable to allocate new string vector on heap.");
3012
+ for (const e4 of t2) Ko(this, e4, ((t3) => {
3013
+ this.i._addStringVectorEntry(n2, t3);
3014
+ }));
3015
+ this.i._addStringVectorToInputSidePacket(n2, e3);
3016
+ }));
3017
+ }
3018
+ attachBoolListener(t2, e2) {
3019
+ qo(this, t2, e2), Ko(this, t2, ((t3) => {
3020
+ this.i._attachBoolListener(t3);
3021
+ }));
3022
+ }
3023
+ attachBoolVectorListener(t2, e2) {
3024
+ Jo(this, t2, e2), Ko(this, t2, ((t3) => {
3025
+ this.i._attachBoolVectorListener(t3);
3026
+ }));
3027
+ }
3028
+ attachIntListener(t2, e2) {
3029
+ qo(this, t2, e2), Ko(this, t2, ((t3) => {
3030
+ this.i._attachIntListener(t3);
3031
+ }));
3032
+ }
3033
+ attachIntVectorListener(t2, e2) {
3034
+ Jo(this, t2, e2), Ko(this, t2, ((t3) => {
3035
+ this.i._attachIntVectorListener(t3);
3036
+ }));
3037
+ }
3038
+ attachUintListener(t2, e2) {
3039
+ qo(this, t2, e2), Ko(this, t2, ((t3) => {
3040
+ this.i._attachUintListener(t3);
3041
+ }));
3042
+ }
3043
+ attachUintVectorListener(t2, e2) {
3044
+ Jo(this, t2, e2), Ko(this, t2, ((t3) => {
3045
+ this.i._attachUintVectorListener(t3);
3046
+ }));
3047
+ }
3048
+ attachDoubleListener(t2, e2) {
3049
+ qo(this, t2, e2), Ko(this, t2, ((t3) => {
3050
+ this.i._attachDoubleListener(t3);
3051
+ }));
3052
+ }
3053
+ attachDoubleVectorListener(t2, e2) {
3054
+ Jo(this, t2, e2), Ko(this, t2, ((t3) => {
3055
+ this.i._attachDoubleVectorListener(t3);
3056
+ }));
3057
+ }
3058
+ attachFloatListener(t2, e2) {
3059
+ qo(this, t2, e2), Ko(this, t2, ((t3) => {
3060
+ this.i._attachFloatListener(t3);
3061
+ }));
3062
+ }
3063
+ attachFloatVectorListener(t2, e2) {
3064
+ Jo(this, t2, e2), Ko(this, t2, ((t3) => {
3065
+ this.i._attachFloatVectorListener(t3);
3066
+ }));
3067
+ }
3068
+ attachStringListener(t2, e2) {
3069
+ qo(this, t2, e2), Ko(this, t2, ((t3) => {
3070
+ this.i._attachStringListener(t3);
3071
+ }));
3072
+ }
3073
+ attachStringVectorListener(t2, e2) {
3074
+ Jo(this, t2, e2), Ko(this, t2, ((t3) => {
3075
+ this.i._attachStringVectorListener(t3);
3076
+ }));
3077
+ }
3078
+ attachProtoListener(t2, e2, n2) {
3079
+ qo(this, t2, e2), Ko(this, t2, ((t3) => {
3080
+ this.i._attachProtoListener(t3, n2 || false);
3081
+ }));
3082
+ }
3083
+ attachProtoVectorListener(t2, e2, n2) {
3084
+ Jo(this, t2, e2), Ko(this, t2, ((t3) => {
3085
+ this.i._attachProtoVectorListener(t3, n2 || false);
3086
+ }));
3087
+ }
3088
+ attachAudioListener(t2, e2, n2) {
3089
+ this.i._attachAudioListener || console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'), qo(this, t2, ((t3, n3) => {
3090
+ t3 = new Float32Array(t3.buffer, t3.byteOffset, t3.length / 4), e2(t3, n3);
3091
+ })), Ko(this, t2, ((t3) => {
3092
+ this.i._attachAudioListener(t3, n2 || false);
3093
+ }));
3094
+ }
3095
+ finishProcessing() {
3096
+ this.i._waitUntilIdle();
3097
+ }
3098
+ closeGraph() {
3099
+ this.i._closeGraph(), this.i.simpleListeners = void 0, this.i.emptyPacketListeners = void 0;
3100
+ }
3101
+ }, class extends Ja {
3102
+ get ha() {
3103
+ return this.i;
3104
+ }
3105
+ sa(t2, e2, n2) {
3106
+ Ko(this, e2, ((e3) => {
3107
+ const [r2, i2] = Yo(this, t2, e3);
3108
+ this.ha._addBoundTextureAsImageToStream(e3, r2, i2, n2);
3109
+ }));
3110
+ }
3111
+ W(t2, e2) {
3112
+ qo(this, t2, e2), Ko(this, t2, ((t3) => {
3113
+ this.ha._attachImageListener(t3);
3114
+ }));
3115
+ }
3116
+ da(t2, e2) {
3117
+ Jo(this, t2, e2), Ko(this, t2, ((t3) => {
3118
+ this.ha._attachImageVectorListener(t3);
3119
+ }));
3120
+ }
3121
+ }));
3122
+ var Ja;
3123
+ var Za = class extends qa {
3124
+ };
3125
+ async function Qa(t2, e2, n2) {
3126
+ return (async function(t3, e3, n3, r2) {
3127
+ return Zo(t3, e3, n3, r2);
3128
+ })(t2, n2.canvas ?? (Ho() ? void 0 : document.createElement("canvas")), e2, n2);
3129
+ }
3130
+ function th(t2, e2, n2, r2) {
3131
+ if (t2.V) {
3132
+ const s2 = new fs();
3133
+ if (n2?.regionOfInterest) {
3134
+ if (!t2.ra) throw Error("This task doesn't support region-of-interest.");
3135
+ var i2 = n2.regionOfInterest;
3136
+ if (i2.left >= i2.right || i2.top >= i2.bottom) throw Error("Expected RectF with left < right and top < bottom.");
3137
+ if (0 > i2.left || 0 > i2.top || 1 < i2.right || 1 < i2.bottom) throw Error("Expected RectF values to be in [0,1].");
3138
+ Hn(s2, 1, (i2.left + i2.right) / 2), Hn(s2, 2, (i2.top + i2.bottom) / 2), Hn(s2, 4, i2.right - i2.left), Hn(s2, 3, i2.bottom - i2.top);
3139
+ } else Hn(s2, 1, 0.5), Hn(s2, 2, 0.5), Hn(s2, 4, 1), Hn(s2, 3, 1);
3140
+ if (n2?.rotationDegrees) {
3141
+ if (0 != n2?.rotationDegrees % 90) throw Error("Expected rotation to be a multiple of 90\xB0.");
3142
+ if (Hn(s2, 5, -Math.PI * n2.rotationDegrees / 180), 0 != n2?.rotationDegrees % 180) {
3143
+ const [t3, r3] = zo(e2);
3144
+ n2 = Gn(s2, 3) * r3 / t3, i2 = Gn(s2, 4) * t3 / r3, Hn(s2, 4, n2), Hn(s2, 3, i2);
3145
+ }
3146
+ }
3147
+ t2.g.addProtoToStream(s2.g(), "mediapipe.NormalizedRect", t2.V, r2);
3148
+ }
3149
+ t2.g.sa(e2, t2.ba, r2 ?? performance.now()), t2.finishProcessing();
3150
+ }
3151
+ function eh(t2, e2, n2) {
3152
+ if (t2.baseOptions?.g()) throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");
3153
+ th(t2, e2, n2, t2.J + 1);
3154
+ }
3155
+ function nh(t2, e2, n2, r2) {
3156
+ if (!t2.baseOptions?.g()) throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");
3157
+ th(t2, e2, n2, r2);
3158
+ }
3159
+ function rh(t2, e2, n2, r2) {
3160
+ var i2 = e2.data;
3161
+ const s2 = e2.width, o2 = s2 * (e2 = e2.height);
3162
+ if ((i2 instanceof Uint8Array || i2 instanceof Float32Array) && i2.length !== o2) throw Error("Unsupported channel count: " + i2.length / o2);
3163
+ return t2 = new Sa([i2], n2, false, t2.g.i.canvas, t2.M, s2, e2), r2 ? t2.clone() : t2;
3164
+ }
3165
+ var ih = class extends sa {
3166
+ constructor(t2, e2, n2, r2) {
3167
+ super(t2), this.g = t2, this.ba = e2, this.V = n2, this.ra = r2, this.M = new ga();
3168
+ }
3169
+ l(t2, e2 = true) {
3170
+ if ("runningMode" in t2 && Vn(this.baseOptions, 2, !!t2.runningMode && "IMAGE" !== t2.runningMode), void 0 !== t2.canvas && this.g.i.canvas !== t2.canvas) throw Error("You must create a new task to reset the canvas.");
3171
+ return super.l(t2, e2);
3172
+ }
3173
+ close() {
3174
+ this.M.close(), super.close();
3175
+ }
3176
+ };
3177
+ ih.prototype.close = ih.prototype.close;
3178
+ var sh = class extends ih {
3179
+ constructor(t2, e2) {
3180
+ super(new Za(t2, e2), "image_in", "norm_rect_in", false), this.j = { detections: [] }, Cn(t2 = this.h = new Is(), 0, 1, e2 = new Cs()), Hn(this.h, 2, 0.5), Hn(this.h, 3, 0.3);
3181
+ }
3182
+ get baseOptions() {
3183
+ return Rn(this.h, Cs, 1);
3184
+ }
3185
+ set baseOptions(t2) {
3186
+ Cn(this.h, 0, 1, t2);
3187
+ }
3188
+ o(t2) {
3189
+ return "minDetectionConfidence" in t2 && Hn(this.h, 2, t2.minDetectionConfidence ?? 0.5), "minSuppressionThreshold" in t2 && Hn(this.h, 3, t2.minSuppressionThreshold ?? 0.3), this.l(t2);
3190
+ }
3191
+ F(t2, e2) {
3192
+ return this.j = { detections: [] }, eh(this, t2, e2), this.j;
3193
+ }
3194
+ G(t2, e2, n2) {
3195
+ return this.j = { detections: [] }, nh(this, t2, n2, e2), this.j;
3196
+ }
3197
+ m() {
3198
+ var t2 = new Di();
3199
+ Ii(t2, "image_in"), Ii(t2, "norm_rect_in"), Ui(t2, "detections");
3200
+ const e2 = new yi();
3201
+ Wn(e2, Ds, this.h);
3202
+ const n2 = new Li();
3203
+ ki(n2, "mediapipe.tasks.vision.face_detector.FaceDetectorGraph"), xi(n2, "IMAGE:image_in"), xi(n2, "NORM_RECT:norm_rect_in"), Si(n2, "DETECTIONS:detections"), n2.o(e2), Oi(t2, n2), this.g.attachProtoVectorListener("detections", ((t3, e3) => {
3204
+ for (const e4 of t3) t3 = ns(e4), this.j.detections.push(Oo(t3));
3205
+ ea(this, e3);
3206
+ })), this.g.attachEmptyPacketListener("detections", ((t3) => {
3207
+ ea(this, t3);
3208
+ })), t2 = t2.g(), this.setGraph(new Uint8Array(t2), true);
3209
+ }
3210
+ };
3211
+ sh.prototype.detectForVideo = sh.prototype.G, sh.prototype.detect = sh.prototype.F, sh.prototype.setOptions = sh.prototype.o, sh.createFromModelPath = async function(t2, e2) {
3212
+ return Qa(sh, t2, { baseOptions: { modelAssetPath: e2 } });
3213
+ }, sh.createFromModelBuffer = function(t2, e2) {
3214
+ return Qa(sh, t2, { baseOptions: { modelAssetBuffer: e2 } });
3215
+ }, sh.createFromOptions = function(t2, e2) {
3216
+ return Qa(sh, t2, e2);
3217
+ };
3218
+ var oh = $a([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]);
3219
+ var ah = $a([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]);
3220
+ var hh = $a([276, 283], [283, 282], [282, 295], [295, 285], [300, 293], [293, 334], [334, 296], [296, 336]);
3221
+ var ch = $a([474, 475], [475, 476], [476, 477], [477, 474]);
3222
+ var uh = $a([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]);
3223
+ var lh = $a([46, 53], [53, 52], [52, 65], [65, 55], [70, 63], [63, 105], [105, 66], [66, 107]);
3224
+ var dh = $a([469, 470], [470, 471], [471, 472], [472, 469]);
3225
+ var fh = $a([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]);
3226
+ var ph = [...oh, ...ah, ...hh, ...uh, ...lh, ...fh];
3227
+ var gh = $a([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]);
3228
+ function mh(t2) {
3229
+ t2.u = { faceLandmarks: [], faceBlendshapes: [], facialTransformationMatrixes: [] };
3230
+ }
3231
+ var yh = class extends ih {
3232
+ constructor(t2, e2) {
3233
+ super(new Za(t2, e2), "image_in", "norm_rect", false), this.u = { faceLandmarks: [], faceBlendshapes: [], facialTransformationMatrixes: [] }, this.outputFacialTransformationMatrixes = this.outputFaceBlendshapes = false, Cn(t2 = this.h = new Hs(), 0, 1, e2 = new Cs()), this.H = new Vs(), Cn(this.h, 0, 3, this.H), this.j = new Is(), Cn(this.h, 0, 2, this.j), Xn(this.j, 4, 1), Hn(this.j, 2, 0.5), Hn(this.H, 2, 0.5), Hn(this.h, 4, 0.5);
3234
+ }
3235
+ get baseOptions() {
3236
+ return Rn(this.h, Cs, 1);
3237
+ }
3238
+ set baseOptions(t2) {
3239
+ Cn(this.h, 0, 1, t2);
3240
+ }
3241
+ o(t2) {
3242
+ return "numFaces" in t2 && Xn(this.j, 4, t2.numFaces ?? 1), "minFaceDetectionConfidence" in t2 && Hn(this.j, 2, t2.minFaceDetectionConfidence ?? 0.5), "minTrackingConfidence" in t2 && Hn(this.h, 4, t2.minTrackingConfidence ?? 0.5), "minFacePresenceConfidence" in t2 && Hn(this.H, 2, t2.minFacePresenceConfidence ?? 0.5), "outputFaceBlendshapes" in t2 && (this.outputFaceBlendshapes = !!t2.outputFaceBlendshapes), "outputFacialTransformationMatrixes" in t2 && (this.outputFacialTransformationMatrixes = !!t2.outputFacialTransformationMatrixes), this.l(t2);
3243
+ }
3244
+ F(t2, e2) {
3245
+ return mh(this), eh(this, t2, e2), this.u;
3246
+ }
3247
+ G(t2, e2, n2) {
3248
+ return mh(this), nh(this, t2, n2, e2), this.u;
3249
+ }
3250
+ m() {
3251
+ var t2 = new Di();
3252
+ Ii(t2, "image_in"), Ii(t2, "norm_rect"), Ui(t2, "face_landmarks");
3253
+ const e2 = new yi();
3254
+ Wn(e2, zs, this.h);
3255
+ const n2 = new Li();
3256
+ ki(n2, "mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"), xi(n2, "IMAGE:image_in"), xi(n2, "NORM_RECT:norm_rect"), Si(n2, "NORM_LANDMARKS:face_landmarks"), n2.o(e2), Oi(t2, n2), this.g.attachProtoVectorListener("face_landmarks", ((t3, e3) => {
3257
+ for (const e4 of t3) t3 = us(e4), this.u.faceLandmarks.push(Io(t3));
3258
+ ea(this, e3);
3259
+ })), this.g.attachEmptyPacketListener("face_landmarks", ((t3) => {
3260
+ ea(this, t3);
3261
+ })), this.outputFaceBlendshapes && (Ui(t2, "blendshapes"), Si(n2, "BLENDSHAPES:blendshapes"), this.g.attachProtoVectorListener("blendshapes", ((t3, e3) => {
3262
+ if (this.outputFaceBlendshapes) for (const e4 of t3) t3 = Wi(e4), this.u.faceBlendshapes.push(Co(t3.g() ?? []));
3263
+ ea(this, e3);
3264
+ })), this.g.attachEmptyPacketListener("blendshapes", ((t3) => {
3265
+ ea(this, t3);
3266
+ }))), this.outputFacialTransformationMatrixes && (Ui(t2, "face_geometry"), Si(n2, "FACE_GEOMETRY:face_geometry"), this.g.attachProtoVectorListener("face_geometry", ((t3, e3) => {
3267
+ if (this.outputFacialTransformationMatrixes) for (const e4 of t3) (t3 = Rn(Gs(e4), ls, 2)) && this.u.facialTransformationMatrixes.push({ rows: Bn(Nn(t3, 1), 0) ?? 0, columns: Bn(Nn(t3, 2), 0) ?? 0, data: yn(t3, 3, ve).slice() ?? [] });
3268
+ ea(this, e3);
3269
+ })), this.g.attachEmptyPacketListener("face_geometry", ((t3) => {
3270
+ ea(this, t3);
3271
+ }))), t2 = t2.g(), this.setGraph(new Uint8Array(t2), true);
3272
+ }
3273
+ };
3274
+ yh.prototype.detectForVideo = yh.prototype.G, yh.prototype.detect = yh.prototype.F, yh.prototype.setOptions = yh.prototype.o, yh.createFromModelPath = function(t2, e2) {
3275
+ return Qa(yh, t2, { baseOptions: { modelAssetPath: e2 } });
3276
+ }, yh.createFromModelBuffer = function(t2, e2) {
3277
+ return Qa(yh, t2, { baseOptions: { modelAssetBuffer: e2 } });
3278
+ }, yh.createFromOptions = function(t2, e2) {
3279
+ return Qa(yh, t2, e2);
3280
+ }, yh.FACE_LANDMARKS_LIPS = oh, yh.FACE_LANDMARKS_LEFT_EYE = ah, yh.FACE_LANDMARKS_LEFT_EYEBROW = hh, yh.FACE_LANDMARKS_LEFT_IRIS = ch, yh.FACE_LANDMARKS_RIGHT_EYE = uh, yh.FACE_LANDMARKS_RIGHT_EYEBROW = lh, yh.FACE_LANDMARKS_RIGHT_IRIS = dh, yh.FACE_LANDMARKS_FACE_OVAL = fh, yh.FACE_LANDMARKS_CONTOURS = ph, yh.FACE_LANDMARKS_TESSELATION = gh;
3281
+ var _h = class extends ih {
3282
+ constructor(t2, e2) {
3283
+ super(new Za(t2, e2), "image_in", "norm_rect", true), Cn(t2 = this.j = new Ks(), 0, 1, e2 = new Cs());
3284
+ }
3285
+ get baseOptions() {
3286
+ return Rn(this.j, Cs, 1);
3287
+ }
3288
+ set baseOptions(t2) {
3289
+ Cn(this.j, 0, 1, t2);
3290
+ }
3291
+ o(t2) {
3292
+ return super.l(t2);
3293
+ }
3294
+ Pa(t2, e2, n2) {
3295
+ const r2 = "function" != typeof e2 ? e2 : {};
3296
+ if (this.h = "function" == typeof e2 ? e2 : n2, eh(this, t2, r2 ?? {}), !this.h) return this.u;
3297
+ }
3298
+ m() {
3299
+ var t2 = new Di();
3300
+ Ii(t2, "image_in"), Ii(t2, "norm_rect"), Ui(t2, "stylized_image");
3301
+ const e2 = new yi();
3302
+ Wn(e2, Ys, this.j);
3303
+ const n2 = new Li();
3304
+ ki(n2, "mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"), xi(n2, "IMAGE:image_in"), xi(n2, "NORM_RECT:norm_rect"), Si(n2, "STYLIZED_IMAGE:stylized_image"), n2.o(e2), Oi(t2, n2), this.g.W("stylized_image", ((t3, e3) => {
3305
+ var n3 = !this.h, r2 = t3.data, i2 = t3.width;
3306
+ const s2 = i2 * (t3 = t3.height);
3307
+ if (r2 instanceof Uint8Array) if (r2.length === 3 * s2) {
3308
+ const e4 = new Uint8ClampedArray(4 * s2);
3309
+ for (let t4 = 0; t4 < s2; ++t4) e4[4 * t4] = r2[3 * t4], e4[4 * t4 + 1] = r2[3 * t4 + 1], e4[4 * t4 + 2] = r2[3 * t4 + 2], e4[4 * t4 + 3] = 255;
3310
+ r2 = new ImageData(e4, i2, t3);
3311
+ } else {
3312
+ if (r2.length !== 4 * s2) throw Error("Unsupported channel count: " + r2.length / s2);
3313
+ r2 = new ImageData(new Uint8ClampedArray(r2.buffer, r2.byteOffset, r2.length), i2, t3);
3314
+ }
3315
+ else if (!(r2 instanceof WebGLTexture)) throw Error(`Unsupported format: ${r2.constructor.name}`);
3316
+ i2 = new Ka([r2], false, false, this.g.i.canvas, this.M, i2, t3), this.u = n3 = n3 ? i2.clone() : i2, this.h && this.h(n3), ea(this, e3);
3317
+ })), this.g.attachEmptyPacketListener("stylized_image", ((t3) => {
3318
+ this.u = null, this.h && this.h(null), ea(this, t3);
3319
+ })), t2 = t2.g(), this.setGraph(new Uint8Array(t2), true);
3320
+ }
3321
+ };
3322
+ _h.prototype.stylize = _h.prototype.Pa, _h.prototype.setOptions = _h.prototype.o, _h.createFromModelPath = function(t2, e2) {
3323
+ return Qa(_h, t2, { baseOptions: { modelAssetPath: e2 } });
3324
+ }, _h.createFromModelBuffer = function(t2, e2) {
3325
+ return Qa(_h, t2, { baseOptions: { modelAssetBuffer: e2 } });
3326
+ }, _h.createFromOptions = function(t2, e2) {
3327
+ return Qa(_h, t2, e2);
3328
+ };
3329
+ var vh = $a([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]);
3330
+ function Eh(t2) {
3331
+ t2.gestures = [], t2.landmarks = [], t2.worldLandmarks = [], t2.handedness = [];
3332
+ }
3333
+ function wh(t2) {
3334
+ return 0 === t2.gestures.length ? { gestures: [], landmarks: [], worldLandmarks: [], handedness: [], handednesses: [] } : { gestures: t2.gestures, landmarks: t2.landmarks, worldLandmarks: t2.worldLandmarks, handedness: t2.handedness, handednesses: t2.handedness };
3335
+ }
3336
+ function Th(t2, e2 = true) {
3337
+ const n2 = [];
3338
+ for (const i2 of t2) {
3339
+ var r2 = Wi(i2);
3340
+ t2 = [];
3341
+ for (const n3 of r2.g()) r2 = e2 && null != Nn(n3, 1) ? Bn(Nn(n3, 1), 0) : -1, t2.push({ score: Gn(n3, 2) ?? 0, index: r2, categoryName: jn(n3, 3) ?? "", displayName: jn(n3, 4) ?? "" });
3342
+ n2.push(t2);
3343
+ }
3344
+ return n2;
3345
+ }
3346
+ var Ah = class extends ih {
3347
+ constructor(t2, e2) {
3348
+ super(new Za(t2, e2), "image_in", "norm_rect", false), this.gestures = [], this.landmarks = [], this.worldLandmarks = [], this.handedness = [], Cn(t2 = this.v = new oo(), 0, 1, e2 = new Cs()), this.A = new io(), Cn(this.v, 0, 2, this.A), this.u = new no(), Cn(this.A, 0, 3, this.u), this.h = new to(), Cn(this.A, 0, 2, this.h), this.j = new Zs(), Cn(this.v, 0, 3, this.j), Hn(this.h, 2, 0.5), Hn(this.A, 4, 0.5), Hn(this.u, 2, 0.5);
3349
+ }
3350
+ get baseOptions() {
3351
+ return Rn(this.v, Cs, 1);
3352
+ }
3353
+ set baseOptions(t2) {
3354
+ Cn(this.v, 0, 1, t2);
3355
+ }
3356
+ o(t2) {
3357
+ if (Xn(this.h, 3, t2.numHands ?? 1), "minHandDetectionConfidence" in t2 && Hn(this.h, 2, t2.minHandDetectionConfidence ?? 0.5), "minTrackingConfidence" in t2 && Hn(this.A, 4, t2.minTrackingConfidence ?? 0.5), "minHandPresenceConfidence" in t2 && Hn(this.u, 2, t2.minHandPresenceConfidence ?? 0.5), t2.cannedGesturesClassifierOptions) {
3358
+ var e2 = new $s(), n2 = e2, r2 = Po(t2.cannedGesturesClassifierOptions, Rn(this.j, $s, 3)?.h());
3359
+ Cn(n2, 0, 2, r2), Cn(this.j, 0, 3, e2);
3360
+ } else void 0 === t2.cannedGesturesClassifierOptions && Rn(this.j, $s, 3)?.g();
3361
+ return t2.customGesturesClassifierOptions ? (Cn(n2 = e2 = new $s(), 0, 2, r2 = Po(t2.customGesturesClassifierOptions, Rn(this.j, $s, 4)?.h())), Cn(this.j, 0, 4, e2)) : void 0 === t2.customGesturesClassifierOptions && Rn(this.j, $s, 4)?.g(), this.l(t2);
3362
+ }
3363
+ Ka(t2, e2) {
3364
+ return Eh(this), eh(this, t2, e2), wh(this);
3365
+ }
3366
+ La(t2, e2, n2) {
3367
+ return Eh(this), nh(this, t2, n2, e2), wh(this);
3368
+ }
3369
+ m() {
3370
+ var t2 = new Di();
3371
+ Ii(t2, "image_in"), Ii(t2, "norm_rect"), Ui(t2, "hand_gestures"), Ui(t2, "hand_landmarks"), Ui(t2, "world_hand_landmarks"), Ui(t2, "handedness");
3372
+ const e2 = new yi();
3373
+ Wn(e2, co, this.v);
3374
+ const n2 = new Li();
3375
+ ki(n2, "mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"), xi(n2, "IMAGE:image_in"), xi(n2, "NORM_RECT:norm_rect"), Si(n2, "HAND_GESTURES:hand_gestures"), Si(n2, "LANDMARKS:hand_landmarks"), Si(n2, "WORLD_LANDMARKS:world_hand_landmarks"), Si(n2, "HANDEDNESS:handedness"), n2.o(e2), Oi(t2, n2), this.g.attachProtoVectorListener("hand_landmarks", ((t3, e3) => {
3376
+ for (const e4 of t3) {
3377
+ t3 = us(e4);
3378
+ const n3 = [];
3379
+ for (const e5 of Pn(t3, as, 1)) n3.push({ x: Gn(e5, 1) ?? 0, y: Gn(e5, 2) ?? 0, z: Gn(e5, 3) ?? 0, visibility: Gn(e5, 4) ?? 0 });
3380
+ this.landmarks.push(n3);
3381
+ }
3382
+ ea(this, e3);
3383
+ })), this.g.attachEmptyPacketListener("hand_landmarks", ((t3) => {
3384
+ ea(this, t3);
3385
+ })), this.g.attachProtoVectorListener("world_hand_landmarks", ((t3, e3) => {
3386
+ for (const e4 of t3) {
3387
+ t3 = os(e4);
3388
+ const n3 = [];
3389
+ for (const e5 of Pn(t3, rs, 1)) n3.push({ x: Gn(e5, 1) ?? 0, y: Gn(e5, 2) ?? 0, z: Gn(e5, 3) ?? 0, visibility: Gn(e5, 4) ?? 0 });
3390
+ this.worldLandmarks.push(n3);
3391
+ }
3392
+ ea(this, e3);
3393
+ })), this.g.attachEmptyPacketListener("world_hand_landmarks", ((t3) => {
3394
+ ea(this, t3);
3395
+ })), this.g.attachProtoVectorListener("hand_gestures", ((t3, e3) => {
3396
+ this.gestures.push(...Th(t3, false)), ea(this, e3);
3397
+ })), this.g.attachEmptyPacketListener("hand_gestures", ((t3) => {
3398
+ ea(this, t3);
3399
+ })), this.g.attachProtoVectorListener("handedness", ((t3, e3) => {
3400
+ this.handedness.push(...Th(t3)), ea(this, e3);
3401
+ })), this.g.attachEmptyPacketListener("handedness", ((t3) => {
3402
+ ea(this, t3);
3403
+ })), t2 = t2.g(), this.setGraph(new Uint8Array(t2), true);
3404
+ }
3405
+ };
3406
+ function bh(t2) {
3407
+ return { landmarks: t2.landmarks, worldLandmarks: t2.worldLandmarks, handednesses: t2.handedness, handedness: t2.handedness };
3408
+ }
3409
+ Ah.prototype.recognizeForVideo = Ah.prototype.La, Ah.prototype.recognize = Ah.prototype.Ka, Ah.prototype.setOptions = Ah.prototype.o, Ah.createFromModelPath = function(t2, e2) {
3410
+ return Qa(Ah, t2, { baseOptions: { modelAssetPath: e2 } });
3411
+ }, Ah.createFromModelBuffer = function(t2, e2) {
3412
+ return Qa(Ah, t2, { baseOptions: { modelAssetBuffer: e2 } });
3413
+ }, Ah.createFromOptions = function(t2, e2) {
3414
+ return Qa(Ah, t2, e2);
3415
+ }, Ah.HAND_CONNECTIONS = vh;
3416
+ var kh = class extends ih {
3417
+ constructor(t2, e2) {
3418
+ super(new Za(t2, e2), "image_in", "norm_rect", false), this.landmarks = [], this.worldLandmarks = [], this.handedness = [], Cn(t2 = this.j = new io(), 0, 1, e2 = new Cs()), this.u = new no(), Cn(this.j, 0, 3, this.u), this.h = new to(), Cn(this.j, 0, 2, this.h), Xn(this.h, 3, 1), Hn(this.h, 2, 0.5), Hn(this.u, 2, 0.5), Hn(this.j, 4, 0.5);
3419
+ }
3420
+ get baseOptions() {
3421
+ return Rn(this.j, Cs, 1);
3422
+ }
3423
+ set baseOptions(t2) {
3424
+ Cn(this.j, 0, 1, t2);
3425
+ }
3426
+ o(t2) {
3427
+ return "numHands" in t2 && Xn(this.h, 3, t2.numHands ?? 1), "minHandDetectionConfidence" in t2 && Hn(this.h, 2, t2.minHandDetectionConfidence ?? 0.5), "minTrackingConfidence" in t2 && Hn(this.j, 4, t2.minTrackingConfidence ?? 0.5), "minHandPresenceConfidence" in t2 && Hn(this.u, 2, t2.minHandPresenceConfidence ?? 0.5), this.l(t2);
3428
+ }
3429
+ F(t2, e2) {
3430
+ return this.landmarks = [], this.worldLandmarks = [], this.handedness = [], eh(this, t2, e2), bh(this);
3431
+ }
3432
+ G(t2, e2, n2) {
3433
+ return this.landmarks = [], this.worldLandmarks = [], this.handedness = [], nh(this, t2, n2, e2), bh(this);
3434
+ }
3435
+ m() {
3436
+ var t2 = new Di();
3437
+ Ii(t2, "image_in"), Ii(t2, "norm_rect"), Ui(t2, "hand_landmarks"), Ui(t2, "world_hand_landmarks"), Ui(t2, "handedness");
3438
+ const e2 = new yi();
3439
+ Wn(e2, ho, this.j);
3440
+ const n2 = new Li();
3441
+ ki(n2, "mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"), xi(n2, "IMAGE:image_in"), xi(n2, "NORM_RECT:norm_rect"), Si(n2, "LANDMARKS:hand_landmarks"), Si(n2, "WORLD_LANDMARKS:world_hand_landmarks"), Si(n2, "HANDEDNESS:handedness"), n2.o(e2), Oi(t2, n2), this.g.attachProtoVectorListener("hand_landmarks", ((t3, e3) => {
3442
+ for (const e4 of t3) t3 = us(e4), this.landmarks.push(Io(t3));
3443
+ ea(this, e3);
3444
+ })), this.g.attachEmptyPacketListener("hand_landmarks", ((t3) => {
3445
+ ea(this, t3);
3446
+ })), this.g.attachProtoVectorListener("world_hand_landmarks", ((t3, e3) => {
3447
+ for (const e4 of t3) t3 = os(e4), this.worldLandmarks.push(Uo(t3));
3448
+ ea(this, e3);
3449
+ })), this.g.attachEmptyPacketListener("world_hand_landmarks", ((t3) => {
3450
+ ea(this, t3);
3451
+ })), this.g.attachProtoVectorListener("handedness", ((t3, e3) => {
3452
+ var n3 = this.handedness, r2 = n3.push;
3453
+ const i2 = [];
3454
+ for (const e4 of t3) {
3455
+ t3 = Wi(e4);
3456
+ const n4 = [];
3457
+ for (const e5 of t3.g()) n4.push({ score: Gn(e5, 2) ?? 0, index: Bn(Nn(e5, 1), 0) ?? -1, categoryName: jn(e5, 3) ?? "", displayName: jn(e5, 4) ?? "" });
3458
+ i2.push(n4);
3459
+ }
3460
+ r2.call(n3, ...i2), ea(this, e3);
3461
+ })), this.g.attachEmptyPacketListener("handedness", ((t3) => {
3462
+ ea(this, t3);
3463
+ })), t2 = t2.g(), this.setGraph(new Uint8Array(t2), true);
3464
+ }
3465
+ };
3466
+ kh.prototype.detectForVideo = kh.prototype.G, kh.prototype.detect = kh.prototype.F, kh.prototype.setOptions = kh.prototype.o, kh.createFromModelPath = function(t2, e2) {
3467
+ return Qa(kh, t2, { baseOptions: { modelAssetPath: e2 } });
3468
+ }, kh.createFromModelBuffer = function(t2, e2) {
3469
+ return Qa(kh, t2, { baseOptions: { modelAssetBuffer: e2 } });
3470
+ }, kh.createFromOptions = function(t2, e2) {
3471
+ return Qa(kh, t2, e2);
3472
+ }, kh.HAND_CONNECTIONS = vh;
3473
+ var xh = $a([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]);
3474
+ function Sh(t2) {
3475
+ t2.h = { faceLandmarks: [], faceBlendshapes: [], poseLandmarks: [], poseWorldLandmarks: [], poseSegmentationMasks: [], leftHandLandmarks: [], leftHandWorldLandmarks: [], rightHandLandmarks: [], rightHandWorldLandmarks: [] };
3476
+ }
3477
+ function Lh(t2) {
3478
+ try {
3479
+ if (!t2.I) return t2.h;
3480
+ t2.I(t2.h);
3481
+ } finally {
3482
+ ia(t2);
3483
+ }
3484
+ }
3485
+ function Fh(t2, e2) {
3486
+ t2 = us(t2), e2.push(Io(t2));
3487
+ }
3488
+ var Rh = class extends ih {
3489
+ constructor(t2, e2) {
3490
+ super(new Za(t2, e2), "input_frames_image", null, false), this.h = { faceLandmarks: [], faceBlendshapes: [], poseLandmarks: [], poseWorldLandmarks: [], poseSegmentationMasks: [], leftHandLandmarks: [], leftHandWorldLandmarks: [], rightHandLandmarks: [], rightHandWorldLandmarks: [] }, this.outputPoseSegmentationMasks = this.outputFaceBlendshapes = false, Cn(t2 = this.A = new yo(), 0, 1, e2 = new Cs()), this.u = new no(), Cn(this.A, 0, 2, this.u), this.aa = new uo(), Cn(this.A, 0, 3, this.aa), this.j = new Is(), Cn(this.A, 0, 4, this.j), this.H = new Vs(), Cn(this.A, 0, 5, this.H), this.v = new fo(), Cn(this.A, 0, 6, this.v), this.D = new go(), Cn(this.A, 0, 7, this.D), Hn(this.j, 2, 0.5), Hn(this.j, 3, 0.3), Hn(this.H, 2, 0.5), Hn(this.v, 2, 0.5), Hn(this.v, 3, 0.3), Hn(this.D, 2, 0.5), Hn(this.u, 2, 0.5);
3491
+ }
3492
+ get baseOptions() {
3493
+ return Rn(this.A, Cs, 1);
3494
+ }
3495
+ set baseOptions(t2) {
3496
+ Cn(this.A, 0, 1, t2);
3497
+ }
3498
+ o(t2) {
3499
+ return "minFaceDetectionConfidence" in t2 && Hn(this.j, 2, t2.minFaceDetectionConfidence ?? 0.5), "minFaceSuppressionThreshold" in t2 && Hn(this.j, 3, t2.minFaceSuppressionThreshold ?? 0.3), "minFacePresenceConfidence" in t2 && Hn(this.H, 2, t2.minFacePresenceConfidence ?? 0.5), "outputFaceBlendshapes" in t2 && (this.outputFaceBlendshapes = !!t2.outputFaceBlendshapes), "minPoseDetectionConfidence" in t2 && Hn(this.v, 2, t2.minPoseDetectionConfidence ?? 0.5), "minPoseSuppressionThreshold" in t2 && Hn(this.v, 3, t2.minPoseSuppressionThreshold ?? 0.3), "minPosePresenceConfidence" in t2 && Hn(this.D, 2, t2.minPosePresenceConfidence ?? 0.5), "outputPoseSegmentationMasks" in t2 && (this.outputPoseSegmentationMasks = !!t2.outputPoseSegmentationMasks), "minHandLandmarksConfidence" in t2 && Hn(this.u, 2, t2.minHandLandmarksConfidence ?? 0.5), this.l(t2);
3500
+ }
3501
+ F(t2, e2, n2) {
3502
+ const r2 = "function" != typeof e2 ? e2 : {};
3503
+ return this.I = "function" == typeof e2 ? e2 : n2, Sh(this), eh(this, t2, r2), Lh(this);
3504
+ }
3505
+ G(t2, e2, n2, r2) {
3506
+ const i2 = "function" != typeof n2 ? n2 : {};
3507
+ return this.I = "function" == typeof n2 ? n2 : r2, Sh(this), nh(this, t2, i2, e2), Lh(this);
3508
+ }
3509
+ m() {
3510
+ var t2 = new Di();
3511
+ Ii(t2, "input_frames_image"), Ui(t2, "pose_landmarks"), Ui(t2, "pose_world_landmarks"), Ui(t2, "face_landmarks"), Ui(t2, "left_hand_landmarks"), Ui(t2, "left_hand_world_landmarks"), Ui(t2, "right_hand_landmarks"), Ui(t2, "right_hand_world_landmarks");
3512
+ const e2 = new yi(), n2 = new oi();
3513
+ An(n2, 1, Me("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"), ""), (function(t3, e3) {
3514
+ if (null != e3) if (Array.isArray(e3)) dn(t3, 2, tn(e3, nn, void 0, void 0, false));
3515
+ else {
3516
+ if (!("string" == typeof e3 || e3 instanceof B || M(e3))) throw Error("invalid value in Any.value field: " + e3 + " expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");
3517
+ An(t3, 2, ae(e3, false, false), D());
3518
+ }
3519
+ })(n2, this.A.g());
3520
+ const r2 = new Li();
3521
+ ki(r2, "mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"), Dn(r2, 8, oi, n2), xi(r2, "IMAGE:input_frames_image"), Si(r2, "POSE_LANDMARKS:pose_landmarks"), Si(r2, "POSE_WORLD_LANDMARKS:pose_world_landmarks"), Si(r2, "FACE_LANDMARKS:face_landmarks"), Si(r2, "LEFT_HAND_LANDMARKS:left_hand_landmarks"), Si(r2, "LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"), Si(r2, "RIGHT_HAND_LANDMARKS:right_hand_landmarks"), Si(r2, "RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"), r2.o(e2), Oi(t2, r2), na(this, t2), this.g.attachProtoListener("pose_landmarks", ((t3, e3) => {
3522
+ Fh(t3, this.h.poseLandmarks), ea(this, e3);
3523
+ })), this.g.attachEmptyPacketListener("pose_landmarks", ((t3) => {
3524
+ ea(this, t3);
3525
+ })), this.g.attachProtoListener("pose_world_landmarks", ((t3, e3) => {
3526
+ var n3 = this.h.poseWorldLandmarks;
3527
+ t3 = os(t3), n3.push(Uo(t3)), ea(this, e3);
3528
+ })), this.g.attachEmptyPacketListener("pose_world_landmarks", ((t3) => {
3529
+ ea(this, t3);
3530
+ })), this.outputPoseSegmentationMasks && (Si(r2, "POSE_SEGMENTATION_MASK:pose_segmentation_mask"), ra(this, "pose_segmentation_mask"), this.g.W("pose_segmentation_mask", ((t3, e3) => {
3531
+ this.h.poseSegmentationMasks = [rh(this, t3, true, !this.I)], ea(this, e3);
3532
+ })), this.g.attachEmptyPacketListener("pose_segmentation_mask", ((t3) => {
3533
+ this.h.poseSegmentationMasks = [], ea(this, t3);
3534
+ }))), this.g.attachProtoListener("face_landmarks", ((t3, e3) => {
3535
+ Fh(t3, this.h.faceLandmarks), ea(this, e3);
3536
+ })), this.g.attachEmptyPacketListener("face_landmarks", ((t3) => {
3537
+ ea(this, t3);
3538
+ })), this.outputFaceBlendshapes && (Ui(t2, "extra_blendshapes"), Si(r2, "FACE_BLENDSHAPES:extra_blendshapes"), this.g.attachProtoListener("extra_blendshapes", ((t3, e3) => {
3539
+ var n3 = this.h.faceBlendshapes;
3540
+ this.outputFaceBlendshapes && (t3 = Wi(t3), n3.push(Co(t3.g() ?? []))), ea(this, e3);
3541
+ })), this.g.attachEmptyPacketListener("extra_blendshapes", ((t3) => {
3542
+ ea(this, t3);
3543
+ }))), this.g.attachProtoListener("left_hand_landmarks", ((t3, e3) => {
3544
+ Fh(t3, this.h.leftHandLandmarks), ea(this, e3);
3545
+ })), this.g.attachEmptyPacketListener("left_hand_landmarks", ((t3) => {
3546
+ ea(this, t3);
3547
+ })), this.g.attachProtoListener("left_hand_world_landmarks", ((t3, e3) => {
3548
+ var n3 = this.h.leftHandWorldLandmarks;
3549
+ t3 = os(t3), n3.push(Uo(t3)), ea(this, e3);
3550
+ })), this.g.attachEmptyPacketListener("left_hand_world_landmarks", ((t3) => {
3551
+ ea(this, t3);
3552
+ })), this.g.attachProtoListener("right_hand_landmarks", ((t3, e3) => {
3553
+ Fh(t3, this.h.rightHandLandmarks), ea(this, e3);
3554
+ })), this.g.attachEmptyPacketListener("right_hand_landmarks", ((t3) => {
3555
+ ea(this, t3);
3556
+ })), this.g.attachProtoListener("right_hand_world_landmarks", ((t3, e3) => {
3557
+ var n3 = this.h.rightHandWorldLandmarks;
3558
+ t3 = os(t3), n3.push(Uo(t3)), ea(this, e3);
3559
+ })), this.g.attachEmptyPacketListener("right_hand_world_landmarks", ((t3) => {
3560
+ ea(this, t3);
3561
+ })), t2 = t2.g(), this.setGraph(new Uint8Array(t2), true);
3562
+ }
3563
+ };
3564
+ Rh.prototype.detectForVideo = Rh.prototype.G, Rh.prototype.detect = Rh.prototype.F, Rh.prototype.setOptions = Rh.prototype.o, Rh.createFromModelPath = function(t2, e2) {
3565
+ return Qa(Rh, t2, { baseOptions: { modelAssetPath: e2 } });
3566
+ }, Rh.createFromModelBuffer = function(t2, e2) {
3567
+ return Qa(Rh, t2, { baseOptions: { modelAssetBuffer: e2 } });
3568
+ }, Rh.createFromOptions = function(t2, e2) {
3569
+ return Qa(Rh, t2, e2);
3570
+ }, Rh.HAND_CONNECTIONS = vh, Rh.POSE_CONNECTIONS = xh, Rh.FACE_LANDMARKS_LIPS = oh, Rh.FACE_LANDMARKS_LEFT_EYE = ah, Rh.FACE_LANDMARKS_LEFT_EYEBROW = hh, Rh.FACE_LANDMARKS_LEFT_IRIS = ch, Rh.FACE_LANDMARKS_RIGHT_EYE = uh, Rh.FACE_LANDMARKS_RIGHT_EYEBROW = lh, Rh.FACE_LANDMARKS_RIGHT_IRIS = dh, Rh.FACE_LANDMARKS_FACE_OVAL = fh, Rh.FACE_LANDMARKS_CONTOURS = ph, Rh.FACE_LANDMARKS_TESSELATION = gh;
3571
+ var Mh = class extends ih {
3572
+ constructor(t2, e2) {
3573
+ super(new Za(t2, e2), "input_image", "norm_rect", true), this.j = { classifications: [] }, Cn(t2 = this.h = new _o(), 0, 1, e2 = new Cs());
3574
+ }
3575
+ get baseOptions() {
3576
+ return Rn(this.h, Cs, 1);
3577
+ }
3578
+ set baseOptions(t2) {
3579
+ Cn(this.h, 0, 1, t2);
3580
+ }
3581
+ o(t2) {
3582
+ return Cn(this.h, 0, 2, Po(t2, Rn(this.h, ks, 2))), this.l(t2);
3583
+ }
3584
+ ua(t2, e2) {
3585
+ return this.j = { classifications: [] }, eh(this, t2, e2), this.j;
3586
+ }
3587
+ va(t2, e2, n2) {
3588
+ return this.j = { classifications: [] }, nh(this, t2, n2, e2), this.j;
3589
+ }
3590
+ m() {
3591
+ var t2 = new Di();
3592
+ Ii(t2, "input_image"), Ii(t2, "norm_rect"), Ui(t2, "classifications");
3593
+ const e2 = new yi();
3594
+ Wn(e2, vo, this.h);
3595
+ const n2 = new Li();
3596
+ ki(n2, "mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"), xi(n2, "IMAGE:input_image"), xi(n2, "NORM_RECT:norm_rect"), Si(n2, "CLASSIFICATIONS:classifications"), n2.o(e2), Oi(t2, n2), this.g.attachProtoListener("classifications", ((t3, e3) => {
3597
+ this.j = (function(t4) {
3598
+ const e4 = { classifications: Pn(t4, ps, 1).map(((t5) => Co(Rn(t5, Xi, 4)?.g() ?? [], Bn(Nn(t5, 2), 0), jn(t5, 3)))) };
3599
+ return null != Fe(cn(t4, 2)) && (e4.timestampMs = Bn(Fe(cn(t4, 2)), 0)), e4;
3600
+ })(ys(t3)), ea(this, e3);
3601
+ })), this.g.attachEmptyPacketListener("classifications", ((t3) => {
3602
+ ea(this, t3);
3603
+ })), t2 = t2.g(), this.setGraph(new Uint8Array(t2), true);
3604
+ }
3605
+ };
3606
+ Mh.prototype.classifyForVideo = Mh.prototype.va, Mh.prototype.classify = Mh.prototype.ua, Mh.prototype.setOptions = Mh.prototype.o, Mh.createFromModelPath = function(t2, e2) {
3607
+ return Qa(Mh, t2, { baseOptions: { modelAssetPath: e2 } });
3608
+ }, Mh.createFromModelBuffer = function(t2, e2) {
3609
+ return Qa(Mh, t2, { baseOptions: { modelAssetBuffer: e2 } });
3610
+ }, Mh.createFromOptions = function(t2, e2) {
3611
+ return Qa(Mh, t2, e2);
3612
+ };
3613
+ var Ph = class extends ih {
3614
+ constructor(t2, e2) {
3615
+ super(new Za(t2, e2), "image_in", "norm_rect", true), this.h = new Eo(), this.embeddings = { embeddings: [] }, Cn(t2 = this.h, 0, 1, e2 = new Cs());
3616
+ }
3617
+ get baseOptions() {
3618
+ return Rn(this.h, Cs, 1);
3619
+ }
3620
+ set baseOptions(t2) {
3621
+ Cn(this.h, 0, 1, t2);
3622
+ }
3623
+ o(t2) {
3624
+ var e2 = this.h, n2 = Rn(this.h, Ss, 2);
3625
+ return n2 = n2 ? n2.clone() : new Ss(), void 0 !== t2.l2Normalize ? Vn(n2, 1, t2.l2Normalize) : "l2Normalize" in t2 && dn(n2, 1), void 0 !== t2.quantize ? Vn(n2, 2, t2.quantize) : "quantize" in t2 && dn(n2, 2), Cn(e2, 0, 2, n2), this.l(t2);
3626
+ }
3627
+ Ba(t2, e2) {
3628
+ return eh(this, t2, e2), this.embeddings;
3629
+ }
3630
+ Ca(t2, e2, n2) {
3631
+ return nh(this, t2, n2, e2), this.embeddings;
3632
+ }
3633
+ m() {
3634
+ var t2 = new Di();
3635
+ Ii(t2, "image_in"), Ii(t2, "norm_rect"), Ui(t2, "embeddings_out");
3636
+ const e2 = new yi();
3637
+ Wn(e2, wo, this.h);
3638
+ const n2 = new Li();
3639
+ ki(n2, "mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"), xi(n2, "IMAGE:image_in"), xi(n2, "NORM_RECT:norm_rect"), Si(n2, "EMBEDDINGS:embeddings_out"), n2.o(e2), Oi(t2, n2), this.g.attachProtoListener("embeddings_out", ((t3, e3) => {
3640
+ t3 = bs(t3), this.embeddings = (function(t4) {
3641
+ return { embeddings: Pn(t4, Es, 1).map(((t5) => {
3642
+ const e4 = { headIndex: Bn(Nn(t5, 3), 0) ?? -1, headName: jn(t5, 4) ?? "" };
3643
+ if (void 0 !== Fn(t5, _s, xn(t5, 1))) t5 = yn(t5 = Rn(t5, _s, xn(t5, 1)), 1, ve), e4.floatEmbedding = t5.slice();
3644
+ else {
3645
+ const n3 = new Uint8Array(0);
3646
+ e4.quantizedEmbedding = Rn(t5, vs, xn(t5, 2))?.qa()?.h() ?? n3;
3647
+ }
3648
+ return e4;
3649
+ })), timestampMs: Bn(Fe(cn(t4, 2)), 0) };
3650
+ })(t3), ea(this, e3);
3651
+ })), this.g.attachEmptyPacketListener("embeddings_out", ((t3) => {
3652
+ ea(this, t3);
3653
+ })), t2 = t2.g(), this.setGraph(new Uint8Array(t2), true);
3654
+ }
3655
+ };
3656
+ Ph.cosineSimilarity = function(t2, e2) {
3657
+ if (t2.floatEmbedding && e2.floatEmbedding) t2 = No(t2.floatEmbedding, e2.floatEmbedding);
3658
+ else {
3659
+ if (!t2.quantizedEmbedding || !e2.quantizedEmbedding) throw Error("Cannot compute cosine similarity between quantized and float embeddings.");
3660
+ t2 = No(Do(t2.quantizedEmbedding), Do(e2.quantizedEmbedding));
3661
+ }
3662
+ return t2;
3663
+ }, Ph.prototype.embedForVideo = Ph.prototype.Ca, Ph.prototype.embed = Ph.prototype.Ba, Ph.prototype.setOptions = Ph.prototype.o, Ph.createFromModelPath = function(t2, e2) {
3664
+ return Qa(Ph, t2, { baseOptions: { modelAssetPath: e2 } });
3665
+ }, Ph.createFromModelBuffer = function(t2, e2) {
3666
+ return Qa(Ph, t2, { baseOptions: { modelAssetBuffer: e2 } });
3667
+ }, Ph.createFromOptions = function(t2, e2) {
3668
+ return Qa(Ph, t2, e2);
3669
+ };
3670
+ var Ch = class {
3671
+ constructor(t2, e2, n2) {
3672
+ this.confidenceMasks = t2, this.categoryMask = e2, this.qualityScores = n2;
3673
+ }
3674
+ close() {
3675
+ this.confidenceMasks?.forEach(((t2) => {
3676
+ t2.close();
3677
+ })), this.categoryMask?.close();
3678
+ }
3679
+ };
3680
+ function Oh(t2) {
3681
+ t2.categoryMask = void 0, t2.confidenceMasks = void 0, t2.qualityScores = void 0;
3682
+ }
3683
+ function Ih(t2) {
3684
+ try {
3685
+ const e2 = new Ch(t2.confidenceMasks, t2.categoryMask, t2.qualityScores);
3686
+ if (!t2.j) return e2;
3687
+ t2.j(e2);
3688
+ } finally {
3689
+ ia(t2);
3690
+ }
3691
+ }
3692
+ Ch.prototype.close = Ch.prototype.close;
3693
+ var Uh = class extends ih {
3694
+ constructor(t2, e2) {
3695
+ super(new Za(t2, e2), "image_in", "norm_rect", false), this.u = [], this.outputCategoryMask = false, this.outputConfidenceMasks = true, this.h = new xo(), this.v = new To(), Cn(this.h, 0, 3, this.v), Cn(t2 = this.h, 0, 1, e2 = new Cs());
3696
+ }
3697
+ get baseOptions() {
3698
+ return Rn(this.h, Cs, 1);
3699
+ }
3700
+ set baseOptions(t2) {
3701
+ Cn(this.h, 0, 1, t2);
3702
+ }
3703
+ o(t2) {
3704
+ return void 0 !== t2.displayNamesLocale ? dn(this.h, 2, Me(t2.displayNamesLocale)) : "displayNamesLocale" in t2 && dn(this.h, 2), "outputCategoryMask" in t2 && (this.outputCategoryMask = t2.outputCategoryMask ?? false), "outputConfidenceMasks" in t2 && (this.outputConfidenceMasks = t2.outputConfidenceMasks ?? true), super.l(t2);
3705
+ }
3706
+ L() {
3707
+ !(function(t2) {
3708
+ const e2 = Pn(t2.fa(), Li, 1).filter(((t3) => jn(t3, 1).includes("mediapipe.tasks.TensorsToSegmentationCalculator")));
3709
+ if (t2.u = [], 1 < e2.length) throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");
3710
+ 1 === e2.length && (Rn(e2[0], yi, 7)?.l()?.g() ?? /* @__PURE__ */ new Map()).forEach(((e3, n2) => {
3711
+ t2.u[Number(n2)] = jn(e3, 1);
3712
+ }));
3713
+ })(this);
3714
+ }
3715
+ ga(t2, e2, n2) {
3716
+ const r2 = "function" != typeof e2 ? e2 : {};
3717
+ return this.j = "function" == typeof e2 ? e2 : n2, Oh(this), eh(this, t2, r2), Ih(this);
3718
+ }
3719
+ Na(t2, e2, n2, r2) {
3720
+ const i2 = "function" != typeof n2 ? n2 : {};
3721
+ return this.j = "function" == typeof n2 ? n2 : r2, Oh(this), nh(this, t2, i2, e2), Ih(this);
3722
+ }
3723
+ Fa() {
3724
+ return this.u;
3725
+ }
3726
+ m() {
3727
+ var t2 = new Di();
3728
+ Ii(t2, "image_in"), Ii(t2, "norm_rect");
3729
+ const e2 = new yi();
3730
+ Wn(e2, So, this.h);
3731
+ const n2 = new Li();
3732
+ ki(n2, "mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"), xi(n2, "IMAGE:image_in"), xi(n2, "NORM_RECT:norm_rect"), n2.o(e2), Oi(t2, n2), na(this, t2), this.outputConfidenceMasks && (Ui(t2, "confidence_masks"), Si(n2, "CONFIDENCE_MASKS:confidence_masks"), ra(this, "confidence_masks"), this.g.da("confidence_masks", ((t3, e3) => {
3733
+ this.confidenceMasks = t3.map(((t4) => rh(this, t4, true, !this.j))), ea(this, e3);
3734
+ })), this.g.attachEmptyPacketListener("confidence_masks", ((t3) => {
3735
+ this.confidenceMasks = [], ea(this, t3);
3736
+ }))), this.outputCategoryMask && (Ui(t2, "category_mask"), Si(n2, "CATEGORY_MASK:category_mask"), ra(this, "category_mask"), this.g.W("category_mask", ((t3, e3) => {
3737
+ this.categoryMask = rh(this, t3, false, !this.j), ea(this, e3);
3738
+ })), this.g.attachEmptyPacketListener("category_mask", ((t3) => {
3739
+ this.categoryMask = void 0, ea(this, t3);
3740
+ }))), Ui(t2, "quality_scores"), Si(n2, "QUALITY_SCORES:quality_scores"), this.g.attachFloatVectorListener("quality_scores", ((t3, e3) => {
3741
+ this.qualityScores = t3, ea(this, e3);
3742
+ })), this.g.attachEmptyPacketListener("quality_scores", ((t3) => {
3743
+ this.categoryMask = void 0, ea(this, t3);
3744
+ })), t2 = t2.g(), this.setGraph(new Uint8Array(t2), true);
3745
+ }
3746
+ };
3747
+ Uh.prototype.getLabels = Uh.prototype.Fa, Uh.prototype.segmentForVideo = Uh.prototype.Na, Uh.prototype.segment = Uh.prototype.ga, Uh.prototype.setOptions = Uh.prototype.o, Uh.createFromModelPath = function(t2, e2) {
3748
+ return Qa(Uh, t2, { baseOptions: { modelAssetPath: e2 } });
3749
+ }, Uh.createFromModelBuffer = function(t2, e2) {
3750
+ return Qa(Uh, t2, { baseOptions: { modelAssetBuffer: e2 } });
3751
+ }, Uh.createFromOptions = function(t2, e2) {
3752
+ return Qa(Uh, t2, e2);
3753
+ };
3754
+ var Dh = class {
3755
+ constructor(t2, e2, n2) {
3756
+ this.confidenceMasks = t2, this.categoryMask = e2, this.qualityScores = n2;
3757
+ }
3758
+ close() {
3759
+ this.confidenceMasks?.forEach(((t2) => {
3760
+ t2.close();
3761
+ })), this.categoryMask?.close();
3762
+ }
3763
+ };
3764
+ Dh.prototype.close = Dh.prototype.close;
3765
+ var Nh = class extends zn {
3766
+ constructor(t2) {
3767
+ super(t2);
3768
+ }
3769
+ };
3770
+ var Bh = [0, jr, -2];
3771
+ var Gh = [0, Or, -3, Hr];
3772
+ var jh = [0, Or, -3, Hr, Or, -1];
3773
+ var Vh = [0, jh];
3774
+ var Xh = [0, Vh, Bh];
3775
+ var Hh = [0, jh, Bh];
3776
+ var Wh = [0, jh, jr, -1];
3777
+ var zh = [0, Wh, Bh];
3778
+ var Kh = [0, Or, -3, Hr, Bh, -1];
3779
+ var Yh = [0, Or, -3, Hr, ti];
3780
+ var $h = class extends zn {
3781
+ constructor(t2) {
3782
+ super(t2);
3783
+ }
3784
+ };
3785
+ var qh = [0, Or, -1, Hr];
3786
+ var Jh = class extends zn {
3787
+ constructor() {
3788
+ super();
3789
+ }
3790
+ };
3791
+ Jh.B = [1];
3792
+ var Zh = class extends zn {
3793
+ constructor(t2) {
3794
+ super(t2);
3795
+ }
3796
+ };
3797
+ var Qh = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 15];
3798
+ var tc = [0, Qh, Jr, jh, Jr, Hh, Jr, Vh, Jr, Xh, Jr, qh, Jr, Yh, Jr, Gh, Jr, [0, Yr, Or, -2, Hr, jr, Hr, -1, 2, Or, Bh], Jr, Wh, Jr, zh, Or, Bh, Yr, Jr, Kh, Jr, [0, Cr, qh]];
3799
+ var ec = [0, Yr, jr, -1, Hr];
3800
+ var nc = class extends zn {
3801
+ constructor() {
3802
+ super();
3803
+ }
3804
+ };
3805
+ nc.B = [1], nc.prototype.g = si([0, Cr, tc, Yr, ec]);
3806
+ var rc = class extends ih {
3807
+ constructor(t2, e2) {
3808
+ super(new Za(t2, e2), "image_in", "norm_rect_in", false), this.outputCategoryMask = false, this.outputConfidenceMasks = true, this.h = new xo(), this.v = new To(), Cn(this.h, 0, 3, this.v), Cn(t2 = this.h, 0, 1, e2 = new Cs());
3809
+ }
3810
+ get baseOptions() {
3811
+ return Rn(this.h, Cs, 1);
3812
+ }
3813
+ set baseOptions(t2) {
3814
+ Cn(this.h, 0, 1, t2);
3815
+ }
3816
+ o(t2) {
3817
+ return "outputCategoryMask" in t2 && (this.outputCategoryMask = t2.outputCategoryMask ?? false), "outputConfidenceMasks" in t2 && (this.outputConfidenceMasks = t2.outputConfidenceMasks ?? true), super.l(t2);
3818
+ }
3819
+ ga(t2, e2, n2, r2) {
3820
+ const i2 = "function" != typeof n2 ? n2 : {};
3821
+ this.j = "function" == typeof n2 ? n2 : r2, this.qualityScores = this.categoryMask = this.confidenceMasks = void 0, n2 = this.J + 1, r2 = new nc();
3822
+ const s2 = new Zh();
3823
+ var o2 = new Nh();
3824
+ if (Xn(o2, 1, 255), Cn(s2, 0, 12, o2), e2.keypoint && e2.scribble) throw Error("Cannot provide both keypoint and scribble.");
3825
+ if (e2.keypoint) {
3826
+ var a2 = new $h();
3827
+ Vn(a2, 3, true), Hn(a2, 1, e2.keypoint.x), Hn(a2, 2, e2.keypoint.y), On(s2, 5, Qh, a2);
3828
+ } else {
3829
+ if (!e2.scribble) throw Error("Must provide either a keypoint or a scribble.");
3830
+ for (a2 of (o2 = new Jh(), e2.scribble)) Vn(e2 = new $h(), 3, true), Hn(e2, 1, a2.x), Hn(e2, 2, a2.y), Dn(o2, 1, $h, e2);
3831
+ On(s2, 15, Qh, o2);
3832
+ }
3833
+ Dn(r2, 1, Zh, s2), this.g.addProtoToStream(r2.g(), "drishti.RenderData", "roi_in", n2), eh(this, t2, i2);
3834
+ t: {
3835
+ try {
3836
+ const t3 = new Dh(this.confidenceMasks, this.categoryMask, this.qualityScores);
3837
+ if (!this.j) {
3838
+ var h2 = t3;
3839
+ break t;
3840
+ }
3841
+ this.j(t3);
3842
+ } finally {
3843
+ ia(this);
3844
+ }
3845
+ h2 = void 0;
3846
+ }
3847
+ return h2;
3848
+ }
3849
+ m() {
3850
+ var t2 = new Di();
3851
+ Ii(t2, "image_in"), Ii(t2, "roi_in"), Ii(t2, "norm_rect_in");
3852
+ const e2 = new yi();
3853
+ Wn(e2, So, this.h);
3854
+ const n2 = new Li();
3855
+ ki(n2, "mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"), xi(n2, "IMAGE:image_in"), xi(n2, "ROI:roi_in"), xi(n2, "NORM_RECT:norm_rect_in"), n2.o(e2), Oi(t2, n2), na(this, t2), this.outputConfidenceMasks && (Ui(t2, "confidence_masks"), Si(n2, "CONFIDENCE_MASKS:confidence_masks"), ra(this, "confidence_masks"), this.g.da("confidence_masks", ((t3, e3) => {
3856
+ this.confidenceMasks = t3.map(((t4) => rh(this, t4, true, !this.j))), ea(this, e3);
3857
+ })), this.g.attachEmptyPacketListener("confidence_masks", ((t3) => {
3858
+ this.confidenceMasks = [], ea(this, t3);
3859
+ }))), this.outputCategoryMask && (Ui(t2, "category_mask"), Si(n2, "CATEGORY_MASK:category_mask"), ra(this, "category_mask"), this.g.W("category_mask", ((t3, e3) => {
3860
+ this.categoryMask = rh(this, t3, false, !this.j), ea(this, e3);
3861
+ })), this.g.attachEmptyPacketListener("category_mask", ((t3) => {
3862
+ this.categoryMask = void 0, ea(this, t3);
3863
+ }))), Ui(t2, "quality_scores"), Si(n2, "QUALITY_SCORES:quality_scores"), this.g.attachFloatVectorListener("quality_scores", ((t3, e3) => {
3864
+ this.qualityScores = t3, ea(this, e3);
3865
+ })), this.g.attachEmptyPacketListener("quality_scores", ((t3) => {
3866
+ this.categoryMask = void 0, ea(this, t3);
3867
+ })), t2 = t2.g(), this.setGraph(new Uint8Array(t2), true);
3868
+ }
3869
+ };
3870
+ rc.prototype.segment = rc.prototype.ga, rc.prototype.setOptions = rc.prototype.o, rc.createFromModelPath = function(t2, e2) {
3871
+ return Qa(rc, t2, { baseOptions: { modelAssetPath: e2 } });
3872
+ }, rc.createFromModelBuffer = function(t2, e2) {
3873
+ return Qa(rc, t2, { baseOptions: { modelAssetBuffer: e2 } });
3874
+ }, rc.createFromOptions = function(t2, e2) {
3875
+ return Qa(rc, t2, e2);
3876
+ };
3877
+ var ic = class extends ih {
3878
+ constructor(t2, e2) {
3879
+ super(new Za(t2, e2), "input_frame_gpu", "norm_rect", false), this.j = { detections: [] }, Cn(t2 = this.h = new Lo(), 0, 1, e2 = new Cs());
3880
+ }
3881
+ get baseOptions() {
3882
+ return Rn(this.h, Cs, 1);
3883
+ }
3884
+ set baseOptions(t2) {
3885
+ Cn(this.h, 0, 1, t2);
3886
+ }
3887
+ o(t2) {
3888
+ return void 0 !== t2.displayNamesLocale ? dn(this.h, 2, Me(t2.displayNamesLocale)) : "displayNamesLocale" in t2 && dn(this.h, 2), void 0 !== t2.maxResults ? Xn(this.h, 3, t2.maxResults) : "maxResults" in t2 && dn(this.h, 3), void 0 !== t2.scoreThreshold ? Hn(this.h, 4, t2.scoreThreshold) : "scoreThreshold" in t2 && dn(this.h, 4), void 0 !== t2.categoryAllowlist ? Tn(this.h, 5, t2.categoryAllowlist) : "categoryAllowlist" in t2 && dn(this.h, 5), void 0 !== t2.categoryDenylist ? Tn(this.h, 6, t2.categoryDenylist) : "categoryDenylist" in t2 && dn(this.h, 6), this.l(t2);
3889
+ }
3890
+ F(t2, e2) {
3891
+ return this.j = { detections: [] }, eh(this, t2, e2), this.j;
3892
+ }
3893
+ G(t2, e2, n2) {
3894
+ return this.j = { detections: [] }, nh(this, t2, n2, e2), this.j;
3895
+ }
3896
+ m() {
3897
+ var t2 = new Di();
3898
+ Ii(t2, "input_frame_gpu"), Ii(t2, "norm_rect"), Ui(t2, "detections");
3899
+ const e2 = new yi();
3900
+ Wn(e2, Fo, this.h);
3901
+ const n2 = new Li();
3902
+ ki(n2, "mediapipe.tasks.vision.ObjectDetectorGraph"), xi(n2, "IMAGE:input_frame_gpu"), xi(n2, "NORM_RECT:norm_rect"), Si(n2, "DETECTIONS:detections"), n2.o(e2), Oi(t2, n2), this.g.attachProtoVectorListener("detections", ((t3, e3) => {
3903
+ for (const e4 of t3) t3 = ns(e4), this.j.detections.push(Oo(t3));
3904
+ ea(this, e3);
3905
+ })), this.g.attachEmptyPacketListener("detections", ((t3) => {
3906
+ ea(this, t3);
3907
+ })), t2 = t2.g(), this.setGraph(new Uint8Array(t2), true);
3908
+ }
3909
+ };
3910
+ ic.prototype.detectForVideo = ic.prototype.G, ic.prototype.detect = ic.prototype.F, ic.prototype.setOptions = ic.prototype.o, ic.createFromModelPath = async function(t2, e2) {
3911
+ return Qa(ic, t2, { baseOptions: { modelAssetPath: e2 } });
3912
+ }, ic.createFromModelBuffer = function(t2, e2) {
3913
+ return Qa(ic, t2, { baseOptions: { modelAssetBuffer: e2 } });
3914
+ }, ic.createFromOptions = function(t2, e2) {
3915
+ return Qa(ic, t2, e2);
3916
+ };
3917
+ var sc = class {
3918
+ constructor(t2, e2, n2) {
3919
+ this.landmarks = t2, this.worldLandmarks = e2, this.segmentationMasks = n2;
3920
+ }
3921
+ close() {
3922
+ this.segmentationMasks?.forEach(((t2) => {
3923
+ t2.close();
3924
+ }));
3925
+ }
3926
+ };
3927
+ function oc(t2) {
3928
+ t2.landmarks = [], t2.worldLandmarks = [], t2.segmentationMasks = void 0;
3929
+ }
3930
+ function ac(t2) {
3931
+ try {
3932
+ const e2 = new sc(t2.landmarks, t2.worldLandmarks, t2.segmentationMasks);
3933
+ if (!t2.j) return e2;
3934
+ t2.j(e2);
3935
+ } finally {
3936
+ ia(t2);
3937
+ }
3938
+ }
3939
+ sc.prototype.close = sc.prototype.close;
3940
+ var hc = class extends ih {
3941
+ constructor(t2, e2) {
3942
+ super(new Za(t2, e2), "image_in", "norm_rect", false), this.landmarks = [], this.worldLandmarks = [], this.outputSegmentationMasks = false, Cn(t2 = this.h = new Ro(), 0, 1, e2 = new Cs()), this.D = new go(), Cn(this.h, 0, 3, this.D), this.v = new fo(), Cn(this.h, 0, 2, this.v), Xn(this.v, 4, 1), Hn(this.v, 2, 0.5), Hn(this.D, 2, 0.5), Hn(this.h, 4, 0.5);
3943
+ }
3944
+ get baseOptions() {
3945
+ return Rn(this.h, Cs, 1);
3946
+ }
3947
+ set baseOptions(t2) {
3948
+ Cn(this.h, 0, 1, t2);
3949
+ }
3950
+ o(t2) {
3951
+ return "numPoses" in t2 && Xn(this.v, 4, t2.numPoses ?? 1), "minPoseDetectionConfidence" in t2 && Hn(this.v, 2, t2.minPoseDetectionConfidence ?? 0.5), "minTrackingConfidence" in t2 && Hn(this.h, 4, t2.minTrackingConfidence ?? 0.5), "minPosePresenceConfidence" in t2 && Hn(this.D, 2, t2.minPosePresenceConfidence ?? 0.5), "outputSegmentationMasks" in t2 && (this.outputSegmentationMasks = t2.outputSegmentationMasks ?? false), this.l(t2);
3952
+ }
3953
+ F(t2, e2, n2) {
3954
+ const r2 = "function" != typeof e2 ? e2 : {};
3955
+ return this.j = "function" == typeof e2 ? e2 : n2, oc(this), eh(this, t2, r2), ac(this);
3956
+ }
3957
+ G(t2, e2, n2, r2) {
3958
+ const i2 = "function" != typeof n2 ? n2 : {};
3959
+ return this.j = "function" == typeof n2 ? n2 : r2, oc(this), nh(this, t2, i2, e2), ac(this);
3960
+ }
3961
+ m() {
3962
+ var t2 = new Di();
3963
+ Ii(t2, "image_in"), Ii(t2, "norm_rect"), Ui(t2, "normalized_landmarks"), Ui(t2, "world_landmarks"), Ui(t2, "segmentation_masks");
3964
+ const e2 = new yi();
3965
+ Wn(e2, Mo, this.h);
3966
+ const n2 = new Li();
3967
+ ki(n2, "mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"), xi(n2, "IMAGE:image_in"), xi(n2, "NORM_RECT:norm_rect"), Si(n2, "NORM_LANDMARKS:normalized_landmarks"), Si(n2, "WORLD_LANDMARKS:world_landmarks"), n2.o(e2), Oi(t2, n2), na(this, t2), this.g.attachProtoVectorListener("normalized_landmarks", ((t3, e3) => {
3968
+ this.landmarks = [];
3969
+ for (const e4 of t3) t3 = us(e4), this.landmarks.push(Io(t3));
3970
+ ea(this, e3);
3971
+ })), this.g.attachEmptyPacketListener("normalized_landmarks", ((t3) => {
3972
+ this.landmarks = [], ea(this, t3);
3973
+ })), this.g.attachProtoVectorListener("world_landmarks", ((t3, e3) => {
3974
+ this.worldLandmarks = [];
3975
+ for (const e4 of t3) t3 = os(e4), this.worldLandmarks.push(Uo(t3));
3976
+ ea(this, e3);
3977
+ })), this.g.attachEmptyPacketListener("world_landmarks", ((t3) => {
3978
+ this.worldLandmarks = [], ea(this, t3);
3979
+ })), this.outputSegmentationMasks && (Si(n2, "SEGMENTATION_MASK:segmentation_masks"), ra(this, "segmentation_masks"), this.g.da("segmentation_masks", ((t3, e3) => {
3980
+ this.segmentationMasks = t3.map(((t4) => rh(this, t4, true, !this.j))), ea(this, e3);
3981
+ })), this.g.attachEmptyPacketListener("segmentation_masks", ((t3) => {
3982
+ this.segmentationMasks = [], ea(this, t3);
3983
+ }))), t2 = t2.g(), this.setGraph(new Uint8Array(t2), true);
3984
+ }
3985
+ };
3986
+ hc.prototype.detectForVideo = hc.prototype.G, hc.prototype.detect = hc.prototype.F, hc.prototype.setOptions = hc.prototype.o, hc.createFromModelPath = function(t2, e2) {
3987
+ return Qa(hc, t2, { baseOptions: { modelAssetPath: e2 } });
3988
+ }, hc.createFromModelBuffer = function(t2, e2) {
3989
+ return Qa(hc, t2, { baseOptions: { modelAssetBuffer: e2 } });
3990
+ }, hc.createFromOptions = function(t2, e2) {
3991
+ return Qa(hc, t2, e2);
3992
+ }, hc.POSE_CONNECTIONS = xh;
3993
+
3994
+ // src/segmenter.ts
3995
+ var WASM_DIR = "/mediakit/mp";
3996
+ var MODEL_URL = "/mediakit/selfie_segmenter.tflite";
3997
+ async function createSegmenter(canvas) {
3998
+ const fileset = await Xo.forVisionTasks(WASM_DIR);
3999
+ const segmenter = await Uh.createFromOptions(fileset, {
4000
+ baseOptions: {
4001
+ modelAssetPath: MODEL_URL,
4002
+ // MediaPipe's GPU delegate runs on WebGL2, which Chrome, Safari and Firefox all
4003
+ // have. That is why mediakit picked MediaPipe over ONNX Runtime Web at P1: ORT's
4004
+ // fast path is WebGPU, which Firefox only has on Windows.
4005
+ delegate: "GPU"
4006
+ },
4007
+ canvas,
4008
+ runningMode: "VIDEO",
4009
+ // Category mask, not a confidence mask. The values are category INDICES, so they need
4010
+ // normalising before they can act as alpha - MaskGain and MaskInvert in `core/graph.go`
4011
+ // do that.
4012
+ outputCategoryMask: true,
4013
+ outputConfidenceMasks: false
4014
+ });
4015
+ let pending = null;
4016
+ const release = () => {
4017
+ pending?.close();
4018
+ pending = null;
4019
+ };
4020
+ return {
4021
+ segment(frame, timestampMs) {
4022
+ release();
4023
+ let texture = null;
4024
+ segmenter.segmentForVideo(frame, timestampMs, (result) => {
4025
+ const mask = result.categoryMask;
4026
+ if (mask) texture = mask.getAsWebGLTexture();
4027
+ pending = result;
4028
+ });
4029
+ return texture;
4030
+ },
4031
+ release,
4032
+ close() {
4033
+ release();
4034
+ segmenter.close();
4035
+ }
4036
+ };
4037
+ }
4038
+
4039
+ // src/face.ts
4040
+ var WASM_DIR2 = "/mediakit/mp";
4041
+ var MODEL_URL2 = "/mediakit/face_landmarker.task";
4042
+ async function createFaceDetector(canvas) {
4043
+ const fileset = await Xo.forVisionTasks(WASM_DIR2);
4044
+ const landmarker = await yh.createFromOptions(fileset, {
4045
+ baseOptions: { modelAssetPath: MODEL_URL2, delegate: "GPU" },
4046
+ canvas,
4047
+ runningMode: "VIDEO",
4048
+ // One face: this is the user's own camera. More faces is more inference for a result
4049
+ // the layer above can only use one of.
4050
+ numFaces: 1,
4051
+ // No blendshapes and no transformation matrix - extra work for data nobody reads.
4052
+ outputFaceBlendshapes: false,
4053
+ outputFacialTransformationMatrixes: false
4054
+ });
4055
+ return {
4056
+ detect(frame, timestampMs, out) {
4057
+ const res = landmarker.detectForVideo(frame, timestampMs);
4058
+ const lm = res.faceLandmarks?.[0];
4059
+ if (!lm || lm.length === 0) return 0;
4060
+ const n2 = Math.min(lm.length * 3, out.length);
4061
+ for (let i2 = 0; i2 * 3 < n2; i2++) {
4062
+ const p2 = lm[i2];
4063
+ out[i2 * 3] = p2.x;
4064
+ out[i2 * 3 + 1] = p2.y;
4065
+ out[i2 * 3 + 2] = p2.z;
4066
+ }
4067
+ return n2;
4068
+ },
4069
+ close() {
4070
+ landmarker.close();
4071
+ }
4072
+ };
4073
+ }
4074
+
4075
+ // src/wasm.ts
4076
+ var WASM_URL = "/mediakit/mediakit.wasm";
4077
+ var EXEC_URL = "/mediakit/wasm_exec.js";
4078
+ var execLoaded = null;
4079
+ var compiled = null;
4080
+ function loadExec() {
4081
+ if (execLoaded) return execLoaded;
4082
+ execLoaded = (async () => {
4083
+ if (globalThis.Go) return;
4084
+ const workerLoad = globalThis.importScripts;
4085
+ if (typeof workerLoad === "function") {
4086
+ workerLoad.call(globalThis, EXEC_URL);
4087
+ } else if (typeof document === "undefined") {
4088
+ await import(
4089
+ /* webpackIgnore: true */
4090
+ EXEC_URL
4091
+ );
4092
+ } else {
4093
+ await new Promise((resolve, reject) => {
4094
+ const el = document.createElement("script");
4095
+ el.src = EXEC_URL;
4096
+ el.async = true;
4097
+ el.onload = () => resolve();
4098
+ el.onerror = () => reject(new Error(`mediakit: cannot load ${EXEC_URL}`));
4099
+ document.head.appendChild(el);
4100
+ });
4101
+ }
4102
+ if (!globalThis.Go) throw new Error("mediakit: wasm_exec.js did not define Go");
4103
+ })();
4104
+ return execLoaded;
4105
+ }
4106
+ function compileModule() {
4107
+ if (compiled) return compiled;
4108
+ compiled = (async () => {
4109
+ const res = await fetch(WASM_URL);
4110
+ if (!res.ok) {
4111
+ throw new Error(
4112
+ `mediakit: cannot load ${WASM_URL} (HTTP ${res.status}) - the host has to serve this package's dist/ under /mediakit/`
4113
+ );
4114
+ }
4115
+ return WebAssembly.compileStreaming(res);
4116
+ })();
4117
+ return compiled;
4118
+ }
4119
+ async function loadCore() {
4120
+ await loadExec();
4121
+ const mod = await compileModule();
4122
+ const Go2 = globalThis.Go;
4123
+ const go2 = new Go2();
4124
+ const instance = await WebAssembly.instantiate(mod, go2.importObject);
4125
+ return new Promise((resolve, reject) => {
4126
+ const timer = setTimeout(
4127
+ () => reject(new Error("mediakit: core did not attach within 10s")),
4128
+ 1e4
4129
+ );
4130
+ globalThis.__mediakitAttach = (core) => {
4131
+ clearTimeout(timer);
4132
+ delete globalThis.__mediakitAttach;
4133
+ resolve(core);
4134
+ };
4135
+ void go2.run(instance).catch((e2) => {
4136
+ clearTimeout(timer);
4137
+ reject(e2 instanceof Error ? e2 : new Error(String(e2)));
4138
+ });
4139
+ });
4140
+ }
4141
+ function splitMicros(us2) {
4142
+ const lo2 = us2 >>> 0;
4143
+ const hi2 = Math.floor(us2 / 2 ** 32);
4144
+ return [lo2, hi2 | 0];
4145
+ }
4146
+
4147
+ // src/recipe.ts
4148
+ var NO_EFFECTS = {
4149
+ beautify: 0,
4150
+ exposure: 0,
4151
+ contrast: 0,
4152
+ saturation: 0,
4153
+ warmth: 0,
4154
+ autoframe: false,
4155
+ teeth: 0,
4156
+ eyeBright: 0,
4157
+ underEye: 0,
4158
+ slimFace: 0,
4159
+ enlargeEyes: 0
4160
+ };
4161
+ var MODE_NONE = 0;
4162
+ var MODE_BLUR = 1;
4163
+ var MODE_IMAGE = 2;
4164
+ function backgroundMode(f2) {
4165
+ switch (f2.kind) {
4166
+ case "blur":
4167
+ return MODE_BLUR;
4168
+ case "image":
4169
+ return MODE_IMAGE;
4170
+ default:
4171
+ return MODE_NONE;
4172
+ }
4173
+ }
4174
+ function needsMask(f2, e2) {
4175
+ return f2.kind !== "none" || e2.beautify > 0 || e2.autoframe;
4176
+ }
4177
+ function needsFace(e2) {
4178
+ return e2.teeth > 0 || e2.eyeBright > 0 || e2.underEye > 0 || e2.slimFace > 0 || e2.enlargeEyes > 0;
4179
+ }
4180
+ function coreRecipe(f2, e2) {
4181
+ return {
4182
+ background: backgroundMode(f2),
4183
+ blurRadius: f2.kind === "blur" ? f2.blurRadius : 0,
4184
+ beautify: e2.beautify,
4185
+ exposure: e2.exposure,
4186
+ contrast: e2.contrast,
4187
+ saturation: e2.saturation,
4188
+ warmth: e2.warmth,
4189
+ autoframe: e2.autoframe,
4190
+ teeth: e2.teeth,
4191
+ eyeBright: e2.eyeBright,
4192
+ underEye: e2.underEye,
4193
+ slimFace: e2.slimFace,
4194
+ enlargeEyes: e2.enlargeEyes
4195
+ };
4196
+ }
4197
+
4198
+ // src/engine.ts
4199
+ var ZERO_STATS = {
4200
+ totalMs: 0,
4201
+ segMs: 0,
4202
+ glCalls: 0,
4203
+ segmented: false,
4204
+ maskScale: 1,
4205
+ workScale: 1,
4206
+ cropCX: 0.5,
4207
+ cropCY: 0.5,
4208
+ cropZoom: 1,
4209
+ needsMask: false,
4210
+ faceFound: false,
4211
+ faceSize: 0,
4212
+ needsFace: false
4213
+ };
4214
+ var Engine = class _Engine {
4215
+ canvas;
4216
+ gl;
4217
+ core;
4218
+ background = null;
4219
+ // The path the current bitmap came from, so a recipe change that leaves the background
4220
+ // alone does not refetch and re-crop it. Without this every slider input event while an
4221
+ // image background is on costs a fetch plus two createImageBitmap calls, which is a
4222
+ // visible stutter under a dragged finger and the exact case setRecipe exists to make cheap.
4223
+ backgroundPath = null;
4224
+ closed = false;
4225
+ /**
4226
+ * The segmenter loads LAZILY - only once a recipe actually needs a person mask.
4227
+ *
4228
+ * The MediaPipe runtime is ~9 MB of wasm plus a model. Someone who only wants a brighter
4229
+ * picture has no reason to download that.
4230
+ */
4231
+ segmenter = null;
4232
+ segmenterLoading = null;
4233
+ /**
4234
+ * The landmark detector, also lazy and independent of the segmenter.
4235
+ *
4236
+ * Its model is ~3.7 MB, fifteen times the segmentation one. Someone who only replaces
4237
+ * their background has no reason to download it, and the other way round.
4238
+ */
4239
+ face = null;
4240
+ faceLoading = null;
4241
+ lmBuf = null;
4242
+ filter = { kind: "none" };
4243
+ effects = NO_EFFECTS;
4244
+ // The PREVIOUS frame's measurements, fed to the governor for the next one. The governor
4245
+ // steers on past numbers because there is no way to know in advance what a frame will cost.
4246
+ prevTotalMs = 0;
4247
+ prevSegMs = 0;
4248
+ last = { ...ZERO_STATS };
4249
+ constructor(canvas, gl, core) {
4250
+ this.canvas = canvas;
4251
+ this.gl = gl;
4252
+ this.core = core;
4253
+ }
4254
+ /** Main thread: makes its own canvas. A worker calls `on` with an OffscreenCanvas. */
4255
+ static async create(width, height, filter, effects = NO_EFFECTS) {
4256
+ const canvas = document.createElement("canvas");
4257
+ canvas.width = width;
4258
+ canvas.height = height;
4259
+ return _Engine.on(canvas, filter, effects);
4260
+ }
4261
+ static async on(canvas, filter, effects = NO_EFFECTS) {
4262
+ const width = canvas.width;
4263
+ const height = canvas.height;
4264
+ const gl = canvas.getContext("webgl2", {
4265
+ alpha: false,
4266
+ premultipliedAlpha: false,
4267
+ antialias: false,
4268
+ depth: false,
4269
+ stencil: false
4270
+ });
4271
+ if (!gl) throw new Error("mediakit: no WebGL2 in this browser");
4272
+ let core;
4273
+ let engine2;
4274
+ try {
4275
+ core = await loadCore();
4276
+ const err = core.init(gl, width, height);
4277
+ if (err) throw new Error(`mediakit: ${err}`);
4278
+ engine2 = new _Engine(canvas, gl, core);
4279
+ await engine2.setRecipe(filter, effects);
4280
+ return engine2;
4281
+ } catch (err) {
4282
+ try {
4283
+ if (engine2) engine2.close();
4284
+ else {
4285
+ core?.close();
4286
+ gl.getExtension("WEBGL_lose_context")?.loseContext();
4287
+ }
4288
+ } catch {
4289
+ }
4290
+ throw err;
4291
+ }
4292
+ }
4293
+ get outputCanvas() {
4294
+ return this.canvas;
4295
+ }
4296
+ /** Change the recipe without rebuilding the pipeline, so dragging a slider does not flash. */
4297
+ async setRecipe(filter, effects = this.effects) {
4298
+ if (this.closed) return;
4299
+ this.filter = filter;
4300
+ this.effects = effects;
4301
+ if (filter.kind === "image" && filter.imagePath !== this.backgroundPath) {
4302
+ const bmp = await loadBitmap(filter.imagePath, this.canvas.width, this.canvas.height);
4303
+ if (this.closed) {
4304
+ bmp.close();
4305
+ return;
4306
+ }
4307
+ this.background?.close();
4308
+ this.background = bmp;
4309
+ this.backgroundPath = filter.imagePath;
4310
+ }
4311
+ this.core.setRecipe(coreRecipe(filter, effects));
4312
+ if (needsMask(filter, effects)) void this.ensureSegmenter();
4313
+ if (needsFace(effects)) void this.ensureFace();
4314
+ }
4315
+ ensureFace() {
4316
+ if (this.face || this.closed) return Promise.resolve();
4317
+ if (this.faceLoading) return this.faceLoading;
4318
+ this.faceLoading = createFaceDetector(this.canvas).then((f2) => {
4319
+ if (this.closed) {
4320
+ f2.close();
4321
+ return;
4322
+ }
4323
+ this.face = f2;
4324
+ this.lmBuf = this.core.faceBuffer();
4325
+ }).catch((e2) => {
4326
+ console.error("mediakit: face detector failed to load", e2);
4327
+ }).finally(() => {
4328
+ this.faceLoading = null;
4329
+ });
4330
+ return this.faceLoading;
4331
+ }
4332
+ ensureSegmenter() {
4333
+ if (this.segmenter || this.closed) return Promise.resolve();
4334
+ if (this.segmenterLoading) return this.segmenterLoading;
4335
+ this.segmenterLoading = createSegmenter(this.canvas).then((s2) => {
4336
+ if (this.closed) {
4337
+ s2.close();
4338
+ return;
4339
+ }
4340
+ this.segmenter = s2;
4341
+ }).catch((e2) => {
4342
+ console.error("mediakit: segmenter failed to load", e2);
4343
+ }).finally(() => {
4344
+ this.segmenterLoading = null;
4345
+ });
4346
+ return this.segmenterLoading;
4347
+ }
4348
+ /**
4349
+ * Draw one source frame onto the output canvas. `false` means nothing was drawn - no mask
4350
+ * yet, the segmenter is still loading, or the recipe is inactive; the transport must
4351
+ * forward the original frame rather than drop it.
4352
+ *
4353
+ * ── Why it takes `TexImageSource` and not just `VideoFrame` ───────────────────────
4354
+ * `texImage2D` accepts a `VideoFrame` and an `HTMLVideoElement` alike, and so does
4355
+ * MediaPipe. That is what lets the fallback transport (Firefox, and Safari before the
4356
+ * worker path) work with NO WebCodecs at all: it passes the `<video>` element straight in.
4357
+ *
4358
+ * LiveKit's reference implementation requires a `VideoFrame` even on its fallback path, so
4359
+ * it constructs one only to destroy it again.
4360
+ */
4361
+ render(source, timestampUs) {
4362
+ if (this.closed) return false;
4363
+ const t0 = performance.now();
4364
+ const [lo2, hi2] = splitMicros(timestampUs);
4365
+ const needSeg = this.core.decide(lo2, hi2, this.prevTotalMs, this.prevSegMs) === 1;
4366
+ let mask = null;
4367
+ let segMs = 0;
4368
+ if (needSeg) {
4369
+ if (!this.segmenter) {
4370
+ void this.ensureSegmenter();
4371
+ } else {
4372
+ const s0 = performance.now();
4373
+ mask = this.segmenter.segment(source, timestampUs / 1e3);
4374
+ segMs = performance.now() - s0;
4375
+ }
4376
+ }
4377
+ if (this.core.decideFace() === 1) {
4378
+ if (!this.face) {
4379
+ void this.ensureFace();
4380
+ } else if (this.lmBuf) {
4381
+ const n2 = this.face.detect(source, timestampUs / 1e3, this.lmBuf);
4382
+ this.core.setFace(lo2, hi2, n2);
4383
+ }
4384
+ }
4385
+ const glCalls = this.core.process(source, mask, this.background);
4386
+ if (mask) this.segmenter?.release();
4387
+ this.prevSegMs = segMs;
4388
+ this.prevTotalMs = performance.now() - t0;
4389
+ const s2 = this.core.stats();
4390
+ this.last = {
4391
+ totalMs: this.prevTotalMs,
4392
+ segMs,
4393
+ glCalls,
4394
+ segmented: needSeg && mask !== null,
4395
+ maskScale: s2 ? s2[1] : 1,
4396
+ workScale: s2 ? s2[2] : 1,
4397
+ cropCX: s2 ? s2[4] : 0.5,
4398
+ cropCY: s2 ? s2[5] : 0.5,
4399
+ cropZoom: s2 ? s2[6] : 1,
4400
+ needsMask: s2 ? s2[7] > 0.5 : false,
4401
+ faceFound: s2 ? s2[8] > 0.5 : false,
4402
+ faceSize: s2 ? s2[9] : 0,
4403
+ needsFace: s2 ? s2[10] > 0.5 : false
4404
+ };
4405
+ return glCalls > 0;
4406
+ }
4407
+ /**
4408
+ * Wrap the output canvas as a new VideoFrame.
4409
+ *
4410
+ * The timestamp is the SOURCE frame's, carried through unchanged. It is not rebuilt from
4411
+ * ticks: whole microseconds cannot represent a frame boundary at 30fps (a frame is
4412
+ * 33333.33 us), so every tick-to-microsecond round trip loses information. Ticks are only
4413
+ * for the governor and the graph to decide with. See the ToMicros comment in
4414
+ * `core/clock.go`.
4415
+ */
4416
+ capture(timestampUs) {
4417
+ return new VideoFrame(this.canvas, { timestamp: timestampUs, alpha: "discard" });
4418
+ }
4419
+ close() {
4420
+ if (this.closed) return;
4421
+ this.closed = true;
4422
+ this.segmenter?.close();
4423
+ this.segmenter = null;
4424
+ this.face?.close();
4425
+ this.face = null;
4426
+ this.lmBuf = null;
4427
+ this.core.close();
4428
+ this.background?.close();
4429
+ this.background = null;
4430
+ this.backgroundPath = null;
4431
+ this.gl.getExtension("WEBGL_lose_context")?.loseContext();
4432
+ }
4433
+ };
4434
+ async function decodeImage(path) {
4435
+ if (typeof Image === "undefined") {
4436
+ const res = await fetch(path);
4437
+ if (!res.ok) throw new Error(`mediakit: cannot load background image ${path} (HTTP ${res.status})`);
4438
+ const blob = await res.blob();
4439
+ try {
4440
+ return await createImageBitmap(blob);
4441
+ } catch (err) {
4442
+ if (blob.type.includes("svg")) {
4443
+ throw new Error(
4444
+ `mediakit: cannot decode the SVG background ${path} off the main thread - give this transport a raster image`
4445
+ );
4446
+ }
4447
+ throw err;
4448
+ }
4449
+ }
4450
+ const img = new Image();
4451
+ img.crossOrigin = "anonymous";
4452
+ await new Promise((resolve, reject) => {
4453
+ img.onload = () => resolve();
4454
+ img.onerror = () => reject(new Error(`mediakit: cannot load background image ${path}`));
4455
+ img.src = path;
4456
+ });
4457
+ if (!img.naturalWidth || !img.naturalHeight) {
4458
+ throw new Error(
4459
+ `mediakit: background image ${path} has no intrinsic size - an SVG needs width and height, a viewBox alone is not enough`
4460
+ );
4461
+ }
4462
+ return createImageBitmap(img);
4463
+ }
4464
+ async function loadBitmap(path, w2, h2) {
4465
+ const src = await decodeImage(path);
4466
+ if (src.width * h2 === src.height * w2) return src;
4467
+ const scale = Math.max(w2 / src.width, h2 / src.height);
4468
+ const cw = Math.min(src.width, Math.round(w2 / scale));
4469
+ const ch2 = Math.min(src.height, Math.round(h2 / scale));
4470
+ const out = await createImageBitmap(
4471
+ src,
4472
+ Math.round((src.width - cw) / 2),
4473
+ Math.round((src.height - ch2) / 2),
4474
+ cw,
4475
+ ch2,
4476
+ { resizeWidth: w2, resizeHeight: h2, resizeQuality: "high" }
4477
+ );
4478
+ src.close();
4479
+ return out;
4480
+ }
4481
+
4482
+ // src/worker/entry.ts
4483
+ var post = (m2) => self.postMessage(m2);
4484
+ var engine = null;
4485
+ var abort = null;
4486
+ async function start(m2) {
4487
+ const canvas = new OffscreenCanvas(m2.width, m2.height);
4488
+ engine = await Engine.on(canvas, m2.filter, m2.effects);
4489
+ abort = new AbortController();
4490
+ let n2 = 0;
4491
+ const transform = new TransformStream({
4492
+ transform: (frame, controller) => {
4493
+ const ts2 = frame.timestamp ?? 0;
4494
+ let drew = false;
4495
+ try {
4496
+ drew = engine?.render(frame, ts2) ?? false;
4497
+ } catch (e2) {
4498
+ post({ t: "error", message: e2 instanceof Error ? e2.message : String(e2) });
4499
+ }
4500
+ if (!drew || !engine) {
4501
+ controller.enqueue(frame);
4502
+ return;
4503
+ }
4504
+ controller.enqueue(engine.capture(ts2));
4505
+ frame.close();
4506
+ if (++n2 % 15 === 0) post({ t: "stats", stats: engine.last });
4507
+ }
4508
+ });
4509
+ post({ t: "ready" });
4510
+ void m2.readable.pipeThrough(transform, { signal: abort.signal }).pipeTo(m2.writable, { signal: abort.signal }).catch((e2) => {
4511
+ if (abort?.signal.aborted) return;
4512
+ post({ t: "error", message: e2 instanceof Error ? e2.message : String(e2) });
4513
+ });
4514
+ }
4515
+ function stop() {
4516
+ abort?.abort();
4517
+ abort = null;
4518
+ engine?.close();
4519
+ engine = null;
4520
+ }
4521
+ self.onmessage = (e2) => {
4522
+ const m2 = e2.data;
4523
+ try {
4524
+ if (m2.t === "start") {
4525
+ void start(m2).catch((err) => {
4526
+ post({ t: "error", message: err instanceof Error ? err.message : String(err) });
4527
+ });
4528
+ } else if (m2.t === "recipe") {
4529
+ void engine?.setRecipe(m2.filter, m2.effects ?? NO_EFFECTS);
4530
+ } else {
4531
+ stop();
4532
+ }
4533
+ } catch (err) {
4534
+ post({ t: "error", message: err instanceof Error ? err.message : String(err) });
4535
+ }
4536
+ };
4537
+ })();
4538
+ //# sourceMappingURL=worker.js.map