@fkn/lib 0.9.63 → 0.9.65
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.
- package/README.md +34 -0
- package/account-Bm7uIcQo.d.ts +39 -0
- package/account-Uh0-1Cbp.js +22 -0
- package/{account-generation-B0cJrpDx.cjs → account-generation-ACCBzaI-.cjs} +1 -1
- package/{account-generation-u31dhamM.js → account-generation-BKHNe-jL.js} +2 -3
- package/account-m2iCmNui.cjs +1 -0
- package/{account-storage-ZkzqZp3A.js → account-storage-BmCVutNL.js} +4 -5
- package/{account-storage-Co9IvkPr.d.ts → account-storage-UmSfF63A.d.ts} +1 -66
- package/{account-storage-BnohkyMJ.cjs → account-storage-dYWDpqsr.cjs} +1 -1
- package/account.cjs +1 -1
- package/account.d.ts +3 -40
- package/account.js +1 -23
- package/{api-xh6lzApn.d.ts → api-0Yp9uZcV.d.ts} +3 -7
- package/{api-Di2Ff3jS.js → api-DRglK7ft.js} +115 -156
- package/api-DrvhPN56.cjs +3 -0
- package/api.cjs +1 -1
- package/api.d.ts +2 -2
- package/api.js +1 -2
- package/attach-policy.d.ts +0 -4
- package/attach-policy.js +2 -3
- package/broker-frame-CF4-yXtj.cjs +9 -0
- package/broker-frame-vjSpBa8d.js +51 -0
- package/broker-frame.cjs +1 -0
- package/broker-frame.d.ts +12 -0
- package/broker-frame.js +1 -0
- package/{busy-DsMWrSzc.js → busy-C1JPjoZ_.js} +1 -2
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.d.ts +1 -1
- package/cloud/dgram.js +1 -2
- package/cloud/dns.cjs +1 -1
- package/cloud/dns.d.ts +2 -2
- package/cloud/dns.js +1 -2
- package/cloud/fetch.cjs +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fetch.js +1 -2
- package/cloud/fs/promises.cjs +1 -1
- package/cloud/fs/promises.d.ts +3 -5
- package/cloud/fs/promises.js +2 -3
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +4 -4
- package/cloud/fs.js +4 -34
- package/cloud/http.cjs +1 -1
- package/cloud/http.d.ts +1 -1
- package/cloud/http.js +1 -2
- package/cloud/net.cjs +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud/net.js +3 -3
- package/{cloud-CI7FFRMC.d.ts → cloud-BoH54gaM.d.ts} +7 -11
- package/{cloud-C6rG_aod.js → cloud-C7StNncS.js} +17 -17
- package/cloud-TN0eDUy3.cjs +1 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +7 -7
- package/cloud.js +7 -7
- package/connect-button-2FmOM8ai.d.ts +2 -0
- package/{connect-button-DtsN3X1J.js → connect-button-C1wKkIhh.js} +1 -2
- package/{contract-BGMJVvTg.d.ts → contract-0rua6Wsh.d.ts} +11 -6
- package/contract.d.ts +3 -3
- package/contract.js +1 -2
- package/desktop-DOubT4ES.d.ts +57 -0
- package/desktop-vXKU4wEK.cjs +1 -0
- package/desktop-xTT7ciGX.js +50 -0
- package/desktop.cjs +1 -1
- package/desktop.d.ts +2 -58
- package/desktop.js +1 -51
- package/dgram-BBbLokVF.js +397 -0
- package/dgram-BYk-QDHW.d.ts +118 -0
- package/dgram-D9ljiUFh.cjs +1 -0
- package/dgram.cjs +1 -1
- package/dgram.d.ts +2 -119
- package/dgram.js +1 -410
- package/dns-2v96zoEh.cjs +1 -0
- package/dns-DyB4K2oE.d.ts +9 -0
- package/dns-o8DLFjP1.js +5 -0
- package/dns.cjs +1 -1
- package/dns.d.ts +3 -10
- package/dns.js +1 -6
- package/extension-BXBjpypy.cjs +1 -0
- package/{extension-C3_aJX7C.js → extension-D5UMnEmQ.js} +11 -12
- package/{extension-C1bcizcn.d.ts → extension-D98KM8W7.d.ts} +1 -27
- package/extension.cjs +1 -1
- package/extension.d.ts +2 -2
- package/extension.js +2 -2
- package/fs/promises.cjs +1 -1
- package/fs/promises.d.ts +2 -4
- package/fs/promises.js +2 -3
- package/fs--MLHvMW-.cjs +1 -0
- package/fs-BX_ghRy0.cjs +1 -0
- package/fs-BnWXGRik.js +33 -0
- package/{fs-DCJAYoYy.d.ts → fs-ChOYC6VD.d.ts} +3 -4
- package/{fs-DgdN2HPt.js → fs-Cw7CcUhx.js} +17 -41
- package/fs.cjs +1 -1
- package/fs.d.ts +4 -4
- package/fs.js +2 -2
- package/{hosts-t7CKGTRz.js → hosts-HUfgMimI.js} +1 -2
- package/http-BE3UBktN.cjs +9 -0
- package/http-CDhG4bUc.d.ts +187 -0
- package/http-DIDjdm08.js +523 -0
- package/http.cjs +1 -9
- package/http.d.ts +2 -188
- package/http.js +1 -542
- package/index-CUWTpQKP.d.ts +87 -0
- package/{index-BQgZVQl7.d.ts → index-CcVwh9yz.d.ts} +0 -2
- package/{index-C5DdoMGo.d.ts → index-Cu5EcdK0.d.ts} +0 -59
- package/{index-57lTXnoe.d.ts → index-D6GPJ4Ow.d.ts} +29 -26
- package/index.cjs +1 -1
- package/index.d.ts +17 -25
- package/index.js +22 -27
- package/lib-Bs-g5jyp.cjs +53 -0
- package/{lib-BrsqpUkv.js → lib-CtJaID_y.js} +7 -31
- package/{messages-AdPfdoLV.d.ts → messages-B9dOXntM.d.ts} +0 -2
- package/messages.d.ts +1 -1
- package/messages.js +1 -2
- package/net-COkJw8lV.js +286 -0
- package/net-Dk2kqtgE.cjs +1 -0
- package/{net-BpyIeQ8r.d.ts → net-mVAYXs8e.d.ts} +5 -7
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +3 -323
- package/{node-fs-DY2fO5zd.js → node-fs-B4pY08Kc.js} +3 -10
- package/node-fs-DN0ejGTL.cjs +1 -0
- package/opfs/promises.cjs +1 -1
- package/opfs/promises.d.ts +2 -4
- package/opfs/promises.js +2 -3
- package/{opfs-D0goLAQW.js → opfs-CzCfVam3.js} +2 -3
- package/opfs-D3pYzYRc.js +35 -0
- package/opfs-DuXvTgIl.cjs +1 -0
- package/opfs.cjs +1 -1
- package/opfs.d.ts +3 -88
- package/opfs.js +1 -36
- package/package.json +6 -1
- package/packages-BEadIy_h.d.ts +155 -0
- package/packages-Cws_rcgf.js +346 -0
- package/packages-DT8vPB5_.cjs +1 -0
- package/packages.cjs +1 -1
- package/packages.d.ts +3 -156
- package/packages.js +1 -347
- package/{proxy-tsVhjcl-.js → proxy-BBAQxJmP.js} +13 -13
- package/{proxy-Dz60YyYy.d.ts → proxy-BP40IXYD.d.ts} +2 -4
- package/proxy-DVgGp6A8.cjs +1 -0
- package/react.cjs +1 -1
- package/react.d.ts +16 -4
- package/react.js +96 -7
- package/{relay-choice-BGwXRC5d.js → relay-choice-Bb3oP2gw.js} +1 -2
- package/{relay-choice-5yUPI-tJ.d.ts → relay-choice-DOUttUnL.d.ts} +2 -4
- package/{rolldown-runtime-Dy4uBu1J.js → rolldown-runtime-CGnMp29N.js} +1 -2
- package/rooms-C6mbannC.d.ts +227 -0
- package/rooms-DHFS9cwA.cjs +1 -0
- package/rooms-DP5stTEr.js +300 -0
- package/rooms.cjs +1 -1
- package/rooms.d.ts +3 -228
- package/rooms.js +1 -301
- package/storage-BCjYihUO.cjs +1 -0
- package/storage-BhfImh_2.js +136 -0
- package/storage-DpCLksAa.d.ts +68 -0
- package/storage.cjs +1 -1
- package/storage.d.ts +3 -69
- package/storage.js +1 -137
- package/{utils-Cyq8uJiy.js → utils-DtWP-E9x.js} +1 -2
- package/{wire-Fk5pJaoy.d.ts → wire-DhmLnYEU.d.ts} +0 -2
- package/wire.d.ts +1 -1
- package/wire.js +1 -2
- package/api-BSk3dc_X.cjs +0 -3
- package/cloud-BoiHKoRZ.cjs +0 -1
- package/connect-button-Cp0NS95-.d.ts +0 -4
- package/extension-Crv4aUAm.cjs +0 -1
- package/fs-CjQTj3FA.cjs +0 -1
- package/lib-C_X3WR4G.cjs +0 -53
- package/node-fs-vsWuoMGa.cjs +0 -1
- package/proxy-BA92hkId.cjs +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { i as e, n as t } from "./broker-frame-vjSpBa8d.js";
|
|
2
|
+
import { checkOsraMessageKey as n, expose as r } from "osra";
|
|
3
|
+
// src/frame-ready.ts
|
|
4
|
+
var i = 1e4, a = 16, o = (e) => {
|
|
4
5
|
let t;
|
|
5
6
|
try {
|
|
6
7
|
t = e.contentWindow;
|
|
@@ -14,58 +15,58 @@ var n = 1e4, r = 16, i = (e) => {
|
|
|
14
15
|
} catch {
|
|
15
16
|
return !0;
|
|
16
17
|
}
|
|
17
|
-
},
|
|
18
|
-
if (
|
|
19
|
-
let
|
|
20
|
-
clearInterval(
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
e.addEventListener("load",
|
|
25
|
-
}),
|
|
26
|
-
let
|
|
27
|
-
clearTimeout(
|
|
18
|
+
}, s = (e, t = i) => new Promise((n) => {
|
|
19
|
+
if (o(e)) return n();
|
|
20
|
+
let r = () => {
|
|
21
|
+
clearInterval(i), clearTimeout(s), e.removeEventListener("load", r), n();
|
|
22
|
+
}, i = setInterval(() => {
|
|
23
|
+
o(e) && r();
|
|
24
|
+
}, a), s = setTimeout(r, t);
|
|
25
|
+
e.addEventListener("load", r);
|
|
26
|
+
}), c = 5e3, l = 9e4, u = (e, t, n) => {
|
|
27
|
+
let r = 1, a, s = e.ownerDocument.defaultView, u = () => {
|
|
28
|
+
clearTimeout(a), s?.removeEventListener("message", m), e.removeEventListener("load", p);
|
|
28
29
|
}, d = () => {
|
|
29
30
|
if (e.isConnected) {
|
|
30
|
-
if (
|
|
31
|
-
|
|
31
|
+
if (r >= 4) return u(), console.error(`FKN @fkn/lib: ${t} did not load in ${r} tries; reload the page`);
|
|
32
|
+
r += 1, e.contentWindow?.location.replace(t), f(l);
|
|
32
33
|
}
|
|
33
34
|
}, f = (e) => {
|
|
34
|
-
clearTimeout(
|
|
35
|
-
}, p = () => f(
|
|
36
|
-
t.source === e.contentWindow && t.origin ===
|
|
35
|
+
clearTimeout(a), a = setTimeout(d, e);
|
|
36
|
+
}, p = () => f(c), m = (t) => {
|
|
37
|
+
t.source === e.contentWindow && t.origin === n && u();
|
|
37
38
|
};
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
},
|
|
39
|
+
if (s?.addEventListener("message", m), e.addEventListener("load", p), o(e)) return f(c);
|
|
40
|
+
a = setTimeout(() => o(e) ? f(8e4) : d(), i);
|
|
41
|
+
}, d = 32, f = 8, p = 120, m = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0H1V1H0Z')"), h = typeof CSS < "u" && CSS.supports("clip-path", "polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)"), g = "light dark", ee = (e) => {
|
|
41
42
|
let t = e.style;
|
|
42
|
-
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",
|
|
43
|
-
},
|
|
43
|
+
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", g), t.setProperty("z-index", "2147483647"), e.setAttribute("title", "FKN");
|
|
44
|
+
}, te = ({ x: e, y: t, width: n, height: r, radius: i }) => {
|
|
44
45
|
if (!i) return `M${e} ${t}h${n}v${r}h${-n}Z`;
|
|
45
46
|
let a = Math.min(n, r) / 2, [o, s, c, l] = i.map((e) => Math.max(0, Math.min(e, a)));
|
|
46
47
|
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`;
|
|
47
|
-
},
|
|
48
|
+
}, ne = () => m && h, _ = ({ x: e, y: t, width: n, height: r }) => [
|
|
48
49
|
[e, t],
|
|
49
50
|
[e + n, t],
|
|
50
51
|
[e + n, t + r],
|
|
51
52
|
[e, t + r],
|
|
52
53
|
[e, t]
|
|
53
|
-
],
|
|
54
|
+
], re = (e) => {
|
|
54
55
|
let t = e[0];
|
|
55
56
|
if (!t) return [];
|
|
56
57
|
let n = _(t)[0], r = [];
|
|
57
58
|
return e.forEach((t, i) => {
|
|
58
59
|
r.push(..._(t)), i > 0 && i < e.length - 1 && r.push(n);
|
|
59
60
|
}), r;
|
|
60
|
-
},
|
|
61
|
+
}, ie = (e) => `polygon(nonzero, ${re(e).map(([e, t]) => `${e}px ${t}px`).join(", ")})`, ae = ({ x: e, y: t, width: n, height: r, radius: i }, a) => {
|
|
61
62
|
let o = `${t}px ${a.width - e - n}px ${a.height - t - r}px ${e}px`;
|
|
62
63
|
return i ? `inset(${o} round ${i.map((e) => `${e}px`).join(" ")})` : `inset(${o})`;
|
|
63
|
-
},
|
|
64
|
+
}, oe = (e, t, n) => {
|
|
64
65
|
if (t) return "none";
|
|
65
66
|
if (e.length === 0) return "inset(100%)";
|
|
66
67
|
let r = e.length === 1 ? e[0] : void 0;
|
|
67
|
-
return r ?
|
|
68
|
-
},
|
|
68
|
+
return r ? ae(r, n) : h && e.length <= 5 && !e.some((e) => e.radius) ? ie(e) : `path('${e.map(te).join("")}')`;
|
|
69
|
+
}, se = (e) => {
|
|
69
70
|
if (e.length < 2) return null;
|
|
70
71
|
let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y));
|
|
71
72
|
return {
|
|
@@ -74,51 +75,51 @@ var n = 1e4, r = 16, i = (e) => {
|
|
|
74
75
|
width: Math.max(...e.map((e) => e.x + e.width)) - t,
|
|
75
76
|
height: Math.max(...e.map((e) => e.y + e.height)) - n
|
|
76
77
|
};
|
|
77
|
-
},
|
|
78
|
+
}, ce = (e, t, n) => t >= e.x && t < e.x + e.width && n >= e.y && n < e.y + e.height, le = 16, v = (e, t, n) => t === 1 ? e * le : t === 2 ? e * n : e, ue = (e, t, n) => {
|
|
78
79
|
let r = getComputedStyle(e);
|
|
79
80
|
return n !== 0 && /auto|scroll/.test(r.overflowY) && e.scrollHeight > e.clientHeight ? !0 : t !== 0 && /auto|scroll/.test(r.overflowX) && e.scrollWidth > e.clientWidth;
|
|
80
|
-
},
|
|
81
|
-
for (let r = e; r; r = r.parentElement) if (
|
|
81
|
+
}, de = (e, t, n) => {
|
|
82
|
+
for (let r = e; r; r = r.parentElement) if (ue(r, t, n)) return r;
|
|
82
83
|
return document.scrollingElement;
|
|
83
84
|
}, y = null, b = null, x = (e) => ({
|
|
84
85
|
width: e.offsetWidth || window.innerWidth,
|
|
85
86
|
height: e.offsetHeight || window.innerHeight
|
|
86
87
|
}), S = (e) => {
|
|
87
|
-
if (!b || !y || !
|
|
88
|
+
if (!b || !y || !ce(b, e.clientX, e.clientY)) return;
|
|
88
89
|
let t = document.elementFromPoint(e.clientX, e.clientY);
|
|
89
90
|
if (!t || t === y) return;
|
|
90
|
-
let n = v(e.deltaX, e.deltaMode, window.innerWidth), r = v(e.deltaY, e.deltaMode, window.innerHeight), i =
|
|
91
|
+
let n = v(e.deltaX, e.deltaMode, window.innerWidth), r = v(e.deltaY, e.deltaMode, window.innerHeight), i = de(t, n, r);
|
|
91
92
|
i && (i.scrollBy({
|
|
92
93
|
left: n,
|
|
93
94
|
top: r,
|
|
94
95
|
behavior: "instant"
|
|
95
96
|
}), e.cancelable && e.preventDefault());
|
|
96
|
-
},
|
|
97
|
+
}, fe = (e) => {
|
|
97
98
|
let t = b !== null;
|
|
98
99
|
b = e, t !== (e !== null) && (e ? window.addEventListener("wheel", S, {
|
|
99
100
|
capture: !0,
|
|
100
101
|
passive: !1
|
|
101
102
|
}) : window.removeEventListener("wheel", S, { capture: !0 }));
|
|
102
|
-
}, C = 0,
|
|
103
|
+
}, C = 0, pe = (e) => {
|
|
103
104
|
if (e === C) return;
|
|
104
105
|
C = e;
|
|
105
106
|
let t = document.documentElement.style;
|
|
106
107
|
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"));
|
|
107
108
|
}, w = (e, { modal: t, rects: n, inset: r }, i) => {
|
|
108
|
-
if (
|
|
109
|
+
if (pe(r), !m) {
|
|
109
110
|
let r = t || n.length > 0;
|
|
110
111
|
e.style.setProperty("pointer-events", r ? "auto" : "none", "important"), e.style.setProperty("visibility", r ? "visible" : "hidden", "important");
|
|
111
112
|
return;
|
|
112
113
|
}
|
|
113
|
-
let a =
|
|
114
|
-
e.style.setProperty("clip-path", o, "important"),
|
|
115
|
-
},
|
|
114
|
+
let a = oe(n, t, i), o = a === "none" || CSS.supports("clip-path", a) ? a : "inset(100%)";
|
|
115
|
+
e.style.setProperty("clip-path", o, "important"), fe(t || o !== a ? null : se(n));
|
|
116
|
+
}, me = (e) => {
|
|
116
117
|
if (typeof e != "object" || !e) return 0;
|
|
117
118
|
let { top: t } = e;
|
|
118
|
-
return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 0 : Math.min(Math.round(t),
|
|
119
|
-
},
|
|
119
|
+
return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 0 : Math.min(Math.round(t), p);
|
|
120
|
+
}, he = (e) => {
|
|
120
121
|
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;
|
|
121
|
-
},
|
|
122
|
+
}, T = (e, t) => {
|
|
122
123
|
if (typeof e != "object" || !e) return null;
|
|
123
124
|
let { x: n, y: r, width: i, height: a } = e;
|
|
124
125
|
if (![
|
|
@@ -127,7 +128,7 @@ var n = 1e4, r = 16, i = (e) => {
|
|
|
127
128
|
i,
|
|
128
129
|
a
|
|
129
130
|
].every((e) => typeof e == "number" && Number.isFinite(e))) return null;
|
|
130
|
-
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 =
|
|
131
|
+
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 = he(e.radius);
|
|
131
132
|
return {
|
|
132
133
|
x: c,
|
|
133
134
|
y: l,
|
|
@@ -135,89 +136,49 @@ var n = 1e4, r = 16, i = (e) => {
|
|
|
135
136
|
height: d - l,
|
|
136
137
|
...f ? { radius: f } : {}
|
|
137
138
|
};
|
|
138
|
-
},
|
|
139
|
+
}, E = {
|
|
139
140
|
"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",
|
|
140
141
|
clipped: "it is clipped away or positioned outside the viewport",
|
|
141
142
|
"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"
|
|
142
|
-
},
|
|
143
|
+
}, ge = (e) => Array.isArray(e) ? e.slice(0, f).flatMap((e) => {
|
|
143
144
|
if (typeof e != "object" || !e) return [];
|
|
144
145
|
let { kind: t, cause: n, level: r } = e;
|
|
145
|
-
return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in
|
|
146
|
+
return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in E) || r !== "full" && r !== "liveness" ? [] : [{
|
|
146
147
|
kind: t,
|
|
147
148
|
cause: n,
|
|
148
149
|
level: r
|
|
149
150
|
}];
|
|
150
|
-
}) : [],
|
|
151
|
-
for (let { kind: t, cause: n, level: r } of e)
|
|
151
|
+
}) : [], D = /* @__PURE__ */ new Set(), _e = (e) => {
|
|
152
|
+
for (let { kind: t, cause: n, level: r } of e) D.has(t) || (D.add(t), console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${E[n]}. Nobody using this page can see or answer it.
|
|
152
153
|
@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." : "")));
|
|
153
|
-
},
|
|
154
|
+
}, O = (e, t) => {
|
|
154
155
|
if (typeof e != "object" || !e) return null;
|
|
155
|
-
let n = e, r = (Array.isArray(n.rects) ? n.rects.slice(0,
|
|
156
|
+
let n = e, r = (Array.isArray(n.rects) ? n.rects.slice(0, d) : []).map((e) => T(e, t)).filter((e) => e !== null && e.width > 0 && e.height > 0);
|
|
156
157
|
return {
|
|
157
158
|
modal: n.modal === !0,
|
|
158
159
|
rects: r,
|
|
159
|
-
hidden:
|
|
160
|
-
inset:
|
|
160
|
+
hidden: ge(n.hidden),
|
|
161
|
+
inset: me(n.inset)
|
|
161
162
|
};
|
|
162
|
-
},
|
|
163
|
-
if (!y ||
|
|
164
|
-
let e = x(y), t =
|
|
163
|
+
}, ve = () => y !== null, k = null, A = null, ye = () => {
|
|
164
|
+
if (!y || k === null) return;
|
|
165
|
+
let e = x(y), t = O(k, e);
|
|
165
166
|
t && w(y, t, e);
|
|
166
|
-
}, ye = (e) => {
|
|
167
|
-
typeof ResizeObserver < "u" && (k ??= new ResizeObserver(ve), k.disconnect(), k.observe(e));
|
|
168
167
|
}, be = (e) => {
|
|
169
|
-
|
|
168
|
+
typeof ResizeObserver < "u" && (A ??= new ResizeObserver(ye), A.disconnect(), A.observe(e));
|
|
169
|
+
}, xe = (e) => {
|
|
170
|
+
ee(e), w(e, {
|
|
170
171
|
modal: !1,
|
|
171
172
|
rects: [],
|
|
172
173
|
hidden: [],
|
|
173
174
|
inset: 0
|
|
174
|
-
}, x(e)), y = e,
|
|
175
|
-
},
|
|
175
|
+
}, x(e)), y = e, be(e);
|
|
176
|
+
}, Se = (e) => {
|
|
176
177
|
if (!y) return;
|
|
177
|
-
let t = x(y), n =
|
|
178
|
-
n && (
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
try {
|
|
182
|
-
t = new URL(`http://${e.includes(":") && !e.startsWith("[") ? `[${e}]` : e}/`).hostname;
|
|
183
|
-
} catch {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
let n = /^\[(?:::ffff:|64:ff9b::)([0-9a-f]{1,4}):([0-9a-f]{1,4})\]$/.exec(t);
|
|
187
|
-
if (n) {
|
|
188
|
-
let e = parseInt(n[1], 16), t = parseInt(n[2], 16);
|
|
189
|
-
return [
|
|
190
|
-
e >> 8,
|
|
191
|
-
e & 255,
|
|
192
|
-
t >> 8,
|
|
193
|
-
t & 255
|
|
194
|
-
].join(".");
|
|
195
|
-
}
|
|
196
|
-
return /^\d+\.\d+\.\d+\.\d+$/.test(t) ? t : void 0;
|
|
197
|
-
}, Te = (e) => {
|
|
198
|
-
let t = A(e);
|
|
199
|
-
return Se.some((e) => t === e || t.endsWith(`.${e}`));
|
|
200
|
-
}, Ee = (e) => {
|
|
201
|
-
if (Te(e)) return !0;
|
|
202
|
-
let t = we(A(e));
|
|
203
|
-
return t !== void 0 && Ce.includes(t);
|
|
204
|
-
}, De = (e) => {
|
|
205
|
-
let t = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, n;
|
|
206
|
-
try {
|
|
207
|
-
n = new URL(t);
|
|
208
|
-
} catch {
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
if (Ee(n.hostname)) throw Error(`fetch refuses FKN platform domains (${n.hostname})`);
|
|
212
|
-
}, Oe = /* @__PURE__ */ "autoplay.fullscreen.picture-in-picture.encrypted-media.screen-wake-lock.speaker-selection.captured-surface-control.camera.microphone.display-capture.geolocation.midi.usb.serial.hid.bluetooth.gamepad.keyboard-map.xr-spatial-tracking.accelerometer.gyroscope.magnetometer.ambient-light-sensor.compute-pressure.clipboard-read.clipboard-write.storage-access.window-management.local-fonts.idle-detection.web-share.sync-xhr.unload.payment.publickey-credentials-get.publickey-credentials-create.otp-credentials.identity-credentials-get.digital-credentials-get.local-network.local-network-access.loopback-network".split("."), ke = () => {
|
|
213
|
-
try {
|
|
214
|
-
let e = globalThis.document?.featurePolicy?.features?.();
|
|
215
|
-
return e === void 0 ? void 0 : new Set(e);
|
|
216
|
-
} catch {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
}, j = (e = !0, t = ke()) => [...Oe, ...e ? ["cross-origin-isolated"] : []].filter((e) => t === void 0 || t.has(e)).join("; "), M = "https://fkn.app", N = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, P = typeof globalThis < "u" && globalThis.crossOriginIsolated === !0, F = `${M}/api${P ? "?coi=1" : ""}`, Ae = "fkn-api-port", je = "fkn-api-port-ack", Me = 2e3, Ne = () => {
|
|
220
|
-
if (!N || typeof window > "u" || window.parent === window) return Promise.resolve(void 0);
|
|
178
|
+
let t = x(y), n = O(e, t);
|
|
179
|
+
n && (k = e, w(y, n, t), _e(n.hidden));
|
|
180
|
+
}, j = "https://fkn.app", M = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, N = typeof globalThis < "u" && globalThis.crossOriginIsolated === !0, P = t(N), Ce = "fkn-api-port", we = "fkn-api-port-ack", Te = 2e3, Ee = () => {
|
|
181
|
+
if (!M || typeof window > "u" || window.parent === window) return Promise.resolve(void 0);
|
|
221
182
|
let e;
|
|
222
183
|
try {
|
|
223
184
|
e = window.parent;
|
|
@@ -232,40 +193,40 @@ var n = 1e4, r = 16, i = (e) => {
|
|
|
232
193
|
} catch {}
|
|
233
194
|
n(e);
|
|
234
195
|
}, i = (e) => {
|
|
235
|
-
e.data?.type ===
|
|
236
|
-
}, a = setTimeout(() => r(void 0),
|
|
196
|
+
e.data?.type === we && r(t.port1);
|
|
197
|
+
}, a = setTimeout(() => r(void 0), Te);
|
|
237
198
|
t.port1.addEventListener("message", i), t.port1.start();
|
|
238
199
|
try {
|
|
239
|
-
e.postMessage({ type:
|
|
200
|
+
e.postMessage({ type: Ce }, j, [t.port2]);
|
|
240
201
|
} catch {
|
|
241
202
|
r(void 0);
|
|
242
203
|
}
|
|
243
204
|
});
|
|
244
|
-
},
|
|
245
|
-
if (
|
|
246
|
-
let
|
|
247
|
-
if (
|
|
205
|
+
}, F, I = () => {
|
|
206
|
+
if (F || !M) return F;
|
|
207
|
+
let t = M.querySelector(`iframe[src="${P}"]`);
|
|
208
|
+
if (t) F = t;
|
|
248
209
|
else {
|
|
249
|
-
let
|
|
250
|
-
|
|
210
|
+
let t = M.createElement("iframe");
|
|
211
|
+
t.setAttribute("allow", e(N)), t.src = P, M.body.appendChild(t), F = t;
|
|
251
212
|
}
|
|
252
|
-
return
|
|
213
|
+
return u(F, P, j), xe(F), F;
|
|
253
214
|
}, L = (async () => {
|
|
254
|
-
if (!
|
|
255
|
-
let e = await
|
|
215
|
+
if (!M) return;
|
|
216
|
+
let e = await Ee();
|
|
256
217
|
if (e) return {
|
|
257
218
|
receive: e,
|
|
258
219
|
emit: e
|
|
259
220
|
};
|
|
260
|
-
let t =
|
|
221
|
+
let t = I();
|
|
261
222
|
if (!t) return;
|
|
262
|
-
await
|
|
223
|
+
await s(t);
|
|
263
224
|
let n = t.contentWindow;
|
|
264
225
|
return n ? {
|
|
265
226
|
receive: window,
|
|
266
227
|
emit: n
|
|
267
228
|
} : void 0;
|
|
268
|
-
})(),
|
|
229
|
+
})(), De = (e, { boundRetired: t = (e) => e } = {}) => {
|
|
269
230
|
let n, r = 0, i = !1, a = () => {}, o = () => new Promise((e) => {
|
|
270
231
|
a = e;
|
|
271
232
|
}), s = o(), c = s, l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), d = 0, f = 0, p = () => {
|
|
@@ -341,7 +302,7 @@ var n = 1e4, r = 16, i = (e) => {
|
|
|
341
302
|
i = !0, n = void 0, p();
|
|
342
303
|
}
|
|
343
304
|
};
|
|
344
|
-
}, R = !1, z = /* @__PURE__ */ new Set(), B = () => R,
|
|
305
|
+
}, R = !1, z = /* @__PURE__ */ new Set(), B = () => R, Oe = () => {
|
|
345
306
|
if (!R) {
|
|
346
307
|
R = !0;
|
|
347
308
|
for (let e of [...z]) try {
|
|
@@ -351,43 +312,42 @@ var n = 1e4, r = 16, i = (e) => {
|
|
|
351
312
|
}
|
|
352
313
|
}, V = (e) => {
|
|
353
314
|
R ? e() : z.add(e);
|
|
354
|
-
},
|
|
315
|
+
}, ke = typeof window < "u" || typeof self < "u", H = async () => {
|
|
355
316
|
if (typeof window < "u") return L;
|
|
356
317
|
if (typeof self < "u") return {
|
|
357
318
|
receive: self,
|
|
358
319
|
emit: self
|
|
359
320
|
};
|
|
360
|
-
}, U = "fkn-api",
|
|
321
|
+
}, U = "fkn-api", Ae = "fkn-api-window", je = { async *[Symbol.asyncIterator]() {
|
|
361
322
|
let e = await H();
|
|
362
|
-
if (!e) {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
yield r;
|
|
323
|
+
if (!e) await new Promise(() => {});
|
|
324
|
+
else {
|
|
325
|
+
if (!B()) {
|
|
326
|
+
let t = new AbortController();
|
|
327
|
+
V(() => t.abort());
|
|
328
|
+
for await (let n of r({}, {
|
|
329
|
+
key: U,
|
|
330
|
+
transport: e,
|
|
331
|
+
unregisterSignal: t.signal
|
|
332
|
+
})) {
|
|
333
|
+
if (t.signal.aborted) break;
|
|
334
|
+
yield n;
|
|
335
|
+
}
|
|
376
336
|
}
|
|
337
|
+
yield* r({}, {
|
|
338
|
+
key: Ae,
|
|
339
|
+
transport: e
|
|
340
|
+
});
|
|
377
341
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
} }, W = !1, G = H().then((t) => new Promise((n) => {
|
|
383
|
-
if (!t) return;
|
|
384
|
-
let { receive: r } = t, i = (t) => {
|
|
385
|
-
e(t.data, U) && (r.removeEventListener("message", i), W = !0, n());
|
|
342
|
+
} }, W = !1, G = H().then((e) => new Promise((t) => {
|
|
343
|
+
if (!e) return;
|
|
344
|
+
let { receive: r } = e, i = (e) => {
|
|
345
|
+
n(e.data, U) && (r.removeEventListener("message", i), W = !0, t());
|
|
386
346
|
};
|
|
387
347
|
r.addEventListener("message", i);
|
|
388
|
-
})), K =
|
|
348
|
+
})), K = De(je, { boundRetired: (e) => Promise.race([e, G.then(() => Q(e, () => new Z()))]) });
|
|
389
349
|
V(() => K.retire());
|
|
390
|
-
var q = Promise.race([K.first, new Promise((e) => V(e))]).then(() => K.facade), J = 8e3,
|
|
350
|
+
var q = Promise.race([K.first, new Promise((e) => V(e))]).then(() => K.facade), J = 8e3, Me = 1e3, Y = !1, X = class extends Error {
|
|
391
351
|
constructor(e, t) {
|
|
392
352
|
super(`@fkn/lib: no broker connection within ${t}ms, so ${e} could not be requested`), this.name = "BrokerUnreachableError";
|
|
393
353
|
}
|
|
@@ -396,23 +356,22 @@ var q = Promise.race([K.first, new Promise((e) => V(e))]).then(() => K.facade),
|
|
|
396
356
|
super("FKN @fkn/lib: this page relays its FKN channel to a worker, and the FKN page it reached predates a channel of the page's own; reload"), this.name = "OwnChannelUnavailableError";
|
|
397
357
|
}
|
|
398
358
|
}, Q = (e, t) => {
|
|
399
|
-
let n = Y ?
|
|
359
|
+
let n = Y ? Me : J;
|
|
400
360
|
return Promise.race([e, new Promise((e, r) => setTimeout(() => {
|
|
401
361
|
Y = !0, r(t(n));
|
|
402
362
|
}, n))]);
|
|
403
|
-
},
|
|
363
|
+
}, Ne = (e) => B() ? Q(K.routable().then(() => K.facade), (t) => W ? new Z() : new X(e, t)) : Q(q, (t) => new X(e, t));
|
|
404
364
|
V(() => {
|
|
405
365
|
G.then(() => {
|
|
406
366
|
let e = setTimeout(() => console.error(new Z()), J);
|
|
407
367
|
K.routable().then(() => clearTimeout(e));
|
|
408
368
|
});
|
|
409
369
|
});
|
|
410
|
-
var $ = K.onEpoch,
|
|
370
|
+
var $ = K.onEpoch, Pe = K.current, Fe = K.lastCall, Ie = K.inFlight;
|
|
411
371
|
$((e) => {
|
|
412
|
-
|
|
413
|
-
exactClips:
|
|
414
|
-
colorScheme:
|
|
372
|
+
ve() && e.overlay.setHost(Se, {
|
|
373
|
+
exactClips: ne(),
|
|
374
|
+
colorScheme: g
|
|
415
375
|
}).catch(() => {});
|
|
416
376
|
});
|
|
417
|
-
|
|
418
|
-
export { Ue as a, He as c, Ie as d, L as f, We as i, Le as l, j as m, X as n, q as o, De as p, Z as r, Ve as s, J as t, $ as u };
|
|
377
|
+
export { Fe as a, Pe as c, Oe as d, L as f, Ie as i, ke as l, X as n, q as o, Z as r, Ne as s, J as t, $ as u };
|
package/api-DrvhPN56.cjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const e=require("./broker-frame-CF4-yXtj.cjs");let t=require("osra");var n=1e4,r=16,i=e=>{let t;try{t=e.contentWindow}catch{return!0}if(!t)return!0;try{let e=t.location.href;return e!==``&&e!==`about:blank`}catch{return!0}},a=(e,t=n)=>new Promise(n=>{if(i(e))return n();let a=()=>{clearInterval(o),clearTimeout(s),e.removeEventListener(`load`,a),n()},o=setInterval(()=>{i(e)&&a()},r),s=setTimeout(a,t);e.addEventListener(`load`,a)}),o=5e3,s=9e4,c=(e,t,r)=>{let a=1,c,l=e.ownerDocument.defaultView,u=()=>{clearTimeout(c),l?.removeEventListener(`message`,m),e.removeEventListener(`load`,p)},d=()=>{if(e.isConnected){if(a>=4)return u(),console.error(`FKN @fkn/lib: ${t} did not load in ${a} tries; reload the page`);a+=1,e.contentWindow?.location.replace(t),f(s)}},f=e=>{clearTimeout(c),c=setTimeout(d,e)},p=()=>f(o),m=t=>{t.source===e.contentWindow&&t.origin===r&&u()};if(l?.addEventListener(`message`,m),e.addEventListener(`load`,p),i(e))return f(o);c=setTimeout(()=>i(e)?f(8e4):d(),n)},l=32,u=8,d=120,f=typeof CSS<`u`&&CSS.supports(`clip-path`,`path('M0 0H1V1H0Z')`),p=typeof CSS<`u`&&CSS.supports(`clip-path`,`polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)`),m=`light dark`,h=e=>{let t=e.style;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`,m),t.setProperty(`z-index`,`2147483647`),e.setAttribute(`title`,`FKN`)},g=({x:e,y:t,width:n,height:r,radius:i})=>{if(!i)return`M${e} ${t}h${n}v${r}h${-n}Z`;let a=Math.min(n,r)/2,[o,s,c,l]=i.map(e=>Math.max(0,Math.min(e,a)));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`},ee=()=>f&&p,_=({x:e,y:t,width:n,height:r})=>[[e,t],[e+n,t],[e+n,t+r],[e,t+r],[e,t]],te=e=>{let t=e[0];if(!t)return[];let n=_(t)[0],r=[];return e.forEach((t,i)=>{r.push(..._(t)),i>0&&i<e.length-1&&r.push(n)}),r},ne=e=>`polygon(nonzero, ${te(e).map(([e,t])=>`${e}px ${t}px`).join(`, `)})`,re=({x:e,y:t,width:n,height:r,radius:i},a)=>{let o=`${t}px ${a.width-e-n}px ${a.height-t-r}px ${e}px`;return i?`inset(${o} round ${i.map(e=>`${e}px`).join(` `)})`:`inset(${o})`},ie=(e,t,n)=>{if(t)return`none`;if(e.length===0)return`inset(100%)`;let r=e.length===1?e[0]:void 0;return r?re(r,n):p&&e.length<=5&&!e.some(e=>e.radius)?ne(e):`path('${e.map(g).join(``)}')`},ae=e=>{if(e.length<2)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,width:Math.max(...e.map(e=>e.x+e.width))-t,height:Math.max(...e.map(e=>e.y+e.height))-n}},oe=(e,t,n)=>t>=e.x&&t<e.x+e.width&&n>=e.y&&n<e.y+e.height,se=16,v=(e,t,n)=>t===1?e*se:t===2?e*n:e,ce=(e,t,n)=>{let r=getComputedStyle(e);return n!==0&&/auto|scroll/.test(r.overflowY)&&e.scrollHeight>e.clientHeight?!0:t!==0&&/auto|scroll/.test(r.overflowX)&&e.scrollWidth>e.clientWidth},le=(e,t,n)=>{for(let r=e;r;r=r.parentElement)if(ce(r,t,n))return r;return document.scrollingElement},y=null,b=null,x=e=>({width:e.offsetWidth||window.innerWidth,height:e.offsetHeight||window.innerHeight}),S=e=>{if(!b||!y||!oe(b,e.clientX,e.clientY))return;let t=document.elementFromPoint(e.clientX,e.clientY);if(!t||t===y)return;let n=v(e.deltaX,e.deltaMode,window.innerWidth),r=v(e.deltaY,e.deltaMode,window.innerHeight),i=le(t,n,r);i&&(i.scrollBy({left:n,top:r,behavior:`instant`}),e.cancelable&&e.preventDefault())},ue=e=>{let t=b!==null;b=e,t!==(e!==null)&&(e?window.addEventListener(`wheel`,S,{capture:!0,passive:!1}):window.removeEventListener(`wheel`,S,{capture:!0}))},C=0,de=e=>{if(e===C)return;C=e;let t=document.documentElement.style;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`))},w=(e,{modal:t,rects:n,inset:r},i)=>{if(de(r),!f){let r=t||n.length>0;e.style.setProperty(`pointer-events`,r?`auto`:`none`,`important`),e.style.setProperty(`visibility`,r?`visible`:`hidden`,`important`);return}let a=ie(n,t,i),o=a===`none`||CSS.supports(`clip-path`,a)?a:`inset(100%)`;e.style.setProperty(`clip-path`,o,`important`),ue(t||o!==a?null:ae(n))},fe=e=>{if(typeof e!=`object`||!e)return 0;let{top:t}=e;return typeof t!=`number`||!Number.isFinite(t)||t<=0?0:Math.min(Math.round(t),d)},pe=e=>{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},me=(e,t)=>{if(typeof e!=`object`||!e)return null;let{x:n,y:r,width:i,height:a}=e;if(![n,r,i,a].every(e=>typeof e==`number`&&Number.isFinite(e)))return null;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=pe(e.radius);return{x:c,y:l,width:u-c,height:d-l,...f?{radius:f}:{}}},T={"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`,clipped:`it is clipped away or positioned outside the viewport`,"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`},E=e=>Array.isArray(e)?e.slice(0,u).flatMap(e=>{if(typeof e!=`object`||!e)return[];let{kind:t,cause:n,level:r}=e;return typeof t!=`string`||t.length>40||typeof n!=`string`||!(n in T)||r!==`full`&&r!==`liveness`?[]:[{kind:t,cause:n,level:r}]}):[],D=new Set,he=e=>{for(let{kind:t,cause:n,level:r}of e)D.has(t)||(D.add(t),console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${T[n]}. Nobody using this page can see or answer it.
|
|
2
|
+
@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`?`
|
|
3
|
+
This browser reports limited detail, so the cause above is a best guess.`:``)))},O=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=e,r=(Array.isArray(n.rects)?n.rects.slice(0,l):[]).map(e=>me(e,t)).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:n.modal===!0,rects:r,hidden:E(n.hidden),inset:fe(n.inset)}},ge=()=>y!==null,k=null,A=null,_e=()=>{if(!y||k===null)return;let e=x(y),t=O(k,e);t&&w(y,t,e)},ve=e=>{typeof ResizeObserver<`u`&&(A??=new ResizeObserver(_e),A.disconnect(),A.observe(e))},ye=e=>{h(e),w(e,{modal:!1,rects:[],hidden:[],inset:0},x(e)),y=e,ve(e)},be=e=>{if(!y)return;let t=x(y),n=O(e,t);n&&(k=e,w(y,n,t),he(n.hidden))},j=`https://fkn.app`,M=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,N=typeof globalThis<`u`&&globalThis.crossOriginIsolated===!0,P=e.n(N),xe=`fkn-api-port`,Se=`fkn-api-port-ack`,Ce=2e3,F=()=>{if(!M||typeof window>`u`||window.parent===window)return Promise.resolve(void 0);let e;try{e=window.parent}catch{return Promise.resolve(void 0)}let t=new MessageChannel;return new Promise(n=>{let r=e=>{if(clearTimeout(a),t.port1.removeEventListener(`message`,i),!e)try{t.port1.close()}catch{}n(e)},i=e=>{e.data?.type===Se&&r(t.port1)},a=setTimeout(()=>r(void 0),Ce);t.port1.addEventListener(`message`,i),t.port1.start();try{e.postMessage({type:xe},j,[t.port2])}catch{r(void 0)}})},I,we=()=>{if(I||!M)return I;let t=M.querySelector(`iframe[src="${P}"]`);if(t)I=t;else{let t=M.createElement(`iframe`);t.setAttribute(`allow`,e.i(N)),t.src=P,M.body.appendChild(t),I=t}return c(I,P,j),ye(I),I},L=(async()=>{if(!M)return;let e=await F();if(e)return{receive:e,emit:e};let t=we();if(!t)return;await a(t);let n=t.contentWindow;return n?{receive:window,emit:n}:void 0})(),Te=(e,{boundRetired:t=e=>e}={})=>{let n,r=0,i=!1,a=()=>{},o=()=>new Promise(e=>{a=e}),s=o(),c=s,l=new Set,u=new Set,d=0,f=0,p=()=>{let e=[...u];u.clear();let t=Error(`FKN: the broker was replaced while this call was pending; retry it`);for(let n of e)try{n(t)}catch{}};(async()=>{for await(let t of e){let e=++r;n={remote:t,epoch:e};let i=a;s=o(),i(t),p();for(let n of[...l])try{n(t,e)}catch{}}})().catch(()=>{});let m=async(e,r)=>{let a=n?.remote??await(i?t(s):s);for(let t of e.slice(0,-1))a=a[t];let o=a[e[e.length-1]??``];d=Date.now(),f+=1;let c=()=>{},l=new Promise((e,t)=>{c=t});u.add(c);try{return await Promise.race([Promise.resolve(o.apply(a,r)),l])}finally{--f,u.delete(c),d=Date.now()}},h=new Map,g=e=>{let t=e.join(`\0`),r=h.get(t);if(r)return r;let i=new Proxy(function(){},{get:(t,r)=>{if(typeof r!=`string`||r===`then`)return;let i=n;if(i){let t=i.remote;for(let n of e)t=t?.[n];if(t?.[r]===void 0)return}return g([...e,r])},apply:(t,n,r)=>m(e,r)});return h.set(t,i),i};return{facade:g([]),first:c.then(()=>{}),current:()=>n,onEpoch:e=>{if(l.add(e),n)try{e(n.remote,n.epoch)}catch{}return()=>{l.delete(e)}},lastCall:()=>d,inFlight:()=>f,routable:()=>n?Promise.resolve():s.then(()=>{}),retire:()=>{i=!0,n=void 0,p()}}},R=!1,z=new Set,B=()=>R,Ee=()=>{if(!R){R=!0;for(let e of[...z])try{e()}catch{}z.clear()}},V=e=>{R?e():z.add(e)},De=typeof window<`u`||typeof self<`u`,H=async()=>{if(typeof window<`u`)return L;if(typeof self<`u`)return{receive:self,emit:self}},U=`fkn-api`,Oe=`fkn-api-window`,ke={async*[Symbol.asyncIterator](){let e=await H();if(!e)await new Promise(()=>{});else{if(!B()){let n=new AbortController;V(()=>n.abort());for await(let r of(0,t.expose)({},{key:U,transport:e,unregisterSignal:n.signal})){if(n.signal.aborted)break;yield r}}yield*(0,t.expose)({},{key:Oe,transport:e})}}},W=!1,G=H().then(e=>new Promise(n=>{if(!e)return;let{receive:r}=e,i=e=>{(0,t.checkOsraMessageKey)(e.data,U)&&(r.removeEventListener(`message`,i),W=!0,n())};r.addEventListener(`message`,i)})),K=Te(ke,{boundRetired:e=>Promise.race([e,G.then(()=>Q(e,()=>new Z))])});V(()=>K.retire());var q=Promise.race([K.first,new Promise(e=>V(e))]).then(()=>K.facade),J=8e3,Ae=1e3,Y=!1,X=class extends Error{constructor(e,t){super(`@fkn/lib: no broker connection within ${t}ms, so ${e} could not be requested`),this.name=`BrokerUnreachableError`}},Z=class extends Error{constructor(){super(`FKN @fkn/lib: this page relays its FKN channel to a worker, and the FKN page it reached predates a channel of the page's own; reload`),this.name=`OwnChannelUnavailableError`}},Q=(e,t)=>{let n=Y?Ae:J;return Promise.race([e,new Promise((e,r)=>setTimeout(()=>{Y=!0,r(t(n))},n))])},je=e=>B()?Q(K.routable().then(()=>K.facade),t=>W?new Z:new X(e,t)):Q(q,t=>new X(e,t));V(()=>{G.then(()=>{let e=setTimeout(()=>console.error(new Z),J);K.routable().then(()=>clearTimeout(e))})});var $=K.onEpoch,Me=K.current,Ne=K.lastCall,Pe=K.inFlight;$(e=>{ge()&&e.overlay.setHost(be,{exactClips:ee(),colorScheme:m}).catch(()=>{})}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return $}});
|
package/api.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./api-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./api-DrvhPN56.cjs");exports.API_DEADLINE_MS=e.t,exports.BrokerUnreachableError=e.n,exports.OwnChannelUnavailableError=e.r,exports.apiInFlight=e.i,exports.apiLastCall=e.a,exports.apiPromise=e.o,exports.apiWithin=e.s,exports.currentApiEpoch=e.c,exports.hasTransport=e.l,exports.onApiEpoch=e.u;
|
package/api.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { X as Resolvers } from "./contract-
|
|
2
|
-
import { a as apiLastCall, c as currentApiEpoch, i as apiInFlight, l as hasTransport, n as BrokerUnreachableError, o as apiPromise, r as OwnChannelUnavailableError, s as apiWithin, t as API_DEADLINE_MS, u as onApiEpoch } from "./api-
|
|
1
|
+
import { X as Resolvers } from "./contract-0rua6Wsh.js";
|
|
2
|
+
import { a as apiLastCall, c as currentApiEpoch, i as apiInFlight, l as hasTransport, n as BrokerUnreachableError, o as apiPromise, r as OwnChannelUnavailableError, s as apiWithin, t as API_DEADLINE_MS, u as onApiEpoch } from "./api-0Yp9uZcV.js";
|
|
3
3
|
export { API_DEADLINE_MS, BrokerUnreachableError, OwnChannelUnavailableError, type Resolvers, apiInFlight, apiLastCall, apiPromise, apiWithin, currentApiEpoch, hasTransport, onApiEpoch };
|
package/api.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { c as API_DEADLINE_MS, i as BrokerUnreachableError, o as OwnChannelUnavailableError, n as apiInFlight, e as apiLastCall, a as apiPromise, s as apiWithin, t as currentApiEpoch, r as hasTransport, l as onApiEpoch };
|
|
1
|
+
export { t as API_DEADLINE_MS, n as BrokerUnreachableError, r as OwnChannelUnavailableError, i as apiInFlight, a as apiLastCall, o as apiPromise, s as apiWithin, c as currentApiEpoch, l as hasTransport, u as onApiEpoch } from "./api-DRglK7ft.js";
|
package/attach-policy.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region ../web-extension/lib/permission/shared/hosts.d.ts
|
|
2
1
|
/** What `normalizeHosts` keeps beyond a bare hostname. */
|
|
3
2
|
type NormalizeHostsOptions = {
|
|
4
3
|
/**
|
|
@@ -14,8 +13,6 @@ type NormalizeHostsOptions = {
|
|
|
14
13
|
* and the middle page all run this one function.
|
|
15
14
|
*/
|
|
16
15
|
declare const normalizeHosts: (raw: readonly string[], { ipv6 }?: NormalizeHostsOptions) => string[];
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/attach-policy.d.ts
|
|
19
16
|
/**
|
|
20
17
|
* The pure half of the middle page's frame.fetch gate: what can be decided from the attachment's own
|
|
21
18
|
* facts, with no broker and no UI. The middle page enforces it on EVERY fetch call, because any app
|
|
@@ -52,5 +49,4 @@ export type FrameFetchClassifier = 'no-base' | 'fetchTarget';
|
|
|
52
49
|
export declare const frameFetchVerdict: (policy: FrameFetchPolicy, url: unknown, { classifier }?: {
|
|
53
50
|
classifier?: FrameFetchClassifier;
|
|
54
51
|
}) => FrameFetchVerdict;
|
|
55
|
-
//#endregion
|
|
56
52
|
export { normalizeHosts as normalizeDeclaredHosts };
|
package/attach-policy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as e, t } from "./hosts-
|
|
2
|
-
|
|
1
|
+
import { l as e, t } from "./hosts-HUfgMimI.js";
|
|
2
|
+
// src/attach-policy.ts
|
|
3
3
|
var n = (t, n, { classifier: r = "no-base" } = {}) => {
|
|
4
4
|
if (!t.session) return {
|
|
5
5
|
kind: "refuse",
|
|
@@ -37,5 +37,4 @@ var n = (t, n, { classifier: r = "no-base" } = {}) => {
|
|
|
37
37
|
promptHosts: a
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
//#endregion
|
|
41
40
|
export { n as frameFetchVerdict, t as normalizeDeclaredHosts };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var e=`fkn.app,fkn.dev,sdbx.app,horionsoftware.com,webvpn.dev,fknmail.app,clairv.app,fkn.cloudflareaccess.com,me-62e.workers.dev,62e9d4fbf21d90ebd4342e54b4babbd3.r2.cloudflarestorage.com,62e9d4fbf21d90ebd4342e54b4babbd3.eu.r2.cloudflarestorage.com,62e9d4fbf21d90ebd4342e54b4babbd3.fedramp.r2.cloudflarestorage.com,pub-8a3dc68041874c7e9c9a54bde972605a.r2.dev,pub-3d97d79220b94243812e60b0e742f2c5.r2.dev,pub-f8bd4876cc3c4b4a951715da5958e49c.r2.dev,web-b3z.pages.dev,fkn-console.pages.dev,dev-dms.pages.dev,fkn-www.pages.dev,fkn-homepage.pages.dev,fkn-sandbox.pages.dev,internal-3ar.pages.dev,stub-ben.pages.dev,ripple-3t3.pages.dev,media-player-e3s.pages.dev,youtube-3c4.pages.dev,horionsoftware.pages.dev,container-ckf.pages.dev,stub-plugin.pages.dev,social-3n2.pages.dev,plugins.banou.dev`.split(`,`),t=e=>e.toLowerCase().replace(/\.+$/,``),n=[`79.127.204.69`,`152.233.49.59`],r=e=>{let t;try{t=new URL(`http://${e.includes(`:`)&&!e.startsWith(`[`)?`[${e}]`:e}/`).hostname}catch{return}let n=/^\[(?:::ffff:|64:ff9b::)([0-9a-f]{1,4}):([0-9a-f]{1,4})\]$/.exec(t);if(n){let e=parseInt(n[1],16),t=parseInt(n[2],16);return[e>>8,e&255,t>>8,t&255].join(`.`)}return/^\d+\.\d+\.\d+\.\d+$/.test(t)?t:void 0},i=n=>{let r=t(n);return e.some(e=>r===e||r.endsWith(`.${e}`))},a=e=>{if(i(e))return!0;let a=r(t(e));return a!==void 0&&n.includes(a)},o=e=>{let t=typeof e==`string`?e:e instanceof URL?e.href:e.url,n;try{n=new URL(t)}catch{return}if(a(n.hostname))throw Error(`fetch refuses FKN platform domains (${n.hostname})`)},s=`autoplay.fullscreen.picture-in-picture.encrypted-media.screen-wake-lock.speaker-selection.captured-surface-control.camera.microphone.display-capture.geolocation.midi.usb.serial.hid.bluetooth.gamepad.keyboard-map.xr-spatial-tracking.accelerometer.gyroscope.magnetometer.ambient-light-sensor.compute-pressure.clipboard-read.clipboard-write.storage-access.window-management.local-fonts.idle-detection.web-share.sync-xhr.unload.payment.publickey-credentials-get.publickey-credentials-create.otp-credentials.identity-credentials-get.digital-credentials-get.local-network.local-network-access.loopback-network`.split(`.`),c=()=>{try{let e=globalThis.document?.featurePolicy?.features?.();return e===void 0?void 0:new Set(e)}catch{return}},l=(e=!0,t=c())=>[...s,...e?[`cross-origin-isolated`]:[]].filter(e=>t===void 0||t.has(e)).join(`; `),u=`https://fkn.app`,d=e=>`${u}/api${e?`?coi=1`:``}`,f=`if (window.parent === window) {
|
|
2
|
+
const isolated = window.crossOriginIsolated === true
|
|
3
|
+
const known = document.featurePolicy?.features?.()
|
|
4
|
+
const frame = document.createElement('iframe')
|
|
5
|
+
frame.setAttribute('allow', ${JSON.stringify(s)}.concat(isolated ? ['cross-origin-isolated'] : []).filter(name => !known || known.includes(name)).join('; '))
|
|
6
|
+
frame.src = isolated ? ${JSON.stringify(d(!0))} : ${JSON.stringify(d(!1))}
|
|
7
|
+
frame.style.cssText = 'position:fixed!important;top:0!important;left:0!important;width:100%!important;height:100%!important;border:none!important;clip-path:inset(100%)!important'
|
|
8
|
+
document.body.appendChild(frame)
|
|
9
|
+
}`;Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// ../platform-policy/src/index.ts
|
|
2
|
+
var e = /* @__PURE__ */ "fkn.app,fkn.dev,sdbx.app,horionsoftware.com,webvpn.dev,fknmail.app,clairv.app,fkn.cloudflareaccess.com,me-62e.workers.dev,62e9d4fbf21d90ebd4342e54b4babbd3.r2.cloudflarestorage.com,62e9d4fbf21d90ebd4342e54b4babbd3.eu.r2.cloudflarestorage.com,62e9d4fbf21d90ebd4342e54b4babbd3.fedramp.r2.cloudflarestorage.com,pub-8a3dc68041874c7e9c9a54bde972605a.r2.dev,pub-3d97d79220b94243812e60b0e742f2c5.r2.dev,pub-f8bd4876cc3c4b4a951715da5958e49c.r2.dev,web-b3z.pages.dev,fkn-console.pages.dev,dev-dms.pages.dev,fkn-www.pages.dev,fkn-homepage.pages.dev,fkn-sandbox.pages.dev,internal-3ar.pages.dev,stub-ben.pages.dev,ripple-3t3.pages.dev,media-player-e3s.pages.dev,youtube-3c4.pages.dev,horionsoftware.pages.dev,container-ckf.pages.dev,stub-plugin.pages.dev,social-3n2.pages.dev,plugins.banou.dev".split(","), t = (e) => e.toLowerCase().replace(/\.+$/, ""), n = ["79.127.204.69", "152.233.49.59"], r = (e) => {
|
|
3
|
+
let t;
|
|
4
|
+
try {
|
|
5
|
+
t = new URL(`http://${e.includes(":") && !e.startsWith("[") ? `[${e}]` : e}/`).hostname;
|
|
6
|
+
} catch {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
let n = /^\[(?:::ffff:|64:ff9b::)([0-9a-f]{1,4}):([0-9a-f]{1,4})\]$/.exec(t);
|
|
10
|
+
if (n) {
|
|
11
|
+
let e = parseInt(n[1], 16), t = parseInt(n[2], 16);
|
|
12
|
+
return [
|
|
13
|
+
e >> 8,
|
|
14
|
+
e & 255,
|
|
15
|
+
t >> 8,
|
|
16
|
+
t & 255
|
|
17
|
+
].join(".");
|
|
18
|
+
}
|
|
19
|
+
return /^\d+\.\d+\.\d+\.\d+$/.test(t) ? t : void 0;
|
|
20
|
+
}, i = (n) => {
|
|
21
|
+
let r = t(n);
|
|
22
|
+
return e.some((e) => r === e || r.endsWith(`.${e}`));
|
|
23
|
+
}, a = (e) => {
|
|
24
|
+
if (i(e)) return !0;
|
|
25
|
+
let a = r(t(e));
|
|
26
|
+
return a !== void 0 && n.includes(a);
|
|
27
|
+
}, o = (e) => {
|
|
28
|
+
let t = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, n;
|
|
29
|
+
try {
|
|
30
|
+
n = new URL(t);
|
|
31
|
+
} catch {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (a(n.hostname)) throw Error(`fetch refuses FKN platform domains (${n.hostname})`);
|
|
35
|
+
}, s = /* @__PURE__ */ "autoplay.fullscreen.picture-in-picture.encrypted-media.screen-wake-lock.speaker-selection.captured-surface-control.camera.microphone.display-capture.geolocation.midi.usb.serial.hid.bluetooth.gamepad.keyboard-map.xr-spatial-tracking.accelerometer.gyroscope.magnetometer.ambient-light-sensor.compute-pressure.clipboard-read.clipboard-write.storage-access.window-management.local-fonts.idle-detection.web-share.sync-xhr.unload.payment.publickey-credentials-get.publickey-credentials-create.otp-credentials.identity-credentials-get.digital-credentials-get.local-network.local-network-access.loopback-network".split("."), c = () => {
|
|
36
|
+
try {
|
|
37
|
+
let e = globalThis.document?.featurePolicy?.features?.();
|
|
38
|
+
return e === void 0 ? void 0 : new Set(e);
|
|
39
|
+
} catch {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
}, l = (e = !0, t = c()) => [...s, ...e ? ["cross-origin-isolated"] : []].filter((e) => t === void 0 || t.has(e)).join("; "), u = "https://fkn.app", d = (e) => `${u}/api${e ? "?coi=1" : ""}`, f = `if (window.parent === window) {
|
|
43
|
+
const isolated = window.crossOriginIsolated === true
|
|
44
|
+
const known = document.featurePolicy?.features?.()
|
|
45
|
+
const frame = document.createElement('iframe')
|
|
46
|
+
frame.setAttribute('allow', ${JSON.stringify(s)}.concat(isolated ? ['cross-origin-isolated'] : []).filter(name => !known || known.includes(name)).join('; '))
|
|
47
|
+
frame.src = isolated ? ${JSON.stringify(d(!0))} : ${JSON.stringify(d(!1))}
|
|
48
|
+
frame.style.cssText = 'position:fixed!important;top:0!important;left:0!important;width:100%!important;height:100%!important;border:none!important;clip-path:inset(100%)!important'
|
|
49
|
+
document.body.appendChild(frame)
|
|
50
|
+
}`;
|
|
51
|
+
export { l as i, d as n, o as r, f as t };
|
package/broker-frame.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./broker-frame-CF4-yXtj.cjs");exports.brokerFrameScript=e.t,exports.brokerFrameSrc=e.n;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The broker frame's address. `/api?coi=1` is the variant that sends COEP and CORP, which a cross-origin isolated page needs to embed at all. */
|
|
2
|
+
export declare const brokerFrameSrc: (isolated: boolean) => string;
|
|
3
|
+
/**
|
|
4
|
+
* The source of an inline `<script>` that mounts fkn.app's broker frame while the page's html is
|
|
5
|
+
* parsed, for the start of `<body>`. `@fkn/lib` adopts the frame instead of mounting its own once
|
|
6
|
+
* the bundle runs, so the broker loads alongside the bundle rather than after it.
|
|
7
|
+
*
|
|
8
|
+
* It mounts the same frame the lib would (address, `allow` list, clipped out of view), and nothing
|
|
9
|
+
* in a framed page, which asks its parent for a broker first. Every step that fails leaves the
|
|
10
|
+
* mount to the lib, as without it.
|
|
11
|
+
*/
|
|
12
|
+
export declare const brokerFrameScript: string;
|
package/broker-frame.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as brokerFrameScript, n as brokerFrameSrc } from "./broker-frame-vjSpBa8d.js";
|