@fkn/lib 0.9.24 → 0.9.25

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 (121) hide show
  1. package/account.cjs +1 -1
  2. package/account.d.ts +7 -3
  3. package/account.js +7 -7
  4. package/api-BCJO3EWi.cjs +3 -0
  5. package/api-CesI0aMl.d.ts +677 -0
  6. package/{api-Jq4OSTp1.js → api-DLvscoll.js} +99 -96
  7. package/api.cjs +1 -0
  8. package/api.d.ts +3 -0
  9. package/api.js +2 -0
  10. package/attach-policy.cjs +1 -0
  11. package/attach-policy.d.ts +35 -0
  12. package/attach-policy.js +43 -0
  13. package/{busy-Bp1E3JPT.js → busy-B189uX--.js} +1 -1
  14. package/cloud/dgram.cjs +1 -1
  15. package/cloud/dgram.js +2 -2
  16. package/cloud/dns.d.ts +1 -1
  17. package/cloud/fetch.cjs +1 -1
  18. package/cloud/fetch.d.ts +1 -1
  19. package/cloud/fetch.js +1 -1
  20. package/cloud/fs/promises.d.ts +7 -6
  21. package/cloud/fs/promises.js +1 -1
  22. package/cloud/fs.cjs +1 -1
  23. package/cloud/fs.d.ts +3 -3
  24. package/cloud/fs.js +10 -9
  25. package/cloud/net.cjs +1 -1
  26. package/cloud/net.d.ts +1 -1
  27. package/cloud/net.js +3 -3
  28. package/cloud-B2ZG-0MF.cjs +1 -0
  29. package/cloud-B7pI3pp1.d.ts +37 -0
  30. package/{cloud-7rfQ2BRH.js → cloud-DolBoNvR.js} +59 -97
  31. package/cloud.cjs +1 -1
  32. package/cloud.d.ts +4 -4
  33. package/cloud.js +4 -4
  34. package/{connect-button-Ds9KpXHe.js → connect-button-CN4ZJwT6.js} +1 -1
  35. package/{connect-button-D8KXSL6s.d.ts → connect-button-DdoEikEd.d.ts} +1 -1
  36. package/contract-D6ksmIm6.d.ts +394 -0
  37. package/contract.cjs +0 -0
  38. package/contract.d.ts +3 -0
  39. package/contract.js +0 -0
  40. package/desktop.js +1 -1
  41. package/dgram.cjs +1 -1
  42. package/dgram.d.ts +6 -47
  43. package/dgram.js +406 -2
  44. package/dns.cjs +1 -1
  45. package/dns.d.ts +1 -3
  46. package/dns.js +2 -2
  47. package/extension-CJUeVRXf.d.ts +361 -0
  48. package/extension-DBazc3ff.cjs +1 -0
  49. package/extension-Dw9gzvei.js +84 -0
  50. package/extension.cjs +1 -1
  51. package/extension.d.ts +3 -3
  52. package/extension.js +3 -3
  53. package/fs/promises.cjs +1 -1
  54. package/fs/promises.d.ts +8 -9
  55. package/fs/promises.js +2 -2
  56. package/fs-DYP7utdw.cjs +1 -0
  57. package/{fs-CUmugp10.d.ts → fs-DlGE0ZNu.d.ts} +20 -21
  58. package/{fs-pOQSZfuf.js → fs-d2ANVBkm.js} +8 -8
  59. package/fs.cjs +1 -1
  60. package/fs.d.ts +2 -2
  61. package/fs.js +1 -1
  62. package/http.cjs +3 -3
  63. package/http.d.ts +4 -6
  64. package/http.js +8 -8
  65. package/{index-CJ0vHTcS.d.ts → index-BQgZVQl7.d.ts} +4 -7
  66. package/{index-DY8WjklJ.d.ts → index-BhO-wymH.d.ts} +15 -293
  67. package/{index-BIZeEsNu.d.ts → index-CGJTVju4.d.ts} +52 -46
  68. package/index.cjs +1 -1
  69. package/index.d.ts +12 -13
  70. package/index.js +61 -59
  71. package/lib-DLM2M3_i.cjs +53 -0
  72. package/{lib-k3lstfa4.js → lib-duLPF_WZ.js} +328 -277
  73. package/messages-DvpKMTsY.d.ts +28 -0
  74. package/messages.cjs +1 -0
  75. package/messages.d.ts +2 -0
  76. package/messages.js +4 -0
  77. package/{net-DaWv81tQ.d.ts → net-DAOcF3Eb.d.ts} +12 -16
  78. package/net.cjs +1 -1
  79. package/net.d.ts +1 -1
  80. package/net.js +318 -3
  81. package/{node-fs-BZCQUmeE.js → node-fs-C9ECR_9H.js} +2 -2
  82. package/opfs/promises.d.ts +7 -8
  83. package/opfs/promises.js +1 -1
  84. package/{opfs-BibrNGF0.js → opfs-D0goLAQW.js} +1 -1
  85. package/opfs.d.ts +24 -26
  86. package/opfs.js +3 -3
  87. package/package.json +27 -2
  88. package/packages.cjs +1 -1
  89. package/packages.d.ts +143 -2
  90. package/packages.js +15 -15
  91. package/{proxy-DmMu2_1z.d.ts → proxy-BubvP9sg.d.ts} +3 -3
  92. package/{proxy-BNdvRifw.cjs → proxy-CefKCs-i.cjs} +1 -1
  93. package/{proxy-CRbkWS4E.js → proxy-KUfE4cEQ.js} +3 -3
  94. package/react.d.ts +3 -7
  95. package/react.js +2 -2
  96. package/{storage-BNjLc1FV.js → storage-BjGr_vC4.js} +5 -5
  97. package/storage-DLB4ciMf.cjs +1 -0
  98. package/utils-BvgGdrgN.cjs +1 -0
  99. package/{utils-DVlbuXmW.js → utils-C-cAd4r4.js} +2 -3
  100. package/wire-Gbo-D74t.d.ts +91 -0
  101. package/wire.cjs +1 -0
  102. package/wire.d.ts +2 -0
  103. package/wire.js +4 -0
  104. package/api-BGYSJVvR.d.ts +0 -789
  105. package/api-C-TpWHAU.cjs +0 -3
  106. package/cloud-BqjwL5KM.cjs +0 -1
  107. package/cloud-DMTkzfcf.d.ts +0 -36
  108. package/dgram-BLN-mfgq.cjs +0 -1
  109. package/dgram-DHQcHefn.js +0 -405
  110. package/extension-B8Y0sUwC.js +0 -78
  111. package/extension-CMPZjuaV.d.ts +0 -16
  112. package/extension-CgSGjcSl.cjs +0 -1
  113. package/fs-BNnozBMU.cjs +0 -1
  114. package/lib-DbiVHPXE.cjs +0 -53
  115. package/lookup-BtwWaCZJ.d.ts +0 -7
  116. package/net-B6RHtWwe.cjs +0 -1
  117. package/net-yBkobZqK.js +0 -317
  118. package/packages-Cn8S-Hkn.d.ts +0 -217
  119. package/storage-qxXFLgTM.d.ts +0 -44
  120. package/storage-xAeRQQiz.cjs +0 -1
  121. package/utils-QfNXtEhb.cjs +0 -1
