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