@fkn/lib 0.9.45 → 0.9.47

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 (99) hide show
  1. package/{account-generation-B-6Pn0b5.cjs → account-generation-9VhfEDoW.cjs} +1 -1
  2. package/{account-generation-XNWOvLea.js → account-generation-hUekEHGW.js} +1 -1
  3. package/account.cjs +1 -1
  4. package/account.js +2 -2
  5. package/{api-Cuf3ynZX.d.ts → api-DIBhBtcU.d.ts} +2 -24
  6. package/api-DMnVye0K.cjs +3 -0
  7. package/{api-DIgTslNb.js → api-ySazPAwN.js} +97 -59
  8. package/api.cjs +1 -1
  9. package/api.d.ts +2 -2
  10. package/api.js +1 -1
  11. package/busy-BXbVH595.cjs +1 -0
  12. package/{busy-B189uX--.js → busy-DsMWrSzc.js} +6 -3
  13. package/cloud/dns.d.ts +1 -1
  14. package/cloud/fetch.cjs +1 -1
  15. package/cloud/fetch.d.ts +1 -1
  16. package/cloud/fetch.js +1 -1
  17. package/cloud/fs/promises.d.ts +1 -1
  18. package/cloud/fs.cjs +1 -1
  19. package/cloud/fs.d.ts +2 -2
  20. package/cloud/fs.js +2 -2
  21. package/cloud/net.cjs +1 -1
  22. package/cloud/net.d.ts +1 -1
  23. package/cloud/net.js +2 -2
  24. package/cloud-BD7uzz5h.js +548 -0
  25. package/{cloud-KBzjWzt1.d.ts → cloud-Bdw5nX-B.d.ts} +4 -4
  26. package/cloud-DL4i8kvf.cjs +1 -0
  27. package/cloud.cjs +1 -1
  28. package/cloud.d.ts +4 -4
  29. package/cloud.js +2 -2
  30. package/{contract-DP_jc5pZ.d.ts → contract-LOcbTDjP.d.ts} +8 -55
  31. package/contract.cjs +1 -1
  32. package/contract.d.ts +4 -4
  33. package/contract.js +3 -9
  34. package/dgram.cjs +1 -1
  35. package/dgram.d.ts +3 -3
  36. package/dgram.js +19 -19
  37. package/dns.cjs +1 -1
  38. package/dns.d.ts +1 -1
  39. package/dns.js +1 -1
  40. package/extension-BeIkBEi3.js +94 -0
  41. package/{extension-X8cnvZej.d.ts → extension-Bsvr9OaV.d.ts} +21 -3
  42. package/extension-eG1RMTDc.cjs +1 -0
  43. package/extension.cjs +1 -1
  44. package/extension.d.ts +2 -2
  45. package/extension.js +3 -3
  46. package/fs/promises.cjs +1 -1
  47. package/fs/promises.d.ts +1 -1
  48. package/fs/promises.js +1 -1
  49. package/fs-BY0Csn2V.js +515 -0
  50. package/fs-DnF1cQuE.cjs +1 -0
  51. package/{fs-KA1Mgisv.d.ts → fs-lKZe5xIo.d.ts} +1 -1
  52. package/fs.cjs +1 -1
  53. package/fs.d.ts +2 -2
  54. package/fs.js +2 -2
  55. package/http.d.ts +1 -1
  56. package/{index-DKr9L2RI.d.ts → index-D9x6A-Gx.d.ts} +1 -1
  57. package/{index-C8Y-YHrU.d.ts → index-iawzrUiB.d.ts} +92 -33
  58. package/index.cjs +1 -1
  59. package/index.d.ts +9 -8
  60. package/index.js +30 -32
  61. package/lib-CK2F5cc1.cjs +53 -0
  62. package/{lib-H5-e2A1h.js → lib-zMHWCUXz.js} +677 -497
  63. package/{net-eyWUIVn2.d.ts → net-taIhsmvu.d.ts} +5 -5
  64. package/net.cjs +1 -1
  65. package/net.d.ts +1 -1
  66. package/net.js +11 -12
  67. package/{node-fs-CK2wWIYS.js → node-fs-DY2fO5zd.js} +1 -1
  68. package/{node-fs-nfX7wisL.cjs → node-fs-vsWuoMGa.cjs} +1 -1
  69. package/opfs.cjs +1 -1
  70. package/opfs.js +1 -1
  71. package/package.json +1 -1
  72. package/packages.cjs +1 -1
  73. package/packages.d.ts +1 -1
  74. package/packages.js +2 -2
  75. package/{proxy-Dixbk1WL.js → proxy-BXkxwBxK.js} +2 -2
  76. package/{proxy-CFK-KiwE.cjs → proxy-BfkfFsNI.cjs} +1 -1
  77. package/{proxy-8Zp-G5da.d.ts → proxy-CSKLtRTm.d.ts} +2 -2
  78. package/rooms.cjs +1 -1
  79. package/rooms.d.ts +1 -1
  80. package/rooms.js +13 -21
  81. package/{storage-BLBsmkmp.d.ts → storage-B_mXNAdB.d.ts} +4 -5
  82. package/{storage-Dn1gTLSZ.js → storage-C6F9SnDM.js} +2 -2
  83. package/{storage-D2cUJlVH.cjs → storage-DmRIhg1P.cjs} +1 -1
  84. package/utils-BpHmMkIR.cjs +1 -0
  85. package/{utils-C-cAd4r4.js → utils-Cyq8uJiy.js} +7 -9
  86. package/{wire-BwA4JjZH.d.ts → wire-Fk5pJaoy.d.ts} +8 -1
  87. package/wire.cjs +1 -1
  88. package/wire.d.ts +2 -2
  89. package/wire.js +2 -2
  90. package/api--LOXTOpv.cjs +0 -3
  91. package/busy-Dv8wzE5M.cjs +0 -1
  92. package/cloud-CKCrMMB_.cjs +0 -1
  93. package/cloud-CVWGyZRT.js +0 -559
  94. package/extension-Dmnh5pcs.js +0 -94
  95. package/extension-YBe6Q6r_.cjs +0 -1
  96. package/fs-CVnmXRf7.js +0 -513
  97. package/fs-p0bOOj5n.cjs +0 -1
  98. package/lib-D4uqe_rb.cjs +0 -53
  99. package/utils-BvgGdrgN.cjs +0 -1