@@ -1,7 +1,6 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { expose as t } from "osra";
3
- //#region src/lib/frame-ready.ts
4
- var n = 1e4, r = 16, i = (e) => {
1
+ import { expose as e } from "osra";
2
+ //#region src/frame-ready.ts
3
+ var t = 1e4, n = 16, r = (e) => {
5
4
  let t;
6
5
  try {
7
6
  t = e.contentWindow;
@@ -15,22 +14,22 @@ var n = 1e4, r = 16, i = (e) => {
15
14
  } catch {
16
15
  return !0;
17
16
  }
18
- }, a = (e, t = n) => new Promise((n) => {
19
- if (i(e)) return n();
17
+ }, i = (e, i = t) => new Promise((t) => {
18
+ if (r(e)) return t();
20
19
  let a = () => {
21
- clearInterval(o), clearTimeout(s), e.removeEventListener("load", a), n();
20
+ clearInterval(o), clearTimeout(s), e.removeEventListener("load", a), t();
22
21
  }, o = setInterval(() => {
23
- i(e) && a();
24
- }, r), s = setTimeout(a, t);
22
+ r(e) && a();
23
+ }, n), s = setTimeout(a, i);
25
24
  e.addEventListener("load", a);
26
- }), o = 32, s = 8, c = 120, l = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0H1V1H0Z')"), u = typeof CSS < "u" && CSS.supports("clip-path", "polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)"), d = (e) => {
25
+ }), a = 32, o = 8, s = 120, c = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0H1V1H0Z')"), l = typeof CSS < "u" && CSS.supports("clip-path", "polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)"), u = (e) => {
27
26
  let t = e.style;
28
27
  t.setProperty("display", "block", "important"), t.setProperty("position", "fixed", "important"), t.setProperty("top", "0", "important"), t.setProperty("left", "0", "important"), t.setProperty("width", "100%", "important"), t.setProperty("height", "100%", "important"), t.setProperty("border", "none", "important"), t.setProperty("padding", "0", "important"), t.setProperty("box-sizing", "border-box", "important"), t.setProperty("clip-path", "inset(100%)", "important"), t.setProperty("background", "transparent"), t.setProperty("color-scheme", "normal"), t.setProperty("z-index", "2147483647"), e.setAttribute("title", "FKN");
29
- }, f = ({ x: e, y: t, width: n, height: r, radius: i }) => {
28
+ }, d = ({ x: e, y: t, width: n, height: r, radius: i }) => {
30
29
  if (!i) return `M${e} ${t}h${n}v${r}h${-n}Z`;
31
30
  let a = Math.min(n, r) / 2, [o, s, c, l] = i.map((e) => Math.max(0, Math.min(e, a)));
32
31
  return `M${e + o} ${t}h${n - o - s}a${s} ${s} 0 0 1 ${s} ${s}v${r - s - c}a${c} ${c} 0 0 1 ${-c} ${c}h${-(n - c - l)}a${l} ${l} 0 0 1 ${-l} ${-l}v${-(r - l - o)}a${o} ${o} 0 0 1 ${o} ${-o}Z`;
33
- }, p = () => l && u, m = ({ x: e, y: t, width: n, height: r }) => [
32
+ }, f = () => c && l, p = ({ x: e, y: t, width: n, height: r }) => [
34
33
  [e, t],
35
34
  [e + n, t],
36
35
  [e + n, t + r],
@@ -39,18 +38,18 @@ var n = 1e4, r = 16, i = (e) => {
39
38
  ], ee = (e) => {
40
39
  let t = e[0];
41
40
  if (!t) return [];
42
- let n = m(t)[0], r = [];
41
+ let n = p(t)[0], r = [];
43
42
  return e.forEach((t, i) => {
44
- r.push(...m(t)), i > 0 && i < e.length - 1 && r.push(n);
43
+ r.push(...p(t)), i > 0 && i < e.length - 1 && r.push(n);
45
44
  }), r;
46
- }, h = (e) => `polygon(nonzero, ${ee(e).map(([e, t]) => `${e}px ${t}px`).join(", ")})`, g = ({ x: e, y: t, width: n, height: r, radius: i }, a) => {
45
+ }, m = (e) => `polygon(nonzero, ${ee(e).map(([e, t]) => `${e}px ${t}px`).join(", ")})`, h = ({ x: e, y: t, width: n, height: r, radius: i }, a) => {
47
46
  let o = `${t}px ${a.width - e - n}px ${a.height - t - r}px ${e}px`;
48
47
  return i ? `inset(${o} round ${i.map((e) => `${e}px`).join(" ")})` : `inset(${o})`;
49
- }, te = (e, t, n) => {
48
+ }, g = (e, t, n) => {
50
49
  if (t) return "none";
51
50
  if (e.length === 0) return "inset(100%)";
52
51
  let r = e.length === 1 ? e[0] : void 0;
53
- return r ? g(r, n) : u && e.length <= 5 && !e.some((e) => e.radius) ? h(e) : `path('${e.map(f).join("")}')`;
52
+ return r ? h(r, n) : l && e.length <= 5 && !e.some((e) => e.radius) ? m(e) : `path('${e.map(d).join("")}')`;
54
53
  }, _ = (e) => {
55
54
  if (e.length < 2) return null;
56
55
  let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y));
@@ -60,51 +59,51 @@ var n = 1e4, r = 16, i = (e) => {
60
59
  width: Math.max(...e.map((e) => e.x + e.width)) - t,
61
60
  height: Math.max(...e.map((e) => e.y + e.height)) - n
62
61
  };
