@monei-js/components 2.1.4 → 2.1.5

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.
Files changed (3) hide show
  1. package/dist/index.cjs +1883 -5
  2. package/dist/index.js +1883 -5
  3. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,6 +1,1255 @@
1
1
  import { t as __exportAll } from "./chunk.js";
2
- import { Thumbmark } from "@thumbmarkjs/thumbmarkjs";
3
- import { WindowMessenger, connect } from "penpal";
2
+ //#region ../../node_modules/.pnpm/@thumbmarkjs+thumbmarkjs@1.7.6/node_modules/@thumbmarkjs/thumbmarkjs/dist/thumbmark.esm.js
3
+ const e = 2592e5, t = "thumbmark", n = "https://api.thumbmarkjs.com", o = {
4
+ exclude: [],
5
+ include: [],
6
+ stabilize: ["private", "iframe"],
7
+ logging: !0,
8
+ timeout: 5e3,
9
+ cache_api_call: !0,
10
+ cache_lifetime_in_ms: 0,
11
+ performance: !1,
12
+ experimental: !1,
13
+ property_name_factory: (e) => `${t}_${e}`
14
+ };
15
+ ({ ...o });
16
+ const a = {
17
+ private: [
18
+ {
19
+ exclude: ["canvas"],
20
+ browsers: [
21
+ "firefox",
22
+ "safari>=17",
23
+ "brave"
24
+ ]
25
+ },
26
+ {
27
+ exclude: ["audio"],
28
+ browsers: ["samsungbrowser", "safari"]
29
+ },
30
+ {
31
+ exclude: ["fonts"],
32
+ browsers: ["firefox"]
33
+ },
34
+ {
35
+ exclude: [
36
+ "audio.sampleHash",
37
+ "hardware.deviceMemory",
38
+ "header.acceptLanguage.q",
39
+ "system.hardwareConcurrency",
40
+ "plugins"
41
+ ],
42
+ browsers: ["brave"]
43
+ },
44
+ {
45
+ exclude: ["tls.extensions"],
46
+ browsers: [
47
+ "firefox",
48
+ "chrome",
49
+ "safari"
50
+ ]
51
+ },
52
+ {
53
+ exclude: ["header.acceptLanguage"],
54
+ browsers: ["edge", "chrome"]
55
+ }
56
+ ],
57
+ iframe: [{
58
+ exclude: ["system.applePayVersion", "system.cookieEnabled"],
59
+ browsers: ["safari"]
60
+ }, { exclude: ["permissions"] }],
61
+ vpn: [{ exclude: ["ip"] }],
62
+ always: [{
63
+ exclude: ["speech"],
64
+ browsers: ["brave", "firefox"]
65
+ }]
66
+ }, s = "undefined" != typeof window ? window.OfflineAudioContext || window.webkitOfflineAudioContext : null;
67
+ function c(e) {
68
+ let t = 0;
69
+ for (let n = 0; n < e.length; ++n) t += Math.abs(e[n]);
70
+ return t;
71
+ }
72
+ function u(e, t, n) {
73
+ let o = [];
74
+ for (let t = 0; t < e[0].data.length; t++) {
75
+ let n = [];
76
+ for (let o = 0; o < e.length; o++) n.push(e[o].data[t]);
77
+ o.push(l(n));
78
+ }
79
+ const r = new Uint8ClampedArray(o);
80
+ return new ImageData(r, t, n);
81
+ }
82
+ function l(e) {
83
+ if (0 === e.length) return 0;
84
+ const t = {};
85
+ for (const n of e) t[n] = (t[n] || 0) + 1;
86
+ let n = e[0];
87
+ for (const e in t) t[e] > t[n] && (n = parseInt(e, 10));
88
+ return n;
89
+ }
90
+ function d(e) {
91
+ return e ^= e >>> 16, e = Math.imul(e, 2246822507), e ^= e >>> 13, e = Math.imul(e, 3266489909), (e ^= e >>> 16) >>> 0;
92
+ }
93
+ const m = new Uint32Array([
94
+ 597399067,
95
+ 2869860233,
96
+ 951274213,
97
+ 2716044179
98
+ ]);
99
+ function f(e, t) {
100
+ return e << t | e >>> 32 - t;
101
+ }
102
+ function p(e, t = 0) {
103
+ if (t = t ? 0 | t : 0, "string" == typeof e && (e = function(e) {
104
+ if ("undefined" != typeof TextEncoder) return new TextEncoder().encode(e).buffer;
105
+ const t = [];
106
+ for (let n = 0; n < e.length; n++) {
107
+ let o = e.charCodeAt(n);
108
+ o < 128 ? t.push(o) : o < 2048 ? t.push(192 | o >> 6, 128 | 63 & o) : o < 55296 || o >= 57344 ? t.push(224 | o >> 12, 128 | o >> 6 & 63, 128 | 63 & o) : (n++, o = 65536 + ((1023 & o) << 10 | 1023 & e.charCodeAt(n)), t.push(240 | o >> 18, 128 | o >> 12 & 63, 128 | o >> 6 & 63, 128 | 63 & o));
109
+ }
110
+ return new Uint8Array(t).buffer;
111
+ }(e)), !(e instanceof ArrayBuffer)) throw new TypeError("Expected key to be ArrayBuffer or string");
112
+ const n = new Uint32Array([
113
+ t,
114
+ t,
115
+ t,
116
+ t
117
+ ]);
118
+ (function(e, t) {
119
+ const n = e.byteLength / 16 | 0, o = new Uint32Array(e, 0, 4 * n);
120
+ for (let e = 0; e < n; e++) {
121
+ const n = o.subarray(4 * e, 4 * (e + 1));
122
+ n[0] = Math.imul(n[0], m[0]), n[0] = f(n[0], 15), n[0] = Math.imul(n[0], m[1]), t[0] = t[0] ^ n[0], t[0] = f(t[0], 19), t[0] = t[0] + t[1], t[0] = Math.imul(t[0], 5) + 1444728091, n[1] = Math.imul(n[1], m[1]), n[1] = f(n[1], 16), n[1] = Math.imul(n[1], m[2]), t[1] = t[1] ^ n[1], t[1] = f(t[1], 17), t[1] = t[1] + t[2], t[1] = Math.imul(t[1], 5) + 197830471, n[2] = Math.imul(n[2], m[2]), n[2] = f(n[2], 17), n[2] = Math.imul(n[2], m[3]), t[2] = t[2] ^ n[2], t[2] = f(t[2], 15), t[2] = t[2] + t[3], t[2] = Math.imul(t[2], 5) + 2530024501, n[3] = Math.imul(n[3], m[3]), n[3] = f(n[3], 18), n[3] = Math.imul(n[3], m[0]), t[3] = t[3] ^ n[3], t[3] = f(t[3], 13), t[3] = t[3] + t[0], t[3] = Math.imul(t[3], 5) + 850148119;
123
+ }
124
+ })(e, n), function(e, t) {
125
+ const n = e.byteLength / 16 | 0, o = e.byteLength % 16, r = new Uint32Array(4), i = new Uint8Array(e, 16 * n, o);
126
+ switch (o) {
127
+ case 15: r[3] = r[3] ^ i[14] << 16;
128
+ case 14: r[3] = r[3] ^ i[13] << 8;
129
+ case 13: r[3] = r[3] ^ i[12], r[3] = Math.imul(r[3], m[3]), r[3] = f(r[3], 18), r[3] = Math.imul(r[3], m[0]), t[3] = t[3] ^ r[3];
130
+ case 12: r[2] = r[2] ^ i[11] << 24;
131
+ case 11: r[2] = r[2] ^ i[10] << 16;
132
+ case 10: r[2] = r[2] ^ i[9] << 8;
133
+ case 9: r[2] = r[2] ^ i[8], r[2] = Math.imul(r[2], m[2]), r[2] = f(r[2], 17), r[2] = Math.imul(r[2], m[3]), t[2] = t[2] ^ r[2];
134
+ case 8: r[1] = r[1] ^ i[7] << 24;
135
+ case 7: r[1] = r[1] ^ i[6] << 16;
136
+ case 6: r[1] = r[1] ^ i[5] << 8;
137
+ case 5: r[1] = r[1] ^ i[4], r[1] = Math.imul(r[1], m[1]), r[1] = f(r[1], 16), r[1] = Math.imul(r[1], m[2]), t[1] = t[1] ^ r[1];
138
+ case 4: r[0] = r[0] ^ i[3] << 24;
139
+ case 3: r[0] = r[0] ^ i[2] << 16;
140
+ case 2: r[0] = r[0] ^ i[1] << 8;
141
+ case 1: r[0] = r[0] ^ i[0], r[0] = Math.imul(r[0], m[0]), r[0] = f(r[0], 15), r[0] = Math.imul(r[0], m[1]), t[0] = t[0] ^ r[0];
142
+ }
143
+ }(e, n), function(e, t) {
144
+ t[0] = t[0] ^ e.byteLength, t[1] = t[1] ^ e.byteLength, t[2] = t[2] ^ e.byteLength, t[3] = t[3] ^ e.byteLength, t[0] = t[0] + t[1] | 0, t[0] = t[0] + t[2] | 0, t[0] = t[0] + t[3] | 0, t[1] = t[1] + t[0] | 0, t[2] = t[2] + t[0] | 0, t[3] = t[3] + t[0] | 0, t[0] = d(t[0]), t[1] = d(t[1]), t[2] = d(t[2]), t[3] = d(t[3]), t[0] = t[0] + t[1] | 0, t[0] = t[0] + t[2] | 0, t[0] = t[0] + t[3] | 0, t[1] = t[1] + t[0] | 0, t[2] = t[2] + t[0] | 0, t[3] = t[3] + t[0] | 0;
145
+ }(e, n);
146
+ const o = new Uint8Array(n.buffer);
147
+ return Array.from(o).map(((e) => e.toString(16).padStart(2, "0"))).join("");
148
+ }
149
+ const h = 280;
150
+ async function g(e) {
151
+ for (var t; !document.body;) await w(50);
152
+ const n = document.createElement("iframe");
153
+ n.setAttribute("frameBorder", "0");
154
+ const o = n.style;
155
+ o.setProperty("position", "fixed"), o.setProperty("display", "block", "important"), o.setProperty("visibility", "visible"), o.setProperty("border", "0"), o.setProperty("opacity", "0"), n.src = "about:blank", document.body.appendChild(n);
156
+ const r = n.contentDocument || (null === (t = n.contentWindow) || void 0 === t ? void 0 : t.document);
157
+ if (!r) throw new Error("Iframe document is not accessible");
158
+ e({ iframe: r }), setTimeout((() => {
159
+ document.body.removeChild(n);
160
+ }), 0);
161
+ }
162
+ function w(e, t) {
163
+ return new Promise(((n) => setTimeout(n, e, t)));
164
+ }
165
+ const v = [
166
+ "Arial",
167
+ "Arial Black",
168
+ "Arial Narrow",
169
+ "Arial Rounded MT",
170
+ "Arimo",
171
+ "Archivo",
172
+ "Barlow",
173
+ "Bebas Neue",
174
+ "Bitter",
175
+ "Bookman",
176
+ "Calibri",
177
+ "Cabin",
178
+ "Candara",
179
+ "Century",
180
+ "Century Gothic",
181
+ "Comic Sans MS",
182
+ "Constantia",
183
+ "Courier",
184
+ "Courier New",
185
+ "Crimson Text",
186
+ "DM Mono",
187
+ "DM Sans",
188
+ "DM Serif Display",
189
+ "DM Serif Text",
190
+ "Dosis",
191
+ "Droid Sans",
192
+ "Exo",
193
+ "Fira Code",
194
+ "Fira Sans",
195
+ "Franklin Gothic Medium",
196
+ "Garamond",
197
+ "Geneva",
198
+ "Georgia",
199
+ "Gill Sans",
200
+ "Helvetica",
201
+ "Impact",
202
+ "Inconsolata",
203
+ "Indie Flower",
204
+ "Inter",
205
+ "Josefin Sans",
206
+ "Karla",
207
+ "Lato",
208
+ "Lexend",
209
+ "Lucida Bright",
210
+ "Lucida Console",
211
+ "Lucida Sans Unicode",
212
+ "Manrope",
213
+ "Merriweather",
214
+ "Merriweather Sans",
215
+ "Montserrat",
216
+ "Myriad",
217
+ "Noto Sans",
218
+ "Nunito",
219
+ "Nunito Sans",
220
+ "Open Sans",
221
+ "Optima",
222
+ "Orbitron",
223
+ "Oswald",
224
+ "Pacifico",
225
+ "Palatino",
226
+ "Perpetua",
227
+ "PT Sans",
228
+ "PT Serif",
229
+ "Poppins",
230
+ "Prompt",
231
+ "Public Sans",
232
+ "Quicksand",
233
+ "Rajdhani",
234
+ "Recursive",
235
+ "Roboto",
236
+ "Roboto Condensed",
237
+ "Rockwell",
238
+ "Rubik",
239
+ "Segoe Print",
240
+ "Segoe Script",
241
+ "Segoe UI",
242
+ "Sora",
243
+ "Source Sans Pro",
244
+ "Space Mono",
245
+ "Tahoma",
246
+ "Taviraj",
247
+ "Times",
248
+ "Times New Roman",
249
+ "Titillium Web",
250
+ "Trebuchet MS",
251
+ "Ubuntu",
252
+ "Varela Round",
253
+ "Verdana",
254
+ "Work Sans"
255
+ ], y = [
256
+ "monospace",
257
+ "sans-serif",
258
+ "serif"
259
+ ];
260
+ function S(e, t) {
261
+ return e.font = `72px ${t}`, e.measureText("WwMmLli0Oo").width;
262
+ }
263
+ function b() {
264
+ var e;
265
+ const t = document.createElement("canvas"), n = null !== (e = t.getContext("webgl")) && void 0 !== e ? e : t.getContext("experimental-webgl");
266
+ if (n && "getParameter" in n) try {
267
+ const e = (n.getParameter(n.VENDOR) || "").toString(), t = (n.getParameter(n.RENDERER) || "").toString();
268
+ let o = {
269
+ vendor: e,
270
+ renderer: t,
271
+ version: (n.getParameter(n.VERSION) || "").toString(),
272
+ shadingLanguageVersion: (n.getParameter(n.SHADING_LANGUAGE_VERSION) || "").toString()
273
+ };
274
+ if (!t.length || !e.length) {
275
+ const e = n.getExtension("WEBGL_debug_renderer_info");
276
+ if (e) {
277
+ const t = (n.getParameter(e.UNMASKED_VENDOR_WEBGL) || "").toString(), r = (n.getParameter(e.UNMASKED_RENDERER_WEBGL) || "").toString();
278
+ t && (o.vendorUnmasked = t), r && (o.rendererUnmasked = r);
279
+ }
280
+ }
281
+ return o;
282
+ } catch (e) {}
283
+ return "undefined";
284
+ }
285
+ function M() {
286
+ const e = new Float32Array(1), t = new Uint8Array(e.buffer);
287
+ return e[0] = Infinity, e[0] = e[0] - e[0], t[3];
288
+ }
289
+ const E = (e, t, n, o) => {
290
+ const r = (n - t) / o;
291
+ let i = 0;
292
+ for (let n = 0; n < o; n++) i += e(t + (n + .5) * r);
293
+ return i * r;
294
+ };
295
+ function P(e, t) {
296
+ const n = {};
297
+ return t.forEach(((t) => {
298
+ const o = function(e) {
299
+ if (0 === e.length) return null;
300
+ const t = {};
301
+ e.forEach(((e) => {
302
+ const n = String(e);
303
+ t[n] = (t[n] || 0) + 1;
304
+ }));
305
+ let n = e[0], o = 1;
306
+ return Object.keys(t).forEach(((e) => {
307
+ t[e] > o && (n = e, o = t[e]);
308
+ })), n;
309
+ }(e.map(((e) => t in e ? e[t] : void 0)).filter(((e) => void 0 !== e)));
310
+ o && (n[t] = o);
311
+ })), n;
312
+ }
313
+ const x = [
314
+ "accelerometer",
315
+ "accessibility",
316
+ "accessibility-events",
317
+ "ambient-light-sensor",
318
+ "background-fetch",
319
+ "background-sync",
320
+ "bluetooth",
321
+ "camera",
322
+ "clipboard-read",
323
+ "clipboard-write",
324
+ "device-info",
325
+ "display-capture",
326
+ "gyroscope",
327
+ "geolocation",
328
+ "local-fonts",
329
+ "magnetometer",
330
+ "microphone",
331
+ "midi",
332
+ "nfc",
333
+ "notifications",
334
+ "payment-handler",
335
+ "persistent-storage",
336
+ "push",
337
+ "speaker",
338
+ "storage-access",
339
+ "top-level-storage-access",
340
+ "window-management",
341
+ "query"
342
+ ];
343
+ function C() {
344
+ if ("undefined" == typeof navigator) return {
345
+ name: "unknown",
346
+ version: "unknown"
347
+ };
348
+ const e = [{
349
+ name: "Brave",
350
+ detect: () => !!navigator.brave
351
+ }];
352
+ for (const t of e) if (t.detect()) {
353
+ const e = A(navigator.userAgent);
354
+ return {
355
+ name: t.name,
356
+ version: e.version
357
+ };
358
+ }
359
+ return A(navigator.userAgent);
360
+ }
361
+ function A(e) {
362
+ var t, n, o, r, i, a;
363
+ const s = [
364
+ /(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)+)/,
365
+ /(?<name>EdgA|EdgiOS|Edg)\/(?<version>\d+(?:\.\d+)+)/,
366
+ /(?<name>OPR|OPX)\/(?<version>\d+(?:\.\d+)+)/,
367
+ /Opera[\s\/](?<version>\d+(?:\.\d+)+)/,
368
+ /Opera Mini\/(?<version>\d+(?:\.\d+)+)/,
369
+ /Opera Mobi\/(?<version>\d+(?:\.\d+)+)/,
370
+ /(?<name>Vivaldi)\/(?<version>\d+(?:\.\d+)+)/,
371
+ /(?<name>CriOS)\/(?<version>\d+(?:\.\d+)+)/,
372
+ /(?<name>FxiOS)\/(?<version>\d+(?:\.\d+)+)/,
373
+ /(?<name>Chrome|Chromium)\/(?<version>\d+(?:\.\d+)+)/,
374
+ /(?<name>Firefox|Waterfox|Iceweasel|IceCat)\/(?<version>\d+(?:\.\d+)+)/,
375
+ /Version\/(?<version1>[\d.]+).*Safari\/[\d.]+|(?<name>Safari)\/(?<version2>[\d.]+)/,
376
+ /(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)+)/,
377
+ /(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)+)/
378
+ ], c = {
379
+ edg: "Edge",
380
+ edga: "Edge",
381
+ edgios: "Edge",
382
+ opr: "Opera",
383
+ opx: "Opera",
384
+ crios: "Chrome",
385
+ fxios: "Firefox",
386
+ samsung: "SamsungBrowser",
387
+ vivaldi: "Vivaldi"
388
+ };
389
+ for (const u of s) {
390
+ const s = e.match(u);
391
+ if (s) {
392
+ let e = null === (t = s.groups) || void 0 === t ? void 0 : t.name, l = (null === (n = s.groups) || void 0 === n ? void 0 : n.version) || (null === (o = s.groups) || void 0 === o ? void 0 : o.version1) || (null === (r = s.groups) || void 0 === r ? void 0 : r.version2);
393
+ if (e || !(null === (i = s.groups) || void 0 === i ? void 0 : i.version1) && !(null === (a = s.groups) || void 0 === a ? void 0 : a.version2) || (e = "Safari"), !e && u.source.includes("Opera Mini") && (e = "Opera Mini"), !e && u.source.includes("Opera Mobi") && (e = "Opera Mobi"), !e && u.source.includes("Opera") && (e = "Opera"), !e && s[1] && (e = s[1]), !l && s[2] && (l = s[2]), e) return {
394
+ name: c[e.toLowerCase()] || e,
395
+ version: l || "unknown"
396
+ };
397
+ }
398
+ }
399
+ return {
400
+ name: "unknown",
401
+ version: "unknown"
402
+ };
403
+ }
404
+ function _() {
405
+ if ("undefined" == typeof navigator || !navigator.userAgent) return !1;
406
+ const e = navigator.userAgent;
407
+ return /Mobi|Android|iPhone|iPod|IEMobile|Opera Mini|Opera Mobi|webOS|BlackBerry|Windows Phone/i.test(e) && !/iPad/i.test(e);
408
+ }
409
+ function T() {
410
+ let e = [];
411
+ const t = {
412
+ "prefers-contrast": [
413
+ "high",
414
+ "more",
415
+ "low",
416
+ "less",
417
+ "forced",
418
+ "no-preference"
419
+ ],
420
+ "any-hover": ["hover", "none"],
421
+ "any-pointer": [
422
+ "none",
423
+ "coarse",
424
+ "fine"
425
+ ],
426
+ pointer: [
427
+ "none",
428
+ "coarse",
429
+ "fine"
430
+ ],
431
+ hover: ["hover", "none"],
432
+ update: ["fast", "slow"],
433
+ "inverted-colors": ["inverted", "none"],
434
+ "prefers-reduced-motion": ["reduce", "no-preference"],
435
+ "prefers-reduced-transparency": ["reduce", "no-preference"],
436
+ scripting: [
437
+ "none",
438
+ "initial-only",
439
+ "enabled"
440
+ ],
441
+ "forced-colors": ["active", "none"]
442
+ };
443
+ return Object.keys(t).forEach(((n) => {
444
+ t[n].forEach(((t) => {
445
+ matchMedia(`(${n}: ${t})`).matches && e.push(`${n}: ${t}`);
446
+ }));
447
+ })), e;
448
+ }
449
+ function k() {
450
+ if ("https:" === window.location.protocol && "function" == typeof window.ApplePaySession) try {
451
+ const e = window.ApplePaySession.supportsVersion;
452
+ for (let t = 15; t > 0; t--) if (e(t)) return t;
453
+ } catch (e) {
454
+ return 0;
455
+ }
456
+ return 0;
457
+ }
458
+ const R = "SamsungBrowser" !== C().name ? 1 : 3;
459
+ let I, O = null;
460
+ function L(e) {
461
+ const t = [];
462
+ return function e(n) {
463
+ if (n && n.toJSON && "function" == typeof n.toJSON && (n = n.toJSON()), void 0 === n) return;
464
+ if ("number" == typeof n) return isFinite(n) ? "" + n : "null";
465
+ if ("object" != typeof n) return JSON.stringify(n);
466
+ let o, r;
467
+ if (Array.isArray(n)) {
468
+ for (r = "[", o = 0; o < n.length; o++) o && (r += ","), r += e(n[o]) || "null";
469
+ return r + "]";
470
+ }
471
+ if (null === n) return "null";
472
+ if (-1 !== t.indexOf(n)) throw new TypeError("Converting circular structure to JSON");
473
+ const i = t.push(n) - 1, a = Object.keys(n).sort();
474
+ for (r = "", o = 0; o < a.length; o++) {
475
+ const t = a[o], i = e(n[t]);
476
+ i && (r && (r += ","), r += JSON.stringify(t) + ":" + i);
477
+ }
478
+ return t.splice(i, 1), "{" + r + "}";
479
+ }(e) || "";
480
+ }
481
+ const B = [
482
+ "𝔄",
483
+ "𝔅",
484
+ "ℭ",
485
+ "𝔇",
486
+ "𝔈",
487
+ "𝔉",
488
+ "𝔸",
489
+ "𝔹",
490
+ "ℂ",
491
+ "𝔻",
492
+ "𝔼",
493
+ "𝔽"
494
+ ], N = [
495
+ "β",
496
+ "ψ",
497
+ "λ",
498
+ "ε",
499
+ "ζ",
500
+ "α",
501
+ "ξ",
502
+ "μ",
503
+ "ρ",
504
+ "φ",
505
+ "κ",
506
+ "τ",
507
+ "η",
508
+ "σ",
509
+ "ι",
510
+ "ω",
511
+ "γ",
512
+ "ν",
513
+ "χ",
514
+ "δ",
515
+ "θ",
516
+ "π",
517
+ "υ",
518
+ "ο"
519
+ ];
520
+ function $(e, t) {
521
+ return `<math><mrow>${t}</mrow></math>`;
522
+ }
523
+ function D() {
524
+ let e = "<mo>∏</mo>";
525
+ return B.forEach(((t, n) => {
526
+ const o = 2 * n, r = N.slice(o, o + 2);
527
+ 2 === r.length && (e += `<mmultiscripts><mi>${t}</mi><none/><mi>${r[1]}</mi><mprescripts></mprescripts><mi>${r[0]}</mi><none/></mmultiscripts>`);
528
+ })), $(0, `<munderover><mmultiscripts>${e}</mmultiscripts></munderover>`);
529
+ }
530
+ function F() {
531
+ const e = [];
532
+ return B.forEach(((t, n) => {
533
+ const o = 2 * n, r = N.slice(o, o + 2);
534
+ 2 === r.length && e.push($(0, `<mmultiscripts><mi>${t}</mi><none/><mi>${r[1]}</mi><mprescripts></mprescripts><mi>${r[0]}</mi><none/></mmultiscripts>`));
535
+ })), e;
536
+ }
537
+ const U = {
538
+ audio: async function() {
539
+ return s ? async function() {
540
+ return new Promise(((e, t) => {
541
+ try {
542
+ const t = new s(1, 5e3, 44100), n = t.createBufferSource(), o = t.createOscillator();
543
+ o.frequency.value = 1e3;
544
+ const r = t.createDynamicsCompressor();
545
+ let i;
546
+ r.threshold.value = -50, r.knee.value = 40, r.ratio.value = 12, r.attack.value = 0, r.release.value = .2, o.connect(r), r.connect(t.destination), o.start(), t.oncomplete = (o) => {
547
+ i = o.renderedBuffer.getChannelData(0), e({
548
+ sampleHash: c(i),
549
+ maxChannels: t.destination.maxChannelCount,
550
+ channelCountMode: n.channelCountMode
551
+ });
552
+ }, t.startRendering();
553
+ } catch (e) {
554
+ console.error("Error creating audio fingerprint:", e), t(e);
555
+ }
556
+ }));
557
+ }() : null;
558
+ },
559
+ canvas: async function() {
560
+ return new Promise(((e) => {
561
+ const t = Array.from({ length: 3 }, (() => function() {
562
+ const e = document.createElement("canvas"), t = e.getContext("2d");
563
+ if (!t) return null;
564
+ e.width = h, e.height = 20;
565
+ const n = t.createLinearGradient(0, 0, e.width, e.height);
566
+ n.addColorStop(0, "red"), n.addColorStop(1 / 6, "orange"), n.addColorStop(2 / 6, "yellow"), n.addColorStop(.5, "green"), n.addColorStop(4 / 6, "blue"), n.addColorStop(5 / 6, "indigo"), n.addColorStop(1, "violet"), t.fillStyle = n, t.fillRect(0, 0, e.width, e.height);
567
+ const o = "Random Text WMwmil10Oo";
568
+ t.font = "23.123px Arial", t.fillStyle = "black", t.fillText(o, -5, 15), t.fillStyle = "rgba(0, 0, 255, 0.5)", t.fillText(o, -3.3, 17.7), t.beginPath(), t.moveTo(0, 0), t.lineTo(2 * e.width / 7, e.height), t.strokeStyle = "white", t.lineWidth = 2, t.stroke();
569
+ return t.getImageData(0, 0, e.width, e.height);
570
+ }())).filter(((e) => null !== e));
571
+ 0 !== t.length ? e({ commonPixelsHash: p(u(t, h, 20).data.toString()).toString() }) : e(null);
572
+ }));
573
+ },
574
+ fonts: async function(e) {
575
+ return new Promise(((e) => {
576
+ try {
577
+ g((async ({ iframe: t }) => {
578
+ const n = t.createElement("canvas").getContext("2d");
579
+ if (!n) return void e(null);
580
+ const o = y.map(((e) => S(n, e)));
581
+ let r = {};
582
+ v.forEach(((e) => {
583
+ const t = S(n, e);
584
+ o.includes(t) || (r[e] = t);
585
+ })), e(r);
586
+ }));
587
+ } catch (t) {
588
+ e(null);
589
+ }
590
+ }));
591
+ },
592
+ hardware: function() {
593
+ return new Promise(((e, t) => {
594
+ const n = void 0 !== navigator.deviceMemory ? navigator.deviceMemory : 0, o = window.performance && window.performance.memory ? window.performance.memory : 0;
595
+ e({
596
+ videocard: b(),
597
+ architecture: M(),
598
+ deviceMemory: n.toString() || "undefined",
599
+ jsHeapSizeLimit: o.jsHeapSizeLimit || 0
600
+ });
601
+ }));
602
+ },
603
+ locales: function() {
604
+ return new Promise(((e) => {
605
+ e({
606
+ languages: navigator.language,
607
+ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
608
+ });
609
+ }));
610
+ },
611
+ math: function() {
612
+ return new Promise(((e) => {
613
+ e({
614
+ acos: Math.acos(.5),
615
+ asin: E(Math.asin, -1, 1, 97),
616
+ cos: E(Math.cos, 0, Math.PI, 97),
617
+ largeCos: Math.cos(0x56bc75e2d63100000),
618
+ largeSin: Math.sin(0x56bc75e2d63100000),
619
+ largeTan: Math.tan(0x56bc75e2d63100000),
620
+ sin: E(Math.sin, -Math.PI, Math.PI, 97),
621
+ tan: E(Math.tan, 0, 2 * Math.PI, 97)
622
+ });
623
+ }));
624
+ },
625
+ permissions: async function(e) {
626
+ const t = (null == e ? void 0 : e.permissions_to_check) || x;
627
+ return P(await Promise.all(Array.from({ length: 3 }, (() => async function(e) {
628
+ const t = {};
629
+ for (const n of e) try {
630
+ t[n] = (await navigator.permissions.query({ name: n })).state.toString();
631
+ } catch (e) {}
632
+ return t;
633
+ }(t)))), t);
634
+ },
635
+ plugins: async function() {
636
+ const e = [];
637
+ if (navigator.plugins) for (let t = 0; t < navigator.plugins.length; t++) {
638
+ const n = navigator.plugins[t];
639
+ e.push([
640
+ n.name,
641
+ n.filename,
642
+ n.description
643
+ ].join("|"));
644
+ }
645
+ return new Promise(((t) => {
646
+ t({ plugins: e });
647
+ }));
648
+ },
649
+ screen: function() {
650
+ return new Promise(((e) => {
651
+ if ("undefined" == typeof matchMedia || "undefined" == typeof screen) return void e(null);
652
+ const t = {
653
+ is_touchscreen: navigator.maxTouchPoints > 0,
654
+ maxTouchPoints: navigator.maxTouchPoints,
655
+ colorDepth: screen.colorDepth,
656
+ mediaMatches: T()
657
+ };
658
+ _() && navigator.maxTouchPoints > 0 && (t.resolution = function() {
659
+ const e = window.screen.width, t = window.screen.height;
660
+ return `${Math.max(e, t).toString()}x${Math.min(e, t).toString()}`;
661
+ }()), e(t);
662
+ }));
663
+ },
664
+ system: function() {
665
+ return new Promise(((e) => {
666
+ const t = C();
667
+ e({
668
+ platform: window.navigator.platform,
669
+ productSub: navigator.productSub,
670
+ product: navigator.product,
671
+ useragent: navigator.userAgent,
672
+ hardwareConcurrency: navigator.hardwareConcurrency,
673
+ browser: {
674
+ name: t.name,
675
+ version: t.version
676
+ },
677
+ mobile: _(),
678
+ applePayVersion: k(),
679
+ cookieEnabled: window.navigator.cookieEnabled
680
+ });
681
+ }));
682
+ },
683
+ webgl: async function() {
684
+ "undefined" != typeof document && (I = document.createElement("canvas"), I.width = 200, I.height = 100, O = I.getContext("webgl"));
685
+ try {
686
+ if (!O) throw new Error("WebGL not supported");
687
+ return { commonPixelsHash: p(u(Array.from({ length: R }, (() => function() {
688
+ try {
689
+ if (!O) throw new Error("WebGL not supported");
690
+ const e = "\n attribute vec2 position;\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n }\n ", t = "\n precision mediump float;\n void main() {\n gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color\n }\n ", n = O.createShader(O.VERTEX_SHADER), o = O.createShader(O.FRAGMENT_SHADER);
691
+ if (!n || !o) throw new Error("Failed to create shaders");
692
+ if (O.shaderSource(n, e), O.shaderSource(o, t), O.compileShader(n), !O.getShaderParameter(n, O.COMPILE_STATUS)) throw new Error("Vertex shader compilation failed: " + O.getShaderInfoLog(n));
693
+ if (O.compileShader(o), !O.getShaderParameter(o, O.COMPILE_STATUS)) throw new Error("Fragment shader compilation failed: " + O.getShaderInfoLog(o));
694
+ const r = O.createProgram();
695
+ if (!r) throw new Error("Failed to create shader program");
696
+ if (O.attachShader(r, n), O.attachShader(r, o), O.linkProgram(r), !O.getProgramParameter(r, O.LINK_STATUS)) throw new Error("Shader program linking failed: " + O.getProgramInfoLog(r));
697
+ O.useProgram(r);
698
+ const i = 137, a = new Float32Array(4 * i), s = 2 * Math.PI / i;
699
+ for (let e = 0; e < i; e++) {
700
+ const t = e * s;
701
+ a[4 * e] = 0, a[4 * e + 1] = 0, a[4 * e + 2] = Math.cos(t) * (I.width / 2), a[4 * e + 3] = Math.sin(t) * (I.height / 2);
702
+ }
703
+ const c = O.createBuffer();
704
+ O.bindBuffer(O.ARRAY_BUFFER, c), O.bufferData(O.ARRAY_BUFFER, a, O.STATIC_DRAW);
705
+ const u = O.getAttribLocation(r, "position");
706
+ O.enableVertexAttribArray(u), O.vertexAttribPointer(u, 2, O.FLOAT, !1, 0, 0), O.viewport(0, 0, I.width, I.height), O.clearColor(0, 0, 0, 1), O.clear(O.COLOR_BUFFER_BIT), O.drawArrays(O.LINES, 0, 2 * i);
707
+ const l = new Uint8ClampedArray(I.width * I.height * 4);
708
+ O.readPixels(0, 0, I.width, I.height, O.RGBA, O.UNSIGNED_BYTE, l);
709
+ return new ImageData(l, I.width, I.height);
710
+ } catch (e) {
711
+ return new ImageData(1, 1);
712
+ } finally {
713
+ O && (O.bindBuffer(O.ARRAY_BUFFER, null), O.useProgram(null), O.viewport(0, 0, O.drawingBufferWidth, O.drawingBufferHeight), O.clearColor(0, 0, 0, 0));
714
+ }
715
+ }())), I.width, I.height).data.toString()).toString() };
716
+ } catch (e) {
717
+ return { webgl: "unsupported" };
718
+ }
719
+ },
720
+ webrtc: async function(e) {
721
+ return new Promise(((t) => {
722
+ try {
723
+ const n = window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection;
724
+ if (!n) return void t({
725
+ supported: !1,
726
+ error: "WebRTC not supported"
727
+ });
728
+ const o = new n({
729
+ iceCandidatePoolSize: 1,
730
+ iceServers: []
731
+ });
732
+ o.createDataChannel("");
733
+ (async () => {
734
+ try {
735
+ const r = await o.createOffer({
736
+ offerToReceiveAudio: !0,
737
+ offerToReceiveVideo: !0
738
+ });
739
+ await o.setLocalDescription(r);
740
+ const i = r.sdp || "", a = [...new Set((i.match(/extmap:\d+ [^\n\r]+/g) || []).map(((e) => e.replace(/extmap:\d+ /, ""))))].sort(), s = (e) => {
741
+ const t = i.match(new RegExp(`m=${e} [^\\s]+ [^\\s]+ ([^\\n\\r]+)`));
742
+ return t ? t[1].split(" ") : [];
743
+ }, c = (e, t) => t.map(((t) => {
744
+ const n = new RegExp(`(rtpmap|fmtp|rtcp-fb):${t} (.+)`, "g"), o = [...i.matchAll(n)];
745
+ if (!o.length) return null;
746
+ const r = {};
747
+ return o.forEach(((t) => {
748
+ const [n, o, i] = t, a = i.split("/");
749
+ "rtpmap" === o ? (r.mimeType = `${e}/${a[0]}`, r.clockRate = +a[1], "audio" === e && (r.channels = +a[2] || 1)) : "rtcp-fb" === o ? (r.feedbackSupport = r.feedbackSupport || [], r.feedbackSupport.push(i)) : "fmtp" === o && (r.sdpFmtpLine = i);
750
+ })), r;
751
+ })).filter(Boolean), u = c("audio", s("audio")), l = c("video", s("video")), d = {
752
+ audio: {
753
+ count: u.length,
754
+ hash: p(L(u))
755
+ },
756
+ video: {
757
+ count: l.length,
758
+ hash: p(L(l))
759
+ },
760
+ extensionsHash: p(L(a))
761
+ }, m = (null == e ? void 0 : e.timeout) || 5e3, f = Math.floor(.9 * m), h = await new Promise(((e) => {
762
+ const t = setTimeout((() => {
763
+ o.removeEventListener("icecandidate", n), o.close(), e({
764
+ supported: !0,
765
+ ...d,
766
+ timeout: !0
767
+ });
768
+ }), f), n = (r) => {
769
+ const i = r.candidate;
770
+ i && i.candidate && (clearTimeout(t), o.removeEventListener("icecandidate", n), o.close(), e({
771
+ supported: !0,
772
+ ...d,
773
+ candidateType: i.type || ""
774
+ }));
775
+ };
776
+ o.addEventListener("icecandidate", n);
777
+ }));
778
+ t({
779
+ details: h,
780
+ hash: p(L(h))
781
+ });
782
+ } catch (e) {
783
+ o.close(), t({
784
+ supported: !0,
785
+ error: `WebRTC offer failed: ${e.message}`
786
+ });
787
+ }
788
+ })();
789
+ } catch (e) {
790
+ t({
791
+ supported: !1,
792
+ error: `WebRTC error: ${e.message}`
793
+ });
794
+ }
795
+ }));
796
+ },
797
+ speech: async function() {
798
+ return new Promise(((e) => {
799
+ try {
800
+ if ("undefined" == typeof window || !window.speechSynthesis || "function" != typeof window.speechSynthesis.getVoices) return void e({
801
+ supported: !1,
802
+ error: "Speech Synthesis API not supported"
803
+ });
804
+ let t = !1, n = null;
805
+ const o = (o) => {
806
+ if (!t) {
807
+ t = !0, n && clearTimeout(n);
808
+ try {
809
+ const t = o.map(((e) => {
810
+ const t = (e) => e.replace(/\\/g, "\\\\").replace(/,/g, "\\,");
811
+ return [
812
+ t(e.voiceURI || ""),
813
+ t(e.name || ""),
814
+ t(e.lang || ""),
815
+ e.localService ? "1" : "0",
816
+ e.default ? "1" : "0"
817
+ ].join(",");
818
+ }));
819
+ t.sort();
820
+ const n = {
821
+ voiceCount: o.length,
822
+ voicesHash: p(L(t))
823
+ };
824
+ e({
825
+ details: n,
826
+ hash: p(L(n))
827
+ });
828
+ } catch (t) {
829
+ e({
830
+ supported: !0,
831
+ error: `Voice processing failed: ${t.message}`
832
+ });
833
+ }
834
+ }
835
+ }, r = window.speechSynthesis.getVoices();
836
+ if (r.length > 0) return void o(r);
837
+ n = setTimeout((() => {
838
+ o(window.speechSynthesis.getVoices());
839
+ }), 800);
840
+ const i = () => {
841
+ window.speechSynthesis.removeEventListener("voiceschanged", i);
842
+ o(window.speechSynthesis.getVoices());
843
+ };
844
+ window.speechSynthesis.addEventListener("voiceschanged", i);
845
+ } catch (t) {
846
+ e({
847
+ supported: !1,
848
+ error: `Speech Synthesis error: ${t.message}`
849
+ });
850
+ }
851
+ }));
852
+ }
853
+ }, V = { mathml: async function() {
854
+ return new Promise(((e) => {
855
+ try {
856
+ g((async ({ iframe: t }) => {
857
+ try {
858
+ if (!function(e) {
859
+ try {
860
+ const t = e.createElement("math");
861
+ t.innerHTML = "<mrow><mi>x</mi></mrow>", t.style.position = "absolute", t.style.visibility = "hidden", e.body.appendChild(t);
862
+ const n = t.getBoundingClientRect();
863
+ return e.body.removeChild(t), n.width > 0 && n.height > 0;
864
+ } catch (e) {
865
+ return !1;
866
+ }
867
+ }(t)) return void e({
868
+ supported: !1,
869
+ error: "MathML not supported"
870
+ });
871
+ const n = [
872
+ $("integral", "<msubsup><mo>∫</mo><mi>a</mi><mi>b</mi></msubsup><mfrac><mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow><mrow><mi>g</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow></mfrac><mi>dx</mi>"),
873
+ $("fraction", "<mfrac><mrow><mi>π</mi><mo>×</mo><msup><mi>r</mi><mn>2</mn></msup></mrow><mrow><mn>2</mn><mi>σ</mi></mrow></mfrac>"),
874
+ $("matrix", "<mo>[</mo><mtable><mtr><mtd><mi>α</mi></mtd><mtd><mi>β</mi></mtd></mtr><mtr><mtd><mi>γ</mi></mtd><mtd><mi>δ</mi></mtd></mtr></mtable><mo>]</mo>"),
875
+ D(),
876
+ ...F()
877
+ ], o = [];
878
+ let r = "";
879
+ n.forEach(((e, n) => {
880
+ const i = function(e, t) {
881
+ try {
882
+ const n = t.createElement("math");
883
+ n.innerHTML = e.replace(/<\/?math>/g, ""), n.style.whiteSpace = "nowrap", n.style.position = "absolute", n.style.visibility = "hidden", n.style.top = "-9999px", t.body.appendChild(n);
884
+ const o = n.getBoundingClientRect(), r = (t.defaultView || window).getComputedStyle(n), i = {
885
+ dimensions: {
886
+ width: o.width,
887
+ height: o.height
888
+ },
889
+ fontInfo: {
890
+ fontFamily: r.fontFamily,
891
+ fontSize: r.fontSize,
892
+ fontWeight: r.fontWeight,
893
+ fontStyle: r.fontStyle,
894
+ lineHeight: r.lineHeight,
895
+ fontVariant: r.fontVariant || "normal",
896
+ fontStretch: r.fontStretch || "normal",
897
+ fontSizeAdjust: r.fontSizeAdjust || "none",
898
+ textRendering: r.textRendering || "auto",
899
+ fontFeatureSettings: r.fontFeatureSettings || "normal",
900
+ fontVariantNumeric: r.fontVariantNumeric || "normal",
901
+ fontKerning: r.fontKerning || "auto"
902
+ }
903
+ };
904
+ return t.body.removeChild(n), i;
905
+ } catch (e) {
906
+ return { error: e.message };
907
+ }
908
+ }(e, t);
909
+ o.push({
910
+ width: i.dimensions.width,
911
+ height: i.dimensions.height
912
+ }), 0 === n && i.fontInfo && (r = p(L(i.fontInfo)));
913
+ }));
914
+ const i = {
915
+ fontStyleHash: r,
916
+ dimensions: o
917
+ };
918
+ e({
919
+ details: i,
920
+ hash: p(L(i))
921
+ });
922
+ } catch (t) {
923
+ e({
924
+ supported: !1,
925
+ error: `MathML error: ${t.message}`
926
+ });
927
+ }
928
+ }));
929
+ } catch (t) {
930
+ e({
931
+ supported: !1,
932
+ error: `MathML error: ${t.message}`
933
+ });
934
+ }
935
+ }));
936
+ } }, j = {}, W = { timeout: "true" };
937
+ function z(e, t) {
938
+ var n, o;
939
+ let r = C();
940
+ if ("unknown" === r.name && t) {
941
+ const e = null === (n = t.system) || void 0 === n ? void 0 : n.browser;
942
+ null != e && e.name && (r = {
943
+ name: String(e.name),
944
+ version: String(e.version || "unknown")
945
+ });
946
+ }
947
+ const i = r.name.toLowerCase(), s = parseInt(r.version.split(".")[0] || "0", 10), c = [...(null == e ? void 0 : e.exclude) || []], u = [...new Set([...(null == e ? void 0 : e.stabilize) || [], "always"])];
948
+ for (const e of u) {
949
+ const t = a[e];
950
+ if (t) for (const e of t) "browsers" in e && !(null === (o = e.browsers) || void 0 === o ? void 0 : o.some(((e) => {
951
+ const t = e.match(/(.+?)(>=)(\d+)/);
952
+ return t ? i === t[1] && s >= +t[3] : i === e;
953
+ }))) || c.push(...e.exclude);
954
+ }
955
+ return c;
956
+ }
957
+ function J(e, t) {
958
+ const n = z(t, e), o = (null == t ? void 0 : t.include) || [];
959
+ return function e(t, r = "") {
960
+ const i = {};
961
+ for (const [a, s] of Object.entries(t)) {
962
+ const t = r ? `${r}.${a}` : a;
963
+ if ("object" != typeof s || Array.isArray(s) || null === s) {
964
+ const e = n.some(((e) => t.startsWith(e))), r = o.some(((e) => t.startsWith(e)));
965
+ e && !r || (i[a] = s);
966
+ } else {
967
+ const n = e(s, t);
968
+ Object.keys(n).length > 0 && (i[a] = n);
969
+ }
970
+ }
971
+ return i;
972
+ }(e);
973
+ }
974
+ const q = "visitor_id";
975
+ function K(e) {
976
+ return e.storage_property_name ? e.storage_property_name : e.property_name_factory(q);
977
+ }
978
+ const Y = `${t}_${q}`;
979
+ function X(e, t) {
980
+ try {
981
+ localStorage.setItem(K(t), e);
982
+ } catch (e) {}
983
+ }
984
+ const Z = "cache";
985
+ function Q(e) {
986
+ try {
987
+ const t = localStorage.getItem(e.property_name_factory(Z));
988
+ return JSON.parse(t) || {};
989
+ } catch (e) {}
990
+ return {};
991
+ }
992
+ function ee(t) {
993
+ return t.cache_lifetime_in_ms > e ? Date.now() + e : Date.now() + t.cache_lifetime_in_ms;
994
+ }
995
+ var te = class extends Error {
996
+ constructor(e) {
997
+ super(`HTTP error! status: ${e}`), this.status = e;
998
+ }
999
+ };
1000
+ let ne = null, oe = null;
1001
+ async function re(e, t, n, o) {
1002
+ const r = await fetch(e, {
1003
+ method: "POST",
1004
+ headers: {
1005
+ "x-api-key": n.api_key,
1006
+ Authorization: "custom-authorized",
1007
+ "Content-Type": "application/json"
1008
+ },
1009
+ body: JSON.stringify(t)
1010
+ });
1011
+ if (!r.ok) throw new te(r.status);
1012
+ const i = await r.json();
1013
+ return i.visitorId && i.visitorId !== o && X(i.visitorId, n), oe = i, function(e, t) {
1014
+ if (!e.cache_api_call || !e.cache_lifetime_in_ms) return;
1015
+ (function(e, t) {
1016
+ const n = {
1017
+ ...Q(e),
1018
+ ...t
1019
+ };
1020
+ try {
1021
+ localStorage.setItem(e.property_name_factory(Z), JSON.stringify(n));
1022
+ } catch (e) {}
1023
+ })(e, {
1024
+ apiResponseExpiry: ee(e),
1025
+ apiResponse: t
1026
+ });
1027
+ }(n, i), i;
1028
+ }
1029
+ const ie = (e, t) => {
1030
+ if (e.cache_api_call) {
1031
+ if (oe) return Promise.resolve(oe);
1032
+ const t = function(e) {
1033
+ const t = Q(e);
1034
+ if (t && t.apiResponse && t.apiResponseExpiry && Date.now() <= t.apiResponseExpiry) return t.apiResponse;
1035
+ }(e);
1036
+ if (t) return Promise.resolve(t);
1037
+ if (ne) return ne;
1038
+ }
1039
+ const o = `${e.api_endpoint || n}/thumbmark`, r = function(e) {
1040
+ try {
1041
+ const t = K(e);
1042
+ let n = localStorage.getItem(t);
1043
+ return n || t === Y || (n = localStorage.getItem(Y), n && X(n, e)), n;
1044
+ } catch (e) {
1045
+ return null;
1046
+ }
1047
+ }(e), i = {
1048
+ components: t,
1049
+ options: e,
1050
+ clientHash: p(L(t)),
1051
+ version: "1.7.6"
1052
+ };
1053
+ if (r && (i.visitorId = r), e.metadata) {
1054
+ const t = "function" == typeof e.metadata ? e.metadata() : e.metadata;
1055
+ if (t) ("string" == typeof t ? t.length : JSON.stringify(t).length) > 1e3 ? console.error("ThumbmarkJS: Metadata exceeds 1000 characters. Skipping metadata.") : i.metadata = t;
1056
+ }
1057
+ const a = e.timeout || 5e3, s = async function(e, t, n, o) {
1058
+ for (let r = 0; r < 3; r++) {
1059
+ r > 0 && await new Promise(((e) => setTimeout(e, 200 * r)));
1060
+ try {
1061
+ return await re(e, t, n, o);
1062
+ } catch (e) {
1063
+ if (e instanceof te || 2 === r) throw e;
1064
+ }
1065
+ }
1066
+ throw new Error("Unreachable");
1067
+ }(o, i, e, r).finally((() => {
1068
+ ne = null;
1069
+ })), c = new Promise(((t) => {
1070
+ setTimeout((() => {
1071
+ const n = Q(e);
1072
+ t((null == n ? void 0 : n.apiResponse) || {
1073
+ info: { timed_out: !0 },
1074
+ ...r && { visitorId: r }
1075
+ });
1076
+ }), a);
1077
+ }));
1078
+ return ne = Promise.race([s, c]), ne;
1079
+ };
1080
+ async function ae(e, t = {}) {
1081
+ var r, i;
1082
+ if ("undefined" == typeof document || "undefined" == typeof window) return {
1083
+ thumbmark: "",
1084
+ components: {},
1085
+ info: {},
1086
+ version: "1.7.6",
1087
+ error: [{
1088
+ type: "fatal",
1089
+ message: "Browser environment required"
1090
+ }]
1091
+ };
1092
+ try {
1093
+ const a = {
1094
+ ...o,
1095
+ ...e
1096
+ }, s = [], c = a.logging && !sessionStorage.getItem("_tmjs_l") && Math.random() < 1e-4, { elapsed: l, resolvedComponents: d, errors: m } = await se({
1097
+ ...U,
1098
+ ...j,
1099
+ ...t
1100
+ }, a);
1101
+ s.push(...m);
1102
+ let f = {}, h = {};
1103
+ if (c || a.experimental) {
1104
+ const { elapsed: e, resolvedComponents: t, errors: n } = await se(V, a);
1105
+ f = t, h = e, s.push(...n);
1106
+ }
1107
+ const g = a.api_key ? ie(a, d) : null;
1108
+ let w = null;
1109
+ if (g) try {
1110
+ w = await g;
1111
+ } catch (e) {
1112
+ if (e instanceof te && 403 === e.status) return {
1113
+ error: [{
1114
+ type: "api_unauthorized",
1115
+ message: "Invalid API key or quota exceeded"
1116
+ }],
1117
+ components: {},
1118
+ info: {},
1119
+ version: "1.7.6",
1120
+ thumbmark: ""
1121
+ };
1122
+ s.push({
1123
+ type: e instanceof te ? "api_error" : "network_error",
1124
+ message: e instanceof Error ? e.message : String(e)
1125
+ });
1126
+ }
1127
+ !(null === (r = null == w ? void 0 : w.info) || void 0 === r) && r.timed_out && s.push({
1128
+ type: "api_timeout",
1129
+ message: "API request timed out"
1130
+ });
1131
+ const v = {
1132
+ ...l,
1133
+ ...h
1134
+ }, y = a.performance ? { elapsed: v } : {}, S = J((null == w ? void 0 : w.components) || {}, a), b = {
1135
+ ...d,
1136
+ ...S
1137
+ }, M = (null == w ? void 0 : w.info) || { uniqueness: { score: "api only" } }, E = null !== (i = null == w ? void 0 : w.thumbmark) && void 0 !== i ? i : p(L(b)), P = "1.7.6";
1138
+ c && async function(e, t, o, r = {}, i = []) {
1139
+ var a;
1140
+ const s = `${n}/log`, c = {
1141
+ thumbmark: e,
1142
+ components: t,
1143
+ experimental: r,
1144
+ version: "1.7.6",
1145
+ options: o,
1146
+ path: null === (a = null === window || void 0 === window ? void 0 : window.location) || void 0 === a ? void 0 : a.pathname,
1147
+ ...i.length > 0 && { errors: i }
1148
+ };
1149
+ sessionStorage.setItem("_tmjs_l", "1");
1150
+ try {
1151
+ await fetch(s, {
1152
+ method: "POST",
1153
+ headers: { "Content-Type": "application/json" },
1154
+ body: JSON.stringify(c)
1155
+ });
1156
+ } catch (e) {}
1157
+ }(E, b, a, f, s).catch((() => {}));
1158
+ return {
1159
+ ...(null == w ? void 0 : w.visitorId) && { visitorId: w.visitorId },
1160
+ thumbmark: E,
1161
+ components: b,
1162
+ info: M,
1163
+ version: P,
1164
+ ...y,
1165
+ ...s.length > 0 && { error: s },
1166
+ ...Object.keys(f).length > 0 && a.experimental && { experimental: f },
1167
+ ...(null == w ? void 0 : w.requestId) && { requestId: w.requestId },
1168
+ ...(null == w ? void 0 : w.metadata) && { metadata: w.metadata }
1169
+ };
1170
+ } catch (e) {
1171
+ return {
1172
+ thumbmark: "",
1173
+ components: {},
1174
+ info: {},
1175
+ version: "1.7.6",
1176
+ error: [{
1177
+ type: "fatal",
1178
+ message: e instanceof Error ? e.message : String(e)
1179
+ }]
1180
+ };
1181
+ }
1182
+ }
1183
+ async function se(e, t) {
1184
+ const n = {
1185
+ ...o,
1186
+ ...t
1187
+ }, r = z(n).filter(((e) => !e.includes("."))), i = Object.entries(e).filter((([e]) => {
1188
+ var t;
1189
+ return !(null === (t = null == n ? void 0 : n.exclude) || void 0 === t ? void 0 : t.includes(e));
1190
+ })).filter((([e]) => !r.includes(e))).filter((([e]) => {
1191
+ var t, o, r, i;
1192
+ return (null === (t = null == n ? void 0 : n.include) || void 0 === t ? void 0 : t.some(((e) => e.includes(".")))) ? null === (o = null == n ? void 0 : n.include) || void 0 === o ? void 0 : o.some(((t) => t.startsWith(e))) : 0 === (null === (r = null == n ? void 0 : n.include) || void 0 === r ? void 0 : r.length) || (null === (i = null == n ? void 0 : n.include) || void 0 === i ? void 0 : i.includes(e));
1193
+ })), a = i.map((([e]) => e)), c = await function(e, t, n) {
1194
+ return Promise.all(e.map(((e) => {
1195
+ const o = performance.now();
1196
+ return Promise.race([e.then(((e) => ({
1197
+ value: e,
1198
+ elapsed: performance.now() - o
1199
+ }))).catch(((e) => ({
1200
+ value: n,
1201
+ elapsed: performance.now() - o,
1202
+ error: e instanceof Error ? e.message : String(e)
1203
+ }))), (r = t, i = n, new Promise(((e) => {
1204
+ setTimeout((() => e(i)), r);
1205
+ }))).then(((e) => ({
1206
+ value: e,
1207
+ elapsed: performance.now() - o,
1208
+ error: "timeout"
1209
+ })))]);
1210
+ var r, i;
1211
+ })));
1212
+ }(i.map((([e, n]) => n(t))), (null == n ? void 0 : n.timeout) || 5e3, W), u = {}, l = {}, d = [];
1213
+ c.forEach(((e, t) => {
1214
+ var n;
1215
+ const o = a[t];
1216
+ u[o] = null !== (n = e.elapsed) && void 0 !== n ? n : 0, "timeout" === e.error ? d.push({
1217
+ type: "component_timeout",
1218
+ message: `Component '${o}' timed out`,
1219
+ component: o
1220
+ }) : e.error && d.push({
1221
+ type: "component_error",
1222
+ message: e.error,
1223
+ component: o
1224
+ }), null != e.value && (l[o] = e.value);
1225
+ }));
1226
+ return {
1227
+ elapsed: u,
1228
+ resolvedComponents: J(l, n),
1229
+ errors: d
1230
+ };
1231
+ }
1232
+ var de = class {
1233
+ constructor(e) {
1234
+ this.options = {
1235
+ ...o,
1236
+ ...e
1237
+ }, this.customComponents = {};
1238
+ }
1239
+ async get(e) {
1240
+ return ae({
1241
+ ...this.options,
1242
+ ...e
1243
+ }, this.customComponents);
1244
+ }
1245
+ getVersion() {
1246
+ return "1.7.6";
1247
+ }
1248
+ includeComponent(e, t) {
1249
+ this.customComponents[e] = t;
1250
+ }
1251
+ };
1252
+ //#endregion
4
1253
  //#region ../shared/lib/utils.ts