@@ -7,20 +7,23 @@ var ne = (e, t) => {
7
7
  return Object.defineProperty(n, "addEventListener", {
8
8
  configurable: !0,
9
9
  value: (a, o, s) => {
10
- if (o !== null) {
11
- if (!r.has(a)) {
12
- let i = (r) => {
13
- n.dispatchEvent(new CustomEvent(a, {
14
- detail: t(r, e),
15
- bubbles: r.bubbles,
16
- cancelable: r.cancelable,
17
- composed: r.composed
18
- }));
19
- };
20
- e.addEventListener(a, i), r.set(a, i);
21
- }
22
- i(a, o, s);
10
+ if (o === null) return;
11
+ let c = r.get(a);
12
+ if (c === void 0) {
13
+ let i = (r) => {
14
+ n.dispatchEvent(new CustomEvent(a, {
15
+ detail: t(r, e),
16
+ bubbles: r.bubbles,
17
+ cancelable: r.cancelable,
18
+ composed: r.composed
19
+ }));
20
+ };
21
+ e.addEventListener(a, i), c = {
22
+ forward: i,
23
+ listeners: /* @__PURE__ */ new Set()
24
+ }, r.set(a, c);
23
25
  }
26
+ c.listeners.add(o), i(a, o, s);
24
27
  }
25
28
  }), Object.defineProperty(n, "removeEventListener", {
26
29
  configurable: !0,
@@ -28,7 +31,7 @@ var ne = (e, t) => {
28
31
  if (n === null) return;
29
32
  a(t, n, i);
30
33
  let o = r.get(t);
31
- o && (e.removeEventListener(t, o), r.delete(t));
34
+ o !== void 0 && (o.listeners.delete(n), !(o.listeners.size > 0) && (e.removeEventListener(t, o.forward), r.delete(t)));
32
35
  }
33
36
  }), n;
34
37
  }, re = (e) => typeof e == "boolean" ? +!!e : +!!e?.capture, b = (e) => {
@@ -245,17 +248,71 @@ var ne = (e, t) => {
245
248
  }, be = (e, t) => {
246
249
  let n = te(e.controller, t);
247
250
  return ge({ ...e.initialState }, n);
248
- }, xe = (e) => [x, ...e], Se = 4, Ce = 0, we = "fknExtension", Te = "fknExtensionAbi", Ee = "fknExtensionOps", De = [
251
+ }, xe = (e) => {
252
+ let t = [];
253
+ return e.forEach((e, n) => {
254
+ t.push([n, e]);
255
+ }), t;
256
+ }, Se = "headers", Ce = {
257
+ type: Se,
258
+ isType: (e) => e instanceof Headers,
259
+ box: (e) => ({
260
+ ..._,
261
+ type: Se,
262
+ entries: xe(e)
263
+ }),
264
+ revive: (e) => new Headers(e.entries)
265
+ }, we = "response", Te = /* @__PURE__ */ new Set([
266
+ 101,
267
+ 204,
268
+ 205,
269
+ 304
270
+ ]), Ee = {
271
+ type: we,
272
+ isType: (e) => e instanceof Response,
273
+ box: (e, t) => ({
274
+ ..._,
275
+ type: we,
276
+ status: e.status,
277
+ statusText: e.statusText,
278
+ headers: Ce.box(e.headers),
279
+ body: e.body ? ee(e.body, t) : null,
280
+ url: e.url,
281
+ redirected: e.redirected
282
+ }),
283
+ revive: (e, t) => {
284
+ if (e.status === 0) return Response.error();
285
+ let n = Ce.revive(e.headers), r = e.body ? te(e.body, t) : null, i = Te.has(e.status);
286
+ r && i && r.cancel().catch(() => {});
287
+ let a = new Response(i ? null : r, {
288
+ status: e.status,
289
+ statusText: e.statusText,
290
+ headers: n
291
+ });
292
+ return e.url && Object.defineProperty(a, "url", {
293
+ value: e.url,
294
+ configurable: !0
295
+ }), e.redirected && Object.defineProperty(a, "redirected", {
296
+ value: !0,
297
+ configurable: !0
298
+ }), a;
299
+ }
300
+ }, De = (e) => [
301
+ x,
302
+ Ce,
303
+ Ee,
304
+ ...e
305
+ ], Oe = 5, ke = 0, Ae = "fknExtension", je = "fknExtensionAbi", Me = "fknExtensionOps", Ne = [
249
306
  "data-fkn-extension",
250
307
  "data-fkn-extension-abi",
251
308
  "data-fkn-extension-ops"
252
- ], Oe = (e) => {
309
+ ], Pe = (e) => {
253
310
  if (e === void 0) return 0;
254
311
  let t = Number(e);
255
312
  return Number.isInteger(t) && t >= 0 ? t : 0;
256
- }, ke = (e) => e === void 0 ? null : e.split(",").map((e) => e.trim()).filter(Boolean), Ae = (e, t = 0) => {
313
+ }, Fe = (e) => e === void 0 ? null : e.split(",").map((e) => e.trim()).filter(Boolean), Ie = (e, t = 0) => {
257
314
  if (e.fknExtension !== "true") return { status: "absent" };
258
- let n = Oe(e[Te]), r = ke(e[Ee]);
315
+ let n = Pe(e[je]), r = Fe(e[Me]);
259
316
  return n < t ? {
260
317
  status: "outdated",
261
318
  abi: n,
@@ -266,7 +323,7 @@ var ne = (e, t) => {
266
323
  abi: n,
267
324
  operations: r
268
325
  };
269
- }, je = (e, t) => e.status === "ok" ? e.operations === null || e.operations.includes(t) : !1, Me = (e, t) => e.status === "ok" && e.operations !== null && e.operations.includes(t), w = class extends Error {
326
+ }, Le = (e, t) => e.status === "ok" ? e.operations === null || e.operations.includes(t) : !1, Re = (e, t) => e.status === "ok" && e.operations !== null && e.operations.includes(t), w = class extends Error {
270
327
  abi;
271
328
  required;
272
329
  name = "ExtensionOutdatedError";
@@ -280,13 +337,13 @@ var ne = (e, t) => {
280
337
  constructor(e, t, n) {
281
338
  super(n ?? `The FKN WebExtension does not support "${e}" (ABI ${t}). Updating the extension may add it.`), this.operation = e, this.abi = t;
282
339
  }
283
- }, Ne = "FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY", Pe = we, Fe = v();
284
- typeof document < "u" && document.addEventListener(Ne, () => {
285
- Fe.dispatchEvent(new CustomEvent("statuschange", { detail: { enabled: Ie() } }));
340
+ }, ze = "FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY", Be = v();
341
+ typeof document < "u" && document.addEventListener(ze, () => {
342
+ Be.dispatchEvent(new CustomEvent("statuschange", { detail: { enabled: Ve() } }));
286
343
  });
287
- var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe] === "true", E = () => typeof document > "u" ? { status: "absent" } : Ae(document.documentElement.dataset), D = null, Le = (e) => {
288
- D = e;
289
- }, Re = 150, O = (e = 1e3) => new Promise((t, n) => {
344
+ var Ve = () => typeof document > "u" ? !1 : document.documentElement.dataset[Ae] === "true", E = () => typeof document > "u" ? { status: "absent" } : Ie(document.documentElement.dataset), He = null, Ue = (e) => {
345
+ He = e;
346
+ }, We = 150, D = (e = 1e3) => new Promise((t, n) => {
290
347
  let r = () => E().status === "ok";
291
348
  if (r()) return t();
292
349
  let i, a = (e) => {
@@ -294,14 +351,14 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
294
351
  }, o = () => a(async () => {
295
352
  let e = E();
296
353
  if (e.status === "outdated") return n(new w(e.abi, e.required));
297
- if (D) {
298
- if (await D().catch(() => {}), r()) return t();
354
+ if (He) {
355
+ if (await He().catch(() => {}), r()) return t();
299
356
  let e = E();
300
357
  if (e.status === "outdated") return n(new w(e.abi, e.required));
301
358
  }
302
359
  n(/* @__PURE__ */ Error("The FKN WebExtension is not installed, enabled or not exposed on this page."));
303
360
  }), s = () => {
304
- clearTimeout(i), i = setTimeout(() => r() ? a(t) : o(), Re);
361
+ clearTimeout(i), i = setTimeout(() => r() ? a(t) : o(), We);
305
362
  }, c = new MutationObserver(() => {
306
363
  r() && a(t);
307
364
  }), l = () => {
@@ -309,39 +366,84 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
309
366
  };
310
367
  if (i = setTimeout(o, e), c.observe(document.documentElement, {
311
368
  attributes: !0,
312
- attributeFilter: [...De]
369
+ attributeFilter: [...Ne]
313
370
  }), document.addEventListener("readystatechange", l), document.readyState === "complete") return s();
314
371
  r() && a(t);
315
- }), ze, k = new Proxy({}, { get: (e, t) => async (...e) => {
316
- await O(), ze ??= y({}, {
372
+ }), Ge, O = new Proxy({}, { get: (e, t) => async (...e) => {
373
+ await D(), Ge ??= y({}, {
317
374
  transport: window,
318
- revivableModules: xe
375
+ revivableModules: De
319
376
  });
320
- let n = (await ze)[t];
377
+ let n = (await Ge)[t];
321
378
  return n(...e);
322
- } }), Be = [
379
+ } }), k = [
323
380
  "origin",
324
381
  "referer",
325
382
  "cookie"
326
- ], Ve = (e, t) => (e ?? []).some(([e, n]) => e.trim().toLowerCase() === t && n !== ""), He = (e) => Ve(e, "cookie"), Ue = (e, t) => {
327
- if (t === "include" && He(e)) throw Error("fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other");
328
- }, We = (e) => {
329
- let t = [...new Set((e ?? []).map(([e]) => e.trim().toLowerCase()).filter((e) => !Be.includes(e)))];
383
+ ], Ke = (e, t) => (e ?? []).some(([e, n]) => e.trim().toLowerCase() === t && n !== ""), qe = (e) => Ke(e, "cookie"), Je = (e, t) => {
384
+ if (t === "include" && qe(e)) throw Error("fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other");
385
+ }, Ye = (e, t) => {
386
+ if (!Array.isArray(t)) throw Error(`${e}: requestHeaders must be an array of header operations`);
387
+ let n = [...new Set(t.map((e) => {
388
+ let t = e?.header;
389
+ return typeof t == "string" ? t.trim().toLowerCase() : String(t);
390
+ }).filter((e) => !k.includes(e)))];
391
+ if (n.length) throw Error(`${e}: refusing to rewrite request header(s): ${n.join(", ")}`);
392
+ }, Xe = (e) => {
393
+ let t = [...new Set((e ?? []).map(([e]) => e.trim().toLowerCase()).filter((e) => !k.includes(e)))];
330
394
  if (t.length) throw Error(`fetch: refusing to forge request header(s): ${t.join(", ")}`);
331
- }, Ge = [
395
+ }, Ze = [
332
396
  "fkn.app",
333
397
  "fkn.dev",
334
- "sdbx.app"
335
- ], Ke = (e) => e.replace(/\.+$/, ""), qe = (e) => {
336
- let t = Ke(e);
337
- return Ge.some((e) => t === e || t.endsWith(`.${e}`));
338
- }, Je = {
398
+ "sdbx.app",
399
+ "fkn.cloudflareaccess.com",
400
+ "horionsoftware.com",
401
+ "62e9d4fbf21d90ebd4342e54b4babbd3.r2.cloudflarestorage.com",
402
+ "web-b3z.pages.dev",
403
+ "fkn-console.pages.dev",
404
+ "dev-dms.pages.dev",
405
+ "fkn-www.pages.dev",
406
+ "fkn-homepage.pages.dev",
407
+ "fkn-sandbox.pages.dev",
408
+ "internal-3ar.pages.dev",
409
+ "stub-ben.pages.dev",
410
+ "ripple-3t3.pages.dev",
411
+ "media-player-e3s.pages.dev",
412
+ "youtube-3c4.pages.dev",
413
+ "horionsoftware.pages.dev",
414
+ "container-ckf.pages.dev",
415
+ "stub-plugin.pages.dev",
416
+ "stub.plugins.banou.dev"
417
+ ], Qe = (e) => e.replace(/\.+$/, ""), $e = ["79.127.204.69", "152.233.49.59"], et = (e) => {
418
+ let t;
419
+ try {
420
+ t = new URL(`http://${e.includes(":") && !e.startsWith("[") ? `[${e}]` : e}/`).hostname;
421
+ } catch {
422
+ return;
423
+ }
424
+ let n = /^\[(?:::ffff:|64:ff9b::)([0-9a-f]{1,4}):([0-9a-f]{1,4})\]$/.exec(t);
425
+ if (n) {
426
+ let e = parseInt(n[1], 16), t = parseInt(n[2], 16);
427
+ return [
428
+ e >> 8,
429
+ e & 255,
430
+ t >> 8,
431
+ t & 255
432
+ ].join(".");
433
+ }
434
+ return /^\d+\.\d+\.\d+\.\d+$/.test(t) ? t : void 0;
435
+ }, A = (e) => {
436
+ let t = Qe(e);
437
+ if (Ze.some((e) => t === e || t.endsWith(`.${e}`))) return !0;
438
+ let n = et(t);
439
+ return n !== void 0 && $e.includes(n);
440
+ }, tt = {
339
441
  scope: "network.fetch",
340
442
  category: "network",
341
443
  severity: 0,
342
444
  title: "Fetch data from other sites",
343
445
  description: "Lets the app download public data from other websites directly, past the usual cross-origin limits."
344
- }, Ye = {
446
+ }, nt = {
345
447
  scope: "network.fetchCredentialed",
346
448
  category: "network",
347
449
  severity: 3,
@@ -349,7 +451,7 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
349
451
  unsafe: !0,
350
452
  title: "Fetch from other sites, signed in as you",
351
453
  description: "Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see."
352
- }, Xe = {
454
+ }, rt = {
353
455
  scope: "network.fetchLocal",
354
456
  category: "network",
355
457
  severity: 3,
@@ -357,12 +459,12 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
357
459
  unsafe: !0,
358
460
  title: "Access devices on your local network",
359
461
  description: "Lets the app reach devices and services on your home or work network, which websites normally cannot touch."
360
- }, Ze = (e) => {
462
+ }, it = (e) => {
361
463
  let t = e.match(/^(\d+)\.(\d+)\.\d+\.\d+$/);
362
464
  if (!t) return !1;
363
465
  let [n, r] = [Number(t[1]), Number(t[2])];
364
466
  return n === 10 || n === 127 || n === 0 || n === 169 && r === 254 || n === 172 && r >= 16 && r <= 31 || n === 192 && r === 168;
365
- }, Qe = (e) => {
467
+ }, at = (e) => {
366
468
  let t;
367
469
  try {
368
470
  t = new URL(e);
@@ -370,40 +472,57 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
370
472
  return !1;
371
473
  }
372
474
  let n = t.hostname.replace(/^\[|\]$/g, "").toLowerCase().replace(/\.$/, "");
373
- return n === "localhost" || n.endsWith(".localhost") || n.endsWith(".local") || n.endsWith(".internal") || n.endsWith(".home.arpa") ? !0 : n.includes(":") ? n === "::" || n === "::1" || n.startsWith("fc") || n.startsWith("fd") || /^fe[89ab]/.test(n) || n.startsWith("::ffff:") : Ze(n);
374
- }, $e = (e) => {
475
+ return n === "localhost" || n.endsWith(".localhost") || n.endsWith(".local") || n.endsWith(".internal") || n.endsWith(".home.arpa") ? !0 : n.includes(":") ? n === "::" || n === "::1" || n.startsWith("fc") || n.startsWith("fd") || /^fe[89ab]/.test(n) || n.startsWith("::ffff:") : it(n);
476
+ }, ot = (e) => {
375
477
  let t;
376
478
  try {
377
479
  t = new URL(e);
378
480
  } catch {
379
481
  return !1;
380
482
  }
381
- return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" || qe(t.hostname);
382
- }, et = (e) => {
383
- if ($e(e)) throw Error("fetch: refusing to target the extension's own pages or FKN platform domains");
384
- }, tt = (e) => {
483
+ return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" || A(t.hostname);
484
+ }, st = (e) => {
485
+ if (ot(e)) throw Error("fetch: refusing to target the extension's own pages or FKN platform domains");
486
+ }, ct = (e) => {
385
487
  if (!e?.headers) return;
386
- let t = new Headers(e.headers), n = Be.map((e) => {
488
+ let t = new Headers(e.headers), n = k.map((e) => {
387
489
  let n = t.get(e);
388
490
  return n === null || n === "" ? void 0 : [e, n];
389
491
  }).filter((e) => e !== void 0);
390
492
  return n.length ? n : void 0;
391
- }, nt = async (e, t) => {
493
+ }, lt = async (e, t) => {
392
494
  let n = new Request(e, t);
393
- et(n.url);
495
+ st(n.url);
394
496
  let r = n.body ? await n.arrayBuffer() : null;
395
- return k.proxyFetch({
497
+ return O.proxyFetch({
396
498
  url: n.url,
397
499
  method: n.method,
398
500
  headers: [...n.headers],
399
501
  body: r,
400
502
  credentials: t?.credentials === "include" ? "include" : "omit",
401
503
  redirect: n.redirect,
402
- unsafeHeaders: tt(t),
504
+ unsafeHeaders: ct(t),
403
505
  reason: t?.reason,
404
506
  signal: t?.signal ?? void 0
405
507
  });
406
- }, rt = {
508
+ }, ut = (e) => {
509
+ for (let t of e) if (typeof t == "string" && A(t.trim().toLowerCase())) return t;
510
+ }, dt = (e) => {
511
+ let t = e.trim().toLowerCase().replace(/^\.+|\.+$/g, "");
512
+ return t !== "" && (A(t) || [...Ze, ...$e].some((e) => e.endsWith(`.${t}`)));
513
+ }, ft = (e) => {
514
+ for (let t of e) if (typeof t == "string" && dt(t)) return t;
515
+ }, pt = (e) => `${e}: refusing to target FKN platform domains`, mt = (e, t) => {
516
+ if (ut(t) !== void 0) throw Error(pt(e));
517
+ }, ht = (e) => {
518
+ try {
519
+ return new URL(String(e)).hostname;
520
+ } catch {
521
+ return "";
522
+ }
523
+ }, j = (e, t) => {
524
+ if (ft(t) !== void 0) throw Error(pt(e));
525
+ }, gt = {
407
526
  scope: "network.readCookie",
408
527
  category: "network",
409
528
  severity: 3,
@@ -411,7 +530,7 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
411
530
  unsafe: !0,
412
531
  title: "Read a site’s cookie",
413
532
  description: "Lets the app read a named cookie from another site, which can include the login token only that site should see."
414
- }, it = { get: (e) => k.getCookie(e) }, at = {
533
+ }, _t = { get: async (e) => (mt("cookies.get", [ht(e.url)]), O.getCookie(e)) }, vt = {
415
534
  scope: "network.modifyRequestHeaders",
416
535
  category: "network",
417
536
  severity: 2,
@@ -419,7 +538,7 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
419
538
  unsafe: !0,
420
539
  title: "Rewrite request headers to other sites",
421
540
  description: "Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites."
422
- }, ot = (e) => k.setRequestHeaderRule(e), st = (e) => k.removeRequestHeaderRule({ ruleId: e }), ct = class extends Error {
541
+ }, yt = async (e) => (j("setRequestHeaderRule", e.domains), Ye("setRequestHeaderRule", e.requestHeaders), O.setRequestHeaderRule(e)), bt = (e) => O.removeRequestHeaderRule({ ruleId: e }), xt = class extends Error {
423
542
  reason;
424
543
  filename;
425
544
  line;
@@ -428,18 +547,18 @@ var Ie = () => typeof document > "u" ? !1 : document.documentElement.dataset[Pe]
428
547
  constructor(e, t, n, r, i) {
429
548
  super(`${e}:${n}:${r}: ${t}`), this.reason = t, this.filename = e, this.line = n, this.column = r, this.source = i;
430
549
  }
431
- }, lt = class {
550
+ }, St = class {
432
551
  start;
433
552
  end;
434
553
  source;
435
554
  constructor(e, t, n) {
436
555
  this.start = e, this.end = t, this.source = n;
437
556
  }
438
- }, A;
557
+ }, M;
439
558
  (function(e) {
440
559
  e.stylesheet = "stylesheet", e.rule = "rule", e.declaration = "declaration", e.comment = "comment", e.atRule = "at-rule", e.container = "container", e.charset = "charset", e.counterStyle = "counter-style", e.document = "document", e.customMedia = "custom-media", e.fontFace = "font-face", e.fontFeatureValues = "font-feature-values", e.host = "host", e.import = "import", e.keyframes = "keyframes", e.keyframe = "keyframe", e.layer = "layer", e.media = "media", e.namespace = "namespace", e.page = "page", e.pageMarginBox = "page-margin-box", e.positionTry = "position-try", e.property = "property", e.scope = "scope", e.startingStyle = "starting-style", e.supports = "supports", e.viewTransition = "view-transition";
441
- })(A ||= {});
442
- var ut = (e, t, n) => {
560
+ })(M ||= {});
561
+ var Ct = (e, t, n) => {
443
562
  let r = n, i = 1e4;
444
563
  do {
445
564
  let n = t.map((t) => e.indexOf(t, r));
@@ -451,7 +570,7 @@ var ut = (e, t, n) => {
451
570
  r = o + 2, i--;
452
571
  } while (i > 0);
453
572
  throw Error("Too many escaping");
454
- }, j = (e, t, n) => {
573
+ }, N = (e, t, n) => {
455
574
  let r = n, i = 1e4;
456
575
  do {
457
576
  let n = t.map((t) => e.indexOf(t, r));
@@ -465,21 +584,21 @@ var ut = (e, t, n) => {
465
584
  break;
466
585
  case "(":
467
586
  {
468
- let t = j(e, [")"], o + 1);
587
+ let t = N(e, [")"], o + 1);
469
588
  if (t === -1) return -1;
470
589
  r = t + 1;
471
590
  }
472
591
  break;
473
592
  case "\"":
474
593
  {
475
- let t = ut(e, ["\""], o + 1);
594
+ let t = Ct(e, ["\""], o + 1);
476
595
  if (t === -1) return -1;
477
596
  r = t + 1;
478
597
  }
479
598
  break;
480
599
  case "'":
481
600
  {
482
- let t = ut(e, ["'"], o + 1);
601
+ let t = Ct(e, ["'"], o + 1);
483
602
  if (t === -1) return -1;
484
603
  r = t + 1;
485
604
  }
@@ -489,17 +608,17 @@ var ut = (e, t, n) => {
489
608
  i--;
490
609
  } while (i > 0);
491
610
  throw Error("Too many escaping");
492
- }, M = /\/\*[^]*?(?:\*\/|$)/g;
493
- function N(e) {
611
+ }, wt = /\/\*[^]*?(?:\*\/|$)/g;
612
+ function P(e) {
494
613
  return e ? e.trim() : "";
495
614
  }
496
- function P(e, t) {
615
+ function Tt(e, t) {
497
616
  let n = e && typeof e.type == "string", r = n ? e : t;
498
617
  for (let t in e) {
499
618
  let n = e[t];
500
619
  Array.isArray(n) ? n.forEach((e) => {
501
- P(e, r);
502
- }) : n && typeof n == "object" && P(n, r);
620
+ Tt(e, r);
621
+ }) : n && typeof n == "object" && Tt(n, r);
503
622
  }
504
623
  return n && Object.defineProperty(e, "parent", {
505
624
  configurable: !0,
@@ -508,7 +627,7 @@ function P(e, t) {
508
627
  value: t || null
509
628
  }), e;
510
629
  }
511
- var dt = class {
630
+ var Et = class {
512
631
  level = 0;
513
632
  indentation = " ";
514
633
  compress = !1;
@@ -523,33 +642,33 @@ var dt = class {
523
642
  }
524
643
  visit(e) {
525
644
  switch (e.type) {
526
- case A.stylesheet: return this.stylesheet(e);
527
- case A.rule: return this.rule(e);
528
- case A.declaration: return this.declaration(e);
529
- case A.comment: return this.comment(e);
530
- case A.container: return this.container(e);
531
- case A.charset: return this.charset(e);
532
- case A.counterStyle: return this.counterStyle(e);
533
- case A.document: return this.document(e);
534
- case A.customMedia: return this.customMedia(e);
535
- case A.fontFace: return this.fontFace(e);
536
- case A.fontFeatureValues: return this.fontFeatureValues(e);
537
- case A.host: return this.host(e);
538
- case A.import: return this.import(e);
539
- case A.keyframes: return this.keyframes(e);
540
- case A.keyframe: return this.keyframe(e);
541
- case A.layer: return this.layer(e);
542
- case A.media: return this.media(e);
543
- case A.namespace: return this.namespace(e);
544
- case A.page: return this.page(e);
545
- case A.pageMarginBox: return this.pageMarginBox(e);
546
- case A.positionTry: return this.positionTry(e);
547
- case A.property: return this.property(e);
548
- case A.scope: return this.scope(e);
549
- case A.startingStyle: return this.startingStyle(e);
550
- case A.supports: return this.supports(e);
551
- case A.viewTransition: return this.viewTransition(e);
552
- case A.atRule: return this.genericAtRule(e);
645
+ case M.stylesheet: return this.stylesheet(e);
646
+ case M.rule: return this.rule(e);
647
+ case M.declaration: return this.declaration(e);
648
+ case M.comment: return this.comment(e);
649
+ case M.container: return this.container(e);
650
+ case M.charset: return this.charset(e);
651
+ case M.counterStyle: return this.counterStyle(e);
652
+ case M.document: return this.document(e);
653
+ case M.customMedia: return this.customMedia(e);
654
+ case M.fontFace: return this.fontFace(e);
655
+ case M.fontFeatureValues: return this.fontFeatureValues(e);
656
+ case M.host: return this.host(e);
657
+ case M.import: return this.import(e);
658
+ case M.keyframes: return this.keyframes(e);
659
+ case M.keyframe: return this.keyframe(e);
660
+ case M.layer: return this.layer(e);
661
+ case M.media: return this.media(e);
662
+ case M.namespace: return this.namespace(e);
663
+ case M.page: return this.page(e);
664
+ case M.pageMarginBox: return this.pageMarginBox(e);
665
+ case M.positionTry: return this.positionTry(e);
666
+ case M.property: return this.property(e);
667
+ case M.scope: return this.scope(e);
668
+ case M.startingStyle: return this.startingStyle(e);
669
+ case M.supports: return this.supports(e);
670
+ case M.viewTransition: return this.viewTransition(e);
671
+ case M.atRule: return this.genericAtRule(e);
553
672
  }
554
673
  }
555
674
  mapVisit(e, t) {
@@ -645,7 +764,7 @@ var dt = class {
645
764
  let t = e.prelude ? ` ${e.prelude}` : "";
646
765
  if (this.compress) return this.emit(`@${e.name}${t}`, e.position) + (e.rules ? this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : ";");
647
766
  if (!e.rules) return this.emit(`${this.indent()}@${e.name}${t};`, e.position);
648
- let n = e.rules.some((e) => e.type !== A.declaration && e.type !== A.comment), r = n ? "\n\n" : "\n";
767
+ let n = e.rules.some((e) => e.type !== M.declaration && e.type !== M.comment), r = n ? "\n\n" : "\n";
649
768
  return this.emit(`${this.indent()}@${e.name}${t}`, e.position) + this.emit(n ? ` {\n${this.indent(1)}` : " {\n") + this.emit(n ? "" : this.indent(1)) + this.mapVisit(e.rules, r) + this.emit(n ? `\n${this.indent(-1)}${this.indent()}}` : `${this.indent(-1)}\n${this.indent()}}`);
650
769
  }
651
770
  rule(e) {
@@ -658,7 +777,7 @@ var dt = class {
658
777
  declaration(e) {
659
778
  return this.compress ? this.emit(`${e.property}:${e.value}`, e.position) + this.emit(";") : e.property === "grid-template-areas" ? this.emit(this.indent()) + this.emit(e.property + ": " + e.value.split("\n").join("\n".padEnd(22) + this.indent()), e.position) + this.emit(";") : this.emit(this.indent()) + this.emit(`${e.property}: ${e.value}`, e.position) + this.emit(";");
660
779
  }
661
- }, ft = (e, t) => {
780
+ }, Dt = (e, t) => {
662
781
  t ||= {};
663
782
  let n = 1, r = 1;
664
783
  function i() {
@@ -666,14 +785,14 @@ var dt = class {
666
785
  line: n,
667
786
  column: r
668
787
  };
669
- return (i) => (i.position = new lt(e, {
788
+ return (i) => (i.position = new St(e, {
670
789
  line: n,
671
790
  column: r
672
791
  }, t?.source || ""), u(), i);
673
792
  }
674
793
  let a = [];
675
794
  function o(i) {
676
- let o = new ct(t?.source || "", i, n, r, e);
795
+ let o = new xt(t?.source || "", i, n, r, e);
677
796
  if (!t?.silent) throw o;
678
797
  a.push(o);
679
798
  }
@@ -709,36 +828,36 @@ var dt = class {
709
828
  if (e.charAt(0) !== "/" || e.charAt(1) !== "*") return;
710
829
  let n = /^\/\*[^]*?\*\//.exec(e);
711
830
  return n ? (l(n), t({
712
- type: A.comment,
831
+ type: M.comment,
713
832
  comment: n[0].slice(2, -2)
714
833
  })) : o("End of comment missing");
715
834
  }
716
835
  function p() {
717
- let t = j(e, ["{"]);
836
+ let t = N(e, ["{"]);
718
837
  if (t === -1 || t === 0) return;
719
838
  let n = e.substring(0, t);
720
839
  return l([n]), ((e, t) => {
721
840
  let n = [], r = 0;
722
841
  for (; r < e.length;) {
723
- let i = j(e, t, r);
842
+ let i = N(e, t, r);
724
843
  if (i === -1) return n.push(e.substring(r)), n;
725
844
  n.push(e.substring(r, i)), r = i + 1;
726
845
  }
727
846
  return n;
728
- })(N(n).replace(M, ""), [","]).map((e) => N(e));
847
+ })(P(n).replace(wt, ""), [","]).map((e) => P(e));
729
848
  }
730
849
  function m() {
731
850
  let t = i(), n = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);
732
851
  if (!n) return;
733
852
  l(n);
734
- let r = N(n[0]), a = /^:\s*/.exec(e);
853
+ let r = P(n[0]), a = /^:\s*/.exec(e);
735
854
  if (!a) return o("property missing ':'");
736
855
  l(a);
737
- let s = "", c = j(e, [";", "}"]);
738
- c !== -1 && (s = e.substring(0, c), l([s]), s = N(s).replace(M, ""));
856
+ let s = "", c = N(e, [";", "}"]);
857
+ c !== -1 && (s = e.substring(0, c), l([s]), s = P(s).replace(wt, ""));
739
858
  let u = t({
740
- type: A.declaration,
741
- property: r.replace(M, ""),
859
+ type: M.declaration,
860
+ property: r.replace(wt, ""),
742
861
  value: s
743
862
  }), d = /^[;\s]*/.exec(e);
744
863
  return d && l(d), u;
@@ -757,9 +876,9 @@ var dt = class {
757
876
  return c() ? n : o("missing '}'");
758
877
  }
759
878
  function g() {
760
- let t = j(e, ["{"]);
879
+ let t = N(e, ["{"]);
761
880
  if (t === -1) return !1;
762
- let n = j(e, [";"]), r = j(e, ["}"]);
881
+ let n = N(e, [";"]), r = N(e, ["}"]);
763
882
  return !(n !== -1 && n < t) && !(r !== -1 && r < t);
764
883
  }
765
884
  function _() {
@@ -836,7 +955,7 @@ var dt = class {
836
955
  i && l(i), r = /^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);
837
956
  }
838
957
  if (t.length) return n({
839
- type: A.keyframe,
958
+ type: M.keyframe,
840
959
  values: t,
841
960
  declarations: h() || []
842
961
  });
@@ -879,7 +998,7 @@ var dt = class {
879
998
  let f = d(), p = y();
880
999
  for (; p;) f.push(p), f = f.concat(d()), p = y();
881
1000
  return c() ? t({
882
- type: A.keyframes,
1001
+ type: M.keyframes,
883
1002
  name: u,
884
1003
  vendor: r,
885
1004
  keyframes: f
@@ -887,11 +1006,11 @@ var dt = class {
887
1006
  }() || function() {
888
1007
  let t = i(), n = /^@media *([^{]+)/.exec(e);
889
1008
  if (!n) return;
890
- let r = N(l(n)[1]);
1009
+ let r = P(l(n)[1]);
891
1010
  if (!s()) return o("@media missing '{'");
892
1011
  let a = v();
893
1012
  return c() ? t({
894
- type: A.media,
1013
+ type: M.media,
895
1014
  media: r,
896
1015
  rules: a
897
1016
  }) : o("@media missing '}'");
@@ -900,29 +1019,29 @@ var dt = class {
900
1019
  if (!n) return;
901
1020
  let r = l(n);
902
1021
  return t({
903
- type: A.customMedia,
904
- name: N(r[1]),
905
- media: N(r[2])
1022
+ type: M.customMedia,
1023
+ name: P(r[1]),
1024
+ media: P(r[2])
906
1025
  });
907
1026
  }() || function() {
908
1027
  let t = i(), n = /^@supports *([^{]+)/.exec(e);
909
1028
  if (!n) return;
910
- let r = N(l(n)[1]);
1029
+ let r = P(l(n)[1]);
911
1030
  if (!s()) return o("@supports missing '{'");
912
1031
  let a = v();
913
1032
  return c() ? t({
914
- type: A.supports,
1033
+ type: M.supports,
915
1034
  supports: r,
916
1035
  rules: a
917
1036
  }) : o("@supports missing '}'");
918
1037
  }() || te() || ne() || re() || function() {
919
1038
  let t = i(), n = /^@([-\w]+)?document *([^{]+)/.exec(e);
920
1039
  if (!n) return;
921
- let r = l(n), a = N(r[1]), u = N(r[2]);
1040
+ let r = l(n), a = P(r[1]), u = P(r[2]);
922
1041
  if (!s()) return o("@document missing '{'");
923
1042
  let d = v();
924
1043
  return c() ? t({
925
- type: A.document,
1044
+ type: M.document,
926
1045
  document: u,
927
1046
  vendor: a,
928
1047
  rules: d
@@ -947,7 +1066,7 @@ var dt = class {
947
1066
  a.push(t), d(a);
948
1067
  }
949
1068
  return c() ? t({
950
- type: A.page,
1069
+ type: M.page,
951
1070
  selectors: r,
952
1071
  declarations: a
953
1072
  }) : o("@page missing '}'");
@@ -957,7 +1076,7 @@ var dt = class {
957
1076
  if (l(n), !s()) return o("@host missing '{'");
958
1077
  let r = v();
959
1078
  return c() ? t({
960
- type: A.host,
1079
+ type: M.host,
961
1080
  rules: r
962
1081
  }) : o("@host missing '}'");
963
1082
  }() || function() {
@@ -967,28 +1086,28 @@ var dt = class {
967
1086
  let r = d(), a = m();
968
1087
  for (; a;) r.push(a), r = r.concat(d()), a = m();
969
1088
  return c() ? t({
970
- type: A.fontFace,
1089
+ type: M.fontFace,
971
1090
  declarations: r
972
1091
  }) : o("@font-face missing '}'");
973
1092
  }() || function() {
974
1093
  let t = i(), n = /^@font-feature-values\s+([^{]+)/.exec(e);
975
1094
  if (!n) return;
976
- let r = N(l(n)[1]);
1095
+ let r = P(l(n)[1]);
977
1096
  if (!s()) return o("@font-feature-values missing '{'");
978
1097
  let a = v();
979
1098
  return c() ? t({
980
- type: A.fontFeatureValues,
1099
+ type: M.fontFeatureValues,
981
1100
  fontFamily: r,
982
1101
  rules: a
983
1102
  }) : o("@font-feature-values missing '}'");
984
1103
  }() || function() {
985
1104
  let t = i(), n = /^@container *([^{]+)/.exec(e);
986
1105
  if (!n) return;
987
- let r = N(l(n)[1]);
1106
+ let r = P(l(n)[1]);
988
1107
  if (!s()) return o("@container missing '{'");
989
1108
  let a = v();
990
1109
  return c() ? t({
991
- type: A.container,
1110
+ type: M.container,
992
1111
  container: r,
993
1112
  rules: a
994
1113
  }) : o("@container missing '}'");
@@ -998,23 +1117,23 @@ var dt = class {
998
1117
  if (l(n), !s()) return o("@starting-style missing '{'");
999
1118
  let r = v();
1000
1119
  return c() ? t({
1001
- type: A.startingStyle,
1120
+ type: M.startingStyle,
1002
1121
  rules: r
1003
1122
  }) : o("@starting-style missing '}'");
1004
1123
  }() || function() {
1005
1124
  let t = i(), n = /^@layer *([^{;@]+)/.exec(e);
1006
1125
  if (!n) return;
1007
- let r = N(l(n)[1]);
1126
+ let r = P(l(n)[1]);
1008
1127
  if (!s()) {
1009
1128
  let n = /^[;\s]*/.exec(e);
1010
1129
  return n && l(n), t({
1011
- type: A.layer,
1130
+ type: M.layer,
1012
1131
  layer: r
1013
1132
  });
1014
1133
  }
1015
1134
  let a = v();
1016
1135
  return c() ? t({
1017
- type: A.layer,
1136
+ type: M.layer,
1018
1137
  layer: r,
1019
1138
  rules: a
1020
1139
  }) : o("@layer missing '}'");
@@ -1026,7 +1145,7 @@ var dt = class {
1026
1145
  let a = d(), u = m();
1027
1146
  for (; u;) a.push(u), a = a.concat(d()), u = m();
1028
1147
  return c() ? t({
1029
- type: A.property,
1148
+ type: M.property,
1030
1149
  name: r,
1031
1150
  declarations: a
1032
1151
  }) : o("@property missing '}'");
@@ -1038,18 +1157,18 @@ var dt = class {
1038
1157
  let a = d(), u = m();
1039
1158
  for (; u;) a.push(u), a = a.concat(d()), u = m();
1040
1159
  return c() ? t({
1041
- type: A.counterStyle,
1160
+ type: M.counterStyle,
1042
1161
  name: r,
1043
1162
  declarations: a
1044
1163
  }) : o("@counter-style missing '}'");
1045
1164
  }() || function() {
1046
1165
  let t = i(), n = /^@scope\s*([^{]*)/.exec(e);
1047
1166
  if (!n) return;
1048
- let r = N(l(n)[1]);
1167
+ let r = P(l(n)[1]);
1049
1168
  if (!s()) return o("@scope missing '{'");
1050
1169
  let a = v();
1051
1170
  return c() ? t({
1052
- type: A.scope,
1171
+ type: M.scope,
1053
1172
  scope: r,
1054
1173
  rules: a
1055
1174
  }) : o("@scope missing '}'");
@@ -1060,7 +1179,7 @@ var dt = class {
1060
1179
  let r = d(), a = m();
1061
1180
  for (; a;) r.push(a), r = r.concat(d()), a = m();
1062
1181
  return c() ? t({
1063
- type: A.viewTransition,
1182
+ type: M.viewTransition,
1064
1183
  declarations: r
1065
1184
  }) : o("@view-transition missing '}'");
1066
1185
  }() || function() {
@@ -1071,7 +1190,7 @@ var dt = class {
1071
1190
  let a = d(), u = m();
1072
1191
  for (; u;) a.push(u), a = a.concat(d()), u = m();
1073
1192
  return c() ? t({
1074
- type: A.positionTry,
1193
+ type: M.positionTry,
1075
1194
  name: r,
1076
1195
  declarations: a
1077
1196
  }) : o("@position-try missing '}'");
@@ -1083,18 +1202,18 @@ var dt = class {
1083
1202
  let a = d(), u = m();
1084
1203
  for (; u;) a.push(u), a = a.concat(d()), u = m();
1085
1204
  return c() ? t({
1086
- type: A.pageMarginBox,
1205
+ type: M.pageMarginBox,
1087
1206
  name: r,
1088
1207
  declarations: a
1089
1208
  }) : o(`@${r} missing '}'`);
1090
1209
  }() || function() {
1091
1210
  let t = i(), n = /^@([-\w]+)\s*/.exec(e);
1092
1211
  if (!n) return;
1093
- let r = l(n)[1], a = "", u = j(e, ["{", ";"]);
1094
- if (u !== -1 && u > 0 && (a = N(e.substring(0, u)), l([e.substring(0, u)])), s()) {
1212
+ let r = l(n)[1], a = "", u = N(e, ["{", ";"]);
1213
+ if (u !== -1 && u > 0 && (a = P(e.substring(0, u)), l([e.substring(0, u)])), s()) {
1095
1214
  let e = v();
1096
1215
  return c() ? t({
1097
- type: A.atRule,
1216
+ type: M.atRule,
1098
1217
  name: r,
1099
1218
  prelude: a,
1100
1219
  rules: e
@@ -1102,7 +1221,7 @@ var dt = class {
1102
1221
  }
1103
1222
  let d = /^[;\s]*/.exec(e);
1104
1223
  return d && l(d), t({
1105
- type: A.atRule,
1224
+ type: M.atRule,
1106
1225
  name: r,
1107
1226
  prelude: a
1108
1227
  });
@@ -1111,12 +1230,12 @@ var dt = class {
1111
1230
  function S() {
1112
1231
  let e = i(), t = p();
1113
1232
  return t ? (d(), e({
1114
- type: A.rule,
1233
+ type: M.rule,
1115
1234
  selectors: t,
1116
1235
  declarations: _() || []
1117
1236
  })) : o("selector missing");
1118
1237
  }
1119
- return P(function() {
1238
+ return Tt(function() {
1120
1239
  let n = function() {
1121
1240
  let n, r = [];
1122
1241
  for (u(), d(r); e.length;) {
@@ -1139,7 +1258,7 @@ var dt = class {
1139
1258
  return r;
1140
1259
  }();
1141
1260
  return {
1142
- type: A.stylesheet,
1261
+ type: M.stylesheet,
1143
1262
  stylesheet: {
1144
1263
  source: t?.source,
1145
1264
  rules: n,
@@ -1147,66 +1266,66 @@ var dt = class {
1147
1266
  }
1148
1267
  };
1149
1268
  }());
1150
- }, pt = (e, t) => new dt(t || {}).compile(e), mt = Object.defineProperty, ht = (e, t) => {
1269
+ }, Ot = (e, t) => new Et(t || {}).compile(e), kt = Object.defineProperty, At = (e, t) => {
1151
1270
  let n = {};
1152
- for (var r in e) mt(n, r, {
1271
+ for (var r in e) kt(n, r, {
1153
1272
  get: e[r],
1154
1273
  enumerable: !0
1155
1274
  });
1156
- return t || mt(n, Symbol.toStringTag, { value: "Module" }), n;
1157
- }, gt = "LocatorError", F = "LocatorUnsupportedError", _t = "LocatorDeniedError", vt = "LocatorInvalidError", yt = (e) => typeof e == "object" && e ? e.name : void 0, I = (e) => Object.assign(Error(e), { name: gt }), L = (e, t = "", n) => Object.assign(Error(e), {
1158
- name: F,
1275
+ return t || kt(n, Symbol.toStringTag, { value: "Module" }), n;
1276
+ }, jt = "LocatorError", Mt = "LocatorUnsupportedError", Nt = "LocatorDeniedError", Pt = "LocatorInvalidError", Ft = (e) => typeof e == "object" && e ? e.name : void 0, F = (e) => Object.assign(Error(e), { name: jt }), I = (e, t = "", n) => Object.assign(Error(e), {
1277
+ name: Mt,
1159
1278
  operation: t,
1160
1279
  backend: n
1161
- }), bt = (e, t) => L(`Locator operation not supported${t ? ` on the ${t} backend` : ""}: ${e}`, e, t), xt = (e, t) => Object.assign(Error(e), {
1162
- name: _t,
1280
+ }), It = (e, t) => I(`Locator operation not supported${t ? ` on the ${t} backend` : ""}: ${e}`, e, t), L = (e, t) => Object.assign(Error(e), {
1281
+ name: Nt,
1163
1282
  operation: t
1164
- }), St = (e, t) => Object.assign(Error(e), {
1165
- name: vt,
1283
+ }), Lt = (e, t) => Object.assign(Error(e), {
1284
+ name: Pt,
1166
1285
  operation: t
1167
1286
  }), R = class extends Error {
1168
1287
  name = "TimeoutError";
1169
1288
  constructor(e, t) {
1170
1289
  super(e, t?.cause === void 0 ? void 0 : { cause: t.cause });
1171
1290
  }
1172
- }, Ct = (e) => yt(e) === F, wt = (e) => yt(e) === _t, z = (e) => yt(e) === vt, Tt = (e) => wt(e) || Ct(e) || z(e), B = (e) => {
1291
+ }, Rt = (e) => Ft(e) === Mt, zt = (e) => Ft(e) === Nt, z = (e) => Ft(e) === Pt, B = (e) => zt(e) || Rt(e) || z(e), V = (e) => {
1173
1292
  let t = (e.ownerDocument ?? e).defaultView;
1174
- if (!t) throw I("the resolved element belongs to a document with no window");
1293
+ if (!t) throw F("the resolved element belongs to a document with no window");
1175
1294
  return t;
1176
- }, Et = (e, t) => {
1295
+ }, Bt = (e, t) => {
1177
1296
  let n = e?.[t];
1178
1297
  return typeof n == "function" ? n : null;
1179
- }, V = (e, t) => {
1298
+ }, H = (e, t) => {
1180
1299
  if (typeof e != "object" || !e) return null;
1181
1300
  let n = (() => {
1182
1301
  try {
1183
- return Et(B(e), t);
1302
+ return Bt(V(e), t);
1184
1303
  } catch {
1185
1304
  return null;
1186
1305
  }
1187
1306
  })();
1188
1307
  if (n && e instanceof n) return n;
1189
- let r = Et(globalThis, t);
1308
+ let r = Bt(globalThis, t);
1190
1309
  return r && e instanceof r ? r : null;
1191
- }, H = (e, t) => V(e, t) !== null, U = (e) => {
1192
- if (e.length === 0) throw I("No elements found");
1193
- if (e.length > 1) throw I(`Strict mode violation: locator resolved to ${e.length} elements`);
1310
+ }, U = (e, t) => H(e, t) !== null, W = (e) => {
1311
+ if (e.length === 0) throw F("No elements found");
1312
+ if (e.length > 1) throw F(`Strict mode violation: locator resolved to ${e.length} elements`);
1194
1313
  return e[0];
1195
- }, Dt = (e, t) => {
1196
- if (!H(e, t)) throw I(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);
1314
+ }, Vt = (e, t) => {
1315
+ if (!U(e, t)) throw F(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);
1197
1316
  return e;
1198
- }, Ot = (e) => e.tagName.toLowerCase(), kt = /* @__PURE__ */ new Set(), At = (e) => {
1199
- kt.add(e);
1200
- }, jt = /(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i, Mt = (e) => e.replace(/\\([0-9a-fA-F]{1,6})\s?/g, (e, t) => String.fromCodePoint(Number.parseInt(t, 16))).replace(/\\(.)/g, "$1"), Nt = (e) => !jt.test(Mt(e.value)), Pt = /* @__PURE__ */ new Set([
1201
- A.import,
1202
- A.fontFace,
1203
- A.namespace,
1204
- A.charset,
1205
- A.document,
1206
- A.comment
1207
- ]), Ft = (e) => {
1208
- if (Pt.has(e.type)) return null;
1209
- if (e.type === A.declaration) return Nt(e) ? e : null;
1317
+ }, Ht = (e) => e.tagName.toLowerCase(), Ut = /* @__PURE__ */ new Set(), Wt = (e) => {
1318
+ Ut.add(e);
1319
+ }, Gt = /(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i, Kt = (e) => e.replace(/\\([0-9a-fA-F]{1,6})\s?/g, (e, t) => String.fromCodePoint(Number.parseInt(t, 16))).replace(/\\(.)/g, "$1"), qt = (e) => !Gt.test(Kt(e.value)), Jt = /* @__PURE__ */ new Set([
1320
+ M.import,
1321
+ M.fontFace,
1322
+ M.namespace,
1323
+ M.charset,
1324
+ M.document,
1325
+ M.comment
1326
+ ]), Yt = (e) => {
1327
+ if (Jt.has(e.type)) return null;
1328
+ if (e.type === M.declaration) return qt(e) ? e : null;
1210
1329
  let t = e, n = { ...t };
1211
1330
  for (let e of [
1212
1331
  "declarations",
@@ -1214,18 +1333,18 @@ var dt = class {
1214
1333
  "keyframes"
1215
1334
  ]) {
1216
1335
  let r = t[e];
1217
- Array.isArray(r) && (n[e] = It(r));
1336
+ Array.isArray(r) && (n[e] = Xt(r));
1218
1337
  }
1219
1338
  return n;
1220
- }, It = (e) => e.map((e) => Ft(e)).filter((e) => e !== null), Lt = (e) => {
1339
+ }, Xt = (e) => e.map((e) => Yt(e)).filter((e) => e !== null), Zt = (e) => {
1221
1340
  let t;
1222
1341
  try {
1223
- t = ft(e, { silent: !0 });
1342
+ t = Dt(e, { silent: !0 });
1224
1343
  } catch {
1225
1344
  return "";
1226
1345
  }
1227
- return t.stylesheet.rules = It(t.stylesheet.rules), pt(t);
1228
- }, Rt = (e, t) => {
1346
+ return t.stylesheet.rules = Xt(t.stylesheet.rules), Ot(t);
1347
+ }, Qt = (e, t) => {
1229
1348
  let n = () => {
1230
1349
  t.parentNode || (e.head ?? e.documentElement).appendChild(t);
1231
1350
  };
@@ -1242,30 +1361,30 @@ var dt = class {
1242
1361
  });
1243
1362
  let i = () => r.disconnect(), a = e.defaultView;
1244
1363
  a ? a.addEventListener("load", i, { once: !0 }) : setTimeout(i, 3e4);
1245
- }, zt = { resolve: (e, t) => {
1364
+ }, $t = { resolve: (e, t) => {
1246
1365
  let n = e.document.createElement("style");
1247
- n.textContent = t.noSanitize ? t.content : Lt(t.content);
1366
+ n.textContent = t.noSanitize ? t.content : Zt(t.content);
1248
1367
  try {
1249
- Rt(e.document, n);
1368
+ Qt(e.document, n);
1250
1369
  } catch (e) {
1251
1370
  console.error(e);
1252
1371
  }
1253
- At(n);
1254
- } }, Bt = (e) => {
1372
+ Wt(n);
1373
+ } }, en = (e) => {
1255
1374
  let t = [];
1256
1375
  return e.forEach((e, n) => {
1257
1376
  t.push([n, e]);
1258
1377
  }), t;
1259
- }, W = {
1378
+ }, G = {
1260
1379
  kind: "frame",
1261
1380
  ensureArgs: (e) => [void 0, e],
1262
1381
  resolve: async (e, t, n = {}) => {
1263
- if (typeof t != "string") throw St("fetch: url must be a string", "fetch");
1264
- let r = B(e.document), i;
1382
+ if (typeof t != "string") throw Lt("fetch: url must be a string", "fetch");
1383
+ let r = V(e.document), i;
1265
1384
  try {
1266
1385
  i = new r.URL(t, e.document.baseURI).href;
1267
1386
  } catch {
1268
- throw St(`fetch: not a valid url: ${t}`, "fetch");
1387
+ throw Lt(`fetch: not a valid url: ${t}`, "fetch");
1269
1388
  }
1270
1389
  let a = await r.fetch(i, {
1271
1390
  method: n.method ?? "GET",
@@ -1281,31 +1400,31 @@ var dt = class {
1281
1400
  url: a.url,
1282
1401
  redirected: a.redirected,
1283
1402
  type: a.type,
1284
- headers: Bt(a.headers),
1403
+ headers: en(a.headers),
1285
1404
  body: await a.arrayBuffer()
1286
1405
  };
1287
1406
  }
1288
- }, G = /* @__PURE__ */ ht({
1289
- click: () => Ht,
1290
- count: () => Xt,
1291
- exists: () => Zt,
1292
- fill: () => Kt,
1293
- getAttribute: () => Jt,
1294
- hover: () => Ut,
1295
- isVisible: () => Yt,
1296
- textContent: () => qt
1297
- }), Vt = (e, t) => {
1407
+ }, K = /* @__PURE__ */ At({
1408
+ click: () => nn,
1409
+ count: () => dn,
1410
+ exists: () => fn,
1411
+ fill: () => sn,
1412
+ getAttribute: () => ln,
1413
+ hover: () => rn,
1414
+ isVisible: () => un,
1415
+ textContent: () => cn
1416
+ }), tn = (e, t) => {
1298
1417
  let n = e.getBoundingClientRect();
1299
1418
  return {
1300
1419
  clientX: n.left + n.width * (t?.x ?? .5),
1301
1420
  clientY: n.top + n.height * (t?.y ?? .5)
1302
1421
  };
1303
- }, Ht = { resolve: (e, t = {}) => {
1304
- let n = U(e.elements), r = B(n), i = {
1422
+ }, nn = { resolve: (e, t = {}) => {
1423
+ let n = W(e.elements), r = V(n), i = {
1305
1424
  bubbles: !0,
1306
1425
  cancelable: !0,
1307
1426
  composed: !0,
1308
- ...Vt(n, t.position),
1427
+ ...tn(n, t.position),
1309
1428
  button: 0
1310
1429
  }, a = {
1311
1430
  ...i,
@@ -1329,12 +1448,12 @@ var dt = class {
1329
1448
  ...i,
1330
1449
  buttons: 0
1331
1450
  }));
1332
- } }, Ut = { resolve: (e, t = {}) => {
1333
- let n = U(e.elements), r = B(n), i = {
1451
+ } }, rn = { resolve: (e, t = {}) => {
1452
+ let n = W(e.elements), r = V(n), i = {
1334
1453
  bubbles: !0,
1335
1454
  cancelable: !0,
1336
1455
  composed: !0,
1337
- ...Vt(n, t.position)
1456
+ ...tn(n, t.position)
1338
1457
  }, a = {
1339
1458
  ...i,
1340
1459
  pointerType: "mouse",
@@ -1348,11 +1467,11 @@ var dt = class {
1348
1467
  ...i,
1349
1468
  bubbles: !1
1350
1469
  })), n.dispatchEvent(new r.MouseEvent("mouseover", i)), n.dispatchEvent(new r.PointerEvent("pointermove", a)), n.dispatchEvent(new r.MouseEvent("mousemove", i));
1351
- } }, Wt = (e, t) => {
1470
+ } }, an = (e, t) => {
1352
1471
  e._valueTracker?.setValue("");
1353
- let n = (V(e, "HTMLTextAreaElement") ?? V(e, "HTMLInputElement"))?.prototype, r = n && Object.getOwnPropertyDescriptor(n, "value")?.set;
1472
+ let n = (H(e, "HTMLTextAreaElement") ?? H(e, "HTMLInputElement"))?.prototype, r = n && Object.getOwnPropertyDescriptor(n, "value")?.set;
1354
1473
  r ? r.call(e, t) : e.value = t;
1355
- }, Gt = (e, t) => {
1474
+ }, on = (e, t) => {
1356
1475
  if (e.type !== "range") return null;
1357
1476
  let n = Number(e.min || 0), r = Number(e.max || 100);
1358
1477
  if (!Number.isFinite(n) || !Number.isFinite(r) || r <= n) return null;
@@ -1389,61 +1508,61 @@ var dt = class {
1389
1508
  buttons: 0
1390
1509
  }
1391
1510
  };
1392
- }, Kt = { resolve: (e, t, n = {}) => {
1393
- let r = U(e.elements), i = B(r), a = H(r, "HTMLInputElement");
1394
- if (a || H(r, "HTMLTextAreaElement")) {
1395
- let e = r, n = a ? Gt(e, t) : null;
1396
- n && (r.dispatchEvent(new i.PointerEvent("pointerdown", n.pointerDown)), r.dispatchEvent(new i.MouseEvent("mousedown", n.mouseDown))), Wt(e, t), r.dispatchEvent(new i.Event("input", { bubbles: !0 })), n && (r.dispatchEvent(new i.PointerEvent("pointerup", n.pointerUp)), r.dispatchEvent(new i.MouseEvent("mouseup", n.mouseUp))), r.dispatchEvent(new i.Event("change", { bubbles: !0 }));
1511
+ }, sn = { resolve: (e, t, n = {}) => {
1512
+ let r = W(e.elements), i = V(r), a = U(r, "HTMLInputElement");
1513
+ if (a || U(r, "HTMLTextAreaElement")) {
1514
+ let e = r, n = a ? on(e, t) : null;
1515
+ n && (r.dispatchEvent(new i.PointerEvent("pointerdown", n.pointerDown)), r.dispatchEvent(new i.MouseEvent("mousedown", n.mouseDown))), an(e, t), r.dispatchEvent(new i.Event("input", { bubbles: !0 })), n && (r.dispatchEvent(new i.PointerEvent("pointerup", n.pointerUp)), r.dispatchEvent(new i.MouseEvent("mouseup", n.mouseUp))), r.dispatchEvent(new i.Event("change", { bubbles: !0 }));
1397
1516
  return;
1398
1517
  }
1399
- if (H(r, "HTMLElement") && r.isContentEditable) {
1518
+ if (U(r, "HTMLElement") && r.isContentEditable) {
1400
1519
  r.textContent = t, r.dispatchEvent(new i.Event("input", { bubbles: !0 }));
1401
1520
  return;
1402
1521
  }
1403
- throw Error(`fill: element <${Ot(r)}> is not fillable`);
1404
- } }, qt = { resolve: (e, t = {}) => U(e.elements).textContent }, Jt = { resolve: (e, t, n = {}) => U(e.elements).getAttribute(t) }, Yt = { resolve: (e, t = {}) => {
1405
- let n = U(e.elements);
1406
- if (!H(n, "HTMLElement")) return !0;
1407
- let r = B(n).getComputedStyle(n);
1522
+ throw Error(`fill: element <${Ht(r)}> is not fillable`);
1523
+ } }, cn = { resolve: (e, t = {}) => W(e.elements).textContent }, ln = { resolve: (e, t, n = {}) => W(e.elements).getAttribute(t) }, un = { resolve: (e, t = {}) => {
1524
+ let n = W(e.elements);
1525
+ if (!U(n, "HTMLElement")) return !0;
1526
+ let r = V(n).getComputedStyle(n);
1408
1527
  if (r?.display === "none" || r?.visibility === "hidden") return !1;
1409
1528
  let i = n.getBoundingClientRect();
1410
1529
  return i.width > 0 && i.height > 0;
1411
- } }, Xt = { resolve: (e, t = {}) => e.elements.length }, Zt = { resolve: (e, t = {}) => e.elements.length > 0 }, K = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(t)]), q = (e) => e.replaceAll("\"", "\\\""), Qt = {
1530
+ } }, dn = { resolve: (e, t = {}) => e.elements.length }, fn = { resolve: (e, t = {}) => e.elements.length > 0 }, q = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(t)]), pn = (e) => e.replaceAll("\"", "\\\""), mn = {
1412
1531
  to: "element",
1413
1532
  css: !0,
1414
- resolve: (e, t) => K(e, t),
1533
+ resolve: (e, t) => q(e, t),
1415
1534
  render: (e) => ({
1416
1535
  fragment: typeof e == "string" ? e : "?",
1417
1536
  separator: "descend"
1418
1537
  })
1419
- }, $t = {
1538
+ }, hn = {
1420
1539
  to: "frame",
1421
1540
  css: !0,
1422
1541
  barrier: "down",
1423
- resolve: (e, t) => K(e, t),
1542
+ resolve: (e, t) => q(e, t),
1424
1543
  render: (e) => ({
1425
1544
  fragment: typeof e == "string" ? e : "?",
1426
1545
  separator: "down"
1427
1546
  })
1428
- }, en = {
1547
+ }, gn = {
1429
1548
  element: {
1430
1549
  selectors: {
1431
- locator: Qt,
1432
- frameLocator: $t,
1550
+ locator: mn,
1551
+ frameLocator: hn,
1433
1552
  getByRole: {
1434
1553
  to: "element",
1435
- resolve: (e, t) => K(e, `[role="${CSS.escape(t)}"]`),
1436
- render: (e) => ({ fragment: typeof e == "string" ? `[role="${q(e)}"]` : "[role]" })
1554
+ resolve: (e, t) => q(e, `[role="${CSS.escape(t)}"]`),
1555
+ render: (e) => ({ fragment: typeof e == "string" ? `[role="${pn(e)}"]` : "[role]" })
1437
1556
  },
1438
1557
  getByText: {
1439
1558
  to: "element",
1440
1559
  resolve: (e, t) => e.elements.flatMap((e) => [e, ...e.querySelectorAll("*")]).filter((e) => e.textContent?.includes(t)),
1441
- render: (e) => ({ fragment: typeof e == "string" ? `:has-text("${q(e)}")` : ":has-text(...)" })
1560
+ render: (e) => ({ fragment: typeof e == "string" ? `:has-text("${pn(e)}")` : ":has-text(...)" })
1442
1561
  },
1443
1562
  getByTestId: {
1444
1563
  to: "element",
1445
- resolve: (e, t) => K(e, `[data-testid="${CSS.escape(t)}"]`),
1446
- render: (e) => ({ fragment: typeof e == "string" ? `[data-testid="${q(e)}"]` : "[data-testid]" })
1564
+ resolve: (e, t) => q(e, `[data-testid="${CSS.escape(t)}"]`),
1565
+ render: (e) => ({ fragment: typeof e == "string" ? `[data-testid="${pn(e)}"]` : "[data-testid]" })
1447
1566
  },
1448
1567
  first: {
1449
1568
  to: "element",
@@ -1460,20 +1579,20 @@ var dt = class {
1460
1579
  }
1461
1580
  },
1462
1581
  operations: {
1463
- click: Ht,
1464
- fill: Kt,
1465
- hover: Ut,
1466
- textContent: qt,
1467
- getAttribute: Jt,
1468
- isVisible: Yt,
1469
- count: Xt,
1470
- exists: Zt
1582
+ click: nn,
1583
+ fill: sn,
1584
+ hover: rn,
1585
+ textContent: cn,
1586
+ getAttribute: ln,
1587
+ isVisible: un,
1588
+ count: dn,
1589
+ exists: fn
1471
1590
  }
1472
1591
  },
1473
1592
  frame: {
1474
1593
  selectors: {
1475
- locator: Qt,
1476
- frameLocator: $t,
1594
+ locator: mn,
1595
+ frameLocator: hn,
1477
1596
  owner: {
1478
1597
  to: "frame",
1479
1598
  barrier: "up",
@@ -1487,11 +1606,11 @@ var dt = class {
1487
1606
  }
1488
1607
  },
1489
1608
  operations: {
1490
- addStyleTag: zt,
1491
- fetch: W
1609
+ addStyleTag: $t,
1610
+ fetch: G
1492
1611
  }
1493
1612
  }
1494
- }, tn = (e, t = en) => ({
1613
+ }, _n = (e, t = gn) => ({
1495
1614
  element: {
1496
1615
  selectors: {
1497
1616
  ...t.element.selectors,
@@ -1512,31 +1631,31 @@ var dt = class {
1512
1631
  ...e.frame?.operations
1513
1632
  }
1514
1633
  }
1515
- }), nn = 3e4, rn = 50, an = (e) => {
1634
+ }), vn = 3e4, yn = 50, bn = (e) => {
1516
1635
  let t = e[e.length - 1];
1517
1636
  return typeof t == "object" && t ? t : void 0;
1518
- }, on = (e) => {
1519
- let t = an(e)?.timeout;
1520
- return typeof t == "number" ? t : nn;
1521
- }, sn = ({ executor: e, parts: t }) => ({ highlight: (n) => e.highlight(t, n).then(() => {}, () => {}) }), cn = async (e) => {
1637
+ }, xn = (e) => {
1638
+ let t = bn(e)?.timeout;
1639
+ return typeof t == "number" ? t : vn;
1640
+ }, Sn = ({ executor: e, parts: t }) => ({ highlight: (n) => e.highlight(t, n).then(() => {}, () => {}) }), Cn = async (e) => {
1522
1641
  let t = {
1523
1642
  parts: e.parts,
1524
1643
  operation: e.operation,
1525
1644
  args: e.args,
1526
1645
  phase: "ensure"
1527
1646
  };
1528
- await e.gate?.(t, sn(e));
1529
- }, ln = (e, t) => {
1647
+ await e.gate?.(t, Sn(e));
1648
+ }, wn = (e, t) => {
1530
1649
  if (t !== void 0 && typeof t == "number" && !(Number.isFinite(t) && t > 0)) throw TypeError(`${e}: timeout must be a positive number of milliseconds, not ${t}; every call ends at its deadline, so 0 does not turn it off`);
1531
- }, un = (e) => typeof e == "object" && e && typeof e.message == "string" ? e.message : String(e), dn = async (e) => {
1650
+ }, Tn = (e) => typeof e == "object" && e && typeof e.message == "string" ? e.message : String(e), En = async (e) => {
1532
1651
  let { executor: t, gate: n, parts: r, operation: i, args: a } = e;
1533
- ln(i, an(a)?.timeout), n && await n({
1652
+ wn(i, bn(a)?.timeout), n && await n({
1534
1653
  parts: r,
1535
1654
  operation: i,
1536
1655
  args: a,
1537
1656
  phase: "execute"
1538
- }, sn(e));
1539
- let o = on(a), s = Date.now() + o, c = /* @__PURE__ */ Error(`Locator timeout (${o}ms): ${i}`), { promise: l, reject: u } = Promise.withResolvers();
1657
+ }, Sn(e));
1658
+ let o = xn(a), s = Date.now() + o, c = /* @__PURE__ */ Error(`Locator timeout (${o}ms): ${i}`), { promise: l, reject: u } = Promise.withResolvers();
1540
1659
  l.catch(() => {});
1541
1660
  let d = setTimeout(() => u(c), o), f = c;
1542
1661
  try {
@@ -1544,62 +1663,47 @@ var dt = class {
1544
1663
  return await Promise.race([t.execute(r, i, a), l]);
1545
1664
  } catch (e) {
1546
1665
  if (e === c) break;
1547
- if (Tt(e)) throw e;
1666
+ if (B(e)) throw e;
1548
1667
  f = e;
1549
1668
  let t = s - Date.now();
1550
1669
  if (t <= 0) break;
1551
- await new Promise((e) => setTimeout(e, Math.min(rn, t)));
1670
+ await new Promise((e) => setTimeout(e, Math.min(yn, t)));
1552
1671
  }
1553
1672
  } finally {
1554
1673
  clearTimeout(d);
1555
1674
  }
1556
- throw f === c ? new R(c.message) : new R(un(f), { cause: f });
1557
- }, fn = (e, t, n, r, i) => {
1675
+ throw f === c ? new R(c.message) : new R(Tn(f), { cause: f });
1676
+ }, Dn = (e, t, n, r, i) => {
1558
1677
  let a = {};
1559
- for (let [o, s] of Object.entries(t[r].selectors)) a[o] = (...a) => fn(e, t, n, s.to, [...i, {
1678
+ for (let [o, s] of Object.entries(t[r].selectors)) a[o] = (...a) => Dn(e, t, n, s.to, [...i, {
1560
1679
  kind: r,
1561
1680
  name: o,
1562
1681
  args: a
1563
1682
  }]);
1564
- for (let [n, o] of Object.entries(t[r].operations)) a[n] = async (...t) => dn({
1683
+ for (let [n, o] of Object.entries(t[r].operations)) a[n] = async (...t) => En({
1565
1684
  ...e,
1566
1685
  parts: i,
1567
1686
  operation: n,
1568
1687
  args: o.send ? o.send(...t) : t
1569
1688
  });
1570
- for (let [o, { to: s, rewrite: c }] of Object.entries(n[r] ?? {})) a[o] = (...r) => fn(e, t, n, s, c(i, ...r));
1689
+ for (let [o, { to: s, rewrite: c }] of Object.entries(n[r] ?? {})) a[o] = (...r) => Dn(e, t, n, s, c(i, ...r));
1571
1690
  return a.ensure = (n, a = {}) => {
1572
1691
  let o = t[r].operations[n]?.ensureArgs;
1573
- return cn({
1692
+ return Cn({
1574
1693
  ...e,
1575
1694
  parts: i,
1576
1695
  operation: n,
1577
1696
  args: o?.(a) ?? [a]
1578
1697
  });
1579
1698
  }, a;
1580
- }, pn = (e) => fn(e, e.modules ?? en, e.rewrites ?? {}, "frame", []), mn = (e, t) => {
1581
- let n = e[t.kind];
1582
- if (!n) throw L(`Unknown locator kind: "${t.kind}"`, t.name);
1583
- let r = n.selectors[t.name];
1584
- if (!r) throw L(`Unknown selector: "${t.kind}.${t.name}"`, t.name);
1585
- return r;
1586
- }, hn = (e, t) => {
1587
- for (let n = 0; n < t.length; n++) {
1588
- let r = mn(e, t[n]);
1589
- if (r.barrier) return {
1590
- module: r,
1591
- index: n
1592
- };
1593
- }
1594
- return null;
1595
- }, gn = () => {
1699
+ }, On = (e) => Dn(e, e.modules ?? gn, e.rewrites ?? {}, "frame", []), kn = () => {
1596
1700
  let e = E();
1597
1701
  return e.status === "ok" && e.abi >= 2;
1598
- }, _n = async () => {
1599
- await O();
1702
+ }, An = async () => {
1703
+ await D();
1600
1704
  let e = E();
1601
1705
  if (e.status === "ok" && e.abi < 2) throw new w(e.abi, 2);
1602
- }, vn = (e) => `Read the text, links and details ${e} shows.`, yn = (e) => `Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`, bn = [
1706
+ }, jn = (e) => `Read the text, links and details ${e} shows.`, Mn = (e) => `Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`, Nn = [
1603
1707
  {
1604
1708
  id: "interaction",
1605
1709
  heading: "Interaction",
@@ -1614,9 +1718,9 @@ var dt = class {
1614
1718
  heading: "Site data",
1615
1719
  summary: "Can read the website's data",
1616
1720
  title: (e) => `Read data from ${e}`,
1617
- description: vn,
1721
+ description: jn,
1618
1722
  cloudTitle: (e) => `Read what's on ${e}`,
1619
- cloudDescription: vn
1723
+ cloudDescription: jn
1620
1724
  },
1621
1725
  {
1622
1726
  id: "network",
@@ -1632,11 +1736,11 @@ var dt = class {
1632
1736
  heading: "Evaluation",
1633
1737
  summary: "Can execute arbitrary code on the website",
1634
1738
  title: (e) => `Run code on ${e}`,
1635
- description: yn,
1739
+ description: Mn,
1636
1740
  cloudTitle: (e) => `Run its own code on ${e}`,
1637
- cloudDescription: yn
1741
+ cloudDescription: Mn
1638
1742
  }
1639
- ], xn = (e) => (t) => {
1743
+ ], Pn = (e) => (t) => {
1640
1744
  if (typeof t != "object" || !t) return t === void 0 ? [] : [t];
1641
1745
  if (t.position !== void 0) throw TypeError(`${e}: position is Playwright's offset in pixels, which no backend serves yet; pass relativePosition, a 0..1 fraction of the box`);
1642
1746
  let { relativePosition: n, ...r } = t;
@@ -1644,40 +1748,46 @@ var dt = class {
1644
1748
  ...r,
1645
1749
  position: n
1646
1750
  }];
1647
- }, Sn = tn({
1751
+ }, Fn = async (e, t, n) => {
1752
+ try {
1753
+ return await G.resolve(e, t, n);
1754
+ } catch (e) {
1755
+ throw B(e) ? e : L(`frame.fetch: ${e instanceof Error ? `${e.name}: ${e.message}` : String(e)}; not retried, since the request may already have been sent`, "fetch");
1756
+ }
1757
+ }, In = _n({
1648
1758
  element: { operations: {
1649
1759
  click: {
1650
- resolve: (e, t = {}) => G.click.resolve(e, t),
1651
- send: xn("click")
1760
+ resolve: (e, t = {}) => K.click.resolve(e, t),
1761
+ send: Pn("click")
1652
1762
  },
1653
1763
  hover: {
1654
- resolve: (e, t = {}) => G.hover.resolve(e, t),
1655
- send: xn("hover")
1764
+ resolve: (e, t = {}) => K.hover.resolve(e, t),
1765
+ send: Pn("hover")
1656
1766
  },
1657
- fill: { resolve: (e, t, n = {}) => G.fill.resolve(e, t, n) },
1658
- textContent: { resolve: (e, t = {}) => G.textContent.resolve(e) },
1659
- getAttribute: { resolve: (e, t, n = {}) => G.getAttribute.resolve(e, t) },
1660
- isVisible: { resolve: (e, t = {}) => G.isVisible.resolve(e) },
1661
- count: { resolve: (e, t = {}) => G.count.resolve(e) },
1662
- exists: { resolve: (e, t = {}) => G.exists.resolve(e) },
1663
- videoElement: { resolve: (e, t = {}) => _e(Dt(U(e.elements), "HTMLVideoElement")) }
1767
+ fill: { resolve: (e, t, n = {}) => K.fill.resolve(e, t, n) },
1768
+ textContent: { resolve: (e, t = {}) => K.textContent.resolve(e) },
1769
+ getAttribute: { resolve: (e, t, n = {}) => K.getAttribute.resolve(e, t) },
1770
+ isVisible: { resolve: (e, t = {}) => K.isVisible.resolve(e) },
1771
+ count: { resolve: (e, t = {}) => K.count.resolve(e) },
1772
+ exists: { resolve: (e, t = {}) => K.exists.resolve(e) },
1773
+ videoElement: { resolve: (e, t = {}) => _e(Vt(W(e.elements), "HTMLVideoElement")) }
1664
1774
  } },
1665
1775
  frame: { operations: {
1666
- addStyleTag: { resolve: (e, t) => zt.resolve(e, t) },
1776
+ addStyleTag: { resolve: (e, t) => $t.resolve(e, t) },
1667
1777
  fetch: {
1668
- resolve: (e, t, n = {}) => W.resolve(e, t, n),
1669
- kind: W.kind,
1670
- ensureArgs: W.ensureArgs
1778
+ resolve: (e, t, n = {}) => Fn(e, t, n),
1779
+ kind: G.kind,
1780
+ ensureArgs: G.ensureArgs
1671
1781
  },
1672
1782
  evaluate: {
1673
1783
  kind: "frame",
1674
1784
  typed: !1,
1675
1785
  resolve: (e, t, n) => {
1676
- throw bt("evaluate", "this realm");
1786
+ throw It("evaluate", "this realm");
1677
1787
  }
1678
1788
  }
1679
1789
  } }
1680
- }), Cn = (e) => e[e.length - 1], wn = {
1790
+ }), Ln = (e) => e[e.length - 1], Rn = {
1681
1791
  element: {
1682
1792
  last: {
1683
1793
  to: "element",
@@ -1690,7 +1800,7 @@ var dt = class {
1690
1800
  contentFrame: {
1691
1801
  to: "frame",
1692
1802
  rewrite: (e) => {
1693
- let t = Cn(e);
1803
+ let t = Ln(e);
1694
1804
  if (t?.name !== "locator") throw TypeError("locator.contentFrame: only a locator that ends in locator(selector) can enter its frame; use frameLocator(selector)");
1695
1805
  return [...e.slice(0, -1), {
1696
1806
  ...t,
@@ -1703,7 +1813,7 @@ var dt = class {
1703
1813
  owner: {
1704
1814
  to: "element",
1705
1815
  rewrite: (e) => {
1706
- let t = Cn(e);
1816
+ let t = Ln(e);
1707
1817
  if (t?.name !== "frameLocator") throw TypeError("frameLocator.owner: this frame was not entered through frameLocator(selector)");
1708
1818
  return [...e.slice(0, -1), {
1709
1819
  ...t,
@@ -1720,7 +1830,7 @@ var dt = class {
1720
1830
  }]
1721
1831
  }
1722
1832
  }
1723
- }, Tn = (e) => {
1833
+ }, zn = (e) => {
1724
1834
  if (!e || e === "about:blank") return !1;
1725
1835
  let t;
1726
1836
  try {
@@ -1728,46 +1838,46 @@ var dt = class {
1728
1838
  } catch {
1729
1839
  return !1;
1730
1840
  }
1731
- return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" || t.protocol !== "about:" && qe(t.hostname);
1841
+ return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" || t.protocol !== "about:" && A(t.hostname);
1732
1842
  }, J = (e) => {
1733
- if (Tn(e)) throw Error("attachFrame: refusing to target the extension's own pages or an FKN platform origin");
1734
- }, En = ({ src: e, domains: t, lockdown: n }) => {
1843
+ if (zn(e)) throw Error("attachFrame: refusing to target the extension's own pages or an FKN platform origin");
1844
+ }, Bn = ({ src: e, domains: t, lockdown: n }) => {
1735
1845
  if (n && !t.length && e && e !== "about:blank") throw Error("attachFrame: lockdown needs domains when the frame already has a src; pass domains or load it via goto");
1736
- }, Dn = {
1846
+ }, Vn = {
1737
1847
  scope: "embed.iframe",
1738
1848
  category: "interaction",
1739
1849
  severity: 0,
1740
1850
  title: "Load another website inside this app",
1741
1851
  description: "Lets the app embed external pages directly inside its own view."
1742
- }, On = {
1852
+ }, Hn = {
1743
1853
  scope: "embed.open",
1744
1854
  category: "interaction",
1745
1855
  severity: 0,
1746
1856
  title: "Open a website inside this app",
1747
1857
  description: "Lets the app navigate to another site without leaving its window."
1748
- }, kn = ["load", "commit"], An = (e) => {
1858
+ }, Un = ["load", "commit"], Wn = (e) => {
1749
1859
  if ("timeoutMs" in e) throw TypeError("frame.goto: pass timeout, in milliseconds; timeoutMs is not an option");
1750
1860
  let { waitUntil: t, timeout: n } = e;
1751
- if (t !== void 0 && !kn.includes(t)) throw TypeError(`frame.goto: waitUntil must be 'load' or 'commit', not ${JSON.stringify(t)}`);
1861
+ if (t !== void 0 && !Un.includes(t)) throw TypeError(`frame.goto: waitUntil must be 'load' or 'commit', not ${JSON.stringify(t)}`);
1752
1862
  if (n !== void 0 && typeof n != "number") throw TypeError("frame.goto: timeout must be a number of milliseconds");
1753
- ln("frame.goto", n);
1754
- }, jn = class extends Error {
1863
+ wn("frame.goto", n);
1864
+ }, Gn = class extends Error {
1755
1865
  name = "FrameWindowBlockedError";
1756
1866
  constructor() {
1757
1867
  super("attachFrame: the browser did not open the window. Call attachFrame directly in a click or key handler, and allow popups for this page");
1758
1868
  }
1759
- }, Mn = /* @__PURE__ */ new Set([
1869
+ }, Kn = /* @__PURE__ */ new Set([
1760
1870
  "jar-unreachable",
1761
1871
  "bad-url",
1762
1872
  "opaque-opener"
1763
- ]), Nn = class extends Error {
1873
+ ]), qn = class extends Error {
1764
1874
  name = "FrameWindowRefusedError";
1765
1875
  reason;
1766
1876
  constructor(e) {
1767
- let t = Mn.has(e) ? e : "unknown";
1877
+ let t = Kn.has(e) ? e : "unknown";
1768
1878
  super(t === "opaque-opener" ? "attachFrame: this page has an opaque origin, which a window can never answer, so no window was opened" : `attachFrame: the window refused to attach (${t}), and loaded nothing`), this.reason = t;
1769
1879
  }
1770
- }, Pn = ["message", "document"], Fn = (e) => {
1880
+ }, Jn = ["message", "document"], Yn = (e) => {
1771
1881
  if (e === "*") return "*";
1772
1882
  let t = () => /* @__PURE__ */ TypeError(`frame.postMessage: targetOrigin must be '*' or an origin, not ${JSON.stringify(e)}`);
1773
1883
  if (typeof e != "string") throw t();
@@ -1779,48 +1889,48 @@ var dt = class {
1779
1889
  }
1780
1890
  if (n === "null") throw t();
1781
1891
  return n;
1782
- }, In = (e, t) => {
1892
+ }, Xn = (e, t) => {
1783
1893
  let n = typeof e == "object" && !!e;
1784
1894
  if (n && t !== void 0) throw TypeError("frame.postMessage: pass transfer inside the options object, not after it");
1785
1895
  let r = n ? e.targetOrigin ?? "*" : e ?? "*", i = n ? e.transfer : t;
1786
1896
  if (i !== void 0 && !Array.isArray(i)) throw TypeError("frame.postMessage: transfer must be an array");
1787
1897
  return {
1788
- targetOrigin: Fn(r),
1898
+ targetOrigin: Yn(r),
1789
1899
  transfer: i === void 0 ? [] : [...i]
1790
1900
  };
1791
- }, Ln = [
1901
+ }, Zn = [
1792
1902
  "url",
1793
1903
  "path",
1794
1904
  "type"
1795
- ], Rn = ["content", "sourceUrl"], zn = /[\n\r\u2028\u2029]/, Bn = (e) => {
1905
+ ], Qn = ["content", "sourceUrl"], $n = /[\n\r\u2028\u2029]/, er = (e) => {
1796
1906
  if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("frame.addScriptTag: options must be an object { content }");
1797
- let t = Object.keys(e), n = t.find((e) => Ln.includes(e));
1907
+ let t = Object.keys(e), n = t.find((e) => Zn.includes(e));
1798
1908
  if (n !== void 0) throw TypeError(`frame.addScriptTag: "${n}" is not served; it runs content as a classic inline script`);
1799
- let r = t.find((e) => !Rn.includes(e));
1909
+ let r = t.find((e) => !Qn.includes(e));
1800
1910
  if (r !== void 0) throw TypeError(`frame.addScriptTag: unknown option "${r}"`);
1801
1911
  let { content: i, sourceUrl: a } = e;
1802
1912
  if (typeof i != "string") throw TypeError("frame.addScriptTag: content must be a string");
1803
- if (a !== void 0 && (typeof a != "string" || a === "" || zn.test(a))) throw TypeError("frame.addScriptTag: sourceUrl must be a non-empty string with no line break");
1913
+ if (a !== void 0 && (typeof a != "string" || a === "" || $n.test(a))) throw TypeError("frame.addScriptTag: sourceUrl must be a non-empty string with no line break");
1804
1914
  return a === void 0 ? { content: i } : {
1805
1915
  content: i,
1806
1916
  sourceUrl: a
1807
1917
  };
1808
- }, Vn = [
1918
+ }, tr = [
1809
1919
  "name",
1810
1920
  "domain",
1811
1921
  "path"
1812
- ], Hn = (e) => e instanceof RegExp || Object.prototype.toString.call(e) === "[object RegExp]", Un = (e) => {
1922
+ ], nr = (e) => e instanceof RegExp || Object.prototype.toString.call(e) === "[object RegExp]", rr = (e) => {
1813
1923
  if (e === void 0) return {};
1814
1924
  if (Object.prototype.toString.call(e) !== "[object Object]") throw TypeError("frame.clearCookies: options must be an object");
1815
- let t = e, n = Object.keys(t).find((e) => !Vn.includes(e));
1925
+ let t = e, n = Object.keys(t).find((e) => !tr.includes(e));
1816
1926
  if (n !== void 0) throw TypeError(`frame.clearCookies: unknown option "${n}"`);
1817
- let r = Vn.flatMap((e) => {
1927
+ let r = tr.flatMap((e) => {
1818
1928
  let n = t[e];
1819
1929
  return n === void 0 ? [] : [{
1820
1930
  key: e,
1821
1931
  value: n
1822
1932
  }];
1823
- }), i = r.find(({ value: e }) => Hn(e));
1933
+ }), i = r.find(({ value: e }) => nr(e));
1824
1934
  if (i !== void 0) throw TypeError(`frame.clearCookies: ${i.key} is a RegExp, and clearCookies takes strings for name, domain and path for now`);
1825
1935
  let a = r.find(({ value: e }) => typeof e != "string");
1826
1936
  if (a !== void 0) throw TypeError(`frame.clearCookies: ${a.key} must be a string`);
@@ -1829,15 +1939,15 @@ var dt = class {
1829
1939
  let s = {};
1830
1940
  for (let { key: e, value: t } of r) s[e] = { equals: t };
1831
1941
  return s;
1832
- }, Wn = (e) => {
1942
+ }, ir = (e) => {
1833
1943
  typeof globalThis.reportError == "function" ? globalThis.reportError(e) : console.error(e);
1834
- }, Gn = (e) => {
1835
- let { owner: t, ...n } = pn({
1944
+ }, ar = (e) => {
1945
+ let { owner: t, ...n } = On({
1836
1946
  executor: e.executor,
1837
- modules: Sn,
1838
- rewrites: wn,
1947
+ modules: In,
1948
+ rewrites: Rn,
1839
1949
  gate: e.gate
1840
- }), r = async (t, n = {}) => (J(t), An(n), e.goto(t, n)), i = () => e.url(), a = async (t) => {
1950
+ }), r = async (t, n = {}) => (J(t), Wn(n), e.goto(t, n)), i = () => e.url(), a = async (t) => {
1841
1951
  let n = e.requestPermissions;
1842
1952
  if (!n) throw Error("frame.requestPermissions: this backend cannot ask for permission categories");
1843
1953
  return n(t);
@@ -1848,18 +1958,18 @@ var dt = class {
1848
1958
  if (typeof i != "string") throw TypeError("frame.evaluate: pass a function or a source string");
1849
1959
  return r(i, structuredClone(n));
1850
1960
  }, s = async (t) => {
1851
- let { content: n, ...r } = Bn(t), i = e.addScriptTag;
1961
+ let { content: n, ...r } = er(t), i = e.addScriptTag;
1852
1962
  if (!i) throw Error("frame.addScriptTag: this backend cannot run scripts in the attached frame");
1853
1963
  await i(n, r);
1854
1964
  }, c = async (t) => {
1855
- let n = Un(t), r = e.clearCookies;
1965
+ let n = rr(t), r = e.clearCookies;
1856
1966
  if (!r) throw Error("frame.clearCookies: this backend cannot clear cookies");
1857
1967
  await r(n);
1858
1968
  }, l = ((t, n, r) => {
1859
1969
  try {
1860
1970
  let i = e.postMessage;
1861
1971
  if (!i) throw Error("frame.postMessage: this backend cannot message the attached frame");
1862
- let a = In(n, r);
1972
+ let a = Xn(n, r);
1863
1973
  return i(t, a.targetOrigin, a.transfer);
1864
1974
  } catch (e) {
1865
1975
  return Promise.reject(e);
@@ -1868,7 +1978,7 @@ var dt = class {
1868
1978
  message: /* @__PURE__ */ new Set(),
1869
1979
  document: /* @__PURE__ */ new Set()
1870
1980
  }, d = null, f = (e, t) => {
1871
- if (!Pn.includes(e)) throw TypeError(`frame.${t}: the event type must be ${Pn.map((e) => `'${e}'`).join(" or ")}, not ${JSON.stringify(e)}`);
1981
+ if (!Jn.includes(e)) throw TypeError(`frame.${t}: the event type must be ${Jn.map((e) => `'${e}'`).join(" or ")}, not ${JSON.stringify(e)}`);
1872
1982
  return u[e];
1873
1983
  }, p = (e) => {
1874
1984
  let t = e.type === "message" ? Object.freeze({
@@ -1884,7 +1994,7 @@ var dt = class {
1884
1994
  for (let n of [...u[e.type]]) try {
1885
1995
  n(t);
1886
1996
  } catch (e) {
1887
- Wn(e);
1997
+ ir(e);
1888
1998
  }
1889
1999
  }, m = (e, t) => {
1890
2000
  if (f(e, "off").delete(t), d !== null && !u.message.size && !u.document.size) {
@@ -1917,7 +2027,7 @@ var dt = class {
1917
2027
  off: m
1918
2028
  };
1919
2029
  return _;
1920
- }, Kn = [
2030
+ }, or = [
1921
2031
  h,
1922
2032
  t,
1923
2033
  g,
@@ -1931,43 +2041,43 @@ var dt = class {
1931
2041
  l,
1932
2042
  f,
1933
2043
  u,
1934
- Dn,
1935
- On,
2044
+ Vn,
2045
+ Hn,
1936
2046
  m,
1937
2047
  r,
1938
- Je,
1939
- Ye,
1940
- Xe,
2048
+ tt,
2049
+ nt,
1941
2050
  rt,
1942
- at
1943
- ], qn = bn.map((e) => e.id), Jn = {
2051
+ gt,
2052
+ vt
2053
+ ], sr = Nn.map((e) => e.id), cr = {
1944
2054
  interaction: "act.click",
1945
2055
  storage: "read.text",
1946
2056
  network: "network.fetchCredentialed",
1947
2057
  evaluation: "media.appearU"
1948
- }, Yn = (e) => e === 0 ? "auto" : e === 4 ? "critical" : "bundled", Xn = Kn, Y = /* @__PURE__ */ new Map(), Zn = {};
2058
+ }, lr = (e) => e === 0 ? "auto" : e === 4 ? "critical" : "bundled", ur = or, Y = /* @__PURE__ */ new Map(), dr = {};
1949
2059
  (() => {
1950
- Y = new Map(Xn.map((e) => [e.scope, e])), Zn = Object.fromEntries(Y), Xn.filter((e) => e.severity === 4).map((e) => e.scope);
1951
- let e = (e) => Xn.filter((t) => t.category === e && Yn(t.severity) === "bundled");
1952
- Object.fromEntries(qn.map((t) => [t, Math.max(0, ...e(t).map((e) => e.severity))])), Object.fromEntries(qn.map((t) => [t, e(t).some((e) => e.unsafe === !0)]));
2060
+ Y = new Map(ur.map((e) => [e.scope, e])), dr = Object.fromEntries(Y), ur.filter((e) => e.severity === 4).map((e) => e.scope);
2061
+ let e = (e) => ur.filter((t) => t.category === e && lr(t.severity) === "bundled");
2062
+ Object.fromEntries(sr.map((t) => [t, Math.max(0, ...e(t).map((e) => e.severity))])), Object.fromEntries(sr.map((t) => [t, e(t).some((e) => e.unsafe === !0)]));
1953
2063
  })();
1954
- var Qn = (e) => Y.get(e)?.category, $n = (e) => {
2064
+ var fr = (e) => Y.get(e)?.category, pr = (e) => {
1955
2065
  let t = Y.get(e);
1956
- return t && Yn(t.severity);
1957
- }, er = (e) => {
2066
+ return t && lr(t.severity);
2067
+ }, mr = (e) => {
1958
2068
  let t = Y.get(e);
1959
- if (t) return Yn(t.severity) === "critical" ? t.scope : t.category;
1960
- }, tr = (e) => Jn[e], nr = ({ category: e, key: t }) => {
1961
- let n = t ?? (e && tr(e));
1962
- return n !== void 0 && Qn(n) !== void 0 ? n : void 0;
1963
- }, rr = (e, t) => {
1964
- for (let { category: n, key: r } of t) if (nr({
2069
+ if (t) return lr(t.severity) === "critical" ? t.scope : t.category;
2070
+ }, hr = (e) => cr[e], gr = ({ category: e, key: t }) => {
2071
+ let n = t ?? (e && hr(e));
2072
+ return n !== void 0 && fr(n) !== void 0 ? n : void 0;
2073
+ }, _r = (e, t) => {
2074
+ for (let { category: n, key: r } of t) if (gr({
1965
2075
  category: n,
1966
2076
  key: r
1967
2077
  }) === void 0) throw TypeError(r === void 0 ? n === void 0 ? `${e}: name a category or a permission key` : `${e}: unknown permission category "${n}"` : `${e}: unknown permission key "${r}"`);
1968
- }, ir = (e, t = {}) => {
2078
+ }, vr = (e, t = {}) => {
1969
2079
  let n = [], r = e.map((e) => {
1970
- let r = nr(e), i = [];
2080
+ let r = gr(e), i = [];
1971
2081
  if (r !== void 0) for (let a of e.hosts) i.push(n.length), n.push({
1972
2082
  ...t,
1973
2083
  key: r,
@@ -1977,8 +2087,8 @@ var Qn = (e) => Y.get(e)?.category, $n = (e) => {
1977
2087
  reason: e.reason
1978
2088
  });
1979
2089
  return {
1980
- key: r !== void 0 && $n(r) === "critical" ? r : void 0,
1981
- category: r === void 0 ? e.category ?? "interaction" : Zn[r].category,
2090
+ key: r !== void 0 && pr(r) === "critical" ? r : void 0,
2091
+ category: r === void 0 ? e.category ?? "interaction" : dr[r].category,
1982
2092
  hosts: e.hosts,
1983
2093
  indexes: i
1984
2094
  };
@@ -1992,31 +2102,31 @@ var Qn = (e) => Y.get(e)?.category, $n = (e) => {
1992
2102
  allow: i.length > 0 && i.every((t) => e[t]?.allow === !0)
1993
2103
  }))
1994
2104
  };
1995
- }, ar = (e) => typeof e == "object" && !!e, or = typeof chrome < "u" && !!chrome.runtime?.id, sr = (e) => ar(e) && e.FKN_WEB_EXTENSION_FRAME_ANNOUNCE_KEY === !0 && typeof e.frameId == "string" && typeof e.document == "string", cr = /* @__PURE__ */ new WeakMap(), lr = /* @__PURE__ */ new WeakMap(), ur = /* @__PURE__ */ new WeakMap(), dr = /* @__PURE__ */ new Set();
1996
- typeof window < "u" && or && window.addEventListener("message", (e) => {
1997
- if (!sr(e.data)) return;
2105
+ }, yr = (e) => typeof e == "object" && !!e, br = typeof chrome < "u" && !!chrome.runtime?.id, xr = (e) => yr(e) && e.FKN_WEB_EXTENSION_FRAME_ANNOUNCE_KEY === !0 && typeof e.frameId == "string" && typeof e.document == "string", Sr = /* @__PURE__ */ new WeakMap(), Cr = /* @__PURE__ */ new WeakMap(), wr = /* @__PURE__ */ new WeakMap(), Tr = /* @__PURE__ */ new Set();
2106
+ typeof window < "u" && br && window.addEventListener("message", (e) => {
2107
+ if (!xr(e.data)) return;
1998
2108
  e.stopImmediatePropagation();
1999
2109
  let t = e.source;
2000
2110
  if (!t || typeof t != "object") return;
2001
- let n = t, r = cr.get(n), i = e.data.frameId, a = e.data.document;
2002
- if (cr.set(n, i), lr.set(n, a), r) for (let e of dr) e(r);
2003
- let o = ur.get(n);
2111
+ let n = t, r = Sr.get(n), i = e.data.frameId, a = e.data.document;
2112
+ if (Sr.set(n, i), Cr.set(n, a), r) for (let e of Tr) e(r);
2113
+ let o = wr.get(n);
2004
2114
  if (o) {
2005
2115
  for (let e of [...o]) (e.notDocument === void 0 || e.notDocument !== a) && (o.delete(e), e.resolve(i));
2006
- o.size || ur.delete(n);
2116
+ o.size || wr.delete(n);
2007
2117
  }
2008
2118
  }, { capture: !0 });
2009
2119
  //#endregion
2010
2120
  //#region ../web-extension/lib/lib/evaluate-deadline.js
2011
- var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr = () => new R(pr), hr = (e) => z(e) && e.message === pr ? mr() : e, gr = [
2121
+ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or = () => new R(Dr), kr = (e) => z(e) && e.message === Dr ? Or() : e, Ar = [
2012
2122
  /^frame load timed out after \d+ms for /,
2013
2123
  /^frame goto: documentstart timed out$/,
2014
2124
  /^navigation to .+ did not commit a document within \d+ms$/s
2015
- ], _r = (e) => {
2125
+ ], jr = (e) => {
2016
2126
  if (e instanceof R) return e;
2017
2127
  let t = typeof e?.message == "string" ? e.message : "";
2018
- return gr.some((e) => e.test(t)) ? new R(t) : e;
2019
- }, vr = (e) => {
2128
+ return Ar.some((e) => e.test(t)) ? new R(t) : e;
2129
+ }, Mr = (e) => {
2020
2130
  let t = e;
2021
2131
  if (t.window === void 0) return "iframe";
2022
2132
  if (t.iframe !== void 0) throw TypeError("attachFrame: pass either iframe or window, not both");
@@ -2024,11 +2134,11 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
2024
2134
  if (t.blank !== void 0) throw TypeError("attachFrame: blank does not apply to a window");
2025
2135
  if (typeof t.window != "object" || t.window === null) throw TypeError("attachFrame: window must be an object");
2026
2136
  return "window";
2027
- }, yr = (e, t, n) => {
2137
+ }, Nr = (e, t, n) => {
2028
2138
  if (e === void 0) return t;
2029
2139
  if (typeof e != "number" || !Number.isFinite(e) || e <= 0) throw TypeError(`attachFrame: window.${n} must be a positive number of CSS pixels`);
2030
2140
  return Math.round(e);
2031
- }, br = ({ url: e, width: t, height: n }) => {
2141
+ }, Pr = ({ url: e, width: t, height: n }) => {
2032
2142
  let r = (() => {
2033
2143
  if (e === void 0 || e === "" || e === "about:blank") return "";
2034
2144
  if (typeof e != "string") throw TypeError("attachFrame: window.url must be a string");
@@ -2044,10 +2154,10 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
2044
2154
  })();
2045
2155
  return r && J(r), {
2046
2156
  url: r,
2047
- width: yr(t, 500, "width"),
2048
- height: yr(n, 700, "height")
2157
+ width: Nr(t, 500, "width"),
2158
+ height: Nr(n, 700, "height")
2049
2159
  };
2050
- }, xr = "attachFrame: storageState seeds a fresh jar, so it needs cookies: 'ephemeral'", Sr = 1e11, Cr = [
2160
+ }, Fr = "attachFrame: storageState seeds a fresh jar, so it needs cookies: 'ephemeral'", Ir = 1e11, Lr = [
2051
2161
  "name",
2052
2162
  "value",
2053
2163
  "domain",
@@ -2056,11 +2166,11 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
2056
2166
  "httpOnly",
2057
2167
  "secure",
2058
2168
  "sameSite"
2059
- ], wr = [
2169
+ ], Rr = [
2060
2170
  "Strict",
2061
2171
  "Lax",
2062
2172
  "None"
2063
- ], X = /[;\x00-\x1f\x7f]/, Z = (e, t) => /* @__PURE__ */ TypeError(`attachFrame: storageState${e} ${t}`), Q = (e) => Object.prototype.toString.call(e) === "[object Object]", Tr = (e) => {
2173
+ ], zr = /[;\x00-\x1f\x7f]/, X = (e, t) => /* @__PURE__ */ TypeError(`attachFrame: storageState${e} ${t}`), Z = (e) => Object.prototype.toString.call(e) === "[object Object]", Br = (e) => {
2064
2174
  let t = e.startsWith(".") ? e.slice(1) : e;
2065
2175
  if (t === "") return null;
2066
2176
  try {
@@ -2068,33 +2178,33 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
2068
2178
  } catch {
2069
2179
  return null;
2070
2180
  }
2071
- }, Er = (e, t) => {
2072
- if (!Q(e)) throw Z(t, "must be an object");
2073
- let n = Object.keys(e).find((e) => !Cr.includes(e));
2074
- if (n !== void 0) throw Z(`${t}.${n}`, "is not a cookie field");
2181
+ }, Vr = (e, t) => {
2182
+ if (!Z(e)) throw X(t, "must be an object");
2183
+ let n = Object.keys(e).find((e) => !Lr.includes(e));
2184
+ if (n !== void 0) throw X(`${t}.${n}`, "is not a cookie field");
2075
2185
  let { name: r, value: i, domain: a, path: o, expires: s, httpOnly: c, secure: l, sameSite: u } = e;
2076
- if (typeof r != "string" || r === "" || r.includes("=") || X.test(r)) throw Z(`${t}.name`, "must be a non-empty string with no \"=\", \";\" or control character");
2077
- if (typeof i != "string" || X.test(i)) throw Z(`${t}.value`, "must be a string with no \";\" or control character");
2078
- if (typeof a != "string" || Tr(a) === null) throw Z(`${t}.domain`, "must be a host: \".youtube.com\" for a cookie its subdomains also receive, \"www.youtube.com\" for a host-only one");
2079
- if (o !== void 0 && (typeof o != "string" || !o.startsWith("/") || X.test(o))) throw Z(`${t}.path`, "must be a string starting with \"/\"");
2080
- if (s !== void 0 && (typeof s != "number" || !Number.isFinite(s) || s <= 0 && s !== -1)) throw Z(`${t}.expires`, "must be -1 for a session cookie, or milliseconds since the epoch");
2081
- if (c !== void 0 && typeof c != "boolean") throw Z(`${t}.httpOnly`, "must be a boolean");
2082
- if (l !== void 0 && typeof l != "boolean") throw Z(`${t}.secure`, "must be a boolean");
2083
- if (u !== void 0 && !wr.includes(u)) throw Z(`${t}.sameSite`, `must be 'Strict', 'Lax' or 'None', not ${JSON.stringify(u)}`);
2186
+ if (typeof r != "string" || r === "" || r.includes("=") || zr.test(r)) throw X(`${t}.name`, "must be a non-empty string with no \"=\", \";\" or control character");
2187
+ if (typeof i != "string" || zr.test(i)) throw X(`${t}.value`, "must be a string with no \";\" or control character");
2188
+ if (typeof a != "string" || Br(a) === null) throw X(`${t}.domain`, "must be a host: \".youtube.com\" for a cookie its subdomains also receive, \"www.youtube.com\" for a host-only one");
2189
+ if (o !== void 0 && (typeof o != "string" || !o.startsWith("/") || zr.test(o))) throw X(`${t}.path`, "must be a string starting with \"/\"");
2190
+ if (s !== void 0 && (typeof s != "number" || !Number.isFinite(s) || s <= 0 && s !== -1)) throw X(`${t}.expires`, "must be -1 for a session cookie, or milliseconds since the epoch");
2191
+ if (c !== void 0 && typeof c != "boolean") throw X(`${t}.httpOnly`, "must be a boolean");
2192
+ if (l !== void 0 && typeof l != "boolean") throw X(`${t}.secure`, "must be a boolean");
2193
+ if (u !== void 0 && !Rr.includes(u)) throw X(`${t}.sameSite`, `must be 'Strict', 'Lax' or 'None', not ${JSON.stringify(u)}`);
2084
2194
  let d = r.toLowerCase();
2085
- if (u === "None" && l !== !0) throw Z(t, "is SameSite=None, which needs secure: true");
2086
- if (d.startsWith("__secure-") && l !== !0) throw Z(t, "is a __Secure- cookie, which needs secure: true");
2087
- if (d.startsWith("__host-") && (l !== !0 || a.startsWith(".") || (o ?? "/") !== "/")) throw Z(t, "is a __Host- cookie, which needs secure: true, a host-only domain and path \"/\"");
2195
+ if (u === "None" && l !== !0) throw X(t, "is SameSite=None, which needs secure: true");
2196
+ if (d.startsWith("__secure-") && l !== !0) throw X(t, "is a __Secure- cookie, which needs secure: true");
2197
+ if (d.startsWith("__host-") && (l !== !0 || a.startsWith(".") || (o ?? "/") !== "/")) throw X(t, "is a __Host- cookie, which needs secure: true, a host-only domain and path \"/\"");
2088
2198
  let f = {
2089
2199
  name: r,
2090
2200
  value: i,
2091
2201
  domain: a
2092
2202
  };
2093
2203
  return o !== void 0 && (f.path = o), s !== void 0 && (f.expires = s), c !== void 0 && (f.httpOnly = c), l !== void 0 && (f.secure = l), u !== void 0 && (f.sameSite = u), f;
2094
- }, Dr = (e, t) => {
2095
- if (!Q(e)) throw Z(t, "must be an object { origin, localStorage }");
2204
+ }, Hr = (e, t) => {
2205
+ if (!Z(e)) throw X(t, "must be an object { origin, localStorage }");
2096
2206
  let n = Object.keys(e).find((e) => e !== "origin" && e !== "localStorage");
2097
- if (n !== void 0) throw Z(`${t}.${n}`, "is not an origin field");
2207
+ if (n !== void 0) throw X(`${t}.${n}`, "is not an origin field");
2098
2208
  let { origin: r, localStorage: i } = e, a = (() => {
2099
2209
  try {
2100
2210
  return typeof r == "string" ? new URL(r) : null;
@@ -2102,43 +2212,43 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
2102
2212
  return null;
2103
2213
  }
2104
2214
  })();
2105
- if (a === null || a.protocol !== "http:" && a.protocol !== "https:" || a.origin !== r) throw Z(`${t}.origin`, `must be an absolute http or https origin, not ${JSON.stringify(r)}`);
2106
- if (!Array.isArray(i)) throw Z(`${t}.localStorage`, "must be an array");
2215
+ if (a === null || a.protocol !== "http:" && a.protocol !== "https:" || a.origin !== r) throw X(`${t}.origin`, `must be an absolute http or https origin, not ${JSON.stringify(r)}`);
2216
+ if (!Array.isArray(i)) throw X(`${t}.localStorage`, "must be an array");
2107
2217
  return {
2108
2218
  origin: r,
2109
2219
  localStorage: i.map((e, n) => {
2110
- let { name: r, value: i } = Q(e) && Object.keys(e).every((e) => e === "name" || e === "value") ? e : {};
2111
- if (typeof r != "string" || typeof i != "string") throw Z(`${t}.localStorage[${n}]`, "must be { name, value } strings");
2220
+ let { name: r, value: i } = Z(e) && Object.keys(e).every((e) => e === "name" || e === "value") ? e : {};
2221
+ if (typeof r != "string" || typeof i != "string") throw X(`${t}.localStorage[${n}]`, "must be { name, value } strings");
2112
2222
  return {
2113
2223
  name: r,
2114
2224
  value: i
2115
2225
  };
2116
2226
  })
2117
2227
  };
2118
- }, Or = (e) => {
2119
- if (!Q(e)) throw Z("", "must be an object { cookies?, origins? }");
2228
+ }, Ur = (e) => {
2229
+ if (!Z(e)) throw X("", "must be an object { cookies?, origins? }");
2120
2230
  let t = Object.keys(e).find((e) => e !== "cookies" && e !== "origins");
2121
- if (t !== void 0) throw Z(`.${t}`, "is not a storageState key; it takes cookies and origins");
2231
+ if (t !== void 0) throw X(`.${t}`, "is not a storageState key; it takes cookies and origins");
2122
2232
  let { cookies: n = [], origins: r = [] } = e;
2123
- if (!Array.isArray(n)) throw Z(".cookies", "must be an array");
2124
- if (!Array.isArray(r)) throw Z(".origins", "must be an array");
2125
- let i = n.map((e, t) => Er(e, `.cookies[${t}]`)), a = r.map((e, t) => Dr(e, `.origins[${t}]`));
2233
+ if (!Array.isArray(n)) throw X(".cookies", "must be an array");
2234
+ if (!Array.isArray(r)) throw X(".origins", "must be an array");
2235
+ let i = n.map((e, t) => Vr(e, `.cookies[${t}]`)), a = r.map((e, t) => Hr(e, `.origins[${t}]`));
2126
2236
  return i.forEach(({ expires: e }, t) => {
2127
- if (e !== void 0 && e > 0 && e < Sr) throw Z(`.cookies[${t}].expires`, `is milliseconds since the epoch, and ${e} reads as a date before 1974; a Playwright storageState gives seconds, so multiply it by 1000`);
2237
+ if (e !== void 0 && e > 0 && e < Ir) throw X(`.cookies[${t}].expires`, `is milliseconds since the epoch, and ${e} reads as a date before 1974; a Playwright storageState gives seconds, so multiply it by 1000`);
2128
2238
  }), {
2129
2239
  cookies: i,
2130
2240
  origins: a
2131
2241
  };
2132
- }, kr = [
2242
+ }, Wr = [
2133
2243
  "persistent",
2134
2244
  "ephemeral",
2135
2245
  "native"
2136
- ], Ar = "attachFrame: syncCookies was replaced by cookies. true is cookies: 'persistent', or 'native' for the person's own browser cookies on the extension; false is cookies: 'ephemeral'", jr = (e) => {
2137
- if ("syncCookies" in e) throw TypeError(Ar);
2246
+ ], Gr = "attachFrame: syncCookies was replaced by cookies. true is cookies: 'persistent', or 'native' for the person's own browser cookies on the extension; false is cookies: 'ephemeral'", Kr = (e) => {
2247
+ if ("syncCookies" in e) throw TypeError(Gr);
2138
2248
  let { cookies: t = "persistent" } = e;
2139
- if (!kr.includes(t)) throw TypeError(`attachFrame: cookies must be 'persistent', 'ephemeral' or 'native', not ${JSON.stringify(t)}`);
2140
- if (e.storageState !== void 0 && t !== "ephemeral") throw TypeError(xr);
2141
- let n = e.storageState === void 0 ? void 0 : Or(e.storageState), r = vr(e);
2249
+ if (!Wr.includes(t)) throw TypeError(`attachFrame: cookies must be 'persistent', 'ephemeral' or 'native', not ${JSON.stringify(t)}`);
2250
+ if (e.storageState !== void 0 && t !== "ephemeral") throw TypeError(Fr);
2251
+ let n = e.storageState === void 0 ? void 0 : Ur(e.storageState), r = Mr(e);
2142
2252
  if (r === "iframe" && e.lockdown && t !== "native") throw TypeError("attachFrame: lockdown runs on the extension, which serves only cookies: 'native'");
2143
2253
  return n === void 0 ? {
2144
2254
  kind: r,
@@ -2148,20 +2258,20 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
2148
2258
  cookies: t,
2149
2259
  storageState: n
2150
2260
  };
2151
- }, Mr = (e) => {
2261
+ }, qr = (e) => {
2152
2262
  try {
2153
2263
  return new URL(e).hostname;
2154
2264
  } catch {
2155
2265
  return "";
2156
2266
  }
2157
- }, Nr = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY", Pr = !1, Fr = () => {
2158
- Pr || (Pr = !0, console.warn("[fkn-frame] the installed FKN WebExtension is too old to ask for permission categories upfront, so each capability will be asked for as it is first used. Updating the extension fixes this."));
2159
- }, Ir = "frame: this frame no longer holds the document the app attached it to", Lr = "frame.postMessage: '*' is not served on the extension yet, since this extension does not report the frame's origin; pass the page's origin as targetOrigin", Rr = () => {
2267
+ }, Jr = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY", Yr = !1, Xr = () => {
2268
+ Yr || (Yr = !0, console.warn("[fkn-frame] the installed FKN WebExtension is too old to ask for permission categories upfront, so each capability will be asked for as it is first used. Updating the extension fixes this."));
2269
+ }, Zr = "frame: this frame no longer holds the document the app attached it to", Qr = "frame.postMessage: '*' is not served on the extension yet, since this extension does not report the frame's origin; pass the page's origin as targetOrigin", $r = () => {
2160
2270
  let e = E();
2161
2271
  if (e.status === "ok" && e.abi >= 1) return;
2162
2272
  let t = e.status === "absent" ? 0 : e.abi;
2163
2273
  throw new T("lockdown", t, `attachFrame: the installed FKN WebExtension (ABI ${t}) may predate lockdown, and one that does attaches the frame with its CSP removed rather than locked down. Updating the extension fixes this.`);
2164
- }, zr = (e) => {
2274
+ }, Q = (e) => {
2165
2275
  try {
2166
2276
  return new URL(e, location.href).hostname;
2167
2277
  } catch {
@@ -2170,90 +2280,160 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
2170
2280
  }, $ = () => {
2171
2281
  let e = E();
2172
2282
  return e.status === "absent" ? 0 : e.abi;
2173
- }, Br = "attachFrame: a blank page is served by the cloud render proxy only; call cloud.attachFrame", Vr = "frame.addScriptTag: an extension frame does not run scripts through mirage yet; attach with cloud.attachFrame", Hr = "frame.clearCookies: an extension frame runs on the browser's own cookies (cookies: 'native'), which FKN does not clear; attach with cookies: 'persistent' to clear the app's jar", Ur = async ({ iframe: e, domains: t = [], lockdown: n = !1, permissions: r, blank: i }) => {
2174
- if (i !== void 0) throw new T("blank", $(), Br);
2175
- let a = crypto.randomUUID();
2176
- if (J(e.src), En({
2177
- src: e.src,
2178
- domains: t,
2179
- lockdown: n
2180
- }), await O(), n && Rr(), !e.isConnected) throw Error("attachFrame: the iframe must be connected to the document before attaching");
2181
- e.dispatchEvent(new CustomEvent(Nr, { detail: a }));
2182
- let { executeLocator: o, highlightLocator: s, ensureLocatorPermission: c, requestCategories: l, evaluateFrame: u, goto: d } = await k.attachFrame({
2183
- marker: a,
2184
- domains: t,
2185
- syncCookies: !0,
2186
- lockdown: n
2187
- }), f = new Set(p([...t, zr(e.src)], { ipv6: !0 })), m = (e) => f.has(p([Mr(e)], { ipv6: !0 })[0] ?? ""), h = Gn({
2283
+ }, ei = "attachFrame: a blank page is served by the cloud render proxy only; call cloud.attachFrame", ti = "frame.addScriptTag: an extension frame does not run scripts through mirage yet; attach with cloud.attachFrame", ni = "frame.clearCookies: an extension frame runs on the browser's own cookies (cookies: 'native'), which FKN does not clear; attach with cookies: 'persistent' to clear the app's jar", ri = ({ executeLocator: e, highlightLocator: t, ensureLocatorPermission: n, requestCategories: r, evaluateFrame: i, goto: a }, { hosts: o, url: s, page: c, unreachable: l, documents: u, navigated: d }) => {
2284
+ let f = new Set(p(o, { ipv6: !0 })), m = (e) => f.has(p([qr(e)], { ipv6: !0 })[0] ?? "");
2285
+ return ar({
2188
2286
  backend: "extension",
2189
2287
  executor: {
2190
- execute: o,
2191
- highlight: s
2288
+ execute: e,
2289
+ highlight: t
2192
2290
  },
2193
- gate: (e) => c(e.parts, e.operation, e.args),
2194
- requestPermissions: async (e) => (rr("frame.requestPermissions", e), await _n(), l(e)),
2291
+ gate: (e) => n(e.parts, e.operation, e.args),
2292
+ requestPermissions: async (e) => (_r("frame.requestPermissions", e), await An(), r(e)),
2195
2293
  evaluate: async (e, t) => {
2196
- if (!Me(E(), "evaluate")) {
2294
+ if (!Re(E(), "evaluate")) {
2197
2295
  let e = E();
2198
2296
  throw new T("evaluate", e.status === "ok" ? e.abi : 0);
2199
2297
  }
2200
- return u({
2298
+ return i({
2201
2299
  source: e,
2202
2300
  arg: t
2203
2301
  }).catch((e) => {
2204
- throw hr(e);
2302
+ throw kr(e);
2205
2303
  });
2206
2304
  },
2207
2305
  addScriptTag: async () => {
2208
- throw new T("addScriptTag", $(), Vr);
2306
+ throw new T("addScriptTag", $(), ti);
2209
2307
  },
2210
2308
  clearCookies: async () => {
2211
- throw new T("clearCookies", $(), Hr);
2309
+ throw new T("clearCookies", $(), ni);
2212
2310
  },
2213
- postMessage: (t, n, r) => {
2214
- if (n === "*") throw L(Lr, "postMessage", "extension");
2215
- if (!m(n)) throw xt(Ir, "postMessage");
2216
- let i = e.contentWindow;
2217
- if (i === null) throw xt("frame: navigate the frame before postMessage", "postMessage");
2218
- return i.postMessage(t, n, r), Promise.resolve();
2311
+ postMessage: (e, t, n) => {
2312
+ if (t === "*") throw I(Qr, "postMessage", "extension");
2313
+ if (!m(t)) throw L(Zr, "postMessage");
2314
+ let r = l();
2315
+ if (r) throw r;
2316
+ return c().postMessage(e, t, n), Promise.resolve();
2219
2317
  },
2220
- listen: (t) => {
2221
- let n = (n) => {
2222
- n.source !== null && n.source === e.contentWindow && !sr(n.data) && m(n.origin) && t({
2318
+ listen: (e) => {
2319
+ let t = (t) => {
2320
+ t.source !== null && t.source === c() && !xr(t.data) && m(t.origin) && e({
2223
2321
  type: "message",
2224
- data: n.data,
2225
- origin: n.origin,
2226
- ports: n.ports
2322
+ data: t.data,
2323
+ origin: t.origin,
2324
+ ports: t.ports
2227
2325
  });
2228
- }, r = () => t({
2326
+ };
2327
+ window.addEventListener("message", t);
2328
+ let n = u(() => e({
2229
2329
  type: "document",
2230
2330
  origin: ""
2231
- });
2232
- return window.addEventListener("message", n), e.addEventListener("load", r), () => {
2233
- window.removeEventListener("message", n), e.removeEventListener("load", r);
2331
+ }));
2332
+ return () => {
2333
+ window.removeEventListener("message", t), n();
2234
2334
  };
2235
2335
  },
2236
2336
  goto: (e, { waitUntil: t, timeout: n, ...r } = {}) => {
2237
- for (let t of p([zr(e)], { ipv6: !0 })) f.add(t);
2238
- return d({
2337
+ j("frame.goto", [Q(e), ...r.domains ?? []]);
2338
+ for (let t of p([Q(e)], { ipv6: !0 })) f.add(t);
2339
+ return d?.(e), a({
2239
2340
  url: e,
2240
2341
  ...r,
2241
2342
  ...t === void 0 ? {} : { waitUntil: t === "commit" ? "documentstart" : t },
2242
2343
  ...n === void 0 ? {} : { timeoutMs: n }
2243
2344
  }).catch((e) => {
2244
- throw _r(e);
2345
+ throw jr(e);
2245
2346
  });
2246
2347
  },
2247
- url: () => e.src
2348
+ url: s
2349
+ });
2350
+ }, ii = async ({ iframe: e, domains: t = [], lockdown: n = !1, permissions: r, blank: i }) => {
2351
+ if (i !== void 0) throw new T("blank", $(), ei);
2352
+ let a = crypto.randomUUID();
2353
+ if (J(e.src), Bn({
2354
+ src: e.src,
2355
+ domains: t,
2356
+ lockdown: n
2357
+ }), j("attachFrame", t), await D(), n && $r(), !e.isConnected) throw Error("attachFrame: the iframe must be connected to the document before attaching");
2358
+ e.dispatchEvent(new CustomEvent(Jr, { detail: a }));
2359
+ let o = ri(await O.attachFrame({
2360
+ marker: a,
2361
+ domains: t,
2362
+ syncCookies: !0,
2363
+ lockdown: n
2364
+ }), {
2365
+ hosts: [...t, Q(e.src)],
2366
+ url: () => e.src,
2367
+ page: () => e.contentWindow,
2368
+ unreachable: () => e.contentWindow === null ? L("frame: navigate the frame before postMessage", "postMessage") : void 0,
2369
+ documents: (t) => (e.addEventListener("load", t), () => e.removeEventListener("load", t))
2248
2370
  });
2249
- return r?.length && (gn() ? await h.requestPermissions(r) : Fr()), h;
2250
- }, Wr = "attachFrame: a window on cookies: 'native' is not served yet; a window runs on the cloud render proxy, which has no browser cookies", Gr = (e) => `attachFrame: cookies: '${e}' runs on the cloud render proxy; call cloud.attachFrame or the top-level attachFrame`, Kr = async (e) => {
2251
- throw br(e.window), new T("attachWindow", $(), Wr);
2252
- }, qr = (async (e) => {
2253
- let { kind: t, cookies: n } = jr(e);
2254
- if (n !== "native") throw new T("cookies", $(), Gr(n));
2255
- return t === "window" ? Kr(e) : Ur(e);
2256
- }), Jr = "permissions.request: pass hosts, the sites the grant applies to", Yr = { request: async (e) => {
2371
+ return r?.length && (kn() ? await o.requestPermissions(r) : Xr()), o;
2372
+ }, ai = "attachFrame: a window on cookies: 'native' needs the FKN WebExtension, which is not on this page", oi = "frame.postMessage: this window's page no longer keeps a link to the app's page, so a message cannot reach it", si = "extension.attachFrame: the attached window closed; attach a fresh window", ci = (e) => `attachFrame: cookies: '${e}' runs on the cloud render proxy; call cloud.attachFrame or the top-level attachFrame`, li = async (e) => {
2373
+ let { domains: t = [], permissions: n } = e, { url: r, width: i, height: a } = Pr(e.window);
2374
+ j("attachFrame", t);
2375
+ let o = E();
2376
+ if (!Re(o, "attachWindow")) throw o.status === "absent" ? new T("attachWindow", 0, ai) : new T("attachWindow", o.abi);
2377
+ let s = window.open(r || "about:blank", "_blank", `popup,width=${i},height=${a}`);
2378
+ if (!s) throw new Gn();
2379
+ let c;
2380
+ try {
2381
+ c = await O.attachWindow({
2382
+ url: r,
2383
+ domains: t
2384
+ });
2385
+ } catch (e) {
2386
+ try {
2387
+ s.close();
2388
+ } catch {}
2389
+ throw e;
2390
+ }
2391
+ let l = new Promise((e) => window.addEventListener("pagehide", () => e(), { once: !0 })), u = !1, d = Promise.race([c.closed, l]).then(() => {
2392
+ u = !0;
2393
+ }, () => {
2394
+ u = !0;
2395
+ }), f = r, p = ri(c, {
2396
+ hosts: r ? [...t, Q(r)] : t,
2397
+ url: () => f,
2398
+ page: () => s,
2399
+ unreachable: () => u ? I(si, "postMessage", "extension") : s.closed ? L(oi, "postMessage") : void 0,
2400
+ documents: (e) => {
2401
+ let t = !0;
2402
+ return (async () => {
2403
+ let n = await c.documentsAfter(-1);
2404
+ for (; t;) {
2405
+ let r = await c.documentsAfter(n);
2406
+ for (; t && n < r; n++) e();
2407
+ }
2408
+ })().catch(() => {}), () => {
2409
+ t = !1;
2410
+ };
2411
+ },
2412
+ navigated: (e) => {
2413
+ try {
2414
+ f = new URL(e, location.href).href;
2415
+ } catch {}
2416
+ }
2417
+ }), m, h = () => m ??= c.close().then(() => d, () => {}).then(() => {
2418
+ u = !0;
2419
+ try {
2420
+ s.close();
2421
+ } catch {}
2422
+ }), g = Object.assign(p, {
2423
+ close: h,
2424
+ closed: d
2425
+ });
2426
+ try {
2427
+ n?.length && await g.requestPermissions(n);
2428
+ } catch (e) {
2429
+ throw await h(), e;
2430
+ }
2431
+ return g;
2432
+ }, ui = (async (e) => {
2433
+ let { kind: t, cookies: n } = Kr(e);
2434
+ if (n !== "native") throw new T("cookies", $(), ci(n));
2435
+ return t === "window" ? li(e) : ii(e);
2436
+ }), di = "permissions.request: pass hosts, the sites the grant applies to", fi = { request: async (e) => {
2257
2437
  let t = e.map((e) => {
2258
2438
  let { category: t, key: n, scope: r, reason: i, hosts: a } = e;
2259
2439
  if (!("hosts" in e) && !("category" in e)) return { legacy: {
@@ -2262,17 +2442,17 @@ var fr = 3e4, pr = `frame.evaluate: the code did not settle within ${fr}ms`, mr
2262
2442
  reason: i
2263
2443
  } };
2264
2444
  let o = p(a ?? [], { ipv6: !0 });
2265
- if (!o.length) throw TypeError(Jr);
2266
- return { ask: {
2445
+ if (!o.length) throw TypeError(di);
2446
+ return mt("permissions.request", o), { ask: {
2267
2447
  category: t,
2268
2448
  key: n,
2269
2449
  reason: i,
2270
2450
  hosts: o
2271
2451
  } };
2272
2452
  }), n = t.flatMap((e) => "ask" in e ? [e.ask] : []);
2273
- rr("permissions.request", n), n.length && await _n();
2274
- let { items: r, answer: i } = ir(n), a = t.flatMap((e) => "legacy" in e ? [e.legacy] : []), o = [...r, ...a], s = o.length ? await k.requestPermissions(o) : [], c = i(s.slice(0, r.length)), l = s.slice(r.length), u = 0, d = 0;
2453
+ _r("permissions.request", n), n.length && await An();
2454
+ let { items: r, answer: i } = vr(n), a = t.flatMap((e) => "legacy" in e ? [e.legacy] : []), o = [...r, ...a], s = o.length ? await O.requestPermissions(o) : [], c = i(s.slice(0, r.length)), l = s.slice(r.length), u = 0, d = 0;
2275
2455
  return t.map((e) => "ask" in e ? c[u++] : l[d++]);
2276
- } }, Xr = "PermissionDeniedError", Zr = (e) => e instanceof Error ? e.name === Xr : ar(e) && e.name === "PermissionDeniedError";
2456
+ } }, pi = "PermissionDeniedError", mi = (e) => e instanceof Error ? e.name === pi : yr(e) && e.name === "PermissionDeniedError";
2277
2457
  //#endregion
2278
- export { Ue as $, _t as A, st as B, Tn as C, F as D, R as E, Tt as F, nt as G, it as H, gt as I, Je as J, Ye as K, wt as L, z as M, hn as N, Ct as O, L as P, We as Q, vt as R, En as S, en as T, rt as U, ot as V, et as W, Qe as X, $e as Y, Be as Z, Nn as _, qr as a, O as at, On as b, _r as c, w as ct, ar as d, xe as dt, He as et, rr as f, ye as ft, jn as g, S as gt, $n as h, be as ht, Nr as i, Le as it, bt as j, xt as k, fr as l, Ce as lt, er as m, ve as mt, Zr as n, Ie as nt, jr as o, Se as ot, Qn as p, _e as pt, Xe as q, Yr as r, E as rt, br as s, T as st, Xr as t, Fe as tt, mr as u, je as ut, Dn as v, bn as w, J as x, Gn as y, at as z };
2458
+ export { Be as $, It as A, _t as B, zn as C, Rt as D, Mt as E, zt as F, rt as G, st as H, Pt as I, at as J, tt as K, vt as L, I as M, B as N, L as O, jt as P, qe as Q, bt as R, Bn as S, R as T, lt as U, gt as V, nt as W, Xe as X, k as Y, Je as Z, qn as _, ui as a, T as at, Hn as b, jr as c, Le as ct, yr as d, _e as dt, Ve as et, _r as f, ve as ft, Gn as g, pr as h, Jr as i, Oe as it, z as j, Nt as k, Er as l, De as lt, mr as m, S as mt, mi as n, Ue as nt, Kr as o, w as ot, fr as p, be as pt, ot as q, fi as r, D as rt, Pr as s, ke as st, pi as t, E as tt, Or as u, ye as ut, Vn as v, Nn as w, J as x, ar as y, yt as z };