@fkn/lib 0.9.71 → 0.9.73

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 (120) hide show
  1. package/{account-DFWaytT5.cjs → account-BdwCDacQ.cjs} +1 -1
  2. package/{account-CXUwroRM.d.ts → account-C9w41S0_.d.ts} +1 -1
  3. package/{account-DF9jsI5N.js → account-URj9bMMj.js} +2 -2
  4. package/{account-generation-BsXJ6WWS.cjs → account-generation--7m_60Fl.cjs} +1 -1
  5. package/{account-generation-C0BizGmy.js → account-generation-DgK9YHiL.js} +1 -1
  6. package/{account-storage-B7QBr9aX.cjs → account-storage-CQ8k71N3.cjs} +1 -1
  7. package/{account-storage-Jgp8ycMy.js → account-storage-CcdeHbnj.js} +2 -2
  8. package/account.cjs +1 -1
  9. package/account.d.ts +2 -2
  10. package/account.js +1 -1
  11. package/api-BORAfb8e.cjs +3 -0
  12. package/{api-dxNQsC_v.js → api-De7vAubY.js} +117 -109
  13. package/{api-DhwJz0vo.d.ts → api-iKK1u-V0.d.ts} +25 -1
  14. package/api.cjs +1 -1
  15. package/api.d.ts +2 -2
  16. package/api.js +1 -1
  17. package/{broker-frame-BClLp2ZV.js → broker-frame-AQDD3D9E.js} +1 -1
  18. package/{broker-frame-BKHtDSjv.cjs → broker-frame-cVEhez7A.cjs} +1 -1
  19. package/broker-frame.cjs +1 -1
  20. package/broker-frame.js +1 -1
  21. package/cloud/dgram.cjs +1 -1
  22. package/cloud/dgram.d.ts +1 -1
  23. package/cloud/dgram.js +1 -1
  24. package/cloud/dns.cjs +1 -1
  25. package/cloud/dns.d.ts +2 -2
  26. package/cloud/dns.js +1 -1
  27. package/cloud/fetch.cjs +1 -1
  28. package/cloud/fetch.d.ts +1 -1
  29. package/cloud/fetch.js +1 -1
  30. package/cloud/fs/promises.cjs +1 -1
  31. package/cloud/fs/promises.js +1 -1
  32. package/cloud/fs.cjs +1 -1
  33. package/cloud/fs.js +2 -2
  34. package/cloud/http.cjs +1 -1
  35. package/cloud/http.d.ts +1 -1
  36. package/cloud/http.js +1 -1
  37. package/cloud/net.cjs +1 -1
  38. package/cloud/net.d.ts +1 -1
  39. package/cloud/net.js +1 -1
  40. package/{cloud-DRfcPLdB.d.ts → cloud-BDTtnMtj.d.ts} +5 -5
  41. package/{cloud-pJ8R_Dmx.cjs → cloud-Buku7KQJ.cjs} +1 -1
  42. package/{cloud-CyU_k-d9.js → cloud-Bv_GUwcG.js} +120 -120
  43. package/cloud.cjs +1 -1
  44. package/cloud.d.ts +6 -6
  45. package/cloud.js +7 -7
  46. package/{contract-CDdIE_Es.d.ts → contract-Cqq1vOqF.d.ts} +35 -1
  47. package/contract.cjs +1 -1
  48. package/contract.d.ts +2 -2
  49. package/contract.js +2 -2
  50. package/{dgram-BPXm8haL.cjs → dgram-BgWDRjw-.cjs} +1 -1
  51. package/{dgram-CPQqam5Z.d.ts → dgram-BggVwnRp.d.ts} +3 -3
  52. package/{dgram-B14T5Lqo.js → dgram-CYegbMMa.js} +1 -1
  53. package/dgram.cjs +1 -1
  54. package/dgram.d.ts +1 -1
  55. package/dgram.js +1 -1
  56. package/{dns-DlTvtfVk.cjs → dns-CtxN7cCj.cjs} +1 -1
  57. package/{dns-BQkSttLP.js → dns-DTbLD2s6.js} +1 -1
  58. package/{dns-_NCe2YLS.d.ts → dns-DeuTGd8C.d.ts} +1 -1
  59. package/dns.cjs +1 -1
  60. package/dns.d.ts +2 -2
  61. package/dns.js +1 -1
  62. package/{extension-Ce1wlb_F.js → extension-0RxQ4Bor.js} +9 -9
  63. package/{extension-veLhWipR.cjs → extension-DHx7sHE4.cjs} +1 -1
  64. package/extension.cjs +1 -1
  65. package/extension.js +2 -2
  66. package/fs/promises.cjs +1 -1
  67. package/fs/promises.js +1 -1
  68. package/{fs-DxECe50Z.cjs → fs-1Q6VCx3d.cjs} +1 -1
  69. package/{fs-DJ4wpfml.js → fs-BJdr72O6.js} +1 -1
  70. package/{fs-DgPbKycT.cjs → fs-BPfRlX_R.cjs} +1 -1
  71. package/{fs-sR6cw1ay.js → fs-C0RZ54fk.js} +3 -3
  72. package/fs.cjs +1 -1
  73. package/fs.js +2 -2
  74. package/{http-aUVH9bBn.js → http-D-rs8b6m.js} +1 -1
  75. package/{http-hIJh5XTX.cjs → http-DkvhaPVT.cjs} +1 -1
  76. package/{http-rzQOrCmq.d.ts → http-LhyEQ2D8.d.ts} +1 -1
  77. package/http.cjs +1 -1
  78. package/http.d.ts +1 -1
  79. package/http.js +1 -1
  80. package/index.cjs +1 -1
  81. package/index.d.ts +11 -11
  82. package/index.js +13 -13
  83. package/{lib-6lykV0aT.js → lib-B4Th0aXQ.js} +514 -508
  84. package/lib-By2YAF1s.cjs +53 -0
  85. package/{net-DUyZ7_3E.cjs → net-B3SziNT3.cjs} +1 -1
  86. package/{net-B4IqLeN8.d.ts → net-CK_1P9_C.d.ts} +3 -3
  87. package/{net-DVYOBov-.js → net-C_R3PDi7.js} +1 -1
  88. package/net.cjs +1 -1
  89. package/net.d.ts +1 -1
  90. package/net.js +1 -1
  91. package/package.json +6 -1
  92. package/{packages-BTDKiQyC.cjs → packages-BwD1QMOz.cjs} +1 -1
  93. package/{packages-XWRhSAUe.js → packages-CNXf-8A8.js} +1 -1
  94. package/{packages-SwO4CxMl.d.ts → packages-FCSR6WEw.d.ts} +1 -1
  95. package/packages.cjs +1 -1
  96. package/packages.d.ts +2 -2
  97. package/packages.js +1 -1
  98. package/proxy-CgISk6T6.cjs +1 -0
  99. package/proxy-OrF-WHyi.js +81 -0
  100. package/{proxy-CzP07me0.d.ts → proxy-Xe45WiQU.d.ts} +2 -2
  101. package/{relay-choice-DB1F7bcn.d.ts → relay-choice-BhdjlopH.d.ts} +1 -1
  102. package/{rooms-CZZfCZRv.cjs → rooms-B_sM_Z93.cjs} +1 -1
  103. package/{rooms-CYP8Bf6L.js → rooms-Dz13jhtS.js} +1 -1
  104. package/{rooms-3XplwXzb.d.ts → rooms-lJGFgMXH.d.ts} +1 -1
  105. package/rooms.cjs +1 -1
  106. package/rooms.d.ts +2 -2
  107. package/rooms.js +1 -1
  108. package/{storage-DtynxQDJ.cjs → storage-B49NeC-h.cjs} +1 -1
  109. package/{storage-d61R3-P1.js → storage-Dd3miXPI.js} +3 -3
  110. package/{storage-C38adB-z.d.ts → storage-ngeijVxI.d.ts} +1 -1
  111. package/storage.cjs +1 -1
  112. package/storage.d.ts +2 -2
  113. package/storage.js +1 -1
  114. package/websocket.cjs +1 -0
  115. package/websocket.d.ts +48 -0
  116. package/websocket.js +179 -0
  117. package/api-b88Y1QDE.cjs +0 -3
  118. package/lib-C1OPIW6F.cjs +0 -53
  119. package/proxy-BOHZkjk-.js +0 -61
  120. package/proxy-vI5LhXLv.cjs +0 -1