5
1254
  /** Parse a CSS px value — accepts "10px", "10", or 10. Returns number or defaultValue. */
6
1255
  const parsePx = (value, defaultValue) => {
@@ -151,7 +1400,7 @@ const getPersistentSeed = async () => {
151
1400
  }
152
1401
  return { seed: cachedSeed };
153
1402
  };
154
- const thumbmark = new Thumbmark({ logging: false });
1403
+ const thumbmark = new de({ logging: false });
155
1404
  thumbmark.includeComponent("persistent_seed", getPersistentSeed);
156
1405
  const getClientFingerprint = async () => {
157
1406
  var _result$thumbmark;
@@ -579,6 +1828,635 @@ function resolveDriver(name, ComponentClass, deps) {
579
1828
  return factory(ComponentClass)(deps);
580
1829
  }
581
1830
  //#endregion
1831
+ //#region \0@oxc-project+runtime@0.121.0/helpers/checkPrivateRedeclaration.js
1832
+ function _checkPrivateRedeclaration(e, t) {
1833
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
1834
+ }
1835
+ //#endregion
1836
+ //#region \0@oxc-project+runtime@0.121.0/helpers/classPrivateFieldInitSpec.js
1837
+ function _classPrivateFieldInitSpec(e, t, a) {
1838
+ _checkPrivateRedeclaration(e, t), t.set(e, a);
1839
+ }
1840
+ //#endregion
1841
+ //#region \0@oxc-project+runtime@0.121.0/helpers/assertClassBrand.js
1842
+ function _assertClassBrand(e, t, n) {
1843
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
1844
+ throw new TypeError("Private element is not present on this object");
1845
+ }
1846
+ //#endregion
1847
+ //#region \0@oxc-project+runtime@0.121.0/helpers/classPrivateFieldSet2.js
1848
+ function _classPrivateFieldSet2(s, a, r) {
1849
+ return s.set(_assertClassBrand(s, a), r), r;
1850
+ }
1851
+ //#endregion
1852
+ //#region \0@oxc-project+runtime@0.121.0/helpers/classPrivateFieldGet2.js
1853
+ function _classPrivateFieldGet2(s, a) {
1854
+ return s.get(_assertClassBrand(s, a));
1855
+ }
1856
+ //#endregion
1857
+ //#region ../../node_modules/.pnpm/penpal@7.0.6/node_modules/penpal/dist/penpal.mjs
1858
+ var _brand, _crypto$randomUUID$bi, _crypto$randomUUID, _brand2, _remoteWindow, _allowedOrigins, _log, _validateReceivedMessage, _concreteRemoteOrigin, _messageCallbacks, _port, _isChildUsingDeprecatedProtocol, _isAllowedOrigin, _getOriginForSendingMessage, _destroyPort, _handleMessageFromRemoteWindow, _handleMessageFromPort;
1859
+ var PenpalError = class extends Error {
1860
+ constructor(code, message) {
1861
+ super(message);
1862
+ this.name = "PenpalError";
1863
+ this.code = code;
1864
+ }
1865
+ };
1866
+ var PenpalError_default = PenpalError;
1867
+ var serializeError = (error) => ({
1868
+ name: error.name,
1869
+ message: error.message,
1870
+ stack: error.stack,
1871
+ penpalCode: error instanceof PenpalError_default ? error.code : void 0
1872
+ });
1873
+ var deserializeError = ({ name, message, stack, penpalCode }) => {
1874
+ const deserializedError = penpalCode ? new PenpalError_default(penpalCode, message) : new Error(message);
1875
+ deserializedError.name = name;
1876
+ deserializedError.stack = stack;
1877
+ return deserializedError;
1878
+ };
1879
+ var brand = Symbol("Reply");
1880
+ var Reply_default = (_brand = /* @__PURE__ */ new WeakMap(), class {
1881
+ constructor(value, options) {
1882
+ _classPrivateFieldInitSpec(this, _brand, brand);
1883
+ this.value = value;
1884
+ this.transferables = options === null || options === void 0 ? void 0 : options.transferables;
1885
+ }
1886
+ });
1887
+ var namespace_default = "penpal";
1888
+ var isObject = (value) => {
1889
+ return typeof value === "object" && value !== null;
1890
+ };
1891
+ var isFunction = (value) => {
1892
+ return typeof value === "function";
1893
+ };
1894
+ var isMessage = (data) => {
1895
+ return isObject(data) && data.namespace === namespace_default;
1896
+ };
1897
+ var isSynMessage = (message) => {
1898
+ return message.type === "SYN";
1899
+ };
1900
+ var isAck1Message = (message) => {
1901
+ return message.type === "ACK1";
1902
+ };
1903
+ var isAck2Message = (message) => {
1904
+ return message.type === "ACK2";
1905
+ };
1906
+ var isCallMessage = (message) => {
1907
+ return message.type === "CALL";
1908
+ };
1909
+ var isReplyMessage = (message) => {
1910
+ return message.type === "REPLY";
1911
+ };
1912
+ var isDestroyMessage = (message) => {
1913
+ return message.type === "DESTROY";
1914
+ };
1915
+ var extractMethodPathsFromMethods = (methods, currentPath = []) => {
1916
+ const methodPaths = [];
1917
+ for (const key of Object.keys(methods)) {
1918
+ const value = methods[key];
1919
+ if (isFunction(value)) methodPaths.push([...currentPath, key]);
1920
+ else if (isObject(value)) methodPaths.push(...extractMethodPathsFromMethods(value, [...currentPath, key]));
1921
+ }
1922
+ return methodPaths;
1923
+ };
1924
+ var getMethodAtMethodPath = (methodPath, methods) => {
1925
+ const result = methodPath.reduce((acc, pathSegment) => {
1926
+ return isObject(acc) ? acc[pathSegment] : void 0;
1927
+ }, methods);
1928
+ return isFunction(result) ? result : void 0;
1929
+ };
1930
+ var formatMethodPath = (methodPath) => {
1931
+ return methodPath.join(".");
1932
+ };
1933
+ var createErrorReplyMessage = (channel, callId, error) => ({
1934
+ namespace: namespace_default,
1935
+ channel,
1936
+ type: "REPLY",
1937
+ callId,
1938
+ isError: true,
1939
+ ...error instanceof Error ? {
1940
+ value: serializeError(error),
1941
+ isSerializedErrorInstance: true
1942
+ } : { value: error }
1943
+ });
1944
+ var connectCallHandler = (messenger, methods, channel, log) => {
1945
+ let isDestroyed = false;
1946
+ const handleMessage = async (message) => {
1947
+ if (isDestroyed) return;
1948
+ if (!isCallMessage(message)) return;
1949
+ log === null || log === void 0 || log(`Received ${formatMethodPath(message.methodPath)}() call`, message);
1950
+ const { methodPath, args, id: callId } = message;
1951
+ let replyMessage;
1952
+ let transferables;
1953
+ try {
1954
+ const method = getMethodAtMethodPath(methodPath, methods);
1955
+ if (!method) throw new PenpalError_default("METHOD_NOT_FOUND", `Method \`${formatMethodPath(methodPath)}\` is not found.`);
1956
+ let value = await method(...args);
1957
+ if (value instanceof Reply_default) {
1958
+ transferables = value.transferables;
1959
+ value = await value.value;
1960
+ }
1961
+ replyMessage = {
1962
+ namespace: namespace_default,
1963
+ channel,
1964
+ type: "REPLY",
1965
+ callId,
1966
+ value
1967
+ };
1968
+ } catch (error) {
1969
+ replyMessage = createErrorReplyMessage(channel, callId, error);
1970
+ }
1971
+ if (isDestroyed) return;
1972
+ try {
1973
+ log === null || log === void 0 || log(`Sending ${formatMethodPath(methodPath)}() reply`, replyMessage);
1974
+ messenger.sendMessage(replyMessage, transferables);
1975
+ } catch (error) {
1976
+ if (error.name === "DataCloneError") {
1977
+ replyMessage = createErrorReplyMessage(channel, callId, error);
1978
+ log === null || log === void 0 || log(`Sending ${formatMethodPath(methodPath)}() reply`, replyMessage);
1979
+ messenger.sendMessage(replyMessage);
1980
+ }
1981
+ throw error;
1982
+ }
1983
+ };
1984
+ messenger.addMessageHandler(handleMessage);
1985
+ return () => {
1986
+ isDestroyed = true;
1987
+ messenger.removeMessageHandler(handleMessage);
1988
+ };
1989
+ };
1990
+ var connectCallHandler_default = connectCallHandler;
1991
+ var generateId_default = (_crypto$randomUUID$bi = (_crypto$randomUUID = crypto.randomUUID) === null || _crypto$randomUUID === void 0 ? void 0 : _crypto$randomUUID.bind(crypto)) !== null && _crypto$randomUUID$bi !== void 0 ? _crypto$randomUUID$bi : (() => new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-"));
1992
+ var brand2 = Symbol("CallOptions");
1993
+ var CallOptions_default = (_brand2 = /* @__PURE__ */ new WeakMap(), class {
1994
+ constructor(options) {
1995
+ _classPrivateFieldInitSpec(this, _brand2, brand2);
1996
+ this.transferables = options === null || options === void 0 ? void 0 : options.transferables;
1997
+ this.timeout = options === null || options === void 0 ? void 0 : options.timeout;
1998
+ }
1999
+ });
2000
+ var methodsToTreatAsNative = /* @__PURE__ */ new Set([
2001
+ "apply",
2002
+ "call",
2003
+ "bind"
2004
+ ]);
2005
+ var createRemoteProxy = (callback, log, path = []) => {
2006
+ return new Proxy(path.length ? () => {} : /* @__PURE__ */ Object.create(null), {
2007
+ get(target, prop) {
2008
+ if (prop === "then") return;
2009
+ if (path.length && methodsToTreatAsNative.has(prop)) return Reflect.get(target, prop);
2010
+ return createRemoteProxy(callback, log, [...path, prop]);
2011
+ },
2012
+ apply(target, _thisArg, args) {
2013
+ return callback(path, args);
2014
+ }
2015
+ });
2016
+ };
2017
+ var getDestroyedConnectionMethodCallError = (methodPath) => {
2018
+ return new PenpalError_default("CONNECTION_DESTROYED", `Method call ${formatMethodPath(methodPath)}() failed due to destroyed connection`);
2019
+ };
2020
+ var connectRemoteProxy = (messenger, channel, log) => {
2021
+ let isDestroyed = false;
2022
+ const replyHandlers = /* @__PURE__ */ new Map();
2023
+ const handleMessage = (message) => {
2024
+ if (!isReplyMessage(message)) return;
2025
+ const { callId, value, isError, isSerializedErrorInstance } = message;
2026
+ const replyHandler = replyHandlers.get(callId);
2027
+ if (!replyHandler) return;
2028
+ replyHandlers.delete(callId);
2029
+ log === null || log === void 0 || log(`Received ${formatMethodPath(replyHandler.methodPath)}() call`, message);
2030
+ if (isError) replyHandler.reject(isSerializedErrorInstance ? deserializeError(value) : value);
2031
+ else replyHandler.resolve(value);
2032
+ };
2033
+ messenger.addMessageHandler(handleMessage);
2034
+ const remoteProxy = createRemoteProxy((methodPath, args) => {
2035
+ if (isDestroyed) throw getDestroyedConnectionMethodCallError(methodPath);
2036
+ const callId = generateId_default();
2037
+ const lastArg = args[args.length - 1];
2038
+ const lastArgIsOptions = lastArg instanceof CallOptions_default;
2039
+ const { timeout, transferables } = lastArgIsOptions ? lastArg : {};
2040
+ const argsWithoutOptions = lastArgIsOptions ? args.slice(0, -1) : args;
2041
+ return new Promise((resolve, reject) => {
2042
+ const timeoutId = timeout !== void 0 ? window.setTimeout(() => {
2043
+ replyHandlers.delete(callId);
2044
+ reject(new PenpalError_default("METHOD_CALL_TIMEOUT", `Method call ${formatMethodPath(methodPath)}() timed out after ${timeout}ms`));
2045
+ }, timeout) : void 0;
2046
+ replyHandlers.set(callId, {
2047
+ methodPath,
2048
+ resolve,
2049
+ reject,
2050
+ timeoutId
2051
+ });
2052
+ try {
2053
+ const callMessage = {
2054
+ namespace: namespace_default,
2055
+ channel,
2056
+ type: "CALL",
2057
+ id: callId,
2058
+ methodPath,
2059
+ args: argsWithoutOptions
2060
+ };
2061
+ log === null || log === void 0 || log(`Sending ${formatMethodPath(methodPath)}() call`, callMessage);
2062
+ messenger.sendMessage(callMessage, transferables);
2063
+ } catch (error) {
2064
+ reject(new PenpalError_default("TRANSMISSION_FAILED", error.message));
2065
+ }
2066
+ });
2067
+ }, log);
2068
+ const destroy = () => {
2069
+ isDestroyed = true;
2070
+ messenger.removeMessageHandler(handleMessage);
2071
+ for (const { methodPath, reject, timeoutId } of replyHandlers.values()) {
2072
+ clearTimeout(timeoutId);
2073
+ reject(getDestroyedConnectionMethodCallError(methodPath));
2074
+ }
2075
+ replyHandlers.clear();
2076
+ };
2077
+ return {
2078
+ remoteProxy,
2079
+ destroy
2080
+ };
2081
+ };
2082
+ var connectRemoteProxy_default = connectRemoteProxy;
2083
+ var getPromiseWithResolvers = () => {
2084
+ let resolve;
2085
+ let reject;
2086
+ return {
2087
+ promise: new Promise((res, rej) => {
2088
+ resolve = res;
2089
+ reject = rej;
2090
+ }),
2091
+ resolve,
2092
+ reject
2093
+ };
2094
+ };
2095
+ var getPromiseWithResolvers_default = getPromiseWithResolvers;
2096
+ var DEPRECATED_PENPAL_PARTICIPANT_ID = "deprecated-penpal";
2097
+ var isDeprecatedMessage = (data) => {
2098
+ return isObject(data) && "penpal" in data;
2099
+ };
2100
+ var upgradeMethodPath = (methodPath) => methodPath.split(".");
2101
+ var downgradeMethodPath = (methodPath) => methodPath.join(".");
2102
+ var stringifyUnknownMessage = (message) => {
2103
+ try {
2104
+ return JSON.stringify(message);
2105
+ } catch (_) {
2106
+ return String(message);
2107
+ }
2108
+ };
2109
+ var getUnexpectedMessageError = (message) => {
2110
+ return new PenpalError_default("TRANSMISSION_FAILED", `Unexpected message to translate: ${stringifyUnknownMessage(message)}`);
2111
+ };
2112
+ var upgradeMessage = (message) => {
2113
+ if (message.penpal === "syn") return {
2114
+ namespace: namespace_default,
2115
+ channel: void 0,
2116
+ type: "SYN",
2117
+ participantId: DEPRECATED_PENPAL_PARTICIPANT_ID
2118
+ };
2119
+ if (message.penpal === "ack") return {
2120
+ namespace: namespace_default,
2121
+ channel: void 0,
2122
+ type: "ACK2"
2123
+ };
2124
+ if (message.penpal === "call") return {
2125
+ namespace: namespace_default,
2126
+ channel: void 0,
2127
+ type: "CALL",
2128
+ id: message.id,
2129
+ methodPath: upgradeMethodPath(message.methodName),
2130
+ args: message.args
2131
+ };
2132
+ if (message.penpal === "reply") if (message.resolution === "fulfilled") return {
2133
+ namespace: namespace_default,
2134
+ channel: void 0,
2135
+ type: "REPLY",
2136
+ callId: message.id,
2137
+ value: message.returnValue
2138
+ };
2139
+ else return {
2140
+ namespace: namespace_default,
2141
+ channel: void 0,
2142
+ type: "REPLY",
2143
+ callId: message.id,
2144
+ isError: true,
2145
+ ...message.returnValueIsError ? {
2146
+ value: message.returnValue,
2147
+ isSerializedErrorInstance: true
2148
+ } : { value: message.returnValue }
2149
+ };
2150
+ throw getUnexpectedMessageError(message);
2151
+ };
2152
+ var downgradeMessage = (message) => {
2153
+ if (isAck1Message(message)) return {
2154
+ penpal: "synAck",
2155
+ methodNames: message.methodPaths.map(downgradeMethodPath)
2156
+ };
2157
+ if (isCallMessage(message)) return {
2158
+ penpal: "call",
2159
+ id: message.id,
2160
+ methodName: downgradeMethodPath(message.methodPath),
2161
+ args: message.args
2162
+ };
2163
+ if (isReplyMessage(message)) if (message.isError) return {
2164
+ penpal: "reply",
2165
+ id: message.callId,
2166
+ resolution: "rejected",
2167
+ ...message.isSerializedErrorInstance ? {
2168
+ returnValue: message.value,
2169
+ returnValueIsError: true
2170
+ } : { returnValue: message.value }
2171
+ };
2172
+ else return {
2173
+ penpal: "reply",
2174
+ id: message.callId,
2175
+ resolution: "fulfilled",
2176
+ returnValue: message.value
2177
+ };
2178
+ throw getUnexpectedMessageError(message);
2179
+ };
2180
+ var shakeHands = ({ messenger, methods, timeout, channel, log }) => {
2181
+ const participantId = generateId_default();
2182
+ let remoteParticipantId;
2183
+ const destroyHandlers = [];
2184
+ let isComplete = false;
2185
+ const methodPaths = extractMethodPathsFromMethods(methods);
2186
+ const { promise, resolve, reject } = getPromiseWithResolvers_default();
2187
+ const timeoutId = timeout !== void 0 ? setTimeout(() => {
2188
+ reject(new PenpalError_default("CONNECTION_TIMEOUT", `Connection timed out after ${timeout}ms`));
2189
+ }, timeout) : void 0;
2190
+ const destroy = () => {
2191
+ for (const destroyHandler of destroyHandlers) destroyHandler();
2192
+ };
2193
+ const connectCallHandlerAndMethodProxies = () => {
2194
+ if (isComplete) return;
2195
+ destroyHandlers.push(connectCallHandler_default(messenger, methods, channel, log));
2196
+ const { remoteProxy, destroy: destroyMethodProxies } = connectRemoteProxy_default(messenger, channel, log);
2197
+ destroyHandlers.push(destroyMethodProxies);
2198
+ clearTimeout(timeoutId);
2199
+ isComplete = true;
2200
+ resolve({
2201
+ remoteProxy,
2202
+ destroy
2203
+ });
2204
+ };
2205
+ const sendSynMessage = () => {
2206
+ const synMessage = {
2207
+ namespace: namespace_default,
2208
+ type: "SYN",
2209
+ channel,
2210
+ participantId
2211
+ };
2212
+ log === null || log === void 0 || log(`Sending handshake SYN`, synMessage);
2213
+ try {
2214
+ messenger.sendMessage(synMessage);
2215
+ } catch (error) {
2216
+ reject(new PenpalError_default("TRANSMISSION_FAILED", error.message));
2217
+ }
2218
+ };
2219
+ const handleSynMessage = (message) => {
2220
+ log === null || log === void 0 || log(`Received handshake SYN`, message);
2221
+ if (message.participantId === remoteParticipantId && remoteParticipantId !== DEPRECATED_PENPAL_PARTICIPANT_ID) return;
2222
+ remoteParticipantId = message.participantId;
2223
+ sendSynMessage();
2224
+ if (!(participantId > remoteParticipantId || remoteParticipantId === DEPRECATED_PENPAL_PARTICIPANT_ID)) return;
2225
+ const ack1Message = {
2226
+ namespace: namespace_default,
2227
+ channel,
2228
+ type: "ACK1",
2229
+ methodPaths
2230
+ };
2231
+ log === null || log === void 0 || log(`Sending handshake ACK1`, ack1Message);
2232
+ try {
2233
+ messenger.sendMessage(ack1Message);
2234
+ } catch (error) {
2235
+ reject(new PenpalError_default("TRANSMISSION_FAILED", error.message));
2236
+ return;
2237
+ }
2238
+ };
2239
+ const handleAck1Message = (message) => {
2240
+ log === null || log === void 0 || log(`Received handshake ACK1`, message);
2241
+ const ack2Message = {
2242
+ namespace: namespace_default,
2243
+ channel,
2244
+ type: "ACK2"
2245
+ };
2246
+ log === null || log === void 0 || log(`Sending handshake ACK2`, ack2Message);
2247
+ try {
2248
+ messenger.sendMessage(ack2Message);
2249
+ } catch (error) {
2250
+ reject(new PenpalError_default("TRANSMISSION_FAILED", error.message));
2251
+ return;
2252
+ }
2253
+ connectCallHandlerAndMethodProxies();
2254
+ };
2255
+ const handleAck2Message = (message) => {
2256
+ log === null || log === void 0 || log(`Received handshake ACK2`, message);
2257
+ connectCallHandlerAndMethodProxies();
2258
+ };
2259
+ const handleMessage = (message) => {
2260
+ if (isSynMessage(message)) handleSynMessage(message);
2261
+ if (isAck1Message(message)) handleAck1Message(message);
2262
+ if (isAck2Message(message)) handleAck2Message(message);
2263
+ };
2264
+ messenger.addMessageHandler(handleMessage);
2265
+ destroyHandlers.push(() => messenger.removeMessageHandler(handleMessage));
2266
+ sendSynMessage();
2267
+ return promise;
2268
+ };
2269
+ var shakeHands_default = shakeHands;
2270
+ var once = (fn) => {
2271
+ let isCalled = false;
2272
+ let result;
2273
+ return (...args) => {
2274
+ if (!isCalled) {
2275
+ isCalled = true;
2276
+ result = fn(...args);
2277
+ }
2278
+ return result;
2279
+ };
2280
+ };
2281
+ var once_default = once;
2282
+ var usedMessengers = /* @__PURE__ */ new WeakSet();
2283
+ var connect = ({ messenger, methods = {}, timeout, channel, log }) => {
2284
+ if (!messenger) throw new PenpalError_default("INVALID_ARGUMENT", "messenger must be defined");
2285
+ if (usedMessengers.has(messenger)) throw new PenpalError_default("INVALID_ARGUMENT", "A messenger can only be used for a single connection");
2286
+ usedMessengers.add(messenger);
2287
+ const connectionDestroyedHandlers = [messenger.destroy];
2288
+ const destroyConnection = once_default((notifyOtherParticipant) => {
2289
+ if (notifyOtherParticipant) {
2290
+ const destroyMessage = {
2291
+ namespace: namespace_default,
2292
+ channel,
2293
+ type: "DESTROY"
2294
+ };
2295
+ try {
2296
+ messenger.sendMessage(destroyMessage);
2297
+ } catch (_) {}
2298
+ }
2299
+ for (const connectionDestroyedHandler of connectionDestroyedHandlers) connectionDestroyedHandler();
2300
+ log === null || log === void 0 || log("Connection destroyed");
2301
+ });
2302
+ const validateReceivedMessage = (data) => {
2303
+ return isMessage(data) && data.channel === channel;
2304
+ };
2305
+ return {
2306
+ promise: (async () => {
2307
+ try {
2308
+ messenger.initialize({
2309
+ log,
2310
+ validateReceivedMessage
2311
+ });
2312
+ messenger.addMessageHandler((message) => {
2313
+ if (isDestroyMessage(message)) destroyConnection(false);
2314
+ });
2315
+ const { remoteProxy, destroy } = await shakeHands_default({
2316
+ messenger,
2317
+ methods,
2318
+ timeout,
2319
+ channel,
2320
+ log
2321
+ });
2322
+ connectionDestroyedHandlers.push(destroy);
2323
+ return remoteProxy;
2324
+ } catch (error) {
2325
+ destroyConnection(true);
2326
+ throw error;
2327
+ }
2328
+ })(),
2329
+ destroy: () => {
2330
+ destroyConnection(true);
2331
+ }
2332
+ };
2333
+ };
2334
+ var connect_default = connect;
2335
+ var WindowMessenger_default = (_remoteWindow = /* @__PURE__ */ new WeakMap(), _allowedOrigins = /* @__PURE__ */ new WeakMap(), _log = /* @__PURE__ */ new WeakMap(), _validateReceivedMessage = /* @__PURE__ */ new WeakMap(), _concreteRemoteOrigin = /* @__PURE__ */ new WeakMap(), _messageCallbacks = /* @__PURE__ */ new WeakMap(), _port = /* @__PURE__ */ new WeakMap(), _isChildUsingDeprecatedProtocol = /* @__PURE__ */ new WeakMap(), _isAllowedOrigin = /* @__PURE__ */ new WeakMap(), _getOriginForSendingMessage = /* @__PURE__ */ new WeakMap(), _destroyPort = /* @__PURE__ */ new WeakMap(), _handleMessageFromRemoteWindow = /* @__PURE__ */ new WeakMap(), _handleMessageFromPort = /* @__PURE__ */ new WeakMap(), class {
2336
+ constructor({ remoteWindow, allowedOrigins }) {
2337
+ _classPrivateFieldInitSpec(this, _remoteWindow, void 0);
2338
+ _classPrivateFieldInitSpec(this, _allowedOrigins, void 0);
2339
+ _classPrivateFieldInitSpec(this, _log, void 0);
2340
+ _classPrivateFieldInitSpec(this, _validateReceivedMessage, void 0);
2341
+ _classPrivateFieldInitSpec(this, _concreteRemoteOrigin, void 0);
2342
+ _classPrivateFieldInitSpec(this, _messageCallbacks, /* @__PURE__ */ new Set());
2343
+ _classPrivateFieldInitSpec(this, _port, void 0);
2344
+ _classPrivateFieldInitSpec(this, _isChildUsingDeprecatedProtocol, false);
2345
+ this.initialize = ({ log, validateReceivedMessage }) => {
2346
+ _classPrivateFieldSet2(_log, this, log);
2347
+ _classPrivateFieldSet2(_validateReceivedMessage, this, validateReceivedMessage);
2348
+ window.addEventListener("message", _classPrivateFieldGet2(_handleMessageFromRemoteWindow, this));
2349
+ };
2350
+ this.sendMessage = (message, transferables) => {
2351
+ if (isSynMessage(message)) {
2352
+ const originForSending = _classPrivateFieldGet2(_getOriginForSendingMessage, this).call(this, message);
2353
+ _classPrivateFieldGet2(_remoteWindow, this).postMessage(message, {
2354
+ targetOrigin: originForSending,
2355
+ transfer: transferables
2356
+ });
2357
+ return;
2358
+ }
2359
+ if (isAck1Message(message) || _classPrivateFieldGet2(_isChildUsingDeprecatedProtocol, this)) {
2360
+ const payload = _classPrivateFieldGet2(_isChildUsingDeprecatedProtocol, this) ? downgradeMessage(message) : message;
2361
+ const originForSending = _classPrivateFieldGet2(_getOriginForSendingMessage, this).call(this, message);
2362
+ _classPrivateFieldGet2(_remoteWindow, this).postMessage(payload, {
2363
+ targetOrigin: originForSending,
2364
+ transfer: transferables
2365
+ });
2366
+ return;
2367
+ }
2368
+ if (isAck2Message(message)) {
2369
+ const { port1, port2 } = new MessageChannel();
2370
+ _classPrivateFieldSet2(_port, this, port1);
2371
+ port1.addEventListener("message", _classPrivateFieldGet2(_handleMessageFromPort, this));
2372
+ port1.start();
2373
+ const transferablesToSend = [port2, ...transferables || []];
2374
+ const originForSending = _classPrivateFieldGet2(_getOriginForSendingMessage, this).call(this, message);
2375
+ _classPrivateFieldGet2(_remoteWindow, this).postMessage(message, {
2376
+ targetOrigin: originForSending,
2377
+ transfer: transferablesToSend
2378
+ });
2379
+ return;
2380
+ }
2381
+ if (_classPrivateFieldGet2(_port, this)) {
2382
+ _classPrivateFieldGet2(_port, this).postMessage(message, { transfer: transferables });
2383
+ return;
2384
+ }
2385
+ throw new PenpalError_default("TRANSMISSION_FAILED", "Cannot send message because the MessagePort is not connected");
2386
+ };
2387
+ this.addMessageHandler = (callback) => {
2388
+ _classPrivateFieldGet2(_messageCallbacks, this).add(callback);
2389
+ };
2390
+ this.removeMessageHandler = (callback) => {
2391
+ _classPrivateFieldGet2(_messageCallbacks, this).delete(callback);
2392
+ };
2393
+ this.destroy = () => {
2394
+ window.removeEventListener("message", _classPrivateFieldGet2(_handleMessageFromRemoteWindow, this));
2395
+ _classPrivateFieldGet2(_destroyPort, this).call(this);
2396
+ _classPrivateFieldGet2(_messageCallbacks, this).clear();
2397
+ };
2398
+ _classPrivateFieldInitSpec(this, _isAllowedOrigin, (origin) => {
2399
+ return _classPrivateFieldGet2(_allowedOrigins, this).some((allowedOrigin) => allowedOrigin instanceof RegExp ? allowedOrigin.test(origin) : allowedOrigin === origin || allowedOrigin === "*");
2400
+ });
2401
+ _classPrivateFieldInitSpec(this, _getOriginForSendingMessage, (message) => {
2402
+ if (isSynMessage(message)) return "*";
2403
+ if (!_classPrivateFieldGet2(_concreteRemoteOrigin, this)) throw new PenpalError_default("TRANSMISSION_FAILED", "Cannot send message because the remote origin is not established");
2404
+ return _classPrivateFieldGet2(_concreteRemoteOrigin, this) === "null" && _classPrivateFieldGet2(_allowedOrigins, this).includes("*") ? "*" : _classPrivateFieldGet2(_concreteRemoteOrigin, this);
2405
+ });
2406
+ _classPrivateFieldInitSpec(this, _destroyPort, () => {
2407
+ var _classPrivateFieldGet2$1, _classPrivateFieldGet3;
2408
+ (_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_port, this)) === null || _classPrivateFieldGet2$1 === void 0 || _classPrivateFieldGet2$1.removeEventListener("message", _classPrivateFieldGet2(_handleMessageFromPort, this));
2409
+ (_classPrivateFieldGet3 = _classPrivateFieldGet2(_port, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.close();
2410
+ _classPrivateFieldSet2(_port, this, void 0);
2411
+ });
2412
+ _classPrivateFieldInitSpec(this, _handleMessageFromRemoteWindow, ({ source, origin, ports, data }) => {
2413
+ var _classPrivateFieldGet6;
2414
+ if (source !== _classPrivateFieldGet2(_remoteWindow, this)) return;
2415
+ if (isDeprecatedMessage(data)) {
2416
+ var _classPrivateFieldGet4;
2417
+ (_classPrivateFieldGet4 = _classPrivateFieldGet2(_log, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.call(this, "Please upgrade the child window to the latest version of Penpal.");
2418
+ _classPrivateFieldSet2(_isChildUsingDeprecatedProtocol, this, true);
2419
+ try {
2420
+ data = upgradeMessage(data);
2421
+ } catch (error) {
2422
+ var _classPrivateFieldGet5;
2423
+ (_classPrivateFieldGet5 = _classPrivateFieldGet2(_log, this)) === null || _classPrivateFieldGet5 === void 0 || _classPrivateFieldGet5.call(this, `Failed to translate deprecated message: ${error.message}`);
2424
+ return;
2425
+ }
2426
+ }
2427
+ if (!((_classPrivateFieldGet6 = _classPrivateFieldGet2(_validateReceivedMessage, this)) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.call(this, data))) return;
2428
+ if (!_classPrivateFieldGet2(_isAllowedOrigin, this).call(this, origin)) {
2429
+ var _classPrivateFieldGet7;
2430
+ (_classPrivateFieldGet7 = _classPrivateFieldGet2(_log, this)) === null || _classPrivateFieldGet7 === void 0 || _classPrivateFieldGet7.call(this, `Received a message from origin \`${origin}\` which did not match allowed origins \`[${_classPrivateFieldGet2(_allowedOrigins, this).join(", ")}]\``);
2431
+ return;
2432
+ }
2433
+ if (isSynMessage(data)) {
2434
+ _classPrivateFieldGet2(_destroyPort, this).call(this);
2435
+ _classPrivateFieldSet2(_concreteRemoteOrigin, this, origin);
2436
+ }
2437
+ if (isAck2Message(data) && !_classPrivateFieldGet2(_isChildUsingDeprecatedProtocol, this)) {
2438
+ _classPrivateFieldSet2(_port, this, ports[0]);
2439
+ if (!_classPrivateFieldGet2(_port, this)) {
2440
+ var _classPrivateFieldGet8;
2441
+ (_classPrivateFieldGet8 = _classPrivateFieldGet2(_log, this)) === null || _classPrivateFieldGet8 === void 0 || _classPrivateFieldGet8.call(this, "Ignoring ACK2 because it did not include a MessagePort");
2442
+ return;
2443
+ }
2444
+ _classPrivateFieldGet2(_port, this).addEventListener("message", _classPrivateFieldGet2(_handleMessageFromPort, this));
2445
+ _classPrivateFieldGet2(_port, this).start();
2446
+ }
2447
+ for (const callback of _classPrivateFieldGet2(_messageCallbacks, this)) callback(data);
2448
+ });
2449
+ _classPrivateFieldInitSpec(this, _handleMessageFromPort, ({ data }) => {
2450
+ var _classPrivateFieldGet9;
2451
+ if (!((_classPrivateFieldGet9 = _classPrivateFieldGet2(_validateReceivedMessage, this)) === null || _classPrivateFieldGet9 === void 0 ? void 0 : _classPrivateFieldGet9.call(this, data))) return;
2452
+ for (const callback of _classPrivateFieldGet2(_messageCallbacks, this)) callback(data);
2453
+ });
2454
+ if (!remoteWindow) throw new PenpalError_default("INVALID_ARGUMENT", "remoteWindow must be defined");
2455
+ _classPrivateFieldSet2(_remoteWindow, this, remoteWindow);
2456
+ _classPrivateFieldSet2(_allowedOrigins, this, (allowedOrigins === null || allowedOrigins === void 0 ? void 0 : allowedOrigins.length) ? allowedOrigins : [window.origin]);
2457
+ }
2458
+ });
2459
+ //#endregion
582
2460
  //#region src/bridge/constants.ts
583
2461
  /** Bridge lifecycle events (replaces zoid.EVENT) */
584
2462
  const EVENT = {
@@ -883,8 +2761,8 @@ function attachRenderMethods(instance, options) {
883
2761
  frame.addEventListener("load", sendInitialProps);
884
2762
  if (frame.contentWindow) sendInitialProps();
885
2763
  if (!frame.contentWindow) throw new Error("iframe contentWindow is not available — frame may not be in the DOM");
886
- const connection = connect({
887
- messenger: new WindowMessenger({
2764
+ const connection = connect_default({
2765
+ messenger: new WindowMessenger_default({
888
2766
  remoteWindow: frame.contentWindow,
889
2767
  allowedOrigins: [new URL(options.url).origin]
890
2768
  }),