@fkn/lib 0.3.7 → 0.3.9

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.
@@ -1,1104 +0,0 @@
1
- import { BoxBase as e, recursiveBox as t, recursiveRevive as n } from "osra";
2
- //#region \0rolldown/runtime.js
3
- var r = Object.defineProperty, i = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), a = (e, t) => {
4
- let n = {};
5
- for (var i in e) r(n, i, {
6
- get: e[i],
7
- enumerable: !0
8
- });
9
- return t || r(n, Symbol.toStringTag, { value: "Module" }), n;
10
- }, o = 3e4, s = 50, c = (e) => {
11
- let t = e[e.length - 1];
12
- return typeof t == "object" && t && "timeout" in t && typeof t.timeout == "number" ? t.timeout : o;
13
- }, l = async (e, t, n, r) => {
14
- let i = e, a = c(r), o = Date.now() + a, l = /* @__PURE__ */ Error(`Locator timeout (${a}ms): ${n}`), { promise: u, reject: d } = Promise.withResolvers(), f = setTimeout(() => d(l), a), p = l;
15
- try {
16
- for (; Date.now() < o;) try {
17
- return await Promise.race([i(t, n, r), u]);
18
- } catch (e) {
19
- if (e === l) break;
20
- p = e;
21
- let t = o - Date.now();
22
- if (t <= 0) break;
23
- await new Promise((e) => setTimeout(e, Math.min(s, t)));
24
- }
25
- } finally {
26
- clearTimeout(f);
27
- }
28
- throw p;
29
- }, u = /* @__PURE__ */ a({
30
- render: () => p,
31
- resolve: () => f,
32
- type: () => d
33
- }), d = "locator", f = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(t)]), p = (e) => ({
34
- fragment: typeof e == "string" ? e : "?",
35
- separator: "descend"
36
- }), m = (e) => typeof e == "object" && !!e, h = (e) => m(e) && e.FKN_WEB_EXTENSION_FRAME_ANNOUNCE_KEY === !0 && typeof e.frameId == "string", g = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new Set(), y = (e) => (v.add(e), () => v.delete(e));
37
- typeof window < "u" && window.addEventListener("message", (e) => {
38
- if (!h(e.data)) return;
39
- e.stopImmediatePropagation();
40
- let t = e.source;
41
- if (!t || typeof t != "object") return;
42
- let n = t, r = g.get(n), i = e.data.frameId;
43
- if (g.set(n, i), r) for (let e of v) e(r);
44
- let a = _.get(n);
45
- if (a) {
46
- _.delete(n);
47
- for (let e of a) e(i);
48
- }
49
- }, { capture: !0 });
50
- var b = (e) => {
51
- let t = e.contentWindow;
52
- if (!t) return Promise.reject(/* @__PURE__ */ Error("frameLocator: <iframe> has no contentWindow"));
53
- let n = g.get(t);
54
- return n ? Promise.resolve(n) : new Promise((e) => {
55
- let n = _.get(t) ?? [];
56
- n.push(e), _.set(t, n);
57
- });
58
- }, x = /* @__PURE__ */ a({
59
- render: () => te,
60
- resolve: () => C,
61
- resolvePeer: () => ee,
62
- type: () => S
63
- }), S = "frameLocator", C = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(t)]).filter((e) => e instanceof HTMLIFrameElement), ee = async ({ parts: e, selfIndex: t, resolveLocal: n }) => {
64
- let r = n(e.slice(0, t + 1))[0];
65
- if (!r) throw Error("frameLocator: no <iframe> matched");
66
- if (!(r instanceof HTMLIFrameElement)) throw Error(`frameLocator: expected <iframe>, got <${r.tagName.toLowerCase()}>`);
67
- return b(r);
68
- }, te = (e) => ({
69
- fragment: typeof e == "string" ? e : "?",
70
- separator: "frame-down"
71
- }), ne = /* @__PURE__ */ a({
72
- render: () => oe,
73
- resolve: () => ie,
74
- resolvePeer: () => ae,
75
- type: () => re
76
- }), re = "owner", ie = (e) => {
77
- throw Error("owner: must be processed by the executor as an upward pivot");
78
- }, ae = async () => {
79
- let { backgroundResolvers: e } = await import("./background-DkW0j6iK.js"), t = await (await e).getParentFrameId();
80
- if (!t) throw Error("owner: already at top frame");
81
- return t;
82
- }, oe = () => ({
83
- fragment: "",
84
- separator: "frame-up"
85
- }), se = class extends Error {
86
- reason;
87
- filename;
88
- line;
89
- column;
90
- source;
91
- constructor(e, t, n, r, i) {
92
- super(`${e}:${n}:${r}: ${t}`), this.reason = t, this.filename = e, this.line = n, this.column = r, this.source = i;
93
- }
94
- }, ce = class {
95
- start;
96
- end;
97
- source;
98
- constructor(e, t, n) {
99
- this.start = e, this.end = t, this.source = n;
100
- }
101
- }, w;
102
- (function(e) {
103
- e.stylesheet = "stylesheet", e.rule = "rule", e.declaration = "declaration", e.comment = "comment", e.container = "container", e.charset = "charset", e.document = "document", e.customMedia = "custom-media", e.fontFace = "font-face", 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.startingStyle = "starting-style", e.supports = "supports";
104
- })(w ||= {});
105
- var T = (e, t, n) => {
106
- let r = n, i = 1e4;
107
- do {
108
- let n = t.map((t) => e.indexOf(t, r));
109
- n.push(e.indexOf("\\", r));
110
- let a = n.filter((e) => e !== -1);
111
- if (a.length === 0) return -1;
112
- let o = Math.min(...a);
113
- if (e[o] !== "\\") return o;
114
- r = o + 2, i--;
115
- } while (i > 0);
116
- throw Error("Too many escaping");
117
- }, E = (e, t, n) => {
118
- let r = n, i = 1e4;
119
- do {
120
- let n = t.map((t) => e.indexOf(t, r));
121
- n.push(e.indexOf("(", r)), n.push(e.indexOf("\"", r)), n.push(e.indexOf("'", r)), n.push(e.indexOf("\\", r));
122
- let a = n.filter((e) => e !== -1);
123
- if (a.length === 0) return -1;
124
- let o = Math.min(...a);
125
- switch (e[o]) {
126
- case "\\":
127
- r = o + 2;
128
- break;
129
- case "(":
130
- {
131
- let t = E(e, [")"], o + 1);
132
- if (t === -1) return -1;
133
- r = t + 1;
134
- }
135
- break;
136
- case "\"":
137
- {
138
- let t = T(e, ["\""], o + 1);
139
- if (t === -1) return -1;
140
- r = t + 1;
141
- }
142
- break;
143
- case "'":
144
- {
145
- let t = T(e, ["'"], o + 1);
146
- if (t === -1) return -1;
147
- r = t + 1;
148
- }
149
- break;
150
- default: return o;
151
- }
152
- i--;
153
- } while (i > 0);
154
- throw Error("Too many escaping");
155
- }, D = /\/\*[^]*?(?:\*\/|$)/g;
156
- function O(e) {
157
- return e ? e.trim() : "";
158
- }
159
- function k(e, t) {
160
- let n = e && typeof e.type == "string", r = n ? e : t;
161
- for (let t in e) {
162
- let n = e[t];
163
- Array.isArray(n) ? n.forEach((e) => {
164
- k(e, r);
165
- }) : n && typeof n == "object" && k(n, r);
166
- }
167
- return n && Object.defineProperty(e, "parent", {
168
- configurable: !0,
169
- writable: !0,
170
- enumerable: !1,
171
- value: t || null
172
- }), e;
173
- }
174
- var le = class {
175
- level = 0;
176
- indentation = " ";
177
- compress = !1;
178
- constructor(e) {
179
- typeof e?.indent == "string" && (this.indentation = e?.indent), e?.compress && (this.compress = !0);
180
- }
181
- emit(e, t) {
182
- return e;
183
- }
184
- indent(e) {
185
- return this.level = this.level || 1, e ? (this.level += e, "") : Array(this.level).join(this.indentation);
186
- }
187
- visit(e) {
188
- switch (e.type) {
189
- case w.stylesheet: return this.stylesheet(e);
190
- case w.rule: return this.rule(e);
191
- case w.declaration: return this.declaration(e);
192
- case w.comment: return this.comment(e);
193
- case w.container: return this.container(e);
194
- case w.charset: return this.charset(e);
195
- case w.document: return this.document(e);
196
- case w.customMedia: return this.customMedia(e);
197
- case w.fontFace: return this.fontFace(e);
198
- case w.host: return this.host(e);
199
- case w.import: return this.import(e);
200
- case w.keyframes: return this.keyframes(e);
201
- case w.keyframe: return this.keyframe(e);
202
- case w.layer: return this.layer(e);
203
- case w.media: return this.media(e);
204
- case w.namespace: return this.namespace(e);
205
- case w.page: return this.page(e);
206
- case w.startingStyle: return this.startingStyle(e);
207
- case w.supports: return this.supports(e);
208
- }
209
- }
210
- mapVisit(e, t) {
211
- let n = "";
212
- t ||= "";
213
- for (let r = 0, i = e.length; r < i; r++) n += this.visit(e[r]), t && r < i - 1 && (n += this.emit(t));
214
- return n;
215
- }
216
- compile(e) {
217
- return this.compress ? e.stylesheet.rules.map(this.visit, this).join("") : this.stylesheet(e);
218
- }
219
- stylesheet(e) {
220
- return this.mapVisit(e.stylesheet.rules, "\n\n");
221
- }
222
- comment(e) {
223
- return this.compress ? this.emit("", e.position) : this.emit(`${this.indent()}/*${e.comment}*/`, e.position);
224
- }
225
- container(e) {
226
- return this.compress ? this.emit(`@container ${e.container}`, e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit(`${this.indent()}@container ${e.container}`, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`\n${this.indent(-1)}${this.indent()}}`);
227
- }
228
- layer(e) {
229
- return this.compress ? this.emit(`@layer ${e.layer}`, e.position) + (e.rules ? this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : ";") : this.emit(`${this.indent()}@layer ${e.layer}`, e.position) + (e.rules ? this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`\n${this.indent(-1)}${this.indent()}}`) : ";");
230
- }
231
- import(e) {
232
- return this.emit(`@import ${e.import};`, e.position);
233
- }
234
- media(e) {
235
- return this.compress ? this.emit(`@media ${e.media}`, e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit(`${this.indent()}@media ${e.media}`, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`\n${this.indent(-1)}${this.indent()}}`);
236
- }
237
- document(e) {
238
- let t = `@${e.vendor || ""}document ${e.document}`;
239
- return this.compress ? this.emit(t, e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit(t, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`${this.indent(-1)}\n}`);
240
- }
241
- charset(e) {
242
- return this.emit(`@charset ${e.charset};`, e.position);
243
- }
244
- namespace(e) {
245
- return this.emit(`@namespace ${e.namespace};`, e.position);
246
- }
247
- startingStyle(e) {
248
- return this.compress ? this.emit("@starting-style", e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit(`${this.indent()}@starting-style`, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`\n${this.indent(-1)}${this.indent()}}`);
249
- }
250
- supports(e) {
251
- return this.compress ? this.emit(`@supports ${e.supports}`, e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit(`${this.indent()}@supports ${e.supports}`, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`\n${this.indent(-1)}${this.indent()}}`);
252
- }
253
- keyframes(e) {
254
- return this.compress ? this.emit(`@${e.vendor || ""}keyframes ${e.name}`, e.position) + this.emit("{") + this.mapVisit(e.keyframes) + this.emit("}") : this.emit(`@${e.vendor || ""}keyframes ${e.name}`, e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.keyframes, "\n") + this.emit(`${this.indent(-1)}}`);
255
- }
256
- keyframe(e) {
257
- let t = e.declarations;
258
- return this.compress ? this.emit(e.values.join(","), e.position) + this.emit("{") + this.mapVisit(t) + this.emit("}") : this.emit(this.indent()) + this.emit(e.values.join(", "), e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(t, "\n") + this.emit(`${this.indent(-1)}\n${this.indent()}}\n`);
259
- }
260
- page(e) {
261
- if (this.compress) {
262
- let t = e.selectors.length ? e.selectors.join(", ") : "";
263
- return this.emit(`@page ${t}`, e.position) + this.emit("{") + this.mapVisit(e.declarations) + this.emit("}");
264
- }
265
- let t = e.selectors.length ? `${e.selectors.join(", ")} ` : "";
266
- return this.emit(`@page ${t}`, e.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(e.declarations, "\n") + this.emit(this.indent(-1)) + this.emit("\n}");
267
- }
268
- fontFace(e) {
269
- return this.compress ? this.emit("@font-face", e.position) + this.emit("{") + this.mapVisit(e.declarations) + this.emit("}") : this.emit("@font-face ", e.position) + this.emit("{\n") + this.emit(this.indent(1)) + this.mapVisit(e.declarations, "\n") + this.emit(this.indent(-1)) + this.emit("\n}");
270
- }
271
- host(e) {
272
- return this.compress ? this.emit("@host", e.position) + this.emit("{") + this.mapVisit(e.rules) + this.emit("}") : this.emit("@host", e.position) + this.emit(` {\n${this.indent(1)}`) + this.mapVisit(e.rules, "\n\n") + this.emit(`${this.indent(-1)}\n}`);
273
- }
274
- customMedia(e) {
275
- return this.emit(`@custom-media ${e.name} ${e.media};`, e.position);
276
- }
277
- rule(e) {
278
- let t = e.declarations;
279
- if (!t.length) return "";
280
- if (this.compress) return this.emit(e.selectors.join(","), e.position) + this.emit("{") + this.mapVisit(t) + this.emit("}");
281
- let n = this.indent();
282
- return this.emit(e.selectors.map((e) => n + e).join(",\n"), e.position) + this.emit(" {\n") + this.emit(this.indent(1)) + this.mapVisit(t, "\n") + this.emit(this.indent(-1)) + this.emit(`\n${this.indent()}}`);
283
- }
284
- declaration(e) {
285
- 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(";");
286
- }
287
- }, ue = (e, t) => {
288
- t ||= {};
289
- let n = 1, r = 1;
290
- function i() {
291
- let e = {
292
- line: n,
293
- column: r
294
- };
295
- return (i) => (i.position = new ce(e, {
296
- line: n,
297
- column: r
298
- }, t?.source || ""), d(), i);
299
- }
300
- let a = [];
301
- function o(i) {
302
- let o = new se(t?.source || "", i, n, r, e);
303
- if (!t?.silent) throw o;
304
- a.push(o);
305
- }
306
- function s() {
307
- let t = /^{\s*/.exec(e);
308
- return !!t && (u(t), !0);
309
- }
310
- function c() {
311
- let t = /^}/.exec(e);
312
- return !!t && (u(t), !0);
313
- }
314
- function l() {
315
- let t, n = [];
316
- for (d(), f(n); e.length && e.charAt(0) !== "}" && (t = S() || C(), t);) n.push(t), f(n);
317
- return n;
318
- }
319
- function u(t) {
320
- let i = t[0];
321
- return function(e) {
322
- let t = e.match(/\n/g);
323
- t && (n += t.length);
324
- let i = e.lastIndexOf("\n");
325
- r = ~i ? e.length - i : r + e.length;
326
- }(i), e = e.slice(i.length), t;
327
- }
328
- function d() {
329
- let t = /^\s*/.exec(e);
330
- t && u(t);
331
- }
332
- function f(e) {
333
- e ||= [];
334
- let t = p();
335
- for (; t;) e.push(t), t = p();
336
- return e;
337
- }
338
- function p() {
339
- let t = i();
340
- if (e.charAt(0) !== "/" || e.charAt(1) !== "*") return;
341
- let n = /^\/\*[^]*?\*\//.exec(e);
342
- return n ? (u(n), t({
343
- type: w.comment,
344
- comment: n[0].slice(2, -2)
345
- })) : o("End of comment missing");
346
- }
347
- function m() {
348
- let t = /^([^{]+)/.exec(e);
349
- if (t) return u(t), ((e, t) => {
350
- let n = [], r = 0;
351
- for (; r < e.length;) {
352
- let i = E(e, t, r);
353
- if (i === -1) return n.push(e.substring(r)), n;
354
- n.push(e.substring(r, i)), r = i + 1;
355
- }
356
- return n;
357
- })(O(t[0]).replace(D, ""), [","]).map((e) => O(e));
358
- }
359
- function h() {
360
- let t = i(), n = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);
361
- if (!n) return;
362
- u(n);
363
- let r = O(n[0]), a = /^:\s*/.exec(e);
364
- if (!a) return o("property missing ':'");
365
- u(a);
366
- let s = "", c = E(e, [";", "}"]);
367
- c !== -1 && (s = e.substring(0, c), u([s]), s = O(s).replace(D, ""));
368
- let l = t({
369
- type: w.declaration,
370
- property: r.replace(D, ""),
371
- value: s
372
- }), d = /^[;\s]*/.exec(e);
373
- return d && u(d), l;
374
- }
375
- function g() {
376
- let e = [];
377
- if (!s()) return o("missing '{'");
378
- f(e);
379
- let t = h();
380
- for (; t;) e.push(t), f(e), t = h();
381
- return c() ? e : o("missing '}'");
382
- }
383
- function _() {
384
- let t = [], n = i(), r = /^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);
385
- for (; r;) {
386
- let n = u(r);
387
- t.push(n[1]);
388
- let i = /^,\s*/.exec(e);
389
- i && u(i), r = /^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);
390
- }
391
- if (t.length) return n({
392
- type: w.keyframe,
393
- values: t,
394
- declarations: g() || []
395
- });
396
- }
397
- let v = x("import"), y = x("charset"), b = x("namespace");
398
- function x(t) {
399
- let n = RegExp("^@" + t + "\\s*((?::?[^;'\"]|\"(?:\\\\\"|[^\"])*?\"|'(?:\\\\'|[^'])*?')+)(?:;|$)");
400
- return () => {
401
- let r = i(), a = n.exec(e);
402
- if (!a) return;
403
- let o = u(a), s = { type: t };
404
- return s[t] = o[1].trim(), r(s);
405
- };
406
- }
407
- function S() {
408
- if (e[0] === "@") return function() {
409
- let t = i(), n = /^@([-\w]+)?keyframes\s*/.exec(e);
410
- if (!n) return;
411
- let r = u(n)[1], a = /^([-\w]+)\s*/.exec(e);
412
- if (!a) return o("@keyframes missing name");
413
- let l = u(a)[1];
414
- if (!s()) return o("@keyframes missing '{'");
415
- let d = f(), p = _();
416
- for (; p;) d.push(p), d = d.concat(f()), p = _();
417
- return c() ? t({
418
- type: w.keyframes,
419
- name: l,
420
- vendor: r,
421
- keyframes: d
422
- }) : o("@keyframes missing '}'");
423
- }() || function() {
424
- let t = i(), n = /^@media *([^{]+)/.exec(e);
425
- if (!n) return;
426
- let r = O(u(n)[1]);
427
- if (!s()) return o("@media missing '{'");
428
- let a = f().concat(l());
429
- return c() ? t({
430
- type: w.media,
431
- media: r,
432
- rules: a
433
- }) : o("@media missing '}'");
434
- }() || function() {
435
- let t = i(), n = /^@custom-media\s+(--\S+)\s+([^{;\s][^{;]*);/.exec(e);
436
- if (!n) return;
437
- let r = u(n);
438
- return t({
439
- type: w.customMedia,
440
- name: O(r[1]),
441
- media: O(r[2])
442
- });
443
- }() || function() {
444
- let t = i(), n = /^@supports *([^{]+)/.exec(e);
445
- if (!n) return;
446
- let r = O(u(n)[1]);
447
- if (!s()) return o("@supports missing '{'");
448
- let a = f().concat(l());
449
- return c() ? t({
450
- type: w.supports,
451
- supports: r,
452
- rules: a
453
- }) : o("@supports missing '}'");
454
- }() || v() || y() || b() || function() {
455
- let t = i(), n = /^@([-\w]+)?document *([^{]+)/.exec(e);
456
- if (!n) return;
457
- let r = u(n), a = O(r[1]), d = O(r[2]);
458
- if (!s()) return o("@document missing '{'");
459
- let p = f().concat(l());
460
- return c() ? t({
461
- type: w.document,
462
- document: d,
463
- vendor: a,
464
- rules: p
465
- }) : o("@document missing '}'");
466
- }() || function() {
467
- let t = i(), n = /^@page */.exec(e);
468
- if (!n) return;
469
- u(n);
470
- let r = m() || [];
471
- if (!s()) return o("@page missing '{'");
472
- let a = f(), l = h();
473
- for (; l;) a.push(l), a = a.concat(f()), l = h();
474
- return c() ? t({
475
- type: w.page,
476
- selectors: r,
477
- declarations: a
478
- }) : o("@page missing '}'");
479
- }() || function() {
480
- let t = i(), n = /^@host\s*/.exec(e);
481
- if (!n) return;
482
- if (u(n), !s()) return o("@host missing '{'");
483
- let r = f().concat(l());
484
- return c() ? t({
485
- type: w.host,
486
- rules: r
487
- }) : o("@host missing '}'");
488
- }() || function() {
489
- let t = i(), n = /^@font-face\s*/.exec(e);
490
- if (!n) return;
491
- if (u(n), !s()) return o("@font-face missing '{'");
492
- let r = f(), a = h();
493
- for (; a;) r.push(a), r = r.concat(f()), a = h();
494
- return c() ? t({
495
- type: w.fontFace,
496
- declarations: r
497
- }) : o("@font-face missing '}'");
498
- }() || function() {
499
- let t = i(), n = /^@container *([^{]+)/.exec(e);
500
- if (!n) return;
501
- let r = O(u(n)[1]);
502
- if (!s()) return o("@container missing '{'");
503
- let a = f().concat(l());
504
- return c() ? t({
505
- type: w.container,
506
- container: r,
507
- rules: a
508
- }) : o("@container missing '}'");
509
- }() || function() {
510
- let t = i(), n = /^@starting-style\s*/.exec(e);
511
- if (!n) return;
512
- if (u(n), !s()) return o("@starting-style missing '{'");
513
- let r = f().concat(l());
514
- return c() ? t({
515
- type: w.startingStyle,
516
- rules: r
517
- }) : o("@starting-style missing '}'");
518
- }() || function() {
519
- let t = i(), n = /^@layer *([^{;@]+)/.exec(e);
520
- if (!n) return;
521
- let r = O(u(n)[1]);
522
- if (!s()) {
523
- let n = /^[;\s]*/.exec(e);
524
- return n && u(n), t({
525
- type: w.layer,
526
- layer: r
527
- });
528
- }
529
- let a = f().concat(l());
530
- return c() ? t({
531
- type: w.layer,
532
- layer: r,
533
- rules: a
534
- }) : o("@layer missing '}'");
535
- }();
536
- }
537
- function C() {
538
- let e = i(), t = m();
539
- return t ? (f(), e({
540
- type: w.rule,
541
- selectors: t,
542
- declarations: g() || []
543
- })) : o("selector missing");
544
- }
545
- return k(function() {
546
- let e = l();
547
- return {
548
- type: w.stylesheet,
549
- stylesheet: {
550
- source: t?.source,
551
- rules: e,
552
- parsingErrors: a
553
- }
554
- };
555
- }());
556
- }, de = (e, t) => new le(t || {}).compile(e), fe = /* @__PURE__ */ a({
557
- resolve: () => ve,
558
- type: () => pe
559
- }), pe = "addStyleTag", me = /(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i, he = (e) => e.replace(/\\([0-9a-fA-F]{1,6})\s?/g, (e, t) => String.fromCodePoint(Number.parseInt(t, 16))).replace(/\\(.)/g, "$1"), A = (e) => !me.test(he(e.value)), j = (e) => {
560
- let t = [];
561
- for (let n of e) switch (n.type) {
562
- case w.import:
563
- case w.fontFace:
564
- case w.namespace:
565
- case w.charset:
566
- case w.document:
567
- case w.comment: continue;
568
- case w.rule:
569
- case w.page:
570
- t.push({
571
- ...n,
572
- declarations: n.declarations.filter((e) => e.type !== w.declaration || A(e))
573
- });
574
- continue;
575
- case w.media:
576
- case w.supports:
577
- case w.container:
578
- case w.host:
579
- case w.startingStyle:
580
- t.push({
581
- ...n,
582
- rules: j(n.rules)
583
- });
584
- continue;
585
- case w.layer:
586
- t.push({
587
- ...n,
588
- rules: n.rules ? j(n.rules) : void 0
589
- });
590
- continue;
591
- case w.keyframes:
592
- t.push({
593
- ...n,
594
- keyframes: n.keyframes.map((e) => e.type === w.keyframe ? {
595
- ...e,
596
- declarations: e.declarations.filter((e) => e.type !== w.declaration || A(e))
597
- } : e)
598
- });
599
- continue;
600
- default: continue;
601
- }
602
- return t;
603
- }, ge = (e) => {
604
- let t;
605
- try {
606
- t = ue(e, { silent: !0 });
607
- } catch {
608
- return "";
609
- }
610
- return t.stylesheet.rules = j(t.stylesheet.rules), de(t);
611
- }, _e = (e) => {
612
- let t = () => {
613
- e.parentNode || (document.head ?? document.documentElement).appendChild(e);
614
- };
615
- t();
616
- let n = new MutationObserver((n) => {
617
- for (let r of n) for (let n of r.removedNodes) if (n === e || n.contains?.(e)) {
618
- t();
619
- return;
620
- }
621
- });
622
- n.observe(document.documentElement, {
623
- childList: !0,
624
- subtree: !0
625
- }), window.addEventListener("load", () => n.disconnect(), { once: !0 });
626
- }, ve = async (e, t) => {
627
- let n = document.createElement("style");
628
- n.textContent = t.noSanitize ? t.content : ge(t.content);
629
- try {
630
- _e(n);
631
- } catch (e) {
632
- console.error(e);
633
- }
634
- }, M = "frameLocator", ye = [
635
- {
636
- ...u,
637
- nextLocatorType: "locator"
638
- },
639
- x,
640
- ne
641
- ], N = [fe], be = {
642
- type: M,
643
- selectorModules: ye,
644
- operationModules: N
645
- }, P = F({
646
- ownType: M,
647
- selectorModules: ye,
648
- operationModules: N
649
- });
650
- //#endregion
651
- //#region node_modules/@mfkn/web-extension/lib/content-script/resolvers/locators/factory.js
652
- function F(e) {
653
- return (t, n = []) => ({
654
- ...Object.fromEntries(e.selectorModules.map((r) => [r.type, (...i) => {
655
- let a = [...n, {
656
- locatorType: e.ownType,
657
- type: r.type,
658
- args: i
659
- }];
660
- return (r.nextLocatorType ?? e.ownType) === "locator" ? Dt(t, a) : P(t, a);
661
- }])),
662
- ...Object.fromEntries(e.operationModules.map(({ type: e }) => [e, (...r) => l(t, n, e, r)]))
663
- });
664
- }
665
- //#endregion
666
- //#region node_modules/@mfkn/web-extension/lib/content-script/resolvers/locators/selectors/get-by-role.js
667
- var xe = /* @__PURE__ */ a({
668
- render: () => we,
669
- resolve: () => Ce,
670
- type: () => Se
671
- }), Se = "getByRole", Ce = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(`[role="${CSS.escape(t)}"]`)]), we = (e) => ({ fragment: typeof e == "string" ? `[role="${e.replaceAll("\"", "\\\"")}"]` : "[role]" }), Te = /* @__PURE__ */ a({
672
- render: () => Oe,
673
- resolve: () => De,
674
- type: () => Ee
675
- }), Ee = "getByText", De = (e, t) => e.elements.flatMap((e) => [e, ...e.querySelectorAll("*")]).filter((e) => e.textContent?.includes(t)), Oe = (e) => ({ fragment: typeof e == "string" ? `:has-text("${e.replaceAll("\"", "\\\"")}")` : ":has-text(...)" }), ke = /* @__PURE__ */ a({
676
- render: () => Me,
677
- resolve: () => je,
678
- type: () => Ae
679
- }), Ae = "getByTestId", je = (e, t) => e.elements.flatMap((e) => [...e.querySelectorAll(`[data-testid="${CSS.escape(t)}"]`)]), Me = (e) => ({ fragment: typeof e == "string" ? `[data-testid="${e.replaceAll("\"", "\\\"")}"]` : "[data-testid]" }), Ne = /* @__PURE__ */ a({
680
- render: () => Ie,
681
- resolve: () => Fe,
682
- type: () => Pe
683
- }), Pe = "first", Fe = (e) => e.elements.slice(0, 1), Ie = () => ({ fragment: ":first" }), Le = /* @__PURE__ */ a({
684
- render: () => ze,
685
- resolve: () => Re,
686
- type: () => "nth"
687
- }), Re = (e, t) => {
688
- let n = e.elements.at(t);
689
- return n ? [n] : [];
690
- }, ze = (e) => ({ fragment: typeof e == "number" ? `:nth(${e})` : ":nth(?)" }), I = (e) => {
691
- let t = Error(e);
692
- return t.name = "LocatorError", t;
693
- }, L = (e) => {
694
- if (e.length === 0) throw I("No elements found");
695
- if (e.length > 1) throw I(`Strict mode violation: locator resolved to ${e.length} elements`);
696
- return e[0];
697
- }, Be = /* @__PURE__ */ a({
698
- resolve: () => He,
699
- type: () => Ve
700
- }), Ve = "click", He = (e, t = {}) => {
701
- let n = L(e.elements), r = n.getBoundingClientRect(), i = t.position?.x ?? .5, a = t.position?.y ?? .5, o = {
702
- bubbles: !0,
703
- cancelable: !0,
704
- composed: !0,
705
- clientX: r.left + r.width * i,
706
- clientY: r.top + r.height * a,
707
- button: 0
708
- }, s = {
709
- ...o,
710
- buttons: 1,
711
- pointerType: "mouse",
712
- pointerId: 1,
713
- isPrimary: !0
714
- }, c = {
715
- ...o,
716
- buttons: 1
717
- }, l = {
718
- ...o,
719
- buttons: 0
720
- };
721
- n.dispatchEvent(new PointerEvent("pointerdown", s)), n.dispatchEvent(new MouseEvent("mousedown", c)), n.dispatchEvent(new PointerEvent("pointerup", {
722
- ...s,
723
- buttons: 0
724
- })), n.dispatchEvent(new MouseEvent("mouseup", l)), n.dispatchEvent(new MouseEvent("click", l));
725
- }, Ue = /* @__PURE__ */ a({
726
- resolve: () => Ke,
727
- type: () => We
728
- }), We = "fill", R = (e, t) => {
729
- e._valueTracker?.setValue("");
730
- let n = e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype, r = Object.getOwnPropertyDescriptor(n, "value")?.set;
731
- r ? r.call(e, t) : e.value = t;
732
- }, Ge = (e, t) => {
733
- if (e.type !== "range") return null;
734
- let n = Number(e.min || 0), r = Number(e.max || 100);
735
- if (!Number.isFinite(n) || !Number.isFinite(r) || r <= n) return null;
736
- let i = Number(t);
737
- if (!Number.isFinite(i)) return null;
738
- let a = Math.max(0, Math.min(1, (i - n) / (r - n))), o = e.getBoundingClientRect(), s = {
739
- bubbles: !0,
740
- cancelable: !0,
741
- composed: !0,
742
- clientX: o.left + o.width * a,
743
- clientY: o.top + o.height / 2,
744
- button: 0
745
- };
746
- return {
747
- pointerDown: {
748
- ...s,
749
- buttons: 1,
750
- pointerType: "mouse",
751
- pointerId: 1,
752
- isPrimary: !0
753
- },
754
- pointerUp: {
755
- ...s,
756
- buttons: 0,
757
- pointerType: "mouse",
758
- pointerId: 1,
759
- isPrimary: !0
760
- },
761
- mouseDown: {
762
- ...s,
763
- buttons: 1
764
- },
765
- mouseUp: {
766
- ...s,
767
- buttons: 0
768
- }
769
- };
770
- }, Ke = (e, t, n = {}) => {
771
- let r = L(e.elements);
772
- if (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement) {
773
- let e = r instanceof HTMLInputElement ? Ge(r, t) : null;
774
- if (e) {
775
- r.dispatchEvent(new PointerEvent("pointerdown", e.pointerDown)), r.dispatchEvent(new MouseEvent("mousedown", e.mouseDown)), R(r, t), r.dispatchEvent(new Event("input", { bubbles: !0 })), r.dispatchEvent(new PointerEvent("pointerup", e.pointerUp)), r.dispatchEvent(new MouseEvent("mouseup", e.mouseUp)), r.dispatchEvent(new Event("change", { bubbles: !0 }));
776
- return;
777
- }
778
- R(r, t), r.dispatchEvent(new Event("input", { bubbles: !0 })), r.dispatchEvent(new Event("change", { bubbles: !0 }));
779
- return;
780
- }
781
- if (r instanceof HTMLElement && r.isContentEditable) {
782
- r.textContent = t, r.dispatchEvent(new Event("input", { bubbles: !0 }));
783
- return;
784
- }
785
- throw Error(`fill: element <${r.tagName.toLowerCase()}> is not fillable`);
786
- }, qe = /* @__PURE__ */ a({
787
- resolve: () => Ye,
788
- type: () => Je
789
- }), Je = "hover", Ye = (e, t = {}) => {
790
- let n = L(e.elements);
791
- n.dispatchEvent(new MouseEvent("mouseenter", {
792
- bubbles: !1,
793
- cancelable: !0
794
- })), n.dispatchEvent(new MouseEvent("mouseover", {
795
- bubbles: !0,
796
- cancelable: !0
797
- })), n.dispatchEvent(new MouseEvent("mousemove", {
798
- bubbles: !0,
799
- cancelable: !0
800
- }));
801
- }, Xe = /* @__PURE__ */ a({
802
- resolve: () => Qe,
803
- type: () => Ze
804
- }), Ze = "textContent", Qe = (e, t = {}) => L(e.elements).textContent, $e = /* @__PURE__ */ a({
805
- resolve: () => tt,
806
- type: () => et
807
- }), et = "isVisible", tt = (e, t = {}) => {
808
- let n = L(e.elements);
809
- if (!(n instanceof HTMLElement)) return !0;
810
- let r = n.ownerDocument.defaultView?.getComputedStyle(n);
811
- if (r?.display === "none" || r?.visibility === "hidden") return !1;
812
- let i = n.getBoundingClientRect();
813
- return i.width > 0 && i.height > 0;
814
- }, nt = /* @__PURE__ */ a({
815
- resolve: () => it,
816
- type: () => rt
817
- }), rt = "count", it = (e, t = {}) => e.elements.length, at = /* @__PURE__ */ a({
818
- resolve: () => st,
819
- type: () => ot
820
- }), ot = "exists", st = (e, t = {}) => e.elements.length > 0, ct = /* @__PURE__ */ a({
821
- resolve: () => ut,
822
- type: () => lt
823
- }), lt = "getAttribute", ut = (e, t, n = {}) => L(e.elements).getAttribute(t), dt = (e, t) => {
824
- let n = new EventTarget(), r = /* @__PURE__ */ new Map(), i = EventTarget.prototype.addEventListener.bind(n), a = EventTarget.prototype.removeEventListener.bind(n);
825
- return Object.defineProperty(n, "addEventListener", {
826
- configurable: !0,
827
- value: (a, o, s) => {
828
- if (o !== null) {
829
- if (!r.has(a)) {
830
- let i = (r) => {
831
- n.dispatchEvent(new CustomEvent(a, {
832
- detail: t(r, e),
833
- bubbles: r.bubbles,
834
- cancelable: r.cancelable,
835
- composed: r.composed
836
- }));
837
- };
838
- e.addEventListener(a, i), r.set(a, i);
839
- }
840
- i(a, o, s);
841
- }
842
- }
843
- }), Object.defineProperty(n, "removeEventListener", {
844
- configurable: !0,
845
- value: (t, n, i) => {
846
- if (n === null) return;
847
- a(t, n, i);
848
- let o = r.get(t);
849
- o && (e.removeEventListener(t, o), r.delete(t));
850
- }
851
- }), n;
852
- }, z = (e) => typeof e == "boolean" ? e ? 1 : 0 : e?.capture ? 1 : 0, ft = (e) => {
853
- let t = /* @__PURE__ */ new WeakMap();
854
- return {
855
- addEventListener: (n, r, i) => {
856
- if (r === null) return;
857
- let a = `${n}|${z(i)}`, o = t.get(r);
858
- if (o || (o = /* @__PURE__ */ new Map(), t.set(r, o)), o.has(a)) return;
859
- let s = typeof i == "object" && !!i && !!i.once, c = (t) => {
860
- s && o.delete(a);
861
- let i = e.unenrich(t, n);
862
- typeof r == "function" ? r.call(e.target, i) : r.handleEvent(i);
863
- };
864
- o.set(a, c), e.remoteEvents.addEventListener(n, c, i);
865
- },
866
- removeEventListener: (n, r, i) => {
867
- if (r === null) return;
868
- let a = `${n}|${z(i)}`, o = t.get(r), s = o?.get(a);
869
- s && (e.remoteEvents.removeEventListener(n, s, i), o.delete(a));
870
- },
871
- dispatchEvent: (t) => e.remoteEvents.dispatchEvent(t)
872
- };
873
- }, pt = /* @__PURE__ */ a({
874
- box: () => Z,
875
- createVideoElementHandle: () => Y,
876
- isType: () => X,
877
- revive: () => Q,
878
- type: () => B
879
- }), B = "videoElement", V = [
880
- "currentTime",
881
- "volume",
882
- "muted",
883
- "playbackRate",
884
- "src",
885
- "loop",
886
- "autoplay",
887
- "preload",
888
- "poster",
889
- "disableRemotePlayback"
890
- ], H = [
891
- "duration",
892
- "paused",
893
- "ended",
894
- "seeking",
895
- "readyState",
896
- "currentSrc"
897
- ], U = ["buffered", "seekable"], W = Symbol.for("fkn.remoteVideoElement"), G = Symbol.for("fkn.remoteVideoElement.state"), K = Symbol.for("fkn.remoteVideoElement.controller"), mt = (e) => e ? Array.from({ length: e.length }, (t, n) => [e.start(n), e.end(n)]) : [], q = (e) => {
898
- let t = {};
899
- for (let n of [...V, ...H]) t[n] = e[n];
900
- for (let n of U) t[n] = mt(e[n]);
901
- return t.error = e.error ? {
902
- code: e.error.code,
903
- message: e.error.message
904
- } : null, t;
905
- }, ht = (e) => {
906
- let t = (t) => {
907
- if (!Number.isInteger(t) || t < 0 || t >= e.length) throw new DOMException("Index or size is negative or greater than the allowed amount", "IndexSizeError");
908
- };
909
- return {
910
- get length() {
911
- return e.length;
912
- },
913
- start(n) {
914
- return t(n), e[n][0];
915
- },
916
- end(n) {
917
- return t(n), e[n][1];
918
- }
919
- };
920
- }, gt = (e) => e ? {
921
- code: e.code,
922
- message: e.message,
923
- MEDIA_ERR_ABORTED: 1,
924
- MEDIA_ERR_NETWORK: 2,
925
- MEDIA_ERR_DECODE: 3,
926
- MEDIA_ERR_SRC_NOT_SUPPORTED: 4
927
- } : null, _t = (e) => dt(e, (e, t) => ({
928
- originalDetail: e instanceof CustomEvent ? e.detail : null,
929
- snapshot: q(t)
930
- })), vt = async (e, t) => {
931
- switch (t) {
932
- case "play": return await e.play(), null;
933
- case "pause": return e.pause(), null;
934
- case "load": return e.load(), null;
935
- case "requestPictureInPicture":
936
- if (typeof e.requestPictureInPicture != "function") throw Error("requestPictureInPicture is not supported in this environment");
937
- return await e.requestPictureInPicture(), null;
938
- case "exitPictureInPicture": {
939
- let t = e.ownerDocument;
940
- if (typeof t?.exitPictureInPicture != "function") throw Error("exitPictureInPicture is not supported in this environment");
941
- return await t.exitPictureInPicture(), null;
942
- }
943
- default: throw Error(`videoElement: unknown method "${t}"`);
944
- }
945
- }, yt = (e) => ({
946
- call: async (t) => vt(e, t),
947
- set: async (t, n) => {
948
- try {
949
- e[t] = n;
950
- } catch {}
951
- return q(e);
952
- },
953
- events: _t(e)
954
- }), J = (e, t) => {
955
- let n = new EventTarget();
956
- Object.defineProperty(n, W, { value: !0 }), Object.defineProperty(n, G, { value: e }), Object.defineProperty(n, K, { value: t });
957
- let r = ft({
958
- target: n,
959
- remoteEvents: t.events,
960
- unenrich: (t, n) => {
961
- if (!(t instanceof CustomEvent)) return t;
962
- let r = t.detail;
963
- if (!r || !("snapshot" in r)) return t;
964
- Object.assign(e, r.snapshot);
965
- let i = {
966
- bubbles: t.bubbles,
967
- cancelable: t.cancelable,
968
- composed: t.composed
969
- };
970
- return r.originalDetail === null ? new Event(n, i) : new CustomEvent(n, {
971
- ...i,
972
- detail: r.originalDetail
973
- });
974
- }
975
- }), i = {
976
- addEventListener: {
977
- configurable: !0,
978
- value: r.addEventListener
979
- },
980
- removeEventListener: {
981
- configurable: !0,
982
- value: r.removeEventListener
983
- },
984
- dispatchEvent: {
985
- configurable: !0,
986
- value: r.dispatchEvent
987
- },
988
- error: {
989
- configurable: !0,
990
- enumerable: !0,
991
- get() {
992
- return gt(e.error);
993
- }
994
- },
995
- play: {
996
- configurable: !0,
997
- value: () => t.call("play", [])
998
- },
999
- pause: {
1000
- configurable: !0,
1001
- value: () => {
1002
- t.call("pause", []).catch(() => {});
1003
- }
1004
- },
1005
- load: {
1006
- configurable: !0,
1007
- value: () => {
1008
- t.call("load", []).catch(() => {});
1009
- }
1010
- },
1011
- requestPictureInPicture: {
1012
- configurable: !0,
1013
- value: () => t.call("requestPictureInPicture", [])
1014
- },
1015
- exitPictureInPicture: {
1016
- configurable: !0,
1017
- value: () => t.call("exitPictureInPicture", [])
1018
- },
1019
- HAVE_FUTURE_DATA: {
1020
- enumerable: !0,
1021
- value: 3
1022
- },
1023
- HAVE_ENOUGH_DATA: {
1024
- enumerable: !0,
1025
- value: 4
1026
- }
1027
- };
1028
- for (let n of V) i[n] = {
1029
- configurable: !0,
1030
- enumerable: !0,
1031
- get() {
1032
- return e[n];
1033
- },
1034
- set(r) {
1035
- e[n] = r, t.set(n, r).then((t) => {
1036
- Object.assign(e, t);
1037
- }, () => {});
1038
- }
1039
- };
1040
- for (let t of H) i[t] = {
1041
- configurable: !0,
1042
- enumerable: !0,
1043
- get() {
1044
- return e[t];
1045
- }
1046
- };
1047
- for (let t of U) i[t] = {
1048
- configurable: !0,
1049
- enumerable: !0,
1050
- get() {
1051
- return ht(e[t]);
1052
- }
1053
- };
1054
- return Object.defineProperties(n, i), n;
1055
- }, Y = (e) => J(q(e), yt(e)), X = (e) => typeof e == "object" && !!e && e[W] === !0, Z = (n, r) => {
1056
- let i = n;
1057
- return {
1058
- ...e,
1059
- type: B,
1060
- initialState: i[G],
1061
- controller: t(i[K], r)
1062
- };
1063
- }, Q = (e, t) => {
1064
- let r = n(e.controller, t);
1065
- return J({ ...e.initialState }, r);
1066
- }, bt = (e) => [pt, ...e], xt = /* @__PURE__ */ a({
1067
- resolve: () => Ct,
1068
- type: () => St
1069
- }), St = "videoElement", Ct = (e, t = {}) => {
1070
- let n = L(e.elements);
1071
- if (!(n instanceof HTMLVideoElement)) throw Error(`videoElement: expected <video>, got <${n.tagName.toLowerCase()}>`);
1072
- return Y(n);
1073
- }, $ = "locator", wt = [
1074
- u,
1075
- {
1076
- ...x,
1077
- nextLocatorType: "frameLocator"
1078
- },
1079
- xe,
1080
- Te,
1081
- ke,
1082
- Ne,
1083
- Le
1084
- ], Tt = [
1085
- Be,
1086
- Ue,
1087
- qe,
1088
- Xe,
1089
- $e,
1090
- nt,
1091
- at,
1092
- ct,
1093
- xt
1094
- ], Et = {
1095
- type: $,
1096
- selectorModules: wt,
1097
- operationModules: Tt
1098
- }, Dt = F({
1099
- ownType: $,
1100
- selectorModules: wt,
1101
- operationModules: Tt
1102
- });
1103
- //#endregion
1104
- export { Y as a, B as c, M as d, y as f, a as h, Z as i, P as l, i as m, $ as n, X as o, m as p, bt as r, Q as s, Et as t, be as u };