@@ -1,22 +1,22 @@
1
1
  import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
- import { D as t, E as n, N as r, O as i, T as a, _ as o, c as s, f as c, ft as l, g as u, h as d, j as f, k as p, l as m, m as h, o as g, p as _, s as v, u as y, x as b, y as x } from "./lib-6lykV0aT.js";
3
- import { c as S, m as C, t as w } from "./hosts-HUfgMimI.js";
4
- import { i as T } from "./broker-frame-BClLp2ZV.js";
5
- import { l as E, n as D, o as O, s as k } from "./api-dxNQsC_v.js";
6
- import { r as A } from "./busy-C1JPjoZ_.js";
7
- import { ATTACH_FRAME_KEY as j, ATTACH_WINDOW_KEY as ee, ATTACH_WINDOW_MESSAGE as M, RELAY_CHOICE_UNSUPPORTED as N, WINDOW_HANDSHAKE_TIMEOUT_MS as te } from "./contract.js";
8
- import { a as P, i as F, t as I } from "./relay-choice-Bb3oP2gw.js";
9
- import { t as L } from "./proxy-BOHZkjk-.js";
2
+ import { D as t, E as n, N as r, O as i, T as a, _ as o, c as s, f as c, ft as l, g as u, h as d, j as f, k as p, l as m, m as h, o as g, p as _, s as v, u as y, x as b, y as x } from "./lib-B4Th0aXQ.js";
3
+ import { t as S } from "./proxy-OrF-WHyi.js";
4
+ import { c as C, m as w, t as T } from "./hosts-HUfgMimI.js";
5
+ import { a as E } from "./broker-frame-AQDD3D9E.js";
6
+ import { l as D, n as O, o as k, s as A } from "./api-De7vAubY.js";
7
+ import { r as j } from "./busy-C1JPjoZ_.js";
8
+ import { ATTACH_FRAME_KEY as M, ATTACH_WINDOW_KEY as ee, ATTACH_WINDOW_MESSAGE as N, RELAY_CHOICE_UNSUPPORTED as P, WINDOW_HANDSHAKE_TIMEOUT_MS as te } from "./contract.js";
9
+ import { a as F, i as I, t as L } from "./relay-choice-Bb3oP2gw.js";
10
10
  import { frameFetchVerdict as R } from "./attach-policy.js";
11
- import { t as ne } from "./dns-BQkSttLP.js";
12
- import { n as re } from "./fs-DJ4wpfml.js";
13
- import { s as ie } from "./net-DVYOBov-.js";
14
- import { i as ae } from "./dgram-B14T5Lqo.js";
15
- import { p as oe } from "./http-aUVH9bBn.js";
11
+ import { t as ne } from "./dns-DTbLD2s6.js";
12
+ import { n as re } from "./fs-BJdr72O6.js";
13
+ import { s as ie } from "./net-C_R3PDi7.js";
14
+ import { i as ae } from "./dgram-CYegbMMa.js";
15
+ import { p as oe } from "./http-D-rs8b6m.js";
16
16
  import { expose as z } from "osra";
17
17
  // src/cloud/frame-broker.ts
