@fkn/lib 0.9.37 → 0.9.39
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/account.cjs +1 -1
- package/account.js +1 -1
- package/{api-CZI08srV.d.ts → api-BxXnHxbd.d.ts} +13 -7
- package/{api-CtiKFcK3.js → api-Dp-2AT3u.js} +84 -77
- package/api-jOTOA-5n.cjs +3 -0
- package/api.cjs +1 -1
- package/api.d.ts +2 -2
- package/api.js +1 -1
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.cjs +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fetch.js +1 -1
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.js +1 -1
- package/cloud/net.d.ts +1 -1
- package/{cloud-DCZv4XAf.d.ts → cloud-B8QYSmW3.d.ts} +3 -3
- package/cloud-BZIJFvPF.cjs +1 -0
- package/{cloud-EfyYfgVT.js → cloud-oMACx7NL.js} +75 -75
- package/cloud.cjs +1 -1
- package/cloud.d.ts +3 -3
- package/cloud.js +2 -2
- package/{contract-_nWuFitS.d.ts → contract-sDmsw-9f.d.ts} +72 -7
- package/contract.cjs +1 -1
- package/contract.d.ts +2 -2
- package/contract.js +6 -2
- package/dgram.cjs +1 -1
- package/dgram.d.ts +2 -2
- package/dgram.js +1 -1
- package/dns.cjs +1 -1
- package/dns.d.ts +1 -1
- package/dns.js +1 -1
- package/{extension-B7jDaJVp.cjs → extension-Bl5ZNj0d.cjs} +1 -1
- package/{extension-sNRjVbET.js → extension-ChZyZgAL.js} +3 -3
- package/{extension-CqOhrS15.d.ts → extension-DMU-CwMw.d.ts} +1 -1
- 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.js +1 -1
- package/{fs-D8RCGFNc.cjs → fs-CaQFRiIT.cjs} +1 -1
- package/{fs-BvNZePtN.js → fs-D3IsGdnN.js} +1 -1
- package/fs.cjs +1 -1
- package/fs.js +1 -1
- package/http.d.ts +1 -1
- package/{index-BUviSXsX.d.ts → index-D2CA-NX5.d.ts} +35 -3
- package/index.cjs +1 -1
- package/index.d.ts +4 -4
- package/index.js +5 -5
- package/{lib-FD1Ssqjt.js → lib-BlyFPeSv.js} +16 -11
- package/lib-tQKlXzhv.cjs +53 -0
- package/{net-eCY_QD4P.d.ts → net-Qmt9L_7t.d.ts} +2 -2
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +1 -1
- package/package.json +1 -1
- package/packages.cjs +1 -1
- package/packages.d.ts +1 -1
- package/packages.js +1 -1
- package/{proxy-CrTXoFQK.d.ts → proxy-CxRQLGNG.d.ts} +2 -2
- package/{proxy-DDwY3AVG.js → proxy-DMTdQ4dN.js} +1 -1
- package/{proxy-CYcaW5ew.cjs → proxy-DjoPtJH9.cjs} +1 -1
- package/rooms.cjs +1 -1
- package/rooms.d.ts +39 -8
- package/rooms.js +117 -95
- package/{storage-dSi2dUKx.cjs → storage-BJd-mWHE.cjs} +1 -1
- package/{storage-BbcnDCnc.js → storage-DSvL-t80.js} +1 -1
- package/api-Djf-XdZ4.cjs +0 -3
- package/cloud-Beg4iCRU.cjs +0 -1
- package/lib-DYKLnpWs.cjs +0 -53
package/rooms.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { c as t, l as n, o as r } from "./api-
|
|
2
|
+
import { c as t, l as n, o as r } from "./api-Dp-2AT3u.js";
|
|
3
3
|
import { t as i } from "./busy-B189uX--.js";
|
|
4
|
+
import { ROOM_TEMPORARY_MS as a } from "./contract.js";
|
|
4
5
|
//#region src/rooms.ts
|
|
5
|
-
var
|
|
6
|
-
available: () =>
|
|
7
|
-
create: () =>
|
|
8
|
-
join: () =>
|
|
9
|
-
open: () =>
|
|
10
|
-
}),
|
|
6
|
+
var o = /* @__PURE__ */ e({
|
|
7
|
+
available: () => g,
|
|
8
|
+
create: () => v,
|
|
9
|
+
join: () => y,
|
|
10
|
+
open: () => _
|
|
11
|
+
}), s = {
|
|
11
12
|
wrongKey: "rooms: wrong room key",
|
|
12
13
|
inviteNoKey: "rooms: the invite carries no key",
|
|
13
14
|
badName: "rooms: the name is not one a room can have",
|
|
@@ -34,6 +35,12 @@ var a = /* @__PURE__ */ e({
|
|
|
34
35
|
notClaimed: "rooms: the room is not claimed",
|
|
35
36
|
noMailbox: "rooms: the room keeps no messages",
|
|
36
37
|
badLimit: "rooms: the limit is out of range",
|
|
38
|
+
badDescription: "rooms: the description is not one a claim can carry",
|
|
39
|
+
notClaimer: "rooms: only the app that claimed the room can describe it",
|
|
40
|
+
notReleaser: "rooms: only the app that claimed the room can release it",
|
|
41
|
+
badTemporary: "rooms: the temporary duration is not one a claim can carry",
|
|
42
|
+
notTemporaryClaimer: "rooms: only the app that claimed the room can set when it expires",
|
|
43
|
+
temporaryUnavailable: "rooms: temporary claims are not available",
|
|
37
44
|
tooFast: "rooms: sending too fast",
|
|
38
45
|
tooLarge: "rooms: the message is too large",
|
|
39
46
|
unavailable: "rooms: rooms are unavailable",
|
|
@@ -42,76 +49,78 @@ var a = /* @__PURE__ */ e({
|
|
|
42
49
|
notJoined: "rooms: not joined",
|
|
43
50
|
malformed: "rooms: malformed frame",
|
|
44
51
|
ended: "rooms: the room has ended"
|
|
45
|
-
},
|
|
52
|
+
}, c = (e, t) => Object.assign(Error(t), { code: e }), l = (e) => e instanceof Error && typeof e.code == "string", u = {
|
|
46
53
|
send: !0,
|
|
47
54
|
receive: !0,
|
|
48
55
|
maxMessageBytes: 262144
|
|
49
|
-
},
|
|
56
|
+
}, d = async () => {
|
|
50
57
|
if (!t) return;
|
|
51
58
|
let e = (await r("a room").catch(() => void 0))?.rooms;
|
|
52
59
|
return typeof e?.open == "function" ? e : void 0;
|
|
53
|
-
},
|
|
54
|
-
throw
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}), C = (e) => {
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
}, f = () => {
|
|
61
|
+
throw c("unavailable", s.unavailable);
|
|
62
|
+
}, p = (e) => e === "blocked" ? "blocked" : e === "not-found" ? "ended" : "unavailable", m = (e) => {
|
|
63
|
+
if (e !== void 0 && e !== !1) return e === !0 ? a.default : typeof e != "number" || !Number.isInteger(e) ? null : e >= a.min && e <= a.max ? e : null;
|
|
64
|
+
}, h = async (e) => {
|
|
65
|
+
let t = e.invite, r = e, a = 0, o = e.self, d = e.owner, f = e.claimed, h = e.mailbox, g = await e.defaults().catch(() => u), _ = !1, v = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set(), b = i("room"), x = () => {}, S = () => {}, C = new Promise((e) => {
|
|
66
|
+
S = e;
|
|
67
|
+
}), w = (e) => {
|
|
68
|
+
let t = [...y];
|
|
69
|
+
y.clear();
|
|
61
70
|
for (let n of t) try {
|
|
62
71
|
n(e);
|
|
63
72
|
} catch {}
|
|
64
|
-
}, w = (e) => {
|
|
65
|
-
g || (g = !0, b(), _.clear(), y(), C(s("closed", o.ended)), x({ reason: e }));
|
|
66
73
|
}, T = (e) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
_ || (_ = !0, x(), v.clear(), b(), w(c("closed", s.ended)), S({ reason: e }));
|
|
75
|
+
}, E = (e) => {
|
|
76
|
+
if (!_) {
|
|
77
|
+
e.type === "defaults" && (g = e.defaults), e.type === "permissions" && e.id === o.id && (o = {
|
|
78
|
+
id: o.id,
|
|
70
79
|
permissions: e.permissions,
|
|
71
80
|
maxMessageBytes: e.maxMessageBytes
|
|
72
|
-
}), e.type === "claim" && (
|
|
73
|
-
for (let t of [...
|
|
81
|
+
}), e.type === "claim" && (f = e.claimed, d = e.owner, f || (h = null));
|
|
82
|
+
for (let t of [...v]) try {
|
|
74
83
|
t(e);
|
|
75
84
|
} catch {}
|
|
76
85
|
}
|
|
77
|
-
},
|
|
78
|
-
Promise.resolve(e.on(
|
|
79
|
-
t === a &&
|
|
86
|
+
}, D = (e, t) => {
|
|
87
|
+
Promise.resolve(e.on(E)).catch(() => {}), Promise.resolve(e.closed).then((e) => {
|
|
88
|
+
t === a && T(e.reason);
|
|
80
89
|
}, () => {});
|
|
81
|
-
},
|
|
82
|
-
if (typeof e?.join != "function") return
|
|
90
|
+
}, O = async (e, n) => {
|
|
91
|
+
if (typeof e?.join != "function") return T("unavailable");
|
|
83
92
|
let i = await e.join(t).catch(() => void 0);
|
|
84
|
-
if (
|
|
85
|
-
if (!i) return
|
|
86
|
-
if ("error" in i) return
|
|
87
|
-
if (i.self.id !==
|
|
88
|
-
r = i,
|
|
89
|
-
let
|
|
90
|
-
|
|
93
|
+
if (_ || n !== a) return;
|
|
94
|
+
if (!i) return T("unavailable");
|
|
95
|
+
if ("error" in i) return T(p(i.error));
|
|
96
|
+
if (i.self.id !== o.id) return Promise.resolve(i.leave()).catch(() => {}), T("unavailable");
|
|
97
|
+
r = i, o = i.self, d = i.owner, f = i.claimed, h = i.mailbox, D(i, n);
|
|
98
|
+
let s = await i.defaults().catch(() => void 0);
|
|
99
|
+
s && !_ && n === a && (g = s);
|
|
91
100
|
};
|
|
92
|
-
|
|
101
|
+
x = n((e, t) => {
|
|
93
102
|
let n = a;
|
|
94
|
-
a = t, !(
|
|
95
|
-
}),
|
|
96
|
-
let
|
|
97
|
-
if (
|
|
103
|
+
a = t, !(_ || n === 0 || n === t) && (w(c("unavailable", s.unavailable)), O(e.rooms, t));
|
|
104
|
+
}), D(e, a);
|
|
105
|
+
let k = async (e) => {
|
|
106
|
+
if (_) throw c("closed", s.ended);
|
|
98
107
|
let t = () => {}, n = new Promise((e, n) => {
|
|
99
108
|
t = n;
|
|
100
109
|
});
|
|
101
|
-
|
|
110
|
+
y.add(t);
|
|
102
111
|
try {
|
|
103
112
|
return await Promise.race([Promise.resolve(e(r)), n]);
|
|
104
113
|
} catch (e) {
|
|
105
|
-
throw
|
|
114
|
+
throw l(e) ? e : c("unavailable", s.unavailable);
|
|
106
115
|
} finally {
|
|
107
|
-
|
|
116
|
+
y.delete(t);
|
|
108
117
|
}
|
|
109
|
-
}, k = async (e) => {
|
|
110
|
-
let t = await O(e);
|
|
111
|
-
if ("error" in t) throw s(t.error, t.message);
|
|
112
118
|
}, A = async (e) => {
|
|
113
|
-
let t = await
|
|
114
|
-
if (
|
|
119
|
+
let t = await k(e);
|
|
120
|
+
if ("error" in t) throw c(t.error, t.message);
|
|
121
|
+
}, j = async (e) => {
|
|
122
|
+
let t = await k(e);
|
|
123
|
+
if (typeof t == "object" && t && "error" in t) throw c(t.error, t.message);
|
|
115
124
|
return t;
|
|
116
125
|
};
|
|
117
126
|
return {
|
|
@@ -120,68 +129,81 @@ var a = /* @__PURE__ */ e({
|
|
|
120
129
|
key: e.key,
|
|
121
130
|
invite: t,
|
|
122
131
|
get self() {
|
|
123
|
-
return
|
|
132
|
+
return o;
|
|
124
133
|
},
|
|
125
134
|
get owner() {
|
|
126
135
|
return d;
|
|
127
136
|
},
|
|
128
137
|
get claimed() {
|
|
129
|
-
return
|
|
138
|
+
return f;
|
|
130
139
|
},
|
|
131
140
|
get mailbox() {
|
|
132
|
-
return
|
|
141
|
+
return h;
|
|
133
142
|
},
|
|
134
|
-
defaults: () =>
|
|
135
|
-
members: () =>
|
|
136
|
-
send: (e) =>
|
|
137
|
-
edit: (e, t) =>
|
|
138
|
-
delete: (e, t) =>
|
|
139
|
-
backlog: (e, t) =>
|
|
140
|
-
setDefault: (e, t) =>
|
|
141
|
-
limit: (e, t) =>
|
|
142
|
-
grant: (e, t) =>
|
|
143
|
-
revoke: (e, t) =>
|
|
144
|
-
remove: (e) =>
|
|
145
|
-
block: (e) =>
|
|
146
|
-
unblock: (e) =>
|
|
147
|
-
claim:
|
|
148
|
-
|
|
143
|
+
defaults: () => g,
|
|
144
|
+
members: () => k((e) => e.members()),
|
|
145
|
+
send: (e) => A((t) => t.send(e)),
|
|
146
|
+
edit: (e, t) => A((n) => n.edit(e, t)),
|
|
147
|
+
delete: (e, t) => A((n) => n.delete(e, t)),
|
|
148
|
+
backlog: (e, t) => j((n) => n.backlog(e, t)),
|
|
149
|
+
setDefault: (e, t) => A((n) => n.setDefault(e, t)),
|
|
150
|
+
limit: (e, t) => A((n) => n.limit(e, t)),
|
|
151
|
+
grant: (e, t) => A((n) => n.grant(e, t)),
|
|
152
|
+
revoke: (e, t) => A((n) => n.revoke(e, t)),
|
|
153
|
+
remove: (e) => A((t) => t.remove(e)),
|
|
154
|
+
block: (e) => A((t) => t.block(e)),
|
|
155
|
+
unblock: (e) => A((t) => t.unblock(e)),
|
|
156
|
+
claim: async (e) => {
|
|
157
|
+
let t = e?.description;
|
|
158
|
+
if (t !== void 0 && typeof t != "string") throw c("invalid", s.badDescription);
|
|
159
|
+
let n = m(e?.temporary);
|
|
160
|
+
if (n === null) throw c("invalid", s.badTemporary);
|
|
161
|
+
let r = {
|
|
162
|
+
...t === void 0 ? {} : { description: t },
|
|
163
|
+
...n === void 0 ? {} : { temporary: n }
|
|
164
|
+
};
|
|
165
|
+
return Object.keys(r).length === 0 ? A((e) => e.claim()) : A((e) => {
|
|
166
|
+
if (n !== void 0 && e.temporaryClaims !== !0) throw c("unavailable", s.temporaryUnavailable);
|
|
167
|
+
return e.claim(r);
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
release: () => A((e) => e.release()),
|
|
149
171
|
usage: async () => {
|
|
150
|
-
let e = await
|
|
151
|
-
return
|
|
172
|
+
let e = await j((e) => e.usage());
|
|
173
|
+
return h = e, e;
|
|
152
174
|
},
|
|
153
|
-
on: async (e) =>
|
|
154
|
-
|
|
175
|
+
on: async (e) => _ ? () => {} : (v.add(e), () => {
|
|
176
|
+
v.delete(e);
|
|
155
177
|
}),
|
|
156
178
|
leave: async () => {
|
|
157
|
-
await Promise.resolve(r.leave()).catch(() => {}),
|
|
179
|
+
await Promise.resolve(r.leave()).catch(() => {}), T("left");
|
|
158
180
|
},
|
|
159
|
-
closed:
|
|
181
|
+
closed: C
|
|
160
182
|
};
|
|
161
|
-
},
|
|
162
|
-
let e = await
|
|
183
|
+
}, g = async () => {
|
|
184
|
+
let e = await d();
|
|
163
185
|
return e ? e.available().catch(() => !1) : !1;
|
|
164
|
-
}, h = async (e, t) => {
|
|
165
|
-
if (typeof e != "string" || e.length === 0 || e.length > 72) throw s("invalid", o.badName);
|
|
166
|
-
let n = await u();
|
|
167
|
-
if (!n) throw s("unavailable", o.unavailable);
|
|
168
|
-
let r = await n.open(e, t).catch(d);
|
|
169
|
-
if ("error" in r) throw s(r.error, r.message);
|
|
170
|
-
return p(r);
|
|
171
|
-
}, g = async (e) => {
|
|
172
|
-
let t = await u();
|
|
173
|
-
if (!t) throw s("unavailable", o.unavailable);
|
|
174
|
-
let n = await t.create(e).catch(d);
|
|
175
|
-
if ("error" in n) throw s(n.error, n.message);
|
|
176
|
-
return p(n);
|
|
177
186
|
}, _ = async (e, t) => {
|
|
187
|
+
if (typeof e != "string" || e.length === 0 || e.length > 72) throw c("invalid", s.badName);
|
|
188
|
+
let n = await d();
|
|
189
|
+
if (!n) throw c("unavailable", s.unavailable);
|
|
190
|
+
let r = await n.open(e, t).catch(f);
|
|
191
|
+
if ("error" in r) throw c(r.error, r.message);
|
|
192
|
+
return h(r);
|
|
193
|
+
}, v = async (e) => {
|
|
194
|
+
let t = await d();
|
|
195
|
+
if (!t) throw c("unavailable", s.unavailable);
|
|
196
|
+
let n = await t.create(e).catch(f);
|
|
197
|
+
if ("error" in n) throw c(n.error, n.message);
|
|
198
|
+
return h(n);
|
|
199
|
+
}, y = async (e, t) => {
|
|
178
200
|
let n = typeof e == "string" ? e.indexOf(".") : -1;
|
|
179
|
-
if (n <= 0 || n === e.length - 1) throw
|
|
180
|
-
let r = await
|
|
181
|
-
if (!r) throw
|
|
182
|
-
let i = await r.join(e, t).catch(
|
|
183
|
-
if ("error" in i) throw
|
|
184
|
-
return
|
|
201
|
+
if (n <= 0 || n === e.length - 1) throw c("invalid", s.inviteNoKey);
|
|
202
|
+
let r = await d();
|
|
203
|
+
if (!r) throw c("unavailable", s.unavailable);
|
|
204
|
+
let i = await r.join(e, t).catch(f);
|
|
205
|
+
if ("error" in i) throw c(i.error, i.message);
|
|
206
|
+
return h(i);
|
|
185
207
|
};
|
|
186
208
|
//#endregion
|
|
187
|
-
export {
|
|
209
|
+
export { g as available, v as create, y as join, _ as open, o as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-jOTOA-5n.cjs"),n=require("./messages.cjs");var r=e.t({StorageLockedError:()=>i,StorageNotFoundError:()=>a,availability:()=>p,available:()=>c,encryption:()=>x,isNotFound:()=>o,list:()=>m,quota:()=>h,readFile:()=>g,readFileSealed:()=>v,remove:()=>b,unlock:()=>S,writeFile:()=>y}),i=class extends Error{code=`FKN_E2E_LOCKED`;constructor(){super(`storage locked: connect the app again to open encrypted data`)}},a=class extends Error{code=n.STORAGE_NOT_FOUND;constructor(e=`storage: no object at that path`){super(e)}},o=e=>e?.code===n.STORAGE_NOT_FOUND,s=e=>{throw e instanceof Error&&e.message.startsWith(`fkn:e2e-locked`)?new i:o(e)||e instanceof Error&&(/^not found$/i.test(e.message)||/\(404\)$/.test(e.message))?new a(e.message):e},c=()=>t.a.then(e=>e.cloud.fs.available()).catch(()=>!1),l=8e3,u=1e3,d=!1,f=async()=>{let e=(await t.a).cloud.fs;return typeof e.availability==`function`?e.availability():await e.available()?`connected`:`disconnected`},p=async()=>{let e=d?u:l,t=await new Promise(t=>{let n=setTimeout(()=>t(`timeout`),e);f().then(e=>{clearTimeout(n),t(e)},()=>{clearTimeout(n),t(`unknown`)})});return t===`timeout`?(d=!0,`unknown`):(d=!1,t)},m=()=>t.a.then(e=>e.cloud.fs.list()),h=()=>t.a.then(e=>e.cloud.fs.quota()),g=async e=>{let n=await(await t.a).cloud.fs.readFile(e).catch(s);return new Blob([n])},_=e=>{if(e===null||!Number.isFinite(e))return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString()},v=async e=>{let n=(await t.a).cloud.fs;if(typeof n.readFileSealed!=`function`)return{data:await n.readFile(e).catch(s),sealedAt:null};let r=await n.readFileSealed(e).catch(s);return{data:r.bytes,sealedAt:_(r.sealedAt)}},y=async(e,n,r)=>{let i=await t.a,a=n instanceof Blob?new Uint8Array(await n.arrayBuffer()):n;await i.cloud.fs.writeFile(e,a,r?.contentType??null).catch(s)},b=e=>t.a.then(t=>t.cloud.fs.remove(e)).then(()=>void 0),x=()=>t.a.then(e=>e.cloud.fs.encryption()),S=()=>t.a.then(e=>e.cloud.fs.unlock());Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return b}});
|
package/api-Djf-XdZ4.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
let e=require("osra");var t=1e4,n=16,r=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}},i=(e,i=t)=>new Promise(t=>{if(r(e))return t();let a=()=>{clearInterval(o),clearTimeout(s),e.removeEventListener(`load`,a),t()},o=setInterval(()=>{r(e)&&a()},n),s=setTimeout(a,i);e.addEventListener(`load`,a)}),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=>{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`,`normal`),t.setProperty(`z-index`,`2147483647`),e.setAttribute(`title`,`FKN`)},d=({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`},f=()=>c&&l,p=({x:e,y:t,width:n,height:r})=>[[e,t],[e+n,t],[e+n,t+r],[e,t+r],[e,t]],ee=e=>{let t=e[0];if(!t)return[];let n=p(t)[0],r=[];return e.forEach((t,i)=>{r.push(...p(t)),i>0&&i<e.length-1&&r.push(n)}),r},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)=>{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})`},g=(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?h(r,n):l&&e.length<=5&&!e.some(e=>e.radius)?m(e):`path('${e.map(d).join(``)}')`},_=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}},te=(e,t,n)=>t>=e.x&&t<e.x+e.width&&n>=e.y&&n<e.y+e.height,ne=16,v=(e,t,n)=>t===1?e*ne:t===2?e*n:e,y=(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},re=(e,t,n)=>{for(let r=e;r;r=r.parentElement)if(y(r,t,n))return r;return document.scrollingElement},b=null,x=null,S=e=>({width:e.offsetWidth||window.innerWidth,height:e.offsetHeight||window.innerHeight}),C=e=>{if(!x||!b||!te(x,e.clientX,e.clientY))return;let t=document.elementFromPoint(e.clientX,e.clientY);if(!t||t===b)return;let n=v(e.deltaX,e.deltaMode,window.innerWidth),r=v(e.deltaY,e.deltaMode,window.innerHeight),i=re(t,n,r);i&&(i.scrollBy({left:n,top:r,behavior:`instant`}),e.cancelable&&e.preventDefault())},ie=e=>{let t=x!==null;x=e,t!==(e!==null)&&(e?window.addEventListener(`wheel`,C,{capture:!0,passive:!1}):window.removeEventListener(`wheel`,C,{capture:!0}))},w=0,ae=e=>{if(e===w)return;w=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`))},T=(e,{modal:t,rects:n,inset:r},i)=>{if(ae(r),!c){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=g(n,t,i),o=a===`none`||CSS.supports(`clip-path`,a)?a:`inset(100%)`;e.style.setProperty(`clip-path`,o,`important`),ie(t||o!==a?null:_(n))},oe=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),s)},se=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},ce=(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=se(e.radius);return{x:c,y:l,width:u-c,height:d-l,...f?{radius:f}:{}}},E={"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`},le=e=>Array.isArray(e)?e.slice(0,o).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 E)||r!==`full`&&r!==`liveness`?[]:[{kind:t,cause:n,level:r}]}):[],D=new Set,ue=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: ${E[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,a):[]).map(e=>ce(e,t)).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:n.modal===!0,rects:r,hidden:le(n.hidden),inset:oe(n.inset)}},k=()=>b!==null,A=null,j=null,M=()=>{if(!b||A===null)return;let e=S(b),t=O(A,e);t&&T(b,t,e)},N=e=>{typeof ResizeObserver<`u`&&(j??=new ResizeObserver(M),j.disconnect(),j.observe(e))},P=e=>{u(e),T(e,{modal:!1,rects:[],hidden:[],inset:0},S(e)),b=e,N(e)},F=e=>{if(!b)return;let t=S(b),n=O(e,t);n&&(A=e,T(b,n,t),ue(n.hidden))},I=[`fkn.app`,`fkn.dev`,`sdbx.app`],L=e=>e.replace(/\.+$/,``),R=e=>{let t=L(e);return I.some(e=>t===e||t.endsWith(`.${e}`))},z=e=>{let t=typeof e==`string`?e:e instanceof URL?e.href:e.url,n;try{n=new URL(t)}catch{return}if(R(n.hostname))throw Error(`fetch refuses FKN platform domains (${n.hostname})`)},B=`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(`.`),V=(e=!0)=>[...B,...e?[`cross-origin-isolated`]:[]].join(`; `),H=`https://fkn.app`,U=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,W=typeof globalThis<`u`&&globalThis.crossOriginIsolated===!0,G=`${H}/api${W?`?coi=1`:``}`,de=`fkn-api-port`,fe=`fkn-api-port-ack`,pe=2e3,me=()=>{if(!U||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===fe&&r(t.port1)},a=setTimeout(()=>r(void 0),pe);t.port1.addEventListener(`message`,i),t.port1.start();try{e.postMessage({type:de},H,[t.port2])}catch{r(void 0)}})},K,he=()=>{if(K||!U)return K;let e=U.querySelector(`iframe[src="${G}"]`);if(e)K=e;else{let e=U.createElement(`iframe`);e.setAttribute(`allow`,V(W)),e.src=G,U.body.appendChild(e),K=e}return P(K),K},q=(async()=>{if(!U)return;let e=await me();if(e)return{receive:e,emit:e};let t=he();if(!t)return;await i(t);let n=t.contentWindow;return n?{receive:window,emit:n}:void 0})(),ge=e=>{let t,n=()=>{},r=new Promise(e=>{n=e}),i=new Set,a=new Set,o=0,s=0;(async()=>{for await(let r of e){let e=(t?.epoch??0)+1;t={remote:r,epoch:e},e===1&&n(r);let o=[...a];a.clear();let s=Error(`FKN: the broker was replaced while this call was pending; retry it`);for(let e of o)try{e(s)}catch{}for(let t of[...i])try{t(r,e)}catch{}}})().catch(()=>{});let c=async(e,n)=>{let i=t?.remote??await r;for(let t of e.slice(0,-1))i=i[t];let c=i[e[e.length-1]??``];o=Date.now(),s+=1;let l=()=>{},u=new Promise((e,t)=>{l=t});a.add(l);try{return await Promise.race([Promise.resolve(c.apply(i,n)),u])}finally{--s,a.delete(l),o=Date.now()}},l=new Map,u=e=>{let n=e.join(`\0`),r=l.get(n);if(r)return r;let i=new Proxy(function(){},{get:(n,r)=>{if(typeof r!=`string`||r===`then`)return;let i=t;if(i){let t=i.remote;for(let n of e)t=t?.[n];if(t?.[r]===void 0)return}return u([...e,r])},apply:(t,n,r)=>c(e,r)});return l.set(n,i),i};return{facade:u([]),first:r.then(()=>{}),current:()=>t,onEpoch:e=>{if(i.add(e),t)try{e(t.remote,t.epoch)}catch{}return()=>{i.delete(e)}},lastCall:()=>o,inFlight:()=>s}},_e=typeof window<`u`||typeof self<`u`,ve=async()=>{if(typeof window<`u`)return q;if(typeof self<`u`)return{receive:self,emit:self}},J=ge({async*[Symbol.asyncIterator](){let t=await ve();if(!t){await new Promise(()=>{});return}yield*(0,e.expose)({},{key:`fkn-api`,transport:t})}}),Y=J.first.then(()=>J.facade),X=8e3,ye=1e3,Z=!1,Q=class extends Error{constructor(e,t){super(`@fkn/lib: no broker connection within ${t}ms, so ${e} could not be requested`),this.name=`BrokerUnreachableError`}},be=e=>{let t=Z?ye:X;return Promise.race([Y,new Promise((n,r)=>setTimeout(()=>{Z=!0,r(new Q(e,t))},t))])},$=J.onEpoch,xe=J.current,Se=J.lastCall,Ce=J.inFlight;$(e=>{k()&&e.overlay.setHost(F,{exactClips:f()}).catch(()=>{})}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return q}});
|
package/cloud-Beg4iCRU.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-DYKLnpWs.cjs"),n=require("./hosts-9dYv63ud.cjs"),r=require("./api-Djf-XdZ4.cjs"),i=require("./busy-Dv8wzE5M.cjs"),a=require("./proxy-CYcaW5ew.cjs"),o=require("./attach-policy.cjs"),s=require("./contract.cjs"),c=require("./dns.cjs"),l=require("./cloud/fs.cjs"),u=require("./net.cjs"),d=require("./dgram.cjs"),f=require("./http.cjs");let p=require("osra");var m=async()=>{let e=()=>r.o(`frame consent`);try{let t=await e();return{request:typeof t.frameConsent.request==`function`?t.frameConsent.request:void 0,ensure:t.frameConsent.ensure}}catch(t){if(!(t instanceof r.n))throw t;return{request:void 0,ensure:t=>e().then(e=>e.frameConsent.ensure(t))}}},h=3e4,g=()=>t.S(`frame.evaluate: the code did not settle within ${h}ms`,`evaluate`),_=`frame: this frame no longer holds the document the app attached it to`,v=!1,y=()=>{v||(v=!0,console.warn(`[fkn-frame] this FKN broker is too old to ask for permission categories, so nothing was asked for upfront and each capability is asked for as it is first used. Reloading the page picks up the current broker.`))},b=e=>[...e].flatMap(e=>{try{return[new URL(e).hostname]}catch{return[]}}),x=(e,t,n)=>n===null?`frame.${e}: the user did not grant ${t} here`:`frame.${e}: the user did not grant ${t} on ${n}`,S=e=>{let{assertLive:r,attach:i,current:a,declaredHosts:s,documentHost:c,ensure:l,request:u,session:d,approvedOrigins:f}=e,p=new Set,m=async()=>c?await c():(()=>{try{return new URL(a()).hostname}catch{return``}})(),h=()=>n.t([...s,...b(f)]),g=async e=>(await u([e]))[0]??!1;return{gate:async({operation:e,args:a,phase:c})=>{r();let v=n.m(e,a);if(v===null)return;let y=t.u(v);if(y===void 0||y===`auto`)return;if(e===`fetch`){let e=o.frameFetchVerdict({session:d,declaredHosts:s,approvedOrigins:f},c===`ensure`?void 0:a[0],{classifier:`fetchTarget`});if(c===`ensure`&&!d)throw t.C(e.kind===`refuse`?e.reason:``,`fetch`);if(c!==`ensure`&&e.kind===`refuse`)throw t.C(e.reason,`fetch`);if(!u){if(e.kind===`refuse`)throw t.C(e.reason,`fetch`);if(!await l({scope:n.c(a[0],a[1]).scope,hosts:e.promptHosts}))throw t.C(`frame.fetch: the user did not grant this`,`fetch`);return}let r=e.kind===`consent`?e.targetHost:await m(),i=n.t([r,...s]);if(!i.length)throw t.C(`frame: navigate the frame before fetch`,`fetch`);if(await g({category:`network`,hosts:i})===!1)throw t.C(x(`fetch`,`network`,r||null),`fetch`);return}let b=await m();if(!b)throw t.C(`frame: navigate the frame before ${e}`,e);if(!h().includes(b))throw t.C(_,e);if(!u)return;let S=t.l(v);if(S===void 0||y===`critical`&&p.has(`${v} ${b}`))return;let C=n.t([b,...s]),w=await g(y===`critical`?{key:v,hosts:C,attach:i}:{category:S,hosts:C});if(w===!1)throw t.C(x(e,S,null),e);if(w===`once`&&c!==`ensure`)for(let e of C)p.add(`${v} ${e}`)},requestCategories:async e=>{r();let a=await m(),o=n.t(a?[a,...s]:s);if(!o.length)throw TypeError(`frame.request: navigate the frame or declare domains first`);let c=e.map(e=>{let n=e.key;return{named:n,critical:n!==void 0&&t.u(n)===`critical`,category:e.category??(n===void 0?void 0:t.c(n))??`interaction`}}),l=({named:e,critical:t,category:n},r)=>({category:n,...t?{key:e}:{},hosts:o,allow:r});if(!u)return y(),c.map(e=>l(e,!1));let d=await u(c.map(({named:e,critical:t,category:n})=>t?{key:e,hosts:o,attach:i}:{category:n,hosts:o}));return c.map((e,t)=>l(e,d[t]!==void 0&&d[t]!==!1))},boundary:h}},C=e=>e,w=5e3,T=new Set([]),E=()=>`https://fkn.app`,D=e=>e?``:`incognito-${crypto.randomUUID()}`,O=(e,t,n)=>{let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(typeof n==`string`?Error(n):n()),t)});return Promise.race([e,i]).finally(()=>clearTimeout(r))},k=e=>Object.assign(Error(e),{name:t.b}),A=`frame.postMessage: this FKN page predates frame messaging; reload the app to load the current one`,j=!1,M=()=>{j||(j=!0,console.warn(`[fkn-frame] this FKN page predates frame messaging, so the page's messages and documents are never reported. Reloading the app loads the current one.`))},N=({from:e,origin:t,attach:n,signal:r})=>i=>{let a=r=>{if(r.source===null||r.source!==e()||r.origin!==t)return;let a=r.data;typeof a==`object`&&a&&a.type===`fkn-frame-message`&&a.attach===n&&typeof a.origin==`string`&&(a.kind===`message`?i({type:`message`,data:a.data,origin:a.origin,ports:r.ports}):a.kind===`document`&&i({type:`document`,origin:a.origin}))};return window.addEventListener(`message`,a,{signal:r}),()=>window.removeEventListener(`message`,a)},P=({control:e,target:n,session:r,declaredHosts:i,approvedOrigins:a,attach:o,assertLive:s,guard:c,consent:l,onNavigated:u,relay:d})=>{let f=n,p=Promise.resolve(),{gate:m,requestCategories:v,boundary:y}=S({session:r,declaredHosts:i,approvedOrigins:a,attach:o,assertLive:s,documentHost:typeof e.documentHost==`function`?()=>c(()=>e.documentHost()):void 0,current:()=>f,...l});return t.m({executor:{execute:(n,r,i)=>T.has(r)?Promise.reject(t.T(r,`cloud`)):(s(),c(()=>e.executeLocator(n,r,i))),highlight:async()=>{}},gate:m,request:v,evaluate:async(t,n)=>(s(),await m({parts:[],operation:`evaluate`,args:[t,n],phase:`execute`}),O(c(()=>e.executeLocator([],`evaluate`,[t,n])),h,g)),postMessage:(n,r,i)=>{if(s(),typeof e.messaging!=`function`)throw t.E(A,`postMessage`,`cloud`);if(r!==`*`&&!y().includes(new URL(r).hostname))throw t.C(_,`postMessage`);let{port1:a,port2:o}=new MessageChannel;a.postMessage({data:n,transfer:i},i);let l=[o,r],u=p.then(async()=>(await m({parts:[],operation:`postMessage`,args:l,phase:`execute`}),{answer:c(()=>e.executeLocator([],`postMessage`,l))}));return p=u.catch(()=>{}),u.then(async({answer:e})=>{await e})},listen:t=>(typeof e.messaging!=`function`&&M(),d(t)),goto:async(t,n={})=>{let r=new URL(t,location.href).href;s();let{timeoutMs:i}=n,o=(()=>{try{return new URL(r).origin}catch{return``}})(),l=o!==``&&!a.has(o);l&&a.add(o);try{await O(c(()=>e.goto(r,n)),(i??3e4)+w,`cloud.attachFrame: the render proxy did not answer goto; the frame may have been detached or its page reloaded`)}catch(e){throw l&&a.delete(o),e}f=r,u()},url:()=>f})},F=250,I=500,L=65e3,R=2e3,z=2e3,B=2,ee=2e3,te=2e3,ne=({origin:e,target:t,session:n,domains:r,attach:i})=>{let a=new URL(`/attach-window`,e);return a.searchParams.set(`attach`,i),t&&a.searchParams.set(`url`,t),n&&a.searchParams.set(`session`,n),r.length&&a.searchParams.set(`domains`,r.join(`,`)),a.href},re=(e,t)=>{let n=document.createElement(`iframe`),r=new URL(`/attach-jar`,e);return r.searchParams.set(`attach`,t),n.src=r.href,n.tabIndex=-1,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`style`,`display:none`),(document.body??document.documentElement).appendChild(n),n},V=(e,t)=>{let n=new MutationObserver(()=>{e.isConnected||t.aborted||(n.disconnect(),console.warn(`cloud.attachFrame: the window's jar anchor was removed from this page, so a sign-in in the window no longer reaches this app's cookie jar`))});e.parentNode&&n.observe(e.parentNode,{childList:!0}),n.observe(document.documentElement,{childList:!0}),t.addEventListener(`abort`,()=>n.disconnect(),{once:!0})},H=()=>k(`cloud.attachFrame: the attached window closed, reloaded or left the page FKN attached; attach a fresh window`),U=()=>k(`cloud.attachFrame: the attached window stopped answering; attach a fresh window`),W=()=>k(`cloud.attachFrame: the window went away before it connected; attach a fresh window`),G=()=>k(`cloud.attachFrame: the window closed before it connected. Either the user closed it, or this page's Cross-Origin-Opener-Policy cut its link to the window`),K=async e=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);let{domains:r=[],syncCookies:a=!0,permissions:o}=e,{url:c,width:l,height:u}=t.s(e.window);if(window.origin===`null`)throw new t.f(`opaque-opener`);let d=E(),f=crypto.randomUUID(),m=D(a),h=n.t(r),g=new Set;c&&g.add(new URL(c).origin);let _=a?re(d,f):null,v=window.open(ne({origin:d,target:c,session:m,domains:h,attach:f}),`_blank`,`popup,width=${l},height=${u}`);if(!v)throw _?.remove(),new t.d;let y=new AbortController,b=!1,x=null,S=(e,t=!1)=>{if(x===null){x=e,y.abort(t?U():H());try{v.closed||v.postMessage({type:s.ATTACH_WINDOW_MESSAGE.detach,attach:f,...t?{unanswered:t}:{}},d)}catch{}_&&setTimeout(()=>_.remove(),te)}};_&&V(_,y.signal);let w=new Promise((e,t)=>{y.signal.addEventListener(`abort`,()=>t(y.signal.reason),{once:!0})});w.catch(()=>{});let T=w.then(()=>{},()=>{}),k=()=>{if(y.signal.aborted)throw y.signal.reason},A=e=>y.signal.aborted?Promise.reject(y.signal.reason):Promise.race([e(),w]),j=e=>e.source===v&&e.origin===d;window.addEventListener(`message`,e=>{if(!j(e))return;let n=e.data;typeof n==`object`&&n&&n.attach===f&&(n.type===s.ATTACH_WINDOW_MESSAGE.refused?S(new t.f(n.reason)):n.type===s.ATTACH_WINDOW_MESSAGE.gone&&S(b?H():W()))},{signal:y.signal}),window.addEventListener(`pagehide`,()=>S(H()),{signal:y.signal});let M=()=>{try{v.postMessage({type:s.ATTACH_WINDOW_MESSAGE.hello,attach:f},d)}catch{}};M();let K=setInterval(M,F),q=setInterval(()=>{v.closed&&S(b?H():G())},I);y.signal.addEventListener(`abort`,()=>{clearInterval(K),clearInterval(q)},{once:!0});let J=async e=>{try{return await Promise.race([e,w])}catch(e){throw x??e}};try{let e=await J(O((0,p.expose)({},{key:s.ATTACH_WINDOW_KEY,transport:{emit:(e,t)=>v.postMessage(e,d,t??[]),receive:e=>{let t=t=>{j(t)&&e(t.data,{source:t.source,origin:t.origin})};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)}},unregisterSignal:y.signal,revivableModules:C(t.nt)}),s.WINDOW_HANDSHAKE_TIMEOUT_MS,`cloud.attachFrame: timed out connecting to the window`));b=!0,clearInterval(K);let n=0,r=setInterval(()=>{O(A(()=>e.ping()),z,`ping`).then(()=>{n=0},()=>{y.signal.aborted||(document.visibilityState===`hidden`?n=0:++n>=B&&S(U(),!0))})},R);y.signal.addEventListener(`abort`,()=>clearInterval(r),{once:!0}),await J(O(e.ready(),L,`cloud.attachFrame: the window never became ready`));let a=i.t(`attached frame`);y.signal.aborted?a():y.signal.addEventListener(`abort`,a,{once:!0});let l=P({control:e,target:c,session:m,declaredHosts:h,approvedOrigins:g,attach:f,assertLive:k,guard:A,consent:{request:t=>A(()=>e.requestConsent(t)),ensure:t=>A(()=>e.requestConsent([t])).then(([e])=>e!==void 0&&e!==!1)},onNavigated:()=>{},relay:N({from:()=>v,origin:d,attach:f,signal:y.signal})}),u=null,_=Object.assign(l,{close:()=>u??=(async()=>{y.signal.aborted||await O(Promise.allSettled([A(()=>e.flushCookies()),A(()=>e.sweepStorage())]),ee,`close`).catch(()=>{});try{v.close()}catch{}S(H())})(),closed:T});return o?.length&&await J(_.request(o)),_}catch(e){let n=x??e;if(!(n instanceof t.f))try{v.close()}catch{}throw S(n),n}},q=`autoplay; fullscreen; encrypted-media; picture-in-picture; clipboard-read; clipboard-write`,J=2e4,Y=65e3,ie=e=>!e||e===`about:blank`,ae=({target:e,session:t,domains:n,attach:r})=>{let i=new URL(`/attach-frame`,E());return e&&i.searchParams.set(`url`,e),t&&i.searchParams.set(`session`,t),n.length&&i.searchParams.set(`domains`,n.join(`,`)),i.searchParams.set(`attach`,r),i.href},oe=(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())},se=()=>k(`cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe`),ce=(e,t)=>{let n=[...e.split(`;`),...t.split(`;`)].map(e=>e.trim()).filter(Boolean);return[...new Set(n)].join(`; `)},le=[300,1200,4e3],X=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 le)setTimeout(t,e)},ue=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`)},de=async({iframe:e,domains:r=[],syncCookies:a=!0,lockdown:o=!1,permissions:c})=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);if(o)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`);ue(e);let l=e.getAttribute(`src`)??``,u=(()=>{if(ie(l))return null;try{return new URL(e.src||l,location.href)}catch{throw Error(`cloud.attachFrame: the iframe src is not a valid URL: ${l}`)}})();if(u){let e=new URL(`/attach-frame`,E());if(u.origin===e.origin&&u.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 d=u?.href??``;d&&t.g(d);let f=D(a),h=n.t(r),g=new Set;try{g.add(new URL(d).origin)}catch{}let _=new AbortController,v=e.referrerPolicy,y=e.allow,b=crypto.randomUUID();if(e.referrerPolicy=`origin`,e.allow=ce(q,e.allow),e.src=ae({target:d,session:f,domains:h,attach:b}),!e.contentWindow)throw Error(`cloud.attachFrame: the iframe window is not available`);try{let n=await O((0,p.expose)({},{key:s.ATTACH_FRAME_KEY,origin:E(),transport:{receive:window,emit:e.contentWindow},unregisterSignal:_.signal,revivableModules:C(t.nt)}),J,`cloud.attachFrame: timed out connecting to the render proxy page`);await O(n.ready(),Y,`cloud.attachFrame: the render proxy never became ready`),d&&X(e),oe(e,()=>_.abort());let r=i.t(`attached frame`);_.signal.aborted?r():_.signal.addEventListener(`abort`,r,{once:!0});let a=e.contentWindow,o=P({control:n,target:d,session:f,declaredHosts:h,approvedOrigins:g,attach:b,assertLive:()=>{if(_.signal.aborted||!e.isConnected||e.contentWindow!==a)throw _.abort(),se()},guard:e=>e(),consent:await m(),onNavigated:()=>X(e),relay:N({from:()=>a,origin:E(),attach:b,signal:_.signal})});return c?.length&&await o.request(c),o}catch(t){throw _.abort(),e.referrerPolicy=v,e.allow=y,e.src=d||`about:blank`,t}},Z=(async e=>t.o(e)===`window`?K(e):de(e)),fe=()=>typeof window<`u`&&!0,Q=async()=>{let e=await r.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}},pe=e.t({attachFrame:()=>Z,available:()=>$,dgram:()=>d.t,dns:()=>c.t,fetch:()=>a.t,fs:()=>l.t,http:()=>f.t,net:()=>u.t,quota:()=>Q}),$=()=>r.c;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
|
package/lib-DYKLnpWs.cjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./hosts-9dYv63ud.cjs");let n=require("osra");var r=(e,t)=>{let n=new EventTarget,r=new Map,i=EventTarget.prototype.addEventListener.bind(n),a=EventTarget.prototype.removeEventListener.bind(n);return Object.defineProperty(n,"addEventListener",{configurable:!0,value:(a,o,s)=>{if(o!==null){if(!r.has(a)){let i=r=>{n.dispatchEvent(new CustomEvent(a,{detail:t(r,e),bubbles:r.bubbles,cancelable:r.cancelable,composed:r.composed}))};e.addEventListener(a,i),r.set(a,i)}i(a,o,s)}}}),Object.defineProperty(n,"removeEventListener",{configurable:!0,value:(t,n,i)=>{if(n===null)return;a(t,n,i);let o=r.get(t);o&&(e.removeEventListener(t,o),r.delete(t))}}),n},i=e=>typeof e==`boolean`?+!!e:+!!e?.capture,a=e=>{let t=new WeakMap;return{addEventListener:(n,r,a)=>{if(r===null)return;let o=`${n}|${i(a)}`,s=t.get(r);if(s||(s=new Map,t.set(r,s)),s.has(o))return;let c=typeof a==`object`&&!!a&&!!a.once,l=t=>{c&&s.delete(o);let i=e.unenrich(t,n);typeof r==`function`?r.call(e.target,i):r.handleEvent(i)};s.set(o,l),e.remoteEvents.addEventListener(n,l,a)},removeEventListener:(n,r,a)=>{if(r===null)return;let o=`${n}|${i(a)}`,s=t.get(r),c=s?.get(o);c&&(e.remoteEvents.removeEventListener(n,c,a),s.delete(o))},dispatchEvent:t=>e.remoteEvents.dispatchEvent(t)}},o=e.t({box:()=>x,createVideoElementHandle:()=>b,isType:()=>ne,revive:()=>S,type:()=>s}),s=`videoElement`,c=[`currentTime`,`volume`,`muted`,`playbackRate`,`src`,`loop`,`autoplay`,`preload`,`poster`,`disableRemotePlayback`],l=[`duration`,`paused`,`ended`,`seeking`,`readyState`,`currentSrc`],u=[`buffered`,`seekable`],d=Symbol.for(`fkn.remoteVideoElement`),f=Symbol.for(`fkn.remoteVideoElement.state`),p=Symbol.for(`fkn.remoteVideoElement.controller`),m=e=>e?Array.from({length:e.length},(t,n)=>[e.start(n),e.end(n)]):[],h=e=>{let t={};for(let n of[...c,...l])t[n]=e[n];for(let n of u)t[n]=m(e[n]);return t.error=e.error?{code:e.error.code,message:e.error.message}:null,t},g=e=>{let t=t=>{if(!Number.isInteger(t)||t<0||t>=e.length)throw new DOMException(`Index or size is negative or greater than the allowed amount`,`IndexSizeError`)};return{get length(){return e.length},start(n){return t(n),e[n][0]},end(n){return t(n),e[n][1]}}},ee=e=>e?{code:e.code,message:e.message,MEDIA_ERR_ABORTED:1,MEDIA_ERR_NETWORK:2,MEDIA_ERR_DECODE:3,MEDIA_ERR_SRC_NOT_SUPPORTED:4}:null,_=e=>r(e,(e,t)=>({originalDetail:e instanceof CustomEvent?e.detail:null,snapshot:h(t)})),v=async(e,t)=>{switch(t){case`play`:return await e.play(),null;case`pause`:return e.pause(),null;case`load`:return e.load(),null;case`requestPictureInPicture`:if(typeof e.requestPictureInPicture!=`function`)throw Error(`requestPictureInPicture is not supported in this environment`);return await e.requestPictureInPicture(),null;case`exitPictureInPicture`:{let t=e.ownerDocument;if(typeof t?.exitPictureInPicture!=`function`)throw Error(`exitPictureInPicture is not supported in this environment`);return await t.exitPictureInPicture(),null}default:throw Error(`videoElement: unknown method "${t}"`)}},te=e=>({call:async t=>v(e,t),set:async(t,n)=>{try{e[t]=n}catch{}return h(e)},events:_(e)}),y=(e,t)=>{let n=new EventTarget;Object.defineProperty(n,d,{value:!0}),Object.defineProperty(n,f,{value:e}),Object.defineProperty(n,p,{value:t});let r=a({target:n,remoteEvents:t.events,unenrich:(t,n)=>{if(!(t instanceof CustomEvent))return t;let r=t.detail;if(!r||!(`snapshot`in r))return t;Object.assign(e,r.snapshot);let i={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed};return r.originalDetail===null?new Event(n,i):new CustomEvent(n,{...i,detail:r.originalDetail})}}),i={addEventListener:{configurable:!0,value:r.addEventListener},removeEventListener:{configurable:!0,value:r.removeEventListener},dispatchEvent:{configurable:!0,value:r.dispatchEvent},error:{configurable:!0,enumerable:!0,get(){return ee(e.error)}},play:{configurable:!0,value:()=>t.call(`play`,[])},pause:{configurable:!0,value:()=>{t.call(`pause`,[]).catch(()=>{})}},load:{configurable:!0,value:()=>{t.call(`load`,[]).catch(()=>{})}},requestPictureInPicture:{configurable:!0,value:()=>t.call(`requestPictureInPicture`,[])},exitPictureInPicture:{configurable:!0,value:()=>t.call(`exitPictureInPicture`,[])},HAVE_FUTURE_DATA:{enumerable:!0,value:3},HAVE_ENOUGH_DATA:{enumerable:!0,value:4}};for(let n of c)i[n]={configurable:!0,enumerable:!0,get(){return e[n]},set(r){e[n]=r,t.set(n,r).then(t=>{Object.assign(e,t)},()=>{})}};for(let t of l)i[t]={configurable:!0,enumerable:!0,get(){return e[t]}};for(let t of u)i[t]={configurable:!0,enumerable:!0,get(){return g(e[t])}};return Object.defineProperties(n,i),n},b=e=>y(h(e),te(e)),ne=e=>typeof e==`object`&&!!e&&e[d]===!0,x=(e,t)=>{let r=e;return{...n.BoxBase,type:s,initialState:r[f],controller:(0,n.recursiveBox)(r[p],t)}},S=(e,t)=>{let r=(0,n.recursiveRevive)(e.controller,t);return y({...e.initialState},r)},C=e=>[o,...e],re=3,ie=0,ae=`fknExtension`,oe=`fknExtensionAbi`,se=`fknExtensionOps`,ce=[`data-fkn-extension`,`data-fkn-extension-abi`,`data-fkn-extension-ops`],le=e=>{if(e===void 0)return 0;let t=Number(e);return Number.isInteger(t)&&t>=0?t:0},ue=e=>e===void 0?null:e.split(`,`).map(e=>e.trim()).filter(Boolean),de=(e,t=0)=>{if(e.fknExtension!==`true`)return{status:`absent`};let n=le(e[oe]),r=ue(e[se]);return n<t?{status:`outdated`,abi:n,required:t,operations:r}:{status:`ok`,abi:n,operations:r}},fe=(e,t)=>e.status===`ok`?e.operations===null||e.operations.includes(t):!1,pe=(e,t)=>e.status===`ok`&&e.operations!==null&&e.operations.includes(t),w=class extends Error{abi;required;name=`ExtensionOutdatedError`;constructor(e,t){super(`The FKN WebExtension is installed but too old for this page: it speaks ABI ${e} and this page needs at least ${t}. Updating the extension fixes this.`),this.abi=e,this.required=t}},T=class extends Error{operation;abi;name=`ExtensionOperationUnsupportedError`;constructor(e,t,n){super(n??`The FKN WebExtension does not support "${e}" (ABI ${t}). Updating the extension may add it.`),this.operation=e,this.abi=t}},me=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,he=ae,ge=(0,n.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(me,()=>{ge.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:_e()}}))});var _e=()=>typeof document>`u`?!1:document.documentElement.dataset[he]===`true`,E=()=>typeof document>`u`?{status:`absent`}:de(document.documentElement.dataset),D=null,ve=e=>{D=e},ye=150,O=(e=1e3)=>new Promise((t,n)=>{let r=()=>E().status===`ok`;if(r())return t();let i,a=e=>{clearTimeout(i),c.disconnect(),document.removeEventListener(`readystatechange`,l),e()},o=()=>a(async()=>{let e=E();if(e.status===`outdated`)return n(new w(e.abi,e.required));if(D){if(await D().catch(()=>{}),r())return t();let e=E();if(e.status===`outdated`)return n(new w(e.abi,e.required))}n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),s=()=>{clearTimeout(i),i=setTimeout(()=>r()?a(t):o(),ye)},c=new MutationObserver(()=>{r()&&a(t)}),l=()=>{document.readyState===`complete`&&!r()&&s()};if(i=setTimeout(o,e),c.observe(document.documentElement,{attributes:!0,attributeFilter:[...ce]}),document.addEventListener(`readystatechange`,l),document.readyState===`complete`)return s();r()&&a(t)}),be,k=new Proxy({},{get:(e,t)=>async(...e)=>{await O(),be??=(0,n.expose)({},{transport:window,revivableModules:C});let r=(await be)[t];return r(...e)}}),xe=[`origin`,`referer`,`cookie`],Se=(e,t)=>(e??[]).some(([e,n])=>e.trim().toLowerCase()===t&&n!==``),Ce=e=>Se(e,`cookie`),we=(e,t)=>{if(t===`include`&&Ce(e))throw Error(`fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other`)},Te=e=>{let t=[...new Set((e??[]).map(([e])=>e.trim().toLowerCase()).filter(e=>!xe.includes(e)))];if(t.length)throw Error(`fetch: refusing to forge request header(s): ${t.join(`, `)}`)},Ee=[`fkn.app`,`fkn.dev`,`sdbx.app`],De=e=>e.replace(/\.+$/,``),Oe=e=>{let t=De(e);return Ee.some(e=>t===e||t.endsWith(`.${e}`))},ke={scope:`network.fetch`,category:`network`,severity:0,title:`Fetch data from other sites`,description:`Lets the app download public data from other websites directly, past the usual cross-origin limits.`},Ae={scope:`network.fetchCredentialed`,category:`network`,severity:3,chip:`load as you`,unsafe:!0,title:`Fetch from other sites, signed in as you`,description:`Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see.`},je={scope:`network.fetchLocal`,category:`network`,severity:3,chip:`local network`,unsafe:!0,title:`Access devices on your local network`,description:`Lets the app reach devices and services on your home or work network, which websites normally cannot touch.`},Me=e=>{let t=e.match(/^(\d+)\.(\d+)\.\d+\.\d+$/);if(!t)return!1;let[n,r]=[Number(t[1]),Number(t[2])];return n===10||n===127||n===0||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168},Ne=e=>{let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.replace(/^\[|\]$/g,``).toLowerCase().replace(/\.$/,``);return n===`localhost`||n.endsWith(`.localhost`)||n.endsWith(`.local`)||n.endsWith(`.internal`)||n.endsWith(`.home.arpa`)?!0:n.includes(`:`)?n===`::`||n===`::1`||n.startsWith(`fc`)||n.startsWith(`fd`)||/^fe[89ab]/.test(n)||n.startsWith(`::ffff:`):Me(n)},Pe=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||Oe(t.hostname)},Fe=e=>{if(Pe(e))throw Error(`fetch: refusing to target the extension's own pages or FKN platform domains`)},Ie=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=xe.map(e=>{let n=t.get(e);return n===null||n===``?void 0:[e,n]}).filter(e=>e!==void 0);return n.length?n:void 0},Le=async(e,t)=>{let n=new Request(e,t);Fe(n.url);let r=n.body?await n.arrayBuffer():null;return k.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:Ie(t),reason:t?.reason,signal:t?.signal??void 0})},Re={scope:`network.readCookie`,category:`network`,severity:3,chip:`read cookie`,unsafe:!0,title:`Read a site’s cookie`,description:`Lets the app read a named cookie from another site, which can include the login token only that site should see.`},ze={get:e=>k.getCookie(e)},Be={scope:`network.modifyRequestHeaders`,category:`network`,severity:2,chip:`rewrite headers`,unsafe:!0,title:`Rewrite request headers to other sites`,description:`Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites.`},Ve=e=>k.setRequestHeaderRule(e),He=e=>k.removeRequestHeaderRule({ruleId:e}),Ue=class extends Error{reason;filename;line;column;source;constructor(e,t,n,r,i){super(`${e}:${n}:${r}: ${t}`),this.reason=t,this.filename=e,this.line=n,this.column=r,this.source=i}},We=class{start;end;source;constructor(e,t,n){this.start=e,this.end=t,this.source=n}},A;(function(e){e.stylesheet=`stylesheet`,e.rule=`rule`,e.declaration=`declaration`,e.comment=`comment`,e.atRule=`at-rule`,e.container=`container`,e.charset=`charset`,e.counterStyle=`counter-style`,e.document=`document`,e.customMedia=`custom-media`,e.fontFace=`font-face`,e.fontFeatureValues=`font-feature-values`,e.host=`host`,e.import=`import`,e.keyframes=`keyframes`,e.keyframe=`keyframe`,e.layer=`layer`,e.media=`media`,e.namespace=`namespace`,e.page=`page`,e.pageMarginBox=`page-margin-box`,e.positionTry=`position-try`,e.property=`property`,e.scope=`scope`,e.startingStyle=`starting-style`,e.supports=`supports`,e.viewTransition=`view-transition`})(A||={});var Ge=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);if(e[o]!==`\\`)return o;r=o+2,i--}while(i>0);throw Error(`Too many escaping`)},j=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`(`,r)),n.push(e.indexOf(`"`,r)),n.push(e.indexOf(`'`,r)),n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);switch(e[o]){case`\\`:r=o+2;break;case`(`:{let t=j(e,[`)`],o+1);if(t===-1)return-1;r=t+1}break;case`"`:{let t=Ge(e,[`"`],o+1);if(t===-1)return-1;r=t+1}break;case`'`:{let t=Ge(e,[`'`],o+1);if(t===-1)return-1;r=t+1}break;default:return o}i--}while(i>0);throw Error(`Too many escaping`)},M=/\/\*[^]*?(?:\*\/|$)/g;function N(e){return e?e.trim():``}function P(e,t){let n=e&&typeof e.type==`string`,r=n?e:t;for(let t in e){let n=e[t];Array.isArray(n)?n.forEach(e=>{P(e,r)}):n&&typeof n==`object`&&P(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var Ke=class{level=0;indentation=` `;compress=!1;constructor(e){typeof e?.indent==`string`&&(this.indentation=e?.indent),e?.compress&&(this.compress=!0)}emit(e,t){return e}indent(e){return this.level=this.level||1,e?(this.level+=e,``):Array(this.level).join(this.indentation)}visit(e){switch(e.type){case A.stylesheet:return this.stylesheet(e);case A.rule:return this.rule(e);case A.declaration:return this.declaration(e);case A.comment:return this.comment(e);case A.container:return this.container(e);case A.charset:return this.charset(e);case A.counterStyle:return this.counterStyle(e);case A.document:return this.document(e);case A.customMedia:return this.customMedia(e);case A.fontFace:return this.fontFace(e);case A.fontFeatureValues:return this.fontFeatureValues(e);case A.host:return this.host(e);case A.import:return this.import(e);case A.keyframes:return this.keyframes(e);case A.keyframe:return this.keyframe(e);case A.layer:return this.layer(e);case A.media:return this.media(e);case A.namespace:return this.namespace(e);case A.page:return this.page(e);case A.pageMarginBox:return this.pageMarginBox(e);case A.positionTry:return this.positionTry(e);case A.property:return this.property(e);case A.scope:return this.scope(e);case A.startingStyle:return this.startingStyle(e);case A.supports:return this.supports(e);case A.viewTransition:return this.viewTransition(e);case A.atRule:return this.genericAtRule(e)}}mapVisit(e,t){let n=``;t||=``;for(let r=0,i=e.length;r<i;r++)n+=this.visit(e[r]),t&&r<i-1&&(n+=this.emit(t));return n}compile(e){return this.compress?e.stylesheet.rules.map(this.visit,this).join(``):this.stylesheet(e)}stylesheet(e){return this.mapVisit(e.stylesheet.rules,`
|
|
2
|
-
|
|
3
|
-
`)}comment(e){return this.compress?this.emit(``,e.position):this.emit(`${this.indent()}/*${e.comment}*/`,e.position)}container(e){return this.compress?this.emit(`@container ${e.container}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@container ${e.container}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
4
|
-
|
|
5
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}layer(e){return this.compress?this.emit(`@layer ${e.layer}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`):this.emit(`${this.indent()}@layer ${e.layer}`,e.position)+(e.rules?this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
6
|
-
|
|
7
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`):`;`)}import(e){return this.emit(`@import ${e.import};`,e.position)}media(e){return this.compress?this.emit(`@media ${e.media}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@media ${e.media}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
8
|
-
|
|
9
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}document(e){let t=`@${e.vendor||``}document ${e.document}`;return this.compress?this.emit(t,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(t,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
10
|
-
|
|
11
|
-
`)+this.emit(`${this.indent(-1)}\n}`)}charset(e){return this.emit(`@charset ${e.charset};`,e.position)}namespace(e){return this.emit(`@namespace ${e.namespace};`,e.position)}startingStyle(e){return this.compress?this.emit(`@starting-style`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@starting-style`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
12
|
-
|
|
13
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}supports(e){return this.compress?this.emit(`@supports ${e.supports}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@supports ${e.supports}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
14
|
-
|
|
15
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}keyframes(e){return this.compress?this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.keyframes)+this.emit(`}`):this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.keyframes,`
|
|
16
|
-
`)+this.emit(`${this.indent(-1)}}`)}keyframe(e){let t=e.declarations;return this.compress?this.emit(e.values.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`):this.emit(this.indent())+this.emit(e.values.join(`, `),e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(t,`
|
|
17
|
-
`)+this.emit(`${this.indent(-1)}\n${this.indent()}}\n`)}page(e){if(this.compress){let t=e.selectors.length?e.selectors.join(`, `):``;return this.emit(`@page ${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`)}let t=e.selectors.length?`${e.selectors.join(`, `)} `:``;return this.emit(`@page ${t}`,e.position)+this.emit(`{
|
|
18
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
19
|
-
`)+this.emit(this.indent(-1))+this.emit(`
|
|
20
|
-
}`)}pageMarginBox(e){return this.compress?this.emit(`@${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`${this.indent()}@${e.name} `,e.position)+this.emit(`{
|
|
21
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
22
|
-
`)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}fontFace(e){return this.compress?this.emit(`@font-face`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@font-face `,e.position)+this.emit(`{
|
|
23
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
24
|
-
`)+this.emit(this.indent(-1))+this.emit(`
|
|
25
|
-
}`)}host(e){return this.compress?this.emit(`@host`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`@host`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
26
|
-
|
|
27
|
-
`)+this.emit(`${this.indent(-1)}\n}`)}customMedia(e){return this.emit(`@custom-media ${e.name} ${e.media};`,e.position)}property(e){return this.compress?this.emit(`@property ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@property ${e.name} `,e.position)+this.emit(`{
|
|
28
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
29
|
-
`)+this.emit(this.indent(-1))+this.emit(`
|
|
30
|
-
}`)}counterStyle(e){return this.compress?this.emit(`@counter-style ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@counter-style ${e.name} `,e.position)+this.emit(`{
|
|
31
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
32
|
-
`)+this.emit(this.indent(-1))+this.emit(`
|
|
33
|
-
}`)}fontFeatureValues(e){return this.compress?this.emit(`@font-feature-values ${e.fontFamily}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@font-feature-values ${e.fontFamily}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
34
|
-
|
|
35
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}scope(e){let t=e.scope?` ${e.scope}`:``;return this.compress?this.emit(`@scope${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@scope${t}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
36
|
-
|
|
37
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}viewTransition(e){return this.compress?this.emit(`@view-transition`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@view-transition `,e.position)+this.emit(`{
|
|
38
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
39
|
-
`)+this.emit(this.indent(-1))+this.emit(`
|
|
40
|
-
}`)}positionTry(e){return this.compress?this.emit(`@position-try ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@position-try ${e.name} `,e.position)+this.emit(`{
|
|
41
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
42
|
-
`)+this.emit(this.indent(-1))+this.emit(`
|
|
43
|
-
}`)}genericAtRule(e){let t=e.prelude?` ${e.prelude}`:``;if(this.compress)return this.emit(`@${e.name}${t}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`);if(!e.rules)return this.emit(`${this.indent()}@${e.name}${t};`,e.position);let n=e.rules.some(e=>e.type!==A.declaration&&e.type!==A.comment),r=n?`
|
|
44
|
-
|
|
45
|
-
`:`
|
|
46
|
-
`;return this.emit(`${this.indent()}@${e.name}${t}`,e.position)+this.emit(n?` {\n${this.indent(1)}`:` {
|
|
47
|
-
`)+this.emit(n?``:this.indent(1))+this.mapVisit(e.rules,r)+this.emit(n?`\n${this.indent(-1)}${this.indent()}}`:`${this.indent(-1)}\n${this.indent()}}`)}rule(e){let t=e.declarations;if(!t.length)return``;if(this.compress)return this.emit(e.selectors.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`);let n=this.indent();return this.emit(e.selectors.map(e=>n+e).join(`,
|
|
48
|
-
`),e.position)+this.emit(` {
|
|
49
|
-
`)+this.emit(this.indent(1))+this.mapVisit(t,`
|
|
50
|
-
`)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}declaration(e){return this.compress?this.emit(`${e.property}:${e.value}`,e.position)+this.emit(`;`):e.property===`grid-template-areas`?this.emit(this.indent())+this.emit(e.property+`: `+e.value.split(`
|
|
51
|
-
`).join(`
|
|
52
|
-
`.padEnd(22)+this.indent()),e.position)+this.emit(`;`):this.emit(this.indent())+this.emit(`${e.property}: ${e.value}`,e.position)+this.emit(`;`)}},qe=(e,t)=>{t||={};let n=1,r=1;function i(){let e={line:n,column:r};return i=>(i.position=new We(e,{line:n,column:r},t?.source||``),u(),i)}let a=[];function o(i){let o=new Ue(t?.source||``,i,n,r,e);if(!t?.silent)throw o;a.push(o)}function s(){let t=/^{\s*/.exec(e);return!!t&&(l(t),!0)}function c(){let t=/^}/.exec(e);return!!t&&(l(t),!0)}function l(t){let i=t[0];return function(e){let t=e.match(/\n/g);t&&(n+=t.length);let i=e.lastIndexOf(`
|
|
53
|
-
`);r=~i?e.length-i:r+e.length}(i),e=e.slice(i.length),t}function u(){let t=/^\s*/.exec(e);t&&l(t)}function d(e){e||=[];let t=f();for(;t;)e.push(t),t=f();return e}function f(){let t=i();if(e.charAt(0)!==`/`||e.charAt(1)!==`*`)return;let n=/^\/\*[^]*?\*\//.exec(e);return n?(l(n),t({type:A.comment,comment:n[0].slice(2,-2)})):o(`End of comment missing`)}function p(){let t=j(e,[`{`]);if(t===-1||t===0)return;let n=e.substring(0,t);return l([n]),((e,t)=>{let n=[],r=0;for(;r<e.length;){let i=j(e,t,r);if(i===-1)return n.push(e.substring(r)),n;n.push(e.substring(r,i)),r=i+1}return n})(N(n).replace(M,``),[`,`]).map(e=>N(e))}function m(){let t=i(),n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);if(!n)return;l(n);let r=N(n[0]),a=/^:\s*/.exec(e);if(!a)return o(`property missing ':'`);l(a);let s=``,c=j(e,[`;`,`}`]);c!==-1&&(s=e.substring(0,c),l([s]),s=N(s).replace(M,``));let u=t({type:A.declaration,property:r.replace(M,``),value:s}),d=/^[;\s]*/.exec(e);return d&&l(d),u}function h(){let n=[];if(!s())return o(`missing '{'`);d(n);let r=m();for(;r;)n.push(r),d(n),r=m();for(;t?.silent&&e.length&&e.charAt(0)!==`}`;){let t=e.indexOf(`;`),i=e.indexOf(`}`);if(t===-1||!(i===-1||t<i))break;for(l([e.substring(0,t+1)]),u(),d(n),r=m();r;)n.push(r),d(n),r=m()}return c()?n:o(`missing '}'`)}function g(){let t=j(e,[`{`]);if(t===-1)return!1;let n=j(e,[`;`]),r=j(e,[`}`]);return!(n!==-1&&n<t)&&!(r!==-1&&r<t)}function ee(){let n=[];if(!s())return o(`missing '{'`);for(d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=S();if(e){n.push(e),d(n);continue}}if(g()){let e=C();if(e){n.push(e),d(n);continue}}let r=m();if(!r){if(t?.silent){let t=e.indexOf(`;`),r=e.indexOf(`}`);if(t!==-1&&(r===-1||t<r)){l([e.substring(0,t+1)]),u(),d(n);continue}}break}n.push(r),d(n)}return c()?n:o(`missing '}'`)}function _(){let n=[];for(u(),d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=S();if(e){n.push(e),d(n);continue}}if(g()){let e=C();if(e){n.push(e),d(n);continue}}let r=m();if(!r){if(t?.silent){let t=e.indexOf(`;`),r=e.indexOf(`}`);if(t!==-1&&(r===-1||t<r)){l([e.substring(0,t+1)]),u(),d(n);continue}}break}n.push(r),d(n)}return n}function v(){let t=[],n=i(),r=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);for(;r;){let n=l(r);t.push(n[1]);let i=/^,\s*/.exec(e);i&&l(i),r=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e)}if(t.length)return n({type:A.keyframe,values:t,declarations:h()||[]})}let te=RegExp(`^@(${[`top-left-corner`,`top-left`,`top-center`,`top-right`,`top-right-corner`,`bottom-left-corner`,`bottom-left`,`bottom-center`,`bottom-right`,`bottom-right-corner`,`left-top`,`left-middle`,`left-bottom`,`right-top`,`right-middle`,`right-bottom`].join(`|`)})(?![\\w-])\\s*`),y=x(`import`),b=x(`charset`),ne=x(`namespace`);function x(t){let n=RegExp(`^@`+t+`\\s*((?::?[^;'"]|"(?:\\\\"|[^"])*?"|'(?:\\\\'|[^'])*?')+)(?:;|$)`);return()=>{let r=i(),a=n.exec(e);if(!a)return;let o=l(a),s={type:t};return s[t]=o[1].trim(),r(s)}}function S(){if(e[0]===`@`)return function(){let t=i(),n=/^@([-\w]+)?keyframes\s*/.exec(e);if(!n)return;let r=l(n)[1],a=/^([-\w]+)\s*/.exec(e);if(!a)return o(`@keyframes missing name`);let u=l(a)[1];if(!s())return o(`@keyframes missing '{'`);let f=d(),p=v();for(;p;)f.push(p),f=f.concat(d()),p=v();return c()?t({type:A.keyframes,name:u,vendor:r,keyframes:f}):o(`@keyframes missing '}'`)}()||function(){let t=i(),n=/^@media *([^{]+)/.exec(e);if(!n)return;let r=N(l(n)[1]);if(!s())return o(`@media missing '{'`);let a=_();return c()?t({type:A.media,media:r,rules:a}):o(`@media missing '}'`)}()||function(){let t=i(),n=/^@custom-media\s+(--\S+)\s+([^{;\s][^{;]*);/.exec(e);if(!n)return;let r=l(n);return t({type:A.customMedia,name:N(r[1]),media:N(r[2])})}()||function(){let t=i(),n=/^@supports *([^{]+)/.exec(e);if(!n)return;let r=N(l(n)[1]);if(!s())return o(`@supports missing '{'`);let a=_();return c()?t({type:A.supports,supports:r,rules:a}):o(`@supports missing '}'`)}()||y()||b()||ne()||function(){let t=i(),n=/^@([-\w]+)?document *([^{]+)/.exec(e);if(!n)return;let r=l(n),a=N(r[1]),u=N(r[2]);if(!s())return o(`@document missing '{'`);let d=_();return c()?t({type:A.document,document:u,vendor:a,rules:d}):o(`@document missing '}'`)}()||function(){let t=i(),n=/^@page */.exec(e);if(!n)return;l(n);let r=p()||[];if(!s())return o(`@page missing '{'`);let a=[];for(d(a);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=S();if(e){a.push(e),d(a);continue}}let t=m();if(!t)break;a.push(t),d(a)}return c()?t({type:A.page,selectors:r,declarations:a}):o(`@page missing '}'`)}()||function(){let t=i(),n=/^@host\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@host missing '{'`);let r=_();return c()?t({type:A.host,rules:r}):o(`@host missing '}'`)}()||function(){let t=i(),n=/^@font-face\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@font-face missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:A.fontFace,declarations:r}):o(`@font-face missing '}'`)}()||function(){let t=i(),n=/^@font-feature-values\s+([^{]+)/.exec(e);if(!n)return;let r=N(l(n)[1]);if(!s())return o(`@font-feature-values missing '{'`);let a=_();return c()?t({type:A.fontFeatureValues,fontFamily:r,rules:a}):o(`@font-feature-values missing '}'`)}()||function(){let t=i(),n=/^@container *([^{]+)/.exec(e);if(!n)return;let r=N(l(n)[1]);if(!s())return o(`@container missing '{'`);let a=_();return c()?t({type:A.container,container:r,rules:a}):o(`@container missing '}'`)}()||function(){let t=i(),n=/^@starting-style\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@starting-style missing '{'`);let r=_();return c()?t({type:A.startingStyle,rules:r}):o(`@starting-style missing '}'`)}()||function(){let t=i(),n=/^@layer *([^{;@]+)/.exec(e);if(!n)return;let r=N(l(n)[1]);if(!s()){let n=/^[;\s]*/.exec(e);return n&&l(n),t({type:A.layer,layer:r})}let a=_();return c()?t({type:A.layer,layer:r,rules:a}):o(`@layer missing '}'`)}()||function(){let t=i(),n=/^@property\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@property missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:A.property,name:r,declarations:a}):o(`@property missing '}'`)}()||function(){let t=i(),n=/^@counter-style\s+([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@counter-style missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:A.counterStyle,name:r,declarations:a}):o(`@counter-style missing '}'`)}()||function(){let t=i(),n=/^@scope\s*([^{]*)/.exec(e);if(!n)return;let r=N(l(n)[1]);if(!s())return o(`@scope missing '{'`);let a=_();return c()?t({type:A.scope,scope:r,rules:a}):o(`@scope missing '}'`)}()||function(){let t=i(),n=/^@view-transition\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@view-transition missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:A.viewTransition,declarations:r}):o(`@view-transition missing '}'`)}()||function(){let t=i(),n=/^@position-try\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@position-try missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:A.positionTry,name:r,declarations:a}):o(`@position-try missing '}'`)}()||function(){let t=i(),n=te.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@${r} missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:A.pageMarginBox,name:r,declarations:a}):o(`@${r} missing '}'`)}()||function(){let t=i(),n=/^@([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1],a=``,u=j(e,[`{`,`;`]);if(u!==-1&&u>0&&(a=N(e.substring(0,u)),l([e.substring(0,u)])),s()){let e=_();return c()?t({type:A.atRule,name:r,prelude:a,rules:e}):o(`@${r} missing '}'`)}let d=/^[;\s]*/.exec(e);return d&&l(d),t({type:A.atRule,name:r,prelude:a})}()}function C(){let e=i(),t=p();return t?(d(),e({type:A.rule,selectors:t,declarations:ee()||[]})):o(`selector missing`)}return P(function(){let n=function(){let n,r=[];for(u(),d(r);e.length;){if(e.charAt(0)===`}`){if(t?.silent){o(`extra '}'`),l([`}`]),u(),d(r);continue}break}if(n=S()||C(),!n){if(t?.silent){l([e.charAt(0)]),u(),d(r);continue}break}r.push(n),d(r)}return r}();return{type:A.stylesheet,stylesheet:{source:t?.source,rules:n,parsingErrors:a}}}())},Je=(e,t)=>new Ke(t||{}).compile(e),Ye=Object.defineProperty,Xe=(e,t)=>{let n={};for(var r in e)Ye(n,r,{get:e[r],enumerable:!0});return t||Ye(n,Symbol.toStringTag,{value:`Module`}),n},Ze=`LocatorError`,F=`LocatorUnsupportedError`,I=`LocatorDeniedError`,Qe=`LocatorInvalidError`,L=e=>typeof e==`object`&&e?e.name:void 0,R=e=>Object.assign(Error(e),{name:Ze}),z=(e,t=``,n)=>Object.assign(Error(e),{name:F,operation:t,backend:n}),$e=(e,t)=>z(`Locator operation not supported${t?` on the ${t} backend`:``}: ${e}`,e,t),B=(e,t)=>Object.assign(Error(e),{name:I,operation:t}),V=(e,t)=>Object.assign(Error(e),{name:Qe,operation:t}),et=e=>L(e)===F,tt=e=>L(e)===I,nt=e=>L(e)===Qe,rt=e=>tt(e)||et(e)||nt(e),H=e=>{let t=(e.ownerDocument??e).defaultView;if(!t)throw R(`the resolved element belongs to a document with no window`);return t},it=(e,t)=>{let n=e?.[t];return typeof n==`function`?n:null},U=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=(()=>{try{return it(H(e),t)}catch{return null}})();if(n&&e instanceof n)return n;let r=it(globalThis,t);return r&&e instanceof r?r:null},W=(e,t)=>U(e,t)!==null,G=e=>{if(e.length===0)throw R(`No elements found`);if(e.length>1)throw R(`Strict mode violation: locator resolved to ${e.length} elements`);return e[0]},at=(e,t)=>{if(!W(e,t))throw R(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);return e},ot=e=>e.tagName.toLowerCase(),st=new Set,ct=e=>{st.add(e)},lt=/(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i,ut=e=>e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\(.)/g,`$1`),dt=e=>!lt.test(ut(e.value)),ft=new Set([A.import,A.fontFace,A.namespace,A.charset,A.document,A.comment]),pt=e=>{if(ft.has(e.type))return null;if(e.type===A.declaration)return dt(e)?e:null;let t=e,n={...t};for(let e of[`declarations`,`rules`,`keyframes`]){let r=t[e];Array.isArray(r)&&(n[e]=mt(r))}return n},mt=e=>e.map(e=>pt(e)).filter(e=>e!==null),ht=e=>{let t;try{t=qe(e,{silent:!0})}catch{return``}return t.stylesheet.rules=mt(t.stylesheet.rules),Je(t)},gt=(e,t)=>{let n=()=>{t.parentNode||(e.head??e.documentElement).appendChild(t)};if(n(),e.readyState===`complete`)return;let r=new MutationObserver(e=>{for(let r of e)for(let e of r.removedNodes)if(e===t||e.contains?.(t)){n();return}});r.observe(e.documentElement,{childList:!0,subtree:!0});let i=()=>r.disconnect(),a=e.defaultView;a?a.addEventListener(`load`,i,{once:!0}):setTimeout(i,3e4)},_t={resolve:(e,t)=>{let n=e.document.createElement(`style`);n.textContent=t.noSanitize?t.content:ht(t.content);try{gt(e.document,n)}catch(e){console.error(e)}ct(n)}},vt=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},K={kind:`frame`,ensureArgs:e=>[void 0,e],resolve:async(e,t,n={})=>{if(typeof t!=`string`)throw V(`fetch: url must be a string`,`fetch`);let r=H(e.document),i;try{i=new r.URL(t,e.document.baseURI).href}catch{throw V(`fetch: not a valid url: ${t}`,`fetch`)}let a=await r.fetch(i,{method:n.method??`GET`,headers:n.headers,body:n.body??null,redirect:n.redirect??`follow`,credentials:n.credentials??`include`});return{status:a.status,statusText:a.statusText,ok:a.ok,url:a.url,redirected:a.redirected,type:a.type,headers:vt(a.headers),body:await a.arrayBuffer()}}},q=Xe({click:()=>bt,count:()=>Ot,exists:()=>kt,fill:()=>wt,getAttribute:()=>Et,hover:()=>xt,isVisible:()=>Dt,textContent:()=>Tt}),yt=(e,t)=>{let n=e.getBoundingClientRect();return{clientX:n.left+n.width*(t?.x??.5),clientY:n.top+n.height*(t?.y??.5)}},bt={resolve:(e,t={})=>{let n=G(e.elements),r=H(n),i={bubbles:!0,cancelable:!0,composed:!0,...yt(n,t.position),button:0},a={...i,pointerType:`mouse`,pointerId:1,isPrimary:!0};n.dispatchEvent(new r.PointerEvent(`pointerdown`,{...a,buttons:1})),n.dispatchEvent(new r.MouseEvent(`mousedown`,{...i,buttons:1})),n.dispatchEvent(new r.PointerEvent(`pointerup`,{...a,buttons:0})),n.dispatchEvent(new r.MouseEvent(`mouseup`,{...i,buttons:0})),n.dispatchEvent(new r.MouseEvent(`click`,{...i,buttons:0}))}},xt={resolve:(e,t={})=>{let n=G(e.elements),r=H(n),i={bubbles:!0,cancelable:!0,composed:!0,...yt(n,t.position)},a={...i,pointerType:`mouse`,pointerId:1,isPrimary:!0};n.dispatchEvent(new r.PointerEvent(`pointerover`,a)),n.dispatchEvent(new r.PointerEvent(`pointerenter`,{...a,bubbles:!1})),n.dispatchEvent(new r.MouseEvent(`mouseenter`,{...i,bubbles:!1})),n.dispatchEvent(new r.MouseEvent(`mouseover`,i)),n.dispatchEvent(new r.PointerEvent(`pointermove`,a)),n.dispatchEvent(new r.MouseEvent(`mousemove`,i))}},St=(e,t)=>{e._valueTracker?.setValue(``);let n=(U(e,`HTMLTextAreaElement`)??U(e,`HTMLInputElement`))?.prototype,r=n&&Object.getOwnPropertyDescriptor(n,`value`)?.set;r?r.call(e,t):e.value=t},Ct=(e,t)=>{if(e.type!==`range`)return null;let n=Number(e.min||0),r=Number(e.max||100);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=n)return null;let i=Number(t);if(!Number.isFinite(i))return null;let a=Math.max(0,Math.min(1,(i-n)/(r-n))),o=e.getBoundingClientRect(),s={bubbles:!0,cancelable:!0,composed:!0,clientX:o.left+o.width*a,clientY:o.top+o.height/2,button:0},c={...s,pointerType:`mouse`,pointerId:1,isPrimary:!0};return{pointerDown:{...c,buttons:1},pointerUp:{...c,buttons:0},mouseDown:{...s,buttons:1},mouseUp:{...s,buttons:0}}},wt={resolve:(e,t,n={})=>{let r=G(e.elements),i=H(r),a=W(r,`HTMLInputElement`);if(a||W(r,`HTMLTextAreaElement`)){let e=r,n=a?Ct(e,t):null;n&&(r.dispatchEvent(new i.PointerEvent(`pointerdown`,n.pointerDown)),r.dispatchEvent(new i.MouseEvent(`mousedown`,n.mouseDown))),St(e,t),r.dispatchEvent(new i.Event(`input`,{bubbles:!0})),n&&(r.dispatchEvent(new i.PointerEvent(`pointerup`,n.pointerUp)),r.dispatchEvent(new i.MouseEvent(`mouseup`,n.mouseUp))),r.dispatchEvent(new i.Event(`change`,{bubbles:!0}));return}if(W(r,`HTMLElement`)&&r.isContentEditable){r.textContent=t,r.dispatchEvent(new i.Event(`input`,{bubbles:!0}));return}throw Error(`fill: element <${ot(r)}> is not fillable`)}},Tt={resolve:(e,t={})=>G(e.elements).textContent},Et={resolve:(e,t,n={})=>G(e.elements).getAttribute(t)},Dt={resolve:(e,t={})=>{let n=G(e.elements);if(!W(n,`HTMLElement`))return!0;let r=H(n).getComputedStyle(n);if(r?.display===`none`||r?.visibility===`hidden`)return!1;let i=n.getBoundingClientRect();return i.width>0&&i.height>0}},Ot={resolve:(e,t={})=>e.elements.length},kt={resolve:(e,t={})=>e.elements.length>0},J=(e,t)=>e.elements.flatMap(e=>[...e.querySelectorAll(t)]),Y=e=>e.replaceAll(`"`,`\\"`),At={to:`element`,css:!0,resolve:(e,t)=>J(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`descend`})},jt={to:`frame`,css:!0,barrier:`down`,resolve:(e,t)=>J(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`down`})},Mt={element:{selectors:{locator:At,frameLocator:jt,getByRole:{to:`element`,resolve:(e,t)=>J(e,`[role="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[role="${Y(e)}"]`:`[role]`})},getByText:{to:`element`,resolve:(e,t)=>e.elements.flatMap(e=>[e,...e.querySelectorAll(`*`)]).filter(e=>e.textContent?.includes(t)),render:e=>({fragment:typeof e==`string`?`:has-text("${Y(e)}")`:`:has-text(...)`})},getByTestId:{to:`element`,resolve:(e,t)=>J(e,`[data-testid="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[data-testid="${Y(e)}"]`:`[data-testid]`})},first:{to:`element`,resolve:e=>e.elements.slice(0,1),render:()=>({fragment:`:first`})},nth:{to:`element`,resolve:(e,t)=>{let n=e.elements.at(t);return n?[n]:[]},render:e=>({fragment:typeof e==`number`?`:nth(${e})`:`:nth(?)`})}},operations:{click:bt,fill:wt,hover:xt,textContent:Tt,getAttribute:Et,isVisible:Dt,count:Ot,exists:kt}},frame:{selectors:{locator:At,frameLocator:jt,owner:{to:`frame`,barrier:`up`,resolve:e=>{throw Error(`owner: must be processed by the executor as an upward pivot`)},render:()=>({fragment:``,separator:`up`})}},operations:{addStyleTag:_t,fetch:K}}},Nt=(e,t=Mt)=>({element:{selectors:{...t.element.selectors,...e.element?.selectors},operations:{...t.element.operations,...e.element?.operations}},frame:{selectors:{...t.frame.selectors,...e.frame?.selectors},operations:{...t.frame.operations,...e.frame?.operations}}}),Pt=3e4,Ft=50,It=e=>{let t=e[e.length-1];return typeof t==`object`&&t?t:void 0},Lt=e=>{let t=It(e)?.timeout;return typeof t==`number`?t:Pt},Rt=({executor:e,parts:t})=>({highlight:n=>e.highlight(t,n).then(()=>{},()=>{})}),zt=async e=>{let t={parts:e.parts,operation:e.operation,args:e.args,phase:`ensure`};await e.gate?.(t,Rt(e))},Bt=async e=>{let{executor:t,gate:n,parts:r,operation:i,args:a}=e;n&&await n({parts:r,operation:i,args:a,phase:`execute`},Rt(e));let o=Lt(a),s=Date.now()+o,c=Error(`Locator timeout (${o}ms): ${i}`),{promise:l,reject:u}=Promise.withResolvers();l.catch(()=>{});let d=setTimeout(()=>u(c),o),f=c;try{for(;Date.now()<s;)try{return await Promise.race([t.execute(r,i,a),l])}catch(e){if(e===c)break;if(rt(e))throw e;f=e;let t=s-Date.now();if(t<=0)break;await new Promise(e=>setTimeout(e,Math.min(Ft,t)))}}finally{clearTimeout(d)}throw f},Vt=(e,t,n,r)=>{let i={};for(let[a,o]of Object.entries(t[n].selectors))i[a]=(...i)=>Vt(e,t,o.to,[...r,{kind:n,name:a,args:i}]);for(let a of Object.keys(t[n].operations))i[a]=(...t)=>Bt({...e,parts:r,operation:a,args:t});return i.ensure=(i,a={})=>{let o=t[n].operations[i]?.ensureArgs;return zt({...e,parts:r,operation:i,args:o?.(a)??[a]})},i},Ht=e=>Vt(e,e.modules??Mt,`frame`,[]),Ut=()=>{let e=E();return e.status===`ok`&&e.abi>=2},Wt=async()=>{await O();let e=E();if(e.status===`ok`&&e.abi<2)throw new w(e.abi,2)},Gt=e=>`Read the text, links and details ${e} shows.`,Kt=e=>`Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`,qt=[{id:`interaction`,heading:`Interaction`,summary:`Allow the app to interact with the website (clicks, type in text, etc.)`,title:e=>`Interact with ${e}`,description:(e,t)=>t?`Click, type and hover on ${e} for you. If you are signed in there, this happens as you.`:`Click, type and hover on ${e} for you, in a signed-out view.`,cloudTitle:e=>`Click and type on ${e}`,cloudDescription:e=>`Clicks, types and scrolls on ${e} for you.`},{id:`storage`,heading:`Site data`,summary:`Can read the website's data`,title:e=>`Read data from ${e}`,description:Gt,cloudTitle:e=>`Read what's on ${e}`,cloudDescription:Gt},{id:`network`,heading:`Network`,summary:`Make requests on behalf of the website (using your cookies, etc.)`,title:e=>`Make requests to ${e} as you`,description:e=>`Load pages and data from ${e} and send changes there with your signed-in session.`,cloudTitle:e=>`Load and send data on ${e}`,cloudDescription:e=>`Loads pages and data from ${e} and sends changes there.`},{id:`evaluation`,heading:`Evaluation`,summary:`Can execute arbitrary code on the website`,title:e=>`Run code on ${e}`,description:Kt,cloudTitle:e=>`Run its own code on ${e}`,cloudDescription:Kt}],Jt=Nt({element:{operations:{click:{resolve:(e,t={})=>q.click.resolve(e,t)},hover:{resolve:(e,t={})=>q.hover.resolve(e,t)},fill:{resolve:(e,t,n={})=>q.fill.resolve(e,t,n)},textContent:{resolve:(e,t={})=>q.textContent.resolve(e)},getAttribute:{resolve:(e,t,n={})=>q.getAttribute.resolve(e,t)},isVisible:{resolve:(e,t={})=>q.isVisible.resolve(e)},count:{resolve:(e,t={})=>q.count.resolve(e)},exists:{resolve:(e,t={})=>q.exists.resolve(e)},videoElement:{resolve:(e,t={})=>b(at(G(e.elements),`HTMLVideoElement`))}}},frame:{operations:{addStyleTag:{resolve:(e,t)=>_t.resolve(e,t)},fetch:{resolve:(e,t,n={})=>K.resolve(e,t,n),kind:K.kind,ensureArgs:K.ensureArgs},evaluate:{kind:`frame`,resolve:(e,t,n)=>{throw $e(`evaluate`,`this realm`)}}}}}),Yt=e=>{if(!e||e===`about:blank`)return!1;let t;try{t=new URL(e,location.href)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||t.protocol!==`about:`&&Oe(t.hostname)},X=e=>{if(Yt(e))throw Error(`attachFrame: refusing to target the extension's own pages or an FKN platform origin`)},Xt=({src:e,domains:t,lockdown:n})=>{if(n&&!t.length&&e&&e!==`about:blank`)throw Error(`attachFrame: lockdown needs domains when the frame already has a src; pass domains or load it via goto`)},Zt={scope:`embed.iframe`,category:`interaction`,severity:0,title:`Load another website inside this app`,description:`Lets the app embed external pages directly inside its own view.`},Qt={scope:`embed.open`,category:`interaction`,severity:0,title:`Open a website inside this app`,description:`Lets the app navigate to another site without leaving its window.`},$t=class extends Error{name=`FrameWindowBlockedError`;constructor(){super(`attachFrame: the browser did not open the window. Call attachFrame directly in a click or key handler, and allow popups for this page`)}},en=new Set([`jar-unreachable`,`bad-url`,`opaque-opener`]),tn=class extends Error{name=`FrameWindowRefusedError`;reason;constructor(e){let t=en.has(e)?e:`unknown`;super(t===`opaque-opener`?`attachFrame: this page has an opaque origin, which a window can never answer, so no window was opened`:`attachFrame: the window refused to attach (${t}), and loaded nothing`),this.reason=t}},nn=[`message`,`document`],rn=e=>{if(e===`*`)return`*`;let t=()=>TypeError(`frame.postMessage: targetOrigin must be '*' or an origin, not ${JSON.stringify(e)}`);if(typeof e!=`string`)throw t();let n;try{n=new URL(e).origin}catch{throw t()}if(n===`null`)throw t();return n},an=(e,t)=>{let n=typeof e==`object`&&!!e;if(n&&t!==void 0)throw TypeError(`frame.postMessage: pass transfer inside the options object, not after it`);let r=n?e.targetOrigin??`*`:e??`*`,i=n?e.transfer:t;if(i!==void 0&&!Array.isArray(i))throw TypeError(`frame.postMessage: transfer must be an array`);return{targetOrigin:rn(r),transfer:i===void 0?[]:[...i]}},on=e=>{typeof globalThis.reportError==`function`?globalThis.reportError(e):console.error(e)},sn=e=>{let t=Ht({executor:e.executor,modules:Jt,gate:e.gate}),n=(t,n={})=>(X(t),e.goto(t,n)),r=()=>e.url(),i=async t=>{let n=e.request;if(!n)throw Error(`frame.request: this backend cannot ask for permission categories`);return n(t)},a=async(t,n)=>{let r=e.evaluate;if(!r)throw Error(`frame.evaluate: this backend cannot run code in the attached frame`);let i=typeof t==`function`?t.toString():t;if(typeof i!=`string`)throw TypeError(`frame.evaluate: pass a function or a source string`);return r(i,n)},o=((t,n,r)=>{try{let i=e.postMessage;if(!i)throw Error(`frame.postMessage: this backend cannot message the attached frame`);let a=an(n,r);return i(t,a.targetOrigin,a.transfer)}catch(e){return Promise.reject(e)}}),s={message:new Set,document:new Set},c=null,l=(e,t)=>{if(!nn.includes(e))throw TypeError(`frame.${t}: the event type must be ${nn.map(e=>`'${e}'`).join(` or `)}, not ${JSON.stringify(e)}`);return s[e]},u=e=>{let t=e.type===`message`?Object.freeze({type:`message`,data:e.data,origin:e.origin,ports:Object.freeze([...e.ports]),source:p}):Object.freeze({type:`document`,origin:e.origin});for(let n of[...s[e.type]])try{n(t)}catch(e){on(e)}},d=(e,t)=>{if(l(e,`removeEventListener`).delete(t),c!==null&&!s.message.size&&!s.document.size){let e=c;c=null,e()}},f=(t,n,r={})=>{let i=l(t,`addEventListener`);if(typeof n!=`function`)throw TypeError(`frame.addEventListener: the listener must be a function`);let{signal:a}=r;if(!(a?.aborted||i.has(n))){if(c===null){let t=e.listen;if(!t)throw Error(`frame.addEventListener: this backend cannot relay the page's messages`);c=t(u)}i.add(n),a?.addEventListener(`abort`,()=>d(t,n),{once:!0})}},p={...t,goto:n,url:r,request:i,evaluate:a,postMessage:o,addEventListener:f,removeEventListener:d};return p},cn=[t.v,t._,t.y,t.h,t.g,t.n,t.i,t.r,t.f,t.a,t.o,t.s,t.p,Zt,Qt,t.u,t.d,ke,Ae,je,Re,Be],ln=qt.map(e=>e.id),un={interaction:`act.click`,storage:`read.text`,network:`network.fetchCredentialed`,evaluation:`media.appearU`},Z=e=>e===0?`auto`:e===4?`critical`:`bundled`,Q=cn,$=new Map,dn={};(()=>{$=new Map(Q.map(e=>[e.scope,e])),dn=Object.fromEntries($),Q.filter(e=>e.severity===4).map(e=>e.scope);let e=e=>Q.filter(t=>t.category===e&&Z(t.severity)===`bundled`);Object.fromEntries(ln.map(t=>[t,Math.max(0,...e(t).map(e=>e.severity))])),Object.fromEntries(ln.map(t=>[t,e(t).some(e=>e.unsafe===!0)]))})();var fn=e=>$.get(e)?.category,pn=e=>{let t=$.get(e);return t&&Z(t.severity)},mn=e=>{let t=$.get(e);if(t)return Z(t.severity)===`critical`?t.scope:t.category},hn=e=>un[e],gn=({category:e,key:t})=>{let n=t??(e&&hn(e));return n!==void 0&&fn(n)!==void 0?n:void 0},_n=(e,t)=>{for(let{category:n,key:r}of t)if(gn({category:n,key:r})===void 0)throw TypeError(r===void 0?n===void 0?`${e}: name a category or a permission key`:`${e}: unknown permission category "${n}"`:`${e}: unknown permission key "${r}"`)},vn=(e,t={})=>{let n=[],r=e.map(e=>{let r=gn(e),i=[];if(r!==void 0)for(let a of e.hosts)i.push(n.length),n.push({...t,key:r,scope:``,site:a,hosts:e.hosts,reason:e.reason});return{key:r!==void 0&&pn(r)===`critical`?r:void 0,category:e.category??(r===void 0?`interaction`:dn[r].category),hosts:e.hosts,indexes:i}});return{items:n,answer:e=>r.map(({key:t,category:n,hosts:r,indexes:i})=>({category:n,...t===void 0?{}:{key:t},hosts:r,allow:i.length>0&&i.every(t=>e[t]?.allow===!0)}))}},yn=e=>typeof e==`object`&&!!e,bn=typeof chrome<`u`&&!!chrome.runtime?.id,xn=e=>yn(e)&&e.FKN_WEB_EXTENSION_FRAME_ANNOUNCE_KEY===!0&&typeof e.frameId==`string`&&typeof e.document==`string`,Sn=new WeakMap,Cn=new WeakMap,wn=new WeakMap,Tn=new Set;typeof window<`u`&&bn&&window.addEventListener(`message`,e=>{if(!xn(e.data))return;e.stopImmediatePropagation();let t=e.source;if(!t||typeof t!=`object`)return;let n=t,r=Sn.get(n),i=e.data.frameId,a=e.data.document;if(Sn.set(n,i),Cn.set(n,a),r)for(let e of Tn)e(r);let o=wn.get(n);if(o){for(let e of[...o])(e.notDocument===void 0||e.notDocument!==a)&&(o.delete(e),e.resolve(i));o.size||wn.delete(n)}},{capture:!0});var En=e=>{let t=e;if(t.window===void 0)return`iframe`;if(t.iframe!==void 0)throw TypeError(`attachFrame: pass either iframe or window, not both`);if(t.lockdown)throw TypeError(`attachFrame: lockdown applies to an iframe, never to a window`);if(typeof t.window!=`object`||t.window===null)throw TypeError(`attachFrame: window must be an object`);return`window`},Dn=(e,t,n)=>{if(e===void 0)return t;if(typeof e!=`number`||!Number.isFinite(e)||e<=0)throw TypeError(`attachFrame: window.${n} must be a positive number of CSS pixels`);return Math.round(e)},On=({url:e,width:t,height:n})=>{let r=(()=>{if(e===void 0||e===``||e===`about:blank`)return``;if(typeof e!=`string`)throw TypeError(`attachFrame: window.url must be a string`);let t=(()=>{try{return new URL(e,location.href)}catch{throw TypeError(`attachFrame: window.url is not a valid URL: ${e}`)}})();if(t.protocol!==`http:`&&t.protocol!==`https:`)throw TypeError(`attachFrame: window.url must be an http or https address`);return t.href})();return r&&X(r),{url:r,width:Dn(t,500,`width`),height:Dn(n,700,`height`)}},kn=e=>{try{return new URL(e).hostname}catch{return``}},An=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,jn=!1,Mn=()=>{jn||(jn=!0,console.warn(`[fkn-frame] the installed FKN WebExtension is too old to ask for permission categories upfront, so each capability will be asked for as it is first used. Updating the extension fixes this.`))},Nn=`frame: this frame no longer holds the document the app attached it to`,Pn=`frame.postMessage: '*' is not served on the extension yet, since this extension does not report the frame's origin; pass the page's origin as targetOrigin`,Fn=e=>{try{return new URL(e,location.href).hostname}catch{return``}},In=async({iframe:e,domains:n=[],syncCookies:r=!0,lockdown:i=!1,permissions:a})=>{let o=crypto.randomUUID();if(X(e.src),Xt({src:e.src,domains:n,lockdown:i}),await O(),!e.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);e.dispatchEvent(new CustomEvent(An,{detail:o}));let{executeLocator:s,highlightLocator:c,ensureLocatorPermission:l,requestCategories:u,evaluateFrame:d,goto:f}=await k.attachFrame({marker:o,domains:n,syncCookies:r,lockdown:i}),p=new Set(t.t([...n,Fn(e.src)],{ipv6:!0})),m=e=>p.has(t.t([kn(e)],{ipv6:!0})[0]??``),h=sn({executor:{execute:s,highlight:c},gate:e=>l(e.parts,e.operation,e.args),request:async e=>(_n(`frame.request`,e),await Wt(),u(e)),evaluate:async(e,t)=>{if(!pe(E(),`evaluate`)){let e=E();throw new T(`evaluate`,e.status===`ok`?e.abi:0)}return d({source:e,arg:t})},postMessage:(t,n,r)=>{if(n===`*`)throw z(Pn,`postMessage`,`extension`);if(!m(n))throw B(Nn,`postMessage`);let i=e.contentWindow;if(i===null)throw B(`frame: navigate the frame before postMessage`,`postMessage`);return i.postMessage(t,n,r),Promise.resolve()},listen:t=>{let n=n=>{n.source!==null&&n.source===e.contentWindow&&!xn(n.data)&&m(n.origin)&&t({type:`message`,data:n.data,origin:n.origin,ports:n.ports})},r=()=>t({type:`document`,origin:``});return window.addEventListener(`message`,n),e.addEventListener(`load`,r),()=>{window.removeEventListener(`message`,n),e.removeEventListener(`load`,r)}},goto:(e,n={})=>{for(let n of t.t([Fn(e)],{ipv6:!0}))p.add(n);return f({url:e,...n})},url:()=>e.src});return a?.length&&(Ut()?await h.request(a):Mn()),h},Ln=`attachFrame: window mode is served by the cloud backend for now, whatever extension is installed. Use cloud.attachFrame({ window })`,Rn=async e=>{if(On(e.window),e.syncCookies===!1)throw TypeError(`attachFrame: syncCookies false does not apply to an extension window, which is the site's own first-party tab`);let t=E();throw new T(`attachWindow`,t.status===`absent`?0:t.abi,Ln)},zn=(async e=>En(e)===`window`?Rn(e):In(e)),Bn=`permissions.request: pass hosts, the sites the grant applies to`,Vn={request:async e=>{let n=e.map(e=>{let{category:n,key:r,scope:i,reason:a,hosts:o}=e;if(!(`hosts`in e)&&!(`category`in e))return{legacy:{key:r,scope:i??``,reason:a}};let s=t.t(o??[],{ipv6:!0});if(!s.length)throw TypeError(Bn);return{ask:{category:n,key:r,reason:a,hosts:s}}}),r=n.flatMap(e=>`ask`in e?[e.ask]:[]);_n(`permissions.request`,r),r.length&&await Wt();let{items:i,answer:a}=vn(r),o=n.flatMap(e=>`legacy`in e?[e.legacy]:[]),s=[...i,...o],c=s.length?await k.requestPermissions(s):[],l=a(c.slice(0,i.length)),u=c.slice(i.length),d=0,f=0;return n.map(e=>`ask`in e?l[d++]:u[f++])}},Hn=`PermissionDeniedError`,Un=e=>e instanceof Error?e.name===Hn:yn(e)&&e.name===`PermissionDeniedError`;Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return zn}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return tn}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return An}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Un}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return En}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Vn}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return On}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Hn}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return ke}});
|