@fkn/lib 0.9.50 → 0.9.51
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/{api-wnOQJEK6.d.ts → api-BFVa-RbA.d.ts} +1 -1
- package/api.d.ts +2 -2
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud-BP_iRJY9.cjs +1 -0
- package/cloud-D8I5SjTC.js +556 -0
- package/{cloud-CWHjH89l.d.ts → cloud-DMlEP2L-.d.ts} +3 -3
- package/cloud.cjs +1 -1
- package/cloud.d.ts +3 -3
- package/cloud.js +1 -1
- package/{contract-DGuGXxKd.d.ts → contract-De1rQSCD.d.ts} +7 -2
- package/contract.d.ts +2 -2
- package/dgram.d.ts +2 -2
- package/dns.d.ts +1 -1
- package/extension-BhLUxlMu.cjs +1 -0
- package/extension-LAOGLbEB.js +95 -0
- package/{extension-C4Don9vi.d.ts → extension-kE9yzbkW.d.ts} +29 -8
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +3 -3
- package/http.d.ts +1 -1
- package/{index-DlBWSKwV.d.ts → index-BQ5OZQhf.d.ts} +19 -5
- package/index.cjs +1 -1
- package/index.d.ts +5 -5
- package/index.js +50 -50
- package/lib-B3BXMegM.cjs +53 -0
- package/{lib-B2cML3Tq.js → lib-ERmfLvVp.js} +423 -414
- package/{net-C2sulnNU.d.ts → net-CF0QTQkN.d.ts} +2 -2
- package/net.d.ts +1 -1
- package/package.json +1 -1
- package/packages.d.ts +1 -1
- package/{proxy-MVuD49E2.d.ts → proxy-C2BGx_V8.d.ts} +2 -2
- package/rooms.d.ts +1 -1
- package/storage.d.ts +1 -1
- package/cloud-CAN_iu2o.cjs +0 -1
- package/cloud-JXQKSDrW.js +0 -548
- package/extension-1Je_RJ6_.js +0 -94
- package/extension-4koB6bS6.cjs +0 -1
- package/lib-35d-3W0p.cjs +0 -53
|
@@ -56,10 +56,10 @@ var ne = (e, t) => {
|
|
|
56
56
|
dispatchEvent: (t) => e.remoteEvents.dispatchEvent(t)
|
|
57
57
|
};
|
|
58
58
|
}, x = /* @__PURE__ */ e({
|
|
59
|
-
box: () =>
|
|
60
|
-
createVideoElementHandle: () =>
|
|
61
|
-
isType: () =>
|
|
62
|
-
revive: () =>
|
|
59
|
+
box: () => be,
|
|
60
|
+
createVideoElementHandle: () => ve,
|
|
61
|
+
isType: () => ye,
|
|
62
|
+
revive: () => xe,
|
|
63
63
|
type: () => S
|
|
64
64
|
}), S = "videoElement", ie = [
|
|
65
65
|
"currentTime",
|
|
@@ -79,7 +79,7 @@ var ne = (e, t) => {
|
|
|
79
79
|
"seeking",
|
|
80
80
|
"readyState",
|
|
81
81
|
"currentSrc"
|
|
82
|
-
], oe = ["buffered", "seekable"], se = Symbol.for("fkn.remoteVideoElement"), ce = Symbol.for("fkn.remoteVideoElement.state"), le = Symbol.for("fkn.remoteVideoElement.controller"), ue = (e) => e ? Array.from({ length: e.length }, (t, n) => [e.start(n), e.end(n)]) : [],
|
|
82
|
+
], oe = ["buffered", "seekable"], se = Symbol.for("fkn.remoteVideoElement"), ce = Symbol.for("fkn.remoteVideoElement.state"), le = Symbol.for("fkn.remoteVideoElement.controller"), ue = (e) => e ? Array.from({ length: e.length }, (t, n) => [e.start(n), e.end(n)]) : [], de = (e) => {
|
|
83
83
|
let t = {};
|
|
84
84
|
for (let n of [...ie, ...ae]) t[n] = e[n];
|
|
85
85
|
for (let n of oe) t[n] = ue(e[n]);
|
|
@@ -87,7 +87,7 @@ var ne = (e, t) => {
|
|
|
87
87
|
code: e.error.code,
|
|
88
88
|
message: e.error.message
|
|
89
89
|
} : null, t;
|
|
90
|
-
},
|
|
90
|
+
}, fe = (e) => {
|
|
91
91
|
let t = (t) => {
|
|
92
92
|
if (!Number.isInteger(t) || t < 0 || t >= e.length) throw new DOMException("Index or size is negative or greater than the allowed amount", "IndexSizeError");
|
|
93
93
|
};
|
|
@@ -102,17 +102,17 @@ var ne = (e, t) => {
|
|
|
102
102
|
return t(n), e[n][1];
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
|
-
},
|
|
105
|
+
}, pe = (e) => e ? {
|
|
106
106
|
code: e.code,
|
|
107
107
|
message: e.message,
|
|
108
108
|
MEDIA_ERR_ABORTED: 1,
|
|
109
109
|
MEDIA_ERR_NETWORK: 2,
|
|
110
110
|
MEDIA_ERR_DECODE: 3,
|
|
111
111
|
MEDIA_ERR_SRC_NOT_SUPPORTED: 4
|
|
112
|
-
} : null,
|
|
112
|
+
} : null, me = (e) => ne(e, (e, t) => ({
|
|
113
113
|
originalDetail: e instanceof CustomEvent ? e.detail : null,
|
|
114
|
-
snapshot:
|
|
115
|
-
})),
|
|
114
|
+
snapshot: de(t)
|
|
115
|
+
})), he = async (e, t) => {
|
|
116
116
|
switch (t) {
|
|
117
117
|
case "play": return await e.play(), null;
|
|
118
118
|
case "pause": return e.pause(), null;
|
|
@@ -127,16 +127,16 @@ var ne = (e, t) => {
|
|
|
127
127
|
}
|
|
128
128
|
default: throw Error(`videoElement: unknown method "${t}"`);
|
|
129
129
|
}
|
|
130
|
-
},
|
|
131
|
-
call: async (t) =>
|
|
130
|
+
}, ge = (e) => ({
|
|
131
|
+
call: async (t) => he(e, t),
|
|
132
132
|
set: async (t, n) => {
|
|
133
133
|
try {
|
|
134
134
|
e[t] = n;
|
|
135
135
|
} catch {}
|
|
136
|
-
return
|
|
136
|
+
return de(e);
|
|
137
137
|
},
|
|
138
|
-
events:
|
|
139
|
-
}),
|
|
138
|
+
events: me(e)
|
|
139
|
+
}), _e = (e, t) => {
|
|
140
140
|
let n = new EventTarget();
|
|
141
141
|
Object.defineProperty(n, se, { value: !0 }), Object.defineProperty(n, ce, { value: e }), Object.defineProperty(n, le, { value: t });
|
|
142
142
|
let r = b({
|
|
@@ -174,7 +174,7 @@ var ne = (e, t) => {
|
|
|
174
174
|
configurable: !0,
|
|
175
175
|
enumerable: !0,
|
|
176
176
|
get() {
|
|
177
|
-
return
|
|
177
|
+
return pe(e.error);
|
|
178
178
|
}
|
|
179
179
|
},
|
|
180
180
|
play: {
|
|
@@ -233,11 +233,11 @@ var ne = (e, t) => {
|
|
|
233
233
|
configurable: !0,
|
|
234
234
|
enumerable: !0,
|
|
235
235
|
get() {
|
|
236
|
-
return
|
|
236
|
+
return fe(e[t]);
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
239
|
return Object.defineProperties(n, i), n;
|
|
240
|
-
},
|
|
240
|
+
}, ve = (e) => _e(de(e), ge(e)), ye = (e) => typeof e == "object" && !!e && e[se] === !0, be = (e, t) => {
|
|
241
241
|
let n = e;
|
|
242
242
|
return {
|
|
243
243
|
..._,
|
|
@@ -245,44 +245,44 @@ var ne = (e, t) => {
|
|
|
245
245
|
initialState: n[ce],
|
|
246
246
|
controller: ee(n[le], t)
|
|
247
247
|
};
|
|
248
|
-
},
|
|
248
|
+
}, xe = (e, t) => {
|
|
249
249
|
let n = te(e.controller, t);
|
|
250
|
-
return
|
|
251
|
-
},
|
|
250
|
+
return _e({ ...e.initialState }, n);
|
|
251
|
+
}, Se = (e) => {
|
|
252
252
|
let t = [];
|
|
253
253
|
return e.forEach((e, n) => {
|
|
254
254
|
t.push([n, e]);
|
|
255
255
|
}), t;
|
|
256
|
-
},
|
|
257
|
-
type:
|
|
256
|
+
}, Ce = "headers", we = {
|
|
257
|
+
type: Ce,
|
|
258
258
|
isType: (e) => e instanceof Headers,
|
|
259
259
|
box: (e) => ({
|
|
260
260
|
..._,
|
|
261
|
-
type:
|
|
262
|
-
entries:
|
|
261
|
+
type: Ce,
|
|
262
|
+
entries: Se(e)
|
|
263
263
|
}),
|
|
264
264
|
revive: (e) => new Headers(e.entries)
|
|
265
|
-
},
|
|
265
|
+
}, Te = "response", Ee = /* @__PURE__ */ new Set([
|
|
266
266
|
101,
|
|
267
267
|
204,
|
|
268
268
|
205,
|
|
269
269
|
304
|
|
270
|
-
]),
|
|
271
|
-
type:
|
|
270
|
+
]), De = {
|
|
271
|
+
type: Te,
|
|
272
272
|
isType: (e) => e instanceof Response,
|
|
273
273
|
box: (e, t) => ({
|
|
274
274
|
..._,
|
|
275
|
-
type:
|
|
275
|
+
type: Te,
|
|
276
276
|
status: e.status,
|
|
277
277
|
statusText: e.statusText,
|
|
278
|
-
headers:
|
|
278
|
+
headers: we.box(e.headers),
|
|
279
279
|
body: e.body ? ee(e.body, t) : null,
|
|
280
280
|
url: e.url,
|
|
281
281
|
redirected: e.redirected
|
|
282
282
|
}),
|
|
283
283
|
revive: (e, t) => {
|
|
284
284
|
if (e.status === 0) return Response.error();
|
|
285
|
-
let n =
|
|
285
|
+
let n = we.revive(e.headers), r = e.body ? te(e.body, t) : null, i = Ee.has(e.status);
|
|
286
286
|
r && i && r.cancel().catch(() => {});
|
|
287
287
|
let a = new Response(i ? null : r, {
|
|
288
288
|
status: e.status,
|
|
@@ -297,22 +297,22 @@ var ne = (e, t) => {
|
|
|
297
297
|
configurable: !0
|
|
298
298
|
}), a;
|
|
299
299
|
}
|
|
300
|
-
},
|
|
300
|
+
}, Oe = (e) => [
|
|
301
301
|
x,
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
we,
|
|
303
|
+
De,
|
|
304
304
|
...e
|
|
305
|
-
],
|
|
305
|
+
], ke = 5, Ae = 0, je = "fknExtension", Me = "fknExtensionAbi", Ne = "fknExtensionOps", Pe = [
|
|
306
306
|
"data-fkn-extension",
|
|
307
307
|
"data-fkn-extension-abi",
|
|
308
308
|
"data-fkn-extension-ops"
|
|
309
|
-
],
|
|
309
|
+
], Fe = (e) => {
|
|
310
310
|
if (e === void 0) return 0;
|
|
311
311
|
let t = Number(e);
|
|
312
312
|
return Number.isInteger(t) && t >= 0 ? t : 0;
|
|
313
|
-
},
|
|
313
|
+
}, Ie = (e) => e === void 0 ? null : e.split(",").map((e) => e.trim()).filter(Boolean), Le = (e, t = 0) => {
|
|
314
314
|
if (e.fknExtension !== "true") return { status: "absent" };
|
|
315
|
-
let n =
|
|
315
|
+
let n = Fe(e[Me]), r = Ie(e[Ne]);
|
|
316
316
|
return n < t ? {
|
|
317
317
|
status: "outdated",
|
|
318
318
|
abi: n,
|
|
@@ -323,42 +323,42 @@ var ne = (e, t) => {
|
|
|
323
323
|
abi: n,
|
|
324
324
|
operations: r
|
|
325
325
|
};
|
|
326
|
-
},
|
|
326
|
+
}, Re = (e, t) => e.status === "ok" ? e.operations === null || e.operations.includes(t) : !1, ze = (e, t) => e.status === "ok" && e.operations !== null && e.operations.includes(t), C = class extends Error {
|
|
327
327
|
abi;
|
|
328
328
|
required;
|
|
329
329
|
name = "ExtensionOutdatedError";
|
|
330
330
|
constructor(e, t) {
|
|
331
331
|
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;
|
|
332
332
|
}
|
|
333
|
-
},
|
|
333
|
+
}, w = class extends Error {
|
|
334
334
|
operation;
|
|
335
335
|
abi;
|
|
336
336
|
name = "ExtensionOperationUnsupportedError";
|
|
337
337
|
constructor(e, t, n) {
|
|
338
338
|
super(n ?? `The FKN WebExtension does not support "${e}" (ABI ${t}). Updating the extension may add it.`), this.operation = e, this.abi = t;
|
|
339
339
|
}
|
|
340
|
-
},
|
|
341
|
-
typeof document < "u" && document.addEventListener(
|
|
342
|
-
|
|
340
|
+
}, Be = "FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY", Ve = v();
|
|
341
|
+
typeof document < "u" && document.addEventListener(Be, () => {
|
|
342
|
+
Ve.dispatchEvent(new CustomEvent("statuschange", { detail: { enabled: He() } }));
|
|
343
343
|
});
|
|
344
|
-
var
|
|
345
|
-
|
|
346
|
-
},
|
|
347
|
-
let r = () =>
|
|
344
|
+
var He = () => typeof document > "u" ? !1 : document.documentElement.dataset[je] === "true", T = () => typeof document > "u" ? { status: "absent" } : Le(document.documentElement.dataset), Ue = null, We = (e) => {
|
|
345
|
+
Ue = e;
|
|
346
|
+
}, Ge = 150, E = (e = 1e3) => new Promise((t, n) => {
|
|
347
|
+
let r = () => T().status === "ok";
|
|
348
348
|
if (r()) return t();
|
|
349
349
|
let i, a = (e) => {
|
|
350
350
|
clearTimeout(i), c.disconnect(), document.removeEventListener("readystatechange", l), e();
|
|
351
351
|
}, o = () => a(async () => {
|
|
352
|
-
let e =
|
|
353
|
-
if (e.status === "outdated") return n(new
|
|
354
|
-
if (
|
|
355
|
-
if (await
|
|
356
|
-
let e =
|
|
357
|
-
if (e.status === "outdated") return n(new
|
|
352
|
+
let e = T();
|
|
353
|
+
if (e.status === "outdated") return n(new C(e.abi, e.required));
|
|
354
|
+
if (Ue) {
|
|
355
|
+
if (await Ue().catch(() => {}), r()) return t();
|
|
356
|
+
let e = T();
|
|
357
|
+
if (e.status === "outdated") return n(new C(e.abi, e.required));
|
|
358
358
|
}
|
|
359
359
|
n(/* @__PURE__ */ Error("The FKN WebExtension is not installed, enabled or not exposed on this page."));
|
|
360
360
|
}), s = () => {
|
|
361
|
-
clearTimeout(i), i = setTimeout(() => r() ? a(t) : o(),
|
|
361
|
+
clearTimeout(i), i = setTimeout(() => r() ? a(t) : o(), Ge);
|
|
362
362
|
}, c = new MutationObserver(() => {
|
|
363
363
|
r() && a(t);
|
|
364
364
|
}), l = () => {
|
|
@@ -366,33 +366,33 @@ var Ve = () => typeof document > "u" ? !1 : document.documentElement.dataset[Ae]
|
|
|
366
366
|
};
|
|
367
367
|
if (i = setTimeout(o, e), c.observe(document.documentElement, {
|
|
368
368
|
attributes: !0,
|
|
369
|
-
attributeFilter: [...
|
|
369
|
+
attributeFilter: [...Pe]
|
|
370
370
|
}), document.addEventListener("readystatechange", l), document.readyState === "complete") return s();
|
|
371
371
|
r() && a(t);
|
|
372
|
-
}),
|
|
373
|
-
await
|
|
372
|
+
}), Ke, D = new Proxy({}, { get: (e, t) => async (...e) => {
|
|
373
|
+
await E(), Ke ??= y({}, {
|
|
374
374
|
transport: window,
|
|
375
|
-
revivableModules:
|
|
375
|
+
revivableModules: Oe
|
|
376
376
|
});
|
|
377
|
-
let n = (await
|
|
377
|
+
let n = (await Ke)[t];
|
|
378
378
|
return n(...e);
|
|
379
|
-
} }),
|
|
379
|
+
} }), O = [
|
|
380
380
|
"origin",
|
|
381
381
|
"referer",
|
|
382
382
|
"cookie"
|
|
383
|
-
],
|
|
384
|
-
if (t === "include" &&
|
|
385
|
-
},
|
|
383
|
+
], qe = (e, t) => (e ?? []).some(([e, n]) => e.trim().toLowerCase() === t && n !== ""), Je = (e) => qe(e, "cookie"), Ye = (e, t) => {
|
|
384
|
+
if (t === "include" && Je(e)) throw Error("fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other");
|
|
385
|
+
}, Xe = (e, t) => {
|
|
386
386
|
if (!Array.isArray(t)) throw Error(`${e}: requestHeaders must be an array of header operations`);
|
|
387
387
|
let n = [...new Set(t.map((e) => {
|
|
388
388
|
let t = e?.header;
|
|
389
389
|
return typeof t == "string" ? t.trim().toLowerCase() : String(t);
|
|
390
|
-
}).filter((e) => !
|
|
390
|
+
}).filter((e) => !O.includes(e)))];
|
|
391
391
|
if (n.length) throw Error(`${e}: refusing to rewrite request header(s): ${n.join(", ")}`);
|
|
392
|
-
},
|
|
393
|
-
let t = [...new Set((e ?? []).map(([e]) => e.trim().toLowerCase()).filter((e) => !
|
|
392
|
+
}, Ze = (e) => {
|
|
393
|
+
let t = [...new Set((e ?? []).map(([e]) => e.trim().toLowerCase()).filter((e) => !O.includes(e)))];
|
|
394
394
|
if (t.length) throw Error(`fetch: refusing to forge request header(s): ${t.join(", ")}`);
|
|
395
|
-
},
|
|
395
|
+
}, Qe = [
|
|
396
396
|
"fkn.app",
|
|
397
397
|
"fkn.dev",
|
|
398
398
|
"sdbx.app",
|
|
@@ -414,7 +414,7 @@ var Ve = () => typeof document > "u" ? !1 : document.documentElement.dataset[Ae]
|
|
|
414
414
|
"container-ckf.pages.dev",
|
|
415
415
|
"stub-plugin.pages.dev",
|
|
416
416
|
"stub.plugins.banou.dev"
|
|
417
|
-
],
|
|
417
|
+
], $e = (e) => e.replace(/\.+$/, ""), et = ["79.127.204.69", "152.233.49.59"], tt = (e) => {
|
|
418
418
|
let t;
|
|
419
419
|
try {
|
|
420
420
|
t = new URL(`http://${e.includes(":") && !e.startsWith("[") ? `[${e}]` : e}/`).hostname;
|
|
@@ -432,18 +432,22 @@ var Ve = () => typeof document > "u" ? !1 : document.documentElement.dataset[Ae]
|
|
|
432
432
|
].join(".");
|
|
433
433
|
}
|
|
434
434
|
return /^\d+\.\d+\.\d+\.\d+$/.test(t) ? t : void 0;
|
|
435
|
-
},
|
|
436
|
-
let t =
|
|
437
|
-
if (
|
|
438
|
-
let n =
|
|
439
|
-
return n !== void 0 &&
|
|
440
|
-
},
|
|
435
|
+
}, k = (e) => {
|
|
436
|
+
let t = $e(e);
|
|
437
|
+
if (Qe.some((e) => t === e || t.endsWith(`.${e}`))) return !0;
|
|
438
|
+
let n = tt(t);
|
|
439
|
+
return n !== void 0 && et.includes(n);
|
|
440
|
+
}, nt = 100, rt = (e) => [...e.trim()], A = (e, t) => {
|
|
441
|
+
if (typeof t != "string") return;
|
|
442
|
+
let n = rt(t).length;
|
|
443
|
+
if (n > 100) throw TypeError(`${e}: reason must be at most 100 characters, not ${n}`);
|
|
444
|
+
}, it = {
|
|
441
445
|
scope: "network.fetch",
|
|
442
446
|
category: "network",
|
|
443
447
|
severity: 0,
|
|
444
448
|
title: "Fetch data from other sites",
|
|
445
449
|
description: "Lets the app download public data from other websites directly, past the usual cross-origin limits."
|
|
446
|
-
},
|
|
450
|
+
}, at = {
|
|
447
451
|
scope: "network.fetchCredentialed",
|
|
448
452
|
category: "network",
|
|
449
453
|
severity: 3,
|
|
@@ -451,7 +455,7 @@ var Ve = () => typeof document > "u" ? !1 : document.documentElement.dataset[Ae]
|
|
|
451
455
|
unsafe: !0,
|
|
452
456
|
title: "Fetch from other sites, signed in as you",
|
|
453
457
|
description: "Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see."
|
|
454
|
-
},
|
|
458
|
+
}, ot = {
|
|
455
459
|
scope: "network.fetchLocal",
|
|
456
460
|
category: "network",
|
|
457
461
|
severity: 3,
|
|
@@ -459,12 +463,12 @@ var Ve = () => typeof document > "u" ? !1 : document.documentElement.dataset[Ae]
|
|
|
459
463
|
unsafe: !0,
|
|
460
464
|
title: "Access devices on your local network",
|
|
461
465
|
description: "Lets the app reach devices and services on your home or work network, which websites normally cannot touch."
|
|
462
|
-
},
|
|
466
|
+
}, st = (e) => {
|
|
463
467
|
let t = e.match(/^(\d+)\.(\d+)\.\d+\.\d+$/);
|
|
464
468
|
if (!t) return !1;
|
|
465
469
|
let [n, r] = [Number(t[1]), Number(t[2])];
|
|
466
470
|
return n === 10 || n === 127 || n === 0 || n === 169 && r === 254 || n === 172 && r >= 16 && r <= 31 || n === 192 && r === 168;
|
|
467
|
-
},
|
|
471
|
+
}, ct = (e) => {
|
|
468
472
|
let t;
|
|
469
473
|
try {
|
|
470
474
|
t = new URL(e);
|
|
@@ -472,57 +476,58 @@ var Ve = () => typeof document > "u" ? !1 : document.documentElement.dataset[Ae]
|
|
|
472
476
|
return !1;
|
|
473
477
|
}
|
|
474
478
|
let n = t.hostname.replace(/^\[|\]$/g, "").toLowerCase().replace(/\.$/, "");
|
|
475
|
-
return n === "localhost" || n.endsWith(".localhost") || n.endsWith(".local") || n.endsWith(".internal") || n.endsWith(".home.arpa") ? !0 : n.includes(":") ? n === "::" || n === "::1" || n.startsWith("fc") || n.startsWith("fd") || /^fe[89ab]/.test(n) || n.startsWith("::ffff:") :
|
|
476
|
-
},
|
|
479
|
+
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:") : st(n);
|
|
480
|
+
}, lt = (e) => {
|
|
477
481
|
let t;
|
|
478
482
|
try {
|
|
479
483
|
t = new URL(e);
|
|
480
484
|
} catch {
|
|
481
485
|
return !1;
|
|
482
486
|
}
|
|
483
|
-
return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" ||
|
|
484
|
-
},
|
|
485
|
-
if (
|
|
486
|
-
},
|
|
487
|
+
return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" || k(t.hostname);
|
|
488
|
+
}, ut = (e) => {
|
|
489
|
+
if (lt(e)) throw Error("fetch: refusing to target the extension's own pages or FKN platform domains");
|
|
490
|
+
}, dt = (e) => {
|
|
487
491
|
if (!e?.headers) return;
|
|
488
|
-
let t = new Headers(e.headers), n =
|
|
492
|
+
let t = new Headers(e.headers), n = O.map((e) => {
|
|
489
493
|
let n = t.get(e);
|
|
490
494
|
return n === null || n === "" ? void 0 : [e, n];
|
|
491
495
|
}).filter((e) => e !== void 0);
|
|
492
496
|
return n.length ? n : void 0;
|
|
493
|
-
},
|
|
497
|
+
}, ft = async (e, t) => {
|
|
498
|
+
A("fetch", t?.reason);
|
|
494
499
|
let n = new Request(e, t);
|
|
495
|
-
|
|
500
|
+
ut(n.url);
|
|
496
501
|
let r = n.body ? await n.arrayBuffer() : null;
|
|
497
|
-
return
|
|
502
|
+
return D.proxyFetch({
|
|
498
503
|
url: n.url,
|
|
499
504
|
method: n.method,
|
|
500
505
|
headers: [...n.headers],
|
|
501
506
|
body: r,
|
|
502
507
|
credentials: t?.credentials === "include" ? "include" : "omit",
|
|
503
508
|
redirect: n.redirect,
|
|
504
|
-
unsafeHeaders:
|
|
509
|
+
unsafeHeaders: dt(t),
|
|
505
510
|
reason: t?.reason,
|
|
506
511
|
signal: t?.signal ?? void 0
|
|
507
512
|
});
|
|
508
|
-
},
|
|
509
|
-
for (let t of e) if (typeof t == "string" &&
|
|
510
|
-
},
|
|
513
|
+
}, pt = (e) => {
|
|
514
|
+
for (let t of e) if (typeof t == "string" && k(t.trim().toLowerCase())) return t;
|
|
515
|
+
}, mt = (e) => {
|
|
511
516
|
let t = e.trim().toLowerCase().replace(/^\.+|\.+$/g, "");
|
|
512
|
-
return t !== "" && (
|
|
513
|
-
}, ft = (e) => {
|
|
514
|
-
for (let t of e) if (typeof t == "string" && dt(t)) return t;
|
|
515
|
-
}, pt = (e) => `${e}: refusing to target FKN platform domains`, mt = (e, t) => {
|
|
516
|
-
if (ut(t) !== void 0) throw Error(pt(e));
|
|
517
|
+
return t !== "" && (k(t) || [...Qe, ...et].some((e) => e.endsWith(`.${t}`)));
|
|
517
518
|
}, ht = (e) => {
|
|
519
|
+
for (let t of e) if (typeof t == "string" && mt(t)) return t;
|
|
520
|
+
}, gt = (e) => `${e}: refusing to target FKN platform domains`, _t = (e, t) => {
|
|
521
|
+
if (pt(t) !== void 0) throw Error(gt(e));
|
|
522
|
+
}, vt = (e) => {
|
|
518
523
|
try {
|
|
519
524
|
return new URL(String(e)).hostname;
|
|
520
525
|
} catch {
|
|
521
526
|
return "";
|
|
522
527
|
}
|
|
523
528
|
}, j = (e, t) => {
|
|
524
|
-
if (
|
|
525
|
-
},
|
|
529
|
+
if (ht(t) !== void 0) throw Error(gt(e));
|
|
530
|
+
}, yt = {
|
|
526
531
|
scope: "network.readCookie",
|
|
527
532
|
category: "network",
|
|
528
533
|
severity: 3,
|
|
@@ -530,7 +535,7 @@ var Ve = () => typeof document > "u" ? !1 : document.documentElement.dataset[Ae]
|
|
|
530
535
|
unsafe: !0,
|
|
531
536
|
title: "Read a site’s cookie",
|
|
532
537
|
description: "Lets the app read a named cookie from another site, which can include the login token only that site should see."
|
|
533
|
-
},
|
|
538
|
+
}, bt = { get: async (e) => (_t("cookies.get", [vt(e.url)]), D.getCookie(e)) }, xt = {
|
|
534
539
|
scope: "network.modifyRequestHeaders",
|
|
535
540
|
category: "network",
|
|
536
541
|
severity: 2,
|
|
@@ -538,7 +543,7 @@ var Ve = () => typeof document > "u" ? !1 : document.documentElement.dataset[Ae]
|
|
|
538
543
|
unsafe: !0,
|
|
539
544
|
title: "Rewrite request headers to other sites",
|
|
540
545
|
description: "Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites."
|
|
541
|
-
},
|
|
546
|
+
}, St = async (e) => (j("setRequestHeaderRule", e.domains), Xe("setRequestHeaderRule", e.requestHeaders), A("setRequestHeaderRule", e.reason), D.setRequestHeaderRule(e)), Ct = (e) => D.removeRequestHeaderRule({ ruleId: e }), wt = class extends Error {
|
|
542
547
|
reason;
|
|
543
548
|
filename;
|
|
544
549
|
line;
|
|
@@ -547,7 +552,7 @@ var Ve = () => typeof document > "u" ? !1 : document.documentElement.dataset[Ae]
|
|
|
547
552
|
constructor(e, t, n, r, i) {
|
|
548
553
|
super(`${e}:${n}:${r}: ${t}`), this.reason = t, this.filename = e, this.line = n, this.column = r, this.source = i;
|
|
549
554
|
}
|
|
550
|
-
},
|
|
555
|
+
}, Tt = class {
|
|
551
556
|
start;
|
|
552
557
|
end;
|
|
553
558
|
source;
|
|
@@ -558,7 +563,7 @@ var Ve = () => typeof document > "u" ? !1 : document.documentElement.dataset[Ae]
|
|
|
558
563
|
(function(e) {
|
|
559
564
|
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";
|
|
560
565
|
})(M ||= {});
|
|
561
|
-
var
|
|
566
|
+
var Et = (e, t, n) => {
|
|
562
567
|
let r = n, i = 1e4;
|
|
563
568
|
do {
|
|
564
569
|
let n = t.map((t) => e.indexOf(t, r));
|
|
@@ -591,14 +596,14 @@ var Ct = (e, t, n) => {
|
|
|
591
596
|
break;
|
|
592
597
|
case "\"":
|
|
593
598
|
{
|
|
594
|
-
let t =
|
|
599
|
+
let t = Et(e, ["\""], o + 1);
|
|
595
600
|
if (t === -1) return -1;
|
|
596
601
|
r = t + 1;
|
|
597
602
|
}
|
|
598
603
|
break;
|
|
599
604
|
case "'":
|
|
600
605
|
{
|
|
601
|
-
let t =
|
|
606
|
+
let t = Et(e, ["'"], o + 1);
|
|
602
607
|
if (t === -1) return -1;
|
|
603
608
|
r = t + 1;
|
|
604
609
|
}
|
|
@@ -608,17 +613,17 @@ var Ct = (e, t, n) => {
|
|
|
608
613
|
i--;
|
|
609
614
|
} while (i > 0);
|
|
610
615
|
throw Error("Too many escaping");
|
|
611
|
-
},
|
|
616
|
+
}, Dt = /\/\*[^]*?(?:\*\/|$)/g;
|
|
612
617
|
function P(e) {
|
|
613
618
|
return e ? e.trim() : "";
|
|
614
619
|
}
|
|
615
|
-
function
|
|
620
|
+
function Ot(e, t) {
|
|
616
621
|
let n = e && typeof e.type == "string", r = n ? e : t;
|
|
617
622
|
for (let t in e) {
|
|
618
623
|
let n = e[t];
|
|
619
624
|
Array.isArray(n) ? n.forEach((e) => {
|
|
620
|
-
|
|
621
|
-
}) : n && typeof n == "object" &&
|
|
625
|
+
Ot(e, r);
|
|
626
|
+
}) : n && typeof n == "object" && Ot(n, r);
|
|
622
627
|
}
|
|
623
628
|
return n && Object.defineProperty(e, "parent", {
|
|
624
629
|
configurable: !0,
|
|
@@ -627,7 +632,7 @@ function Tt(e, t) {
|
|
|
627
632
|
value: t || null
|
|
628
633
|
}), e;
|
|
629
634
|
}
|
|
630
|
-
var
|
|
635
|
+
var kt = class {
|
|
631
636
|
level = 0;
|
|
632
637
|
indentation = " ";
|
|
633
638
|
compress = !1;
|
|
@@ -777,7 +782,7 @@ var Et = class {
|
|
|
777
782
|
declaration(e) {
|
|
778
783
|
return this.compress ? this.emit(`${e.property}:${e.value}`, e.position) + this.emit(";") : e.property === "grid-template-areas" ? this.emit(this.indent()) + this.emit(e.property + ": " + e.value.split("\n").join("\n".padEnd(22) + this.indent()), e.position) + this.emit(";") : this.emit(this.indent()) + this.emit(`${e.property}: ${e.value}`, e.position) + this.emit(";");
|
|
779
784
|
}
|
|
780
|
-
},
|
|
785
|
+
}, At = (e, t) => {
|
|
781
786
|
t ||= {};
|
|
782
787
|
let n = 1, r = 1;
|
|
783
788
|
function i() {
|
|
@@ -785,14 +790,14 @@ var Et = class {
|
|
|
785
790
|
line: n,
|
|
786
791
|
column: r
|
|
787
792
|
};
|
|
788
|
-
return (i) => (i.position = new
|
|
793
|
+
return (i) => (i.position = new Tt(e, {
|
|
789
794
|
line: n,
|
|
790
795
|
column: r
|
|
791
796
|
}, t?.source || ""), u(), i);
|
|
792
797
|
}
|
|
793
798
|
let a = [];
|
|
794
799
|
function o(i) {
|
|
795
|
-
let o = new
|
|
800
|
+
let o = new wt(t?.source || "", i, n, r, e);
|
|
796
801
|
if (!t?.silent) throw o;
|
|
797
802
|
a.push(o);
|
|
798
803
|
}
|
|
@@ -844,7 +849,7 @@ var Et = class {
|
|
|
844
849
|
n.push(e.substring(r, i)), r = i + 1;
|
|
845
850
|
}
|
|
846
851
|
return n;
|
|
847
|
-
})(P(n).replace(
|
|
852
|
+
})(P(n).replace(Dt, ""), [","]).map((e) => P(e));
|
|
848
853
|
}
|
|
849
854
|
function m() {
|
|
850
855
|
let t = i(), n = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);
|
|
@@ -854,10 +859,10 @@ var Et = class {
|
|
|
854
859
|
if (!a) return o("property missing ':'");
|
|
855
860
|
l(a);
|
|
856
861
|
let s = "", c = N(e, [";", "}"]);
|
|
857
|
-
c !== -1 && (s = e.substring(0, c), l([s]), s = P(s).replace(
|
|
862
|
+
c !== -1 && (s = e.substring(0, c), l([s]), s = P(s).replace(Dt, ""));
|
|
858
863
|
let u = t({
|
|
859
864
|
type: M.declaration,
|
|
860
|
-
property: r.replace(
|
|
865
|
+
property: r.replace(Dt, ""),
|
|
861
866
|
value: s
|
|
862
867
|
}), d = /^[;\s]*/.exec(e);
|
|
863
868
|
return d && l(d), u;
|
|
@@ -1235,7 +1240,7 @@ var Et = class {
|
|
|
1235
1240
|
declarations: _() || []
|
|
1236
1241
|
})) : o("selector missing");
|
|
1237
1242
|
}
|
|
1238
|
-
return
|
|
1243
|
+
return Ot(function() {
|
|
1239
1244
|
let n = function() {
|
|
1240
1245
|
let n, r = [];
|
|
1241
1246
|
for (u(), d(r); e.length;) {
|
|
@@ -1266,66 +1271,66 @@ var Et = class {
|
|
|
1266
1271
|
}
|
|
1267
1272
|
};
|
|
1268
1273
|
}());
|
|
1269
|
-
},
|
|
1274
|
+
}, jt = (e, t) => new kt(t || {}).compile(e), Mt = Object.defineProperty, Nt = (e, t) => {
|
|
1270
1275
|
let n = {};
|
|
1271
|
-
for (var r in e)
|
|
1276
|
+
for (var r in e) Mt(n, r, {
|
|
1272
1277
|
get: e[r],
|
|
1273
1278
|
enumerable: !0
|
|
1274
1279
|
});
|
|
1275
|
-
return t ||
|
|
1276
|
-
},
|
|
1277
|
-
name:
|
|
1280
|
+
return t || Mt(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
1281
|
+
}, Pt = "LocatorError", Ft = "LocatorUnsupportedError", It = "LocatorDeniedError", Lt = "LocatorInvalidError", Rt = (e) => typeof e == "object" && e ? e.name : void 0, F = (e) => Object.assign(Error(e), { name: Pt }), I = (e, t = "", n) => Object.assign(Error(e), {
|
|
1282
|
+
name: Ft,
|
|
1278
1283
|
operation: t,
|
|
1279
1284
|
backend: n
|
|
1280
|
-
}),
|
|
1281
|
-
name:
|
|
1285
|
+
}), zt = (e, t) => I(`Locator operation not supported${t ? ` on the ${t} backend` : ""}: ${e}`, e, t), L = (e, t) => Object.assign(Error(e), {
|
|
1286
|
+
name: It,
|
|
1282
1287
|
operation: t
|
|
1283
|
-
}),
|
|
1284
|
-
name:
|
|
1288
|
+
}), Bt = (e, t) => Object.assign(Error(e), {
|
|
1289
|
+
name: Lt,
|
|
1285
1290
|
operation: t
|
|
1286
1291
|
}), R = class extends Error {
|
|
1287
1292
|
name = "TimeoutError";
|
|
1288
1293
|
constructor(e, t) {
|
|
1289
1294
|
super(e, t?.cause === void 0 ? void 0 : { cause: t.cause });
|
|
1290
1295
|
}
|
|
1291
|
-
},
|
|
1296
|
+
}, Vt = (e) => Rt(e) === Ft, Ht = (e) => Rt(e) === It, Ut = (e) => Rt(e) === Lt, z = (e) => Ht(e) || Vt(e) || Ut(e), B = (e) => {
|
|
1292
1297
|
let t = (e.ownerDocument ?? e).defaultView;
|
|
1293
1298
|
if (!t) throw F("the resolved element belongs to a document with no window");
|
|
1294
1299
|
return t;
|
|
1295
|
-
},
|
|
1300
|
+
}, Wt = (e, t) => {
|
|
1296
1301
|
let n = e?.[t];
|
|
1297
1302
|
return typeof n == "function" ? n : null;
|
|
1298
|
-
},
|
|
1303
|
+
}, Gt = (e, t) => {
|
|
1299
1304
|
if (typeof e != "object" || !e) return null;
|
|
1300
1305
|
let n = (() => {
|
|
1301
1306
|
try {
|
|
1302
|
-
return
|
|
1307
|
+
return Wt(B(e), t);
|
|
1303
1308
|
} catch {
|
|
1304
1309
|
return null;
|
|
1305
1310
|
}
|
|
1306
1311
|
})();
|
|
1307
1312
|
if (n && e instanceof n) return n;
|
|
1308
|
-
let r =
|
|
1313
|
+
let r = Wt(globalThis, t);
|
|
1309
1314
|
return r && e instanceof r ? r : null;
|
|
1310
|
-
},
|
|
1315
|
+
}, V = (e, t) => Gt(e, t) !== null, H = (e) => {
|
|
1311
1316
|
if (e.length === 0) throw F("No elements found");
|
|
1312
1317
|
if (e.length > 1) throw F(`Strict mode violation: locator resolved to ${e.length} elements`);
|
|
1313
1318
|
return e[0];
|
|
1314
|
-
},
|
|
1315
|
-
if (!
|
|
1319
|
+
}, Kt = (e, t) => {
|
|
1320
|
+
if (!V(e, t)) throw F(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);
|
|
1316
1321
|
return e;
|
|
1317
|
-
},
|
|
1318
|
-
|
|
1319
|
-
},
|
|
1322
|
+
}, qt = (e) => e.tagName.toLowerCase(), Jt = /* @__PURE__ */ new Set(), Yt = (e) => {
|
|
1323
|
+
Jt.add(e);
|
|
1324
|
+
}, Xt = /(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i, Zt = (e) => e.replace(/\\([0-9a-fA-F]{1,6})\s?/g, (e, t) => String.fromCodePoint(Number.parseInt(t, 16))).replace(/\\(.)/g, "$1"), Qt = (e) => !Xt.test(Zt(e.value)), $t = /* @__PURE__ */ new Set([
|
|
1320
1325
|
M.import,
|
|
1321
1326
|
M.fontFace,
|
|
1322
1327
|
M.namespace,
|
|
1323
1328
|
M.charset,
|
|
1324
1329
|
M.document,
|
|
1325
1330
|
M.comment
|
|
1326
|
-
]),
|
|
1327
|
-
if (
|
|
1328
|
-
if (e.type === M.declaration) return
|
|
1331
|
+
]), en = (e) => {
|
|
1332
|
+
if ($t.has(e.type)) return null;
|
|
1333
|
+
if (e.type === M.declaration) return Qt(e) ? e : null;
|
|
1329
1334
|
let t = e, n = { ...t };
|
|
1330
1335
|
for (let e of [
|
|
1331
1336
|
"declarations",
|
|
@@ -1333,18 +1338,18 @@ var Et = class {
|
|
|
1333
1338
|
"keyframes"
|
|
1334
1339
|
]) {
|
|
1335
1340
|
let r = t[e];
|
|
1336
|
-
Array.isArray(r) && (n[e] =
|
|
1341
|
+
Array.isArray(r) && (n[e] = tn(r));
|
|
1337
1342
|
}
|
|
1338
1343
|
return n;
|
|
1339
|
-
},
|
|
1344
|
+
}, tn = (e) => e.map((e) => en(e)).filter((e) => e !== null), nn = (e) => {
|
|
1340
1345
|
let t;
|
|
1341
1346
|
try {
|
|
1342
|
-
t =
|
|
1347
|
+
t = At(e, { silent: !0 });
|
|
1343
1348
|
} catch {
|
|
1344
1349
|
return "";
|
|
1345
1350
|
}
|
|
1346
|
-
return t.stylesheet.rules =
|
|
1347
|
-
},
|
|
1351
|
+
return t.stylesheet.rules = tn(t.stylesheet.rules), jt(t);
|
|
1352
|
+
}, rn = (e, t) => {
|
|
1348
1353
|
let n = () => {
|
|
1349
1354
|
t.parentNode || (e.head ?? e.documentElement).appendChild(t);
|
|
1350
1355
|
};
|
|
@@ -1361,30 +1366,30 @@ var Et = class {
|
|
|
1361
1366
|
});
|
|
1362
1367
|
let i = () => r.disconnect(), a = e.defaultView;
|
|
1363
1368
|
a ? a.addEventListener("load", i, { once: !0 }) : setTimeout(i, 3e4);
|
|
1364
|
-
},
|
|
1369
|
+
}, an = { resolve: (e, t) => {
|
|
1365
1370
|
let n = e.document.createElement("style");
|
|
1366
|
-
n.textContent = t.noSanitize ? t.content :
|
|
1371
|
+
n.textContent = t.noSanitize ? t.content : nn(t.content);
|
|
1367
1372
|
try {
|
|
1368
|
-
|
|
1373
|
+
rn(e.document, n);
|
|
1369
1374
|
} catch (e) {
|
|
1370
1375
|
console.error(e);
|
|
1371
1376
|
}
|
|
1372
|
-
|
|
1373
|
-
} },
|
|
1377
|
+
Yt(n);
|
|
1378
|
+
} }, on = (e) => {
|
|
1374
1379
|
let t = [];
|
|
1375
1380
|
return e.forEach((e, n) => {
|
|
1376
1381
|
t.push([n, e]);
|
|
1377
1382
|
}), t;
|
|
1378
|
-
},
|
|
1383
|
+
}, U = {
|
|
1379
1384
|
kind: "frame",
|
|
1380
1385
|
ensureArgs: (e) => [void 0, e],
|
|
1381
1386
|
resolve: async (e, t, n = {}) => {
|
|
1382
|
-
if (typeof t != "string") throw
|
|
1383
|
-
let r =
|
|
1387
|
+
if (typeof t != "string") throw Bt("fetch: url must be a string", "fetch");
|
|
1388
|
+
let r = B(e.document), i;
|
|
1384
1389
|
try {
|
|
1385
1390
|
i = new r.URL(t, e.document.baseURI).href;
|
|
1386
1391
|
} catch {
|
|
1387
|
-
throw
|
|
1392
|
+
throw Bt(`fetch: not a valid url: ${t}`, "fetch");
|
|
1388
1393
|
}
|
|
1389
1394
|
let a = await r.fetch(i, {
|
|
1390
1395
|
method: n.method ?? "GET",
|
|
@@ -1400,31 +1405,31 @@ var Et = class {
|
|
|
1400
1405
|
url: a.url,
|
|
1401
1406
|
redirected: a.redirected,
|
|
1402
1407
|
type: a.type,
|
|
1403
|
-
headers:
|
|
1408
|
+
headers: on(a.headers),
|
|
1404
1409
|
body: await a.arrayBuffer()
|
|
1405
1410
|
};
|
|
1406
1411
|
}
|
|
1407
|
-
},
|
|
1408
|
-
click: () =>
|
|
1409
|
-
count: () =>
|
|
1410
|
-
exists: () =>
|
|
1411
|
-
fill: () =>
|
|
1412
|
-
getAttribute: () =>
|
|
1413
|
-
hover: () =>
|
|
1414
|
-
isVisible: () =>
|
|
1415
|
-
textContent: () =>
|
|
1416
|
-
}),
|
|
1412
|
+
}, W = /* @__PURE__ */ Nt({
|
|
1413
|
+
click: () => cn,
|
|
1414
|
+
count: () => gn,
|
|
1415
|
+
exists: () => _n,
|
|
1416
|
+
fill: () => fn,
|
|
1417
|
+
getAttribute: () => mn,
|
|
1418
|
+
hover: () => ln,
|
|
1419
|
+
isVisible: () => hn,
|
|
1420
|
+
textContent: () => pn
|
|
1421
|
+
}), sn = (e, t) => {
|
|
1417
1422
|
let n = e.getBoundingClientRect();
|
|
1418
1423
|
return {
|
|
1419
1424
|
clientX: n.left + n.width * (t?.x ?? .5),
|
|
1420
1425
|
clientY: n.top + n.height * (t?.y ?? .5)
|
|
1421
1426
|
};
|
|
1422
|
-
},
|
|
1423
|
-
let n =
|
|
1427
|
+
}, cn = { resolve: (e, t = {}) => {
|
|
1428
|
+
let n = H(e.elements), r = B(n), i = {
|
|
1424
1429
|
bubbles: !0,
|
|
1425
1430
|
cancelable: !0,
|
|
1426
1431
|
composed: !0,
|
|
1427
|
-
...
|
|
1432
|
+
...sn(n, t.position),
|
|
1428
1433
|
button: 0
|
|
1429
1434
|
}, a = {
|
|
1430
1435
|
...i,
|
|
@@ -1448,12 +1453,12 @@ var Et = class {
|
|
|
1448
1453
|
...i,
|
|
1449
1454
|
buttons: 0
|
|
1450
1455
|
}));
|
|
1451
|
-
} },
|
|
1452
|
-
let n =
|
|
1456
|
+
} }, ln = { resolve: (e, t = {}) => {
|
|
1457
|
+
let n = H(e.elements), r = B(n), i = {
|
|
1453
1458
|
bubbles: !0,
|
|
1454
1459
|
cancelable: !0,
|
|
1455
1460
|
composed: !0,
|
|
1456
|
-
...
|
|
1461
|
+
...sn(n, t.position)
|
|
1457
1462
|
}, a = {
|
|
1458
1463
|
...i,
|
|
1459
1464
|
pointerType: "mouse",
|
|
@@ -1467,11 +1472,11 @@ var Et = class {
|
|
|
1467
1472
|
...i,
|
|
1468
1473
|
bubbles: !1
|
|
1469
1474
|
})), n.dispatchEvent(new r.MouseEvent("mouseover", i)), n.dispatchEvent(new r.PointerEvent("pointermove", a)), n.dispatchEvent(new r.MouseEvent("mousemove", i));
|
|
1470
|
-
} },
|
|
1475
|
+
} }, un = (e, t) => {
|
|
1471
1476
|
e._valueTracker?.setValue("");
|
|
1472
|
-
let n = (
|
|
1477
|
+
let n = (Gt(e, "HTMLTextAreaElement") ?? Gt(e, "HTMLInputElement"))?.prototype, r = n && Object.getOwnPropertyDescriptor(n, "value")?.set;
|
|
1473
1478
|
r ? r.call(e, t) : e.value = t;
|
|
1474
|
-
},
|
|
1479
|
+
}, dn = (e, t) => {
|
|
1475
1480
|
if (e.type !== "range") return null;
|
|
1476
1481
|
let n = Number(e.min || 0), r = Number(e.max || 100);
|
|
1477
1482
|
if (!Number.isFinite(n) || !Number.isFinite(r) || r <= n) return null;
|
|
@@ -1508,61 +1513,61 @@ var Et = class {
|
|
|
1508
1513
|
buttons: 0
|
|
1509
1514
|
}
|
|
1510
1515
|
};
|
|
1511
|
-
},
|
|
1512
|
-
let r =
|
|
1513
|
-
if (a ||
|
|
1514
|
-
let e = r, n = a ?
|
|
1515
|
-
n && (r.dispatchEvent(new i.PointerEvent("pointerdown", n.pointerDown)), r.dispatchEvent(new i.MouseEvent("mousedown", n.mouseDown))),
|
|
1516
|
+
}, fn = { resolve: (e, t, n = {}) => {
|
|
1517
|
+
let r = H(e.elements), i = B(r), a = V(r, "HTMLInputElement");
|
|
1518
|
+
if (a || V(r, "HTMLTextAreaElement")) {
|
|
1519
|
+
let e = r, n = a ? dn(e, t) : null;
|
|
1520
|
+
n && (r.dispatchEvent(new i.PointerEvent("pointerdown", n.pointerDown)), r.dispatchEvent(new i.MouseEvent("mousedown", n.mouseDown))), un(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 }));
|
|
1516
1521
|
return;
|
|
1517
1522
|
}
|
|
1518
|
-
if (
|
|
1523
|
+
if (V(r, "HTMLElement") && r.isContentEditable) {
|
|
1519
1524
|
r.textContent = t, r.dispatchEvent(new i.Event("input", { bubbles: !0 }));
|
|
1520
1525
|
return;
|
|
1521
1526
|
}
|
|
1522
|
-
throw Error(`fill: element <${
|
|
1523
|
-
} },
|
|
1524
|
-
let n =
|
|
1525
|
-
if (!
|
|
1526
|
-
let r =
|
|
1527
|
+
throw Error(`fill: element <${qt(r)}> is not fillable`);
|
|
1528
|
+
} }, pn = { resolve: (e, t = {}) => H(e.elements).textContent }, mn = { resolve: (e, t, n = {}) => H(e.elements).getAttribute(t) }, hn = { resolve: (e, t = {}) => {
|
|
1529
|
+
let n = H(e.elements);
|
|
1530
|
+
if (!V(n, "HTMLElement")) return !0;
|
|
1531
|
+
let r = B(n).getComputedStyle(n);
|
|
1527
1532
|
if (r?.display === "none" || r?.visibility === "hidden") return !1;
|
|
1528
1533
|
let i = n.getBoundingClientRect();
|
|
1529
1534
|
return i.width > 0 && i.height > 0;
|
|
1530
|
-
} },
|
|
1535
|
+
} }, gn = { resolve: (e, t = {}) => e.elements.length }, _n = { resolve: (e, t = {}) => e.elements.length > 0 }, G = (e, t) => (e.topLevel ? [e.document] : e.elements).flatMap((e) => [...e.querySelectorAll(t)]), vn = (e) => e.replaceAll("\"", "\\\""), yn = {
|
|
1531
1536
|
to: "element",
|
|
1532
1537
|
css: !0,
|
|
1533
|
-
resolve: (e, t) =>
|
|
1538
|
+
resolve: (e, t) => G(e, t),
|
|
1534
1539
|
render: (e) => ({
|
|
1535
1540
|
fragment: typeof e == "string" ? e : "?",
|
|
1536
1541
|
separator: "descend"
|
|
1537
1542
|
})
|
|
1538
|
-
},
|
|
1543
|
+
}, bn = {
|
|
1539
1544
|
to: "frame",
|
|
1540
1545
|
css: !0,
|
|
1541
1546
|
barrier: "down",
|
|
1542
|
-
resolve: (e, t) =>
|
|
1547
|
+
resolve: (e, t) => G(e, t),
|
|
1543
1548
|
render: (e) => ({
|
|
1544
1549
|
fragment: typeof e == "string" ? e : "?",
|
|
1545
1550
|
separator: "down"
|
|
1546
1551
|
})
|
|
1547
|
-
},
|
|
1552
|
+
}, xn = {
|
|
1548
1553
|
element: {
|
|
1549
1554
|
selectors: {
|
|
1550
|
-
locator:
|
|
1551
|
-
frameLocator:
|
|
1555
|
+
locator: yn,
|
|
1556
|
+
frameLocator: bn,
|
|
1552
1557
|
getByRole: {
|
|
1553
1558
|
to: "element",
|
|
1554
|
-
resolve: (e, t) =>
|
|
1555
|
-
render: (e) => ({ fragment: typeof e == "string" ? `[role="${
|
|
1559
|
+
resolve: (e, t) => G(e, `[role="${CSS.escape(t)}"]`),
|
|
1560
|
+
render: (e) => ({ fragment: typeof e == "string" ? `[role="${vn(e)}"]` : "[role]" })
|
|
1556
1561
|
},
|
|
1557
1562
|
getByText: {
|
|
1558
1563
|
to: "element",
|
|
1559
1564
|
resolve: (e, t) => e.elements.flatMap((e) => [e, ...e.querySelectorAll("*")]).filter((e) => e.textContent?.includes(t)),
|
|
1560
|
-
render: (e) => ({ fragment: typeof e == "string" ? `:has-text("${
|
|
1565
|
+
render: (e) => ({ fragment: typeof e == "string" ? `:has-text("${vn(e)}")` : ":has-text(...)" })
|
|
1561
1566
|
},
|
|
1562
1567
|
getByTestId: {
|
|
1563
1568
|
to: "element",
|
|
1564
|
-
resolve: (e, t) =>
|
|
1565
|
-
render: (e) => ({ fragment: typeof e == "string" ? `[data-testid="${
|
|
1569
|
+
resolve: (e, t) => G(e, `[data-testid="${CSS.escape(t)}"]`),
|
|
1570
|
+
render: (e) => ({ fragment: typeof e == "string" ? `[data-testid="${vn(e)}"]` : "[data-testid]" })
|
|
1566
1571
|
},
|
|
1567
1572
|
first: {
|
|
1568
1573
|
to: "element",
|
|
@@ -1579,20 +1584,20 @@ var Et = class {
|
|
|
1579
1584
|
}
|
|
1580
1585
|
},
|
|
1581
1586
|
operations: {
|
|
1582
|
-
click:
|
|
1583
|
-
fill:
|
|
1584
|
-
hover:
|
|
1585
|
-
textContent:
|
|
1586
|
-
getAttribute:
|
|
1587
|
-
isVisible:
|
|
1588
|
-
count:
|
|
1589
|
-
exists:
|
|
1587
|
+
click: cn,
|
|
1588
|
+
fill: fn,
|
|
1589
|
+
hover: ln,
|
|
1590
|
+
textContent: pn,
|
|
1591
|
+
getAttribute: mn,
|
|
1592
|
+
isVisible: hn,
|
|
1593
|
+
count: gn,
|
|
1594
|
+
exists: _n
|
|
1590
1595
|
}
|
|
1591
1596
|
},
|
|
1592
1597
|
frame: {
|
|
1593
1598
|
selectors: {
|
|
1594
|
-
locator:
|
|
1595
|
-
frameLocator:
|
|
1599
|
+
locator: yn,
|
|
1600
|
+
frameLocator: bn,
|
|
1596
1601
|
owner: {
|
|
1597
1602
|
to: "frame",
|
|
1598
1603
|
barrier: "up",
|
|
@@ -1606,11 +1611,11 @@ var Et = class {
|
|
|
1606
1611
|
}
|
|
1607
1612
|
},
|
|
1608
1613
|
operations: {
|
|
1609
|
-
addStyleTag:
|
|
1610
|
-
fetch:
|
|
1614
|
+
addStyleTag: an,
|
|
1615
|
+
fetch: U
|
|
1611
1616
|
}
|
|
1612
1617
|
}
|
|
1613
|
-
},
|
|
1618
|
+
}, Sn = (e, t = xn) => ({
|
|
1614
1619
|
element: {
|
|
1615
1620
|
selectors: {
|
|
1616
1621
|
...t.element.selectors,
|
|
@@ -1631,31 +1636,31 @@ var Et = class {
|
|
|
1631
1636
|
...e.frame?.operations
|
|
1632
1637
|
}
|
|
1633
1638
|
}
|
|
1634
|
-
}),
|
|
1639
|
+
}), Cn = 3e4, wn = 50, K = (e) => {
|
|
1635
1640
|
let t = e[e.length - 1];
|
|
1636
1641
|
return typeof t == "object" && t ? t : void 0;
|
|
1637
|
-
},
|
|
1638
|
-
let t =
|
|
1639
|
-
return typeof t == "number" ? t :
|
|
1640
|
-
},
|
|
1642
|
+
}, Tn = (e) => {
|
|
1643
|
+
let t = K(e)?.timeout;
|
|
1644
|
+
return typeof t == "number" ? t : Cn;
|
|
1645
|
+
}, En = ({ executor: e, parts: t }) => ({ highlight: (n) => e.highlight(t, n).then(() => {}, () => {}) }), Dn = async (e) => {
|
|
1641
1646
|
let t = {
|
|
1642
1647
|
parts: e.parts,
|
|
1643
1648
|
operation: e.operation,
|
|
1644
1649
|
args: e.args,
|
|
1645
1650
|
phase: "ensure"
|
|
1646
1651
|
};
|
|
1647
|
-
await e.gate?.(t,
|
|
1648
|
-
},
|
|
1652
|
+
await e.gate?.(t, En(e));
|
|
1653
|
+
}, On = (e, t) => {
|
|
1649
1654
|
if (t !== void 0 && typeof t == "number" && !(Number.isFinite(t) && t > 0)) throw TypeError(`${e}: timeout must be a positive number of milliseconds, not ${t}; every call ends at its deadline, so 0 does not turn it off`);
|
|
1650
|
-
},
|
|
1655
|
+
}, kn = (e) => typeof e == "object" && e && typeof e.message == "string" ? e.message : String(e), An = async (e) => {
|
|
1651
1656
|
let { executor: t, gate: n, parts: r, operation: i, args: a } = e;
|
|
1652
|
-
|
|
1657
|
+
On(i, K(a)?.timeout), n && await n({
|
|
1653
1658
|
parts: r,
|
|
1654
1659
|
operation: i,
|
|
1655
1660
|
args: a,
|
|
1656
1661
|
phase: "execute"
|
|
1657
|
-
},
|
|
1658
|
-
let o =
|
|
1662
|
+
}, En(e));
|
|
1663
|
+
let o = Tn(a), s = Date.now() + o, c = /* @__PURE__ */ Error(`Locator timeout (${o}ms): ${i}`), { promise: l, reject: u } = Promise.withResolvers();
|
|
1659
1664
|
l.catch(() => {});
|
|
1660
1665
|
let d = setTimeout(() => u(c), o), f = c;
|
|
1661
1666
|
try {
|
|
@@ -1664,48 +1669,48 @@ var Et = class {
|
|
|
1664
1669
|
return await Promise.race([t.execute(r, i, a), l]);
|
|
1665
1670
|
} catch (e) {
|
|
1666
1671
|
if (e === c) break;
|
|
1667
|
-
if (
|
|
1672
|
+
if (z(e)) throw e;
|
|
1668
1673
|
f = e;
|
|
1669
1674
|
let t = s - Date.now();
|
|
1670
1675
|
if (t <= 0) break;
|
|
1671
|
-
await new Promise((e) => setTimeout(e, Math.min(
|
|
1676
|
+
await new Promise((e) => setTimeout(e, Math.min(wn, t)));
|
|
1672
1677
|
}
|
|
1673
1678
|
while (Date.now() < s);
|
|
1674
1679
|
} finally {
|
|
1675
1680
|
clearTimeout(d);
|
|
1676
1681
|
}
|
|
1677
|
-
throw f === c ? new R(c.message) : new R(
|
|
1678
|
-
},
|
|
1682
|
+
throw f === c ? new R(c.message) : new R(kn(f), { cause: f });
|
|
1683
|
+
}, jn = (e, t, n, r, i) => {
|
|
1679
1684
|
let a = {};
|
|
1680
|
-
for (let [o, s] of Object.entries(t[r].selectors)) a[o] = (...a) =>
|
|
1685
|
+
for (let [o, s] of Object.entries(t[r].selectors)) a[o] = (...a) => jn(e, t, n, s.to, [...i, {
|
|
1681
1686
|
kind: r,
|
|
1682
1687
|
name: o,
|
|
1683
1688
|
args: a
|
|
1684
1689
|
}]);
|
|
1685
|
-
for (let [n, o] of Object.entries(t[r].operations)) a[n] = async (...t) =>
|
|
1690
|
+
for (let [n, o] of Object.entries(t[r].operations)) a[n] = async (...t) => An({
|
|
1686
1691
|
...e,
|
|
1687
1692
|
parts: i,
|
|
1688
1693
|
operation: n,
|
|
1689
1694
|
args: o.send ? o.send(...t) : t
|
|
1690
1695
|
});
|
|
1691
|
-
for (let [o, { to: s, rewrite: c }] of Object.entries(n[r] ?? {})) a[o] = (...r) =>
|
|
1696
|
+
for (let [o, { to: s, rewrite: c }] of Object.entries(n[r] ?? {})) a[o] = (...r) => jn(e, t, n, s, c(i, ...r));
|
|
1692
1697
|
return a.ensure = (n, a = {}) => {
|
|
1693
1698
|
let o = t[r].operations[n]?.ensureArgs;
|
|
1694
|
-
return
|
|
1699
|
+
return Dn({
|
|
1695
1700
|
...e,
|
|
1696
1701
|
parts: i,
|
|
1697
1702
|
operation: n,
|
|
1698
1703
|
args: o?.(a) ?? [a]
|
|
1699
1704
|
});
|
|
1700
1705
|
}, a;
|
|
1701
|
-
},
|
|
1702
|
-
let e =
|
|
1706
|
+
}, Mn = (e) => jn(e, e.modules ?? xn, e.rewrites ?? {}, "frame", []), Nn = () => {
|
|
1707
|
+
let e = T();
|
|
1703
1708
|
return e.status === "ok" && e.abi >= 2;
|
|
1704
|
-
},
|
|
1705
|
-
await
|
|
1706
|
-
let e =
|
|
1707
|
-
if (e.status === "ok" && e.abi < 2) throw new
|
|
1708
|
-
},
|
|
1709
|
+
}, Pn = async () => {
|
|
1710
|
+
await E();
|
|
1711
|
+
let e = T();
|
|
1712
|
+
if (e.status === "ok" && e.abi < 2) throw new C(e.abi, 2);
|
|
1713
|
+
}, Fn = (e) => `Read the text, links and details ${e} shows.`, In = (e) => `Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`, Ln = [
|
|
1709
1714
|
{
|
|
1710
1715
|
id: "interaction",
|
|
1711
1716
|
heading: "Interaction",
|
|
@@ -1720,9 +1725,9 @@ var Et = class {
|
|
|
1720
1725
|
heading: "Site data",
|
|
1721
1726
|
summary: "Can read the website's data",
|
|
1722
1727
|
title: (e) => `Read data from ${e}`,
|
|
1723
|
-
description:
|
|
1728
|
+
description: Fn,
|
|
1724
1729
|
cloudTitle: (e) => `Read what's on ${e}`,
|
|
1725
|
-
cloudDescription:
|
|
1730
|
+
cloudDescription: Fn
|
|
1726
1731
|
},
|
|
1727
1732
|
{
|
|
1728
1733
|
id: "network",
|
|
@@ -1738,11 +1743,11 @@ var Et = class {
|
|
|
1738
1743
|
heading: "Evaluation",
|
|
1739
1744
|
summary: "Can execute arbitrary code on the website",
|
|
1740
1745
|
title: (e) => `Run code on ${e}`,
|
|
1741
|
-
description:
|
|
1746
|
+
description: In,
|
|
1742
1747
|
cloudTitle: (e) => `Run its own code on ${e}`,
|
|
1743
|
-
cloudDescription:
|
|
1748
|
+
cloudDescription: In
|
|
1744
1749
|
}
|
|
1745
|
-
],
|
|
1750
|
+
], Rn = (e) => (t) => {
|
|
1746
1751
|
if (typeof t != "object" || !t) return t === void 0 ? [] : [t];
|
|
1747
1752
|
if (t.position !== void 0) throw TypeError(`${e}: position is Playwright's offset in pixels, which no backend serves yet; pass relativePosition, a 0..1 fraction of the box`);
|
|
1748
1753
|
let { relativePosition: n, ...r } = t;
|
|
@@ -1750,46 +1755,46 @@ var Et = class {
|
|
|
1750
1755
|
...r,
|
|
1751
1756
|
position: n
|
|
1752
1757
|
}];
|
|
1753
|
-
},
|
|
1758
|
+
}, zn = async (e, t, n) => {
|
|
1754
1759
|
try {
|
|
1755
|
-
return await
|
|
1760
|
+
return await U.resolve(e, t, n);
|
|
1756
1761
|
} catch (e) {
|
|
1757
|
-
throw
|
|
1762
|
+
throw z(e) ? e : L(`frame.fetch: ${e instanceof Error ? `${e.name}: ${e.message}` : String(e)}; not retried, since the request may already have been sent`, "fetch");
|
|
1758
1763
|
}
|
|
1759
|
-
},
|
|
1764
|
+
}, Bn = Sn({
|
|
1760
1765
|
element: { operations: {
|
|
1761
1766
|
click: {
|
|
1762
|
-
resolve: (e, t = {}) =>
|
|
1763
|
-
send:
|
|
1767
|
+
resolve: (e, t = {}) => W.click.resolve(e, t),
|
|
1768
|
+
send: Rn("click")
|
|
1764
1769
|
},
|
|
1765
1770
|
hover: {
|
|
1766
|
-
resolve: (e, t = {}) =>
|
|
1767
|
-
send:
|
|
1771
|
+
resolve: (e, t = {}) => W.hover.resolve(e, t),
|
|
1772
|
+
send: Rn("hover")
|
|
1768
1773
|
},
|
|
1769
|
-
fill: { resolve: (e, t, n = {}) =>
|
|
1770
|
-
textContent: { resolve: (e, t = {}) =>
|
|
1771
|
-
getAttribute: { resolve: (e, t, n = {}) =>
|
|
1772
|
-
isVisible: { resolve: (e, t = {}) =>
|
|
1773
|
-
count: { resolve: (e, t = {}) =>
|
|
1774
|
-
exists: { resolve: (e, t = {}) =>
|
|
1775
|
-
videoElement: { resolve: (e, t = {}) =>
|
|
1774
|
+
fill: { resolve: (e, t, n = {}) => W.fill.resolve(e, t, n) },
|
|
1775
|
+
textContent: { resolve: (e, t = {}) => W.textContent.resolve(e) },
|
|
1776
|
+
getAttribute: { resolve: (e, t, n = {}) => W.getAttribute.resolve(e, t) },
|
|
1777
|
+
isVisible: { resolve: (e, t = {}) => W.isVisible.resolve(e) },
|
|
1778
|
+
count: { resolve: (e, t = {}) => W.count.resolve(e) },
|
|
1779
|
+
exists: { resolve: (e, t = {}) => W.exists.resolve(e) },
|
|
1780
|
+
videoElement: { resolve: (e, t = {}) => ve(Kt(H(e.elements), "HTMLVideoElement")) }
|
|
1776
1781
|
} },
|
|
1777
1782
|
frame: { operations: {
|
|
1778
|
-
addStyleTag: { resolve: (e, t) =>
|
|
1783
|
+
addStyleTag: { resolve: (e, t) => an.resolve(e, t) },
|
|
1779
1784
|
fetch: {
|
|
1780
|
-
resolve: (e, t, n = {}) =>
|
|
1781
|
-
kind:
|
|
1782
|
-
ensureArgs:
|
|
1785
|
+
resolve: (e, t, n = {}) => zn(e, t, n),
|
|
1786
|
+
kind: U.kind,
|
|
1787
|
+
ensureArgs: U.ensureArgs
|
|
1783
1788
|
},
|
|
1784
1789
|
evaluate: {
|
|
1785
1790
|
kind: "frame",
|
|
1786
1791
|
typed: !1,
|
|
1787
1792
|
resolve: (e, t, n) => {
|
|
1788
|
-
throw
|
|
1793
|
+
throw zt("evaluate", "this realm");
|
|
1789
1794
|
}
|
|
1790
1795
|
}
|
|
1791
1796
|
} }
|
|
1792
|
-
}),
|
|
1797
|
+
}), Vn = (e) => e[e.length - 1], Hn = {
|
|
1793
1798
|
element: {
|
|
1794
1799
|
last: {
|
|
1795
1800
|
to: "element",
|
|
@@ -1802,7 +1807,7 @@ var Et = class {
|
|
|
1802
1807
|
contentFrame: {
|
|
1803
1808
|
to: "frame",
|
|
1804
1809
|
rewrite: (e) => {
|
|
1805
|
-
let t =
|
|
1810
|
+
let t = Vn(e);
|
|
1806
1811
|
if (t?.name !== "locator") throw TypeError("locator.contentFrame: only a locator that ends in locator(selector) can enter its frame; use frameLocator(selector)");
|
|
1807
1812
|
return [...e.slice(0, -1), {
|
|
1808
1813
|
...t,
|
|
@@ -1815,7 +1820,7 @@ var Et = class {
|
|
|
1815
1820
|
owner: {
|
|
1816
1821
|
to: "element",
|
|
1817
1822
|
rewrite: (e) => {
|
|
1818
|
-
let t =
|
|
1823
|
+
let t = Vn(e);
|
|
1819
1824
|
if (t?.name !== "frameLocator") throw TypeError("frameLocator.owner: this frame was not entered through frameLocator(selector)");
|
|
1820
1825
|
return [...e.slice(0, -1), {
|
|
1821
1826
|
...t,
|
|
@@ -1832,7 +1837,7 @@ var Et = class {
|
|
|
1832
1837
|
}]
|
|
1833
1838
|
}
|
|
1834
1839
|
}
|
|
1835
|
-
},
|
|
1840
|
+
}, Un = (e) => {
|
|
1836
1841
|
if (!e || e === "about:blank") return !1;
|
|
1837
1842
|
let t;
|
|
1838
1843
|
try {
|
|
@@ -1840,46 +1845,46 @@ var Et = class {
|
|
|
1840
1845
|
} catch {
|
|
1841
1846
|
return !1;
|
|
1842
1847
|
}
|
|
1843
|
-
return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" || t.protocol !== "about:" &&
|
|
1844
|
-
},
|
|
1845
|
-
if (
|
|
1846
|
-
},
|
|
1848
|
+
return t.protocol === "chrome-extension:" || t.protocol === "moz-extension:" || t.protocol !== "about:" && k(t.hostname);
|
|
1849
|
+
}, q = (e) => {
|
|
1850
|
+
if (Un(e)) throw Error("attachFrame: refusing to target the extension's own pages or an FKN platform origin");
|
|
1851
|
+
}, Wn = ({ src: e, domains: t, lockdown: n }) => {
|
|
1847
1852
|
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");
|
|
1848
|
-
},
|
|
1853
|
+
}, Gn = {
|
|
1849
1854
|
scope: "embed.iframe",
|
|
1850
1855
|
category: "interaction",
|
|
1851
1856
|
severity: 0,
|
|
1852
1857
|
title: "Load another website inside this app",
|
|
1853
1858
|
description: "Lets the app embed external pages directly inside its own view."
|
|
1854
|
-
},
|
|
1859
|
+
}, Kn = {
|
|
1855
1860
|
scope: "embed.open",
|
|
1856
1861
|
category: "interaction",
|
|
1857
1862
|
severity: 0,
|
|
1858
1863
|
title: "Open a website inside this app",
|
|
1859
1864
|
description: "Lets the app navigate to another site without leaving its window."
|
|
1860
|
-
},
|
|
1865
|
+
}, qn = ["load", "commit"], Jn = (e) => {
|
|
1861
1866
|
if ("timeoutMs" in e) throw TypeError("frame.goto: pass timeout, in milliseconds; timeoutMs is not an option");
|
|
1862
1867
|
let { waitUntil: t, timeout: n } = e;
|
|
1863
|
-
if (t !== void 0 && !
|
|
1868
|
+
if (t !== void 0 && !qn.includes(t)) throw TypeError(`frame.goto: waitUntil must be 'load' or 'commit', not ${JSON.stringify(t)}`);
|
|
1864
1869
|
if (n !== void 0 && typeof n != "number") throw TypeError("frame.goto: timeout must be a number of milliseconds");
|
|
1865
|
-
|
|
1866
|
-
},
|
|
1870
|
+
On("frame.goto", n);
|
|
1871
|
+
}, Yn = class extends Error {
|
|
1867
1872
|
name = "FrameWindowBlockedError";
|
|
1868
1873
|
constructor() {
|
|
1869
1874
|
super("attachFrame: the browser did not open the window. Call attachFrame directly in a click or key handler, and allow popups for this page");
|
|
1870
1875
|
}
|
|
1871
|
-
},
|
|
1876
|
+
}, Xn = /* @__PURE__ */ new Set([
|
|
1872
1877
|
"jar-unreachable",
|
|
1873
1878
|
"bad-url",
|
|
1874
1879
|
"opaque-opener"
|
|
1875
|
-
]),
|
|
1880
|
+
]), Zn = class extends Error {
|
|
1876
1881
|
name = "FrameWindowRefusedError";
|
|
1877
1882
|
reason;
|
|
1878
1883
|
constructor(e) {
|
|
1879
|
-
let t =
|
|
1884
|
+
let t = Xn.has(e) ? e : "unknown";
|
|
1880
1885
|
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;
|
|
1881
1886
|
}
|
|
1882
|
-
},
|
|
1887
|
+
}, Qn = ["message", "document"], $n = (e) => {
|
|
1883
1888
|
if (e === "*") return "*";
|
|
1884
1889
|
let t = () => /* @__PURE__ */ TypeError(`frame.postMessage: targetOrigin must be '*' or an origin, not ${JSON.stringify(e)}`);
|
|
1885
1890
|
if (typeof e != "string") throw t();
|
|
@@ -1891,48 +1896,48 @@ var Et = class {
|
|
|
1891
1896
|
}
|
|
1892
1897
|
if (n === "null") throw t();
|
|
1893
1898
|
return n;
|
|
1894
|
-
},
|
|
1899
|
+
}, er = (e, t) => {
|
|
1895
1900
|
let n = typeof e == "object" && !!e;
|
|
1896
1901
|
if (n && t !== void 0) throw TypeError("frame.postMessage: pass transfer inside the options object, not after it");
|
|
1897
1902
|
let r = n ? e.targetOrigin ?? "*" : e ?? "*", i = n ? e.transfer : t;
|
|
1898
1903
|
if (i !== void 0 && !Array.isArray(i)) throw TypeError("frame.postMessage: transfer must be an array");
|
|
1899
1904
|
return {
|
|
1900
|
-
targetOrigin:
|
|
1905
|
+
targetOrigin: $n(r),
|
|
1901
1906
|
transfer: i === void 0 ? [] : [...i]
|
|
1902
1907
|
};
|
|
1903
|
-
},
|
|
1908
|
+
}, tr = [
|
|
1904
1909
|
"url",
|
|
1905
1910
|
"path",
|
|
1906
1911
|
"type"
|
|
1907
|
-
],
|
|
1912
|
+
], nr = ["content", "sourceUrl"], rr = /[\n\r\u2028\u2029]/, ir = (e) => {
|
|
1908
1913
|
if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("frame.addScriptTag: options must be an object { content }");
|
|
1909
|
-
let t = Object.keys(e), n = t.find((e) =>
|
|
1914
|
+
let t = Object.keys(e), n = t.find((e) => tr.includes(e));
|
|
1910
1915
|
if (n !== void 0) throw TypeError(`frame.addScriptTag: "${n}" is not served; it runs content as a classic inline script`);
|
|
1911
|
-
let r = t.find((e) => !
|
|
1916
|
+
let r = t.find((e) => !nr.includes(e));
|
|
1912
1917
|
if (r !== void 0) throw TypeError(`frame.addScriptTag: unknown option "${r}"`);
|
|
1913
1918
|
let { content: i, sourceUrl: a } = e;
|
|
1914
1919
|
if (typeof i != "string") throw TypeError("frame.addScriptTag: content must be a string");
|
|
1915
|
-
if (a !== void 0 && (typeof a != "string" || a === "" ||
|
|
1920
|
+
if (a !== void 0 && (typeof a != "string" || a === "" || rr.test(a))) throw TypeError("frame.addScriptTag: sourceUrl must be a non-empty string with no line break");
|
|
1916
1921
|
return a === void 0 ? { content: i } : {
|
|
1917
1922
|
content: i,
|
|
1918
1923
|
sourceUrl: a
|
|
1919
1924
|
};
|
|
1920
|
-
},
|
|
1925
|
+
}, ar = [
|
|
1921
1926
|
"name",
|
|
1922
1927
|
"domain",
|
|
1923
1928
|
"path"
|
|
1924
|
-
],
|
|
1929
|
+
], or = (e) => e instanceof RegExp || Object.prototype.toString.call(e) === "[object RegExp]", sr = (e) => {
|
|
1925
1930
|
if (e === void 0) return {};
|
|
1926
1931
|
if (Object.prototype.toString.call(e) !== "[object Object]") throw TypeError("frame.clearCookies: options must be an object");
|
|
1927
|
-
let t = e, n = Object.keys(t).find((e) => !
|
|
1932
|
+
let t = e, n = Object.keys(t).find((e) => !ar.includes(e));
|
|
1928
1933
|
if (n !== void 0) throw TypeError(`frame.clearCookies: unknown option "${n}"`);
|
|
1929
|
-
let r =
|
|
1934
|
+
let r = ar.flatMap((e) => {
|
|
1930
1935
|
let n = t[e];
|
|
1931
1936
|
return n === void 0 ? [] : [{
|
|
1932
1937
|
key: e,
|
|
1933
1938
|
value: n
|
|
1934
1939
|
}];
|
|
1935
|
-
}), i = r.find(({ value: e }) =>
|
|
1940
|
+
}), i = r.find(({ value: e }) => or(e));
|
|
1936
1941
|
if (i !== void 0) throw TypeError(`frame.clearCookies: ${i.key} is a RegExp, and clearCookies takes strings for name, domain and path for now`);
|
|
1937
1942
|
let a = r.find(({ value: e }) => typeof e != "string");
|
|
1938
1943
|
if (a !== void 0) throw TypeError(`frame.clearCookies: ${a.key} must be a string`);
|
|
@@ -1941,15 +1946,18 @@ var Et = class {
|
|
|
1941
1946
|
let s = {};
|
|
1942
1947
|
for (let { key: e, value: t } of r) s[e] = { equals: t };
|
|
1943
1948
|
return s;
|
|
1944
|
-
},
|
|
1949
|
+
}, cr = (e) => {
|
|
1945
1950
|
typeof globalThis.reportError == "function" ? globalThis.reportError(e) : console.error(e);
|
|
1946
|
-
},
|
|
1947
|
-
let { owner: t, ...n } =
|
|
1951
|
+
}, lr = (e) => {
|
|
1952
|
+
let { owner: t, ...n } = Mn({
|
|
1948
1953
|
executor: e.executor,
|
|
1949
|
-
modules:
|
|
1950
|
-
rewrites:
|
|
1951
|
-
gate:
|
|
1952
|
-
|
|
1954
|
+
modules: Bn,
|
|
1955
|
+
rewrites: Hn,
|
|
1956
|
+
gate: async (t, n) => {
|
|
1957
|
+
A(t.operation, K(t.args)?.reason), await e.gate?.(t, n);
|
|
1958
|
+
}
|
|
1959
|
+
}), r = async (t, n = {}) => (q(t), Jn(n), e.goto(t, n)), i = () => e.url(), a = async (t) => {
|
|
1960
|
+
for (let e of t) A("frame.requestPermissions", e?.reason);
|
|
1953
1961
|
let n = e.requestPermissions;
|
|
1954
1962
|
if (!n) throw Error("frame.requestPermissions: this backend cannot ask for permission categories");
|
|
1955
1963
|
return n(t);
|
|
@@ -1960,18 +1968,18 @@ var Et = class {
|
|
|
1960
1968
|
if (typeof i != "string") throw TypeError("frame.evaluate: pass a function or a source string");
|
|
1961
1969
|
return r(i, structuredClone(n));
|
|
1962
1970
|
}, s = async (t) => {
|
|
1963
|
-
let { content: n, ...r } =
|
|
1971
|
+
let { content: n, ...r } = ir(t), i = e.addScriptTag;
|
|
1964
1972
|
if (!i) throw Error("frame.addScriptTag: this backend cannot run scripts in the attached frame");
|
|
1965
1973
|
await i(n, r);
|
|
1966
1974
|
}, c = async (t) => {
|
|
1967
|
-
let n =
|
|
1975
|
+
let n = sr(t), r = e.clearCookies;
|
|
1968
1976
|
if (!r) throw Error("frame.clearCookies: this backend cannot clear cookies");
|
|
1969
1977
|
await r(n);
|
|
1970
1978
|
}, l = ((t, n, r) => {
|
|
1971
1979
|
try {
|
|
1972
1980
|
let i = e.postMessage;
|
|
1973
1981
|
if (!i) throw Error("frame.postMessage: this backend cannot message the attached frame");
|
|
1974
|
-
let a =
|
|
1982
|
+
let a = er(n, r);
|
|
1975
1983
|
return i(t, a.targetOrigin, a.transfer);
|
|
1976
1984
|
} catch (e) {
|
|
1977
1985
|
return Promise.reject(e);
|
|
@@ -1980,7 +1988,7 @@ var Et = class {
|
|
|
1980
1988
|
message: /* @__PURE__ */ new Set(),
|
|
1981
1989
|
document: /* @__PURE__ */ new Set()
|
|
1982
1990
|
}, d = null, f = (e, t) => {
|
|
1983
|
-
if (!
|
|
1991
|
+
if (!Qn.includes(e)) throw TypeError(`frame.${t}: the event type must be ${Qn.map((e) => `'${e}'`).join(" or ")}, not ${JSON.stringify(e)}`);
|
|
1984
1992
|
return u[e];
|
|
1985
1993
|
}, p = (e) => {
|
|
1986
1994
|
let t = e.type === "message" ? Object.freeze({
|
|
@@ -1996,7 +2004,7 @@ var Et = class {
|
|
|
1996
2004
|
for (let n of [...u[e.type]]) try {
|
|
1997
2005
|
n(t);
|
|
1998
2006
|
} catch (e) {
|
|
1999
|
-
|
|
2007
|
+
cr(e);
|
|
2000
2008
|
}
|
|
2001
2009
|
}, m = (e, t) => {
|
|
2002
2010
|
if (f(e, "off").delete(t), d !== null && !u.message.size && !u.document.size) {
|
|
@@ -2029,7 +2037,7 @@ var Et = class {
|
|
|
2029
2037
|
off: m
|
|
2030
2038
|
};
|
|
2031
2039
|
return _;
|
|
2032
|
-
},
|
|
2040
|
+
}, ur = [
|
|
2033
2041
|
h,
|
|
2034
2042
|
t,
|
|
2035
2043
|
g,
|
|
@@ -2043,43 +2051,43 @@ var Et = class {
|
|
|
2043
2051
|
l,
|
|
2044
2052
|
f,
|
|
2045
2053
|
u,
|
|
2046
|
-
|
|
2047
|
-
|
|
2054
|
+
Gn,
|
|
2055
|
+
Kn,
|
|
2048
2056
|
m,
|
|
2049
2057
|
r,
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
],
|
|
2058
|
+
it,
|
|
2059
|
+
at,
|
|
2060
|
+
ot,
|
|
2061
|
+
yt,
|
|
2062
|
+
xt
|
|
2063
|
+
], dr = Ln.map((e) => e.id), fr = {
|
|
2056
2064
|
interaction: "act.click",
|
|
2057
2065
|
storage: "read.text",
|
|
2058
2066
|
network: "network.fetchCredentialed",
|
|
2059
2067
|
evaluation: "media.appearU"
|
|
2060
|
-
},
|
|
2068
|
+
}, pr = (e) => e === 0 ? "auto" : e === 4 ? "critical" : "bundled", mr = ur, J = /* @__PURE__ */ new Map(), hr = {};
|
|
2061
2069
|
(() => {
|
|
2062
|
-
|
|
2063
|
-
let e = (e) =>
|
|
2064
|
-
Object.fromEntries(
|
|
2070
|
+
J = new Map(mr.map((e) => [e.scope, e])), hr = Object.fromEntries(J), mr.filter((e) => e.severity === 4).map((e) => e.scope);
|
|
2071
|
+
let e = (e) => mr.filter((t) => t.category === e && pr(t.severity) === "bundled");
|
|
2072
|
+
Object.fromEntries(dr.map((t) => [t, Math.max(0, ...e(t).map((e) => e.severity))])), Object.fromEntries(dr.map((t) => [t, e(t).some((e) => e.unsafe === !0)]));
|
|
2065
2073
|
})();
|
|
2066
|
-
var
|
|
2067
|
-
let t =
|
|
2068
|
-
return t &&
|
|
2069
|
-
},
|
|
2070
|
-
let t =
|
|
2071
|
-
if (t) return
|
|
2072
|
-
},
|
|
2073
|
-
let n = t ?? (e &&
|
|
2074
|
-
return n !== void 0 &&
|
|
2075
|
-
},
|
|
2076
|
-
for (let { category: n, key: r } of t) if (
|
|
2074
|
+
var gr = (e) => J.get(e)?.category, _r = (e) => {
|
|
2075
|
+
let t = J.get(e);
|
|
2076
|
+
return t && pr(t.severity);
|
|
2077
|
+
}, vr = (e) => {
|
|
2078
|
+
let t = J.get(e);
|
|
2079
|
+
if (t) return pr(t.severity) === "critical" ? t.scope : t.category;
|
|
2080
|
+
}, yr = (e) => fr[e], br = ({ category: e, key: t }) => {
|
|
2081
|
+
let n = t ?? (e && yr(e));
|
|
2082
|
+
return n !== void 0 && gr(n) !== void 0 ? n : void 0;
|
|
2083
|
+
}, xr = (e, t) => {
|
|
2084
|
+
for (let { category: n, key: r } of t) if (br({
|
|
2077
2085
|
category: n,
|
|
2078
2086
|
key: r
|
|
2079
2087
|
}) === 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}"`);
|
|
2080
|
-
},
|
|
2088
|
+
}, Sr = (e, t = {}) => {
|
|
2081
2089
|
let n = [], r = e.map((e) => {
|
|
2082
|
-
let r =
|
|
2090
|
+
let r = br(e), i = [];
|
|
2083
2091
|
if (r !== void 0) for (let a of e.hosts) i.push(n.length), n.push({
|
|
2084
2092
|
...t,
|
|
2085
2093
|
key: r,
|
|
@@ -2089,8 +2097,8 @@ var fr = (e) => Y.get(e)?.category, pr = (e) => {
|
|
|
2089
2097
|
reason: e.reason
|
|
2090
2098
|
});
|
|
2091
2099
|
return {
|
|
2092
|
-
key: r !== void 0 &&
|
|
2093
|
-
category: r === void 0 ? e.category ?? "interaction" :
|
|
2100
|
+
key: r !== void 0 && _r(r) === "critical" ? r : void 0,
|
|
2101
|
+
category: r === void 0 ? e.category ?? "interaction" : hr[r].category,
|
|
2094
2102
|
hosts: e.hosts,
|
|
2095
2103
|
indexes: i
|
|
2096
2104
|
};
|
|
@@ -2104,31 +2112,31 @@ var fr = (e) => Y.get(e)?.category, pr = (e) => {
|
|
|
2104
2112
|
allow: i.length > 0 && i.every((t) => e[t]?.allow === !0)
|
|
2105
2113
|
}))
|
|
2106
2114
|
};
|
|
2107
|
-
},
|
|
2108
|
-
typeof window < "u" &&
|
|
2109
|
-
if (!
|
|
2115
|
+
}, Cr = (e) => typeof e == "object" && !!e, wr = typeof chrome < "u" && !!chrome.runtime?.id, Tr = (e) => Cr(e) && e.FKN_WEB_EXTENSION_FRAME_ANNOUNCE_KEY === !0 && typeof e.frameId == "string" && typeof e.document == "string", Er = /* @__PURE__ */ new WeakMap(), Dr = /* @__PURE__ */ new WeakMap(), Or = /* @__PURE__ */ new WeakMap(), kr = /* @__PURE__ */ new Set();
|
|
2116
|
+
typeof window < "u" && wr && window.addEventListener("message", (e) => {
|
|
2117
|
+
if (!Tr(e.data)) return;
|
|
2110
2118
|
e.stopImmediatePropagation();
|
|
2111
2119
|
let t = e.source;
|
|
2112
2120
|
if (!t || typeof t != "object") return;
|
|
2113
|
-
let n = t, r =
|
|
2114
|
-
if (
|
|
2115
|
-
let o =
|
|
2121
|
+
let n = t, r = Er.get(n), i = e.data.frameId, a = e.data.document;
|
|
2122
|
+
if (Er.set(n, i), Dr.set(n, a), r) for (let e of kr) e(r);
|
|
2123
|
+
let o = Or.get(n);
|
|
2116
2124
|
if (o) {
|
|
2117
2125
|
for (let e of [...o]) (e.notDocument === void 0 || e.notDocument !== a) && (o.delete(e), e.resolve(i));
|
|
2118
|
-
o.size ||
|
|
2126
|
+
o.size || Or.delete(n);
|
|
2119
2127
|
}
|
|
2120
2128
|
}, { capture: !0 });
|
|
2121
2129
|
//#endregion
|
|
2122
2130
|
//#region ../web-extension/lib/lib/evaluate-deadline.js
|
|
2123
|
-
var
|
|
2131
|
+
var Ar = 3e4, jr = `frame.evaluate: the code did not settle within ${Ar}ms`, Mr = () => new R(jr), Nr = (e) => Ut(e) && e.message === jr ? Mr() : e, Pr = [
|
|
2124
2132
|
/^frame load timed out after \d+ms for /,
|
|
2125
2133
|
/^frame goto: documentstart timed out$/,
|
|
2126
2134
|
/^navigation to .+ did not commit a document within \d+ms$/s
|
|
2127
|
-
],
|
|
2135
|
+
], Fr = (e) => {
|
|
2128
2136
|
if (e instanceof R) return e;
|
|
2129
2137
|
let t = typeof e?.message == "string" ? e.message : "";
|
|
2130
|
-
return
|
|
2131
|
-
},
|
|
2138
|
+
return Pr.some((e) => e.test(t)) ? new R(t) : e;
|
|
2139
|
+
}, Ir = (e) => {
|
|
2132
2140
|
let t = e;
|
|
2133
2141
|
if (t.window === void 0) return "iframe";
|
|
2134
2142
|
if (t.iframe !== void 0) throw TypeError("attachFrame: pass either iframe or window, not both");
|
|
@@ -2136,11 +2144,11 @@ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or
|
|
|
2136
2144
|
if (t.blank !== void 0) throw TypeError("attachFrame: blank does not apply to a window");
|
|
2137
2145
|
if (typeof t.window != "object" || t.window === null) throw TypeError("attachFrame: window must be an object");
|
|
2138
2146
|
return "window";
|
|
2139
|
-
},
|
|
2147
|
+
}, Lr = (e, t, n) => {
|
|
2140
2148
|
if (e === void 0) return t;
|
|
2141
2149
|
if (typeof e != "number" || !Number.isFinite(e) || e <= 0) throw TypeError(`attachFrame: window.${n} must be a positive number of CSS pixels`);
|
|
2142
2150
|
return Math.round(e);
|
|
2143
|
-
},
|
|
2151
|
+
}, Rr = ({ url: e, width: t, height: n }) => {
|
|
2144
2152
|
let r = (() => {
|
|
2145
2153
|
if (e === void 0 || e === "" || e === "about:blank") return "";
|
|
2146
2154
|
if (typeof e != "string") throw TypeError("attachFrame: window.url must be a string");
|
|
@@ -2154,12 +2162,12 @@ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or
|
|
|
2154
2162
|
if (t.protocol !== "http:" && t.protocol !== "https:") throw TypeError("attachFrame: window.url must be an http or https address");
|
|
2155
2163
|
return t.href;
|
|
2156
2164
|
})();
|
|
2157
|
-
return r &&
|
|
2165
|
+
return r && q(r), {
|
|
2158
2166
|
url: r,
|
|
2159
|
-
width:
|
|
2160
|
-
height:
|
|
2167
|
+
width: Lr(t, 500, "width"),
|
|
2168
|
+
height: Lr(n, 700, "height")
|
|
2161
2169
|
};
|
|
2162
|
-
},
|
|
2170
|
+
}, zr = "attachFrame: storageState seeds a fresh jar, so it needs cookies: 'ephemeral'", Br = 1e11, Vr = [
|
|
2163
2171
|
"name",
|
|
2164
2172
|
"value",
|
|
2165
2173
|
"domain",
|
|
@@ -2168,11 +2176,11 @@ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or
|
|
|
2168
2176
|
"httpOnly",
|
|
2169
2177
|
"secure",
|
|
2170
2178
|
"sameSite"
|
|
2171
|
-
],
|
|
2179
|
+
], Hr = [
|
|
2172
2180
|
"Strict",
|
|
2173
2181
|
"Lax",
|
|
2174
2182
|
"None"
|
|
2175
|
-
],
|
|
2183
|
+
], Y = /[;\x00-\x1f\x7f]/, X = (e, t) => /* @__PURE__ */ TypeError(`attachFrame: storageState${e} ${t}`), Z = (e) => Object.prototype.toString.call(e) === "[object Object]", Ur = (e) => {
|
|
2176
2184
|
let t = e.startsWith(".") ? e.slice(1) : e;
|
|
2177
2185
|
if (t === "") return null;
|
|
2178
2186
|
try {
|
|
@@ -2180,19 +2188,19 @@ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or
|
|
|
2180
2188
|
} catch {
|
|
2181
2189
|
return null;
|
|
2182
2190
|
}
|
|
2183
|
-
},
|
|
2191
|
+
}, Wr = (e, t) => {
|
|
2184
2192
|
if (!Z(e)) throw X(t, "must be an object");
|
|
2185
|
-
let n = Object.keys(e).find((e) => !
|
|
2193
|
+
let n = Object.keys(e).find((e) => !Vr.includes(e));
|
|
2186
2194
|
if (n !== void 0) throw X(`${t}.${n}`, "is not a cookie field");
|
|
2187
2195
|
let { name: r, value: i, domain: a, path: o, expires: s, httpOnly: c, secure: l, sameSite: u } = e;
|
|
2188
|
-
if (typeof r != "string" || r === "" || r.includes("=") ||
|
|
2189
|
-
if (typeof i != "string" ||
|
|
2190
|
-
if (typeof a != "string" ||
|
|
2191
|
-
if (o !== void 0 && (typeof o != "string" || !o.startsWith("/") ||
|
|
2196
|
+
if (typeof r != "string" || r === "" || r.includes("=") || Y.test(r)) throw X(`${t}.name`, "must be a non-empty string with no \"=\", \";\" or control character");
|
|
2197
|
+
if (typeof i != "string" || Y.test(i)) throw X(`${t}.value`, "must be a string with no \";\" or control character");
|
|
2198
|
+
if (typeof a != "string" || Ur(a) === null) throw X(`${t}.domain`, "must be a host: \".youtube.com\" for a cookie its subdomains also receive, \"www.youtube.com\" for a host-only one");
|
|
2199
|
+
if (o !== void 0 && (typeof o != "string" || !o.startsWith("/") || Y.test(o))) throw X(`${t}.path`, "must be a string starting with \"/\"");
|
|
2192
2200
|
if (s !== void 0 && (typeof s != "number" || !Number.isFinite(s) || s <= 0 && s !== -1)) throw X(`${t}.expires`, "must be -1 for a session cookie, or milliseconds since the epoch");
|
|
2193
2201
|
if (c !== void 0 && typeof c != "boolean") throw X(`${t}.httpOnly`, "must be a boolean");
|
|
2194
2202
|
if (l !== void 0 && typeof l != "boolean") throw X(`${t}.secure`, "must be a boolean");
|
|
2195
|
-
if (u !== void 0 && !
|
|
2203
|
+
if (u !== void 0 && !Hr.includes(u)) throw X(`${t}.sameSite`, `must be 'Strict', 'Lax' or 'None', not ${JSON.stringify(u)}`);
|
|
2196
2204
|
let d = r.toLowerCase();
|
|
2197
2205
|
if (u === "None" && l !== !0) throw X(t, "is SameSite=None, which needs secure: true");
|
|
2198
2206
|
if (d.startsWith("__secure-") && l !== !0) throw X(t, "is a __Secure- cookie, which needs secure: true");
|
|
@@ -2203,7 +2211,7 @@ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or
|
|
|
2203
2211
|
domain: a
|
|
2204
2212
|
};
|
|
2205
2213
|
return o !== void 0 && (f.path = o), s !== void 0 && (f.expires = s), c !== void 0 && (f.httpOnly = c), l !== void 0 && (f.secure = l), u !== void 0 && (f.sameSite = u), f;
|
|
2206
|
-
},
|
|
2214
|
+
}, Gr = (e, t) => {
|
|
2207
2215
|
if (!Z(e)) throw X(t, "must be an object { origin, localStorage }");
|
|
2208
2216
|
let n = Object.keys(e).find((e) => e !== "origin" && e !== "localStorage");
|
|
2209
2217
|
if (n !== void 0) throw X(`${t}.${n}`, "is not an origin field");
|
|
@@ -2227,31 +2235,32 @@ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or
|
|
|
2227
2235
|
};
|
|
2228
2236
|
})
|
|
2229
2237
|
};
|
|
2230
|
-
},
|
|
2238
|
+
}, Kr = (e) => {
|
|
2231
2239
|
if (!Z(e)) throw X("", "must be an object { cookies?, origins? }");
|
|
2232
2240
|
let t = Object.keys(e).find((e) => e !== "cookies" && e !== "origins");
|
|
2233
2241
|
if (t !== void 0) throw X(`.${t}`, "is not a storageState key; it takes cookies and origins");
|
|
2234
2242
|
let { cookies: n = [], origins: r = [] } = e;
|
|
2235
2243
|
if (!Array.isArray(n)) throw X(".cookies", "must be an array");
|
|
2236
2244
|
if (!Array.isArray(r)) throw X(".origins", "must be an array");
|
|
2237
|
-
let i = n.map((e, t) =>
|
|
2245
|
+
let i = n.map((e, t) => Wr(e, `.cookies[${t}]`)), a = r.map((e, t) => Gr(e, `.origins[${t}]`));
|
|
2238
2246
|
return i.forEach(({ expires: e }, t) => {
|
|
2239
|
-
if (e !== void 0 && e > 0 && e <
|
|
2247
|
+
if (e !== void 0 && e > 0 && e < Br) throw X(`.cookies[${t}].expires`, `is milliseconds since the epoch, and ${e} reads as a date before 1974; a Playwright storageState gives seconds, so multiply it by 1000`);
|
|
2240
2248
|
}), {
|
|
2241
2249
|
cookies: i,
|
|
2242
2250
|
origins: a
|
|
2243
2251
|
};
|
|
2244
|
-
},
|
|
2252
|
+
}, qr = [
|
|
2245
2253
|
"persistent",
|
|
2246
2254
|
"ephemeral",
|
|
2247
2255
|
"native"
|
|
2248
|
-
],
|
|
2249
|
-
if ("syncCookies" in e) throw TypeError(
|
|
2256
|
+
], Jr = "attachFrame: syncCookies was replaced by cookies. true is cookies: 'persistent', or 'native' for the person's own browser cookies on the extension; false is cookies: 'ephemeral'", Yr = (e) => {
|
|
2257
|
+
if ("syncCookies" in e) throw TypeError(Jr);
|
|
2250
2258
|
let { cookies: t = "persistent" } = e;
|
|
2251
|
-
if (!
|
|
2252
|
-
if (e.storageState !== void 0 && t !== "ephemeral") throw TypeError(
|
|
2253
|
-
let n = e.storageState === void 0 ? void 0 :
|
|
2259
|
+
if (!qr.includes(t)) throw TypeError(`attachFrame: cookies must be 'persistent', 'ephemeral' or 'native', not ${JSON.stringify(t)}`);
|
|
2260
|
+
if (e.storageState !== void 0 && t !== "ephemeral") throw TypeError(zr);
|
|
2261
|
+
let n = e.storageState === void 0 ? void 0 : Kr(e.storageState), r = Ir(e);
|
|
2254
2262
|
if (r === "iframe" && e.lockdown && t !== "native") throw TypeError("attachFrame: lockdown runs on the extension, which serves only cookies: 'native'");
|
|
2263
|
+
if (Array.isArray(e.permissions)) for (let t of e.permissions) A("attachFrame", t?.reason);
|
|
2255
2264
|
return n === void 0 ? {
|
|
2256
2265
|
kind: r,
|
|
2257
2266
|
cookies: t
|
|
@@ -2260,13 +2269,13 @@ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or
|
|
|
2260
2269
|
cookies: t,
|
|
2261
2270
|
storageState: n
|
|
2262
2271
|
};
|
|
2263
|
-
},
|
|
2264
|
-
|
|
2265
|
-
},
|
|
2266
|
-
let e =
|
|
2272
|
+
}, Xr = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY", Zr = !1, Qr = () => {
|
|
2273
|
+
Zr || (Zr = !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."));
|
|
2274
|
+
}, $r = "frame: this frame no longer holds the document the app attached it to", ei = "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", ti = () => {
|
|
2275
|
+
let e = T();
|
|
2267
2276
|
if (e.status === "ok" && e.abi >= 1) return;
|
|
2268
2277
|
let t = e.status === "absent" ? 0 : e.abi;
|
|
2269
|
-
throw new
|
|
2278
|
+
throw new w("lockdown", t, `attachFrame: the installed FKN WebExtension (ABI ${t}) may predate lockdown, and one that does attaches the frame with its CSP removed rather than locked down. Updating the extension fixes this.`);
|
|
2270
2279
|
}, Q = (e) => {
|
|
2271
2280
|
try {
|
|
2272
2281
|
return new URL(e, location.href).hostname;
|
|
@@ -2274,46 +2283,46 @@ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or
|
|
|
2274
2283
|
return "";
|
|
2275
2284
|
}
|
|
2276
2285
|
}, $ = () => {
|
|
2277
|
-
let e =
|
|
2286
|
+
let e = T();
|
|
2278
2287
|
return e.status === "absent" ? 0 : e.abi;
|
|
2279
|
-
},
|
|
2280
|
-
let f = new Set(p(o, { ipv6: !0 })), m = (e) => f.has(p([
|
|
2281
|
-
return
|
|
2288
|
+
}, ni = "attachFrame: a blank page is served by the cloud render proxy only; call cloud.attachFrame", ri = "frame.addScriptTag: an extension frame does not run scripts through mirage yet; attach with cloud.attachFrame", ii = "frame.clearCookies: an extension frame runs on the browser's own cookies (cookies: 'native'), which FKN does not clear; attach with cookies: 'persistent' to clear the app's jar", ai = ({ executeLocator: e, highlightLocator: t, ensureLocatorPermission: n, requestCategories: r, evaluateFrame: i, goto: a }, { hosts: o, url: s, page: c, unreachable: l, documents: u, navigated: d }) => {
|
|
2289
|
+
let f = new Set(p(o, { ipv6: !0 })), m = (e) => f.has(p([vt(e)], { ipv6: !0 })[0] ?? "");
|
|
2290
|
+
return lr({
|
|
2282
2291
|
backend: "extension",
|
|
2283
2292
|
executor: {
|
|
2284
2293
|
execute: e,
|
|
2285
2294
|
highlight: t
|
|
2286
2295
|
},
|
|
2287
2296
|
gate: (e) => n(e.parts, e.operation, e.args),
|
|
2288
|
-
requestPermissions: async (e) => (
|
|
2297
|
+
requestPermissions: async (e) => (xr("frame.requestPermissions", e), await Pn(), r(e)),
|
|
2289
2298
|
evaluate: async (e, t) => {
|
|
2290
|
-
if (!
|
|
2291
|
-
let e =
|
|
2292
|
-
throw new
|
|
2299
|
+
if (!ze(T(), "evaluate")) {
|
|
2300
|
+
let e = T();
|
|
2301
|
+
throw new w("evaluate", e.status === "ok" ? e.abi : 0);
|
|
2293
2302
|
}
|
|
2294
2303
|
return i({
|
|
2295
2304
|
source: e,
|
|
2296
2305
|
arg: t
|
|
2297
2306
|
}).catch((e) => {
|
|
2298
|
-
throw
|
|
2307
|
+
throw Nr(e);
|
|
2299
2308
|
});
|
|
2300
2309
|
},
|
|
2301
2310
|
addScriptTag: async () => {
|
|
2302
|
-
throw new
|
|
2311
|
+
throw new w("addScriptTag", $(), ri);
|
|
2303
2312
|
},
|
|
2304
2313
|
clearCookies: async () => {
|
|
2305
|
-
throw new
|
|
2314
|
+
throw new w("clearCookies", $(), ii);
|
|
2306
2315
|
},
|
|
2307
2316
|
postMessage: (e, t, n) => {
|
|
2308
|
-
if (t === "*") throw I(
|
|
2309
|
-
if (!m(t)) throw L(
|
|
2317
|
+
if (t === "*") throw I(ei, "postMessage", "extension");
|
|
2318
|
+
if (!m(t)) throw L($r, "postMessage");
|
|
2310
2319
|
let r = l();
|
|
2311
2320
|
if (r) throw r;
|
|
2312
2321
|
return c().postMessage(e, t, n), Promise.resolve();
|
|
2313
2322
|
},
|
|
2314
2323
|
listen: (e) => {
|
|
2315
2324
|
let t = (t) => {
|
|
2316
|
-
t.source !== null && t.source === c() && !
|
|
2325
|
+
t.source !== null && t.source === c() && !Tr(t.data) && m(t.origin) && e({
|
|
2317
2326
|
type: "message",
|
|
2318
2327
|
data: t.data,
|
|
2319
2328
|
origin: t.origin,
|
|
@@ -2338,21 +2347,21 @@ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or
|
|
|
2338
2347
|
...t === void 0 ? {} : { waitUntil: t === "commit" ? "documentstart" : t },
|
|
2339
2348
|
...n === void 0 ? {} : { timeoutMs: n }
|
|
2340
2349
|
}).catch((e) => {
|
|
2341
|
-
throw
|
|
2350
|
+
throw Fr(e);
|
|
2342
2351
|
});
|
|
2343
2352
|
},
|
|
2344
2353
|
url: s
|
|
2345
2354
|
});
|
|
2346
|
-
},
|
|
2347
|
-
if (i !== void 0) throw new
|
|
2355
|
+
}, oi = async ({ iframe: e, domains: t = [], lockdown: n = !1, permissions: r, blank: i }) => {
|
|
2356
|
+
if (i !== void 0) throw new w("blank", $(), ni);
|
|
2348
2357
|
let a = crypto.randomUUID();
|
|
2349
|
-
if (
|
|
2358
|
+
if (q(e.src), Wn({
|
|
2350
2359
|
src: e.src,
|
|
2351
2360
|
domains: t,
|
|
2352
2361
|
lockdown: n
|
|
2353
|
-
}), j("attachFrame", t), await
|
|
2354
|
-
e.dispatchEvent(new CustomEvent(
|
|
2355
|
-
let o =
|
|
2362
|
+
}), j("attachFrame", t), await E(), n && ti(), !e.isConnected) throw Error("attachFrame: the iframe must be connected to the document before attaching");
|
|
2363
|
+
e.dispatchEvent(new CustomEvent(Xr, { detail: a }));
|
|
2364
|
+
let o = ai(await D.attachFrame({
|
|
2356
2365
|
marker: a,
|
|
2357
2366
|
domains: t,
|
|
2358
2367
|
syncCookies: !0,
|
|
@@ -2364,17 +2373,17 @@ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or
|
|
|
2364
2373
|
unreachable: () => e.contentWindow === null ? L("frame: navigate the frame before postMessage", "postMessage") : void 0,
|
|
2365
2374
|
documents: (t) => (e.addEventListener("load", t), () => e.removeEventListener("load", t))
|
|
2366
2375
|
});
|
|
2367
|
-
return r?.length && (
|
|
2368
|
-
},
|
|
2369
|
-
let { domains: t = [], permissions: n } = e, { url: r, width: i, height: a } =
|
|
2376
|
+
return r?.length && (Nn() ? await o.requestPermissions(r) : Qr()), o;
|
|
2377
|
+
}, si = "attachFrame: a window on cookies: 'native' needs the FKN WebExtension, which is not on this page", ci = "frame.postMessage: this window's page no longer keeps a link to the app's page, so a message cannot reach it", li = "extension.attachFrame: the attached window closed; attach a fresh window", ui = (e) => `attachFrame: cookies: '${e}' runs on the cloud render proxy; call cloud.attachFrame or the top-level attachFrame`, di = async (e) => {
|
|
2378
|
+
let { domains: t = [], permissions: n } = e, { url: r, width: i, height: a } = Rr(e.window);
|
|
2370
2379
|
j("attachFrame", t);
|
|
2371
|
-
let o =
|
|
2372
|
-
if (!
|
|
2380
|
+
let o = T();
|
|
2381
|
+
if (!ze(o, "attachWindow")) throw o.status === "absent" ? new w("attachWindow", 0, si) : new w("attachWindow", o.abi);
|
|
2373
2382
|
let s = window.open(r || "about:blank", "_blank", `popup,width=${i},height=${a}`);
|
|
2374
|
-
if (!s) throw new
|
|
2383
|
+
if (!s) throw new Yn();
|
|
2375
2384
|
let c;
|
|
2376
2385
|
try {
|
|
2377
|
-
c = await
|
|
2386
|
+
c = await D.attachWindow({
|
|
2378
2387
|
url: r,
|
|
2379
2388
|
domains: t
|
|
2380
2389
|
});
|
|
@@ -2388,11 +2397,11 @@ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or
|
|
|
2388
2397
|
u = !0;
|
|
2389
2398
|
}, () => {
|
|
2390
2399
|
u = !0;
|
|
2391
|
-
}), f = r, p =
|
|
2400
|
+
}), f = r, p = ai(c, {
|
|
2392
2401
|
hosts: r ? [...t, Q(r)] : t,
|
|
2393
2402
|
url: () => f,
|
|
2394
2403
|
page: () => s,
|
|
2395
|
-
unreachable: () => u ? I(
|
|
2404
|
+
unreachable: () => u ? I(li, "postMessage", "extension") : s.closed ? L(ci, "postMessage") : void 0,
|
|
2396
2405
|
documents: (e) => {
|
|
2397
2406
|
let t = !0;
|
|
2398
2407
|
return (async () => {
|
|
@@ -2425,30 +2434,30 @@ var Er = 3e4, Dr = `frame.evaluate: the code did not settle within ${Er}ms`, Or
|
|
|
2425
2434
|
throw await h(), e;
|
|
2426
2435
|
}
|
|
2427
2436
|
return g;
|
|
2428
|
-
},
|
|
2429
|
-
let { kind: t, cookies: n } =
|
|
2430
|
-
if (n !== "native") throw new
|
|
2431
|
-
return t === "window" ?
|
|
2432
|
-
}),
|
|
2437
|
+
}, fi = (async (e) => {
|
|
2438
|
+
let { kind: t, cookies: n } = Yr(e);
|
|
2439
|
+
if (n !== "native") throw new w("cookies", $(), ui(n));
|
|
2440
|
+
return t === "window" ? di(e) : oi(e);
|
|
2441
|
+
}), pi = "permissions.request: pass hosts, the sites the grant applies to", mi = { request: async (e) => {
|
|
2433
2442
|
let t = e.map((e) => {
|
|
2434
2443
|
let { category: t, key: n, scope: r, reason: i, hosts: a } = e;
|
|
2435
|
-
if (!("hosts" in e) && !("category" in e)) return { legacy: {
|
|
2444
|
+
if (A("permissions.request", i), !("hosts" in e) && !("category" in e)) return { legacy: {
|
|
2436
2445
|
key: n,
|
|
2437
2446
|
scope: r ?? "",
|
|
2438
2447
|
reason: i
|
|
2439
2448
|
} };
|
|
2440
2449
|
let o = p(a ?? [], { ipv6: !0 });
|
|
2441
|
-
if (!o.length) throw TypeError(
|
|
2442
|
-
return
|
|
2450
|
+
if (!o.length) throw TypeError(pi);
|
|
2451
|
+
return _t("permissions.request", o), { ask: {
|
|
2443
2452
|
category: t,
|
|
2444
2453
|
key: n,
|
|
2445
2454
|
reason: i,
|
|
2446
2455
|
hosts: o
|
|
2447
2456
|
} };
|
|
2448
2457
|
}), n = t.flatMap((e) => "ask" in e ? [e.ask] : []);
|
|
2449
|
-
|
|
2450
|
-
let { items: r, answer: i } =
|
|
2458
|
+
xr("permissions.request", n), n.length && await Pn();
|
|
2459
|
+
let { items: r, answer: i } = Sr(n), a = t.flatMap((e) => "legacy" in e ? [e.legacy] : []), o = [...r, ...a], s = o.length ? await D.requestPermissions(o) : [], c = i(s.slice(0, r.length)), l = s.slice(r.length), u = 0, d = 0;
|
|
2451
2460
|
return t.map((e) => "ask" in e ? c[u++] : l[d++]);
|
|
2452
|
-
} },
|
|
2461
|
+
} }, hi = "PermissionDeniedError", gi = (e) => e instanceof Error ? e.name === hi : Cr(e) && e.name === "PermissionDeniedError";
|
|
2453
2462
|
//#endregion
|
|
2454
|
-
export {
|
|
2463
|
+
export { Ze as $, It as A, St as B, Un as C, Ft as D, R as E, Pt as F, at as G, yt as H, Ht as I, lt as J, ot as K, Lt as L, Ut as M, I as N, Vt as O, z as P, O as Q, xt as R, Wn as S, K as T, ut as U, bt as V, ft as W, nt as X, ct as Y, A as Z, Zn as _, S as _t, fi as a, We as at, Kn as b, Fr as c, w as ct, Cr as d, Re as dt, Ye as et, xr as f, Oe as ft, Yn as g, xe as gt, _r as h, ye as ht, Xr as i, T as it, zt as j, L as k, Ar as l, C as lt, vr as m, ve as mt, gi as n, Ve as nt, Yr as o, E as ot, gr as p, be as pt, it as q, mi as r, He as rt, Rr as s, ke as st, hi as t, Je as tt, Mr as u, Ae as ut, Gn as v, Ln as w, q as x, lr as y, Ct as z };
|