18
18
  var se = async () => {
19
- let e = () => k("frame consent");
19
+ let e = () => A("frame consent");
20
20
  try {
21
21
  let t = await e();
22
22
  return {
@@ -24,7 +24,7 @@ var se = async () => {
24
24
  ensure: t.frameConsent.ensure
25
25
  };
26
26
  } catch (t) {
27
- if (!(t instanceof D)) throw t;
27
+ if (!(t instanceof O)) throw t;
28
28
  return {
29
29
  request: void 0,
30
30
  ensure: (t) => e().then((e) => e.frameConsent.ensure(t))
@@ -45,11 +45,11 @@ var se = async () => {
45
45
  } catch {
46
46
  return "";
47
47
  }
48
- }, v = async () => s ? await s() : g(), y = () => w([...o, ...le(f)]), b = async (e, t) => (await e([t]))[0] ?? !1;
48
+ }, v = async () => s ? await s() : g(), y = () => T([...o, ...le(f)]), b = async (e, t) => (await e([t]))[0] ?? !1;
49
49
  return {
50
50
  gate: async ({ operation: e, args: i, phase: s }) => {
51
51
  t();
52
- let c = C(e, i);
52
+ let c = w(e, i);
53
53
  if (c === null) return;
54
54
  let _ = d(c);
55
55
  if (_ === void 0 || _ === "auto") return;
@@ -65,12 +65,12 @@ var se = async () => {
65
65
  if (!t) {
66
66
  if (e.kind === "refuse") throw p(e.reason, "fetch");
67
67
  if (!await n({
68
- scope: S(i[0], i[1]).scope,
68
+ scope: C(i[0], i[1]).scope,
69
69
  hosts: e.promptHosts
70
70
  })) throw p("frame.fetch: the user did not grant this", "fetch");
71
71
  return;
72
72
  }
73
- let c = e.kind === "consent" ? e.targetHost : await v(), l = w([c, ...o]);
73
+ let c = e.kind === "consent" ? e.targetHost : await v(), l = T([c, ...o]);
74
74
  if (!l.length) throw p("frame: navigate the frame before fetch", "fetch");
75
75
  if (await b(t, {
76
76
  category: "network",
@@ -82,26 +82,26 @@ var se = async () => {
82
82
  let x = await v();
83
83
  if (!x) throw p(`frame: navigate the frame before ${e}`, e);
84
84
  if (!y().includes(x)) throw p(B, e);
85
- let T = h(c);
86
- if (T === void 0 || T === "evaluation" && x === g() && await l?.() || _ === "critical" && m.has(`${c} ${x}`)) return;
85
+ let S = h(c);
86
+ if (S === void 0 || S === "evaluation" && x === g() && await l?.() || _ === "critical" && m.has(`${c} ${x}`)) return;
87
87
  let { request: E } = await r();
88
88
  if (!E) return;
89
- let D = w([x, ...o]), O = H(a(i)), k = _ === "critical" ? {
89
+ let D = T([x, ...o]), O = H(a(i)), k = _ === "critical" ? {
90
90
  key: c,
91
91
  hosts: D,
92
92
  attach: n,
93
93
  ...O
94
94
  } : {
95
- category: T,
95
+ category: S,
96
96
  hosts: D,
97
97
  ...O
98
98
  }, A = await b(E, k);
99
- if (A === !1) throw p(U(e, T, null), e);
99
+ if (A === !1) throw p(U(e, S, null), e);
100
100
  if (A === "once" && s !== "ensure") for (let e of D) m.add(`${c} ${e}`);
101
101
  },
102
102
  requestCategories: async (e) => {
103
103
  t(), c("frame.requestPermissions", e);
104
- let i = await v(), a = w(i ? [i, ...o] : o);
104
+ let i = await v(), a = T(i ? [i, ...o] : o);
105
105
  if (!a.length) throw TypeError("frame.requestPermissions: navigate the frame or declare domains first");
106
106
  let s = e.map((e) => {
107
107
  let t = e.key;
@@ -143,16 +143,16 @@ var se = async () => {
143
143
  i = setTimeout(() => a(typeof r == "string" ? new n(r) : r()), t);
144
144
  });
145
145
  return Promise.race([e, a]).finally(() => clearTimeout(i));
146
- }, J = (e) => Object.assign(Error(e), { name: t }), pe = "frame.postMessage: this FKN page predates frame messaging; reload the app to load the current one", me = "frame.addScriptTag: this render proxy predates addScriptTag; reload the app", he = `frame.addScriptTag: no answer within ${m}ms; the script may or may not have run`, ge = "frame.clearCookies: this FKN page predates clearCookies; reload the app to load the current one", _e = "frame.clearCookies: this attachment reaches no site yet; attach a url, goto one, or declare it in domains", Y = 3e4, X = "attachFrame: this FKN page predates storageState; reload the app to load the current one", ve = 2e4, ye = async (e, t) => {
147
- if (typeof e.seed != "function") throw r(X, "storageState", "cloud");
146
+ }, J = (e) => Object.assign(Error(e), { name: t }), pe = "frame.postMessage: this FKN page predates frame messaging; reload the app to load the current one", me = "frame.addScriptTag: this render proxy predates addScriptTag; reload the app", he = `frame.addScriptTag: no answer within ${m}ms; the script may or may not have run`, ge = "frame.clearCookies: this FKN page predates clearCookies; reload the app to load the current one", _e = "frame.clearCookies: this attachment reaches no site yet; attach a url, goto one, or declare it in domains", Y = 3e4, ve = "attachFrame: this FKN page predates storageState; reload the app to load the current one", ye = 2e4, be = async (e, t) => {
147
+ if (typeof e.seed != "function") throw r(ve, "storageState", "cloud");
148
148
  try {
149
- await q(e.seed(t), ve, "attachFrame: the render proxy did not take the storageState seed");
149
+ await q(e.seed(t), ye, "attachFrame: the render proxy did not take the storageState seed");
150
150
  } catch (e) {
151
- throw i(e) ? r(X, "storageState", "cloud") : e;
151
+ throw i(e) ? r(ve, "storageState", "cloud") : e;
152
152
  }
153
- }, be = `frame.clearCookies: the render proxy did not answer within ${Y}ms; the cookies may or may not be gone, and calling it again is safe`, xe = (e) => i(e) && e.message === f("addScriptTag").message, Se = !1, Ce = () => {
154
- Se || (Se = !0, console.warn("[fkn-frame] this FKN page predates frame messaging, so the page's messages and documents are never reported. Reloading the app loads the current one."));
155
- }, we = ({ from: e, origin: t, attach: n, signal: r }) => (i) => {
153
+ }, xe = `frame.clearCookies: the render proxy did not answer within ${Y}ms; the cookies may or may not be gone, and calling it again is safe`, Se = (e) => i(e) && e.message === f("addScriptTag").message, Ce = !1, we = () => {
154
+ Ce || (Ce = !0, console.warn("[fkn-frame] this FKN page predates frame messaging, so the page's messages and documents are never reported. Reloading the app loads the current one."));
155
+ }, Te = ({ from: e, origin: t, attach: n, signal: r }) => (i) => {
156
156
  let a = (r) => {
157
157
  if (r.source === null || r.source !== e() || r.origin !== t) return;
158
158
  let a = r.data;
@@ -167,13 +167,13 @@ var se = async () => {
167
167
  }));
168
168
  };
169
169
  return window.addEventListener("message", a, { signal: r }), () => window.removeEventListener("message", a);
170
- }, Te = (e) => {
170
+ }, Ee = (e) => {
171
171
  if (typeof e != "function") return () => Promise.resolve(e);
172
172
  let t = null;
173
173
  return () => t ??= e().catch((e) => {
174
174
  throw t = null, e;
175
175
  });
176
- }, Ee = ({ control: e, target: t, blank: n = !1, session: i, declaredHosts: a, approvedOrigins: o, attach: c, assertLive: l, guard: u, consent: d, onNavigated: h, relay: g }) => {
176
+ }, De = ({ control: e, target: t, blank: n = !1, session: i, declaredHosts: a, approvedOrigins: o, attach: c, assertLive: l, guard: u, consent: d, onNavigated: h, relay: g }) => {
177
177
  let _ = t, v = n && i !== "", b = async () => {
178
178
  if (!v) return !1;
179
179
  let n = typeof e.blank == "function" ? await u(() => e.blank()) : "";
@@ -186,7 +186,7 @@ var se = async () => {
186
186
  assertLive: l,
187
187
  documentHost: typeof e.documentHost == "function" ? () => u(() => e.documentHost()) : void 0,
188
188
  current: () => _,
189
- consent: Te(d),
189
+ consent: Ee(d),
190
190
  freshBlank: b
191
191
  });
192
192
  return x({
@@ -215,13 +215,13 @@ var se = async () => {
215
215
  try {
216
216
  await q(u(() => e.executeLocator([], "addScriptTag", i)), m, he);
217
217
  } catch (e) {
218
- throw xe(e) ? r(me, "addScriptTag", "cloud") : e;
218
+ throw Se(e) ? r(me, "addScriptTag", "cloud") : e;
219
219
  }
220
220
  },
221
221
  clearCookies: async (t) => {
222
222
  if (l(), typeof e.clearCookies != "function") throw r(ge, "clearCookies", "cloud");
223
223
  if (T().length === 0) throw p(_e, "clearCookies");
224
- await q(u(() => e.clearCookies(t)), Y, be);
224
+ await q(u(() => e.clearCookies(t)), Y, xe);
225
225
  },
226
226
  postMessage: (t, n, i) => {
227
227
  if (l(), typeof e.messaging != "function") throw r(pe, "postMessage", "cloud");
@@ -241,7 +241,7 @@ var se = async () => {
241
241
  await e;
242
242
  });
243
243
  },
244
- listen: (t) => (typeof e.messaging != "function" && Ce(), g(t)),
244
+ listen: (t) => (typeof e.messaging != "function" && we(), g(t)),
245
245
  goto: async (t, { timeout: n, ...r } = {}) => {
246
246
  let i = new URL(t, location.href).href;
247
247
  l(), v = !1;
@@ -265,38 +265,38 @@ var se = async () => {
265
265
  },
266
266
  url: () => _
267
267
  });
268
- }, De = async (e) => {
268
+ }, Oe = async (e) => {
269
269
  if (e === void 0) {
270
- let e = await k("a relay").catch(() => void 0);
270
+ let e = await A("a relay").catch(() => void 0);
271
271
  if (typeof e?.relay?.resolve != "function") return;
272
272
  let t = await e.relay.resolve().catch(() => void 0);
273
273
  return t && "id" in t ? t.id : void 0;
274
274
  }
275
- let t = await k("a relay choice");
276
- I(t, "attachFrame");
275
+ let t = await A("a relay choice");
276
+ L(t, "attachFrame");
277
277
  let n = await t.relay.resolve(e);
278
- if ("refused" in n) throw F(`attachFrame: ${n.refused}`);
278
+ if ("refused" in n) throw I(`attachFrame: ${n.refused}`);
279
279
  return n.id;
280
- }, Oe = async (e, t) => {
281
- if ((typeof e.relay == "function" ? await e.relay() : "") !== t) throw F(`attachFrame: ${N}`);
282
- }, ke = 250, Ae = 500, je = 65e3, Me = 2e3, Ne = 2e3, Pe = 2, Fe = 2e3, Ie = 2e3, Le = ({ origin: e, target: t, session: n, domains: r, attach: i }) => {
280
+ }, ke = async (e, t) => {
281
+ if ((typeof e.relay == "function" ? await e.relay() : "") !== t) throw I(`attachFrame: ${P}`);
282
+ }, Ae = 250, je = 500, Me = 65e3, Ne = 2e3, Pe = 2e3, Fe = 2, Ie = 2e3, Le = 2e3, Re = ({ origin: e, target: t, session: n, domains: r, attach: i }) => {
283
283
  let a = new URL("/attach-window", e);
284
284
  return a.searchParams.set("attach", i), t && a.searchParams.set("url", t), n && a.searchParams.set("session", n), r.length && a.searchParams.set("domains", r.join(",")), a.href;
285
- }, Re = (e, t) => {
285
+ }, ze = (e, t) => {
286
286
  let n = document.createElement("iframe"), r = new URL("/attach-jar", e);
287
287
  return r.searchParams.set("attach", t), n.src = r.href, n.tabIndex = -1, n.setAttribute("aria-hidden", "true"), n.setAttribute("style", "display:none"), (document.body ?? document.documentElement).appendChild(n), n;
288
- }, ze = (e, t) => {
288
+ }, Be = (e, t) => {
289
289
  let n = new MutationObserver(() => {
290
290
  e.isConnected || t.aborted || (n.disconnect(), console.warn("cloud.attachFrame: the window's jar anchor was removed from this page, so a sign-in in the window no longer reaches this app's cookie jar"));
291
291
  });
292
292
  e.parentNode && n.observe(e.parentNode, { childList: !0 }), n.observe(document.documentElement, { childList: !0 }), t.addEventListener("abort", () => n.disconnect(), { once: !0 });
293
- }, Z = () => J("cloud.attachFrame: the attached window closed, reloaded or left the page FKN attached; attach a fresh window"), Be = () => J("cloud.attachFrame: the attached window stopped answering; attach a fresh window"), Ve = () => J("cloud.attachFrame: the window went away before it connected; attach a fresh window"), He = () => J("cloud.attachFrame: the window closed before it connected. Either the user closed it, or this page's Cross-Origin-Opener-Policy cut its link to the window"), Ue = async (e, t, n) => {
293
+ }, X = () => J("cloud.attachFrame: the attached window closed, reloaded or left the page FKN attached; attach a fresh window"), Ve = () => J("cloud.attachFrame: the attached window stopped answering; attach a fresh window"), He = () => J("cloud.attachFrame: the window went away before it connected; attach a fresh window"), Ue = () => J("cloud.attachFrame: the window closed before it connected. Either the user closed it, or this page's Cross-Origin-Opener-Policy cut its link to the window"), We = async (e, t, n) => {
294
294
  if (typeof window > "u") throw Error("cloud.attachFrame needs a window realm");
295
295
  let { domains: r = [], permissions: i, relay: a } = e, { url: s, width: c, height: d } = v(e.window);
296
296
  if (window.origin === "null") throw new o("opaque-opener");
297
- let f = G(), p = crypto.randomUUID(), m = K(t), h = w(r), g = /* @__PURE__ */ new Set();
297
+ let f = G(), p = crypto.randomUUID(), m = K(t), h = T(r), g = /* @__PURE__ */ new Set();
298
298
  s && g.add(new URL(s).origin);
299
- let _ = t === "persistent" ? Re(f, p) : null, y = window.open(Le({
299
+ let _ = t === "persistent" ? ze(f, p) : null, y = window.open(Re({
300
300
  origin: f,
301
301
  target: n === void 0 ? s : "",
302
302
  session: m,
@@ -306,59 +306,59 @@ var se = async () => {
306
306
  if (!y) throw _?.remove(), new u();
307
307
  let b = new AbortController(), x = !1, S = null, C = (e, t = !1) => {
308
308
  if (S === null) {
309
- S = e, b.abort(t ? Be() : Z());
309
+ S = e, b.abort(t ? Ve() : X());
310
310
  try {
311
311
  y.closed || y.postMessage({
312
- type: M.detach,
312
+ type: N.detach,
313
313
  attach: p,
314
314
  ...t ? { unanswered: t } : {}
315
315
  }, f);
316
316
  } catch {}
317
- _ && setTimeout(() => _.remove(), Ie);
317
+ _ && setTimeout(() => _.remove(), Le);
318
318
  }
319
319
  };
320
- _ && ze(_, b.signal);
321
- let T = new Promise((e, t) => {
320
+ _ && Be(_, b.signal);
321
+ let w = new Promise((e, t) => {
322
322
  b.signal.addEventListener("abort", () => t(b.signal.reason), { once: !0 });
323
323
  });
324
- T.catch(() => {});
325
- let E = T.then(() => {}, () => {}), D = () => {
324
+ w.catch(() => {});
325
+ let E = w.then(() => {}, () => {}), D = () => {
326
326
  if (b.signal.aborted) throw b.signal.reason;
327
- }, O = (e) => b.signal.aborted ? Promise.reject(b.signal.reason) : Promise.race([e(), T]), k = (e) => e.source === y && e.origin === f;
327
+ }, O = (e) => b.signal.aborted ? Promise.reject(b.signal.reason) : Promise.race([e(), w]), k = (e) => e.source === y && e.origin === f;
328
328
  window.addEventListener("message", (e) => {
329
329
  let t = e.source === null && e.origin === f;
330
330
  if (!k(e) && !t) return;
331
331
  let n = e.data;
332
- typeof n == "object" && n && n.attach === p && (n.type === M.gone ? C(x ? Z() : Ve()) : n.type === M.refused && !t && C(new o(n.reason)));
333
- }, { signal: b.signal }), window.addEventListener("pagehide", () => C(Z()), { signal: b.signal });
334
- let j = De(a), N, F, I = () => {
332
+ typeof n == "object" && n && n.attach === p && (n.type === N.gone ? C(x ? X() : He()) : n.type === N.refused && !t && C(new o(n.reason)));
333
+ }, { signal: b.signal }), window.addEventListener("pagehide", () => C(X()), { signal: b.signal });
334
+ let A = Oe(a), M, P, I = () => {
335
335
  let e = () => {
336
336
  try {
337
337
  y.postMessage({
338
- type: M.hello,
338
+ type: N.hello,
339
339
  attach: p,
340
- ...N ? { relay: N } : {}
340
+ ...M ? { relay: M } : {}
341
341
  }, f);
342
342
  } catch {}
343
343
  };
344
- e(), F = setInterval(e, ke);
344
+ e(), P = setInterval(e, Ae);
345
345
  };
346
346
  a === void 0 && I();
347
347
  let L = setInterval(() => {
348
- y.closed && C(x ? Z() : He());
349
- }, Ae);
348
+ y.closed && C(x ? X() : Ue());
349
+ }, je);
350
350
  b.signal.addEventListener("abort", () => {
351
- clearInterval(F), clearInterval(L);
351
+ clearInterval(P), clearInterval(L);
352
352
  }, { once: !0 });
353
353
  let R = async (e) => {
354
354
  try {
355
- return await Promise.race([e, T]);
355
+ return await Promise.race([e, w]);
356
356
  } catch (e) {
357
357
  throw S ?? e;
358
358
  }
359
359
  };
360
360
  try {
361
- a !== void 0 && (N = await R(j), I());
361
+ a !== void 0 && (M = await R(A), I());
362
362
  let e = await R(q(z({}, {
363
363
  key: ee,
364
364
  transport: {
@@ -376,16 +376,16 @@ var se = async () => {
376
376
  unregisterSignal: b.signal,
377
377
  revivableModules: W(l)
378
378
  }), te, "cloud.attachFrame: timed out connecting to the window"));
379
- x = !0, clearInterval(F);
379
+ x = !0, clearInterval(P);
380
380
  let t = 0, r = setInterval(() => {
381
- q(O(() => e.ping()), Ne, "ping").then(() => {
381
+ q(O(() => e.ping()), Pe, "ping").then(() => {
382
382
  t = 0;
383
383
  }, () => {
384
- b.signal.aborted || (document.visibilityState === "hidden" ? t = 0 : ++t >= Pe && C(Be(), !0));
384
+ b.signal.aborted || (document.visibilityState === "hidden" ? t = 0 : ++t >= Fe && C(Ve(), !0));
385
385
  });
386
- }, Me);
387
- b.signal.addEventListener("abort", () => clearInterval(r), { once: !0 }), N && await R(q(Oe(e, N), je, "cloud.attachFrame: the window never became ready")), await R(q(e.ready(), je, "cloud.attachFrame: the window never became ready")), n !== void 0 && await R(ye(e, n)), A("attached frame", b.signal);
388
- let o = Ee({
386
+ }, Ne);
387
+ b.signal.addEventListener("abort", () => clearInterval(r), { once: !0 }), M && await R(q(ke(e, M), Me, "cloud.attachFrame: the window never became ready")), await R(q(e.ready(), Me, "cloud.attachFrame: the window never became ready")), n !== void 0 && await R(be(e, n)), j("attached frame", b.signal);
388
+ let o = De({
389
389
  control: e,
390
390
  target: s,
391
391
  session: m,
@@ -399,7 +399,7 @@ var se = async () => {
399
399
  ensure: (t) => O(() => e.requestConsent([t])).then(([e]) => e !== void 0 && e !== !1)
400
400
  },
401
401
  onNavigated: () => {},
402
- relay: we({
402
+ relay: Te({
403
403
  from: () => y,
404
404
  origin: f,
405
405
  attach: p,
@@ -407,15 +407,15 @@ var se = async () => {
407
407
  })
408
408
  }), c = null, u = Object.assign(o, {
409
409
  close: () => c ??= (async () => {
410
- b.signal.aborted || await q(Promise.allSettled([O(() => e.flushCookies()), O(() => e.sweepStorage())]), Fe, "close").catch(() => {});
410
+ b.signal.aborted || await q(Promise.allSettled([O(() => e.flushCookies()), O(() => e.sweepStorage())]), Ie, "close").catch(() => {});
411
411
  try {
412
412
  y.close();
413
413
  } catch {}
414
- C(Z());
414
+ C(X());
415
415
  })(),
416
416
  closed: E
417
417
  });
418
- return N ? P(u, N) : j.then((e) => P(u, e)), n !== void 0 && s && await R(u.goto(s)), i?.length && await R(u.requestPermissions(i)), u;
418
+ return M ? F(u, M) : A.then((e) => F(u, e)), n !== void 0 && s && await R(u.goto(s)), i?.length && await R(u.requestPermissions(i)), u;
419
419
  } catch (e) {
420
420
  let t = S ?? e;
421
421
  if (!(t instanceof o)) try {
@@ -423,7 +423,7 @@ var se = async () => {
423
423
  } catch {}
424
424
  throw C(t), t;
425
425
  }
426
- }, We = 2e4, Q = 65e3, $ = (e) => !e || e === "about:blank", Ge = "cloud.attachFrame: this FKN page predates blank pages; reload the app to load the current one", Ke = "cloud.attachFrame: cookies: 'native' needs the FKN browser extension; the cloud render proxy has no browser cookies", qe = (e) => e.split("#")[0] ?? "", Je = ({ iframe: e, lockdown: t, cookies: n, blank: r }) => {
426
+ }, Ge = 2e4, Z = 65e3, Q = (e) => !e || e === "about:blank", Ke = "cloud.attachFrame: this FKN page predates blank pages; reload the app to load the current one", qe = "cloud.attachFrame: cookies: 'native' needs the FKN browser extension; the cloud render proxy has no browser cookies", Je = (e) => e.split("#")[0] ?? "", Ye = ({ iframe: e, lockdown: t, cookies: n, blank: r }) => {
427
427
  if (r === void 0) return "";
428
428
  if (typeof r != "object" || !r) throw TypeError("attachFrame: blank must be an object { url }");
429
429
  let i = Object.keys(r).find((e) => e !== "url");
@@ -437,15 +437,15 @@ var se = async () => {
437
437
  })();
438
438
  if (!o || o.protocol !== "http:" && o.protocol !== "https:") throw TypeError(`attachFrame: blank.url must be an absolute http or https url, not "${String(a)}"`);
439
439
  let s = e.getAttribute("src") ?? "";
440
- if (!$(s)) throw TypeError(`attachFrame: blank needs an iframe with no src; this one has "${s}"`);
440
+ if (!Q(s)) throw TypeError(`attachFrame: blank needs an iframe with no src; this one has "${s}"`);
441
441
  if (t) throw TypeError("attachFrame: blank does not combine with lockdown");
442
442
  if (n === "native") throw TypeError("attachFrame: blank runs on the cloud render proxy, which has no browser cookies; pass cookies: 'persistent' or 'ephemeral'");
443
- if (b(o.href), !at()) throw Error("attachFrame: a blank page is served by the cloud render proxy, which this build does not configure");
443
+ if (b(o.href), !ot()) throw Error("attachFrame: a blank page is served by the cloud render proxy, which this build does not configure");
444
444
  return o.href;
445
- }, Ye = ({ target: e, blank: t, session: n, domains: r, attach: i, relay: a }) => {
445
+ }, Xe = ({ target: e, blank: t, session: n, domains: r, attach: i, relay: a }) => {
446
446
  let o = new URL("/attach-frame", G());
447
447
  return t ? o.searchParams.set("blank", t) : e && o.searchParams.set("url", e), n && o.searchParams.set("session", n), r.length && o.searchParams.set("domains", r.join(",")), o.searchParams.set("attach", i), a && o.searchParams.set("relay", a), o.href;
448
- }, Xe = (e, t) => {
448
+ }, Ze = (e, t) => {
449
449
  let n = () => {
450
450
  a(), t();
451
451
  }, r = e.parentNode, i = new MutationObserver(() => {
@@ -454,14 +454,14 @@ var se = async () => {
454
454
  window.removeEventListener("pagehide", n), i.disconnect();
455
455
  };
456
456
  window.addEventListener("pagehide", n, { once: !0 }), r && i.observe(r, { childList: !0 }), e.isConnected || (a(), t());
457
- }, Ze = () => J("cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe"), Qe = (e, t) => {
457
+ }, Qe = () => J("cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe"), $e = (e, t) => {
458
458
  let n = [...e.split(";"), ...t.split(";")].map((e) => e.trim()).filter(Boolean);
459
459
  return [...new Set(n)].join("; ");
460
- }, $e = [
460
+ }, et = [
461
461
  300,
462
462
  1200,
463
463
  4e3
464
- ], et = (e) => {
464
+ ], tt = (e) => {
465
465
  let t = () => {
466
466
  if (!e.isConnected) return;
467
467
  let t = e.style.height, n = e.getBoundingClientRect();
@@ -470,22 +470,22 @@ var se = async () => {
470
470
  }, 50));
471
471
  };
472
472
  t();
473
- for (let e of $e) setTimeout(t, e);
474
- }, tt = (e) => {
473
+ for (let e of et) setTimeout(t, e);
474
+ }, nt = (e) => {
475
475
  let t = e.getAttribute("sandbox");
476
476
  if (t === null) return;
477
477
  let n = new Set(t.toLowerCase().split(/\s+/).filter(Boolean)), r = ["allow-scripts", "allow-same-origin"].filter((e) => !n.has(e));
478
478
  if (r.length) throw Error(`cloud.attachFrame: the iframe's sandbox attribute must include ${r.join(" and ")} for the render proxy to load`);
479
- }, nt = async (e, t) => {
480
- let n = typeof e.blank == "function" ? await q(e.blank(), Q, "cloud.attachFrame: the render proxy never became ready") : "";
481
- if (typeof n != "string" || qe(n) !== qe(t)) throw r(Ge, "blank", "cloud");
482
- }, rt = async (e, t, n) => {
483
- let r = Je(e), { iframe: i, domains: a = [], permissions: o, relay: s } = e;
479
+ }, rt = async (e, t) => {
480
+ let n = typeof e.blank == "function" ? await q(e.blank(), Z, "cloud.attachFrame: the render proxy never became ready") : "";
481
+ if (typeof n != "string" || Je(n) !== Je(t)) throw r(Ke, "blank", "cloud");
482
+ }, it = async (e, t, n) => {
483
+ let r = Ye(e), { iframe: i, domains: a = [], permissions: o, relay: s } = e;
484
484
  if (typeof window > "u") throw Error("cloud.attachFrame needs a window realm");
485
485
  if (!i.isConnected) throw Error("cloud.attachFrame: the iframe must be connected to the document before attaching");
486
- tt(i);
486
+ nt(i);
487
487
  let c = i.getAttribute("src") ?? "", u = (() => {
488
- if ($(c)) return null;
488
+ if (Q(c)) return null;
489
489
  try {
490
490
  return new URL(i.src || c, location.href);
491
491
  } catch {
@@ -498,12 +498,12 @@ var se = async () => {
498
498
  }
499
499
  let d = u?.href ?? "";
500
500
  d && b(d);
501
- let f = n === void 0 ? d : "", p = K(t), m = w(a), h = /* @__PURE__ */ new Set();
501
+ let f = n === void 0 ? d : "", p = K(t), m = T(a), h = /* @__PURE__ */ new Set();
502
502
  try {
503
503
  h.add(new URL(r || d).origin);
504
504
  } catch {}
505
- let g = De(s), _ = s === void 0 ? void 0 : await g, v = new AbortController(), y = i.referrerPolicy, x = i.allow, S = crypto.randomUUID();
506
- if (i.referrerPolicy = "origin", i.allow = Qe(T(), i.allow), i.src = Ye({
505
+ let g = Oe(s), _ = s === void 0 ? void 0 : await g, v = new AbortController(), y = i.referrerPolicy, x = i.allow, S = crypto.randomUUID();
506
+ if (i.referrerPolicy = "origin", i.allow = $e(E(), i.allow), i.src = Xe({
507
507
  target: f,
508
508
  blank: r,
509
509
  session: p,
@@ -513,7 +513,7 @@ var se = async () => {
513
513
  }), !i.contentWindow) throw Error("cloud.attachFrame: the iframe window is not available");
514
514
  try {
515
515
  let e = await q(z({}, {
516
- key: j,
516
+ key: M,
517
517
  origin: G(),
518
518
  transport: {
519
519
  receive: window,
@@ -521,9 +521,9 @@ var se = async () => {
521
521
  },
522
522
  unregisterSignal: v.signal,
523
523
  revivableModules: W(l)
524
- }), We, "cloud.attachFrame: timed out connecting to the render proxy page");
525
- _ && await q(Oe(e, _), Q, "cloud.attachFrame: the render proxy never became ready"), await q(e.ready(), Q, "cloud.attachFrame: the render proxy never became ready"), r && await nt(e, r), n !== void 0 && await ye(e, n), (d || r) && et(i), Xe(i, () => v.abort()), A("attached frame", v.signal);
526
- let t = i.contentWindow, a = Ee({
524
+ }), Ge, "cloud.attachFrame: timed out connecting to the render proxy page");
525
+ _ && await q(ke(e, _), Z, "cloud.attachFrame: the render proxy never became ready"), await q(e.ready(), Z, "cloud.attachFrame: the render proxy never became ready"), r && await rt(e, r), n !== void 0 && await be(e, n), (d || r) && tt(i), Ze(i, () => v.abort()), j("attached frame", v.signal);
526
+ let t = i.contentWindow, a = De({
527
527
  control: e,
528
528
  target: r || d,
529
529
  blank: r !== "",
@@ -532,28 +532,28 @@ var se = async () => {
532
532
  approvedOrigins: h,
533
533
  attach: S,
534
534
  assertLive: () => {
535
- if (v.signal.aborted || !i.isConnected || i.contentWindow !== t) throw v.abort(), Ze();
535
+ if (v.signal.aborted || !i.isConnected || i.contentWindow !== t) throw v.abort(), Qe();
536
536
  },
537
537
  guard: (e) => e(),
538
538
  consent: se,
539
- onNavigated: () => et(i),
540
- relay: we({
539
+ onNavigated: () => tt(i),
540
+ relay: Te({
541
541
  from: () => t,
542
542
  origin: G(),
543
543
  attach: S,
544
544
  signal: v.signal
545
545
  })
546
546
  });
547
- return _ ? P(a, _) : g.then((e) => P(a, e)), n !== void 0 && d && await a.goto(d), o?.length && await a.requestPermissions(o), a;
547
+ return _ ? F(a, _) : g.then((e) => F(a, e)), n !== void 0 && d && await a.goto(d), o?.length && await a.requestPermissions(o), a;
548
548
  } catch (e) {
549
549
  throw v.abort(), i.referrerPolicy = y, i.allow = x, i.src = f || "about:blank", e;
550
550
  }
551
- }, it = (async (e) => {
551
+ }, at = (async (e) => {
552
552
  let { kind: t, cookies: n, storageState: r } = g(e);
553
- if (n === "native") throw TypeError(Ke);
554
- return t === "window" ? Ue(e, n, r) : rt(e, n, r);
555
- }), at = () => typeof window < "u" && !0, ot = async () => {
556
- let e = await O.then((e) => e.cloud.quota());
553
+ if (n === "native") throw TypeError(qe);
554
+ return t === "window" ? We(e, n, r) : it(e, n, r);
555
+ }), ot = () => typeof window < "u" && !0, st = async () => {
556
+ let e = await k.then((e) => e.cloud.quota());
557
557
  return {
558
558
  premium: e.premium,
559
559
  overQuota: e.overQuota,
@@ -564,15 +564,15 @@ var se = async () => {
564
564
  bytesPerSecond: e.bytesPerSecond,
565
565
  bitsPerSecond: e.bytesPerSecond * 8
566
566
  };
567
- }, st = /* @__PURE__ */ e({
568
- attachFrame: () => it,
569
- available: () => ct,
567
+ }, ct = /* @__PURE__ */ e({
568
+ attachFrame: () => at,
569
+ available: () => $,
570
570
  dgram: () => ae,
571
571
  dns: () => ne,
572
- fetch: () => L,
572
+ fetch: () => S,
573
573
  fs: () => re,
574
574
  http: () => oe,
575
575
  net: () => ie,
576
- quota: () => ot
577
- }), ct = () => E;
578
- export { Je as a, it as i, st as n, ot as r, ct as t };
576
+ quota: () => st
577
+ }), $ = () => D;
578
+ export { Ye as a, at as i, ct as n, st as r, $ as t };
package/cloud.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./proxy-vI5LhXLv.cjs"),t=require("./cloud-pJ8R_Dmx.cjs"),n=require("./dns-DlTvtfVk.cjs"),r=require("./fs-DxECe50Z.cjs"),i=require("./net-DUyZ7_3E.cjs"),a=require("./dgram-BPXm8haL.cjs"),o=require("./http-hIJh5XTX.cjs");exports.attachFrame=t.i,exports.available=t.t,Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return a.i}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return n.t}}),exports.fetch=e.t,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return r.n}}),Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return o.p}}),Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return i.s}}),exports.quota=t.r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./proxy-CgISk6T6.cjs"),t=require("./cloud-Buku7KQJ.cjs"),n=require("./dns-CtxN7cCj.cjs"),r=require("./fs-1Q6VCx3d.cjs"),i=require("./net-B3SziNT3.cjs"),a=require("./dgram-BgWDRjw-.cjs"),o=require("./http-DkvhaPVT.cjs");exports.attachFrame=t.i,exports.available=t.t,Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return a.i}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return n.t}}),exports.fetch=e.t,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return r.n}}),Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return o.p}}),Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return i.s}}),exports.quota=t.r;
package/cloud.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { t as cloudFetch } from "./proxy-CzP07me0.js";
2
- import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-DRfcPLdB.js";
3
- import { t as dns_d_exports } from "./dns-_NCe2YLS.js";
1
+ import { t as cloudFetch } from "./proxy-Xe45WiQU.js";
2
+ import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-BDTtnMtj.js";
3
+ import { t as dns_d_exports } from "./dns-DeuTGd8C.js";
4
4
  import { n as fs_d_exports } from "./fs-ChOYC6VD.js";
5
- import { s as net_d_exports } from "./net-B4IqLeN8.js";
6
- import { i as dgram_d_exports } from "./dgram-CPQqam5Z.js";
7
- import { _ as http_d_exports } from "./http-rzQOrCmq.js";
5
+ import { s as net_d_exports } from "./net-CK_1P9_C.js";
6
+ import { i as dgram_d_exports } from "./dgram-BggVwnRp.js";
7
+ import { _ as http_d_exports } from "./http-LhyEQ2D8.js";
8
8
  export { type QuotaStatus, attachFrame, available, dgram_d_exports as dgram, dns_d_exports as dns, cloudFetch as fetch, fs_d_exports as fs, http_d_exports as http, net_d_exports as net, quota };
package/cloud.js CHANGED
@@ -1,8 +1,8 @@
1
- import { t as e } from "./proxy-BOHZkjk-.js";
2
- import { i as t, r as n, t as r } from "./cloud-CyU_k-d9.js";
3
- import { t as i } from "./dns-BQkSttLP.js";
4
- import { n as a } from "./fs-DJ4wpfml.js";
5
- import { s as o } from "./net-DVYOBov-.js";
6
- import { i as s } from "./dgram-B14T5Lqo.js";
7
- import { p as c } from "./http-aUVH9bBn.js";
1
+ import { t as e } from "./proxy-OrF-WHyi.js";
2
+ import { i as t, r as n, t as r } from "./cloud-Bv_GUwcG.js";
3
+ import { t as i } from "./dns-DTbLD2s6.js";
4
+ import { n as a } from "./fs-BJdr72O6.js";
5
+ import { s as o } from "./net-C_R3PDi7.js";
6
+ import { i as s } from "./dgram-CYegbMMa.js";
7
+ import { p as c } from "./http-D-rs8b6m.js";
8
8
  export { t as attachFrame, r as available, s as dgram, i as dns, e as fetch, a as fs, c as http, o as net, n as quota };