@fkn/lib 0.9.3 → 0.9.5
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-CtmJlpfo.js → api-Bhz3iB9m.js} +14 -14
- package/{api-UzF-KbxK.cjs → api-C75xqLFy.cjs} +1 -1
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.js +1 -1
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.js +1 -1
- package/cloud/net.cjs +1 -1
- package/cloud/net.js +1 -1
- package/{cloud-CAOIpDIH.d.ts → cloud-Bzjnrblb.d.ts} +1 -1
- package/{cloud-CnddU57R.js → cloud-CbNYpNK8.js} +4 -4
- package/{cloud-B_Q0iiCr.cjs → cloud-mWhpmEwZ.cjs} +1 -1
- package/cloud.cjs +1 -1
- package/cloud.d.ts +1 -1
- package/cloud.js +4 -4
- package/{dgram-C6ADuKcR.cjs → dgram-C2LmoO0A.cjs} +1 -1
- package/{dgram-Bq_i0wX0.js → dgram-D4JF_XW7.js} +1 -1
- package/dgram.cjs +1 -1
- package/dgram.js +1 -1
- package/dns.cjs +1 -1
- package/dns.js +1 -1
- package/extension-C6xmQRHj.js +78 -0
- package/extension-XC1EtYP6.d.ts +16 -0
- package/extension-dmTtpkT5.cjs +1 -0
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +3 -3
- package/fs/promises.cjs +1 -1
- package/fs/promises.js +1 -1
- package/{fs-V_Sx6o9N.cjs → fs-BXcz3BjJ.cjs} +1 -1
- package/{fs-DU9rph4j.js → fs-Bghx-1Hy.js} +2 -2
- package/fs.cjs +1 -1
- package/fs.js +1 -1
- package/http.cjs +1 -1
- package/http.js +1 -1
- package/{index-pr5vLVVT.d.ts → index-BQdGI3d3.d.ts} +22 -1
- package/index.cjs +1 -1
- package/index.d.ts +4 -4
- package/index.js +28 -28
- package/{net-kkSsmaSz.js → net-BgQYnATG.js} +1 -1
- package/{net-eFlsYreG.cjs → net-zOx2OVGc.cjs} +1 -1
- package/net.cjs +1 -1
- package/net.js +1 -1
- package/package.json +1 -1
- package/packages.cjs +1 -1
- package/packages.js +1 -1
- package/proxy-C67lCEBx.cjs +53 -0
- package/{proxy-8bvtaeNn.js → proxy-DGVOk4Q8.js} +161 -145
- package/{storage-YL0pIVoy.js → storage-D01O3zky.js} +1 -1
- package/{storage-fSj65-d5.cjs → storage-a3OhXFv2.cjs} +1 -1
- package/extension-D7SSKewV.d.ts +0 -16
- package/extension-H9AUHZdt.js +0 -73
- package/extension-QRMx3Qhh.cjs +0 -1
- package/proxy-D2cxusWD.cjs +0 -53
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { t } from "./api-
|
|
2
|
+
import { t } from "./api-Bhz3iB9m.js";
|
|
3
3
|
import { BoxBase as n, createTypedEventTarget as r, expose as i, recursiveBox as a, recursiveRevive as o } from "osra";
|
|
4
4
|
//#region node_modules/@mfkn/web-extension/lib/lib/revivables/event-proxy.js
|
|
5
5
|
var s = (e, t) => {
|
|
@@ -53,10 +53,10 @@ var s = (e, t) => {
|
|
|
53
53
|
dispatchEvent: (t) => e.remoteEvents.dispatchEvent(t)
|
|
54
54
|
};
|
|
55
55
|
}, u = /* @__PURE__ */ e({
|
|
56
|
-
box: () =>
|
|
56
|
+
box: () => C,
|
|
57
57
|
createVideoElementHandle: () => S,
|
|
58
|
-
isType: () =>
|
|
59
|
-
revive: () =>
|
|
58
|
+
isType: () => ie,
|
|
59
|
+
revive: () => w,
|
|
60
60
|
type: () => d
|
|
61
61
|
}), d = "videoElement", f = [
|
|
62
62
|
"currentTime",
|
|
@@ -234,7 +234,7 @@ var s = (e, t) => {
|
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
236
|
return Object.defineProperties(n, i), n;
|
|
237
|
-
}, S = (e) => x(y(e), b(e)),
|
|
237
|
+
}, S = (e) => x(y(e), b(e)), ie = (e) => typeof e == "object" && !!e && e[h] === !0, C = (e, t) => {
|
|
238
238
|
let r = e;
|
|
239
239
|
return {
|
|
240
240
|
...n,
|
|
@@ -242,67 +242,83 @@ var s = (e, t) => {
|
|
|
242
242
|
initialState: r[g],
|
|
243
243
|
controller: a(r[_], t)
|
|
244
244
|
};
|
|
245
|
-
},
|
|
245
|
+
}, w = (e, t) => {
|
|
246
246
|
let n = o(e.controller, t);
|
|
247
247
|
return x({ ...e.initialState }, n);
|
|
248
|
-
},
|
|
249
|
-
typeof document < "u" && document.addEventListener(
|
|
250
|
-
|
|
248
|
+
}, T = (e) => [u, ...e], ae = "FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY", oe = "fknExtension", E = r();
|
|
249
|
+
typeof document < "u" && document.addEventListener(ae, () => {
|
|
250
|
+
E.dispatchEvent(new CustomEvent("statuschange", { detail: { enabled: D() } }));
|
|
251
251
|
});
|
|
252
|
-
var
|
|
253
|
-
|
|
254
|
-
},
|
|
255
|
-
if (
|
|
252
|
+
var D = () => typeof document > "u" ? !1 : document.documentElement.dataset[oe] === "true", O = null, se = (e) => {
|
|
253
|
+
O = e;
|
|
254
|
+
}, ce = 150, k = (e = 1e3) => new Promise((t, n) => {
|
|
255
|
+
if (D()) return t();
|
|
256
256
|
let r, i = (e) => {
|
|
257
257
|
clearTimeout(r), s.disconnect(), document.removeEventListener("readystatechange", c), e();
|
|
258
258
|
}, a = () => i(async () => {
|
|
259
|
-
if (
|
|
259
|
+
if (O && (await O().catch(() => {}), D())) return t();
|
|
260
260
|
n(/* @__PURE__ */ Error("The FKN WebExtension is not installed, enabled or not exposed on this page."));
|
|
261
261
|
}), o = () => {
|
|
262
|
-
clearTimeout(r), r = setTimeout(() =>
|
|
262
|
+
clearTimeout(r), r = setTimeout(() => D() ? i(t) : a(), ce);
|
|
263
263
|
}, s = new MutationObserver(() => {
|
|
264
|
-
|
|
264
|
+
D() && i(t);
|
|
265
265
|
}), c = () => {
|
|
266
|
-
document.readyState === "complete" && !
|
|
266
|
+
document.readyState === "complete" && !D() && o();
|
|
267
267
|
};
|
|
268
268
|
if (r = setTimeout(a, e), s.observe(document.documentElement, {
|
|
269
269
|
attributes: !0,
|
|
270
270
|
attributeFilter: ["data-fkn-extension"]
|
|
271
271
|
}), document.addEventListener("readystatechange", c), document.readyState === "complete") return o();
|
|
272
|
-
|
|
273
|
-
}),
|
|
274
|
-
await
|
|
272
|
+
D() && i(t);
|
|
273
|
+
}), le, A = new Proxy({}, { get: (e, t) => async (...e) => {
|
|
274
|
+
await k(), le ??= i({}, {
|
|
275
275
|
transport: window,
|
|
276
|
-
revivableModules:
|
|
276
|
+
revivableModules: T
|
|
277
277
|
});
|
|
278
|
-
let n = (await
|
|
278
|
+
let n = (await le)[t];
|
|
279
279
|
return n(...e);
|
|
280
|
-
} }),
|
|
280
|
+
} }), j = [
|
|
281
|
+
"origin",
|
|
282
|
+
"referer",
|
|
283
|
+
"cookie"
|
|
284
|
+
], ue = (e, t) => (e ?? []).some(([e, n]) => e.trim().toLowerCase() === t && n !== ""), de = (e) => ue(e, "cookie"), fe = (e, t) => {
|
|
285
|
+
if (t === "include" && de(e)) throw Error("fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other");
|
|
286
|
+
}, pe = (e) => {
|
|
287
|
+
let t = [...new Set((e ?? []).map(([e]) => e.trim().toLowerCase()).filter((e) => !j.includes(e)))];
|
|
288
|
+
if (t.length) throw Error(`fetch: refusing to forge request header(s): ${t.join(", ")}`);
|
|
289
|
+
}, me = {
|
|
281
290
|
scope: "network.fetch",
|
|
282
291
|
category: "network",
|
|
283
292
|
severity: 0,
|
|
284
293
|
title: "Fetch data from other sites",
|
|
285
294
|
description: "Lets the app download public data from other websites directly, past the usual cross-origin limits."
|
|
286
|
-
},
|
|
295
|
+
}, he = {
|
|
287
296
|
scope: "network.fetchCredentialed",
|
|
288
297
|
category: "network",
|
|
289
298
|
severity: 3,
|
|
290
299
|
unsafe: !0,
|
|
291
300
|
title: "Fetch from other sites, signed in as you",
|
|
292
301
|
description: "Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see."
|
|
293
|
-
},
|
|
302
|
+
}, ge = {
|
|
303
|
+
scope: "network.fetchForgedCookie",
|
|
304
|
+
category: "network",
|
|
305
|
+
severity: 2,
|
|
306
|
+
unsafe: !0,
|
|
307
|
+
title: "Send its own cookies to other sites",
|
|
308
|
+
description: "Lets the app attach cookies it already holds to its requests, so the other site answers as if signed in to the account the app is holding, not yours."
|
|
309
|
+
}, _e = {
|
|
294
310
|
scope: "network.fetchLocal",
|
|
295
311
|
category: "network",
|
|
296
312
|
severity: 3,
|
|
297
313
|
unsafe: !0,
|
|
298
314
|
title: "Access devices on your local network",
|
|
299
315
|
description: "Lets the app reach devices and services on your home or work network, which websites normally cannot touch."
|
|
300
|
-
},
|
|
316
|
+
}, ve = (e) => {
|
|
301
317
|
let t = e.match(/^(\d+)\.(\d+)\.\d+\.\d+$/);
|
|
302
318
|
if (!t) return !1;
|
|
303
319
|
let [n, r] = [Number(t[1]), Number(t[2])];
|
|
304
320
|
return n === 10 || n === 127 || n === 0 || n === 169 && r === 254 || n === 172 && r >= 16 && r <= 31 || n === 192 && r === 168;
|
|
305
|
-
},
|
|
321
|
+
}, ye = (e) => {
|
|
306
322
|
let t;
|
|
307
323
|
try {
|
|
308
324
|
t = new URL(e);
|
|
@@ -310,8 +326,8 @@ var O = () => typeof document > "u" ? !1 : document.documentElement.dataset[ae]
|
|
|
310
326
|
return !1;
|
|
311
327
|
}
|
|
312
328
|
let n = t.hostname.replace(/^\[|\]$/g, "").toLowerCase().replace(/\.$/, "");
|
|
313
|
-
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:") :
|
|
314
|
-
},
|
|
329
|
+
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:") : ve(n);
|
|
330
|
+
}, be = ["fkn.app", "fkn.dev"], M = (e) => {
|
|
315
331
|
let t;
|
|
316
332
|
try {
|
|
317
333
|
t = new URL(e);
|
|
@@ -320,46 +336,46 @@ var O = () => typeof document > "u" ? !1 : document.documentElement.dataset[ae]
|
|
|
320
336
|
}
|
|
321
337
|
if (t.protocol === "chrome-extension:" || t.protocol === "moz-extension:") return !0;
|
|
322
338
|
let n = t.hostname;
|
|
323
|
-
return
|
|
339
|
+
return be.some((e) => n === e || n.endsWith(`.${e}`));
|
|
324
340
|
}, N = (e) => {
|
|
325
341
|
if (M(e)) throw Error("fetch: refusing to target the extension's own pages or FKN platform domains");
|
|
326
|
-
},
|
|
342
|
+
}, xe = (e) => {
|
|
327
343
|
if (!e?.headers) return;
|
|
328
|
-
let t = new Headers(e.headers), n =
|
|
344
|
+
let t = new Headers(e.headers), n = j.map((e) => {
|
|
329
345
|
let n = t.get(e);
|
|
330
|
-
return n === null ? void 0 : [e, n];
|
|
346
|
+
return n === null || n === "" ? void 0 : [e, n];
|
|
331
347
|
}).filter((e) => e !== void 0);
|
|
332
348
|
return n.length ? n : void 0;
|
|
333
|
-
},
|
|
349
|
+
}, Se = async (e, t) => {
|
|
334
350
|
let n = new Request(e, t);
|
|
335
351
|
N(n.url);
|
|
336
352
|
let r = n.body ? await n.arrayBuffer() : null;
|
|
337
|
-
return
|
|
353
|
+
return A.proxyFetch({
|
|
338
354
|
url: n.url,
|
|
339
355
|
method: n.method,
|
|
340
356
|
headers: [...n.headers],
|
|
341
357
|
body: r,
|
|
342
358
|
credentials: t?.credentials === "include" ? "include" : "omit",
|
|
343
359
|
redirect: n.redirect,
|
|
344
|
-
unsafeHeaders:
|
|
360
|
+
unsafeHeaders: xe(t),
|
|
345
361
|
reason: t?.reason,
|
|
346
362
|
signal: t?.signal ?? void 0
|
|
347
363
|
});
|
|
348
|
-
},
|
|
364
|
+
}, Ce = {
|
|
349
365
|
scope: "network.readCookie",
|
|
350
366
|
category: "network",
|
|
351
367
|
severity: 3,
|
|
352
368
|
unsafe: !0,
|
|
353
369
|
title: "Read a site’s cookie",
|
|
354
370
|
description: "Lets the app read a named cookie from another site, which can include the login token only that site should see."
|
|
355
|
-
},
|
|
371
|
+
}, we = { get: (e) => A.getCookie(e) }, Te = {
|
|
356
372
|
scope: "network.modifyRequestHeaders",
|
|
357
373
|
category: "network",
|
|
358
374
|
severity: 2,
|
|
359
375
|
unsafe: !0,
|
|
360
376
|
title: "Rewrite request headers to other sites",
|
|
361
377
|
description: "Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites."
|
|
362
|
-
},
|
|
378
|
+
}, Ee = (e) => A.setRequestHeaderRule(e), De = (e) => A.removeRequestHeaderRule({ ruleId: e }), Oe = class extends Error {
|
|
363
379
|
reason;
|
|
364
380
|
filename;
|
|
365
381
|
line;
|
|
@@ -368,7 +384,7 @@ var O = () => typeof document > "u" ? !1 : document.documentElement.dataset[ae]
|
|
|
368
384
|
constructor(e, t, n, r, i) {
|
|
369
385
|
super(`${e}:${n}:${r}: ${t}`), this.reason = t, this.filename = e, this.line = n, this.column = r, this.source = i;
|
|
370
386
|
}
|
|
371
|
-
},
|
|
387
|
+
}, ke = class {
|
|
372
388
|
start;
|
|
373
389
|
end;
|
|
374
390
|
source;
|
|
@@ -448,7 +464,7 @@ function z(e, t) {
|
|
|
448
464
|
value: t || null
|
|
449
465
|
}), e;
|
|
450
466
|
}
|
|
451
|
-
var
|
|
467
|
+
var Ae = class {
|
|
452
468
|
level = 0;
|
|
453
469
|
indentation = " ";
|
|
454
470
|
compress = !1;
|
|
@@ -598,7 +614,7 @@ var Te = class {
|
|
|
598
614
|
declaration(e) {
|
|
599
615
|
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(";");
|
|
600
616
|
}
|
|
601
|
-
},
|
|
617
|
+
}, je = (e, t) => {
|
|
602
618
|
t ||= {};
|
|
603
619
|
let n = 1, r = 1;
|
|
604
620
|
function i() {
|
|
@@ -606,14 +622,14 @@ var Te = class {
|
|
|
606
622
|
line: n,
|
|
607
623
|
column: r
|
|
608
624
|
};
|
|
609
|
-
return (i) => (i.position = new
|
|
625
|
+
return (i) => (i.position = new ke(e, {
|
|
610
626
|
line: n,
|
|
611
627
|
column: r
|
|
612
628
|
}, t?.source || ""), u(), i);
|
|
613
629
|
}
|
|
614
630
|
let a = [];
|
|
615
631
|
function o(i) {
|
|
616
|
-
let o = new
|
|
632
|
+
let o = new Oe(t?.source || "", i, n, r, e);
|
|
617
633
|
if (!t?.silent) throw o;
|
|
618
634
|
a.push(o);
|
|
619
635
|
}
|
|
@@ -1087,48 +1103,48 @@ var Te = class {
|
|
|
1087
1103
|
}
|
|
1088
1104
|
};
|
|
1089
1105
|
}());
|
|
1090
|
-
},
|
|
1106
|
+
}, Me = (e, t) => new Ae(t || {}).compile(e), B = "LocatorError", V = "LocatorUnsupportedError", H = "LocatorDeniedError", U = (e) => typeof e == "object" && e ? e.name : void 0, W = (e) => Object.assign(Error(e), { name: B }), Ne = (e, t = "", n) => Object.assign(Error(e), {
|
|
1091
1107
|
name: V,
|
|
1092
1108
|
operation: t,
|
|
1093
1109
|
backend: n
|
|
1094
|
-
}),
|
|
1110
|
+
}), Pe = (e, t) => Ne(`Locator operation not supported${t ? ` on the ${t} backend` : ""}: ${e}`, e, t), Fe = (e) => U(e) === V, Ie = (e) => U(e) === H, G = (e) => Ie(e) || Fe(e), K = (e) => {
|
|
1095
1111
|
let t = (e.ownerDocument ?? e).defaultView;
|
|
1096
1112
|
if (!t) throw W("the resolved element belongs to a document with no window");
|
|
1097
1113
|
return t;
|
|
1098
|
-
},
|
|
1114
|
+
}, Le = (e, t) => {
|
|
1099
1115
|
let n = e?.[t];
|
|
1100
1116
|
return typeof n == "function" ? n : null;
|
|
1101
1117
|
}, q = (e, t) => {
|
|
1102
1118
|
if (typeof e != "object" || !e) return null;
|
|
1103
1119
|
let n = (() => {
|
|
1104
1120
|
try {
|
|
1105
|
-
return
|
|
1121
|
+
return Le(K(e), t);
|
|
1106
1122
|
} catch {
|
|
1107
1123
|
return null;
|
|
1108
1124
|
}
|
|
1109
1125
|
})();
|
|
1110
1126
|
if (n && e instanceof n) return n;
|
|
1111
|
-
let r =
|
|
1127
|
+
let r = Le(globalThis, t);
|
|
1112
1128
|
return r && e instanceof r ? r : null;
|
|
1113
1129
|
}, J = (e, t) => q(e, t) !== null, Y = (e) => {
|
|
1114
1130
|
if (e.length === 0) throw W("No elements found");
|
|
1115
1131
|
if (e.length > 1) throw W(`Strict mode violation: locator resolved to ${e.length} elements`);
|
|
1116
1132
|
return e[0];
|
|
1117
|
-
},
|
|
1133
|
+
}, Re = (e, t) => {
|
|
1118
1134
|
if (!J(e, t)) throw W(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);
|
|
1119
1135
|
return e;
|
|
1120
|
-
},
|
|
1121
|
-
|
|
1122
|
-
},
|
|
1136
|
+
}, ze = (e) => e.tagName.toLowerCase(), Be = /* @__PURE__ */ new Set(), Ve = (e) => {
|
|
1137
|
+
Be.add(e);
|
|
1138
|
+
}, He = /(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i, Ue = (e) => e.replace(/\\([0-9a-fA-F]{1,6})\s?/g, (e, t) => String.fromCodePoint(Number.parseInt(t, 16))).replace(/\\(.)/g, "$1"), We = (e) => !He.test(Ue(e.value)), Ge = /* @__PURE__ */ new Set([
|
|
1123
1139
|
P.import,
|
|
1124
1140
|
P.fontFace,
|
|
1125
1141
|
P.namespace,
|
|
1126
1142
|
P.charset,
|
|
1127
1143
|
P.document,
|
|
1128
1144
|
P.comment
|
|
1129
|
-
]),
|
|
1130
|
-
if (
|
|
1131
|
-
if (e.type === P.declaration) return
|
|
1145
|
+
]), Ke = (e) => {
|
|
1146
|
+
if (Ge.has(e.type)) return null;
|
|
1147
|
+
if (e.type === P.declaration) return We(e) ? e : null;
|
|
1132
1148
|
let t = e, n = { ...t };
|
|
1133
1149
|
for (let e of [
|
|
1134
1150
|
"declarations",
|
|
@@ -1136,18 +1152,18 @@ var Te = class {
|
|
|
1136
1152
|
"keyframes"
|
|
1137
1153
|
]) {
|
|
1138
1154
|
let r = t[e];
|
|
1139
|
-
Array.isArray(r) && (n[e] =
|
|
1155
|
+
Array.isArray(r) && (n[e] = qe(r));
|
|
1140
1156
|
}
|
|
1141
1157
|
return n;
|
|
1142
|
-
},
|
|
1158
|
+
}, qe = (e) => e.map((e) => Ke(e)).filter((e) => e !== null), Je = (e) => {
|
|
1143
1159
|
let t;
|
|
1144
1160
|
try {
|
|
1145
|
-
t =
|
|
1161
|
+
t = je(e, { silent: !0 });
|
|
1146
1162
|
} catch {
|
|
1147
1163
|
return "";
|
|
1148
1164
|
}
|
|
1149
|
-
return t.stylesheet.rules =
|
|
1150
|
-
},
|
|
1165
|
+
return t.stylesheet.rules = qe(t.stylesheet.rules), Me(t);
|
|
1166
|
+
}, Ye = (e, t) => {
|
|
1151
1167
|
let n = () => {
|
|
1152
1168
|
t.parentNode || (e.head ?? e.documentElement).appendChild(t);
|
|
1153
1169
|
};
|
|
@@ -1164,27 +1180,27 @@ var Te = class {
|
|
|
1164
1180
|
});
|
|
1165
1181
|
let i = () => r.disconnect(), a = e.defaultView;
|
|
1166
1182
|
a ? a.addEventListener("load", i, { once: !0 }) : setTimeout(i, 3e4);
|
|
1167
|
-
},
|
|
1183
|
+
}, Xe = { resolve: (e, t) => {
|
|
1168
1184
|
let n = e.document.createElement("style");
|
|
1169
|
-
n.textContent = t.noSanitize ? t.content :
|
|
1185
|
+
n.textContent = t.noSanitize ? t.content : Je(t.content);
|
|
1170
1186
|
try {
|
|
1171
|
-
|
|
1187
|
+
Ye(e.document, n);
|
|
1172
1188
|
} catch (e) {
|
|
1173
1189
|
console.error(e);
|
|
1174
1190
|
}
|
|
1175
|
-
|
|
1176
|
-
} },
|
|
1191
|
+
Ve(n);
|
|
1192
|
+
} }, Ze = (e, t) => {
|
|
1177
1193
|
let n = e.getBoundingClientRect();
|
|
1178
1194
|
return {
|
|
1179
1195
|
clientX: n.left + n.width * (t?.x ?? .5),
|
|
1180
1196
|
clientY: n.top + n.height * (t?.y ?? .5)
|
|
1181
1197
|
};
|
|
1182
|
-
},
|
|
1198
|
+
}, Qe = { resolve: (e, t = {}) => {
|
|
1183
1199
|
let n = Y(e.elements), r = K(n), i = {
|
|
1184
1200
|
bubbles: !0,
|
|
1185
1201
|
cancelable: !0,
|
|
1186
1202
|
composed: !0,
|
|
1187
|
-
...
|
|
1203
|
+
...Ze(n, t.position),
|
|
1188
1204
|
button: 0
|
|
1189
1205
|
}, a = {
|
|
1190
1206
|
...i,
|
|
@@ -1208,12 +1224,12 @@ var Te = class {
|
|
|
1208
1224
|
...i,
|
|
1209
1225
|
buttons: 0
|
|
1210
1226
|
}));
|
|
1211
|
-
} },
|
|
1227
|
+
} }, $e = { resolve: (e, t = {}) => {
|
|
1212
1228
|
let n = Y(e.elements), r = K(n), i = {
|
|
1213
1229
|
bubbles: !0,
|
|
1214
1230
|
cancelable: !0,
|
|
1215
1231
|
composed: !0,
|
|
1216
|
-
...
|
|
1232
|
+
...Ze(n, t.position)
|
|
1217
1233
|
}, a = {
|
|
1218
1234
|
...i,
|
|
1219
1235
|
pointerType: "mouse",
|
|
@@ -1227,11 +1243,11 @@ var Te = class {
|
|
|
1227
1243
|
...i,
|
|
1228
1244
|
bubbles: !1
|
|
1229
1245
|
})), n.dispatchEvent(new r.MouseEvent("mouseover", i)), n.dispatchEvent(new r.PointerEvent("pointermove", a)), n.dispatchEvent(new r.MouseEvent("mousemove", i));
|
|
1230
|
-
} },
|
|
1246
|
+
} }, et = (e, t) => {
|
|
1231
1247
|
e._valueTracker?.setValue("");
|
|
1232
1248
|
let n = (q(e, "HTMLTextAreaElement") ?? q(e, "HTMLInputElement"))?.prototype, r = n && Object.getOwnPropertyDescriptor(n, "value")?.set;
|
|
1233
1249
|
r ? r.call(e, t) : e.value = t;
|
|
1234
|
-
},
|
|
1250
|
+
}, tt = (e, t) => {
|
|
1235
1251
|
if (e.type !== "range") return null;
|
|
1236
1252
|
let n = Number(e.min || 0), r = Number(e.max || 100);
|
|
1237
1253
|
if (!Number.isFinite(n) || !Number.isFinite(r) || r <= n) return null;
|
|
@@ -1268,36 +1284,36 @@ var Te = class {
|
|
|
1268
1284
|
buttons: 0
|
|
1269
1285
|
}
|
|
1270
1286
|
};
|
|
1271
|
-
},
|
|
1287
|
+
}, nt = { resolve: (e, t, n = {}) => {
|
|
1272
1288
|
let r = Y(e.elements), i = K(r), a = J(r, "HTMLInputElement");
|
|
1273
1289
|
if (a || J(r, "HTMLTextAreaElement")) {
|
|
1274
|
-
let e = r, n = a ?
|
|
1275
|
-
n && (r.dispatchEvent(new i.PointerEvent("pointerdown", n.pointerDown)), r.dispatchEvent(new i.MouseEvent("mousedown", n.mouseDown))),
|
|
1290
|
+
let e = r, n = a ? tt(e, t) : null;
|
|
1291
|
+
n && (r.dispatchEvent(new i.PointerEvent("pointerdown", n.pointerDown)), r.dispatchEvent(new i.MouseEvent("mousedown", n.mouseDown))), et(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 }));
|
|
1276
1292
|
return;
|
|
1277
1293
|
}
|
|
1278
1294
|
if (J(r, "HTMLElement") && r.isContentEditable) {
|
|
1279
1295
|
r.textContent = t, r.dispatchEvent(new i.Event("input", { bubbles: !0 }));
|
|
1280
1296
|
return;
|
|
1281
1297
|
}
|
|
1282
|
-
throw Error(`fill: element <${
|
|
1283
|
-
} },
|
|
1298
|
+
throw Error(`fill: element <${ze(r)}> is not fillable`);
|
|
1299
|
+
} }, rt = { resolve: (e, t = {}) => Y(e.elements).textContent }, it = { resolve: (e, t, n = {}) => Y(e.elements).getAttribute(t) }, at = { resolve: (e, t = {}) => {
|
|
1284
1300
|
let n = Y(e.elements);
|
|
1285
1301
|
if (!J(n, "HTMLElement")) return !0;
|
|
1286
1302
|
let r = K(n).getComputedStyle(n);
|
|
1287
1303
|
if (r?.display === "none" || r?.visibility === "hidden") return !1;
|
|
1288
1304
|
let i = n.getBoundingClientRect();
|
|
1289
1305
|
return i.width > 0 && i.height > 0;
|
|
1290
|
-
} },
|
|
1306
|
+
} }, ot = { resolve: (e, t = {}) => e.elements.length }, st = { resolve: (e, t = {}) => e.elements.length > 0 }, X = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1291
1307
|
__proto__: null,
|
|
1292
|
-
click:
|
|
1293
|
-
count:
|
|
1294
|
-
exists:
|
|
1295
|
-
fill:
|
|
1296
|
-
getAttribute:
|
|
1297
|
-
hover:
|
|
1298
|
-
isVisible:
|
|
1299
|
-
textContent:
|
|
1300
|
-
}, Symbol.toStringTag, { value: "Module" })), Z = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(t)]), Q = (e) => e.replaceAll("\"", "\\\""),
|
|
1308
|
+
click: Qe,
|
|
1309
|
+
count: ot,
|
|
1310
|
+
exists: st,
|
|
1311
|
+
fill: nt,
|
|
1312
|
+
getAttribute: it,
|
|
1313
|
+
hover: $e,
|
|
1314
|
+
isVisible: at,
|
|
1315
|
+
textContent: rt
|
|
1316
|
+
}, Symbol.toStringTag, { value: "Module" })), Z = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(t)]), Q = (e) => e.replaceAll("\"", "\\\""), ct = {
|
|
1301
1317
|
to: "element",
|
|
1302
1318
|
css: !0,
|
|
1303
1319
|
resolve: (e, t) => Z(e, t),
|
|
@@ -1305,7 +1321,7 @@ var Te = class {
|
|
|
1305
1321
|
fragment: typeof e == "string" ? e : "?",
|
|
1306
1322
|
separator: "descend"
|
|
1307
1323
|
})
|
|
1308
|
-
},
|
|
1324
|
+
}, lt = {
|
|
1309
1325
|
to: "frame",
|
|
1310
1326
|
css: !0,
|
|
1311
1327
|
barrier: "down",
|
|
@@ -1314,11 +1330,11 @@ var Te = class {
|
|
|
1314
1330
|
fragment: typeof e == "string" ? e : "?",
|
|
1315
1331
|
separator: "down"
|
|
1316
1332
|
})
|
|
1317
|
-
},
|
|
1333
|
+
}, ut = {
|
|
1318
1334
|
element: {
|
|
1319
1335
|
selectors: {
|
|
1320
|
-
locator:
|
|
1321
|
-
frameLocator:
|
|
1336
|
+
locator: ct,
|
|
1337
|
+
frameLocator: lt,
|
|
1322
1338
|
getByRole: {
|
|
1323
1339
|
to: "element",
|
|
1324
1340
|
resolve: (e, t) => Z(e, `[role="${CSS.escape(t)}"]`),
|
|
@@ -1349,20 +1365,20 @@ var Te = class {
|
|
|
1349
1365
|
}
|
|
1350
1366
|
},
|
|
1351
1367
|
operations: {
|
|
1352
|
-
click:
|
|
1353
|
-
fill:
|
|
1354
|
-
hover:
|
|
1355
|
-
textContent:
|
|
1356
|
-
getAttribute:
|
|
1357
|
-
isVisible:
|
|
1358
|
-
count:
|
|
1359
|
-
exists:
|
|
1368
|
+
click: Qe,
|
|
1369
|
+
fill: nt,
|
|
1370
|
+
hover: $e,
|
|
1371
|
+
textContent: rt,
|
|
1372
|
+
getAttribute: it,
|
|
1373
|
+
isVisible: at,
|
|
1374
|
+
count: ot,
|
|
1375
|
+
exists: st
|
|
1360
1376
|
}
|
|
1361
1377
|
},
|
|
1362
1378
|
frame: {
|
|
1363
1379
|
selectors: {
|
|
1364
|
-
locator:
|
|
1365
|
-
frameLocator:
|
|
1380
|
+
locator: ct,
|
|
1381
|
+
frameLocator: lt,
|
|
1366
1382
|
owner: {
|
|
1367
1383
|
to: "frame",
|
|
1368
1384
|
barrier: "up",
|
|
@@ -1375,9 +1391,9 @@ var Te = class {
|
|
|
1375
1391
|
})
|
|
1376
1392
|
}
|
|
1377
1393
|
},
|
|
1378
|
-
operations: { addStyleTag:
|
|
1394
|
+
operations: { addStyleTag: Xe }
|
|
1379
1395
|
}
|
|
1380
|
-
},
|
|
1396
|
+
}, dt = (e, t = ut) => ({
|
|
1381
1397
|
element: {
|
|
1382
1398
|
selectors: {
|
|
1383
1399
|
...t.element.selectors,
|
|
@@ -1398,29 +1414,29 @@ var Te = class {
|
|
|
1398
1414
|
...e.frame?.operations
|
|
1399
1415
|
}
|
|
1400
1416
|
}
|
|
1401
|
-
}),
|
|
1417
|
+
}), ft = 3e4, pt = 50, mt = (e) => {
|
|
1402
1418
|
let t = e[e.length - 1];
|
|
1403
1419
|
return typeof t == "object" && t ? t : void 0;
|
|
1404
|
-
},
|
|
1405
|
-
let t =
|
|
1406
|
-
return typeof t == "number" ? t :
|
|
1407
|
-
},
|
|
1420
|
+
}, ht = (e) => {
|
|
1421
|
+
let t = mt(e)?.timeout;
|
|
1422
|
+
return typeof t == "number" ? t : ft;
|
|
1423
|
+
}, gt = ({ executor: e, parts: t }) => ({ highlight: (n) => e.highlight(t, n).then(() => {}, () => {}) }), _t = async (e) => {
|
|
1408
1424
|
let t = {
|
|
1409
1425
|
parts: e.parts,
|
|
1410
1426
|
operation: e.operation,
|
|
1411
1427
|
args: e.args,
|
|
1412
1428
|
phase: "ensure"
|
|
1413
1429
|
};
|
|
1414
|
-
await e.gate?.(t,
|
|
1415
|
-
},
|
|
1430
|
+
await e.gate?.(t, gt(e));
|
|
1431
|
+
}, vt = async (e) => {
|
|
1416
1432
|
let { executor: t, gate: n, parts: r, operation: i, args: a } = e;
|
|
1417
1433
|
n && await n({
|
|
1418
1434
|
parts: r,
|
|
1419
1435
|
operation: i,
|
|
1420
1436
|
args: a,
|
|
1421
1437
|
phase: "execute"
|
|
1422
|
-
},
|
|
1423
|
-
let o =
|
|
1438
|
+
}, gt(e));
|
|
1439
|
+
let o = ht(a), s = Date.now() + o, c = /* @__PURE__ */ Error(`Locator timeout (${o}ms): ${i}`), { promise: l, reject: u } = Promise.withResolvers();
|
|
1424
1440
|
l.catch(() => {});
|
|
1425
1441
|
let d = setTimeout(() => u(c), o), f = c;
|
|
1426
1442
|
try {
|
|
@@ -1428,36 +1444,36 @@ var Te = class {
|
|
|
1428
1444
|
return await Promise.race([t.execute(r, i, a), l]);
|
|
1429
1445
|
} catch (e) {
|
|
1430
1446
|
if (e === c) break;
|
|
1431
|
-
if (
|
|
1447
|
+
if (G(e)) throw e;
|
|
1432
1448
|
f = e;
|
|
1433
1449
|
let t = s - Date.now();
|
|
1434
1450
|
if (t <= 0) break;
|
|
1435
|
-
await new Promise((e) => setTimeout(e, Math.min(
|
|
1451
|
+
await new Promise((e) => setTimeout(e, Math.min(pt, t)));
|
|
1436
1452
|
}
|
|
1437
1453
|
} finally {
|
|
1438
1454
|
clearTimeout(d);
|
|
1439
1455
|
}
|
|
1440
1456
|
throw f;
|
|
1441
|
-
},
|
|
1457
|
+
}, yt = (e, t, n, r) => {
|
|
1442
1458
|
let i = {};
|
|
1443
|
-
for (let [a, o] of Object.entries(t[n].selectors)) i[a] = (...i) =>
|
|
1459
|
+
for (let [a, o] of Object.entries(t[n].selectors)) i[a] = (...i) => yt(e, t, o.to, [...r, {
|
|
1444
1460
|
kind: n,
|
|
1445
1461
|
name: a,
|
|
1446
1462
|
args: i
|
|
1447
1463
|
}]);
|
|
1448
|
-
for (let a of Object.keys(t[n].operations)) i[a] = (...t) =>
|
|
1464
|
+
for (let a of Object.keys(t[n].operations)) i[a] = (...t) => vt({
|
|
1449
1465
|
...e,
|
|
1450
1466
|
parts: r,
|
|
1451
1467
|
operation: a,
|
|
1452
1468
|
args: t
|
|
1453
1469
|
});
|
|
1454
|
-
return i.ensure = (t, n = {}) =>
|
|
1470
|
+
return i.ensure = (t, n = {}) => _t({
|
|
1455
1471
|
...e,
|
|
1456
1472
|
parts: r,
|
|
1457
1473
|
operation: t,
|
|
1458
1474
|
args: [n]
|
|
1459
1475
|
}), i;
|
|
1460
|
-
},
|
|
1476
|
+
}, bt = (e) => yt(e, e.modules ?? ut, "frame", []), xt = dt({
|
|
1461
1477
|
element: { operations: {
|
|
1462
1478
|
click: { resolve: (e, t = {}) => X.click.resolve(e, t) },
|
|
1463
1479
|
hover: { resolve: (e, t = {}) => X.hover.resolve(e, t) },
|
|
@@ -1467,10 +1483,10 @@ var Te = class {
|
|
|
1467
1483
|
isVisible: { resolve: (e, t = {}) => X.isVisible.resolve(e) },
|
|
1468
1484
|
count: { resolve: (e, t = {}) => X.count.resolve(e) },
|
|
1469
1485
|
exists: { resolve: (e, t = {}) => X.exists.resolve(e) },
|
|
1470
|
-
videoElement: { resolve: (e, t = {}) => S(
|
|
1486
|
+
videoElement: { resolve: (e, t = {}) => S(Re(Y(e.elements), "HTMLVideoElement")) }
|
|
1471
1487
|
} },
|
|
1472
|
-
frame: { operations: { addStyleTag: { resolve: (e, t) =>
|
|
1473
|
-
}),
|
|
1488
|
+
frame: { operations: { addStyleTag: { resolve: (e, t) => Xe.resolve(e, t) } } }
|
|
1489
|
+
}), St = (e) => {
|
|
1474
1490
|
if (!e || e === "about:blank") return !1;
|
|
1475
1491
|
let t;
|
|
1476
1492
|
try {
|
|
@@ -1483,25 +1499,25 @@ var Te = class {
|
|
|
1483
1499
|
let n = t.hostname, r = (e) => n === e || n.endsWith(`.${e}`);
|
|
1484
1500
|
return r("fkn.app") || r("fkn.dev") || r("sdbx.app");
|
|
1485
1501
|
}, $ = (e) => {
|
|
1486
|
-
if (
|
|
1487
|
-
},
|
|
1502
|
+
if (St(e)) throw Error("attachFrame: refusing to target the extension's own pages or an FKN platform origin");
|
|
1503
|
+
}, Ct = ({ src: e, domains: t, lockdown: n }) => {
|
|
1488
1504
|
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");
|
|
1489
|
-
},
|
|
1505
|
+
}, wt = {
|
|
1490
1506
|
scope: "embed.iframe",
|
|
1491
1507
|
category: "embed",
|
|
1492
1508
|
severity: 0,
|
|
1493
1509
|
title: "Load another website inside this app",
|
|
1494
1510
|
description: "Lets the app embed external pages directly inside its own view."
|
|
1495
|
-
},
|
|
1511
|
+
}, Tt = {
|
|
1496
1512
|
scope: "embed.open",
|
|
1497
1513
|
category: "embed",
|
|
1498
1514
|
severity: 0,
|
|
1499
1515
|
title: "Open a website inside this app",
|
|
1500
1516
|
description: "Lets the app navigate to another site without leaving its window."
|
|
1501
|
-
},
|
|
1502
|
-
let t =
|
|
1517
|
+
}, Et = (e) => {
|
|
1518
|
+
let t = bt({
|
|
1503
1519
|
executor: e.executor,
|
|
1504
|
-
modules:
|
|
1520
|
+
modules: xt,
|
|
1505
1521
|
gate: e.gate
|
|
1506
1522
|
}), n = (t, n = {}) => ($(t), e.goto(t, n)), r = () => e.url();
|
|
1507
1523
|
return {
|
|
@@ -1509,21 +1525,21 @@ var Te = class {
|
|
|
1509
1525
|
goto: n,
|
|
1510
1526
|
url: r
|
|
1511
1527
|
};
|
|
1512
|
-
},
|
|
1528
|
+
}, Dt = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY", Ot = async ({ iframe: e, domains: t = [], syncCookies: n = !0, lockdown: r = !1 }) => {
|
|
1513
1529
|
let i = crypto.randomUUID();
|
|
1514
|
-
if ($(e.src),
|
|
1530
|
+
if ($(e.src), Ct({
|
|
1515
1531
|
src: e.src,
|
|
1516
1532
|
domains: t,
|
|
1517
1533
|
lockdown: r
|
|
1518
|
-
}), await
|
|
1519
|
-
e.dispatchEvent(new CustomEvent(
|
|
1520
|
-
let { executeLocator: a, highlightLocator: o, ensureLocatorPermission: s, goto: c } = await
|
|
1534
|
+
}), await k(), !e.isConnected) throw Error("attachFrame: the iframe must be connected to the document before attaching");
|
|
1535
|
+
e.dispatchEvent(new CustomEvent(Dt, { detail: i }));
|
|
1536
|
+
let { executeLocator: a, highlightLocator: o, ensureLocatorPermission: s, goto: c } = await A.attachFrame({
|
|
1521
1537
|
marker: i,
|
|
1522
1538
|
domains: t,
|
|
1523
1539
|
syncCookies: n,
|
|
1524
1540
|
lockdown: r
|
|
1525
1541
|
});
|
|
1526
|
-
return
|
|
1542
|
+
return Et({
|
|
1527
1543
|
executor: {
|
|
1528
1544
|
execute: a,
|
|
1529
1545
|
highlight: o
|
|
@@ -1535,11 +1551,11 @@ var Te = class {
|
|
|
1535
1551
|
}),
|
|
1536
1552
|
url: () => e.src
|
|
1537
1553
|
});
|
|
1538
|
-
},
|
|
1554
|
+
}, kt = { request: (e) => A.requestPermissions(e.map((e) => ({
|
|
1539
1555
|
key: e.key,
|
|
1540
1556
|
scope: e.scope ?? "",
|
|
1541
1557
|
reason: e.reason
|
|
1542
|
-
}))) },
|
|
1558
|
+
}))) }, At = ["fkn.app", "fkn.dev"], jt = (e) => {
|
|
1543
1559
|
let t = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, n;
|
|
1544
1560
|
try {
|
|
1545
1561
|
n = new URL(t);
|
|
@@ -1547,24 +1563,24 @@ var Te = class {
|
|
|
1547
1563
|
return;
|
|
1548
1564
|
}
|
|
1549
1565
|
let r = n.hostname;
|
|
1550
|
-
if (
|
|
1551
|
-
},
|
|
1566
|
+
if (At.some((e) => r === e || r.endsWith(`.${e}`))) throw Error(`fetch refuses FKN platform domains (${r})`);
|
|
1567
|
+
}, Mt = async (e) => {
|
|
1552
1568
|
if (e != null) return typeof e == "string" || e instanceof ArrayBuffer || ArrayBuffer.isView(e) ? e : new Request("https://body.invalid/", {
|
|
1553
1569
|
method: "POST",
|
|
1554
1570
|
body: e,
|
|
1555
1571
|
duplex: "half"
|
|
1556
1572
|
}).arrayBuffer();
|
|
1557
|
-
},
|
|
1573
|
+
}, Nt = async (e) => {
|
|
1558
1574
|
if (e.method === "GET" || e.method === "HEAD") return;
|
|
1559
1575
|
let t = await e.clone().arrayBuffer();
|
|
1560
1576
|
return t.byteLength ? t : void 0;
|
|
1561
|
-
},
|
|
1562
|
-
if (
|
|
1577
|
+
}, Pt = async (e, n) => {
|
|
1578
|
+
if (jt(e), typeof e == "object" && e && !(e instanceof URL) && typeof e.url == "string") {
|
|
1563
1579
|
let r = e, i = {};
|
|
1564
1580
|
r.headers.forEach((e, t) => {
|
|
1565
1581
|
i[t] = e;
|
|
1566
1582
|
});
|
|
1567
|
-
let a = await
|
|
1583
|
+
let a = await Mt(n?.body === void 0 ? await Nt(r) : n.body);
|
|
1568
1584
|
return t.then((e) => e.cloud.fetch(r.url, {
|
|
1569
1585
|
...n,
|
|
1570
1586
|
method: n?.method ?? r.method,
|
|
@@ -1572,11 +1588,11 @@ var Te = class {
|
|
|
1572
1588
|
body: a
|
|
1573
1589
|
}));
|
|
1574
1590
|
}
|
|
1575
|
-
let r = e instanceof URL ? e.href : e, i = await
|
|
1591
|
+
let r = e instanceof URL ? e.href : e, i = await Mt(n?.body);
|
|
1576
1592
|
return t.then((e) => e.cloud.fetch(r, n?.body === void 0 ? n : {
|
|
1577
1593
|
...n,
|
|
1578
1594
|
body: i
|
|
1579
1595
|
}));
|
|
1580
1596
|
};
|
|
1581
1597
|
//#endregion
|
|
1582
|
-
export {
|
|
1598
|
+
export { M as A, T as B, Ce as C, ge as D, he as E, de as F, d as G, S as H, E as I, D as L, j as M, pe as N, _e as O, fe as P, se as R, we as S, Se as T, ie as U, C as V, w as W, V as _, Ot as a, De as b, Tt as c, St as d, B as f, Fe as g, G as h, Dt as i, ye as j, me as k, $ as l, Pe as m, jt as n, wt as o, Ie as p, kt as r, Et as s, Pt as t, Ct as u, H as v, N as w, Ee as x, Te as y, k as z };
|