63
- }, v = (e, t, n) => t >= e.x && t < e.x + e.width && n >= e.y && n < e.y + e.height, y = 16, b = (e, t, n) => t === 1 ? e * y : t === 2 ? e * n : e, ne = (e, t, n) => {
62
+ }, v = (e, t, n) => t >= e.x && t < e.x + e.width && n >= e.y && n < e.y + e.height, te = 16, y = (e, t, n) => t === 1 ? e * te : t === 2 ? e * n : e, ne = (e, t, n) => {
64
63
  let r = getComputedStyle(e);
65
64
  return n !== 0 && /auto|scroll/.test(r.overflowY) && e.scrollHeight > e.clientHeight ? !0 : t !== 0 && /auto|scroll/.test(r.overflowX) && e.scrollWidth > e.clientWidth;
66
- }, x = (e, t, n) => {
65
+ }, re = (e, t, n) => {
67
66
  for (let r = e; r; r = r.parentElement) if (ne(r, t, n)) return r;
68
67
  return document.scrollingElement;
69
- }, S = null, C = null, w = (e) => ({
68
+ }, b = null, x = null, S = (e) => ({
70
69
  width: e.offsetWidth || window.innerWidth,
71
70
  height: e.offsetHeight || window.innerHeight
72
- }), T = (e) => {
73
- if (!C || !S || !v(C, e.clientX, e.clientY)) return;
71
+ }), C = (e) => {
72
+ if (!x || !b || !v(x, e.clientX, e.clientY)) return;
74
73
  let t = document.elementFromPoint(e.clientX, e.clientY);
75
- if (!t || t === S) return;
76
- let n = b(e.deltaX, e.deltaMode, window.innerWidth), r = b(e.deltaY, e.deltaMode, window.innerHeight), i = x(t, n, r);
74
+ if (!t || t === b) return;
75
+ let n = y(e.deltaX, e.deltaMode, window.innerWidth), r = y(e.deltaY, e.deltaMode, window.innerHeight), i = re(t, n, r);
77
76
  i && (i.scrollBy({
78
77
  left: n,
79
78
  top: r,
80
79
  behavior: "instant"
81
80
  }), e.cancelable && e.preventDefault());
82
- }, E = (e) => {
83
- let t = C !== null;
84
- C = e, t !== (e !== null) && (e ? window.addEventListener("wheel", T, {
81
+ }, w = (e) => {
82
+ let t = x !== null;
83
+ x = e, t !== (e !== null) && (e ? window.addEventListener("wheel", C, {
85
84
  capture: !0,
86
85
  passive: !1
87
- }) : window.removeEventListener("wheel", T, { capture: !0 }));
88
- }, D = 0, O = (e) => {
89
- if (e === D) return;
90
- D = e;
86
+ }) : window.removeEventListener("wheel", C, { capture: !0 }));
87
+ }, T = 0, ie = (e) => {
88
+ if (e === T) return;
89
+ T = e;
91
90
  let t = document.documentElement.style;
92
91
  e > 0 ? (t.setProperty("margin-top", `${e}px`, "important"), t.setProperty("--fkn-inset-top", `${e}px`)) : (t.removeProperty("margin-top"), t.removeProperty("--fkn-inset-top"));
93
- }, k = (e, { modal: t, rects: n, inset: r }, i) => {
94
- if (O(r), !l) {
92
+ }, E = (e, { modal: t, rects: n, inset: r }, i) => {
93
+ if (ie(r), !c) {
95
94
  let r = t || n.length > 0;
96
95
  e.style.setProperty("pointer-events", r ? "auto" : "none", "important"), e.style.setProperty("visibility", r ? "visible" : "hidden", "important");
97
96
  return;
98
97
  }
99
- let a = te(n, t, i), o = a === "none" || CSS.supports("clip-path", a) ? a : "inset(100%)";
100
- e.style.setProperty("clip-path", o, "important"), E(t || o !== a ? null : _(n));
101
- }, re = (e) => {
98
+ let a = g(n, t, i), o = a === "none" || CSS.supports("clip-path", a) ? a : "inset(100%)";
99
+ e.style.setProperty("clip-path", o, "important"), w(t || o !== a ? null : _(n));
100
+ }, ae = (e) => {
102
101
  if (typeof e != "object" || !e) return 0;
103
102
  let { top: t } = e;
104
- return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 0 : Math.min(Math.round(t), c);
105
- }, ie = (e) => {
103
+ return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 0 : Math.min(Math.round(t), s);
104
+ }, oe = (e) => {
106
105
  if (!(!Array.isArray(e) || e.length !== 4) && e.every((e) => typeof e == "number" && Number.isFinite(e) && e >= 0)) return e.some((e) => e > 0) ? e : void 0;
107
- }, ae = (e, t) => {
106
+ }, se = (e, t) => {
108
107
  if (typeof e != "object" || !e) return null;
109
108
  let { x: n, y: r, width: i, height: a } = e;
110
109
  if (![
@@ -113,7 +112,7 @@ var n = 1e4, r = 16, i = (e) => {
113
112
  i,
114
113
  a
115
114
  ].every((e) => typeof e == "number" && Number.isFinite(e))) return null;
116
- let o = t.width, s = t.height, c = Math.max(0, Math.min(Math.round(n), o)), l = Math.max(0, Math.min(Math.round(r), s)), u = Math.max(c, Math.min(Math.round(n + i), o)), d = Math.max(l, Math.min(Math.round(r + a), s)), f = ie(e.radius);
115
+ let o = t.width, s = t.height, c = Math.max(0, Math.min(Math.round(n), o)), l = Math.max(0, Math.min(Math.round(r), s)), u = Math.max(c, Math.min(Math.round(n + i), o)), d = Math.max(l, Math.min(Math.round(r + a), s)), f = oe(e.radius);
117
116
  return {
118
117
  x: c,
119
118
  y: l,
@@ -121,49 +120,49 @@ var n = 1e4, r = 16, i = (e) => {
121
120
  height: d - l,
122
121
  ...f ? { radius: f } : {}
123
122
  };
124
- }, A = {
123
+ }, D = {
125
124
  "not-rendered": "this page is not painting it at all, so it or an ancestor is display:none, or the frame was moved out of the layout",
126
125
  clipped: "it is clipped away or positioned outside the viewport",
127
126
  "not-shown": "it is rendered but would not be seen, so either something is drawn over it, or it or an ancestor has opacity below 1, visibility:hidden, or a filter"
128
- }, oe = (e) => Array.isArray(e) ? e.slice(0, s).flatMap((e) => {
127
+ }, ce = (e) => Array.isArray(e) ? e.slice(0, o).flatMap((e) => {
129
128
  if (typeof e != "object" || !e) return [];
130
129
  let { kind: t, cause: n, level: r } = e;
131
- return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in A) || r !== "full" && r !== "liveness" ? [] : [{
130
+ return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in D) || r !== "full" && r !== "liveness" ? [] : [{
132
131
  kind: t,
133
132
  cause: n,
134
133
  level: r
135
134
  }];
136
- }) : [], j = /* @__PURE__ */ new Set(), M = (e) => {
137
- for (let { kind: t, cause: n, level: r } of e) j.has(t) || (j.add(t), console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${A[n]}. Nobody using this page can see or answer it.
135
+ }) : [], O = /* @__PURE__ */ new Set(), le = (e) => {
136
+ for (let { kind: t, cause: n, level: r } of e) O.has(t) || (O.add(t), console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${D[n]}. Nobody using this page can see or answer it.
138
137
  @fkn/lib draws its UI inside <iframe title="FKN"> and sets display, position, top, left, width, height, border, padding, box-sizing, clip-path and z-index on that element. Leave those as they are, then check for an ancestor with opacity, visibility, display or a clipping transform, and for an element stacked above it.` + (r === "liveness" ? "\nThis browser reports limited detail, so the cause above is a best guess." : "")));
139
- }, N = (e, t) => {
138
+ }, k = (e, t) => {
140
139
  if (typeof e != "object" || !e) return null;
141
- let n = e, r = (Array.isArray(n.rects) ? n.rects.slice(0, o) : []).map((e) => ae(e, t)).filter((e) => e !== null && e.width > 0 && e.height > 0);
140
+ let n = e, r = (Array.isArray(n.rects) ? n.rects.slice(0, a) : []).map((e) => se(e, t)).filter((e) => e !== null && e.width > 0 && e.height > 0);
142
141
  return {
143
142
  modal: n.modal === !0,
144
143
  rects: r,
145
- hidden: oe(n.hidden),
146
- inset: re(n.inset)
144
+ hidden: ce(n.hidden),
145
+ inset: ae(n.inset)
147
146
  };
148
- }, P = () => S !== null, F = null, I = null, L = () => {
149
- if (!S || F === null) return;
150
- let e = w(S), t = N(F, e);
151
- t && k(S, t, e);
152
- }, R = (e) => {
153
- typeof ResizeObserver > "u" || (I ??= new ResizeObserver(L), I.disconnect(), I.observe(e));
154
- }, z = (e) => {
155
- d(e), k(e, {
147
+ }, A = () => b !== null, j = null, M = null, N = () => {
148
+ if (!b || j === null) return;
149
+ let e = S(b), t = k(j, e);
150
+ t && E(b, t, e);
151
+ }, P = (e) => {
152
+ typeof ResizeObserver > "u" || (M ??= new ResizeObserver(N), M.disconnect(), M.observe(e));
153
+ }, F = (e) => {
154
+ u(e), E(e, {
156
155
  modal: !1,
157
156
  rects: [],
158
157
  hidden: [],
159
158
  inset: 0
160
- }, w(e)), S = e, R(e);
161
- }, B = (e) => {
162
- if (!S) return;
163
- let t = w(S), n = N(e, t);
164
- n && (F = e, k(S, n, t), M(n.hidden));
165
- }, V = "https://fkn.app", H = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, U = typeof globalThis < "u" && globalThis.crossOriginIsolated === !0, W = `${V}/api${U ? "?coi=1" : ""}`, G = "fkn-api-port", K = "fkn-api-port-ack", se = 2e3, ce = () => {
166
- if (!H || typeof window > "u" || window.parent === window) return Promise.resolve(void 0);
159
+ }, S(e)), b = e, P(e);
160
+ }, I = (e) => {
161
+ if (!b) return;
162
+ let t = S(b), n = k(e, t);
163
+ n && (j = e, E(b, n, t), le(n.hidden));
164
+ }, L = "https://fkn.app", R = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, z = typeof globalThis < "u" && globalThis.crossOriginIsolated === !0, B = `${L}/api${z ? "?coi=1" : ""}`, V = "fkn-api-port", H = "fkn-api-port-ack", U = 2e3, W = () => {
165
+ if (!R || typeof window > "u" || window.parent === window) return Promise.resolve(void 0);
167
166
  let e;
168
167
  try {
169
168
  e = window.parent;
@@ -178,40 +177,40 @@ var n = 1e4, r = 16, i = (e) => {
178
177
  } catch {}
179
178
  n(e);
180
179
  }, i = (e) => {
181
- e.data?.type === K && r(t.port1);
182
- }, a = setTimeout(() => r(void 0), se);
180
+ e.data?.type === H && r(t.port1);
181
+ }, a = setTimeout(() => r(void 0), U);
183
182
  t.port1.addEventListener("message", i), t.port1.start();
184
183
  try {
185
- e.postMessage({ type: G }, V, [t.port2]);
184
+ e.postMessage({ type: V }, L, [t.port2]);
186
185
  } catch {
187
186
  r(void 0);
188
187
  }
189
188
  });
190
- }, q, le = () => {
191
- if (q || !H) return q;
192
- let e = H.querySelector(`iframe[src="${W}"]`);
193
- if (e) q = e;
189
+ }, G, ue = () => {
190
+ if (G || !R) return G;
191
+ let e = R.querySelector(`iframe[src="${B}"]`);
192
+ if (e) G = e;
194
193
  else {
195
- let e = H.createElement("iframe");
196
- U && e.setAttribute("allow", "cross-origin-isolated"), e.src = W, H.body.appendChild(e), q = e;
194
+ let e = R.createElement("iframe");
195
+ z && e.setAttribute("allow", "cross-origin-isolated"), e.src = B, R.body.appendChild(e), G = e;
197
196
  }
198
- return z(q), q;
199
- }, J = (async () => {
200
- if (!H) return;
201
- let e = await ce();
197
+ return F(G), G;
198
+ }, K = (async () => {
199
+ if (!R) return;
200
+ let e = await W();
202
201
  if (e) return {
203
202
  receive: e,
204
203
  emit: e
205
204
  };
206
- let t = le();
205
+ let t = ue();
207
206
  if (!t) return;
208
- await a(t);
207
+ await i(t);
209
208
  let n = t.contentWindow;
210
209
  return n ? {
211
210
  receive: window,
212
211
  emit: n
213
212
  } : void 0;
214
- })(), ue = (e) => {
213
+ })(), de = (e) => {
215
214
  let t, n = () => {}, r = new Promise((e) => {
216
215
  n = e;
217
216
  }), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = 0, s = 0;
@@ -280,30 +279,34 @@ var n = 1e4, r = 16, i = (e) => {
280
279
  lastCall: () => o,
281
280
  inFlight: () => s
282
281
  };
283
- }, de = /* @__PURE__ */ e({
284
- apiPromise: () => Z,
285
- currentApiEpoch: () => $,
286
- hasTransport: () => Y,
287
- onApiEpoch: () => Q
288
- }), Y = typeof window < "u" || typeof self < "u", fe = async () => {
289
- if (typeof window < "u") return J;
282
+ }, fe = typeof window < "u" || typeof self < "u", pe = async () => {
283
+ if (typeof window < "u") return K;
290
284
  if (typeof self < "u") return {
291
285
  receive: self,
292
286
  emit: self
293
287
  };
294
- }, X = ue({ async *[Symbol.asyncIterator]() {
295
- let e = await fe();
296
- if (!e) {
288
+ }, q = de({ async *[Symbol.asyncIterator]() {
289
+ let t = await pe();
290
+ if (!t) {
297
291
  await new Promise(() => {});
298
292
  return;
299
293
  }
300
- yield* t({}, {
294
+ yield* e({}, {
301
295
  key: "fkn-api",
302
- transport: e
296
+ transport: t
303
297
  });
304
- } }), Z = X.first.then(() => X.facade), Q = X.onEpoch, $ = X.current;
305
- X.lastCall, X.inFlight, Q((e) => {
306
- P() && e.overlay.setHost(B, { exactClips: p() }).catch(() => {});
298
+ } }), J = q.first.then(() => q.facade), Y = 8e3, me = 1e3, X = !1, Z = class extends Error {
299
+ constructor(e, t) {
300
+ super(`@fkn/lib: no broker connection within ${t}ms, so ${e} could not be requested`), this.name = "BrokerUnreachableError";
301
+ }
302
+ }, he = (e) => {
303
+ let t = X ? me : Y;
304
+ return Promise.race([J, new Promise((n, r) => setTimeout(() => {
305
+ X = !0, r(new Z(e, t));
306
+ }, t))]);
307
+ }, Q = q.onEpoch, ge = q.current, $ = q.lastCall, _e = q.inFlight;
308
+ Q((e) => {
309
+ A() && e.overlay.setHost(I, { exactClips: f() }).catch(() => {});
307
310
  });
308
311
  //#endregion
309
- export { Q as a, Y as i, de as n, J as o, $ as r, Z as t };
312
+ export { J as a, fe as c, $ as i, Q as l, Z as n, he as o, _e as r, ge as s, Y as t, K as u };
package/api.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./api-BCJO3EWi.cjs");exports.API_DEADLINE_MS=e.t,exports.BrokerUnreachableError=e.n,exports.apiInFlight=e.r,exports.apiLastCall=e.i,exports.apiPromise=e.a,exports.apiWithin=e.o,exports.currentApiEpoch=e.s,exports.hasTransport=e.c,exports.onApiEpoch=e.l;
package/api.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { P as Resolvers } from "./contract-D6ksmIm6.js";
2
+ import { a as apiPromise, c as hasTransport, i as apiLastCall, l as onApiEpoch, n as BrokerUnreachableError, o as apiWithin, r as apiInFlight, s as currentApiEpoch, t as API_DEADLINE_MS } from "./api-CesI0aMl.js";
3
+ export { API_DEADLINE_MS, BrokerUnreachableError, type Resolvers, apiInFlight, apiLastCall, apiPromise, apiWithin, currentApiEpoch, hasTransport, onApiEpoch };
package/api.js ADDED
@@ -0,0 +1,2 @@
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./api-DLvscoll.js";
2
+ export { c as API_DEADLINE_MS, i as BrokerUnreachableError, o as apiInFlight, n as apiLastCall, e as apiPromise, a as apiWithin, s as currentApiEpoch, t as hasTransport, r as onApiEpoch };
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>{let t=[];for(let n of e){let e=n.trim().toLowerCase();!e||e.length>253||/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/.test(e)&&(t.includes(e)||t.push(e))}return t},t=(e,t)=>{if(!e.session)return{kind:`refuse`,reason:`frame.fetch on the cloud backend needs its own session: attach with syncCookies: false`};if(typeof t!=`string`)return{kind:`refuse`,reason:`frame.fetch: url must be a string`};let n;try{n=new URL(t)}catch{return{kind:`refuse`,reason:`frame.fetch on the cloud backend needs an absolute url`}}if(n.protocol!==`https:`&&n.protocol!==`http:`)return{kind:`refuse`,reason:`frame.fetch: only http(s) urls are supported`};if(!(e.declaredHosts.includes(n.hostname)||e.approvedOrigins.has(n.origin)))return{kind:`refuse`,reason:`frame.fetch: the target is outside the origins this attachment declared`};let r=e.declaredHosts.length?e.declaredHosts:[n.hostname];return{kind:`consent`,targetHost:n.hostname,promptHosts:r}};exports.frameFetchVerdict=t,exports.normalizeDeclaredHosts=e;
@@ -0,0 +1,35 @@
1
+ //#region src/attach-policy.d.ts
2
+ /**
3
+ * The pure half of the middle page's frame.fetch gate: everything that can be decided from the
4
+ * attachment's own facts, with no broker and no UI. The middle page enforces this on EVERY fetch
5
+ * call, because any app can drive the 'fkn-attach-frame' channel directly and skip the client
6
+ * library's copy of the same checks.
7
+ *
8
+ * Refusals here must surface under a TERMINAL locator error name (the caller maps them through
9
+ * `locatorDeniedError`), or the shared dispatch loop retries them to its 30 second deadline and
10
+ * reports a timeout that names neither the operation nor the reason.
11
+ */
12
+ type FrameFetchPolicy = {
13
+ /** '' means the shared render-proxy jar; non-empty is an isolated per-attach session */
14
+ session: string;
15
+ /** bare hostnames the app declared at attach; matched on hostname alone, any scheme or port */
16
+ declaredHosts: string[];
17
+ /** exact origins this attachment has legitimately visited: the attach url plus every goto target */
18
+ approvedOrigins: ReadonlySet<string>;
19
+ };
20
+ type FrameFetchVerdict = {
21
+ kind: 'refuse';
22
+ reason: string;
23
+ } | {
24
+ kind: 'consent';
25
+ targetHost: string;
26
+ promptHosts: string[];
27
+ };
28
+ /**
29
+ * Bare hostnames only: lowercase, no scheme, no port, no path. Anything else is dropped rather
30
+ * than repaired, so a malformed declaration narrows the app's reach instead of widening it.
31
+ */
32
+ declare const normalizeDeclaredHosts: (raw: string[]) => string[];
33
+ declare const frameFetchVerdict: (policy: FrameFetchPolicy, url: unknown) => FrameFetchVerdict;
34
+ //#endregion
35
+ export { FrameFetchPolicy, FrameFetchVerdict, frameFetchVerdict, normalizeDeclaredHosts };
@@ -0,0 +1,43 @@
1
+ //#region src/attach-policy.ts
2
+ var e = (e) => {
3
+ let t = [];
4
+ for (let n of e) {
5
+ let e = n.trim().toLowerCase();
6
+ !e || e.length > 253 || /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/.test(e) && (t.includes(e) || t.push(e));
7
+ }
8
+ return t;
9
+ }, t = (e, t) => {
10
+ if (!e.session) return {
11
+ kind: "refuse",
12
+ reason: "frame.fetch on the cloud backend needs its own session: attach with syncCookies: false"
13
+ };
14
+ if (typeof t != "string") return {
15
+ kind: "refuse",
16
+ reason: "frame.fetch: url must be a string"
17
+ };
18
+ let n;
19
+ try {
20
+ n = new URL(t);
21
+ } catch {
22
+ return {
23
+ kind: "refuse",
24
+ reason: "frame.fetch on the cloud backend needs an absolute url"
25
+ };
26
+ }
27
+ if (n.protocol !== "https:" && n.protocol !== "http:") return {
28
+ kind: "refuse",
29
+ reason: "frame.fetch: only http(s) urls are supported"
30
+ };
31
+ if (!(e.declaredHosts.includes(n.hostname) || e.approvedOrigins.has(n.origin))) return {
32
+ kind: "refuse",
33
+ reason: "frame.fetch: the target is outside the origins this attachment declared"
34
+ };
35
+ let r = e.declaredHosts.length ? e.declaredHosts : [n.hostname];
36
+ return {
37
+ kind: "consent",
38
+ targetHost: n.hostname,
39
+ promptHosts: r
40
+ };
41
+ };
42
+ //#endregion
43
+ export { t as frameFetchVerdict, e as normalizeDeclaredHosts };
@@ -1,4 +1,4 @@
1
- //#region src/lib/busy.ts
1
+ //#region src/busy.ts
2
2
  var e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), n = (t) => {
3
3
  e.set(t, (e.get(t) ?? 0) + 1);
4
4
  let n = !1;
package/cloud/dgram.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../dgram-BLN-mfgq.cjs");exports.Socket=e.t,exports.createSocket=e.n,exports.default=e.r;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../dgram.cjs");exports.Socket=e.Socket,exports.createSocket=e.createSocket,exports.default=e.default;
package/cloud/dgram.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, r as t, t as n } from "../dgram-DHQcHefn.js";
2
- export { n as Socket, e as createSocket, t as default };
1
+ import e, { Socket as t, createSocket as n } from "../dgram.js";
2
+ export { t as Socket, n as createSocket, e as default };
package/cloud/dns.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { t as AddressLookupResult } from "../lookup-BtwWaCZJ.js";
1
+ import { n as AddressLookupResult } from "../contract-D6ksmIm6.js";
2
2
  import { lookup } from "../dns.js";
3
3
  export { type AddressLookupResult, lookup };
package/cloud/fetch.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../proxy-BNdvRifw.cjs");exports.fetch=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../proxy-CefKCs-i.cjs");exports.fetch=e.t;
package/cloud/fetch.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { t as cloudFetch } from "../proxy-DmMu2_1z.js";
1
+ import { t as cloudFetch } from "../proxy-BubvP9sg.js";
2
2
  export { cloudFetch as fetch };
package/cloud/fetch.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "../proxy-CRbkWS4E.js";
1
+ import { t as e } from "../proxy-KUfE4cEQ.js";
2
2
  export { e as fetch };
@@ -1,9 +1,10 @@
1
- import { a as Stats, i as ReadOptions, o as WriteData, r as MakeOptions, s as WriteOptions } from "../../index-CJ0vHTcS.js";
2
- //#region src/lib/cloud/fs-promises.d.ts
1
+ import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions } from "../../index-BQgZVQl7.js";
2
+ import "../../fs-DlGE0ZNu.js";
3
+ //#region src/cloud/fs-promises.d.ts
3
4
  declare const readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>, writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>, unlink: (path: import("node:fs").PathLike) => Promise<void>, rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => Promise<void>, readdir: (path: import("node:fs").PathLike) => Promise<string[]>, mkdir: (_path?: import("node:fs").PathLike, _options?: MakeOptions) => Promise<void>, rm: (path: import("node:fs").PathLike, options?: {
4
- recursive?: boolean;
5
- }) => Promise<void>, rmdir: (path: import("node:fs").PathLike, options?: {
6
- recursive?: boolean;
7
- }) => Promise<void>, stat: (path: import("node:fs").PathLike) => Promise<Stats>, lstat: (path: import("node:fs").PathLike) => Promise<Stats>, access: (path: import("node:fs").PathLike) => Promise<void>;
5
+ recursive?: boolean;
6
+ }) => Promise<void>, rmdir: (path: import("node:fs").PathLike, options?: {
7
+ recursive?: boolean;
8
+ }) => Promise<void>, stat: (path: import("node:fs").PathLike) => Promise<Stats>, lstat: (path: import("node:fs").PathLike) => Promise<Stats>, access: (path: import("node:fs").PathLike) => Promise<void>;
8
9
  //#endregion
9
10
  export { access, lstat, mkdir, readFile, readdir, rename, rm, rmdir, stat, unlink, writeFile };
@@ -1,5 +1,5 @@
1
1
  import { promises as e } from "../fs.js";
2
- //#region src/lib/cloud/fs-promises.ts
2
+ //#region src/cloud/fs-promises.ts
3
3
  var { readFile: t, writeFile: n, unlink: r, rename: i, readdir: a, mkdir: o, rm: s, rmdir: c, stat: l, lstat: u, access: d } = e;
4
4
  //#endregion
5
5
  export { d as access, u as lstat, o as mkdir, t as readFile, a as readdir, i as rename, s as rm, c as rmdir, l as stat, r as unlink, n as writeFile };
package/cloud/fs.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BIInC43l.cjs"),t=require("../node-fs-DZPGCYWg.cjs"),n=require("../storage-xAeRQQiz.cjs");var r=e.t({STORAGE_NOT_FOUND:()=>n.p,StorageLockedError:()=>n.t,StorageNotFoundError:()=>n.n,available:()=>i,encryption:()=>n.i,isNotFound:()=>n.a,mkdir:()=>u,promises:()=>p,quota:()=>n.s,readFile:()=>a,readdir:()=>l,rename:()=>c,rm:()=>d,stat:()=>f,unlink:()=>s,unlock:()=>n.d,writeFile:()=>o}),{available:i,readFile:a,writeFile:o,unlink:s,rename:c,readdir:l,mkdir:u,rm:d,stat:f,promises:p}=t.t(n.u,{memfs:!1});exports.STORAGE_NOT_FOUND=n.p,exports.StorageLockedError=n.t,exports.StorageNotFoundError=n.n,exports.available=i,exports.encryption=n.i,exports.isNotFound=n.a,exports.mkdir=u,exports.promises=p,exports.quota=n.s,exports.readFile=a,exports.readdir=l,exports.rename=c,exports.rm=d,exports.stat=f,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}}),exports.unlink=s,exports.unlock=n.d,exports.writeFile=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BIInC43l.cjs"),t=require("../node-fs-DZPGCYWg.cjs"),n=require("../messages.cjs"),r=require("../storage-DLB4ciMf.cjs");var i=e.t({STORAGE_NOT_FOUND:()=>n.STORAGE_NOT_FOUND,StorageLockedError:()=>r.t,StorageNotFoundError:()=>r.n,available:()=>a,encryption:()=>r.i,isNotFound:()=>r.a,mkdir:()=>d,promises:()=>m,quota:()=>r.s,readFile:()=>o,readdir:()=>u,rename:()=>l,rm:()=>f,stat:()=>p,unlink:()=>c,unlock:()=>r.d,writeFile:()=>s}),{available:a,readFile:o,writeFile:s,unlink:c,rename:l,readdir:u,mkdir:d,rm:f,stat:p,promises:m}=t.t(r.u,{memfs:!1});exports.STORAGE_NOT_FOUND=n.STORAGE_NOT_FOUND,exports.StorageLockedError=r.t,exports.StorageNotFoundError=r.n,exports.available=a,exports.encryption=r.i,exports.isNotFound=r.a,exports.mkdir=d,exports.promises=m,exports.quota=r.s,exports.readFile=o,exports.readdir=u,exports.rename=l,exports.rm=f,exports.stat=p,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),exports.unlink=c,exports.unlock=r.d,exports.writeFile=s;
package/cloud/fs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as STORAGE_NOT_FOUND } from "../storage-qxXFLgTM.js";
2
- import { a as Stats } from "../index-CJ0vHTcS.js";
3
- import { _ as encryption, a as readFile, b as unlock, c as rm, d as writeFile, f as EncryptionStatus, g as StorageQuota, h as StorageNotFoundError, i as promises, l as stat, m as StorageLockedError, o as readdir, p as FileEntry, r as mkdir, s as rename, t as available, u as unlink, v as isNotFound, y as quota } from "../fs-CUmugp10.js";
1
+ import { i as Stats } from "../index-BQgZVQl7.js";
2
+ import { _ as encryption, a as readFile, b as unlock, c as rm, d as writeFile, f as EncryptionStatus, g as StorageQuota, h as StorageNotFoundError, i as promises, l as stat, m as StorageLockedError, o as readdir, p as FileEntry, r as mkdir, s as rename, t as available, u as unlink, v as isNotFound, y as quota } from "../fs-DlGE0ZNu.js";
3
+ import { i as STORAGE_NOT_FOUND } from "../messages-DvpKMTsY.js";
4
4
  export { type EncryptionStatus, type FileEntry, STORAGE_NOT_FOUND, type Stats, StorageLockedError, StorageNotFoundError, type StorageQuota, available, encryption, isNotFound, mkdir, promises, quota, readFile, readdir, rename, rm, stat, unlink, unlock, writeFile };
package/cloud/fs.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import { t as e } from "../rolldown-runtime-Dy4uBu1J.js";
2
- import { t } from "../node-fs-BZCQUmeE.js";
3
- import { a as n, d as r, i, n as a, p as o, s, t as c, u as l } from "../storage-BNjLc1FV.js";
4
- //#region src/lib/cloud/fs.ts
2
+ import { t } from "../node-fs-C9ECR_9H.js";
3
+ import { STORAGE_NOT_FOUND as n } from "../messages.js";
4
+ import { a as r, d as i, i as a, n as o, s, t as c, u as l } from "../storage-BjGr_vC4.js";
5
+ //#region src/cloud/fs.ts
5
6
  var u = /* @__PURE__ */ e({
6
- STORAGE_NOT_FOUND: () => o,
7
+ STORAGE_NOT_FOUND: () => n,
7
8
  StorageLockedError: () => c,
8
- StorageNotFoundError: () => a,
9
+ StorageNotFoundError: () => o,
9
10
  available: () => d,
10
- encryption: () => i,
11
- isNotFound: () => n,
11
+ encryption: () => a,
12
+ isNotFound: () => r,
12
13
  mkdir: () => _,
13
14
  promises: () => b,
14
15
  quota: () => s,
@@ -18,8 +19,8 @@ var u = /* @__PURE__ */ e({
18
19
  rm: () => v,
19
20
  stat: () => y,
20
21
  unlink: () => m,
21
- unlock: () => r,
22
+ unlock: () => i,
22
23
  writeFile: () => p
23
24
  }), { available: d, readFile: f, writeFile: p, unlink: m, rename: h, readdir: g, mkdir: _, rm: v, stat: y, promises: b } = t(l, { memfs: !1 });
24
25
  //#endregion
25
- export { o as STORAGE_NOT_FOUND, c as StorageLockedError, a as StorageNotFoundError, d as available, i as encryption, n as isNotFound, _ as mkdir, b as promises, s as quota, f as readFile, g as readdir, h as rename, v as rm, y as stat, u as t, m as unlink, r as unlock, p as writeFile };
26
+ export { n as STORAGE_NOT_FOUND, c as StorageLockedError, o as StorageNotFoundError, d as available, a as encryption, r as isNotFound, _ as mkdir, b as promises, s as quota, f as readFile, g as readdir, h as rename, v as rm, y as stat, u as t, m as unlink, i as unlock, p as writeFile };
package/cloud/net.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../utils-QfNXtEhb.cjs"),t=require("../net-B6RHtWwe.cjs");exports.Server=t.t,exports.Socket=t.n,exports._default=t.r,exports.default=t.r,exports.connect=t.i,exports.createConnection=t.a,exports.createServer=t.o,exports.isIP=e.r,exports.isIPv4=e.i,exports.isIPv6=e.a;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../utils-BvgGdrgN.cjs"),t=require("../net.cjs");exports.Server=t.Server,exports.Socket=t.Socket,exports._default=t._default,exports.default=t._default,exports.connect=t.connect,exports.createConnection=t.createConnection,exports.createServer=t.createServer,exports.isIP=e.r,exports.isIPv4=e.i,exports.isIPv6=e.a;
package/cloud/net.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "../net-DaWv81tQ.js";
1
+ import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "../net-DAOcF3Eb.js";
2
2
  export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
package/cloud/net.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as e, i as t, r as n } from "../utils-DVlbuXmW.js";
2
- import { a as r, i, n as a, o, r as s, t as c } from "../net-yBkobZqK.js";
3
- export { c as Server, a as Socket, s as _default, s as default, i as connect, r as createConnection, o as createServer, n as isIP, t as isIPv4, e as isIPv6 };
1
+ import { a as e, i as t, r as n } from "../utils-C-cAd4r4.js";
2
+ import { Server as r, Socket as i, _default as a, connect as o, createConnection as s, createServer as c } from "../net.js";
3
+ export { r as Server, i as Socket, a as _default, a as default, o as connect, s as createConnection, c as createServer, n as isIP, t as isIPv4, e as isIPv6 };
@@ -0,0 +1 @@
1
+ const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-DLM2M3_i.cjs"),n=require("./api-BCJO3EWi.cjs"),r=require("./busy-Dv8wzE5M.cjs"),i=require("./proxy-CefKCs-i.cjs"),a=require("./attach-policy.cjs"),o=require("./dns.cjs"),s=require("./cloud/fs.cjs"),c=require("./net.cjs"),l=require("./dgram.cjs"),u=require("./http.cjs");let d=require("osra");var f={scope:`frame.fetchRead`,category:`network`,severity:3,unsafe:!0,title:`Read your account data on this site`,description:`Lets the app read pages and data from this site as you, using the session in the frame.`},p={scope:`frame.fetchWrite`,category:`network`,severity:3,unsafe:!0,title:`Change your account data on this site`,description:`Lets the app send changes to this site as you, using the session in the frame.`},m=new Set([`GET`,`HEAD`,`OPTIONS`]),h=(e,t)=>m.has((t?.method??`GET`).toUpperCase())?f:p,g=e=>e,_=`autoplay; fullscreen; encrypted-media; picture-in-picture; clipboard-read; clipboard-write`,v=2e4,y=65e3,b=3e4,x=5e3,S=new Set([]),C=()=>`https://fkn.app`,w=e=>!e||e===`about:blank`,T=e=>e?``:`incognito-${crypto.randomUUID()}`,E=({target:e,session:t,domains:n})=>{let r=new URL(`/attach-frame`,C());return e&&r.searchParams.set(`url`,e),t&&r.searchParams.set(`session`,t),n.length&&r.searchParams.set(`domains`,n.join(`,`)),r.href},D=(e,t,n)=>{let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(Error(n)),t)});return Promise.race([e,i]).finally(()=>clearTimeout(r))},O=(e,t)=>{let n=()=>{a(),t()},r=e.parentNode,i=new MutationObserver(()=>{(!e.isConnected||e.parentNode!==r)&&(a(),t())}),a=()=>{window.removeEventListener(`pagehide`,n),i.disconnect()};window.addEventListener(`pagehide`,n,{once:!0}),r&&i.observe(r,{childList:!0}),e.isConnected||(a(),t())},k=()=>Object.assign(Error(`cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe`),{name:t.u}),A=(e,t)=>{let n=[...e.split(`;`),...t.split(`;`)].map(e=>e.trim()).filter(Boolean);return[...new Set(n)].join(`; `)},j=[300,1200,4e3],M=e=>{let t=()=>{if(!e.isConnected)return;let t=e.style.height,n=e.getBoundingClientRect();n.height&&(e.style.height=`${n.height-1}px`,setTimeout(()=>{e.style.height=t},50))};t();for(let e of j)setTimeout(t,e)},N=e=>{let t=e.getAttribute(`sandbox`);if(t===null)return;let n=new Set(t.toLowerCase().split(/\s+/).filter(Boolean)),r=[`allow-scripts`,`allow-same-origin`].filter(e=>!n.has(e));if(r.length)throw Error(`cloud.attachFrame: the iframe's sandbox attribute must include ${r.join(` and `)} for the render proxy to load`)},P=async({iframe:e,domains:i=[],syncCookies:o=!0,lockdown:s=!1})=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);if(s)throw Error(`cloud.attachFrame does not support lockdown; use the extension backend for a sealed frame`);if(!e.isConnected)throw Error(`cloud.attachFrame: the iframe must be connected to the document before attaching`);N(e);let c=e.getAttribute(`src`)??``,l=(()=>{if(w(c))return null;try{return new URL(e.src||c,location.href)}catch{throw Error(`cloud.attachFrame: the iframe src is not a valid URL: ${c}`)}})();if(l){let e=new URL(`/attach-frame`,C());if(l.origin===e.origin&&l.pathname===e.pathname)throw Error(`cloud.attachFrame: this iframe is already attached; navigate with the Frame returned by that attach or use a fresh iframe`)}let u=l?.href??``;u&&t.s(u);let f=u,p=T(o),m=a.normalizeDeclaredHosts(i),j=new Set;try{j.add(new URL(u).origin)}catch{}let P=new AbortController,F=e.referrerPolicy,I=e.allow;if(e.referrerPolicy=`origin`,e.allow=A(_,e.allow),e.src=E({target:u,session:p,domains:m}),!e.contentWindow)throw Error(`cloud.attachFrame: the iframe window is not available`);try{let i=await D((0,d.expose)({},{key:`fkn-attach-frame`,origin:C(),transport:{receive:window,emit:e.contentWindow},unregisterSignal:P.signal,revivableModules:g(t.W)}),v,`cloud.attachFrame: timed out connecting to the render proxy page`);await D(i.ready(),y,`cloud.attachFrame: the render proxy never became ready`),u&&M(e),O(e,()=>P.abort());let o=r.t(`attached frame`);P.signal.aborted?o():P.signal.addEventListener(`abort`,o,{once:!0});let s=e.contentWindow,c=()=>{if(!(!P.signal.aborted&&e.isConnected&&e.contentWindow===s))throw P.abort(),k()};return t.a({executor:{execute:(e,n,r)=>S.has(n)?Promise.reject(t.d(n,`cloud`)):(c(),i.executeLocator(e,n,r)),highlight:async()=>{}},gate:async e=>{if(e.operation!==`fetch`)return;let r=a.frameFetchVerdict({session:p,declaredHosts:m,approvedOrigins:j},e.args[0]);if(r.kind===`refuse`)throw t.m(r.reason,`fetch`);if(!await(await n.a).frameConsent.ensure({scope:h(e.args[0],e.args[1]).scope,hosts:r.promptHosts}))throw t.m(`frame.fetch: the user did not grant this`,`fetch`)},goto:async(t,n={})=>{let r=new URL(t,location.href).href;c();let{timeoutMs:a}=n;await D(i.goto(r,n),(a??b)+x,`cloud.attachFrame: the render proxy did not answer goto; the frame may have been detached or its page reloaded`),f=r;try{j.add(new URL(r).origin)}catch{}M(e)},url:()=>f})}catch(t){throw P.abort(),e.referrerPolicy=F,e.allow=I,e.src=u||`about:blank`,t}},F=()=>typeof window<`u`&&!0,I=async()=>{let e=await n.a.then(e=>e.cloud.quota());return{premium:e.premium,overQuota:e.overQuota,throttled:e.overQuota&&!e.premium,usedBytes:e.usedBytes,limitBytes:e.limitBytes,remainingBytes:e.remaining,bytesPerSecond:e.bytesPerSecond,bitsPerSecond:e.bytesPerSecond*8}},L=e.t({attachFrame:()=>P,available:()=>R,dgram:()=>l.t,dns:()=>o.t,fetch:()=>i.t,fs:()=>s.t,http:()=>u.t,net:()=>c.t,quota:()=>I}),R=()=>n.c;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return R}});