@pi-oxide/extension-js 0.13.2 → 0.14.0
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/content-script.js +3 -3
- package/extension_js.d.ts +11 -11
- package/extension_js.js +94097 -94096
- package/index.js +1006 -859
- package/package.json +2 -2
- package/worker.js +118 -117
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var sr = Object.defineProperty;
|
|
2
|
+
var cr = (e, r, n) => r in e ? sr(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
|
|
3
|
+
var L = (e, r, n) => cr(e, typeof r != "symbol" ? r + "" : r, n);
|
|
4
4
|
import { z as t } from "zod";
|
|
5
|
-
import { collectDocument as
|
|
6
|
-
const
|
|
5
|
+
import { collectDocument as lr, formatSnapshot as nt, init as dr } from "@pi-oxide/dom-semantic-tree";
|
|
6
|
+
const Ne = {
|
|
7
7
|
trace: 0,
|
|
8
8
|
debug: 1,
|
|
9
9
|
info: 2,
|
|
@@ -11,14 +11,14 @@ const Ae = {
|
|
|
11
11
|
error: 4,
|
|
12
12
|
none: 5
|
|
13
13
|
};
|
|
14
|
-
let
|
|
15
|
-
function
|
|
16
|
-
|
|
14
|
+
let at = "trace";
|
|
15
|
+
function ur(e) {
|
|
16
|
+
at = e;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
function pr(e) {
|
|
19
|
+
return Ne[e] >= Ne[at];
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function ot(e, r = "info") {
|
|
22
22
|
var n;
|
|
23
23
|
if (e === null) return "null";
|
|
24
24
|
if (e === void 0) return "undefined";
|
|
@@ -41,15 +41,15 @@ function nt(e, r = "info") {
|
|
|
41
41
|
}
|
|
42
42
|
return String(e);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function mr(e) {
|
|
45
45
|
return `[extension-js][${e}]`;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function br(e, r) {
|
|
48
48
|
if (!e) return "";
|
|
49
49
|
const n = [];
|
|
50
50
|
try {
|
|
51
51
|
for (const [a, o] of Object.entries(e))
|
|
52
|
-
n.push(`${a}=${
|
|
52
|
+
n.push(`${a}=${ot(o, r)}`);
|
|
53
53
|
} catch {
|
|
54
54
|
return " metadata=[unreadable]";
|
|
55
55
|
}
|
|
@@ -58,7 +58,7 @@ function pr(e, r) {
|
|
|
58
58
|
function ie(e, r) {
|
|
59
59
|
return r.length === 0 ? { event: e } : r.length === 1 && typeof r[0] == "object" && r[0] !== null && !Array.isArray(r[0]) ? { event: e, metadata: r[0] } : {
|
|
60
60
|
event: e,
|
|
61
|
-
metadata: { _args: r.map((n) =>
|
|
61
|
+
metadata: { _args: r.map((n) => ot(n)).join(" ") }
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
class De {
|
|
@@ -67,8 +67,8 @@ class De {
|
|
|
67
67
|
}
|
|
68
68
|
log(r, n, a) {
|
|
69
69
|
try {
|
|
70
|
-
if (!
|
|
71
|
-
const o =
|
|
70
|
+
if (!pr(r)) return;
|
|
71
|
+
const o = mr(this.namespace), i = br(a, r), s = `${o} ${n}${i}`;
|
|
72
72
|
switch (r) {
|
|
73
73
|
case "trace":
|
|
74
74
|
case "debug":
|
|
@@ -129,12 +129,12 @@ class De {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
const f = new De("root"),
|
|
133
|
-
function
|
|
134
|
-
|
|
132
|
+
const f = new De("root"), it = /* @__PURE__ */ new Set();
|
|
133
|
+
function hr(e) {
|
|
134
|
+
it.add(e);
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
return
|
|
136
|
+
function st(e) {
|
|
137
|
+
return it.has(e);
|
|
138
138
|
}
|
|
139
139
|
function le(e) {
|
|
140
140
|
return e == null ? {} : e instanceof Map ? Object.fromEntries(
|
|
@@ -144,8 +144,8 @@ function le(e) {
|
|
|
144
144
|
])
|
|
145
145
|
) : Array.isArray(e) ? e.map(le) : e;
|
|
146
146
|
}
|
|
147
|
-
const
|
|
148
|
-
function
|
|
147
|
+
const fr = "Content script is not connected on this tab. This tab was likely open before the extension loaded (MV3 does not retro-inject).";
|
|
148
|
+
function gr(e) {
|
|
149
149
|
return [
|
|
150
150
|
`await page.goto(${JSON.stringify(e || "")})`,
|
|
151
151
|
"Or ask the user to refresh the target tab, then retry fill/click"
|
|
@@ -156,12 +156,12 @@ function ge(e, r) {
|
|
|
156
156
|
message: e !== void 0 ? `Content script is not connected on tab ${e} (${n}).` : `Content script is not connected on this tab (${n}).`,
|
|
157
157
|
code: "E_CONTENT_SCRIPT",
|
|
158
158
|
category: "content-script",
|
|
159
|
-
hint:
|
|
160
|
-
recovery:
|
|
159
|
+
hint: fr,
|
|
160
|
+
recovery: gr(r)
|
|
161
161
|
};
|
|
162
162
|
return e !== void 0 && (a.details = { tabId: e, url: n }), a;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function yr(e) {
|
|
165
165
|
return {
|
|
166
166
|
message: `No active tab resolved for ${e}.`,
|
|
167
167
|
code: "E_NO_TAB",
|
|
@@ -172,7 +172,7 @@ function fr(e) {
|
|
|
172
172
|
]
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function _r(e, r) {
|
|
176
176
|
var c, l;
|
|
177
177
|
const n = e ? "refId" : r != null && r.label ? "label" : null, a = e || (r == null ? void 0 : r.label) || "";
|
|
178
178
|
let o = `Element not found${n ? ` by ${n} "${a}"` : ""}`;
|
|
@@ -197,14 +197,14 @@ function gr(e, r) {
|
|
|
197
197
|
};
|
|
198
198
|
return (l = r == null ? void 0 : r.candidates) != null && l.length && (s.details = { ...s.details, candidates: r.candidates }), i && (s.details = { ...s.details, snapshot: r.snapshot }), s;
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function wr(e) {
|
|
201
201
|
return e.includes("Could not establish connection") || e.includes("Receiving end does not exist") || e.includes("Timeout waiting for content-script ping") || e.includes("content script not available") || e.includes("message port closed before a response was received");
|
|
202
202
|
}
|
|
203
203
|
function me(e) {
|
|
204
204
|
const r = new Error(e.message);
|
|
205
205
|
throw r.code = e.code, e.category && (r.category = e.category), e.hint && (r.hint = e.hint), e.recovery && (r.recovery = e.recovery), e.details && (r.details = e.details), r;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function kr(e, r, n) {
|
|
208
208
|
let a = `Element not found by label "${e}"`;
|
|
209
209
|
if (r !== void 0) {
|
|
210
210
|
const i = r.map((s) => s.name || s.refId).filter(Boolean).slice(0, 5);
|
|
@@ -225,7 +225,7 @@ function _r(e, r, n) {
|
|
|
225
225
|
}
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Ir(e) {
|
|
229
229
|
if (!(e instanceof Error)) return {};
|
|
230
230
|
const r = e.name !== "Error" ? e.name : void 0, n = e.stack;
|
|
231
231
|
let a;
|
|
@@ -235,13 +235,13 @@ function wr(e) {
|
|
|
235
235
|
}
|
|
236
236
|
return { name: r, stack: n, line: a };
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function ct(e, r) {
|
|
239
239
|
if (typeof e == "object" && e !== null && "code" in e && typeof e.code == "string" && "message" in e && typeof e.message == "string") {
|
|
240
240
|
const c = e;
|
|
241
241
|
return c.hint || c.recovery ? c : c.code === "E_CONTENT_SCRIPT" ? ge(r == null ? void 0 : r.tabId, r == null ? void 0 : r.url) : c;
|
|
242
242
|
}
|
|
243
|
-
const n = (e instanceof Error ? e.message : String(e)) || "", { name: a, stack: o, line: i } =
|
|
244
|
-
if (
|
|
243
|
+
const n = (e instanceof Error ? e.message : String(e)) || "", { name: a, stack: o, line: i } = Ir(e);
|
|
244
|
+
if (wr(n))
|
|
245
245
|
return ge(r == null ? void 0 : r.tabId, r == null ? void 0 : r.url);
|
|
246
246
|
if (n.includes("permission") || n.includes("Permission")) {
|
|
247
247
|
const c = {
|
|
@@ -301,7 +301,7 @@ function T(e, r = 0, n = 2) {
|
|
|
301
301
|
}
|
|
302
302
|
return e instanceof t.ZodOptional ? `${T(e.unwrap(), r, n)}?` : e instanceof t.ZodLiteral ? JSON.stringify(e.value) : e instanceof t.ZodEnum ? e.options.map((a) => `"${a}"`).join(" | ") : e instanceof t.ZodAny ? "any" : e instanceof t.ZodUnknown ? "unknown" : e instanceof t.ZodVoid ? "void" : e instanceof t.ZodUndefined ? "undefined" : e instanceof t.ZodEffects ? T(e.innerType(), r, n) : e instanceof t.ZodDefault ? T(e.removeDefault(), r, n) : e instanceof t.ZodNullable ? `${T(e.unwrap(), r, n)} | null` : e instanceof t.ZodLazy ? "lazy" : e instanceof t.ZodPromise ? `Promise<${T(e.unwrap(), r + 1, n)}>` : e instanceof t.ZodFunction ? "function" : e instanceof t.ZodDate ? "Date" : e instanceof t.ZodMap ? "Map" : e instanceof t.ZodSet ? "Set" : e instanceof t.ZodIntersection ? `${T(e._def.left, r, n)} & ${T(e._def.right, r, n)}` : e instanceof t.ZodDiscriminatedUnion ? e.options.map((a) => T(a, r, n)).join(" or ") : e instanceof t.ZodBranded ? T(e.unwrap(), r, n) : e instanceof t.ZodNaN ? "NaN" : e instanceof t.ZodCatch ? T(e.removeCatch(), r, n) : e instanceof t.ZodPipeline ? T(e._def.in, r, n) : e instanceof t.ZodReadonly ? `readonly ${T(e.unwrap(), r, n)}` : "unknown";
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function vr(e) {
|
|
305
305
|
const r = Z(e);
|
|
306
306
|
if (!(r instanceof t.ZodObject))
|
|
307
307
|
return [];
|
|
@@ -353,33 +353,33 @@ function kr(e) {
|
|
|
353
353
|
};
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function lt(e) {
|
|
357
357
|
return T(e, 0, 3);
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function Er(e) {
|
|
360
360
|
return e === null ? "null" : e === void 0 ? "undefined" : Array.isArray(e) ? "array" : typeof e;
|
|
361
361
|
}
|
|
362
|
-
function
|
|
362
|
+
function xr(e, r, n, a) {
|
|
363
363
|
const o = n.filter((c) => c.path.length === 0), i = n.filter((c) => c.path.length > 0);
|
|
364
364
|
if (o.length > 0 && i.length === 0) {
|
|
365
365
|
const c = o.some((d) => d.code === "custom"), l = o.some(
|
|
366
366
|
(d) => d.code !== "invalid_type" && d.code !== "invalid_literal" && d.code !== "invalid_union"
|
|
367
367
|
);
|
|
368
368
|
if (!c && !l) {
|
|
369
|
-
const d = T(r), u =
|
|
369
|
+
const d = T(r), u = Er(a);
|
|
370
370
|
return `Invalid parameters for ${e}: expected ${d}${d === "{ }" ? " or no args" : ""}, received ${u}`;
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
const s = n.map((c) => `at '${c.path.length > 0 ? c.path.join(".") : "root"}': ${c.message}`);
|
|
374
374
|
return `Invalid parameters for ${e}: ${s.join("; ")}`;
|
|
375
375
|
}
|
|
376
|
-
async function
|
|
376
|
+
async function Sr(e, r, n, a, o) {
|
|
377
377
|
const i = e.safeParse(le(a));
|
|
378
378
|
if (!i.success)
|
|
379
379
|
return {
|
|
380
380
|
ok: !1,
|
|
381
381
|
error: {
|
|
382
|
-
message:
|
|
382
|
+
message: xr(
|
|
383
383
|
o,
|
|
384
384
|
e,
|
|
385
385
|
i.error.issues,
|
|
@@ -407,7 +407,7 @@ async function Er(e, r, n, a, o) {
|
|
|
407
407
|
}
|
|
408
408
|
return { ok: !0, value: c.data };
|
|
409
409
|
} catch (s) {
|
|
410
|
-
const c =
|
|
410
|
+
const c = ct(s), l = c.code === "E_EXTENSION" && (typeof s != "object" || s === null || !("code" in s));
|
|
411
411
|
return {
|
|
412
412
|
ok: !1,
|
|
413
413
|
error: {
|
|
@@ -418,23 +418,23 @@ async function Er(e, r, n, a, o) {
|
|
|
418
418
|
};
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
-
function
|
|
422
|
-
return r !== "main-thread" ? r :
|
|
421
|
+
function Tr(e, r) {
|
|
422
|
+
return r !== "main-thread" ? r : st(e) ? "content-script" : r;
|
|
423
423
|
}
|
|
424
|
-
const
|
|
425
|
-
let
|
|
426
|
-
function
|
|
424
|
+
const Ce = f.child("tool-registry"), qe = /* @__PURE__ */ new Map(), be = /* @__PURE__ */ new Map();
|
|
425
|
+
let dt = !1, he = null;
|
|
426
|
+
function Me(e) {
|
|
427
427
|
he = e;
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function Oe() {
|
|
430
430
|
return he == null ? void 0 : he.signal;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
433
|
-
const e =
|
|
432
|
+
function ee() {
|
|
433
|
+
const e = Oe();
|
|
434
434
|
if (e != null && e.aborted)
|
|
435
435
|
throw new Error("Runner aborted: ExtensionSession stopped");
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function ut(e) {
|
|
438
438
|
m({
|
|
439
439
|
...e,
|
|
440
440
|
owner: "content-script",
|
|
@@ -444,7 +444,7 @@ function lt(e) {
|
|
|
444
444
|
});
|
|
445
445
|
}
|
|
446
446
|
function m(e) {
|
|
447
|
-
if (
|
|
447
|
+
if (dt)
|
|
448
448
|
throw new Error(`JS registry is frozen; cannot register "${e.action}"`);
|
|
449
449
|
if (be.has(e.action))
|
|
450
450
|
throw new Error(`Tool "${e.action}" is already registered`);
|
|
@@ -459,7 +459,7 @@ function m(e) {
|
|
|
459
459
|
throw new Error(
|
|
460
460
|
`Duplicate public name "${r}" for action "${e.action}" (already registered by "${a}")`
|
|
461
461
|
);
|
|
462
|
-
const o =
|
|
462
|
+
const o = Tr(e.action, e.owner), i = {
|
|
463
463
|
...e,
|
|
464
464
|
owner: o
|
|
465
465
|
};
|
|
@@ -472,31 +472,31 @@ function m(e) {
|
|
|
472
472
|
params: e.params,
|
|
473
473
|
returns: e.returns,
|
|
474
474
|
handler: async (c, l, d, u) => {
|
|
475
|
-
const
|
|
475
|
+
const b = {
|
|
476
476
|
action: i.action,
|
|
477
477
|
callId: l,
|
|
478
478
|
runId: d,
|
|
479
479
|
signal: u
|
|
480
480
|
};
|
|
481
|
-
return i.handler(c,
|
|
481
|
+
return i.handler(c, b);
|
|
482
482
|
},
|
|
483
483
|
paramTypes: e.paramTypes ?? [],
|
|
484
|
-
returnType: e.returnType ??
|
|
484
|
+
returnType: e.returnType ?? lt(e.returns),
|
|
485
485
|
returnDoc: e.returnDoc ?? "Result",
|
|
486
486
|
errorCode: e.errorCode,
|
|
487
487
|
errorCategory: e.errorCategory,
|
|
488
488
|
example: e.example
|
|
489
489
|
};
|
|
490
|
-
|
|
490
|
+
qe.set(e.action, s);
|
|
491
491
|
}
|
|
492
|
-
function
|
|
493
|
-
return
|
|
492
|
+
function Pe(e) {
|
|
493
|
+
return qe.get(e);
|
|
494
494
|
}
|
|
495
|
-
function
|
|
496
|
-
|
|
497
|
-
const e =
|
|
495
|
+
function Cr() {
|
|
496
|
+
dt = !0;
|
|
497
|
+
const e = pt(), r = [];
|
|
498
498
|
for (const n of e)
|
|
499
|
-
n.owner === "main-thread" ?
|
|
499
|
+
n.owner === "main-thread" ? Pe(n.action) || r.push(`${n.action} (main-thread: no tool handler)`) : n.owner === "content-script" ? st(n.action) || r.push(
|
|
500
500
|
`${n.action} (content-script: missing from content-script action set)`
|
|
501
501
|
) : r.push(`${n.action} (unknown owner: ${n.owner})`);
|
|
502
502
|
if (r.length > 0)
|
|
@@ -506,13 +506,13 @@ function Sr() {
|
|
|
506
506
|
`)
|
|
507
507
|
);
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function pt() {
|
|
510
510
|
var r, n, a, o, i;
|
|
511
511
|
const e = [];
|
|
512
512
|
for (const [s, c] of be) {
|
|
513
513
|
if (c.owner === "rust") continue;
|
|
514
|
-
const l = c.paramTypes && c.paramTypes.length > 0 ? c.paramTypes :
|
|
515
|
-
type: c.returnType ??
|
|
514
|
+
const l = c.paramTypes && c.paramTypes.length > 0 ? c.paramTypes : vr(c.params), d = {
|
|
515
|
+
type: c.returnType ?? lt(c.returns),
|
|
516
516
|
description: c.returnDoc ?? "Result"
|
|
517
517
|
};
|
|
518
518
|
e.push({
|
|
@@ -543,8 +543,8 @@ function dt() {
|
|
|
543
543
|
return e;
|
|
544
544
|
}
|
|
545
545
|
async function x(e, r, n, a, o) {
|
|
546
|
-
|
|
547
|
-
const i =
|
|
546
|
+
Ce.debug("dispatch_start", { action: e, callId: n, runId: a });
|
|
547
|
+
const i = qe.get(e);
|
|
548
548
|
if (!i)
|
|
549
549
|
return {
|
|
550
550
|
ok: !1,
|
|
@@ -554,19 +554,19 @@ async function x(e, r, n, a, o) {
|
|
|
554
554
|
category: "unknown"
|
|
555
555
|
}
|
|
556
556
|
};
|
|
557
|
-
|
|
558
|
-
const s = await
|
|
557
|
+
ee();
|
|
558
|
+
const s = await Sr(
|
|
559
559
|
i.params,
|
|
560
560
|
i.returns,
|
|
561
561
|
async (c) => i.handler(c, n, a, o),
|
|
562
562
|
r,
|
|
563
563
|
e
|
|
564
564
|
);
|
|
565
|
-
return s.ok ? (
|
|
565
|
+
return s.ok ? (Ce.debug("dispatch_done", {
|
|
566
566
|
action: e,
|
|
567
567
|
ok: !0,
|
|
568
568
|
resultType: typeof s.value
|
|
569
|
-
}), s) : (
|
|
569
|
+
}), s) : (Ce.warn("dispatch_error", {
|
|
570
570
|
action: e,
|
|
571
571
|
error: s.error.message,
|
|
572
572
|
code: s.error.code
|
|
@@ -579,46 +579,46 @@ async function x(e, r, n, a, o) {
|
|
|
579
579
|
}
|
|
580
580
|
} : s);
|
|
581
581
|
}
|
|
582
|
-
const
|
|
582
|
+
const Xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
583
583
|
__proto__: null,
|
|
584
584
|
coerceWasmParams: le,
|
|
585
585
|
dispatchTool: x,
|
|
586
|
-
freezeJsRegistry:
|
|
587
|
-
getRunnerSignal:
|
|
588
|
-
getSerializableJsManifest:
|
|
589
|
-
getTool:
|
|
590
|
-
registerContentScriptJsCall:
|
|
586
|
+
freezeJsRegistry: Cr,
|
|
587
|
+
getRunnerSignal: Oe,
|
|
588
|
+
getSerializableJsManifest: pt,
|
|
589
|
+
getTool: Pe,
|
|
590
|
+
registerContentScriptJsCall: ut,
|
|
591
591
|
registerJsCall: m,
|
|
592
|
-
setRunnerAbortController:
|
|
593
|
-
throwIfAborted:
|
|
592
|
+
setRunnerAbortController: Me,
|
|
593
|
+
throwIfAborted: ee
|
|
594
594
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
595
|
-
let
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
},
|
|
595
|
+
let $ = null, ye = !1;
|
|
596
|
+
const mt = ({ tabId: e }) => {
|
|
597
|
+
$ = e;
|
|
598
|
+
}, bt = (e, r) => {
|
|
599
599
|
var a;
|
|
600
600
|
const n = window.chrome;
|
|
601
|
-
(a = n == null ? void 0 : n.runtime) != null && a.id && r.status === "complete" && (
|
|
601
|
+
(a = n == null ? void 0 : n.runtime) != null && a.id && r.status === "complete" && ($ = e, n.tabs.sendMessage(e, { action: "ping" }).catch(() => {
|
|
602
602
|
}));
|
|
603
603
|
};
|
|
604
|
-
function
|
|
604
|
+
function Rr(e) {
|
|
605
605
|
var r;
|
|
606
|
-
ye || (r = e == null ? void 0 : e.runtime) != null && r.id && (ye = !0, e.tabs.onActivated.addListener(
|
|
606
|
+
ye || (r = e == null ? void 0 : e.runtime) != null && r.id && (ye = !0, e.tabs.onActivated.addListener(mt), e.tabs.onUpdated.addListener(bt), e.tabs.query({ active: !0, lastFocusedWindow: !0 }).then((n) => {
|
|
607
607
|
const a = n[0];
|
|
608
|
-
(a == null ? void 0 : a.id) !== void 0 && (
|
|
608
|
+
(a == null ? void 0 : a.id) !== void 0 && ($ = a.id);
|
|
609
609
|
}).catch(() => {
|
|
610
610
|
}));
|
|
611
611
|
}
|
|
612
|
-
function
|
|
612
|
+
function Ar() {
|
|
613
613
|
var r;
|
|
614
614
|
const e = window.chrome;
|
|
615
|
-
!((r = e == null ? void 0 : e.runtime) != null && r.id) || !ye || (e.tabs.onActivated.removeListener(
|
|
615
|
+
!((r = e == null ? void 0 : e.runtime) != null && r.id) || !ye || (e.tabs.onActivated.removeListener(mt), e.tabs.onUpdated.removeListener(bt), ye = !1);
|
|
616
616
|
}
|
|
617
|
-
async function
|
|
617
|
+
async function ht() {
|
|
618
618
|
var n;
|
|
619
619
|
const e = f.child("tab-context");
|
|
620
|
-
if (e.debug("resolveActiveTabId_start", { activeTabId:
|
|
621
|
-
return e.debug("resolveActiveTabId_result", { tabId:
|
|
620
|
+
if (e.debug("resolveActiveTabId_start", { activeTabId: $ }), $ !== null)
|
|
621
|
+
return e.debug("resolveActiveTabId_result", { tabId: $ }), $;
|
|
622
622
|
const r = window.chrome;
|
|
623
623
|
if (!((n = r == null ? void 0 : r.runtime) != null && n.id))
|
|
624
624
|
return e.warn("resolveActiveTabId_result", {
|
|
@@ -628,12 +628,12 @@ async function mt() {
|
|
|
628
628
|
try {
|
|
629
629
|
const o = (await r.tabs.query({ active: !0 }))[0];
|
|
630
630
|
if (o && typeof o.id == "number")
|
|
631
|
-
return
|
|
631
|
+
return $ = o.id, e.debug("resolveActiveTabId_result", { tabId: o.id }), o.id;
|
|
632
632
|
} catch {
|
|
633
633
|
}
|
|
634
634
|
return e.warn("resolveActiveTabId_result", { tabId: null, reason: "not_found" }), null;
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function Nr(e) {
|
|
637
637
|
if (typeof e == "number" && Number.isFinite(e))
|
|
638
638
|
return e;
|
|
639
639
|
if (typeof e == "bigint") {
|
|
@@ -642,23 +642,23 @@ function Rr(e) {
|
|
|
642
642
|
}
|
|
643
643
|
return null;
|
|
644
644
|
}
|
|
645
|
-
function
|
|
646
|
-
const n = r.tabId ?? r.tab_id, a =
|
|
645
|
+
function Mr(e, r) {
|
|
646
|
+
const n = r.tabId ?? r.tab_id, a = Nr(n);
|
|
647
647
|
if (a !== null)
|
|
648
648
|
return a;
|
|
649
649
|
if (n != null)
|
|
650
650
|
throw new Error("tabId must be a finite number or safe integer bigint");
|
|
651
651
|
if (e === "required")
|
|
652
652
|
throw new Error("tabId is required for this action");
|
|
653
|
-
if (
|
|
654
|
-
return
|
|
653
|
+
if ($ !== null)
|
|
654
|
+
return $;
|
|
655
655
|
throw new Error("No active tab available");
|
|
656
656
|
}
|
|
657
657
|
function y(e, r, n, a) {
|
|
658
658
|
const o = new Error(e);
|
|
659
659
|
return o.code = r, n && (o.category = n), a != null && a.hint && (o.hint = a.hint), a != null && a.recovery && (o.recovery = a.recovery), a != null && a.details && (o.details = a.details), o;
|
|
660
660
|
}
|
|
661
|
-
function
|
|
661
|
+
function Dr(e) {
|
|
662
662
|
throw y(e.message, e.code, e.category, {
|
|
663
663
|
hint: e.hint,
|
|
664
664
|
recovery: e.recovery,
|
|
@@ -696,7 +696,7 @@ const _e = {
|
|
|
696
696
|
tts: "tts",
|
|
697
697
|
windows: "windows"
|
|
698
698
|
};
|
|
699
|
-
async function
|
|
699
|
+
async function ft() {
|
|
700
700
|
var e, r, n, a;
|
|
701
701
|
if (typeof chrome < "u" && ((e = chrome.runtime) != null && e.id))
|
|
702
702
|
try {
|
|
@@ -709,10 +709,10 @@ async function bt() {
|
|
|
709
709
|
else
|
|
710
710
|
ce = null;
|
|
711
711
|
}
|
|
712
|
-
async function
|
|
713
|
-
await
|
|
712
|
+
async function gt() {
|
|
713
|
+
await ft();
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function yt(e) {
|
|
716
716
|
if (e.length === 0) return null;
|
|
717
717
|
const r = e[0];
|
|
718
718
|
if (r === "system" && e.length >= 2) {
|
|
@@ -722,32 +722,32 @@ function ft(e) {
|
|
|
722
722
|
}
|
|
723
723
|
return r in _e ? _e[r] : r;
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function _t(e) {
|
|
726
726
|
const r = e.match(/^chrome_([a-zA-Z0-9]+)_/);
|
|
727
727
|
if (!r) return null;
|
|
728
728
|
const n = r[1];
|
|
729
729
|
return n in _e ? _e[n] : n;
|
|
730
730
|
}
|
|
731
|
-
function
|
|
731
|
+
function wt(e) {
|
|
732
732
|
return e === null ? !0 : ce === null ? !1 : ce.has(e);
|
|
733
733
|
}
|
|
734
|
-
function
|
|
735
|
-
if (r !== null && !
|
|
734
|
+
function Le(e, r) {
|
|
735
|
+
if (r !== null && !wt(r))
|
|
736
736
|
throw y(
|
|
737
737
|
`Permission denied: ${r} required for ${e}`,
|
|
738
738
|
"E_PERMISSION",
|
|
739
739
|
"permission"
|
|
740
740
|
);
|
|
741
741
|
}
|
|
742
|
-
const
|
|
742
|
+
const qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
743
743
|
__proto__: null,
|
|
744
|
-
checkPermission:
|
|
745
|
-
hasPermission:
|
|
746
|
-
initCapabilities:
|
|
747
|
-
manifestPermissionForApiPath:
|
|
748
|
-
permissionFromChromeAction:
|
|
749
|
-
refreshCapabilities:
|
|
750
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
744
|
+
checkPermission: Le,
|
|
745
|
+
hasPermission: wt,
|
|
746
|
+
initCapabilities: ft,
|
|
747
|
+
manifestPermissionForApiPath: yt,
|
|
748
|
+
permissionFromChromeAction: _t,
|
|
749
|
+
refreshCapabilities: gt
|
|
750
|
+
}, Symbol.toStringTag, { value: "Module" })), Or = /* @__PURE__ */ new Set([
|
|
751
751
|
"bookmarks_search",
|
|
752
752
|
"bookmarks_create",
|
|
753
753
|
"bookmarks_delete",
|
|
@@ -760,13 +760,13 @@ const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
760
760
|
"notifications_create",
|
|
761
761
|
"notifications_clear"
|
|
762
762
|
]);
|
|
763
|
-
function
|
|
764
|
-
return e.startsWith("chrome_") ||
|
|
763
|
+
function kt(e) {
|
|
764
|
+
return e.startsWith("chrome_") || Or.has(e);
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function It(e, r) {
|
|
767
767
|
return e(...r);
|
|
768
768
|
}
|
|
769
|
-
const
|
|
769
|
+
const Pr = /* @__PURE__ */ new Set([
|
|
770
770
|
"chrome_bookmarks_search",
|
|
771
771
|
"bookmarks_search",
|
|
772
772
|
"chrome_history_search",
|
|
@@ -776,9 +776,9 @@ const qr = /* @__PURE__ */ new Set([
|
|
|
776
776
|
"tab_query"
|
|
777
777
|
]);
|
|
778
778
|
function je(e, r) {
|
|
779
|
-
return r.length > 0 ? r :
|
|
779
|
+
return r.length > 0 ? r : Pr.has(e) ? [{}] : r;
|
|
780
780
|
}
|
|
781
|
-
function
|
|
781
|
+
function He(e, r) {
|
|
782
782
|
if (!Array.isArray(e))
|
|
783
783
|
throw y(
|
|
784
784
|
`Native-parity action ${r} requires an argument array`,
|
|
@@ -787,7 +787,7 @@ function Ue(e, r) {
|
|
|
787
787
|
);
|
|
788
788
|
return e;
|
|
789
789
|
}
|
|
790
|
-
function
|
|
790
|
+
function vt(e, r, n) {
|
|
791
791
|
let a = e;
|
|
792
792
|
for (let i = 0; i < r.length; i++) {
|
|
793
793
|
const s = r[i];
|
|
@@ -843,34 +843,34 @@ function fe(e) {
|
|
|
843
843
|
return r;
|
|
844
844
|
}
|
|
845
845
|
function p(e, r, n, a, o, i, s, c = [], l, d) {
|
|
846
|
-
const u =
|
|
846
|
+
const u = Lr(e), b = a.length > 0 ? `chrome.${a.join(".")}` : r, h = yt(a);
|
|
847
847
|
m({
|
|
848
848
|
action: e,
|
|
849
|
-
namespace:
|
|
849
|
+
namespace: b,
|
|
850
850
|
name: u,
|
|
851
851
|
description: n,
|
|
852
852
|
params: t.unknown(),
|
|
853
853
|
returns: o,
|
|
854
854
|
owner: "main-thread",
|
|
855
|
-
permission:
|
|
855
|
+
permission: h ?? void 0,
|
|
856
856
|
returnType: d ?? void 0,
|
|
857
857
|
handler: async (S, I) => {
|
|
858
858
|
var R;
|
|
859
|
-
const A = f.child("chrome"),
|
|
860
|
-
if (!((R =
|
|
859
|
+
const A = f.child("chrome"), D = window.chrome;
|
|
860
|
+
if (!((R = D == null ? void 0 : D.runtime) != null && R.id))
|
|
861
861
|
throw y(
|
|
862
862
|
`${e} is only available in a browser extension context`,
|
|
863
863
|
"E_NO_EXTENSION",
|
|
864
864
|
"permission"
|
|
865
865
|
);
|
|
866
|
-
|
|
867
|
-
const
|
|
866
|
+
Le(e, h);
|
|
867
|
+
const Y = je(
|
|
868
868
|
e,
|
|
869
|
-
|
|
870
|
-
),
|
|
871
|
-
A.debug("chrome_passthrough", { action: e, argCount:
|
|
869
|
+
He(S, e)
|
|
870
|
+
), W = vt(D, a, u);
|
|
871
|
+
A.debug("chrome_passthrough", { action: e, argCount: Y.length });
|
|
872
872
|
try {
|
|
873
|
-
const _ = await
|
|
873
|
+
const _ = await It(W, Y);
|
|
874
874
|
A.debug("chrome_passthrough_ok", { action: e });
|
|
875
875
|
const G = fe(_);
|
|
876
876
|
return G === void 0 ? null : G;
|
|
@@ -895,29 +895,29 @@ function p(e, r, n, a, o, i, s, c = [], l, d) {
|
|
|
895
895
|
example: l
|
|
896
896
|
});
|
|
897
897
|
}
|
|
898
|
-
function
|
|
898
|
+
function Lr(e) {
|
|
899
899
|
const r = e.split("_").at(-1);
|
|
900
900
|
if (!r)
|
|
901
901
|
throw new Error(`Cannot derive Chrome method name from action "${e}"`);
|
|
902
902
|
return r;
|
|
903
903
|
}
|
|
904
904
|
const Ie = {};
|
|
905
|
-
function
|
|
905
|
+
function Ki(e, r) {
|
|
906
906
|
Ie[e] = r;
|
|
907
907
|
}
|
|
908
|
-
function
|
|
908
|
+
function Vi(e) {
|
|
909
909
|
Object.assign(Ie, e);
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function Et(e) {
|
|
912
912
|
var r;
|
|
913
|
-
if (
|
|
913
|
+
if (Pe(e)) return !0;
|
|
914
914
|
if (e.startsWith("host_")) {
|
|
915
915
|
const n = e.slice(5);
|
|
916
916
|
return !!Ie[n] || !!((r = window.__hostHandlers) != null && r[n]);
|
|
917
917
|
}
|
|
918
918
|
return !1;
|
|
919
919
|
}
|
|
920
|
-
async function
|
|
920
|
+
async function xt(e, r) {
|
|
921
921
|
var o;
|
|
922
922
|
const n = f.child("runner");
|
|
923
923
|
n.debug("handleHostCallAction_start", { action: e });
|
|
@@ -954,8 +954,8 @@ async function vt(e, r) {
|
|
|
954
954
|
};
|
|
955
955
|
}
|
|
956
956
|
}
|
|
957
|
-
const
|
|
958
|
-
function
|
|
957
|
+
const Q = 3e4, St = 300, jr = 100, Hr = 500, Tt = 500, Ct = 500;
|
|
958
|
+
function H(e) {
|
|
959
959
|
return typeof e == "object" && e !== null && !Array.isArray(e) ? e : {};
|
|
960
960
|
}
|
|
961
961
|
function z(e) {
|
|
@@ -971,12 +971,12 @@ function te(e) {
|
|
|
971
971
|
if (Array.isArray(e)) {
|
|
972
972
|
const a = e[0], o = z(a);
|
|
973
973
|
if (o !== null) return o;
|
|
974
|
-
const i =
|
|
974
|
+
const i = H(a);
|
|
975
975
|
return z(i.id) ?? z(i.tabId) ?? z(i.tab_id);
|
|
976
976
|
}
|
|
977
977
|
const r = z(e);
|
|
978
978
|
if (r !== null) return r;
|
|
979
|
-
const n =
|
|
979
|
+
const n = H(e);
|
|
980
980
|
return z(n.id) ?? z(n.tabId) ?? z(n.tab_id);
|
|
981
981
|
}
|
|
982
982
|
const Ur = /* @__PURE__ */ new Map([
|
|
@@ -985,12 +985,12 @@ const Ur = /* @__PURE__ */ new Map([
|
|
|
985
985
|
["tab_wait_for_load", (e) => ({ tabId: e })],
|
|
986
986
|
["tab_scroll", (e) => ({ tabId: e })],
|
|
987
987
|
["sidepanel_wait", (e) => ({ duration: e })]
|
|
988
|
-
]),
|
|
988
|
+
]), Fr = /* @__PURE__ */ new Map([
|
|
989
989
|
["tab_create", (e) => ({ url: e })],
|
|
990
990
|
["page_new_tab", (e) => ({ url: e })],
|
|
991
991
|
["page_find", (e) => ({ selector: e })],
|
|
992
992
|
["sidepanel_press", (e) => ({ key: e })]
|
|
993
|
-
]),
|
|
993
|
+
]), Wr = /* @__PURE__ */ new Map([
|
|
994
994
|
["tab_press", (e) => ({ tabId: e[0], key: e[1] })],
|
|
995
995
|
["tab_unhover", (e) => ({ tabId: e[0] })],
|
|
996
996
|
[
|
|
@@ -998,13 +998,13 @@ const Ur = /* @__PURE__ */ new Map([
|
|
|
998
998
|
(e) => ({
|
|
999
999
|
tabId: e[0],
|
|
1000
1000
|
direction: e[1] ?? "down",
|
|
1001
|
-
amount: e[2] ??
|
|
1001
|
+
amount: e[2] ?? St
|
|
1002
1002
|
})
|
|
1003
1003
|
],
|
|
1004
1004
|
["tab_back", (e) => ({ tabId: e[0] })],
|
|
1005
1005
|
[
|
|
1006
1006
|
"tab_wait_for_load",
|
|
1007
|
-
(e) => ({ tabId: e[0], timeout: e[1] ?? BigInt(
|
|
1007
|
+
(e) => ({ tabId: e[0], timeout: e[1] ?? BigInt(Q) })
|
|
1008
1008
|
],
|
|
1009
1009
|
["tab_evaluate", (e) => ({ tabId: e[0], script: e[1] })],
|
|
1010
1010
|
["tab_fetch", (e) => ({ tabId: e[0], url: e[1], options: e[2] ?? {} })],
|
|
@@ -1013,15 +1013,15 @@ const Ur = /* @__PURE__ */ new Map([
|
|
|
1013
1013
|
["tab_snapshot_data", (e) => ({ tabId: e[0], options: e[1] ?? {} })],
|
|
1014
1014
|
[
|
|
1015
1015
|
"page_wait_for",
|
|
1016
|
-
(e) => ({ selector: e[0], timeout: e[1] ?? BigInt(
|
|
1016
|
+
(e) => ({ selector: e[0], timeout: e[1] ?? BigInt(Q) })
|
|
1017
1017
|
],
|
|
1018
1018
|
["page_extract", (e) => ({ fields: e })],
|
|
1019
1019
|
["storage_get_many", (e) => ({ keys: e })],
|
|
1020
1020
|
["storage_delete_many", (e) => ({ keys: e })]
|
|
1021
1021
|
]);
|
|
1022
|
-
function
|
|
1022
|
+
function $r(e, r) {
|
|
1023
1023
|
if (r = le(r), typeof r == "string") {
|
|
1024
|
-
const n =
|
|
1024
|
+
const n = Fr.get(e);
|
|
1025
1025
|
if (n) return n(r);
|
|
1026
1026
|
}
|
|
1027
1027
|
if (typeof r == "number" || typeof r == "bigint") {
|
|
@@ -1029,12 +1029,12 @@ function Fr(e, r) {
|
|
|
1029
1029
|
if (n) return n(r);
|
|
1030
1030
|
}
|
|
1031
1031
|
if (Array.isArray(r)) {
|
|
1032
|
-
const n =
|
|
1032
|
+
const n = Wr.get(e);
|
|
1033
1033
|
if (n) return n(r);
|
|
1034
1034
|
}
|
|
1035
1035
|
return r;
|
|
1036
1036
|
}
|
|
1037
|
-
function
|
|
1037
|
+
function v(e) {
|
|
1038
1038
|
if (!e.ok)
|
|
1039
1039
|
throw y(
|
|
1040
1040
|
e.error.message,
|
|
@@ -1043,32 +1043,32 @@ function E(e) {
|
|
|
1043
1043
|
);
|
|
1044
1044
|
return e.value;
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1047
|
-
if (!
|
|
1046
|
+
function Gr(e, r) {
|
|
1047
|
+
if (!kt(e)) return r;
|
|
1048
1048
|
const n = Array.isArray(r) ? r : [];
|
|
1049
1049
|
return je(e, n);
|
|
1050
1050
|
}
|
|
1051
|
-
function
|
|
1051
|
+
function Br(e) {
|
|
1052
1052
|
return {
|
|
1053
1053
|
ok: !1,
|
|
1054
1054
|
error: { message: `Unknown action: ${e}`, code: "E_UNKNOWN" }
|
|
1055
1055
|
};
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1058
|
-
const r = e ??
|
|
1057
|
+
function Kr(e) {
|
|
1058
|
+
const r = e ?? Oe();
|
|
1059
1059
|
if (r != null && r.aborted)
|
|
1060
1060
|
throw new Error("Runner aborted: ExtensionSession stopped");
|
|
1061
1061
|
return r ?? new AbortController().signal;
|
|
1062
1062
|
}
|
|
1063
|
-
async function
|
|
1064
|
-
if (!
|
|
1065
|
-
return { response:
|
|
1063
|
+
async function Vr(e, r) {
|
|
1064
|
+
if (!Et(e.action))
|
|
1065
|
+
return { response: Br(e.action) };
|
|
1066
1066
|
if (e.action.startsWith("host_"))
|
|
1067
|
-
return { response: await
|
|
1067
|
+
return { response: await xt(
|
|
1068
1068
|
e.action.slice(5),
|
|
1069
1069
|
e.params
|
|
1070
1070
|
), handler: "host" };
|
|
1071
|
-
const n =
|
|
1071
|
+
const n = kt(e.action) ? Gr(e.action, e.params) : $r(e.action, e.params);
|
|
1072
1072
|
return { response: await x(
|
|
1073
1073
|
e.action,
|
|
1074
1074
|
n,
|
|
@@ -1077,23 +1077,23 @@ async function Br(e, r) {
|
|
|
1077
1077
|
r
|
|
1078
1078
|
) };
|
|
1079
1079
|
}
|
|
1080
|
-
function
|
|
1080
|
+
function Zr(e) {
|
|
1081
1081
|
return f.child("runner").timer("command_dispatch", {
|
|
1082
1082
|
action: e.action,
|
|
1083
1083
|
commandId: e.call_id,
|
|
1084
1084
|
runId: e.runId
|
|
1085
1085
|
});
|
|
1086
1086
|
}
|
|
1087
|
-
async function
|
|
1088
|
-
const n =
|
|
1087
|
+
async function zr(e, r) {
|
|
1088
|
+
const n = Zr(e), { response: a, handler: o } = await Vr(
|
|
1089
1089
|
e,
|
|
1090
|
-
|
|
1090
|
+
Kr(r)
|
|
1091
1091
|
);
|
|
1092
1092
|
return n({ ok: a.ok, ...o ? { handler: o } : {} }), a;
|
|
1093
1093
|
}
|
|
1094
|
-
const
|
|
1095
|
-
let
|
|
1096
|
-
function
|
|
1094
|
+
const Xr = /^e\d+$/;
|
|
1095
|
+
let Rt = 0;
|
|
1096
|
+
function Qr() {
|
|
1097
1097
|
let e = 0;
|
|
1098
1098
|
for (const r of document.querySelectorAll("[data-ref-id]")) {
|
|
1099
1099
|
const n = r.getAttribute("data-ref-id");
|
|
@@ -1101,15 +1101,93 @@ function zr() {
|
|
|
1101
1101
|
const a = parseInt(n.replace(/^e/, ""), 10);
|
|
1102
1102
|
!Number.isNaN(a) && a > e && (e = a);
|
|
1103
1103
|
}
|
|
1104
|
-
|
|
1104
|
+
Rt = e;
|
|
1105
1105
|
}
|
|
1106
|
-
function
|
|
1106
|
+
function At(e) {
|
|
1107
1107
|
const r = e.getAttribute("data-ref-id");
|
|
1108
|
-
if (r &&
|
|
1109
|
-
const n = `e${++
|
|
1108
|
+
if (r && Xr.test(r)) return r;
|
|
1109
|
+
const n = `e${++Rt}`;
|
|
1110
1110
|
return e.setAttribute("data-ref-id", n), n;
|
|
1111
1111
|
}
|
|
1112
|
-
const
|
|
1112
|
+
const Jr = /* @__PURE__ */ new Set([
|
|
1113
|
+
"button",
|
|
1114
|
+
"tab",
|
|
1115
|
+
"link",
|
|
1116
|
+
"checkbox",
|
|
1117
|
+
"menuitem",
|
|
1118
|
+
"menuitemcheckbox",
|
|
1119
|
+
"menuitemradio",
|
|
1120
|
+
"radio",
|
|
1121
|
+
"textbox"
|
|
1122
|
+
]);
|
|
1123
|
+
function Yr(e) {
|
|
1124
|
+
let r = e;
|
|
1125
|
+
for (; r; ) {
|
|
1126
|
+
if (r.hidden || r.getAttribute("aria-hidden") === "true" || r.inert) return !0;
|
|
1127
|
+
const n = window.getComputedStyle(r);
|
|
1128
|
+
if (n.display === "none" || n.visibility === "hidden") return !0;
|
|
1129
|
+
r = r.parentElement;
|
|
1130
|
+
}
|
|
1131
|
+
return !1;
|
|
1132
|
+
}
|
|
1133
|
+
function en(e) {
|
|
1134
|
+
var n, a;
|
|
1135
|
+
const r = e.getAttribute("jsaction");
|
|
1136
|
+
if (!r) return !1;
|
|
1137
|
+
for (const o of r.split(";")) {
|
|
1138
|
+
const i = o.trim();
|
|
1139
|
+
if (!i) continue;
|
|
1140
|
+
const s = i.split(":"), c = s.length === 1 ? "click" : (n = s[0]) == null ? void 0 : n.trim(), l = ((a = s.length === 1 ? s[0] : s[1]) == null ? void 0 : a.trim()) ?? "";
|
|
1141
|
+
if (c === "click" && !(!l || l.startsWith("none.") || l.endsWith("._")) && l.includes("."))
|
|
1142
|
+
return !0;
|
|
1143
|
+
}
|
|
1144
|
+
return !1;
|
|
1145
|
+
}
|
|
1146
|
+
function tn(e) {
|
|
1147
|
+
var n;
|
|
1148
|
+
const r = (n = e.getAttribute("class")) == null ? void 0 : n.toLowerCase();
|
|
1149
|
+
return (r == null ? void 0 : r.includes("button")) === !0 || (r == null ? void 0 : r.includes("btn")) === !0;
|
|
1150
|
+
}
|
|
1151
|
+
function rn(e) {
|
|
1152
|
+
return e instanceof HTMLButtonElement || e instanceof HTMLSelectElement ? !e.disabled : e instanceof HTMLTextAreaElement ? !e.disabled && !e.readOnly : e instanceof HTMLInputElement ? e.type !== "hidden" && !e.disabled : e instanceof HTMLAnchorElement ? e.hasAttribute("href") : !1;
|
|
1153
|
+
}
|
|
1154
|
+
function nn(e) {
|
|
1155
|
+
const r = e.getAttribute("contenteditable");
|
|
1156
|
+
return r !== null && (r === "" || r.toLowerCase() === "true" || r.toLowerCase() === "contenteditable");
|
|
1157
|
+
}
|
|
1158
|
+
function an(e) {
|
|
1159
|
+
const r = e.getAttribute("tabindex");
|
|
1160
|
+
if (r === null) return !1;
|
|
1161
|
+
const n = Number.parseInt(r, 10);
|
|
1162
|
+
return Number.isFinite(n) && n >= 0;
|
|
1163
|
+
}
|
|
1164
|
+
function Nt(e) {
|
|
1165
|
+
if (Yr(e)) return { clickable: !1, confidence: "low" };
|
|
1166
|
+
if (e.getAttribute("aria-disabled") === "true")
|
|
1167
|
+
return { clickable: !1, confidence: "low" };
|
|
1168
|
+
let r = { clickable: !1, confidence: "low" };
|
|
1169
|
+
const n = e.getAttribute("role");
|
|
1170
|
+
return n && Jr.has(n.toLowerCase()) ? r = { clickable: !0, confidence: "high", reason: "role" } : e.getAttribute("onclick") || e.onclick ? r = { clickable: !0, confidence: "high", reason: "onclick" } : en(e) ? r = { clickable: !0, confidence: "high", reason: "jsaction" } : nn(e) ? r = { clickable: !0, confidence: "high", reason: "contenteditable" } : an(e) ? r = { clickable: !0, confidence: "high", reason: "tabindex" } : rn(e) ? r = { clickable: !0, confidence: "high", reason: "native" } : tn(e) && (r = { clickable: !0, confidence: "low", reason: "buttonClass" }), r.clickable && e.tagName.toLowerCase() === "span" && (r = { clickable: !0, confidence: "low", reason: "span" }), r;
|
|
1171
|
+
}
|
|
1172
|
+
function on(e) {
|
|
1173
|
+
const r = [1, 2, 3], n = 6, a = /* @__PURE__ */ new Set();
|
|
1174
|
+
for (let o = 0; o < e.length; o++) {
|
|
1175
|
+
const i = e[o];
|
|
1176
|
+
if (i.confidence !== "low") continue;
|
|
1177
|
+
const s = Math.min(e.length, o + 1 + n);
|
|
1178
|
+
for (let c = o + 1; c < s; c++) {
|
|
1179
|
+
let l = e[c].el;
|
|
1180
|
+
for (const d of r)
|
|
1181
|
+
if (l = (l == null ? void 0 : l.parentElement) ?? null, l === i.el) {
|
|
1182
|
+
a.add(i.el);
|
|
1183
|
+
break;
|
|
1184
|
+
}
|
|
1185
|
+
if (a.has(i.el)) break;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
return a;
|
|
1189
|
+
}
|
|
1190
|
+
const Ue = 'input, textarea, select, button, a, [role="button"], [role="link"]', sn = /* @__PURE__ */ new Set(["script", "style", "noscript", "template"]), Mt = /* @__PURE__ */ new Set([
|
|
1113
1191
|
"p",
|
|
1114
1192
|
"span",
|
|
1115
1193
|
"label",
|
|
@@ -1137,12 +1215,12 @@ const Le = 'input, textarea, select, button, a, [role="button"], [role="link"]',
|
|
|
1137
1215
|
"sub",
|
|
1138
1216
|
"sup"
|
|
1139
1217
|
]);
|
|
1140
|
-
function
|
|
1218
|
+
function cn(e) {
|
|
1141
1219
|
const r = {};
|
|
1142
1220
|
if (e instanceof HTMLInputElement)
|
|
1143
|
-
e.type !== "password" && e.type !== "hidden" && (r.value = e.value), (e.type === "checkbox" || e.type === "radio") && (r.checked = e.checked), r.disabled = e.disabled, r.readOnly = e.readOnly,
|
|
1221
|
+
e.type !== "password" && e.type !== "hidden" && (r.value = e.value), (e.type === "checkbox" || e.type === "radio") && (r.checked = e.checked), r.disabled = e.disabled, r.readOnly = e.readOnly, Re(e, r);
|
|
1144
1222
|
else if (e instanceof HTMLTextAreaElement)
|
|
1145
|
-
r.value = e.value, r.disabled = e.disabled, r.readOnly = e.readOnly,
|
|
1223
|
+
r.value = e.value, r.disabled = e.disabled, r.readOnly = e.readOnly, Re(e, r);
|
|
1146
1224
|
else if (e instanceof HTMLSelectElement) {
|
|
1147
1225
|
if (e.multiple) {
|
|
1148
1226
|
const n = [];
|
|
@@ -1151,17 +1229,17 @@ function Qr(e) {
|
|
|
1151
1229
|
r.value = n.join(",");
|
|
1152
1230
|
} else
|
|
1153
1231
|
r.value = e.value;
|
|
1154
|
-
r.disabled = e.disabled,
|
|
1232
|
+
r.disabled = e.disabled, Re(e, r);
|
|
1155
1233
|
} else e instanceof HTMLOptionElement && (r.value = e.value, r.selected = e.selected, r.disabled = e.disabled);
|
|
1156
1234
|
return r;
|
|
1157
1235
|
}
|
|
1158
|
-
function
|
|
1236
|
+
function Re(e, r) {
|
|
1159
1237
|
const n = e.required || e.getAttribute("aria-required") === "true", o = !(e.getAttribute("aria-invalid") === "true") && e.checkValidity();
|
|
1160
1238
|
n && (r.required = !0), r.valid = o, r.invalid = !o;
|
|
1161
|
-
const i =
|
|
1239
|
+
const i = ln(e);
|
|
1162
1240
|
i && (r.errorMessage = i), !o && e.validationMessage && (r.validationMessage = e.validationMessage);
|
|
1163
1241
|
}
|
|
1164
|
-
function
|
|
1242
|
+
function ln(e) {
|
|
1165
1243
|
var n;
|
|
1166
1244
|
const r = [
|
|
1167
1245
|
...(e.getAttribute("aria-errormessage") || "").split(/\s+/),
|
|
@@ -1176,26 +1254,26 @@ function Jr(e) {
|
|
|
1176
1254
|
if (s === "alert" || c && c !== "off" || /error|required|select|please|invalid/i.test(i)) return i;
|
|
1177
1255
|
}
|
|
1178
1256
|
}
|
|
1179
|
-
function
|
|
1257
|
+
function dn(e, r) {
|
|
1180
1258
|
const n = e.tagName.toLowerCase();
|
|
1181
|
-
n !== "input" && n !== "textarea" && n !== "select" && n !== "option" || Object.assign(r,
|
|
1259
|
+
n !== "input" && n !== "textarea" && n !== "select" && n !== "option" || Object.assign(r, cn(e));
|
|
1182
1260
|
}
|
|
1183
|
-
const
|
|
1261
|
+
const un = /* @__PURE__ */ new Set(["http:", "https:", "file:"]);
|
|
1184
1262
|
function ve(e) {
|
|
1185
1263
|
if (e)
|
|
1186
1264
|
try {
|
|
1187
1265
|
const r = new URL(e, window.location.href);
|
|
1188
|
-
return
|
|
1266
|
+
return un.has(r.protocol) ? r.href : void 0;
|
|
1189
1267
|
} catch {
|
|
1190
1268
|
return;
|
|
1191
1269
|
}
|
|
1192
1270
|
}
|
|
1193
|
-
function
|
|
1271
|
+
function pn(e) {
|
|
1194
1272
|
const r = e.closest("article[data-post-id], [data-post-id]");
|
|
1195
1273
|
if (r)
|
|
1196
|
-
return
|
|
1274
|
+
return At(r);
|
|
1197
1275
|
}
|
|
1198
|
-
function
|
|
1276
|
+
function mn(e) {
|
|
1199
1277
|
const r = e.querySelector(
|
|
1200
1278
|
":scope > h2 a[href], a[data-permalink], a[rel='permalink']"
|
|
1201
1279
|
);
|
|
@@ -1217,16 +1295,16 @@ function X(e) {
|
|
|
1217
1295
|
if (a === "radio") return "radio";
|
|
1218
1296
|
if (a === "submit" || a === "button") return "button";
|
|
1219
1297
|
}
|
|
1220
|
-
return r === "textarea" ? "textbox" : r === "select" ? "combobox" : r === "img" ? "img" : r === "h1" || r === "h2" || r === "h3" || r === "h4" || r === "h5" || r === "h6" ? "heading" : r === "li" ? "listitem" : r === "ul" || r === "ol" ? "list" : r === "table" ? "table" : r === "tr" ? "row" : r === "td" || r === "th" ? "cell" : r === "nav" ? "navigation" : r === "main" ? "main" : r === "article" ? "article" : r === "section" ? "region" : r === "aside" ? "complementary" : r === "form" ? "form" : r === "dialog" || r === "modal" ? "dialog" : r === "figure" ? "figure" : r === "figcaption" ? "caption" :
|
|
1298
|
+
return r === "textarea" ? "textbox" : r === "select" ? "combobox" : r === "img" ? "img" : r === "h1" || r === "h2" || r === "h3" || r === "h4" || r === "h5" || r === "h6" ? "heading" : r === "li" ? "listitem" : r === "ul" || r === "ol" ? "list" : r === "table" ? "table" : r === "tr" ? "row" : r === "td" || r === "th" ? "cell" : r === "nav" ? "navigation" : r === "main" ? "main" : r === "article" ? "article" : r === "section" ? "region" : r === "aside" ? "complementary" : r === "form" ? "form" : r === "dialog" || r === "modal" ? "dialog" : r === "figure" ? "figure" : r === "figcaption" ? "caption" : "generic";
|
|
1221
1299
|
}
|
|
1222
|
-
function
|
|
1300
|
+
function bn(e) {
|
|
1223
1301
|
var r;
|
|
1224
1302
|
for (const n of e.childNodes)
|
|
1225
1303
|
if (n.nodeType === Node.TEXT_NODE && ((r = n.textContent) == null ? void 0 : r.trim()))
|
|
1226
1304
|
return !0;
|
|
1227
1305
|
return !1;
|
|
1228
1306
|
}
|
|
1229
|
-
function
|
|
1307
|
+
function Dt(e, r = 60) {
|
|
1230
1308
|
var o, i;
|
|
1231
1309
|
const n = [];
|
|
1232
1310
|
for (const s of e.childNodes)
|
|
@@ -1239,7 +1317,7 @@ function At(e, r = 60) {
|
|
|
1239
1317
|
const a = (i = e.textContent) == null ? void 0 : i.trim();
|
|
1240
1318
|
return a ? a.slice(0, r) : "";
|
|
1241
1319
|
}
|
|
1242
|
-
function
|
|
1320
|
+
function hn(e) {
|
|
1243
1321
|
let r = e;
|
|
1244
1322
|
for (; r; ) {
|
|
1245
1323
|
if (r.hidden || r.getAttribute("aria-hidden") === "true" || r.inert) return !0;
|
|
@@ -1249,19 +1327,19 @@ function an(e) {
|
|
|
1249
1327
|
}
|
|
1250
1328
|
return !1;
|
|
1251
1329
|
}
|
|
1252
|
-
function
|
|
1253
|
-
return
|
|
1330
|
+
function fn(e) {
|
|
1331
|
+
return hn(e);
|
|
1254
1332
|
}
|
|
1255
|
-
function
|
|
1333
|
+
function qt(e) {
|
|
1256
1334
|
var c;
|
|
1257
1335
|
const r = e.tagName.toLowerCase();
|
|
1258
|
-
if (
|
|
1336
|
+
if (sn.has(r) || fn(e)) return !1;
|
|
1259
1337
|
const n = X(e);
|
|
1260
1338
|
if (n !== "generic" && !(n === "presentation" || n === "none")) return !0;
|
|
1261
1339
|
const o = e.getAttribute("aria-live");
|
|
1262
1340
|
if (o && o !== "off") return !0;
|
|
1263
1341
|
const i = e.getAttribute("role");
|
|
1264
|
-
return i === "status" || i === "alert" ? !0 : ((c = e.textContent) == null ? void 0 : c.trim()) || "" ? !!(
|
|
1342
|
+
return i === "status" || i === "alert" ? !0 : ((c = e.textContent) == null ? void 0 : c.trim()) || "" ? !!(Mt.has(r) || bn(e)) : !1;
|
|
1265
1343
|
}
|
|
1266
1344
|
function Ee(e) {
|
|
1267
1345
|
var s, c, l;
|
|
@@ -1281,33 +1359,63 @@ function Ee(e) {
|
|
|
1281
1359
|
const i = X(e);
|
|
1282
1360
|
if (i !== "generic" && i !== "list" && i !== "table" && i !== "row" && i !== "region" && i !== "navigation" && i !== "main")
|
|
1283
1361
|
return ((c = e.textContent) == null ? void 0 : c.trim().slice(0, 60)) || "";
|
|
1284
|
-
if (i === "generic" &&
|
|
1285
|
-
const d =
|
|
1362
|
+
if (i === "generic" && qt(e)) {
|
|
1363
|
+
const d = Dt(e);
|
|
1286
1364
|
if (d) return d;
|
|
1287
1365
|
const u = e.tagName.toLowerCase();
|
|
1288
|
-
if (
|
|
1366
|
+
if (Mt.has(u) || e.childElementCount === 0)
|
|
1289
1367
|
return ((l = e.textContent) == null ? void 0 : l.trim().slice(0, 60)) || "";
|
|
1290
1368
|
}
|
|
1291
1369
|
return "";
|
|
1292
1370
|
}
|
|
1293
|
-
function
|
|
1294
|
-
return e instanceof HTMLInputElement && e.type === "file" ||
|
|
1371
|
+
function gn(e) {
|
|
1372
|
+
return e instanceof HTMLInputElement && e.type === "file" || _n(e) || Ot(e) || Fe(e) ? !0 : qt(e);
|
|
1295
1373
|
}
|
|
1296
|
-
function
|
|
1374
|
+
function Fe(e) {
|
|
1375
|
+
return Nt(e).clickable;
|
|
1376
|
+
}
|
|
1377
|
+
function yn(e) {
|
|
1378
|
+
if (!Fe(e)) return !1;
|
|
1379
|
+
const r = e.ownerDocument;
|
|
1380
|
+
if (typeof r.elementFromPoint != "function") return !0;
|
|
1381
|
+
const n = r.defaultView, a = Array.from(e.getClientRects()).filter(
|
|
1382
|
+
(i) => i.width > 0 && i.height > 0
|
|
1383
|
+
);
|
|
1384
|
+
if (a.length === 0) return !0;
|
|
1385
|
+
let o = !1;
|
|
1386
|
+
for (const i of a) {
|
|
1387
|
+
const s = [
|
|
1388
|
+
[i.left + i.width / 2, i.top + i.height / 2],
|
|
1389
|
+
[i.left + 0.1, i.top + 0.1],
|
|
1390
|
+
[i.right - 0.1, i.top + 0.1],
|
|
1391
|
+
[i.left + 0.1, i.bottom - 0.1],
|
|
1392
|
+
[i.right - 0.1, i.bottom - 0.1]
|
|
1393
|
+
];
|
|
1394
|
+
for (const [c, l] of s) {
|
|
1395
|
+
if (n && (c < 0 || l < 0 || c > n.innerWidth || l > n.innerHeight))
|
|
1396
|
+
continue;
|
|
1397
|
+
o = !0;
|
|
1398
|
+
const d = r.elementFromPoint(c, l);
|
|
1399
|
+
if (d && (e.contains(d) || d.contains(e))) return !0;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
return !o;
|
|
1403
|
+
}
|
|
1404
|
+
function _n(e) {
|
|
1297
1405
|
return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? !e.checkValidity() || e.getAttribute("aria-invalid") === "true" : !1;
|
|
1298
1406
|
}
|
|
1299
|
-
function
|
|
1407
|
+
function Ot(e) {
|
|
1300
1408
|
return !(e instanceof HTMLInputElement) || e.closest('[role="combobox"]') === null || !(e.type === "hidden" || e.getAttribute("aria-hidden") === "true" || e.tabIndex === -1) ? !1 : e.required || e.getAttribute("aria-required") === "true" || (e.getAttribute("aria-describedby") || "").length > 0;
|
|
1301
1409
|
}
|
|
1302
|
-
function
|
|
1410
|
+
function wn(e) {
|
|
1303
1411
|
return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
|
|
1304
1412
|
}
|
|
1305
|
-
function
|
|
1413
|
+
function kn(e, r) {
|
|
1306
1414
|
var n, a, o, i;
|
|
1307
1415
|
if (e) {
|
|
1308
1416
|
const s = e.getAttribute("id");
|
|
1309
1417
|
if (s) {
|
|
1310
|
-
const u = document.querySelector(`label[for="${
|
|
1418
|
+
const u = document.querySelector(`label[for="${wn(s)}"]`);
|
|
1311
1419
|
if ((n = u == null ? void 0 : u.textContent) != null && n.trim()) return u.textContent.trim();
|
|
1312
1420
|
}
|
|
1313
1421
|
const c = e.closest("label");
|
|
@@ -1324,63 +1432,66 @@ function dn(e, r) {
|
|
|
1324
1432
|
}
|
|
1325
1433
|
return r;
|
|
1326
1434
|
}
|
|
1327
|
-
const
|
|
1435
|
+
const In = {
|
|
1328
1436
|
script: !0,
|
|
1329
1437
|
style: !0,
|
|
1330
1438
|
noscript: !0,
|
|
1331
1439
|
template: !0
|
|
1332
|
-
},
|
|
1440
|
+
}, vn = (e, r) => dn(e, r), En = (e, r) => {
|
|
1333
1441
|
var a;
|
|
1334
|
-
if (!
|
|
1442
|
+
if (!Ot(e)) return;
|
|
1335
1443
|
r.controlType = "validation-proxy", r.actionable = !1;
|
|
1336
1444
|
const n = (a = e.closest('[role="combobox"]')) == null ? void 0 : a.getAttribute("data-ref-id");
|
|
1337
1445
|
n && (r.forControl = n);
|
|
1338
|
-
},
|
|
1446
|
+
}, xn = (e, r) => {
|
|
1339
1447
|
if (r.controlType === "validation-proxy" || r.role !== "combobox" && r.tag !== "select") return;
|
|
1340
1448
|
r.controlType = "dropdown", r.recommendedAction = "select_option", r.controls = e.getAttribute("aria-controls") || e.getAttribute("aria-owns") || void 0;
|
|
1341
1449
|
const n = e.getAttribute("aria-expanded");
|
|
1342
1450
|
r.expanded = n === "true" ? !0 : n === "false" ? !1 : void 0;
|
|
1343
|
-
},
|
|
1451
|
+
}, Sn = (e, r) => {
|
|
1452
|
+
r.controlType || Fe(e) && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement || yn(e) && (r.actionable = !0, r.recommendedAction = "click", r.confidence = Nt(e).confidence));
|
|
1453
|
+
}, Tn = (e, r) => {
|
|
1344
1454
|
r.tag === "a" && (r.href = ve(e.getAttribute("href")));
|
|
1345
|
-
},
|
|
1455
|
+
}, Cn = (e, r) => {
|
|
1346
1456
|
r.tag === "img" && (r.src = ve(e.getAttribute("src")), r.alt = e.getAttribute("alt") || "");
|
|
1347
|
-
},
|
|
1457
|
+
}, Rn = (e, r) => {
|
|
1348
1458
|
var a;
|
|
1349
1459
|
if (r.tag !== "input") return;
|
|
1350
1460
|
const n = e;
|
|
1351
1461
|
r.title = e.getAttribute("title") || void 0, n.type === "file" && (r.accept = n.getAttribute("accept") || void 0, r.filesCount = ((a = n.files) == null ? void 0 : a.length) ?? 0);
|
|
1352
|
-
},
|
|
1353
|
-
r.tag !== "img" && r.tag !== "a" || (r.parentRefId =
|
|
1354
|
-
},
|
|
1462
|
+
}, An = (e, r) => {
|
|
1463
|
+
r.tag !== "img" && r.tag !== "a" || (r.parentRefId = pn(e) || r.parentRefId);
|
|
1464
|
+
}, Nn = (e, r) => {
|
|
1355
1465
|
r.postId = e.getAttribute("data-post-id") || void 0;
|
|
1356
|
-
},
|
|
1466
|
+
}, Mn = (e, r) => {
|
|
1357
1467
|
if (r.tag === "a") return;
|
|
1358
|
-
const n =
|
|
1468
|
+
const n = mn(e);
|
|
1359
1469
|
n && (r.permalink = ve(n.getAttribute("href")));
|
|
1360
|
-
},
|
|
1470
|
+
}, Dn = (e, r) => {
|
|
1361
1471
|
if (r.tag === "img") return;
|
|
1362
1472
|
const n = Array.from(e.querySelectorAll("img")).map((a) => ve(a.getAttribute("src"))).filter((a) => !!a);
|
|
1363
1473
|
n.length > 0 && (r.imageUrls = n);
|
|
1364
|
-
},
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1474
|
+
}, qn = (e, r) => [
|
|
1475
|
+
vn,
|
|
1476
|
+
En,
|
|
1477
|
+
xn,
|
|
1478
|
+
Sn,
|
|
1479
|
+
Tn,
|
|
1480
|
+
Cn,
|
|
1481
|
+
Rn,
|
|
1482
|
+
An,
|
|
1483
|
+
Nn,
|
|
1484
|
+
Mn,
|
|
1485
|
+
Dn
|
|
1486
|
+
].forEach((n) => n(e, r)), On = (e, r, n) => {
|
|
1376
1487
|
const a = {
|
|
1377
|
-
refId:
|
|
1488
|
+
refId: At(e),
|
|
1378
1489
|
role: X(e),
|
|
1379
1490
|
tag: e.tagName.toLowerCase(),
|
|
1380
|
-
text:
|
|
1491
|
+
text: Dt(e, 100)
|
|
1381
1492
|
}, o = Ee(e);
|
|
1382
|
-
return o && (a.name = o), (a.tag === "img" || a.tag === "a") && n && (a.parentRefId = n),
|
|
1383
|
-
},
|
|
1493
|
+
return o && (a.name = o), (a.tag === "img" || a.tag === "a") && n && (a.parentRefId = n), qn(e, a), a;
|
|
1494
|
+
}, Pn = (e, r) => {
|
|
1384
1495
|
var o, i, s, c, l, d;
|
|
1385
1496
|
const n = e.controlType === "dropdown" ? "dropdown" : e.controlType === "validation-proxy" ? "validation-proxy" : e.role, a = [
|
|
1386
1497
|
[e.name, `"${(o = e.name) == null ? void 0 : o.replace(/"/g, '\\"')}"`],
|
|
@@ -1395,6 +1506,7 @@ const un = {
|
|
|
1395
1506
|
[e.expanded !== void 0, `expanded=${e.expanded}`],
|
|
1396
1507
|
[e.controls, `opens="${(c = e.controls) == null ? void 0 : c.replace(/"/g, '\\"')}"`],
|
|
1397
1508
|
[e.recommendedAction, `use="${e.recommendedAction}"`],
|
|
1509
|
+
[e.confidence === "low", "confidence=low"],
|
|
1398
1510
|
[e.actionable === !1, "actionable=false"],
|
|
1399
1511
|
[e.forControl, `forControl="${e.forControl}"`],
|
|
1400
1512
|
[e.errorMessage, `error="${(l = e.errorMessage) == null ? void 0 : l.replace(/"/g, '\\"')}"`],
|
|
@@ -1407,30 +1519,29 @@ const un = {
|
|
|
1407
1519
|
`${" ".repeat(r)}- ${n}`,
|
|
1408
1520
|
...a.filter(([u]) => u).map(([, u]) => u)
|
|
1409
1521
|
].join(" ");
|
|
1410
|
-
},
|
|
1522
|
+
}, Ln = (e) => e.filter(
|
|
1411
1523
|
(r) => (r.invalid || r.errorMessage !== void 0 || r.validationMessage !== void 0) && r.controlType !== "validation-proxy"
|
|
1412
1524
|
).map((r) => ({
|
|
1413
|
-
field:
|
|
1525
|
+
field: kn(
|
|
1414
1526
|
document.querySelector(`[data-ref-id="${r.refId}"]`),
|
|
1415
1527
|
r.name || r.refId
|
|
1416
1528
|
),
|
|
1417
1529
|
error: r.errorMessage || r.validationMessage || "",
|
|
1418
1530
|
refId: r.refId
|
|
1419
|
-
})),
|
|
1531
|
+
})), jn = (...e) => (r) => e.reduce(
|
|
1420
1532
|
(n, a) => n.kind === "reject" ? n : a(n),
|
|
1421
1533
|
r
|
|
1422
|
-
),
|
|
1423
|
-
const r =
|
|
1534
|
+
), Hn = (e) => In[e.el.tagName.toLowerCase()] ? { kind: "reject", el: e.el, depth: e.depth } : e, Un = (e) => gn(e.el) ? e : { kind: "reject", el: e.el, depth: e.depth }, Fn = (e, r) => (n) => e >= r ? { kind: "reject", el: n.el, depth: n.depth } : n, Wn = (e) => {
|
|
1535
|
+
const r = On(e.el, e.depth, e.parentRefId);
|
|
1424
1536
|
return {
|
|
1425
1537
|
kind: "emit",
|
|
1426
1538
|
node: r,
|
|
1427
|
-
line: En(r, e.depth),
|
|
1428
1539
|
children: Array.from(e.el.children),
|
|
1429
1540
|
childDepth: e.depth + 1,
|
|
1430
1541
|
childRefId: r.refId
|
|
1431
1542
|
};
|
|
1432
|
-
},
|
|
1433
|
-
emitted: { node: e.node
|
|
1543
|
+
}, $n = (e) => e.kind === "emit" ? {
|
|
1544
|
+
emitted: { node: e.node },
|
|
1434
1545
|
children: e.children,
|
|
1435
1546
|
childDepth: e.childDepth,
|
|
1436
1547
|
childRefId: e.childRefId
|
|
@@ -1439,24 +1550,24 @@ const un = {
|
|
|
1439
1550
|
children: Array.from(e.el.children),
|
|
1440
1551
|
childDepth: e.depth,
|
|
1441
1552
|
childRefId: ""
|
|
1442
|
-
},
|
|
1443
|
-
const n = [], a = [], o =
|
|
1444
|
-
const
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
)({ kind: "enter", el:
|
|
1449
|
-
|
|
1553
|
+
}, Gn = (e, r) => {
|
|
1554
|
+
const n = [], a = [], o = [], i = (s, c, l) => {
|
|
1555
|
+
const u = jn(
|
|
1556
|
+
Hn,
|
|
1557
|
+
Un,
|
|
1558
|
+
Fn(n.length, r)
|
|
1559
|
+
)({ kind: "enter", el: s, depth: c, parentRefId: l }), b = $n(
|
|
1560
|
+
u.kind === "reject" ? u : Wn(u)
|
|
1450
1561
|
);
|
|
1451
|
-
|
|
1452
|
-
for (const h of
|
|
1562
|
+
b.emitted && (n.push(b.emitted.node), a.push(s), o.push(c));
|
|
1563
|
+
for (const h of b.children) {
|
|
1453
1564
|
if (n.length >= r) break;
|
|
1454
|
-
|
|
1565
|
+
i(h, b.childDepth, b.childRefId);
|
|
1455
1566
|
}
|
|
1456
1567
|
};
|
|
1457
|
-
return
|
|
1568
|
+
return i(e, 0, ""), { nodes: n, els: a, depths: o };
|
|
1458
1569
|
};
|
|
1459
|
-
function
|
|
1570
|
+
function Bn(e) {
|
|
1460
1571
|
let r = !1;
|
|
1461
1572
|
const n = typeof MutationObserver < "u" && document.body ? new MutationObserver(() => {
|
|
1462
1573
|
r = !0;
|
|
@@ -1478,28 +1589,37 @@ function Mn(e) {
|
|
|
1478
1589
|
});
|
|
1479
1590
|
}
|
|
1480
1591
|
}
|
|
1481
|
-
function
|
|
1482
|
-
return
|
|
1483
|
-
const { nodes: r,
|
|
1592
|
+
function Kn(e) {
|
|
1593
|
+
return Qr(), Bn(() => {
|
|
1594
|
+
const { nodes: r, els: n, depths: a } = document.body ? Gn(document.body, e) : { nodes: [], els: [], depths: [] }, o = [];
|
|
1595
|
+
for (let c = 0; c < r.length; c++)
|
|
1596
|
+
r[c].actionable && o.push({
|
|
1597
|
+
el: n[c],
|
|
1598
|
+
confidence: r[c].confidence ?? "high"
|
|
1599
|
+
});
|
|
1600
|
+
const i = on(o);
|
|
1601
|
+
for (let c = 0; c < r.length; c++)
|
|
1602
|
+
r[c].actionable && i.has(n[c]) && (r[c].actionable = !1, delete r[c].recommendedAction, delete r[c].confidence);
|
|
1603
|
+
const s = r.map((c, l) => Pn(c, a[l]));
|
|
1484
1604
|
return {
|
|
1485
1605
|
text: [
|
|
1486
1606
|
`URL: ${window.location.href}`,
|
|
1487
1607
|
`Title: ${document.title}`,
|
|
1488
1608
|
"",
|
|
1489
|
-
...
|
|
1609
|
+
...s
|
|
1490
1610
|
].join(`
|
|
1491
1611
|
`),
|
|
1492
1612
|
nodes: r,
|
|
1493
|
-
formErrors:
|
|
1613
|
+
formErrors: Ln(r),
|
|
1494
1614
|
url: window.location.href,
|
|
1495
1615
|
title: document.title,
|
|
1496
1616
|
viewport: { width: window.innerWidth, height: window.innerHeight }
|
|
1497
1617
|
};
|
|
1498
1618
|
});
|
|
1499
1619
|
}
|
|
1500
|
-
let
|
|
1501
|
-
function
|
|
1502
|
-
return
|
|
1620
|
+
let Ae = null;
|
|
1621
|
+
function Pt() {
|
|
1622
|
+
return Ae || (Ae = dr()), Ae ?? Promise.resolve();
|
|
1503
1623
|
}
|
|
1504
1624
|
async function xe(e) {
|
|
1505
1625
|
const r = f.child("runner");
|
|
@@ -1508,7 +1628,7 @@ async function xe(e) {
|
|
|
1508
1628
|
max_nodes: e == null ? void 0 : e.max_nodes
|
|
1509
1629
|
});
|
|
1510
1630
|
try {
|
|
1511
|
-
if (await
|
|
1631
|
+
if (await Pt(), typeof document > "u" || !document.body)
|
|
1512
1632
|
return {
|
|
1513
1633
|
ok: !1,
|
|
1514
1634
|
error: {
|
|
@@ -1519,7 +1639,7 @@ async function xe(e) {
|
|
|
1519
1639
|
};
|
|
1520
1640
|
const n = {};
|
|
1521
1641
|
e && (e.max_nodes != null && (n.maxNodes = Number(e.max_nodes)), e.interactive_only != null && (n.interactiveOnly = e.interactive_only));
|
|
1522
|
-
const a =
|
|
1642
|
+
const a = lr(n), o = nt(a, "compact-text");
|
|
1523
1643
|
return r.debug("handleDomSnapshot_result", { status: "ok" }), {
|
|
1524
1644
|
ok: !0,
|
|
1525
1645
|
value: { data: a, text: o }
|
|
@@ -1535,12 +1655,12 @@ async function xe(e) {
|
|
|
1535
1655
|
};
|
|
1536
1656
|
}
|
|
1537
1657
|
}
|
|
1538
|
-
async function
|
|
1658
|
+
async function Vn(e) {
|
|
1539
1659
|
const r = f.child("runner");
|
|
1540
1660
|
r.debug("handleDomFormat_start", { format: e.format });
|
|
1541
1661
|
try {
|
|
1542
|
-
await
|
|
1543
|
-
const { snapshot: n, format: a } = e, o =
|
|
1662
|
+
await Pt();
|
|
1663
|
+
const { snapshot: n, format: a } = e, o = nt(n, a);
|
|
1544
1664
|
return r.debug("handleDomFormat_result", { status: "ok" }), { ok: !0, value: o };
|
|
1545
1665
|
} catch (n) {
|
|
1546
1666
|
const a = n instanceof Error ? n.message : String(n);
|
|
@@ -1553,47 +1673,47 @@ async function On(e) {
|
|
|
1553
1673
|
};
|
|
1554
1674
|
}
|
|
1555
1675
|
}
|
|
1556
|
-
const
|
|
1557
|
-
function
|
|
1676
|
+
const Qe = 8 * 1024;
|
|
1677
|
+
function Zn(e) {
|
|
1558
1678
|
let r = "";
|
|
1559
|
-
for (let n = 0; n < e.length; n +=
|
|
1560
|
-
const a = e.subarray(n, n +
|
|
1679
|
+
for (let n = 0; n < e.length; n += Qe) {
|
|
1680
|
+
const a = e.subarray(n, n + Qe);
|
|
1561
1681
|
for (let o = 0; o < a.length; o++)
|
|
1562
1682
|
r += String.fromCharCode(a[o]);
|
|
1563
1683
|
}
|
|
1564
1684
|
return btoa(r);
|
|
1565
1685
|
}
|
|
1566
|
-
function
|
|
1686
|
+
function zn(e) {
|
|
1567
1687
|
return e.toLowerCase().split(";")[0].trim();
|
|
1568
1688
|
}
|
|
1569
|
-
function
|
|
1689
|
+
function Xn(e) {
|
|
1570
1690
|
return e.startsWith("image/") || e.startsWith("audio/") || e.startsWith("video/") || e === "application/octet-stream" || e === "application/pdf" || e === "application/zip" || e === "application/gzip" || e === "application/x-gzip" || e === "application/x-zip-compressed" ? !0 : e.startsWith("application/vnd.");
|
|
1571
1691
|
}
|
|
1572
|
-
function
|
|
1692
|
+
function Qn(e) {
|
|
1573
1693
|
for (let r = 0; r < e.length; r++)
|
|
1574
1694
|
if (e[r] === 0) return !0;
|
|
1575
1695
|
return !1;
|
|
1576
1696
|
}
|
|
1577
|
-
function
|
|
1697
|
+
function Lt(e) {
|
|
1578
1698
|
return Object.fromEntries(e.headers.entries());
|
|
1579
1699
|
}
|
|
1580
|
-
function
|
|
1700
|
+
function Je(e, r, n) {
|
|
1581
1701
|
return {
|
|
1582
1702
|
status: e.status,
|
|
1583
1703
|
ok: e.ok,
|
|
1584
|
-
headers:
|
|
1585
|
-
body:
|
|
1704
|
+
headers: Lt(e),
|
|
1705
|
+
body: Zn(r),
|
|
1586
1706
|
bodyEncoding: "base64",
|
|
1587
1707
|
byteLength: r.length,
|
|
1588
1708
|
contentType: n,
|
|
1589
1709
|
finalUrl: e.url
|
|
1590
1710
|
};
|
|
1591
1711
|
}
|
|
1592
|
-
function
|
|
1712
|
+
function Ye(e, r, n) {
|
|
1593
1713
|
return {
|
|
1594
1714
|
status: e.status,
|
|
1595
1715
|
ok: e.ok,
|
|
1596
|
-
headers:
|
|
1716
|
+
headers: Lt(e),
|
|
1597
1717
|
body: r,
|
|
1598
1718
|
bodyEncoding: "text",
|
|
1599
1719
|
byteLength: new TextEncoder().encode(r).length,
|
|
@@ -1601,29 +1721,29 @@ function Qe(e, r, n) {
|
|
|
1601
1721
|
finalUrl: e.url
|
|
1602
1722
|
};
|
|
1603
1723
|
}
|
|
1604
|
-
async function
|
|
1605
|
-
const r = e.headers.get("content-type") || "", n =
|
|
1606
|
-
if (
|
|
1724
|
+
async function Jn(e) {
|
|
1725
|
+
const r = e.headers.get("content-type") || "", n = zn(r);
|
|
1726
|
+
if (Xn(n)) {
|
|
1607
1727
|
const o = new Uint8Array(await e.arrayBuffer());
|
|
1608
|
-
return
|
|
1728
|
+
return Je(e, o, r);
|
|
1609
1729
|
}
|
|
1610
1730
|
if (!n || n.startsWith("text/")) {
|
|
1611
1731
|
const o = new Uint8Array(await e.arrayBuffer());
|
|
1612
|
-
if (
|
|
1613
|
-
return
|
|
1732
|
+
if (Qn(o))
|
|
1733
|
+
return Je(e, o, r);
|
|
1614
1734
|
const i = new TextDecoder().decode(o);
|
|
1615
|
-
return
|
|
1735
|
+
return Ye(e, i, r);
|
|
1616
1736
|
}
|
|
1617
1737
|
const a = await e.text();
|
|
1618
|
-
return
|
|
1738
|
+
return Ye(e, a, r);
|
|
1619
1739
|
}
|
|
1620
|
-
async function
|
|
1621
|
-
|
|
1740
|
+
async function Yn(e) {
|
|
1741
|
+
ee();
|
|
1622
1742
|
const { url: r, method: n, headers: a, body: o, timeout: i } = e;
|
|
1623
1743
|
try {
|
|
1624
1744
|
const s = new AbortController(), c = setTimeout(
|
|
1625
1745
|
() => s.abort(),
|
|
1626
|
-
Number(i) ??
|
|
1746
|
+
Number(i) ?? Q
|
|
1627
1747
|
), l = {
|
|
1628
1748
|
method: n || "GET",
|
|
1629
1749
|
headers: typeof a == "object" && a !== null ? a : {},
|
|
@@ -1631,7 +1751,7 @@ async function Fn(e) {
|
|
|
1631
1751
|
};
|
|
1632
1752
|
o != null && (l.body = typeof o == "string" ? o : String(o));
|
|
1633
1753
|
const d = await fetch(r, l);
|
|
1634
|
-
return clearTimeout(c), { ok: !0, value: await
|
|
1754
|
+
return clearTimeout(c), { ok: !0, value: await Jn(d) };
|
|
1635
1755
|
} catch (s) {
|
|
1636
1756
|
return s instanceof Error && s.name === "AbortError" ? {
|
|
1637
1757
|
ok: !1,
|
|
@@ -1658,7 +1778,7 @@ t.union([
|
|
|
1658
1778
|
t.number(),
|
|
1659
1779
|
t.record(t.unknown())
|
|
1660
1780
|
]);
|
|
1661
|
-
const
|
|
1781
|
+
const ea = t.union([
|
|
1662
1782
|
t.number(),
|
|
1663
1783
|
t.record(t.unknown())
|
|
1664
1784
|
]);
|
|
@@ -1760,14 +1880,14 @@ t.union([
|
|
|
1760
1880
|
t.record(t.unknown());
|
|
1761
1881
|
t.record(t.unknown());
|
|
1762
1882
|
t.record(t.unknown());
|
|
1763
|
-
const
|
|
1883
|
+
const ta = t.object({}), ra = t.union([
|
|
1764
1884
|
t.tuple([t.union([t.object({ text: t.string() }), t.string()])]),
|
|
1765
1885
|
t.object({ text: t.string().optional(), value: t.string().optional() })
|
|
1766
|
-
]), P = () => t.union([t.bigint(), t.number().finite()]).transform((e) => BigInt(e)), q = () => t.string().regex(/^(?:f\d+_)?e\d+$/),
|
|
1886
|
+
]), P = () => t.union([t.bigint(), t.number().finite()]).transform((e) => BigInt(e)), q = () => t.string().regex(/^(?:f\d+_)?e\d+$/), na = 'use { refId: "e2" } or { label: "..." } object form, not positional arguments', We = (e, r) => {
|
|
1767
1887
|
if (e.__invalidPositional !== void 0) {
|
|
1768
1888
|
r.addIssue({
|
|
1769
1889
|
code: t.ZodIssueCode.custom,
|
|
1770
|
-
message:
|
|
1890
|
+
message: na
|
|
1771
1891
|
});
|
|
1772
1892
|
return;
|
|
1773
1893
|
}
|
|
@@ -1775,8 +1895,8 @@ const Wn = t.object({}), Gn = t.union([
|
|
|
1775
1895
|
code: t.ZodIssueCode.custom,
|
|
1776
1896
|
message: "Either refId or label is required"
|
|
1777
1897
|
});
|
|
1778
|
-
},
|
|
1779
|
-
e.x !== void 0 || e.y !== void 0 ||
|
|
1898
|
+
}, jt = (e, r) => {
|
|
1899
|
+
e.x !== void 0 || e.y !== void 0 || We(e, r);
|
|
1780
1900
|
}, C = (e) => t.preprocess(
|
|
1781
1901
|
(r) => typeof r == "string" || typeof r == "number" ? { __invalidPositional: r } : r,
|
|
1782
1902
|
t.object({
|
|
@@ -1784,10 +1904,10 @@ const Wn = t.object({}), Gn = t.union([
|
|
|
1784
1904
|
refId: q().optional().describe("Element reference ID (e.g. e2)"),
|
|
1785
1905
|
label: t.string().optional().describe("Human-readable element label"),
|
|
1786
1906
|
...e
|
|
1787
|
-
}).superRefine(
|
|
1907
|
+
}).superRefine(We)
|
|
1788
1908
|
), re = {
|
|
1789
1909
|
tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID")
|
|
1790
|
-
},
|
|
1910
|
+
}, U = (e) => t.preprocess(
|
|
1791
1911
|
(r) => typeof r == "string" || typeof r == "number" ? { __invalidPositional: r } : r,
|
|
1792
1912
|
t.object({
|
|
1793
1913
|
__invalidPositional: t.union([t.string(), t.number()]).optional().describe("Internal flag for positional argument rejection"),
|
|
@@ -1795,7 +1915,7 @@ const Wn = t.object({}), Gn = t.union([
|
|
|
1795
1915
|
refId: q().optional().describe("Element reference ID (e.g. e2)"),
|
|
1796
1916
|
label: t.string().optional().describe("Human-readable element label"),
|
|
1797
1917
|
...e
|
|
1798
|
-
}).superRefine(
|
|
1918
|
+
}).superRefine(We)
|
|
1799
1919
|
);
|
|
1800
1920
|
t.object({
|
|
1801
1921
|
path: t.string().describe("File or directory path")
|
|
@@ -1822,17 +1942,17 @@ t.object({
|
|
|
1822
1942
|
path: t.string().describe("File path to hash"),
|
|
1823
1943
|
algo: t.string().default("sha256").describe("Hash algorithm (e.g. sha256, md5)")
|
|
1824
1944
|
});
|
|
1825
|
-
const
|
|
1945
|
+
const aa = t.object({
|
|
1826
1946
|
action: t.string().describe("Host action name"),
|
|
1827
1947
|
params: t.object({}).passthrough().optional().describe("Parameters for the host action")
|
|
1828
|
-
}).passthrough(),
|
|
1948
|
+
}).passthrough(), Ht = t.union([
|
|
1829
1949
|
t.string(),
|
|
1830
1950
|
t.number(),
|
|
1831
1951
|
t.boolean(),
|
|
1832
1952
|
t.null(),
|
|
1833
1953
|
t.array(t.unknown()),
|
|
1834
1954
|
t.record(t.unknown())
|
|
1835
|
-
]),
|
|
1955
|
+
]), oa = Ht, Ut = t.object({
|
|
1836
1956
|
url: t.string().describe("URL to fetch"),
|
|
1837
1957
|
method: t.string().default("GET").describe("HTTP method (GET, POST, PUT, DELETE, etc.)"),
|
|
1838
1958
|
headers: t.record(t.string()).default({}).describe("Request headers as key-value pairs"),
|
|
@@ -1842,30 +1962,30 @@ const Kn = t.object({
|
|
|
1842
1962
|
"When true, store binary responses as a handle instead of returning body bytes"
|
|
1843
1963
|
),
|
|
1844
1964
|
options: t.object({}).passthrough().optional().describe("Fetch options")
|
|
1845
|
-
}).passthrough(),
|
|
1965
|
+
}).passthrough(), ia = t.object({
|
|
1846
1966
|
duration: P().describe("Duration to sleep in milliseconds")
|
|
1847
|
-
}),
|
|
1967
|
+
}), sa = t.object({}), ca = t.object({}), la = t.object({
|
|
1848
1968
|
url: t.string().describe("URL to navigate to"),
|
|
1849
1969
|
timeout: P().optional().describe("Navigation timeout in milliseconds"),
|
|
1850
1970
|
waitUntil: t.enum(["load", "networkidle"]).optional().describe(
|
|
1851
1971
|
"When to consider navigation complete: 'load' (tab status complete) or 'networkidle' (no in-flight requests for 500ms)"
|
|
1852
1972
|
)
|
|
1853
|
-
}),
|
|
1973
|
+
}), da = t.object({}), ua = t.object({}), pa = t.object({}), ma = t.object({
|
|
1854
1974
|
duration: P().default(1000n).describe("Duration to wait in milliseconds")
|
|
1855
|
-
}),
|
|
1975
|
+
}), ba = C(), ha = (e, r) => {
|
|
1856
1976
|
[e.url, e.path, e.handle].filter(
|
|
1857
1977
|
(a) => typeof a == "string" && a.length > 0
|
|
1858
1978
|
).length !== 1 && r.addIssue({
|
|
1859
1979
|
code: t.ZodIssueCode.custom,
|
|
1860
1980
|
message: "Each file entry requires exactly one of url, path, or handle"
|
|
1861
1981
|
});
|
|
1862
|
-
},
|
|
1982
|
+
}, Ft = t.object({
|
|
1863
1983
|
name: t.string().optional().describe("File name including extension"),
|
|
1864
1984
|
mimeType: t.string().optional().describe("MIME type (defaults to application/octet-stream)"),
|
|
1865
1985
|
url: t.string().url().optional().describe("HTTP(S) URL to fetch in the target tab"),
|
|
1866
1986
|
path: t.string().min(1).optional().describe("Virtual filesystem path (resolved in worker)"),
|
|
1867
1987
|
handle: t.string().min(1).optional().describe("Binary handle from page.fetch({ store: true })")
|
|
1868
|
-
}).superRefine(
|
|
1988
|
+
}).superRefine(ha), Wt = t.discriminatedUnion("kind", [
|
|
1869
1989
|
t.object({
|
|
1870
1990
|
kind: t.literal("bytes"),
|
|
1871
1991
|
name: t.string().min(1),
|
|
@@ -1878,44 +1998,44 @@ const Kn = t.object({
|
|
|
1878
1998
|
name: t.string().min(1),
|
|
1879
1999
|
mimeType: t.string().optional()
|
|
1880
2000
|
})
|
|
1881
|
-
]),
|
|
2001
|
+
]), fa = C({
|
|
1882
2002
|
value: t.string().describe("Value to fill into the element")
|
|
1883
|
-
}),
|
|
1884
|
-
files: t.array(
|
|
2003
|
+
}), ga = C({
|
|
2004
|
+
files: t.array(Ft).min(1).describe("Files to attach to the input")
|
|
1885
2005
|
});
|
|
1886
2006
|
C({
|
|
1887
|
-
files: t.array(
|
|
2007
|
+
files: t.array(Wt).min(1).describe("Resolved files for content-script application")
|
|
1888
2008
|
});
|
|
1889
|
-
const
|
|
2009
|
+
const ya = C({
|
|
1890
2010
|
text: t.string().describe("Text to type into the element")
|
|
1891
|
-
}),
|
|
2011
|
+
}), _a = C({
|
|
1892
2012
|
text: t.string().describe("Text to append into the element")
|
|
1893
|
-
}),
|
|
2013
|
+
}), wa = t.object({
|
|
1894
2014
|
refId: q().optional().describe(
|
|
1895
2015
|
"Element reference ID to dispatch the key on (e.g. e2). Omit to dispatch on document."
|
|
1896
2016
|
),
|
|
1897
2017
|
label: t.string().optional().describe("Human-readable element label. Omit to dispatch on document."),
|
|
1898
2018
|
key: t.string().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
|
|
1899
|
-
}),
|
|
2019
|
+
}), ka = C({
|
|
1900
2020
|
value: t.union([
|
|
1901
2021
|
t.string().describe("Value to select in the dropdown"),
|
|
1902
2022
|
t.array(t.string()).describe(
|
|
1903
2023
|
"Values to select in a multiple dropdown (empty array clears selection)"
|
|
1904
2024
|
)
|
|
1905
2025
|
]).describe("Value (string) or values (array) to select in the dropdown")
|
|
1906
|
-
}),
|
|
2026
|
+
}), Ia = C({
|
|
1907
2027
|
value: t.string().describe(
|
|
1908
2028
|
"Visible text of the option to select (matched case-insensitively)"
|
|
1909
2029
|
)
|
|
1910
|
-
}),
|
|
2030
|
+
}), va = C({
|
|
1911
2031
|
checked: t.boolean().optional().describe("Desired checked state (true to check, false to uncheck)")
|
|
1912
|
-
}),
|
|
2032
|
+
}), Ea = t.object({
|
|
1913
2033
|
name: t.string().min(1).describe("The `name` attribute of the radio group to pick from"),
|
|
1914
2034
|
value: t.string().describe("The `value` of the radio option to check")
|
|
1915
|
-
}),
|
|
2035
|
+
}), xa = C(), Sa = t.object({}), Ta = C(), Ca = t.object({
|
|
1916
2036
|
direction: t.string().default("down").describe("Scroll direction: up, down, left, or right"),
|
|
1917
2037
|
amount: t.number().default(300).describe("Pixels to scroll")
|
|
1918
|
-
}),
|
|
2038
|
+
}), Ra = t.preprocess(
|
|
1919
2039
|
(e) => typeof e == "string" || typeof e == "number" ? { __invalidPositional: e } : e,
|
|
1920
2040
|
t.object({
|
|
1921
2041
|
__invalidPositional: t.union([t.string(), t.number()]).optional().describe("Internal flag for positional argument rejection"),
|
|
@@ -1923,28 +2043,28 @@ const ia = C({
|
|
|
1923
2043
|
label: t.string().optional().describe("Human-readable element label"),
|
|
1924
2044
|
x: t.number().optional().describe("X coordinate to scroll to"),
|
|
1925
2045
|
y: t.number().optional().describe("Y coordinate to scroll to")
|
|
1926
|
-
}).superRefine(
|
|
1927
|
-
),
|
|
2046
|
+
}).superRefine(jt)
|
|
2047
|
+
), Aa = C(), Na = t.object({
|
|
1928
2048
|
selector: t.string().describe("CSS selector to find elements")
|
|
1929
|
-
}),
|
|
2049
|
+
}), Ma = t.object({
|
|
1930
2050
|
selector: t.string().describe("CSS selector for the root element(s) to introspect"),
|
|
1931
2051
|
depth: t.number().int().min(0).max(10).default(2).describe("How many descendant levels to include (0 = root only)"),
|
|
1932
2052
|
includeHidden: t.boolean().default(!0).describe(
|
|
1933
2053
|
"Include elements hidden by CSS/aria (default true — this tool's purpose is to see what the curated snapshot filters out)"
|
|
1934
2054
|
)
|
|
1935
|
-
}),
|
|
2055
|
+
}), Da = t.object({
|
|
1936
2056
|
selector: t.string().describe("CSS selector to wait for"),
|
|
1937
2057
|
timeout: P().default(30000n).describe("Timeout in milliseconds")
|
|
1938
|
-
}),
|
|
2058
|
+
}), qa = t.object({
|
|
1939
2059
|
fields: t.array(t.string()).describe("Array of field names to extract")
|
|
1940
|
-
}),
|
|
2060
|
+
}), Oa = t.preprocess(
|
|
1941
2061
|
(e) => Array.isArray(e) ? { fields: e } : e,
|
|
1942
|
-
|
|
1943
|
-
),
|
|
2062
|
+
qa
|
|
2063
|
+
), Pa = t.union([
|
|
1944
2064
|
t.number(),
|
|
1945
2065
|
t.array(t.object({}).passthrough()),
|
|
1946
2066
|
t.object({}).passthrough()
|
|
1947
|
-
]),
|
|
2067
|
+
]), La = t.object({}), g = t.object({
|
|
1948
2068
|
ok: t.literal(!0).describe("Whether the action succeeded"),
|
|
1949
2069
|
action: t.string().describe("Action identifier (e.g. 'page_fill')"),
|
|
1950
2070
|
refId: q().optional().describe("Element reference ID that was acted upon (e.g. e2)"),
|
|
@@ -1994,7 +2114,7 @@ const ia = C({
|
|
|
1994
2114
|
)
|
|
1995
2115
|
});
|
|
1996
2116
|
t.union([g, t.null()]);
|
|
1997
|
-
const
|
|
2117
|
+
const $e = t.object({
|
|
1998
2118
|
status: t.number().describe("HTTP response status code"),
|
|
1999
2119
|
ok: t.boolean().describe("Whether the response status is 2xx"),
|
|
2000
2120
|
headers: t.record(t.string()).describe("Response headers as key-value pairs"),
|
|
@@ -2004,10 +2124,10 @@ const Fe = t.object({
|
|
|
2004
2124
|
byteLength: t.number().describe("Length of the body in bytes"),
|
|
2005
2125
|
contentType: t.string().describe("Response Content-Type header"),
|
|
2006
2126
|
finalUrl: t.string().describe("Final URL after redirects")
|
|
2007
|
-
}),
|
|
2127
|
+
}), $t = t.object({
|
|
2008
2128
|
data: t.object({}).passthrough().describe("Structured snapshot data"),
|
|
2009
2129
|
text: t.string().describe("Plain text representation of the snapshot")
|
|
2010
|
-
}),
|
|
2130
|
+
}), ja = t.object({}), Ha = t.object({
|
|
2011
2131
|
tabId: t.number(),
|
|
2012
2132
|
url: t.string(),
|
|
2013
2133
|
title: t.string(),
|
|
@@ -2016,7 +2136,7 @@ const Fe = t.object({
|
|
|
2016
2136
|
mutationsReady: t.boolean(),
|
|
2017
2137
|
hint: t.string().optional(),
|
|
2018
2138
|
recovery: t.array(t.string()).optional()
|
|
2019
|
-
}),
|
|
2139
|
+
}), Ua = Ht, Fa = t.object({
|
|
2020
2140
|
refId: q().describe("Element reference ID (e.g. e2)"),
|
|
2021
2141
|
role: t.string().describe("ARIA role of the element"),
|
|
2022
2142
|
tag: t.string().describe("HTML tag name"),
|
|
@@ -2052,7 +2172,7 @@ const Fe = t.object({
|
|
|
2052
2172
|
text: t.string().describe(
|
|
2053
2173
|
"Broad text-first representation of the page, including visible text, form values, and validation/error text"
|
|
2054
2174
|
),
|
|
2055
|
-
nodes: t.array(
|
|
2175
|
+
nodes: t.array(Fa).describe(
|
|
2056
2176
|
"Broad snapshot nodes with refIds where possible; not limited to interactive elements"
|
|
2057
2177
|
),
|
|
2058
2178
|
formErrors: t.array(
|
|
@@ -2071,7 +2191,7 @@ const Fe = t.object({
|
|
|
2071
2191
|
observationId: t.string().optional().describe(
|
|
2072
2192
|
"Opaque ID of the observation lease granted by this snapshot. Pass to subsequent actions to prove they act on fresh observations."
|
|
2073
2193
|
)
|
|
2074
|
-
}),
|
|
2194
|
+
}), Gt = t.object({
|
|
2075
2195
|
refId: q().optional(),
|
|
2076
2196
|
tag: t.string(),
|
|
2077
2197
|
role: t.string().optional(),
|
|
@@ -2101,9 +2221,9 @@ const Fe = t.object({
|
|
|
2101
2221
|
recommendedAction: t.string().optional(),
|
|
2102
2222
|
controls: t.string().optional(),
|
|
2103
2223
|
expanded: t.boolean().optional(),
|
|
2104
|
-
children: t.array(t.lazy(() =>
|
|
2105
|
-
}),
|
|
2106
|
-
nodes: t.array(
|
|
2224
|
+
children: t.array(t.lazy(() => Gt)).optional().describe("Nested descendants up to `depth`")
|
|
2225
|
+
}), Wa = t.object({
|
|
2226
|
+
nodes: t.array(Gt),
|
|
2107
2227
|
url: t.string(),
|
|
2108
2228
|
title: t.string()
|
|
2109
2229
|
}), N = t.object({
|
|
@@ -2142,7 +2262,7 @@ const Fe = t.object({
|
|
|
2142
2262
|
state: t.string().optional().describe("Window state"),
|
|
2143
2263
|
alwaysOnTop: t.boolean().optional().describe("Whether the window is always on top"),
|
|
2144
2264
|
sessionId: t.string().optional().describe("Session ID")
|
|
2145
|
-
}).passthrough(),
|
|
2265
|
+
}).passthrough(), $a = t.array(de), ue = t.object({
|
|
2146
2266
|
name: t.string().describe("Cookie name"),
|
|
2147
2267
|
value: t.string().describe("Cookie value"),
|
|
2148
2268
|
domain: t.string().optional().describe("Cookie domain"),
|
|
@@ -2154,9 +2274,9 @@ const Fe = t.object({
|
|
|
2154
2274
|
session: t.boolean().optional().describe("Whether the cookie is a session cookie"),
|
|
2155
2275
|
expirationDate: t.number().optional().describe("Expiration date as Unix timestamp"),
|
|
2156
2276
|
storeId: t.string().optional().describe("Store ID")
|
|
2157
|
-
}).nullable(),
|
|
2277
|
+
}).nullable(), Bt = t.array(
|
|
2158
2278
|
ue.nullable().unwrap()
|
|
2159
|
-
),
|
|
2279
|
+
), Ga = t.object({
|
|
2160
2280
|
id: t.string().describe("Bookmark ID"),
|
|
2161
2281
|
parentId: t.string().optional().describe("Parent folder ID"),
|
|
2162
2282
|
index: t.number().optional().describe("Bookmark index"),
|
|
@@ -2165,30 +2285,30 @@ const Fe = t.object({
|
|
|
2165
2285
|
dateAdded: t.number().optional().describe("Date added"),
|
|
2166
2286
|
dateGroupModified: t.number().optional().describe("Date group modified"),
|
|
2167
2287
|
children: t.array(t.object({ id: t.string() }).passthrough()).optional().describe("Child bookmarks")
|
|
2168
|
-
}).passthrough(), pe = t.array(
|
|
2288
|
+
}).passthrough(), pe = t.array(Ga), Ba = t.object({
|
|
2169
2289
|
id: t.string().describe("History item ID"),
|
|
2170
2290
|
url: t.string().optional().describe("URL"),
|
|
2171
2291
|
title: t.string().optional().describe("Title"),
|
|
2172
2292
|
lastVisitTime: t.number().optional().describe("Last visit time"),
|
|
2173
2293
|
visitCount: t.number().optional().describe("Visit count"),
|
|
2174
2294
|
typedCount: t.number().optional().describe("Typed count")
|
|
2175
|
-
}).passthrough(),
|
|
2295
|
+
}).passthrough(), Ge = t.array(Ba), Ka = t.object({
|
|
2176
2296
|
frameId: t.number().describe("Frame ID"),
|
|
2177
2297
|
result: t.unknown().optional().describe("Script result")
|
|
2178
|
-
}),
|
|
2298
|
+
}), Va = t.array(Ka), Kt = t.string(), Vt = t.boolean(), Za = t.union([t.string(), t.number()]), za = t.boolean(), Se = t.object({
|
|
2179
2299
|
id: t.number().optional().describe("Group ID"),
|
|
2180
2300
|
collapsed: t.boolean().optional().describe("Whether the group is collapsed"),
|
|
2181
2301
|
color: t.string().optional().describe("Group color"),
|
|
2182
2302
|
title: t.string().optional().describe("Group title"),
|
|
2183
2303
|
windowId: t.number().optional().describe("Window ID")
|
|
2184
|
-
}).passthrough(),
|
|
2304
|
+
}).passthrough(), Xa = t.array(Se), Qa = t.object({
|
|
2185
2305
|
lastModified: t.number().optional().describe("Last modified time"),
|
|
2186
2306
|
tab: N.optional().describe("Tab info"),
|
|
2187
2307
|
window: de.optional().describe("Window info")
|
|
2188
|
-
}).passthrough(),
|
|
2308
|
+
}).passthrough(), Be = t.array(Qa), Ja = t.object({
|
|
2189
2309
|
deviceName: t.string().optional().describe("Device name"),
|
|
2190
|
-
sessions:
|
|
2191
|
-
}).passthrough(),
|
|
2310
|
+
sessions: Be.optional().describe("Sessions")
|
|
2311
|
+
}).passthrough(), Ya = t.array(Ja), eo = t.object({
|
|
2192
2312
|
id: t.number().optional().describe("Download ID"),
|
|
2193
2313
|
url: t.string().optional().describe("Download URL"),
|
|
2194
2314
|
filename: t.string().optional().describe("Filename"),
|
|
@@ -2206,63 +2326,63 @@ const Fe = t.object({
|
|
|
2206
2326
|
referrer: t.string().optional().describe("Referrer URL"),
|
|
2207
2327
|
byExtensionId: t.string().optional().describe("Extension ID"),
|
|
2208
2328
|
byExtensionName: t.string().optional().describe("Extension name")
|
|
2209
|
-
}).passthrough(),
|
|
2329
|
+
}).passthrough(), Zt = t.array(eo), to = t.number(), ro = t.object({
|
|
2210
2330
|
archName: t.string().describe("CPU architecture"),
|
|
2211
2331
|
modelName: t.string().describe("CPU model"),
|
|
2212
2332
|
numOfProcessors: t.number().describe("Number of processors"),
|
|
2213
2333
|
features: t.array(t.string()).describe("CPU features")
|
|
2214
|
-
}),
|
|
2334
|
+
}), no = t.object({
|
|
2215
2335
|
capacity: t.number().describe("Total memory capacity"),
|
|
2216
2336
|
availableCapacity: t.number().describe("Available memory capacity")
|
|
2217
|
-
}),
|
|
2337
|
+
}), ao = t.array(
|
|
2218
2338
|
t.object({
|
|
2219
2339
|
id: t.string().describe("Storage ID"),
|
|
2220
2340
|
name: t.string().describe("Storage name"),
|
|
2221
2341
|
type: t.string().describe("Storage type"),
|
|
2222
2342
|
capacity: t.number().describe("Storage capacity")
|
|
2223
2343
|
})
|
|
2224
|
-
),
|
|
2344
|
+
), oo = C(), io = C(), so = C({
|
|
2225
2345
|
value: t.string().optional().describe("Value to fill into the element")
|
|
2226
|
-
}),
|
|
2346
|
+
}), co = C({
|
|
2227
2347
|
text: t.string().optional().describe("Text to type into the element")
|
|
2228
|
-
}),
|
|
2348
|
+
}), lo = t.object({
|
|
2229
2349
|
key: t.string().optional().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
|
|
2230
|
-
}),
|
|
2350
|
+
}), uo = C({
|
|
2231
2351
|
value: t.string().optional().describe("Value to select in the dropdown")
|
|
2232
|
-
}),
|
|
2352
|
+
}), po = C({
|
|
2233
2353
|
checked: t.boolean().optional().describe("Desired checked state (true to check, false to uncheck)")
|
|
2234
|
-
}),
|
|
2354
|
+
}), mo = C(), bo = t.object({}), ho = t.object({
|
|
2235
2355
|
direction: t.string().optional().describe("Scroll direction: up, down, left, or right"),
|
|
2236
2356
|
amount: t.number().optional().describe("Pixels to scroll")
|
|
2237
|
-
}),
|
|
2357
|
+
}), fo = C(), go = C({
|
|
2238
2358
|
text: t.string().optional().describe("Text to append into the element")
|
|
2239
|
-
}),
|
|
2359
|
+
}), yo = t.object({}), _o = t.object({}), wo = t.object({
|
|
2240
2360
|
duration: P().default(1000n).describe("Duration to wait in milliseconds")
|
|
2241
|
-
}),
|
|
2361
|
+
}), ko = t.object({
|
|
2242
2362
|
interactive_only: t.boolean().default(!1).describe("Only include interactive elements"),
|
|
2243
2363
|
max_nodes: P().default(500n).describe("Maximum number of nodes to include in snapshot")
|
|
2244
|
-
}),
|
|
2364
|
+
}), Io = t.object({
|
|
2245
2365
|
interactive_only: t.boolean().default(!1).describe("Only include interactive elements"),
|
|
2246
2366
|
max_nodes: P().default(500n).describe("Maximum number of nodes to include in snapshot")
|
|
2247
|
-
}),
|
|
2367
|
+
}), vo = t.object({
|
|
2248
2368
|
interactive_only: t.boolean().default(!1).describe("Only include interactive elements"),
|
|
2249
2369
|
max_nodes: P().default(500n).describe("Maximum number of nodes to include in snapshot")
|
|
2250
|
-
}),
|
|
2370
|
+
}), Eo = t.object({
|
|
2251
2371
|
interactive_only: t.boolean().default(!1).describe("Only include interactive elements"),
|
|
2252
2372
|
max_nodes: P().default(500n).describe("Maximum number of nodes to include in snapshot")
|
|
2253
|
-
}),
|
|
2373
|
+
}), xo = t.object({
|
|
2254
2374
|
snapshot: t.object({}).passthrough().describe("Raw DOM snapshot data to format"),
|
|
2255
2375
|
format: t.string().optional().describe("Output format (e.g. markdown, html)")
|
|
2256
|
-
}),
|
|
2376
|
+
}), So = t.object({
|
|
2257
2377
|
max_nodes: t.number().optional().describe("Maximum nodes to include"),
|
|
2258
2378
|
options: t.object({}).passthrough().optional().describe("Snapshot options")
|
|
2259
|
-
}).passthrough(),
|
|
2379
|
+
}).passthrough(), To = t.object({
|
|
2260
2380
|
max_nodes: t.number().optional().describe("Maximum nodes to include"),
|
|
2261
2381
|
options: t.object({}).passthrough().optional().describe("Snapshot options")
|
|
2262
|
-
}).passthrough(),
|
|
2382
|
+
}).passthrough(), Co = t.object({
|
|
2263
2383
|
max_nodes: t.number().optional().describe("Maximum nodes to include"),
|
|
2264
2384
|
options: t.object({}).passthrough().optional().describe("Snapshot options")
|
|
2265
|
-
}).passthrough(),
|
|
2385
|
+
}).passthrough(), Ro = t.object({
|
|
2266
2386
|
role: t.union([t.string(), t.array(t.string())]).optional().describe("Filter by ARIA role"),
|
|
2267
2387
|
tag: t.union([t.string(), t.array(t.string())]).optional().describe("Filter by HTML tag"),
|
|
2268
2388
|
text: t.string().optional().describe("Filter by text content (case-insensitive substring)"),
|
|
@@ -2271,44 +2391,45 @@ const Fe = t.object({
|
|
|
2271
2391
|
href: t.string().optional().describe("Filter by href pattern (case-insensitive substring)"),
|
|
2272
2392
|
src: t.string().optional().describe("Filter by src pattern (case-insensitive substring)"),
|
|
2273
2393
|
limit: t.number().positive().optional().describe("Maximum filtered nodes to return")
|
|
2274
|
-
}).passthrough(),
|
|
2275
|
-
filter:
|
|
2394
|
+
}).passthrough(), zt = t.object({
|
|
2395
|
+
filter: Ro.optional().describe(
|
|
2276
2396
|
"Semantic filter criteria"
|
|
2277
2397
|
),
|
|
2278
2398
|
max_nodes: t.number().optional().describe("Maximum nodes to collect before filtering")
|
|
2279
|
-
}).passthrough(),
|
|
2399
|
+
}).passthrough(), Ao = zt.extend({
|
|
2280
2400
|
tabId: t.number().describe("Tab ID")
|
|
2281
|
-
}),
|
|
2401
|
+
}), No = t.object({
|
|
2282
2402
|
key: t.string().describe("Storage key to retrieve")
|
|
2283
|
-
}),
|
|
2403
|
+
}), Mo = t.object({
|
|
2284
2404
|
key: t.string().describe("Storage key to set"),
|
|
2285
2405
|
value: t.string().describe("Value to store")
|
|
2286
|
-
}),
|
|
2406
|
+
}), Do = t.object({
|
|
2287
2407
|
key: t.string().describe("Storage key to delete")
|
|
2288
|
-
}),
|
|
2408
|
+
}), qo = t.object({}), Oo = t.object({
|
|
2289
2409
|
items: t.record(t.string()).describe("Record of key-value string pairs to store")
|
|
2290
|
-
}),
|
|
2410
|
+
}), Po = t.preprocess((e) => e !== null && typeof e == "object" && !Array.isArray(e) && !("items" in e) ? { items: e } : e, Oo), Lo = t.object({
|
|
2291
2411
|
keys: t.array(t.string()).describe("Array of storage keys to retrieve"),
|
|
2292
2412
|
defaults: t.record(t.string()).optional().describe("Default string values for missing keys")
|
|
2293
|
-
}),
|
|
2413
|
+
}), jo = t.preprocess(
|
|
2294
2414
|
(e) => Array.isArray(e) ? { keys: e } : e,
|
|
2295
|
-
|
|
2296
|
-
),
|
|
2415
|
+
Lo
|
|
2416
|
+
), Ho = t.object({}), Uo = t.object({
|
|
2297
2417
|
keys: t.array(t.string()).describe("Array of storage keys to delete")
|
|
2298
|
-
}),
|
|
2418
|
+
}), Fo = t.preprocess(
|
|
2299
2419
|
(e) => Array.isArray(e) ? { keys: e } : e,
|
|
2300
|
-
|
|
2301
|
-
),
|
|
2420
|
+
Uo
|
|
2421
|
+
), Wo = t.object({}), $o = t.object({
|
|
2302
2422
|
active: t.boolean().optional().describe("Whether the tabs are active"),
|
|
2303
2423
|
currentWindow: t.boolean().optional().describe("Whether the tabs are in the current window"),
|
|
2304
2424
|
url: t.string().optional().describe("URL pattern to match tabs against")
|
|
2305
|
-
}).passthrough(),
|
|
2425
|
+
}).passthrough(), Ke = $o, Xt = t.preprocess(
|
|
2306
2426
|
(e) => typeof e == "string" ? { url: e } : e,
|
|
2307
2427
|
t.object({
|
|
2308
2428
|
url: t.string().optional().describe("URL to open in the new tab"),
|
|
2309
|
-
active: t.boolean().optional().describe("Whether to focus the new tab")
|
|
2429
|
+
active: t.boolean().optional().describe("Whether to focus the new tab"),
|
|
2430
|
+
waitForReady: t.boolean().optional().describe("Wait for page load and content-script readiness")
|
|
2310
2431
|
})
|
|
2311
|
-
),
|
|
2432
|
+
), Qt = t.union([
|
|
2312
2433
|
t.number(),
|
|
2313
2434
|
t.array(
|
|
2314
2435
|
t.object({
|
|
@@ -2322,15 +2443,15 @@ const Fe = t.object({
|
|
|
2322
2443
|
tabId: t.number().optional(),
|
|
2323
2444
|
tab_id: t.number().optional()
|
|
2324
2445
|
}).passthrough()
|
|
2325
|
-
]),
|
|
2446
|
+
]), Jt = Qt, Go = Qt, Bo = U(), Ko = U({
|
|
2326
2447
|
value: t.string().describe("Value to fill into the element")
|
|
2327
|
-
}),
|
|
2328
|
-
files: t.array(
|
|
2448
|
+
}), Vo = U({
|
|
2449
|
+
files: t.array(Ft).min(1).describe("Files to attach to the input")
|
|
2329
2450
|
});
|
|
2330
|
-
|
|
2331
|
-
files: t.array(
|
|
2451
|
+
U({
|
|
2452
|
+
files: t.array(Wt).min(1).describe("Resolved files for content-script application")
|
|
2332
2453
|
});
|
|
2333
|
-
const
|
|
2454
|
+
const Zo = t.preprocess(
|
|
2334
2455
|
(e) => typeof e == "string" || typeof e == "number" ? { __invalidPositional: e } : e,
|
|
2335
2456
|
t.object({
|
|
2336
2457
|
__invalidPositional: t.union([t.string(), t.number()]).optional().describe("Internal flag for positional argument rejection"),
|
|
@@ -2339,59 +2460,59 @@ const Po = t.preprocess(
|
|
|
2339
2460
|
label: t.string().optional().describe("Human-readable element label"),
|
|
2340
2461
|
x: t.number().optional().describe("X coordinate to scroll to"),
|
|
2341
2462
|
y: t.number().optional().describe("Y coordinate to scroll to")
|
|
2342
|
-
}).superRefine(
|
|
2343
|
-
),
|
|
2463
|
+
}).superRefine(jt)
|
|
2464
|
+
), zo = U({
|
|
2344
2465
|
text: t.string().describe("Text to type into the element")
|
|
2345
|
-
}),
|
|
2466
|
+
}), Xo = t.object({
|
|
2346
2467
|
...re,
|
|
2347
2468
|
key: t.string().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
|
|
2348
|
-
}),
|
|
2469
|
+
}), Qo = U({
|
|
2349
2470
|
value: t.string().describe("Value to select in the dropdown")
|
|
2350
|
-
}),
|
|
2471
|
+
}), Jo = U({
|
|
2351
2472
|
value: t.string().describe(
|
|
2352
2473
|
"Visible text of the option to select (matched case-insensitively)"
|
|
2353
2474
|
)
|
|
2354
|
-
}),
|
|
2475
|
+
}), Yo = U({
|
|
2355
2476
|
checked: t.boolean().optional().describe("Desired checked state (true to check, false to uncheck)")
|
|
2356
|
-
}),
|
|
2477
|
+
}), ei = U(), ti = U(), ri = t.object({
|
|
2357
2478
|
...re,
|
|
2358
2479
|
name: t.string().min(1).describe("The `name` attribute of the radio group to pick from"),
|
|
2359
2480
|
value: t.string().describe("The `value` of the radio option to check")
|
|
2360
|
-
}),
|
|
2481
|
+
}), ni = t.object({
|
|
2361
2482
|
...re
|
|
2362
|
-
}),
|
|
2483
|
+
}), ai = t.object({
|
|
2363
2484
|
...re,
|
|
2364
2485
|
direction: t.string().default("down").describe("Scroll direction: up, down, left, or right"),
|
|
2365
2486
|
amount: t.number().default(300).describe("Pixels to scroll")
|
|
2366
|
-
}),
|
|
2487
|
+
}), oi = U(), ii = t.object({
|
|
2367
2488
|
tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
|
|
2368
2489
|
script: t.string().optional().describe("Script to evaluate"),
|
|
2369
2490
|
code: t.string().optional().describe("Alternative script code"),
|
|
2370
2491
|
js: t.string().optional().describe("Alternative JS code")
|
|
2371
|
-
}).passthrough(),
|
|
2492
|
+
}).passthrough(), si = t.object({
|
|
2372
2493
|
tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID")
|
|
2373
|
-
}).passthrough(),
|
|
2494
|
+
}).passthrough(), ci = t.object({
|
|
2374
2495
|
tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID")
|
|
2375
|
-
}).passthrough(),
|
|
2496
|
+
}).passthrough(), li = t.object({
|
|
2376
2497
|
tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
|
|
2377
2498
|
timeout: t.number().optional().describe("Timeout in milliseconds")
|
|
2378
|
-
}).passthrough(),
|
|
2499
|
+
}).passthrough(), di = t.object({
|
|
2379
2500
|
tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
|
|
2380
2501
|
url: t.string().optional().describe("URL to fetch"),
|
|
2381
2502
|
options: t.object({}).passthrough().optional().describe("Fetch options")
|
|
2382
|
-
}).passthrough(),
|
|
2503
|
+
}).passthrough(), ui = t.object({
|
|
2383
2504
|
tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
|
|
2384
2505
|
max_nodes: t.number().optional().describe("Maximum nodes to include"),
|
|
2385
2506
|
options: t.object({}).passthrough().optional().describe("Snapshot options")
|
|
2386
|
-
}).passthrough(),
|
|
2507
|
+
}).passthrough(), pi = t.object({
|
|
2387
2508
|
tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
|
|
2388
2509
|
max_nodes: t.number().optional().describe("Maximum nodes to include"),
|
|
2389
2510
|
options: t.object({}).passthrough().optional().describe("Snapshot options")
|
|
2390
|
-
}).passthrough(),
|
|
2511
|
+
}).passthrough(), mi = t.object({
|
|
2391
2512
|
tabId: t.union([t.number(), t.bigint()]).optional().describe("Target tab ID"),
|
|
2392
2513
|
max_nodes: t.number().optional().describe("Maximum nodes to include"),
|
|
2393
2514
|
options: t.object({}).passthrough().optional().describe("Snapshot options")
|
|
2394
|
-
}).passthrough(),
|
|
2515
|
+
}).passthrough(), bi = t.object({
|
|
2395
2516
|
...re,
|
|
2396
2517
|
url: t.string().describe("URL to navigate the tab to"),
|
|
2397
2518
|
timeout: P().optional().describe("Navigation timeout in milliseconds"),
|
|
@@ -2402,19 +2523,19 @@ const Po = t.preprocess(
|
|
|
2402
2523
|
function B(e) {
|
|
2403
2524
|
return document.querySelector(`[data-ref-id='${CSS.escape(e)}']`);
|
|
2404
2525
|
}
|
|
2405
|
-
function
|
|
2526
|
+
function hi(e) {
|
|
2406
2527
|
if (typeof e == "string")
|
|
2407
2528
|
return q().safeParse(e).success ? e : void 0;
|
|
2408
|
-
const r =
|
|
2529
|
+
const r = H(e), n = typeof r.refId == "string" ? r.refId : typeof r.ref_id == "string" ? r.ref_id : void 0;
|
|
2409
2530
|
if (!(n && !q().safeParse(n).success))
|
|
2410
2531
|
return n;
|
|
2411
2532
|
}
|
|
2412
|
-
const
|
|
2533
|
+
const fi = {
|
|
2413
2534
|
message: "Content script error",
|
|
2414
2535
|
code: "E_CONTENT_SCRIPT",
|
|
2415
2536
|
category: "resource"
|
|
2416
2537
|
};
|
|
2417
|
-
function
|
|
2538
|
+
function gi(e, r = fi) {
|
|
2418
2539
|
if (typeof e == "string")
|
|
2419
2540
|
return {
|
|
2420
2541
|
message: e || r.message,
|
|
@@ -2434,13 +2555,13 @@ function oi(e, r = ai) {
|
|
|
2434
2555
|
}
|
|
2435
2556
|
return { ...r };
|
|
2436
2557
|
}
|
|
2437
|
-
function
|
|
2558
|
+
function Ve(e) {
|
|
2438
2559
|
return e && typeof e == "object" && e.ok === !1 ? {
|
|
2439
2560
|
ok: !1,
|
|
2440
|
-
error:
|
|
2561
|
+
error: gi(e.error)
|
|
2441
2562
|
} : { ok: !0, value: e && typeof e == "object" && "value" in e ? e.value : e };
|
|
2442
2563
|
}
|
|
2443
|
-
const se = f.child("runner"),
|
|
2564
|
+
const se = f.child("runner"), yi = [
|
|
2444
2565
|
"main_frame",
|
|
2445
2566
|
"sub_frame",
|
|
2446
2567
|
"stylesheet",
|
|
@@ -2450,12 +2571,12 @@ const se = f.child("runner"), ii = [
|
|
|
2450
2571
|
"media",
|
|
2451
2572
|
"other"
|
|
2452
2573
|
];
|
|
2453
|
-
class
|
|
2574
|
+
class _i {
|
|
2454
2575
|
constructor(r) {
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2576
|
+
L(this, "inFlight", /* @__PURE__ */ new Map());
|
|
2577
|
+
L(this, "onBeforeRequest", null);
|
|
2578
|
+
L(this, "onCompleted", null);
|
|
2579
|
+
L(this, "onErrorOccurred", null);
|
|
2459
2580
|
this.tabId = r;
|
|
2460
2581
|
}
|
|
2461
2582
|
start() {
|
|
@@ -2468,7 +2589,7 @@ class si {
|
|
|
2468
2589
|
const n = {
|
|
2469
2590
|
tabId: this.tabId,
|
|
2470
2591
|
urls: ["<all_urls>"],
|
|
2471
|
-
types:
|
|
2592
|
+
types: yi
|
|
2472
2593
|
};
|
|
2473
2594
|
this.onBeforeRequest = (o) => {
|
|
2474
2595
|
o.tabId === this.tabId && this.inFlight.set(o.requestId, Date.now());
|
|
@@ -2487,7 +2608,7 @@ class si {
|
|
|
2487
2608
|
for (; Date.now() < a; ) {
|
|
2488
2609
|
if (this.inFlight.size === 0) {
|
|
2489
2610
|
if (await new Promise(
|
|
2490
|
-
(s) => setTimeout(s,
|
|
2611
|
+
(s) => setTimeout(s, Ct)
|
|
2491
2612
|
), this.inFlight.size === 0) {
|
|
2492
2613
|
se.debug("networkTracker_idle", { tabId: this.tabId, traceId: n });
|
|
2493
2614
|
return;
|
|
@@ -2511,12 +2632,12 @@ class si {
|
|
|
2511
2632
|
r && (this.onBeforeRequest && r.onBeforeRequest.removeListener(this.onBeforeRequest), this.onCompleted && r.onCompleted.removeListener(this.onCompleted), this.onErrorOccurred && r.onErrorOccurred.removeListener(this.onErrorOccurred), this.onBeforeRequest = null, this.onCompleted = null, this.onErrorOccurred = null, this.inFlight.clear(), se.debug("networkTracker_disposed", { tabId: this.tabId }));
|
|
2512
2633
|
}
|
|
2513
2634
|
}
|
|
2514
|
-
function
|
|
2635
|
+
function wi(e) {
|
|
2515
2636
|
return new Promise((r) => setTimeout(r, e));
|
|
2516
2637
|
}
|
|
2517
|
-
async function
|
|
2638
|
+
async function Yt(e) {
|
|
2518
2639
|
var n;
|
|
2519
|
-
|
|
2640
|
+
ee();
|
|
2520
2641
|
const r = window.chrome;
|
|
2521
2642
|
if (!((n = r == null ? void 0 : r.tabs) != null && n.get)) return null;
|
|
2522
2643
|
try {
|
|
@@ -2533,9 +2654,9 @@ async function Xt(e) {
|
|
|
2533
2654
|
return ke(a);
|
|
2534
2655
|
}
|
|
2535
2656
|
}
|
|
2536
|
-
async function
|
|
2657
|
+
async function Te(e, r = 3e3) {
|
|
2537
2658
|
var c;
|
|
2538
|
-
|
|
2659
|
+
ee();
|
|
2539
2660
|
const n = f.child("runner");
|
|
2540
2661
|
n.debug("pingTabContentScript_start", { tabId: e, timeout: r });
|
|
2541
2662
|
const a = window.chrome;
|
|
@@ -2551,19 +2672,19 @@ async function Ke(e, r = 3e3) {
|
|
|
2551
2672
|
const o = Date.now() + r;
|
|
2552
2673
|
let i = "";
|
|
2553
2674
|
for (; Date.now() < o; ) {
|
|
2554
|
-
|
|
2675
|
+
ee();
|
|
2555
2676
|
const l = o - Date.now();
|
|
2556
2677
|
if (l <= 0) break;
|
|
2557
2678
|
try {
|
|
2558
2679
|
const d = await Promise.race([
|
|
2559
2680
|
a.tabs.sendMessage(e, { action: "ping" }),
|
|
2560
2681
|
new Promise(
|
|
2561
|
-
(
|
|
2562
|
-
() =>
|
|
2682
|
+
(b, h) => setTimeout(
|
|
2683
|
+
() => h(new Error("Timeout waiting for content-script ping")),
|
|
2563
2684
|
l
|
|
2564
2685
|
)
|
|
2565
2686
|
)
|
|
2566
|
-
]), u =
|
|
2687
|
+
]), u = Ve(d);
|
|
2567
2688
|
return u.ok ? (n.debug("pingTabContentScript_success", { tabId: e, result: d }), { ok: !0, value: { ok: !0 } }) : (n.debug("pingTabContentScript_rejected", {
|
|
2568
2689
|
tabId: e,
|
|
2569
2690
|
error: u.error
|
|
@@ -2571,7 +2692,7 @@ async function Ke(e, r = 3e3) {
|
|
|
2571
2692
|
} catch (d) {
|
|
2572
2693
|
const u = (d instanceof Error ? d.message : String(d)) || "";
|
|
2573
2694
|
if (i = u, n.debug("pingTabContentScript_retry", { tabId: e, error: u }), u.includes("Could not establish connection") || u.includes("Receiving end does not exist") || u.includes("message port closed before a response was received")) {
|
|
2574
|
-
await
|
|
2695
|
+
await wi(Math.min(jr, o - Date.now()));
|
|
2575
2696
|
continue;
|
|
2576
2697
|
}
|
|
2577
2698
|
if (u.includes("Timeout waiting for content-script ping"))
|
|
@@ -2590,9 +2711,9 @@ async function Ke(e, r = 3e3) {
|
|
|
2590
2711
|
error: ge(e, s)
|
|
2591
2712
|
};
|
|
2592
2713
|
}
|
|
2593
|
-
async function
|
|
2594
|
-
var
|
|
2595
|
-
|
|
2714
|
+
async function er(e, r = 3e4, n) {
|
|
2715
|
+
var b;
|
|
2716
|
+
ee();
|
|
2596
2717
|
const a = f.child("runner"), o = typeof e == "number" ? e : null, i = n == null ? void 0 : n.preNavigationUrl, s = n == null ? void 0 : n.getNavSawLoading;
|
|
2597
2718
|
a.debug("waitForTabLoad_start", {
|
|
2598
2719
|
tabId: o,
|
|
@@ -2601,7 +2722,7 @@ async function Qt(e, r = 3e4, n) {
|
|
|
2601
2722
|
runId: n == null ? void 0 : n.runId
|
|
2602
2723
|
});
|
|
2603
2724
|
const c = window.chrome;
|
|
2604
|
-
if (!((
|
|
2725
|
+
if (!((b = c == null ? void 0 : c.runtime) != null && b.id))
|
|
2605
2726
|
return {
|
|
2606
2727
|
ok: !1,
|
|
2607
2728
|
error: {
|
|
@@ -2618,41 +2739,41 @@ async function Qt(e, r = 3e4, n) {
|
|
|
2618
2739
|
code: "E_MISSING_PARAM"
|
|
2619
2740
|
}
|
|
2620
2741
|
};
|
|
2621
|
-
const l = (
|
|
2622
|
-
if (
|
|
2742
|
+
const l = (h, S) => {
|
|
2743
|
+
if (h.status !== "complete") return !1;
|
|
2623
2744
|
if (i === void 0) return !0;
|
|
2624
|
-
const I =
|
|
2745
|
+
const I = h.url !== i;
|
|
2625
2746
|
return S || I;
|
|
2626
|
-
}, d = (
|
|
2747
|
+
}, d = (h) => i !== void 0 && typeof h == "string" && h.length > 0 && h !== i, u = (n == null ? void 0 : n.loadGraceMs) ?? 5e3;
|
|
2627
2748
|
try {
|
|
2628
|
-
return await new Promise((
|
|
2629
|
-
let I = !1, A = (s == null ? void 0 : s()) ?? !1,
|
|
2630
|
-
const
|
|
2749
|
+
return await new Promise((h, S) => {
|
|
2750
|
+
let I = !1, A = (s == null ? void 0 : s()) ?? !1, D = null;
|
|
2751
|
+
const Y = () => {
|
|
2631
2752
|
try {
|
|
2632
|
-
c.tabs.onUpdated.removeListener(
|
|
2753
|
+
c.tabs.onUpdated.removeListener(ze);
|
|
2633
2754
|
} catch {
|
|
2634
2755
|
}
|
|
2635
|
-
|
|
2636
|
-
},
|
|
2637
|
-
I || (I = !0,
|
|
2756
|
+
D && clearTimeout(D);
|
|
2757
|
+
}, W = (M) => {
|
|
2758
|
+
I || (I = !0, Y(), M());
|
|
2638
2759
|
}, R = () => {
|
|
2639
2760
|
s != null && s() && (A = !0);
|
|
2640
|
-
}, _ = (
|
|
2641
|
-
|
|
2761
|
+
}, _ = (M) => {
|
|
2762
|
+
D || I || d(M) && (D = setTimeout(() => {
|
|
2642
2763
|
a.debug("waitForTabLoad_grace_settle", {
|
|
2643
2764
|
tabId: o,
|
|
2644
|
-
url:
|
|
2765
|
+
url: M,
|
|
2645
2766
|
graceMs: u,
|
|
2646
2767
|
runId: n == null ? void 0 : n.runId
|
|
2647
|
-
}),
|
|
2768
|
+
}), W(h);
|
|
2648
2769
|
}, u));
|
|
2649
2770
|
}, G = () => {
|
|
2650
|
-
R(), c.tabs.get(o).then((
|
|
2651
|
-
l(
|
|
2771
|
+
R(), c.tabs.get(o).then((M) => {
|
|
2772
|
+
l(M, A) ? W(h) : _(M.url);
|
|
2652
2773
|
}).catch(() => {
|
|
2653
2774
|
});
|
|
2654
|
-
},
|
|
2655
|
-
|
|
2775
|
+
}, ze = (M, oe) => {
|
|
2776
|
+
M === o && (oe.status === "loading" && (A = !0, a.debug("waitForTabLoad_status", {
|
|
2656
2777
|
tabId: o,
|
|
2657
2778
|
status: "loading",
|
|
2658
2779
|
runId: n == null ? void 0 : n.runId
|
|
@@ -2662,25 +2783,25 @@ async function Qt(e, r = 3e4, n) {
|
|
|
2662
2783
|
runId: n == null ? void 0 : n.runId
|
|
2663
2784
|
}), _(oe.url)), oe.status === "complete" && G());
|
|
2664
2785
|
};
|
|
2665
|
-
c.tabs.onUpdated.addListener(
|
|
2666
|
-
R(),
|
|
2786
|
+
c.tabs.onUpdated.addListener(ze), c.tabs.get(o).then((M) => {
|
|
2787
|
+
R(), M.status === "loading" && (A = !0), a.debug("waitForTabLoad_initial_status", {
|
|
2667
2788
|
tabId: o,
|
|
2668
|
-
status:
|
|
2669
|
-
url:
|
|
2789
|
+
status: M.status,
|
|
2790
|
+
url: M.url,
|
|
2670
2791
|
runId: n == null ? void 0 : n.runId
|
|
2671
|
-
}), l(
|
|
2672
|
-
}).catch((
|
|
2673
|
-
|
|
2792
|
+
}), l(M, A) ? W(h) : _(M.url);
|
|
2793
|
+
}).catch((M) => {
|
|
2794
|
+
W(() => S(M));
|
|
2674
2795
|
}), setTimeout(() => {
|
|
2675
|
-
|
|
2796
|
+
W(() => S(new Error("Timeout waiting for tab load")));
|
|
2676
2797
|
}, r);
|
|
2677
2798
|
}), a.debug("waitForTabLoad_loaded", {
|
|
2678
2799
|
tabId: o,
|
|
2679
2800
|
status: "complete",
|
|
2680
2801
|
runId: n == null ? void 0 : n.runId
|
|
2681
2802
|
}), { ok: !0, value: !0 };
|
|
2682
|
-
} catch (
|
|
2683
|
-
if (
|
|
2803
|
+
} catch (h) {
|
|
2804
|
+
if (h instanceof Error && h.message === "Timeout waiting for tab load") {
|
|
2684
2805
|
let S = "";
|
|
2685
2806
|
try {
|
|
2686
2807
|
S = (await c.tabs.get(o)).url || "";
|
|
@@ -2701,17 +2822,17 @@ async function Qt(e, r = 3e4, n) {
|
|
|
2701
2822
|
}
|
|
2702
2823
|
};
|
|
2703
2824
|
}
|
|
2704
|
-
return ke(
|
|
2825
|
+
return ke(h);
|
|
2705
2826
|
}
|
|
2706
2827
|
}
|
|
2707
|
-
async function
|
|
2708
|
-
var A,
|
|
2828
|
+
async function Ze(e) {
|
|
2829
|
+
var A, D, Y, W;
|
|
2709
2830
|
const {
|
|
2710
2831
|
tabId: r,
|
|
2711
2832
|
url: n,
|
|
2712
2833
|
preNavigationUrl: a,
|
|
2713
2834
|
waitUntil: o,
|
|
2714
|
-
timeoutMs: i =
|
|
2835
|
+
timeoutMs: i = Q,
|
|
2715
2836
|
traceId: s = "?",
|
|
2716
2837
|
logPrefix: c
|
|
2717
2838
|
} = e, l = window.chrome;
|
|
@@ -2719,28 +2840,28 @@ async function Jt(e) {
|
|
|
2719
2840
|
const u = (R, _) => {
|
|
2720
2841
|
R === r && _.status === "loading" && (d = !0);
|
|
2721
2842
|
};
|
|
2722
|
-
(
|
|
2843
|
+
(D = (A = l == null ? void 0 : l.tabs) == null ? void 0 : A.onUpdated) == null || D.addListener(u);
|
|
2723
2844
|
try {
|
|
2724
2845
|
const R = await x("chrome_tabs_update", [
|
|
2725
2846
|
r,
|
|
2726
2847
|
{ url: n }
|
|
2727
2848
|
]);
|
|
2728
2849
|
if (!R.ok)
|
|
2729
|
-
return
|
|
2730
|
-
const _ = await
|
|
2850
|
+
return v(R);
|
|
2851
|
+
const _ = await er(r, i, {
|
|
2731
2852
|
preNavigationUrl: a,
|
|
2732
2853
|
getNavSawLoading: () => d,
|
|
2733
2854
|
runId: s
|
|
2734
2855
|
});
|
|
2735
2856
|
if (!_.ok)
|
|
2736
|
-
return
|
|
2857
|
+
return v(_);
|
|
2737
2858
|
f.debug(`${c}_tab_load_complete`, { traceId: s, tabId: r });
|
|
2738
2859
|
} finally {
|
|
2739
|
-
(
|
|
2860
|
+
(W = (Y = l == null ? void 0 : l.tabs) == null ? void 0 : Y.onUpdated) == null || W.removeListener(u);
|
|
2740
2861
|
}
|
|
2741
|
-
const
|
|
2742
|
-
if (
|
|
2743
|
-
const R = N.safeParse(
|
|
2862
|
+
const b = await x("chrome_tabs_get", [r]);
|
|
2863
|
+
if (b.ok && b.value) {
|
|
2864
|
+
const R = N.safeParse(b.value);
|
|
2744
2865
|
if (R.success) {
|
|
2745
2866
|
const _ = R.data.url ?? "";
|
|
2746
2867
|
if (_ && !_.startsWith("http:") && !_.startsWith("https:"))
|
|
@@ -2758,10 +2879,10 @@ async function Jt(e) {
|
|
|
2758
2879
|
}
|
|
2759
2880
|
}
|
|
2760
2881
|
if (o === "networkidle") {
|
|
2761
|
-
const R = new
|
|
2882
|
+
const R = new _i(r);
|
|
2762
2883
|
try {
|
|
2763
2884
|
f.debug(`${c}_network_idle_start`, { traceId: s, tabId: r }), R.start();
|
|
2764
|
-
const _ = Math.max(
|
|
2885
|
+
const _ = Math.max(Ct * 2, i);
|
|
2765
2886
|
await R.waitForIdle(_, s);
|
|
2766
2887
|
} catch (_) {
|
|
2767
2888
|
throw f.debug(`${c}_network_idle_timeout`, {
|
|
@@ -2777,11 +2898,11 @@ async function Jt(e) {
|
|
|
2777
2898
|
R.dispose(), f.debug(`${c}_network_idle_done`, { traceId: s, tabId: r });
|
|
2778
2899
|
}
|
|
2779
2900
|
}
|
|
2780
|
-
const
|
|
2781
|
-
if (!
|
|
2782
|
-
return
|
|
2783
|
-
await new Promise((R) => setTimeout(R,
|
|
2784
|
-
const S = await x("chrome_tabs_get", [r]), I = N.safeParse(
|
|
2901
|
+
const h = await Te(r, i);
|
|
2902
|
+
if (!h.ok)
|
|
2903
|
+
return v(h);
|
|
2904
|
+
await new Promise((R) => setTimeout(R, Hr));
|
|
2905
|
+
const S = await x("chrome_tabs_get", [r]), I = N.safeParse(v(S));
|
|
2785
2906
|
if (!I.success)
|
|
2786
2907
|
throw y(
|
|
2787
2908
|
`Navigation completed but the resulting tab failed schema validation: ${I.error.message}`,
|
|
@@ -2795,7 +2916,7 @@ m({
|
|
|
2795
2916
|
namespace: "storage",
|
|
2796
2917
|
name: "get",
|
|
2797
2918
|
description: "Get a value from localStorage",
|
|
2798
|
-
params:
|
|
2919
|
+
params: No,
|
|
2799
2920
|
returns: t.string().nullable(),
|
|
2800
2921
|
fields: ["key"],
|
|
2801
2922
|
aliases: [{ namespace: "web.storage", name: "get", fields: ["key"] }],
|
|
@@ -2819,7 +2940,7 @@ m({
|
|
|
2819
2940
|
namespace: "storage",
|
|
2820
2941
|
name: "set",
|
|
2821
2942
|
description: "Set a value in localStorage",
|
|
2822
|
-
params:
|
|
2943
|
+
params: Mo,
|
|
2823
2944
|
returns: t.null(),
|
|
2824
2945
|
fields: ["key", "value"],
|
|
2825
2946
|
aliases: [
|
|
@@ -2851,7 +2972,7 @@ m({
|
|
|
2851
2972
|
namespace: "storage",
|
|
2852
2973
|
name: "delete",
|
|
2853
2974
|
description: "Delete a key from localStorage",
|
|
2854
|
-
params:
|
|
2975
|
+
params: Do,
|
|
2855
2976
|
returns: t.null(),
|
|
2856
2977
|
fields: ["key"],
|
|
2857
2978
|
aliases: [{ namespace: "web.storage", name: "delete", fields: ["key"] }],
|
|
@@ -2875,7 +2996,7 @@ m({
|
|
|
2875
2996
|
namespace: "storage",
|
|
2876
2997
|
name: "list",
|
|
2877
2998
|
description: "List all localStorage keys",
|
|
2878
|
-
params:
|
|
2999
|
+
params: qo,
|
|
2879
3000
|
returns: t.array(t.string()),
|
|
2880
3001
|
aliases: [{ namespace: "web.storage", name: "list" }],
|
|
2881
3002
|
owner: "main-thread",
|
|
@@ -2898,11 +3019,11 @@ m({
|
|
|
2898
3019
|
namespace: "storage",
|
|
2899
3020
|
name: "set_many",
|
|
2900
3021
|
description: "Set multiple values in localStorage",
|
|
2901
|
-
params:
|
|
3022
|
+
params: Po,
|
|
2902
3023
|
returns: t.null(),
|
|
2903
3024
|
owner: "main-thread",
|
|
2904
3025
|
handler: async (e, r) => {
|
|
2905
|
-
const n =
|
|
3026
|
+
const n = H(e.items);
|
|
2906
3027
|
for (const a of Object.keys(n)) {
|
|
2907
3028
|
const o = n[a];
|
|
2908
3029
|
localStorage.setItem(
|
|
@@ -2930,11 +3051,11 @@ m({
|
|
|
2930
3051
|
namespace: "storage",
|
|
2931
3052
|
name: "get_many",
|
|
2932
3053
|
description: "Get multiple values from localStorage",
|
|
2933
|
-
params:
|
|
3054
|
+
params: jo,
|
|
2934
3055
|
returns: t.record(t.string().nullable()),
|
|
2935
3056
|
owner: "main-thread",
|
|
2936
3057
|
handler: async (e, r) => {
|
|
2937
|
-
const n = e.keys, a =
|
|
3058
|
+
const n = e.keys, a = H(e.defaults ?? {}), o = {};
|
|
2938
3059
|
for (const i of n) {
|
|
2939
3060
|
const s = localStorage.getItem(`__csl__:${String(i)}`);
|
|
2940
3061
|
o[String(i)] = s !== null ? s : a[String(i)] ?? null;
|
|
@@ -2965,7 +3086,7 @@ m({
|
|
|
2965
3086
|
namespace: "storage",
|
|
2966
3087
|
name: "get_all",
|
|
2967
3088
|
description: "Get all __csl__ values from localStorage",
|
|
2968
|
-
params:
|
|
3089
|
+
params: Ho,
|
|
2969
3090
|
returns: t.record(t.string().nullable()),
|
|
2970
3091
|
owner: "main-thread",
|
|
2971
3092
|
handler: async (e, r) => {
|
|
@@ -2990,7 +3111,7 @@ m({
|
|
|
2990
3111
|
namespace: "storage",
|
|
2991
3112
|
name: "delete_many",
|
|
2992
3113
|
description: "Delete multiple keys from localStorage",
|
|
2993
|
-
params:
|
|
3114
|
+
params: Fo,
|
|
2994
3115
|
returns: t.null(),
|
|
2995
3116
|
owner: "main-thread",
|
|
2996
3117
|
handler: async (e, r) => {
|
|
@@ -3017,7 +3138,7 @@ m({
|
|
|
3017
3138
|
namespace: "storage",
|
|
3018
3139
|
name: "clear",
|
|
3019
3140
|
description: "Clear all __csl__ keys from localStorage",
|
|
3020
|
-
params:
|
|
3141
|
+
params: Wo,
|
|
3021
3142
|
returns: t.null(),
|
|
3022
3143
|
owner: "main-thread",
|
|
3023
3144
|
handler: async (e, r) => {
|
|
@@ -3036,7 +3157,7 @@ m({
|
|
|
3036
3157
|
errorCategory: "storage",
|
|
3037
3158
|
example: "storage.clear()"
|
|
3038
3159
|
});
|
|
3039
|
-
const
|
|
3160
|
+
const tr = t.record(t.unknown());
|
|
3040
3161
|
p(
|
|
3041
3162
|
"chrome_storage_local_set",
|
|
3042
3163
|
"chrome",
|
|
@@ -3053,7 +3174,7 @@ p(
|
|
|
3053
3174
|
"chrome",
|
|
3054
3175
|
"Get extension local storage values",
|
|
3055
3176
|
["storage", "local"],
|
|
3056
|
-
|
|
3177
|
+
tr,
|
|
3057
3178
|
"ECHROME",
|
|
3058
3179
|
"extension",
|
|
3059
3180
|
[],
|
|
@@ -3097,7 +3218,7 @@ p(
|
|
|
3097
3218
|
"chrome",
|
|
3098
3219
|
"Get extension sync storage values",
|
|
3099
3220
|
["storage", "sync"],
|
|
3100
|
-
|
|
3221
|
+
tr,
|
|
3101
3222
|
"ECHROME",
|
|
3102
3223
|
"extension",
|
|
3103
3224
|
[],
|
|
@@ -3130,7 +3251,7 @@ m({
|
|
|
3130
3251
|
namespace: "clipboard",
|
|
3131
3252
|
name: "read",
|
|
3132
3253
|
description: "Read text from clipboard",
|
|
3133
|
-
params:
|
|
3254
|
+
params: ta,
|
|
3134
3255
|
returns: t.string(),
|
|
3135
3256
|
aliases: [{ namespace: "web.clipboard", name: "read" }],
|
|
3136
3257
|
owner: "main-thread",
|
|
@@ -3146,7 +3267,7 @@ m({
|
|
|
3146
3267
|
namespace: "clipboard",
|
|
3147
3268
|
name: "write",
|
|
3148
3269
|
description: "Write text to clipboard",
|
|
3149
|
-
params:
|
|
3270
|
+
params: ra,
|
|
3150
3271
|
returns: t.null(),
|
|
3151
3272
|
aliases: [{ namespace: "web.clipboard", name: "write", fields: ["text"] }],
|
|
3152
3273
|
owner: "main-thread",
|
|
@@ -3156,7 +3277,7 @@ m({
|
|
|
3156
3277
|
const a = e[0];
|
|
3157
3278
|
typeof a == "object" && a !== null ? n = String(a.text ?? a) : n = String(a);
|
|
3158
3279
|
} else {
|
|
3159
|
-
const a =
|
|
3280
|
+
const a = H(e);
|
|
3160
3281
|
n = a.text || a.value || "";
|
|
3161
3282
|
}
|
|
3162
3283
|
return await navigator.clipboard.writeText(n), null;
|
|
@@ -3185,14 +3306,14 @@ m({
|
|
|
3185
3306
|
namespace: "network",
|
|
3186
3307
|
name: "fetch",
|
|
3187
3308
|
description: "Make an HTTP request",
|
|
3188
|
-
params:
|
|
3189
|
-
returns:
|
|
3309
|
+
params: Ut,
|
|
3310
|
+
returns: $e,
|
|
3190
3311
|
fields: ["url"],
|
|
3191
3312
|
aliases: [{ namespace: "web", name: "fetch", fields: ["url"] }],
|
|
3192
3313
|
owner: "main-thread",
|
|
3193
3314
|
handler: async (e, r) => {
|
|
3194
|
-
const n = await
|
|
3195
|
-
return
|
|
3315
|
+
const n = await Yn(e);
|
|
3316
|
+
return v(n);
|
|
3196
3317
|
},
|
|
3197
3318
|
paramTypes: [
|
|
3198
3319
|
{
|
|
@@ -3236,7 +3357,7 @@ m({
|
|
|
3236
3357
|
namespace: "util",
|
|
3237
3358
|
name: "sleep",
|
|
3238
3359
|
description: "Sleep for a duration",
|
|
3239
|
-
params:
|
|
3360
|
+
params: ia,
|
|
3240
3361
|
returns: t.null(),
|
|
3241
3362
|
fields: ["duration"],
|
|
3242
3363
|
aliases: [{ namespace: "web", name: "sleep", fields: ["duration"] }],
|
|
@@ -3280,13 +3401,13 @@ m({
|
|
|
3280
3401
|
errorCode: "E_UNKNOWN",
|
|
3281
3402
|
example: 'util.mock_async({ tabId: 123, script: "document.title" })'
|
|
3282
3403
|
});
|
|
3283
|
-
const O = "Returns a Promise; await before reading the result. For a cell's last line, use `page.snapshot()` without a leading await so the cell returns the settled value.",
|
|
3404
|
+
const O = "Returns a Promise; await before reading the result. For a cell's last line, use `page.snapshot()` without a leading await so the cell returns the settled value.", ki = [
|
|
3284
3405
|
{
|
|
3285
3406
|
action: "page_back",
|
|
3286
3407
|
namespace: "page",
|
|
3287
3408
|
name: "back",
|
|
3288
3409
|
description: "Go back in the active tab",
|
|
3289
|
-
params:
|
|
3410
|
+
params: da,
|
|
3290
3411
|
returns: g,
|
|
3291
3412
|
paramTypes: [],
|
|
3292
3413
|
returnDoc: "Navigation result",
|
|
@@ -3299,7 +3420,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3299
3420
|
namespace: "page",
|
|
3300
3421
|
name: "click",
|
|
3301
3422
|
description: "Click an element in the active tab",
|
|
3302
|
-
params:
|
|
3423
|
+
params: ba,
|
|
3303
3424
|
returns: g,
|
|
3304
3425
|
paramTypes: [
|
|
3305
3426
|
{
|
|
@@ -3337,7 +3458,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3337
3458
|
namespace: "page",
|
|
3338
3459
|
name: "fill",
|
|
3339
3460
|
description: "Fill an element in the active tab",
|
|
3340
|
-
params:
|
|
3461
|
+
params: fa,
|
|
3341
3462
|
returns: g,
|
|
3342
3463
|
paramTypes: [
|
|
3343
3464
|
{
|
|
@@ -3381,7 +3502,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3381
3502
|
namespace: "page",
|
|
3382
3503
|
name: "setFiles",
|
|
3383
3504
|
description: "Attach files to a file input in the active tab",
|
|
3384
|
-
params:
|
|
3505
|
+
params: ga,
|
|
3385
3506
|
returns: g,
|
|
3386
3507
|
paramTypes: [
|
|
3387
3508
|
{
|
|
@@ -3427,7 +3548,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3427
3548
|
namespace: "page",
|
|
3428
3549
|
name: "type",
|
|
3429
3550
|
description: "Type into an element in the active tab",
|
|
3430
|
-
params:
|
|
3551
|
+
params: ya,
|
|
3431
3552
|
returns: g,
|
|
3432
3553
|
paramTypes: [
|
|
3433
3554
|
{
|
|
@@ -3471,7 +3592,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3471
3592
|
namespace: "page",
|
|
3472
3593
|
name: "append",
|
|
3473
3594
|
description: "Append text to an element in the active tab",
|
|
3474
|
-
params:
|
|
3595
|
+
params: _a,
|
|
3475
3596
|
returns: g,
|
|
3476
3597
|
paramTypes: [
|
|
3477
3598
|
{
|
|
@@ -3513,7 +3634,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3513
3634
|
namespace: "page",
|
|
3514
3635
|
name: "press",
|
|
3515
3636
|
description: "Press a key in the active tab",
|
|
3516
|
-
params:
|
|
3637
|
+
params: wa,
|
|
3517
3638
|
returns: g,
|
|
3518
3639
|
fields: ["key"],
|
|
3519
3640
|
paramTypes: [
|
|
@@ -3545,7 +3666,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3545
3666
|
namespace: "page",
|
|
3546
3667
|
name: "select",
|
|
3547
3668
|
description: "Select an option in the active tab",
|
|
3548
|
-
params:
|
|
3669
|
+
params: ka,
|
|
3549
3670
|
returns: g,
|
|
3550
3671
|
paramTypes: [
|
|
3551
3672
|
{
|
|
@@ -3588,7 +3709,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3588
3709
|
namespace: "page",
|
|
3589
3710
|
name: "select_option",
|
|
3590
3711
|
description: "Select a value from a dropdown/combobox (native select, react-select, ARIA listbox) by clicking the option whose visible text matches value",
|
|
3591
|
-
params:
|
|
3712
|
+
params: Ia,
|
|
3592
3713
|
returns: g,
|
|
3593
3714
|
paramTypes: [
|
|
3594
3715
|
{
|
|
@@ -3634,7 +3755,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3634
3755
|
namespace: "page",
|
|
3635
3756
|
name: "check",
|
|
3636
3757
|
description: "Check/uncheck an element in the active tab",
|
|
3637
|
-
params:
|
|
3758
|
+
params: va,
|
|
3638
3759
|
returns: g,
|
|
3639
3760
|
paramTypes: [
|
|
3640
3761
|
{
|
|
@@ -3677,7 +3798,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3677
3798
|
namespace: "page",
|
|
3678
3799
|
name: "hover",
|
|
3679
3800
|
description: "Hover over an element in the active tab",
|
|
3680
|
-
params:
|
|
3801
|
+
params: xa,
|
|
3681
3802
|
returns: g,
|
|
3682
3803
|
paramTypes: [
|
|
3683
3804
|
{
|
|
@@ -3714,7 +3835,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3714
3835
|
namespace: "page",
|
|
3715
3836
|
name: "unhover",
|
|
3716
3837
|
description: "Unhover in the active tab",
|
|
3717
|
-
params:
|
|
3838
|
+
params: Sa,
|
|
3718
3839
|
returns: g,
|
|
3719
3840
|
paramTypes: [],
|
|
3720
3841
|
returnDoc: "{ ok: true, action: 'unhover' }",
|
|
@@ -3738,7 +3859,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3738
3859
|
namespace: "page",
|
|
3739
3860
|
name: "submit",
|
|
3740
3861
|
description: "Submit a form in the active tab (calls form.requestSubmit())",
|
|
3741
|
-
params:
|
|
3862
|
+
params: Ta,
|
|
3742
3863
|
returns: g,
|
|
3743
3864
|
paramTypes: [
|
|
3744
3865
|
{
|
|
@@ -3776,7 +3897,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3776
3897
|
namespace: "page",
|
|
3777
3898
|
name: "checkRadio",
|
|
3778
3899
|
description: "Check a radio option by group name and value in the active tab",
|
|
3779
|
-
params:
|
|
3900
|
+
params: Ea,
|
|
3780
3901
|
returns: g,
|
|
3781
3902
|
paramTypes: [
|
|
3782
3903
|
{
|
|
@@ -3814,7 +3935,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3814
3935
|
namespace: "page",
|
|
3815
3936
|
name: "scroll",
|
|
3816
3937
|
description: "Scroll the active tab",
|
|
3817
|
-
params:
|
|
3938
|
+
params: Ca,
|
|
3818
3939
|
returns: g,
|
|
3819
3940
|
fields: ["direction", "amount"],
|
|
3820
3941
|
paramTypes: [
|
|
@@ -3841,7 +3962,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3841
3962
|
namespace: "page",
|
|
3842
3963
|
name: "scroll_to",
|
|
3843
3964
|
description: "Scroll to an element in the active tab",
|
|
3844
|
-
params:
|
|
3965
|
+
params: Ra,
|
|
3845
3966
|
returns: g,
|
|
3846
3967
|
paramTypes: [
|
|
3847
3968
|
{
|
|
@@ -3867,7 +3988,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3867
3988
|
namespace: "page",
|
|
3868
3989
|
name: "dblclick",
|
|
3869
3990
|
description: "Double-click an element in the active tab",
|
|
3870
|
-
params:
|
|
3991
|
+
params: Aa,
|
|
3871
3992
|
returns: g,
|
|
3872
3993
|
paramTypes: [
|
|
3873
3994
|
{
|
|
@@ -3904,7 +4025,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3904
4025
|
namespace: "page",
|
|
3905
4026
|
name: "forward",
|
|
3906
4027
|
description: "Go forward in the active tab",
|
|
3907
|
-
params:
|
|
4028
|
+
params: ua,
|
|
3908
4029
|
returns: g,
|
|
3909
4030
|
paramTypes: [],
|
|
3910
4031
|
returnDoc: "Navigation result",
|
|
@@ -3917,7 +4038,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3917
4038
|
namespace: "page",
|
|
3918
4039
|
name: "snapshot",
|
|
3919
4040
|
description: "Capture a broad, text-first page snapshot. Default behavior is intentionally generous: visible text, form values, required/invalid state, and linked field error text are included with actionable refIds where possible.",
|
|
3920
|
-
params:
|
|
4041
|
+
params: So,
|
|
3921
4042
|
returns: t.string(),
|
|
3922
4043
|
paramTypes: [
|
|
3923
4044
|
{
|
|
@@ -3953,7 +4074,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3953
4074
|
namespace: "page",
|
|
3954
4075
|
name: "snapshot_text",
|
|
3955
4076
|
description: "Capture a broad text-first DOM snapshot and return only its text representation",
|
|
3956
|
-
params:
|
|
4077
|
+
params: To,
|
|
3957
4078
|
returns: t.string(),
|
|
3958
4079
|
paramTypes: [
|
|
3959
4080
|
{
|
|
@@ -3973,7 +4094,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
3973
4094
|
namespace: "page",
|
|
3974
4095
|
name: "snapshot_data",
|
|
3975
4096
|
description: "Get broad page snapshot data. Includes visible text, form values, required/invalid state, linked error text, and actionable refIds where possible.",
|
|
3976
|
-
params:
|
|
4097
|
+
params: Co,
|
|
3977
4098
|
returns: we,
|
|
3978
4099
|
paramTypes: [
|
|
3979
4100
|
{
|
|
@@ -4004,7 +4125,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4004
4125
|
namespace: "page",
|
|
4005
4126
|
name: "snapshot_query",
|
|
4006
4127
|
description: "Opt-in filtered snapshot query by role, tag, text, name, etc. Use this only when you intentionally want less than the default broad snapshot.",
|
|
4007
|
-
params:
|
|
4128
|
+
params: zt,
|
|
4008
4129
|
returns: we,
|
|
4009
4130
|
paramTypes: [
|
|
4010
4131
|
{
|
|
@@ -4040,7 +4161,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4040
4161
|
namespace: "page",
|
|
4041
4162
|
name: "find",
|
|
4042
4163
|
description: "Find elements in the active tab using a CSS selector",
|
|
4043
|
-
params:
|
|
4164
|
+
params: Na,
|
|
4044
4165
|
returns: t.array(
|
|
4045
4166
|
t.object({
|
|
4046
4167
|
refId: q(),
|
|
@@ -4087,8 +4208,8 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4087
4208
|
namespace: "page",
|
|
4088
4209
|
name: "dom",
|
|
4089
4210
|
description: "Introspect raw DOM subtree by CSS selector. Read-only. Use this whenever snapshot/find do not expose enough data: hidden inputs, validation shims, raw attributes, dropdown/listbox ownership, shadowed widgets, aria-hidden regions, or exact DOM structure.",
|
|
4090
|
-
params:
|
|
4091
|
-
returns:
|
|
4211
|
+
params: Ma,
|
|
4212
|
+
returns: Wa,
|
|
4092
4213
|
paramTypes: [
|
|
4093
4214
|
{
|
|
4094
4215
|
name: "selector",
|
|
@@ -4132,7 +4253,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4132
4253
|
namespace: "page",
|
|
4133
4254
|
name: "wait_for",
|
|
4134
4255
|
description: "Wait for a selector in the active tab",
|
|
4135
|
-
params:
|
|
4256
|
+
params: Da,
|
|
4136
4257
|
returns: t.boolean(),
|
|
4137
4258
|
fields: ["selector", "timeout"],
|
|
4138
4259
|
paramTypes: [
|
|
@@ -4164,7 +4285,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4164
4285
|
namespace: "page",
|
|
4165
4286
|
name: "extract",
|
|
4166
4287
|
description: "Extract data from the active tab",
|
|
4167
|
-
params:
|
|
4288
|
+
params: Oa,
|
|
4168
4289
|
returns: t.object({
|
|
4169
4290
|
title: t.string().optional(),
|
|
4170
4291
|
url: t.string().optional(),
|
|
@@ -4195,8 +4316,8 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4195
4316
|
namespace: "page",
|
|
4196
4317
|
name: "fetch",
|
|
4197
4318
|
description: "Fetch in the active tab",
|
|
4198
|
-
params:
|
|
4199
|
-
returns:
|
|
4319
|
+
params: Ut,
|
|
4320
|
+
returns: $e,
|
|
4200
4321
|
fields: ["url", "options"],
|
|
4201
4322
|
paramTypes: [
|
|
4202
4323
|
{
|
|
@@ -4225,13 +4346,13 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4225
4346
|
},
|
|
4226
4347
|
handlerKey: "fetch"
|
|
4227
4348
|
}
|
|
4228
|
-
],
|
|
4349
|
+
], Ii = [
|
|
4229
4350
|
{
|
|
4230
4351
|
action: "tab_click",
|
|
4231
4352
|
namespace: "web.tab",
|
|
4232
4353
|
name: "click",
|
|
4233
4354
|
description: "Click in a tab",
|
|
4234
|
-
params:
|
|
4355
|
+
params: Bo,
|
|
4235
4356
|
returns: g,
|
|
4236
4357
|
paramTypes: [
|
|
4237
4358
|
{
|
|
@@ -4271,7 +4392,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4271
4392
|
namespace: "web.tab",
|
|
4272
4393
|
name: "fill",
|
|
4273
4394
|
description: "Fill in a tab",
|
|
4274
|
-
params:
|
|
4395
|
+
params: Ko,
|
|
4275
4396
|
returns: g,
|
|
4276
4397
|
paramTypes: [
|
|
4277
4398
|
{
|
|
@@ -4317,7 +4438,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4317
4438
|
namespace: "web.tab",
|
|
4318
4439
|
name: "setFiles",
|
|
4319
4440
|
description: "Attach files to a file input in a tab",
|
|
4320
|
-
params:
|
|
4441
|
+
params: Vo,
|
|
4321
4442
|
returns: g,
|
|
4322
4443
|
paramTypes: [
|
|
4323
4444
|
{
|
|
@@ -4363,7 +4484,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4363
4484
|
namespace: "web.tab",
|
|
4364
4485
|
name: "scroll_to",
|
|
4365
4486
|
description: "Scroll to position in a tab",
|
|
4366
|
-
params:
|
|
4487
|
+
params: Zo,
|
|
4367
4488
|
returns: g,
|
|
4368
4489
|
paramTypes: [
|
|
4369
4490
|
{
|
|
@@ -4407,7 +4528,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4407
4528
|
namespace: "web.tab",
|
|
4408
4529
|
name: "type",
|
|
4409
4530
|
description: "Type in a tab",
|
|
4410
|
-
params:
|
|
4531
|
+
params: zo,
|
|
4411
4532
|
returns: g,
|
|
4412
4533
|
paramTypes: [
|
|
4413
4534
|
{
|
|
@@ -4453,7 +4574,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4453
4574
|
namespace: "web.tab",
|
|
4454
4575
|
name: "press",
|
|
4455
4576
|
description: "Press a key in a tab",
|
|
4456
|
-
params:
|
|
4577
|
+
params: Xo,
|
|
4457
4578
|
returns: g,
|
|
4458
4579
|
paramTypes: [
|
|
4459
4580
|
{
|
|
@@ -4487,7 +4608,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4487
4608
|
namespace: "web.tab",
|
|
4488
4609
|
name: "select",
|
|
4489
4610
|
description: "Select an option in a tab",
|
|
4490
|
-
params:
|
|
4611
|
+
params: Qo,
|
|
4491
4612
|
returns: g,
|
|
4492
4613
|
paramTypes: [
|
|
4493
4614
|
{
|
|
@@ -4533,7 +4654,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4533
4654
|
namespace: "web.tab",
|
|
4534
4655
|
name: "select_option",
|
|
4535
4656
|
description: "Open a combobox (react-select/listbox) in a tab and click the option whose text matches value",
|
|
4536
|
-
params:
|
|
4657
|
+
params: Jo,
|
|
4537
4658
|
returns: g,
|
|
4538
4659
|
paramTypes: [
|
|
4539
4660
|
{
|
|
@@ -4582,7 +4703,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4582
4703
|
namespace: "web.tab",
|
|
4583
4704
|
name: "check",
|
|
4584
4705
|
description: "Check/uncheck in a tab",
|
|
4585
|
-
params:
|
|
4706
|
+
params: Yo,
|
|
4586
4707
|
returns: g,
|
|
4587
4708
|
paramTypes: [
|
|
4588
4709
|
{
|
|
@@ -4628,7 +4749,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4628
4749
|
namespace: "web.tab",
|
|
4629
4750
|
name: "submit",
|
|
4630
4751
|
description: "Submit a form in a tab (calls form.requestSubmit())",
|
|
4631
|
-
params:
|
|
4752
|
+
params: ti,
|
|
4632
4753
|
returns: g,
|
|
4633
4754
|
paramTypes: [
|
|
4634
4755
|
{
|
|
@@ -4668,7 +4789,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4668
4789
|
namespace: "web.tab",
|
|
4669
4790
|
name: "checkRadio",
|
|
4670
4791
|
description: "Check a radio option by group name and value in a tab",
|
|
4671
|
-
params:
|
|
4792
|
+
params: ri,
|
|
4672
4793
|
returns: g,
|
|
4673
4794
|
paramTypes: [
|
|
4674
4795
|
{
|
|
@@ -4708,7 +4829,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4708
4829
|
namespace: "web.tab",
|
|
4709
4830
|
name: "hover",
|
|
4710
4831
|
description: "Hover in a tab",
|
|
4711
|
-
params:
|
|
4832
|
+
params: ei,
|
|
4712
4833
|
returns: g,
|
|
4713
4834
|
paramTypes: [
|
|
4714
4835
|
{
|
|
@@ -4748,7 +4869,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4748
4869
|
namespace: "web.tab",
|
|
4749
4870
|
name: "unhover",
|
|
4750
4871
|
description: "Unhover in a tab",
|
|
4751
|
-
params:
|
|
4872
|
+
params: ni,
|
|
4752
4873
|
returns: g,
|
|
4753
4874
|
paramTypes: [
|
|
4754
4875
|
{
|
|
@@ -4776,7 +4897,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4776
4897
|
namespace: "web.tab",
|
|
4777
4898
|
name: "scroll",
|
|
4778
4899
|
description: "Scroll in a tab",
|
|
4779
|
-
params:
|
|
4900
|
+
params: ai,
|
|
4780
4901
|
returns: g,
|
|
4781
4902
|
paramTypes: [
|
|
4782
4903
|
{
|
|
@@ -4808,7 +4929,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4808
4929
|
namespace: "web.tab",
|
|
4809
4930
|
name: "dblclick",
|
|
4810
4931
|
description: "Double-click in a tab",
|
|
4811
|
-
params:
|
|
4932
|
+
params: oi,
|
|
4812
4933
|
returns: g,
|
|
4813
4934
|
paramTypes: [
|
|
4814
4935
|
{
|
|
@@ -4848,7 +4969,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4848
4969
|
namespace: "web.tab",
|
|
4849
4970
|
name: "back",
|
|
4850
4971
|
description: "Go back in a tab",
|
|
4851
|
-
params:
|
|
4972
|
+
params: si,
|
|
4852
4973
|
returns: g,
|
|
4853
4974
|
paramTypes: [
|
|
4854
4975
|
{
|
|
@@ -4868,7 +4989,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4868
4989
|
namespace: "web.tab",
|
|
4869
4990
|
name: "forward",
|
|
4870
4991
|
description: "Go forward in a tab",
|
|
4871
|
-
params:
|
|
4992
|
+
params: ci,
|
|
4872
4993
|
returns: g,
|
|
4873
4994
|
paramTypes: [
|
|
4874
4995
|
{
|
|
@@ -4888,7 +5009,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4888
5009
|
namespace: "web.tab",
|
|
4889
5010
|
name: "snapshot",
|
|
4890
5011
|
description: "Get a broad, text-first tab snapshot. Includes visible text, form values, validation/error text, and actionable refIds where possible.",
|
|
4891
|
-
params:
|
|
5012
|
+
params: ui,
|
|
4892
5013
|
returns: t.string(),
|
|
4893
5014
|
fields: ["tabId"],
|
|
4894
5015
|
paramTypes: [
|
|
@@ -4923,7 +5044,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4923
5044
|
namespace: "web.tab",
|
|
4924
5045
|
name: "snapshot_text",
|
|
4925
5046
|
description: "Get broad, text-first tab snapshot text",
|
|
4926
|
-
params:
|
|
5047
|
+
params: pi,
|
|
4927
5048
|
returns: t.string(),
|
|
4928
5049
|
fields: ["tabId"],
|
|
4929
5050
|
paramTypes: [
|
|
@@ -4944,7 +5065,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4944
5065
|
namespace: "web.tab",
|
|
4945
5066
|
name: "snapshot_data",
|
|
4946
5067
|
description: "Get broad tab snapshot data. Includes visible text, form values, validation/error text, and actionable refIds where possible.",
|
|
4947
|
-
params:
|
|
5068
|
+
params: mi,
|
|
4948
5069
|
returns: we,
|
|
4949
5070
|
fields: ["tabId"],
|
|
4950
5071
|
paramTypes: [
|
|
@@ -4974,7 +5095,7 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
4974
5095
|
namespace: "web.tab",
|
|
4975
5096
|
name: "snapshot_query",
|
|
4976
5097
|
description: "Query tab snapshot with semantic filtering by role, tag, text, name, etc.",
|
|
4977
|
-
params:
|
|
5098
|
+
params: Ao,
|
|
4978
5099
|
returns: we,
|
|
4979
5100
|
fields: ["tabId"],
|
|
4980
5101
|
paramTypes: [
|
|
@@ -5015,8 +5136,8 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
5015
5136
|
namespace: "web.tab",
|
|
5016
5137
|
name: "fetch",
|
|
5017
5138
|
description: "Fetch in a tab",
|
|
5018
|
-
params:
|
|
5019
|
-
returns:
|
|
5139
|
+
params: di,
|
|
5140
|
+
returns: $e,
|
|
5020
5141
|
fields: ["tabId", "url", "options"],
|
|
5021
5142
|
paramTypes: [
|
|
5022
5143
|
{
|
|
@@ -5042,8 +5163,8 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
5042
5163
|
namespace: "web.tab",
|
|
5043
5164
|
name: "evaluate",
|
|
5044
5165
|
description: "Evaluate script in a tab (content-script context)",
|
|
5045
|
-
params:
|
|
5046
|
-
returns:
|
|
5166
|
+
params: ii,
|
|
5167
|
+
returns: Ua,
|
|
5047
5168
|
fields: ["tabId", "script"],
|
|
5048
5169
|
paramTypes: [
|
|
5049
5170
|
{
|
|
@@ -5071,29 +5192,29 @@ const O = "Returns a Promise; await before reading the result. For a cell's last
|
|
|
5071
5192
|
},
|
|
5072
5193
|
handlerKey: "evaluate"
|
|
5073
5194
|
}
|
|
5074
|
-
],
|
|
5075
|
-
...
|
|
5076
|
-
...
|
|
5195
|
+
], rr = [
|
|
5196
|
+
...ki,
|
|
5197
|
+
...Ii
|
|
5077
5198
|
];
|
|
5078
|
-
function
|
|
5199
|
+
function nr(e) {
|
|
5079
5200
|
const { handlerKey: r, ...n } = e;
|
|
5080
|
-
|
|
5201
|
+
ut(n), hr(e.action);
|
|
5081
5202
|
}
|
|
5082
5203
|
async function ae(e) {
|
|
5083
|
-
const r = await
|
|
5084
|
-
return r === null &&
|
|
5204
|
+
const r = await ht();
|
|
5205
|
+
return r === null && Dr(yr(e)), r;
|
|
5085
5206
|
}
|
|
5086
5207
|
m({
|
|
5087
5208
|
action: "page_url",
|
|
5088
5209
|
namespace: "page",
|
|
5089
5210
|
name: "url",
|
|
5090
5211
|
description: "Get the URL of the active tab",
|
|
5091
|
-
params:
|
|
5212
|
+
params: sa,
|
|
5092
5213
|
returns: t.string(),
|
|
5093
5214
|
owner: "main-thread",
|
|
5094
5215
|
handler: async (e, r) => {
|
|
5095
5216
|
const n = await ae("page.url()");
|
|
5096
|
-
return
|
|
5217
|
+
return v(
|
|
5097
5218
|
await x("chrome_tabs_get", [n])
|
|
5098
5219
|
).url ?? "";
|
|
5099
5220
|
},
|
|
@@ -5107,12 +5228,12 @@ m({
|
|
|
5107
5228
|
namespace: "page",
|
|
5108
5229
|
name: "title",
|
|
5109
5230
|
description: "Get the title of the active tab",
|
|
5110
|
-
params:
|
|
5231
|
+
params: ca,
|
|
5111
5232
|
returns: t.string(),
|
|
5112
5233
|
owner: "main-thread",
|
|
5113
5234
|
handler: async (e, r) => {
|
|
5114
5235
|
const n = await ae("page.title()");
|
|
5115
|
-
return
|
|
5236
|
+
return v(
|
|
5116
5237
|
await x("chrome_tabs_get", [n])
|
|
5117
5238
|
).title ?? "";
|
|
5118
5239
|
},
|
|
@@ -5121,16 +5242,16 @@ m({
|
|
|
5121
5242
|
errorCode: "E_NO_TAB",
|
|
5122
5243
|
example: "page.title()"
|
|
5123
5244
|
});
|
|
5124
|
-
for (const e of
|
|
5245
|
+
for (const e of rr.filter(
|
|
5125
5246
|
(r) => r.namespace === "page"
|
|
5126
5247
|
))
|
|
5127
|
-
|
|
5248
|
+
nr(e);
|
|
5128
5249
|
m({
|
|
5129
5250
|
action: "page_goto",
|
|
5130
5251
|
namespace: "page",
|
|
5131
5252
|
name: "goto",
|
|
5132
5253
|
description: "Navigate the active tab to a URL",
|
|
5133
|
-
params:
|
|
5254
|
+
params: la,
|
|
5134
5255
|
returns: N,
|
|
5135
5256
|
fields: ["url"],
|
|
5136
5257
|
owner: "main-thread",
|
|
@@ -5154,8 +5275,8 @@ m({
|
|
|
5154
5275
|
"E_PERMISSION",
|
|
5155
5276
|
"navigation"
|
|
5156
5277
|
);
|
|
5157
|
-
const c = Number(e.timeout) ||
|
|
5158
|
-
return
|
|
5278
|
+
const c = Number(e.timeout) || Q;
|
|
5279
|
+
return Ze({
|
|
5159
5280
|
tabId: n,
|
|
5160
5281
|
url: e.url,
|
|
5161
5282
|
preNavigationUrl: s,
|
|
@@ -5189,13 +5310,13 @@ m({
|
|
|
5189
5310
|
namespace: "page",
|
|
5190
5311
|
name: "health",
|
|
5191
5312
|
description: "Report tab readiness for mutations vs read-only snapshot APIs",
|
|
5192
|
-
params:
|
|
5193
|
-
returns:
|
|
5313
|
+
params: ja,
|
|
5314
|
+
returns: Ha,
|
|
5194
5315
|
owner: "main-thread",
|
|
5195
5316
|
handler: async (e, r) => {
|
|
5196
|
-
const n = await ae("page.health()"), a =
|
|
5317
|
+
const n = await ae("page.health()"), a = v(
|
|
5197
5318
|
await x("chrome_tabs_get", [n])
|
|
5198
|
-
), o = a.url ?? "", i = a.title ?? "", s = await
|
|
5319
|
+
), o = a.url ?? "", i = a.title ?? "", s = await Yt(n), c = s && !s.ok ? "blocked" : "ok", d = (await Te(n, Tt)).ok ? "connected" : "missing", u = c === "ok" && d === "connected", b = {
|
|
5199
5320
|
tabId: n,
|
|
5200
5321
|
url: o,
|
|
5201
5322
|
title: i,
|
|
@@ -5205,14 +5326,14 @@ m({
|
|
|
5205
5326
|
};
|
|
5206
5327
|
if (!u)
|
|
5207
5328
|
if (c === "blocked")
|
|
5208
|
-
|
|
5329
|
+
b.hint = "This tab URL does not support DOM APIs. Only http(s) pages support page.* and web.tab.* DOM operations.", b.recovery = [
|
|
5209
5330
|
"Navigate to an http(s) URL with await page.goto(url)"
|
|
5210
5331
|
];
|
|
5211
5332
|
else {
|
|
5212
|
-
const
|
|
5213
|
-
|
|
5333
|
+
const h = ge(n, o);
|
|
5334
|
+
b.hint = h.hint, b.recovery = h.recovery;
|
|
5214
5335
|
}
|
|
5215
|
-
return
|
|
5336
|
+
return b;
|
|
5216
5337
|
},
|
|
5217
5338
|
paramTypes: [],
|
|
5218
5339
|
returnDoc: "Tab health: contentScript connection and http(s) domApis readiness",
|
|
@@ -5224,12 +5345,12 @@ m({
|
|
|
5224
5345
|
namespace: "page",
|
|
5225
5346
|
name: "reload",
|
|
5226
5347
|
description: "Reload the active tab",
|
|
5227
|
-
params:
|
|
5348
|
+
params: pa,
|
|
5228
5349
|
returns: t.null(),
|
|
5229
5350
|
owner: "main-thread",
|
|
5230
5351
|
handler: async (e, r) => {
|
|
5231
5352
|
const n = await ae("page.reload()");
|
|
5232
|
-
return
|
|
5353
|
+
return v(await x("chrome_tabs_reload", [n]));
|
|
5233
5354
|
},
|
|
5234
5355
|
paramTypes: [],
|
|
5235
5356
|
returnDoc: "null",
|
|
@@ -5241,7 +5362,7 @@ m({
|
|
|
5241
5362
|
namespace: "page",
|
|
5242
5363
|
name: "wait",
|
|
5243
5364
|
description: "Wait for a duration",
|
|
5244
|
-
params:
|
|
5365
|
+
params: ma,
|
|
5245
5366
|
returns: t.boolean(),
|
|
5246
5367
|
fields: ["duration"],
|
|
5247
5368
|
owner: "main-thread",
|
|
@@ -5265,14 +5386,14 @@ m({
|
|
|
5265
5386
|
namespace: "page",
|
|
5266
5387
|
name: "close",
|
|
5267
5388
|
description: "Close a tab",
|
|
5268
|
-
params:
|
|
5389
|
+
params: Pa,
|
|
5269
5390
|
returns: t.null(),
|
|
5270
5391
|
owner: "main-thread",
|
|
5271
5392
|
handler: async (e, r) => {
|
|
5272
5393
|
const n = typeof e == "number" ? e : te(e);
|
|
5273
5394
|
if (n === null)
|
|
5274
5395
|
throw y("page_close requires a tabId", "E_MISSING_PARAM");
|
|
5275
|
-
return
|
|
5396
|
+
return v(await x("chrome_tabs_remove", [n]));
|
|
5276
5397
|
},
|
|
5277
5398
|
paramTypes: [
|
|
5278
5399
|
{
|
|
@@ -5291,11 +5412,11 @@ m({
|
|
|
5291
5412
|
namespace: "page",
|
|
5292
5413
|
name: "tabs",
|
|
5293
5414
|
description: "Query tabs",
|
|
5294
|
-
params:
|
|
5415
|
+
params: Ke,
|
|
5295
5416
|
returns: ne,
|
|
5296
5417
|
owner: "main-thread",
|
|
5297
5418
|
handler: async (e, r) => {
|
|
5298
|
-
const n =
|
|
5419
|
+
const n = v(
|
|
5299
5420
|
await x("chrome_tabs_query", [e])
|
|
5300
5421
|
);
|
|
5301
5422
|
return (Array.isArray(n) ? n : []).map((a) => ({
|
|
@@ -5321,14 +5442,14 @@ m({
|
|
|
5321
5442
|
namespace: "page",
|
|
5322
5443
|
name: "switch",
|
|
5323
5444
|
description: "Switch to a tab",
|
|
5324
|
-
params:
|
|
5445
|
+
params: Jt,
|
|
5325
5446
|
returns: N,
|
|
5326
5447
|
owner: "main-thread",
|
|
5327
5448
|
handler: async (e, r) => {
|
|
5328
5449
|
const n = typeof e == "number" ? e : te(e);
|
|
5329
5450
|
if (n === null)
|
|
5330
5451
|
throw y("page_switch requires a tabId", "E_MISSING_PARAM");
|
|
5331
|
-
return
|
|
5452
|
+
return v(
|
|
5332
5453
|
await x("chrome_tabs_update", [n, { active: !0 }])
|
|
5333
5454
|
);
|
|
5334
5455
|
},
|
|
@@ -5349,11 +5470,11 @@ m({
|
|
|
5349
5470
|
namespace: "page",
|
|
5350
5471
|
name: "new_tab",
|
|
5351
5472
|
description: "Open a new tab",
|
|
5352
|
-
params:
|
|
5473
|
+
params: Xt,
|
|
5353
5474
|
returns: N,
|
|
5354
5475
|
fields: ["url"],
|
|
5355
5476
|
owner: "main-thread",
|
|
5356
|
-
handler: async (e, r) =>
|
|
5477
|
+
handler: async (e, r) => v(await x("chrome_tabs_create", [e])),
|
|
5357
5478
|
paramTypes: [
|
|
5358
5479
|
{
|
|
5359
5480
|
name: "url",
|
|
@@ -5378,11 +5499,11 @@ m({
|
|
|
5378
5499
|
namespace: "page",
|
|
5379
5500
|
name: "active_tab",
|
|
5380
5501
|
description: "Get the active tab",
|
|
5381
|
-
params:
|
|
5502
|
+
params: La,
|
|
5382
5503
|
returns: N,
|
|
5383
5504
|
owner: "main-thread",
|
|
5384
5505
|
handler: async (e, r) => {
|
|
5385
|
-
const n = await ae("page.active_tab()"), a =
|
|
5506
|
+
const n = await ae("page.active_tab()"), a = v(
|
|
5386
5507
|
await x("chrome_tabs_get", [n])
|
|
5387
5508
|
);
|
|
5388
5509
|
return { ...a, tabId: typeof a.id == "number" ? a.id : n };
|
|
@@ -5392,42 +5513,42 @@ m({
|
|
|
5392
5513
|
errorCode: "E_NO_TAB",
|
|
5393
5514
|
example: "page.active_tab()"
|
|
5394
5515
|
});
|
|
5395
|
-
function
|
|
5516
|
+
function vi(e) {
|
|
5396
5517
|
return {
|
|
5397
5518
|
tag: e.tagName.toLowerCase(),
|
|
5398
5519
|
role: X(e),
|
|
5399
5520
|
name: Ee(e)
|
|
5400
5521
|
};
|
|
5401
5522
|
}
|
|
5402
|
-
let
|
|
5403
|
-
function
|
|
5404
|
-
|
|
5523
|
+
let et = 0, tt, rt = /* @__PURE__ */ new Map();
|
|
5524
|
+
function Ei(e = []) {
|
|
5525
|
+
et += 1, tt = `obs${et}`, rt = /* @__PURE__ */ new Map();
|
|
5405
5526
|
for (const r of e)
|
|
5406
|
-
|
|
5527
|
+
rt.set(r.refId, {
|
|
5407
5528
|
element: r.element,
|
|
5408
|
-
fingerprint:
|
|
5529
|
+
fingerprint: vi(r.element)
|
|
5409
5530
|
});
|
|
5410
|
-
return
|
|
5531
|
+
return tt;
|
|
5411
5532
|
}
|
|
5412
|
-
function
|
|
5533
|
+
function xi(e) {
|
|
5413
5534
|
return document.querySelector(
|
|
5414
5535
|
`[data-ref-id='${CSS.escape(e)}']`
|
|
5415
5536
|
);
|
|
5416
5537
|
}
|
|
5417
|
-
function
|
|
5418
|
-
const r =
|
|
5419
|
-
const i =
|
|
5538
|
+
function Si(e) {
|
|
5539
|
+
const r = Kn(e), n = r.nodes.map((o) => {
|
|
5540
|
+
const i = xi(o.refId);
|
|
5420
5541
|
return i ? { refId: o.refId, element: i } : null;
|
|
5421
5542
|
}).filter(
|
|
5422
5543
|
(o) => o !== null
|
|
5423
|
-
), a =
|
|
5544
|
+
), a = Ei(n);
|
|
5424
5545
|
return { ...r, observationId: a };
|
|
5425
5546
|
}
|
|
5426
5547
|
function K(e) {
|
|
5427
5548
|
var a, o, i;
|
|
5428
5549
|
const r = e.toLowerCase().trim();
|
|
5429
5550
|
if (!r) return null;
|
|
5430
|
-
const n = Array.from(document.querySelectorAll(
|
|
5551
|
+
const n = Array.from(document.querySelectorAll(Ue));
|
|
5431
5552
|
for (const s of n) {
|
|
5432
5553
|
const c = s.getAttribute("aria-label");
|
|
5433
5554
|
if (c && c.toLowerCase().trim() === r) return s;
|
|
@@ -5436,8 +5557,8 @@ function K(e) {
|
|
|
5436
5557
|
return s;
|
|
5437
5558
|
const d = s.id;
|
|
5438
5559
|
if (d) {
|
|
5439
|
-
const
|
|
5440
|
-
if (
|
|
5560
|
+
const h = document.querySelector(`label[for='${CSS.escape(d)}']`);
|
|
5561
|
+
if (h && ((a = h.textContent) == null ? void 0 : a.trim().toLowerCase()) === r)
|
|
5441
5562
|
return s;
|
|
5442
5563
|
}
|
|
5443
5564
|
const u = s.closest("label");
|
|
@@ -5445,16 +5566,16 @@ function K(e) {
|
|
|
5445
5566
|
}
|
|
5446
5567
|
return null;
|
|
5447
5568
|
}
|
|
5448
|
-
function
|
|
5569
|
+
function Ti(e) {
|
|
5449
5570
|
var o;
|
|
5450
5571
|
const r = e.toLowerCase().trim();
|
|
5451
5572
|
if (!r) return [];
|
|
5452
|
-
const n = Array.from(document.querySelectorAll(
|
|
5573
|
+
const n = Array.from(document.querySelectorAll(Ue)), a = [];
|
|
5453
5574
|
for (const i of n) {
|
|
5454
5575
|
const s = i.getAttribute("aria-label"), c = i.placeholder, l = ((o = i.textContent) == null ? void 0 : o.trim()) || "";
|
|
5455
5576
|
if (![s, c, l].filter(
|
|
5456
5577
|
Boolean
|
|
5457
|
-
).some((
|
|
5578
|
+
).some((b) => b.toLowerCase().includes(r)))
|
|
5458
5579
|
continue;
|
|
5459
5580
|
const u = i.getAttribute("data-ref-id");
|
|
5460
5581
|
if (u && (a.push({
|
|
@@ -5466,13 +5587,13 @@ function hi(e) {
|
|
|
5466
5587
|
}
|
|
5467
5588
|
return a;
|
|
5468
5589
|
}
|
|
5469
|
-
function
|
|
5590
|
+
function Ci(e) {
|
|
5470
5591
|
const r = document.querySelector(
|
|
5471
5592
|
`[data-ref-id='${CSS.escape(e)}']`
|
|
5472
5593
|
);
|
|
5473
5594
|
let n, a;
|
|
5474
5595
|
r && (n = r.tagName.toLowerCase(), a = X(r));
|
|
5475
|
-
const o = Array.from(document.querySelectorAll(
|
|
5596
|
+
const o = Array.from(document.querySelectorAll(Ue)), i = [];
|
|
5476
5597
|
for (const s of o) {
|
|
5477
5598
|
const c = s.getAttribute("data-ref-id");
|
|
5478
5599
|
if (c) {
|
|
@@ -5490,24 +5611,24 @@ function fi(e) {
|
|
|
5490
5611
|
}
|
|
5491
5612
|
return i;
|
|
5492
5613
|
}
|
|
5493
|
-
function
|
|
5614
|
+
function Ri() {
|
|
5494
5615
|
try {
|
|
5495
|
-
return
|
|
5616
|
+
return Si(Number.MAX_SAFE_INTEGER);
|
|
5496
5617
|
} catch {
|
|
5497
5618
|
return;
|
|
5498
5619
|
}
|
|
5499
5620
|
}
|
|
5500
5621
|
function V(e, r, n = !1) {
|
|
5501
|
-
const a =
|
|
5622
|
+
const a = Ri();
|
|
5502
5623
|
if (e) {
|
|
5503
|
-
const o = n ?
|
|
5624
|
+
const o = n ? Ci(e) : [];
|
|
5504
5625
|
me(
|
|
5505
|
-
|
|
5626
|
+
_r(e, { candidates: o, snapshot: a })
|
|
5506
5627
|
);
|
|
5507
5628
|
}
|
|
5508
5629
|
if (r) {
|
|
5509
|
-
const o = n ?
|
|
5510
|
-
me(
|
|
5630
|
+
const o = n ? Ti(r) : [];
|
|
5631
|
+
me(kr(r, o));
|
|
5511
5632
|
}
|
|
5512
5633
|
me({
|
|
5513
5634
|
message: "Element not found",
|
|
@@ -5515,7 +5636,7 @@ function V(e, r, n = !1) {
|
|
|
5515
5636
|
category: "resource"
|
|
5516
5637
|
});
|
|
5517
5638
|
}
|
|
5518
|
-
const
|
|
5639
|
+
const Ai = /* @__PURE__ */ new Map([
|
|
5519
5640
|
[
|
|
5520
5641
|
"sidepanel_click",
|
|
5521
5642
|
(e, r) => {
|
|
@@ -5639,7 +5760,7 @@ const yi = /* @__PURE__ */ new Map([
|
|
|
5639
5760
|
[
|
|
5640
5761
|
"sidepanel_scroll",
|
|
5641
5762
|
(e, r) => {
|
|
5642
|
-
const n = r.direction ?? "down", a = typeof r.amount == "number" ? r.amount :
|
|
5763
|
+
const n = r.direction ?? "down", a = typeof r.amount == "number" ? r.amount : St;
|
|
5643
5764
|
return window.scrollBy({
|
|
5644
5765
|
top: n === "up" ? -a : a,
|
|
5645
5766
|
behavior: "smooth"
|
|
@@ -5655,10 +5776,10 @@ const yi = /* @__PURE__ */ new Map([
|
|
|
5655
5776
|
}
|
|
5656
5777
|
]
|
|
5657
5778
|
]);
|
|
5658
|
-
function
|
|
5659
|
-
const n = f.child("runner"), a =
|
|
5779
|
+
function j(e, r) {
|
|
5780
|
+
const n = f.child("runner"), a = hi(r);
|
|
5660
5781
|
n.debug("dispatchSidepanelEvent_start", { action: e, refId: a });
|
|
5661
|
-
const o =
|
|
5782
|
+
const o = H(r), i = Ai.get(e);
|
|
5662
5783
|
if (!i)
|
|
5663
5784
|
throw n.error("dispatchSidepanelEvent_no_handler", { action: e }), y(`Unknown sidepanel action: ${e}`, "E_UNKNOWN");
|
|
5664
5785
|
return i(a, o);
|
|
@@ -5668,10 +5789,10 @@ m({
|
|
|
5668
5789
|
namespace: "sidepanel",
|
|
5669
5790
|
name: "click",
|
|
5670
5791
|
description: "Click an element in the sidepanel",
|
|
5671
|
-
params:
|
|
5792
|
+
params: oo,
|
|
5672
5793
|
returns: t.null(),
|
|
5673
5794
|
owner: "main-thread",
|
|
5674
|
-
handler: async (e, r) =>
|
|
5795
|
+
handler: async (e, r) => j("sidepanel_click", e),
|
|
5675
5796
|
paramTypes: [
|
|
5676
5797
|
{
|
|
5677
5798
|
name: "refId",
|
|
@@ -5695,10 +5816,10 @@ m({
|
|
|
5695
5816
|
namespace: "sidepanel",
|
|
5696
5817
|
name: "dblclick",
|
|
5697
5818
|
description: "Double-click an element in the sidepanel",
|
|
5698
|
-
params:
|
|
5819
|
+
params: io,
|
|
5699
5820
|
returns: t.null(),
|
|
5700
5821
|
owner: "main-thread",
|
|
5701
|
-
handler: async (e, r) =>
|
|
5822
|
+
handler: async (e, r) => j("sidepanel_dblclick", e),
|
|
5702
5823
|
paramTypes: [
|
|
5703
5824
|
{
|
|
5704
5825
|
name: "refId",
|
|
@@ -5722,10 +5843,10 @@ m({
|
|
|
5722
5843
|
namespace: "sidepanel",
|
|
5723
5844
|
name: "fill",
|
|
5724
5845
|
description: "Fill an element in the sidepanel",
|
|
5725
|
-
params:
|
|
5846
|
+
params: so,
|
|
5726
5847
|
returns: t.null(),
|
|
5727
5848
|
owner: "main-thread",
|
|
5728
|
-
handler: async (e, r) =>
|
|
5849
|
+
handler: async (e, r) => j("sidepanel_fill", e),
|
|
5729
5850
|
paramTypes: [
|
|
5730
5851
|
{
|
|
5731
5852
|
name: "refId",
|
|
@@ -5755,10 +5876,10 @@ m({
|
|
|
5755
5876
|
namespace: "sidepanel",
|
|
5756
5877
|
name: "type",
|
|
5757
5878
|
description: "Type into an element in the sidepanel",
|
|
5758
|
-
params:
|
|
5879
|
+
params: co,
|
|
5759
5880
|
returns: t.null(),
|
|
5760
5881
|
owner: "main-thread",
|
|
5761
|
-
handler: async (e, r) =>
|
|
5882
|
+
handler: async (e, r) => j("sidepanel_type", e),
|
|
5762
5883
|
paramTypes: [
|
|
5763
5884
|
{
|
|
5764
5885
|
name: "refId",
|
|
@@ -5788,11 +5909,11 @@ m({
|
|
|
5788
5909
|
namespace: "sidepanel",
|
|
5789
5910
|
name: "press",
|
|
5790
5911
|
description: "Press a key in the sidepanel",
|
|
5791
|
-
params:
|
|
5912
|
+
params: lo,
|
|
5792
5913
|
returns: t.null(),
|
|
5793
5914
|
fields: ["key"],
|
|
5794
5915
|
owner: "main-thread",
|
|
5795
|
-
handler: async (e, r) =>
|
|
5916
|
+
handler: async (e, r) => j("sidepanel_press", e),
|
|
5796
5917
|
paramTypes: [
|
|
5797
5918
|
{
|
|
5798
5919
|
name: "key",
|
|
@@ -5810,10 +5931,10 @@ m({
|
|
|
5810
5931
|
namespace: "sidepanel",
|
|
5811
5932
|
name: "select",
|
|
5812
5933
|
description: "Select an option in the sidepanel",
|
|
5813
|
-
params:
|
|
5934
|
+
params: uo,
|
|
5814
5935
|
returns: t.null(),
|
|
5815
5936
|
owner: "main-thread",
|
|
5816
|
-
handler: async (e, r) =>
|
|
5937
|
+
handler: async (e, r) => j("sidepanel_select", e),
|
|
5817
5938
|
paramTypes: [
|
|
5818
5939
|
{
|
|
5819
5940
|
name: "refId",
|
|
@@ -5843,10 +5964,10 @@ m({
|
|
|
5843
5964
|
namespace: "sidepanel",
|
|
5844
5965
|
name: "check",
|
|
5845
5966
|
description: "Check/uncheck an element in the sidepanel",
|
|
5846
|
-
params:
|
|
5967
|
+
params: po,
|
|
5847
5968
|
returns: t.null(),
|
|
5848
5969
|
owner: "main-thread",
|
|
5849
|
-
handler: async (e, r) =>
|
|
5970
|
+
handler: async (e, r) => j("sidepanel_check", e),
|
|
5850
5971
|
paramTypes: [
|
|
5851
5972
|
{
|
|
5852
5973
|
name: "refId",
|
|
@@ -5876,10 +5997,10 @@ m({
|
|
|
5876
5997
|
namespace: "sidepanel",
|
|
5877
5998
|
name: "hover",
|
|
5878
5999
|
description: "Hover over an element in the sidepanel",
|
|
5879
|
-
params:
|
|
6000
|
+
params: mo,
|
|
5880
6001
|
returns: t.null(),
|
|
5881
6002
|
owner: "main-thread",
|
|
5882
|
-
handler: async (e, r) =>
|
|
6003
|
+
handler: async (e, r) => j("sidepanel_hover", e),
|
|
5883
6004
|
paramTypes: [
|
|
5884
6005
|
{
|
|
5885
6006
|
name: "refId",
|
|
@@ -5903,10 +6024,10 @@ m({
|
|
|
5903
6024
|
namespace: "sidepanel",
|
|
5904
6025
|
name: "unhover",
|
|
5905
6026
|
description: "Unhover in the sidepanel",
|
|
5906
|
-
params:
|
|
6027
|
+
params: bo,
|
|
5907
6028
|
returns: t.null(),
|
|
5908
6029
|
owner: "main-thread",
|
|
5909
|
-
handler: async (e, r) =>
|
|
6030
|
+
handler: async (e, r) => j("sidepanel_unhover", e),
|
|
5910
6031
|
paramTypes: [],
|
|
5911
6032
|
returnDoc: "null",
|
|
5912
6033
|
errorCode: "E_UNKNOWN",
|
|
@@ -5917,10 +6038,10 @@ m({
|
|
|
5917
6038
|
namespace: "sidepanel",
|
|
5918
6039
|
name: "scroll",
|
|
5919
6040
|
description: "Scroll the sidepanel",
|
|
5920
|
-
params:
|
|
6041
|
+
params: ho,
|
|
5921
6042
|
returns: t.null(),
|
|
5922
6043
|
owner: "main-thread",
|
|
5923
|
-
handler: async (e, r) =>
|
|
6044
|
+
handler: async (e, r) => j("sidepanel_scroll", e),
|
|
5924
6045
|
paramTypes: [
|
|
5925
6046
|
{
|
|
5926
6047
|
name: "direction",
|
|
@@ -5944,10 +6065,10 @@ m({
|
|
|
5944
6065
|
namespace: "sidepanel",
|
|
5945
6066
|
name: "scroll_to",
|
|
5946
6067
|
description: "Scroll to an element in the sidepanel",
|
|
5947
|
-
params:
|
|
6068
|
+
params: fo,
|
|
5948
6069
|
returns: t.null(),
|
|
5949
6070
|
owner: "main-thread",
|
|
5950
|
-
handler: async (e, r) =>
|
|
6071
|
+
handler: async (e, r) => j("sidepanel_scroll_to", e),
|
|
5951
6072
|
paramTypes: [
|
|
5952
6073
|
{
|
|
5953
6074
|
name: "refId",
|
|
@@ -5971,10 +6092,10 @@ m({
|
|
|
5971
6092
|
namespace: "sidepanel",
|
|
5972
6093
|
name: "append",
|
|
5973
6094
|
description: "Append text to an element in the sidepanel",
|
|
5974
|
-
params:
|
|
6095
|
+
params: go,
|
|
5975
6096
|
returns: t.null(),
|
|
5976
6097
|
owner: "main-thread",
|
|
5977
|
-
handler: async (e, r) =>
|
|
6098
|
+
handler: async (e, r) => j("sidepanel_append", e),
|
|
5978
6099
|
paramTypes: [
|
|
5979
6100
|
{
|
|
5980
6101
|
name: "refId",
|
|
@@ -6004,7 +6125,7 @@ m({
|
|
|
6004
6125
|
namespace: "sidepanel",
|
|
6005
6126
|
name: "url",
|
|
6006
6127
|
description: "Get the sidepanel URL",
|
|
6007
|
-
params:
|
|
6128
|
+
params: yo,
|
|
6008
6129
|
returns: t.string(),
|
|
6009
6130
|
owner: "main-thread",
|
|
6010
6131
|
handler: async (e, r) => window.location.href,
|
|
@@ -6018,7 +6139,7 @@ m({
|
|
|
6018
6139
|
namespace: "sidepanel",
|
|
6019
6140
|
name: "title",
|
|
6020
6141
|
description: "Get the sidepanel title",
|
|
6021
|
-
params:
|
|
6142
|
+
params: _o,
|
|
6022
6143
|
returns: t.string(),
|
|
6023
6144
|
owner: "main-thread",
|
|
6024
6145
|
handler: async (e, r) => document.title,
|
|
@@ -6032,7 +6153,7 @@ m({
|
|
|
6032
6153
|
namespace: "sidepanel",
|
|
6033
6154
|
name: "wait",
|
|
6034
6155
|
description: "Wait in the sidepanel",
|
|
6035
|
-
params:
|
|
6156
|
+
params: wo,
|
|
6036
6157
|
returns: t.boolean(),
|
|
6037
6158
|
fields: ["duration"],
|
|
6038
6159
|
owner: "main-thread",
|
|
@@ -6056,7 +6177,7 @@ m({
|
|
|
6056
6177
|
namespace: "sidepanel",
|
|
6057
6178
|
name: "snapshot",
|
|
6058
6179
|
description: "Capture sidepanel DOM snapshot",
|
|
6059
|
-
params:
|
|
6180
|
+
params: ko,
|
|
6060
6181
|
returns: t.string(),
|
|
6061
6182
|
owner: "main-thread",
|
|
6062
6183
|
handler: async (e, r) => {
|
|
@@ -6094,7 +6215,7 @@ m({
|
|
|
6094
6215
|
namespace: "sidepanel",
|
|
6095
6216
|
name: "snapshot_text",
|
|
6096
6217
|
description: "Capture sidepanel DOM snapshot and return text representation",
|
|
6097
|
-
params:
|
|
6218
|
+
params: Io,
|
|
6098
6219
|
returns: t.string(),
|
|
6099
6220
|
owner: "main-thread",
|
|
6100
6221
|
handler: async (e, r) => {
|
|
@@ -6132,8 +6253,8 @@ m({
|
|
|
6132
6253
|
namespace: "sidepanel",
|
|
6133
6254
|
name: "snapshot_data",
|
|
6134
6255
|
description: "Get sidepanel snapshot data",
|
|
6135
|
-
params:
|
|
6136
|
-
returns:
|
|
6256
|
+
params: vo,
|
|
6257
|
+
returns: $t,
|
|
6137
6258
|
owner: "main-thread",
|
|
6138
6259
|
handler: async (e, r) => {
|
|
6139
6260
|
const n = await xe(e);
|
|
@@ -6143,7 +6264,7 @@ m({
|
|
|
6143
6264
|
n.error.code,
|
|
6144
6265
|
n.error.category
|
|
6145
6266
|
);
|
|
6146
|
-
return
|
|
6267
|
+
return v(n);
|
|
6147
6268
|
},
|
|
6148
6269
|
paramTypes: [
|
|
6149
6270
|
{
|
|
@@ -6168,8 +6289,8 @@ m({
|
|
|
6168
6289
|
namespace: "dom",
|
|
6169
6290
|
name: "snapshot",
|
|
6170
6291
|
description: "Take a DOM snapshot",
|
|
6171
|
-
params:
|
|
6172
|
-
returns:
|
|
6292
|
+
params: Eo,
|
|
6293
|
+
returns: $t,
|
|
6173
6294
|
owner: "main-thread",
|
|
6174
6295
|
handler: async (e, r) => {
|
|
6175
6296
|
const n = await xe(e);
|
|
@@ -6179,7 +6300,7 @@ m({
|
|
|
6179
6300
|
n.error.code,
|
|
6180
6301
|
n.error.category
|
|
6181
6302
|
);
|
|
6182
|
-
return
|
|
6303
|
+
return v(n);
|
|
6183
6304
|
},
|
|
6184
6305
|
paramTypes: [
|
|
6185
6306
|
{
|
|
@@ -6204,10 +6325,10 @@ m({
|
|
|
6204
6325
|
namespace: "dom",
|
|
6205
6326
|
name: "format",
|
|
6206
6327
|
description: "Format a DOM snapshot",
|
|
6207
|
-
params:
|
|
6328
|
+
params: xo,
|
|
6208
6329
|
returns: t.string(),
|
|
6209
6330
|
owner: "main-thread",
|
|
6210
|
-
handler: async (e, r) =>
|
|
6331
|
+
handler: async (e, r) => v(await Vn(e)),
|
|
6211
6332
|
paramTypes: [
|
|
6212
6333
|
{
|
|
6213
6334
|
name: "snapshot",
|
|
@@ -6231,11 +6352,11 @@ m({
|
|
|
6231
6352
|
namespace: "web.tab",
|
|
6232
6353
|
name: "query",
|
|
6233
6354
|
description: "Query tabs",
|
|
6234
|
-
params:
|
|
6355
|
+
params: Ke,
|
|
6235
6356
|
returns: ne,
|
|
6236
6357
|
owner: "main-thread",
|
|
6237
6358
|
handler: async (e, r) => {
|
|
6238
|
-
const n =
|
|
6359
|
+
const n = v(
|
|
6239
6360
|
await x("chrome_tabs_query", [e])
|
|
6240
6361
|
);
|
|
6241
6362
|
if (n == null) return [];
|
|
@@ -6270,10 +6391,10 @@ m({
|
|
|
6270
6391
|
aliases: [{ namespace: "tab", name: "current" }],
|
|
6271
6392
|
owner: "main-thread",
|
|
6272
6393
|
handler: async (e, r) => {
|
|
6273
|
-
const n = await
|
|
6394
|
+
const n = await ht();
|
|
6274
6395
|
if (n === null)
|
|
6275
6396
|
throw new Error("No active tab available");
|
|
6276
|
-
const a =
|
|
6397
|
+
const a = v(
|
|
6277
6398
|
await x("chrome_tabs_get", [n])
|
|
6278
6399
|
);
|
|
6279
6400
|
return { ...a, tabId: typeof a.id == "number" ? a.id : n };
|
|
@@ -6289,14 +6410,14 @@ m({
|
|
|
6289
6410
|
namespace: "web.tab",
|
|
6290
6411
|
name: "get",
|
|
6291
6412
|
description: "Get a tab by id",
|
|
6292
|
-
params:
|
|
6413
|
+
params: ea,
|
|
6293
6414
|
returns: N,
|
|
6294
6415
|
fields: ["tabId"],
|
|
6295
6416
|
aliases: [{ namespace: "tab", name: "get", fields: ["tabId"] }],
|
|
6296
6417
|
owner: "main-thread",
|
|
6297
6418
|
handler: async (e, r) => {
|
|
6298
|
-
const n = te(
|
|
6299
|
-
return
|
|
6419
|
+
const n = te(H(e));
|
|
6420
|
+
return v(await x("chrome_tabs_get", [n]));
|
|
6300
6421
|
},
|
|
6301
6422
|
paramTypes: [
|
|
6302
6423
|
{
|
|
@@ -6316,11 +6437,11 @@ m({
|
|
|
6316
6437
|
namespace: "web.tab",
|
|
6317
6438
|
name: "find",
|
|
6318
6439
|
description: "Find tabs matching a query",
|
|
6319
|
-
params:
|
|
6440
|
+
params: Ke,
|
|
6320
6441
|
returns: ne,
|
|
6321
6442
|
aliases: [{ namespace: "tab", name: "find" }],
|
|
6322
6443
|
owner: "main-thread",
|
|
6323
|
-
handler: async (e, r) =>
|
|
6444
|
+
handler: async (e, r) => v(await x("chrome_tabs_query", [e])),
|
|
6324
6445
|
paramTypes: [
|
|
6325
6446
|
{
|
|
6326
6447
|
name: "query",
|
|
@@ -6343,7 +6464,7 @@ m({
|
|
|
6343
6464
|
returns: ne,
|
|
6344
6465
|
aliases: [{ namespace: "tab", name: "list" }],
|
|
6345
6466
|
owner: "main-thread",
|
|
6346
|
-
handler: async (e, r) =>
|
|
6467
|
+
handler: async (e, r) => v(await x("chrome_tabs_query", [{}])),
|
|
6347
6468
|
paramTypes: [],
|
|
6348
6469
|
returnDoc: "All tabs",
|
|
6349
6470
|
errorCode: "ECHROME",
|
|
@@ -6355,12 +6476,24 @@ m({
|
|
|
6355
6476
|
namespace: "web.tab",
|
|
6356
6477
|
name: "create",
|
|
6357
6478
|
description: "Create a tab",
|
|
6358
|
-
params:
|
|
6479
|
+
params: Xt,
|
|
6359
6480
|
returns: N,
|
|
6360
6481
|
fields: ["url"],
|
|
6361
6482
|
aliases: [{ namespace: "tab", name: "create", fields: ["url"] }],
|
|
6362
6483
|
owner: "main-thread",
|
|
6363
|
-
handler: async (e, r) =>
|
|
6484
|
+
handler: async (e, r) => {
|
|
6485
|
+
const n = e, { waitForReady: a, ...o } = n, i = v(
|
|
6486
|
+
await x("chrome_tabs_create", [o])
|
|
6487
|
+
), s = i.tabId ?? i.id;
|
|
6488
|
+
return typeof s == "number" && n.url && n.waitForReady !== !1 && (n.url.startsWith("http:") || n.url.startsWith("https:")) ? Ze({
|
|
6489
|
+
tabId: s,
|
|
6490
|
+
url: n.url,
|
|
6491
|
+
preNavigationUrl: i.url,
|
|
6492
|
+
timeoutMs: Q,
|
|
6493
|
+
traceId: r.runId ?? "?",
|
|
6494
|
+
logPrefix: "tab_create"
|
|
6495
|
+
}) : i;
|
|
6496
|
+
},
|
|
6364
6497
|
paramTypes: [
|
|
6365
6498
|
{
|
|
6366
6499
|
name: "url",
|
|
@@ -6373,26 +6506,38 @@ m({
|
|
|
6373
6506
|
type: "boolean",
|
|
6374
6507
|
required: !1,
|
|
6375
6508
|
description: "Whether to focus the new tab (literal)"
|
|
6509
|
+
},
|
|
6510
|
+
{
|
|
6511
|
+
name: "waitForReady",
|
|
6512
|
+
type: "boolean",
|
|
6513
|
+
required: !1,
|
|
6514
|
+
description: "Wait for page load and content-script readiness before returning. Defaults to true for http(s) URLs; set false for raw immediate tab creation."
|
|
6376
6515
|
}
|
|
6377
6516
|
],
|
|
6378
6517
|
returnDoc: "Created tab",
|
|
6379
6518
|
errorCode: "ECHROME",
|
|
6380
6519
|
errorCategory: "extension",
|
|
6381
|
-
example: 'web.tab.create("https://example.com")'
|
|
6520
|
+
example: 'web.tab.create("https://example.com")',
|
|
6521
|
+
agentMeta: {
|
|
6522
|
+
notes: [
|
|
6523
|
+
"For http(s) URLs, web.tab.create waits for page load/content-script readiness by default. Set waitForReady: false for raw immediate tab creation; call web.tab.goto({ tabId, url }) before snapshot/click/fill if Chrome has not committed the inactive tab URL."
|
|
6524
|
+
],
|
|
6525
|
+
relatedApis: ["web.tab.goto", "web.tab.wait_for_load", "web.tab.snapshot"]
|
|
6526
|
+
}
|
|
6382
6527
|
});
|
|
6383
6528
|
m({
|
|
6384
6529
|
action: "tab_activate",
|
|
6385
6530
|
namespace: "web.tab",
|
|
6386
6531
|
name: "activate",
|
|
6387
6532
|
description: "Activate a tab",
|
|
6388
|
-
params:
|
|
6533
|
+
params: Jt,
|
|
6389
6534
|
returns: N,
|
|
6390
6535
|
owner: "main-thread",
|
|
6391
6536
|
handler: async (e, r) => {
|
|
6392
6537
|
const n = typeof e == "number" ? e : te(e);
|
|
6393
6538
|
if (n === null)
|
|
6394
6539
|
throw y("tab_activate requires a tabId", "E_MISSING_PARAM");
|
|
6395
|
-
return
|
|
6540
|
+
return v(
|
|
6396
6541
|
await x("chrome_tabs_update", [n, { active: !0 }])
|
|
6397
6542
|
);
|
|
6398
6543
|
},
|
|
@@ -6413,14 +6558,14 @@ m({
|
|
|
6413
6558
|
namespace: "web.tab",
|
|
6414
6559
|
name: "close",
|
|
6415
6560
|
description: "Close a tab",
|
|
6416
|
-
params:
|
|
6561
|
+
params: Go,
|
|
6417
6562
|
returns: t.null(),
|
|
6418
6563
|
owner: "main-thread",
|
|
6419
6564
|
handler: async (e, r) => {
|
|
6420
6565
|
const n = typeof e == "number" ? e : te(e);
|
|
6421
6566
|
if (n === null)
|
|
6422
6567
|
throw y("tab_close requires a tabId", "E_MISSING_PARAM");
|
|
6423
|
-
return
|
|
6568
|
+
return v(await x("chrome_tabs_remove", [n]));
|
|
6424
6569
|
},
|
|
6425
6570
|
paramTypes: [
|
|
6426
6571
|
{
|
|
@@ -6434,21 +6579,23 @@ m({
|
|
|
6434
6579
|
errorCode: "E_MISSING_PARAM",
|
|
6435
6580
|
example: "web.tab.close(123)"
|
|
6436
6581
|
});
|
|
6437
|
-
for (const e of
|
|
6582
|
+
for (const e of rr.filter(
|
|
6438
6583
|
(r) => r.namespace === "web.tab"
|
|
6439
6584
|
))
|
|
6440
|
-
|
|
6585
|
+
nr(e);
|
|
6441
6586
|
m({
|
|
6442
6587
|
action: "tab_wait_for_load",
|
|
6443
6588
|
namespace: "web.tab",
|
|
6444
6589
|
name: "wait_for_load",
|
|
6445
6590
|
description: "Wait for tab to load",
|
|
6446
|
-
params:
|
|
6591
|
+
params: li,
|
|
6447
6592
|
returns: t.boolean(),
|
|
6448
6593
|
owner: "main-thread",
|
|
6449
6594
|
handler: async (e, r) => {
|
|
6450
|
-
const n =
|
|
6451
|
-
|
|
6595
|
+
const n = H(e), a = te(e), o = typeof n.timeout == "number" ? n.timeout : 3e4;
|
|
6596
|
+
if (a === null)
|
|
6597
|
+
throw y("tab_wait_for_load requires a tabId", "E_MISSING_PARAM");
|
|
6598
|
+
return v(await er(a, o)), v(await Te(a, o)), !0;
|
|
6452
6599
|
},
|
|
6453
6600
|
paramTypes: [
|
|
6454
6601
|
{
|
|
@@ -6473,12 +6620,12 @@ m({
|
|
|
6473
6620
|
namespace: "web.tab",
|
|
6474
6621
|
name: "goto",
|
|
6475
6622
|
description: "Navigate a specific tab to a URL (tab-scoped; avoids active-tab global state)",
|
|
6476
|
-
params:
|
|
6623
|
+
params: bi,
|
|
6477
6624
|
returns: N,
|
|
6478
6625
|
fields: ["url"],
|
|
6479
6626
|
owner: "main-thread",
|
|
6480
6627
|
handler: async (e, r) => {
|
|
6481
|
-
const n = te(
|
|
6628
|
+
const n = te(H(e));
|
|
6482
6629
|
if (n === null)
|
|
6483
6630
|
throw y("tab_goto requires a tabId", "E_MISSING_PARAM");
|
|
6484
6631
|
const a = r.runId ?? "?";
|
|
@@ -6487,7 +6634,7 @@ m({
|
|
|
6487
6634
|
tabId: n,
|
|
6488
6635
|
url: e.url,
|
|
6489
6636
|
waitUntil: e.waitUntil ?? "load",
|
|
6490
|
-
timeoutMs: Number(e.timeout) ||
|
|
6637
|
+
timeoutMs: Number(e.timeout) || Q
|
|
6491
6638
|
}), !e.url.startsWith("http:") && !e.url.startsWith("https:"))
|
|
6492
6639
|
throw y(
|
|
6493
6640
|
`Navigation blocked: URL scheme not supported (${e.url})`,
|
|
@@ -6515,8 +6662,8 @@ m({
|
|
|
6515
6662
|
"E_PERMISSION",
|
|
6516
6663
|
"navigation"
|
|
6517
6664
|
);
|
|
6518
|
-
const c = Number(e.timeout) ||
|
|
6519
|
-
return
|
|
6665
|
+
const c = Number(e.timeout) || Q;
|
|
6666
|
+
return Ze({
|
|
6520
6667
|
tabId: n,
|
|
6521
6668
|
url: e.url,
|
|
6522
6669
|
preNavigationUrl: s,
|
|
@@ -6551,8 +6698,8 @@ m({
|
|
|
6551
6698
|
errorCategory: "navigation",
|
|
6552
6699
|
example: 'web.tab.goto({ tabId: 42, url: "https://example.com" })'
|
|
6553
6700
|
});
|
|
6554
|
-
const
|
|
6555
|
-
function w(e, r, n, a =
|
|
6701
|
+
const E = t.unknown(), k = t.union([t.null(), t.undefined(), t.boolean()]), J = k;
|
|
6702
|
+
function w(e, r, n, a = E, o, i) {
|
|
6556
6703
|
p(
|
|
6557
6704
|
e,
|
|
6558
6705
|
"chrome",
|
|
@@ -6672,7 +6819,7 @@ p(
|
|
|
6672
6819
|
"chrome",
|
|
6673
6820
|
"Clear an alarm",
|
|
6674
6821
|
["alarms"],
|
|
6675
|
-
|
|
6822
|
+
za,
|
|
6676
6823
|
"ECHROME",
|
|
6677
6824
|
"extension",
|
|
6678
6825
|
[
|
|
@@ -6823,7 +6970,7 @@ w(
|
|
|
6823
6970
|
"chrome_browsingData_remove",
|
|
6824
6971
|
["browsingData"],
|
|
6825
6972
|
"Remove browsing data",
|
|
6826
|
-
|
|
6973
|
+
E,
|
|
6827
6974
|
"chrome.browsingData.remove({ since: 0 })",
|
|
6828
6975
|
"null"
|
|
6829
6976
|
);
|
|
@@ -6831,7 +6978,7 @@ w(
|
|
|
6831
6978
|
"chrome_browsingData_removeCache",
|
|
6832
6979
|
["browsingData"],
|
|
6833
6980
|
"Remove cache",
|
|
6834
|
-
|
|
6981
|
+
E,
|
|
6835
6982
|
"chrome.browsingData.removeCache({ since: 0 })",
|
|
6836
6983
|
"null"
|
|
6837
6984
|
);
|
|
@@ -6839,7 +6986,7 @@ w(
|
|
|
6839
6986
|
"chrome_browsingData_removeCookies",
|
|
6840
6987
|
["browsingData"],
|
|
6841
6988
|
"Remove cookies",
|
|
6842
|
-
|
|
6989
|
+
E,
|
|
6843
6990
|
"chrome.browsingData.removeCookies({ since: 0 })",
|
|
6844
6991
|
"null"
|
|
6845
6992
|
);
|
|
@@ -6847,7 +6994,7 @@ w(
|
|
|
6847
6994
|
"chrome_browsingData_removeDownloads",
|
|
6848
6995
|
["browsingData"],
|
|
6849
6996
|
"Remove downloads",
|
|
6850
|
-
|
|
6997
|
+
E,
|
|
6851
6998
|
"chrome.browsingData.removeDownloads({ since: 0 })",
|
|
6852
6999
|
"null"
|
|
6853
7000
|
);
|
|
@@ -6855,7 +7002,7 @@ w(
|
|
|
6855
7002
|
"chrome_browsingData_removeFormData",
|
|
6856
7003
|
["browsingData"],
|
|
6857
7004
|
"Remove form data",
|
|
6858
|
-
|
|
7005
|
+
E,
|
|
6859
7006
|
"chrome.browsingData.removeFormData({ since: 0 })",
|
|
6860
7007
|
"null"
|
|
6861
7008
|
);
|
|
@@ -6863,7 +7010,7 @@ w(
|
|
|
6863
7010
|
"chrome_browsingData_removeHistory",
|
|
6864
7011
|
["browsingData"],
|
|
6865
7012
|
"Remove history",
|
|
6866
|
-
|
|
7013
|
+
E,
|
|
6867
7014
|
"chrome.browsingData.removeHistory({ since: 0 })",
|
|
6868
7015
|
"null"
|
|
6869
7016
|
);
|
|
@@ -6871,7 +7018,7 @@ w(
|
|
|
6871
7018
|
"chrome_browsingData_removePasswords",
|
|
6872
7019
|
["browsingData"],
|
|
6873
7020
|
"Remove passwords",
|
|
6874
|
-
|
|
7021
|
+
J,
|
|
6875
7022
|
"chrome.browsingData.removePasswords({ since: 0 })",
|
|
6876
7023
|
"null"
|
|
6877
7024
|
);
|
|
@@ -6880,7 +7027,7 @@ p(
|
|
|
6880
7027
|
"chrome",
|
|
6881
7028
|
"Create a context menu",
|
|
6882
7029
|
["contextMenus"],
|
|
6883
|
-
|
|
7030
|
+
Za,
|
|
6884
7031
|
"ECHROME",
|
|
6885
7032
|
"extension",
|
|
6886
7033
|
[],
|
|
@@ -6964,7 +7111,7 @@ p(
|
|
|
6964
7111
|
"chrome",
|
|
6965
7112
|
"Get all cookies",
|
|
6966
7113
|
["cookies"],
|
|
6967
|
-
|
|
7114
|
+
Bt,
|
|
6968
7115
|
"ECHROME",
|
|
6969
7116
|
"extension",
|
|
6970
7117
|
[],
|
|
@@ -6974,7 +7121,7 @@ w(
|
|
|
6974
7121
|
"chrome_declarativeNetRequest_getDynamicRules",
|
|
6975
7122
|
["declarativeNetRequest"],
|
|
6976
7123
|
"Get dynamic DNR rules",
|
|
6977
|
-
|
|
7124
|
+
E,
|
|
6978
7125
|
"chrome.declarativeNetRequest.getDynamicRules()",
|
|
6979
7126
|
"Rule[]"
|
|
6980
7127
|
);
|
|
@@ -6982,7 +7129,7 @@ w(
|
|
|
6982
7129
|
"chrome_declarativeNetRequest_getEnabledRulesets",
|
|
6983
7130
|
["declarativeNetRequest"],
|
|
6984
7131
|
"Get enabled DNR rulesets",
|
|
6985
|
-
|
|
7132
|
+
E,
|
|
6986
7133
|
"chrome.declarativeNetRequest.getEnabledRulesets()",
|
|
6987
7134
|
"RulesetInfo[]"
|
|
6988
7135
|
);
|
|
@@ -6990,7 +7137,7 @@ w(
|
|
|
6990
7137
|
"chrome_declarativeNetRequest_getSessionRules",
|
|
6991
7138
|
["declarativeNetRequest"],
|
|
6992
7139
|
"Get session DNR rules",
|
|
6993
|
-
|
|
7140
|
+
E,
|
|
6994
7141
|
"chrome.declarativeNetRequest.getSessionRules()",
|
|
6995
7142
|
"Rule[]"
|
|
6996
7143
|
);
|
|
@@ -6998,7 +7145,7 @@ w(
|
|
|
6998
7145
|
"chrome_declarativeNetRequest_updateDynamicRules",
|
|
6999
7146
|
["declarativeNetRequest"],
|
|
7000
7147
|
"Update dynamic DNR rules",
|
|
7001
|
-
|
|
7148
|
+
E,
|
|
7002
7149
|
"chrome.declarativeNetRequest.updateDynamicRules({ addRules: [] })",
|
|
7003
7150
|
"null"
|
|
7004
7151
|
);
|
|
@@ -7006,7 +7153,7 @@ w(
|
|
|
7006
7153
|
"chrome_declarativeNetRequest_updateEnabledRulesets",
|
|
7007
7154
|
["declarativeNetRequest"],
|
|
7008
7155
|
"Update enabled DNR rulesets",
|
|
7009
|
-
|
|
7156
|
+
E,
|
|
7010
7157
|
"chrome.declarativeNetRequest.updateEnabledRulesets({ enableRulesetIds: [] })",
|
|
7011
7158
|
"null"
|
|
7012
7159
|
);
|
|
@@ -7014,7 +7161,7 @@ w(
|
|
|
7014
7161
|
"chrome_declarativeNetRequest_updateSessionRules",
|
|
7015
7162
|
["declarativeNetRequest"],
|
|
7016
7163
|
"Update session DNR rules",
|
|
7017
|
-
|
|
7164
|
+
E,
|
|
7018
7165
|
"chrome.declarativeNetRequest.updateSessionRules({ addRules: [] })",
|
|
7019
7166
|
"null"
|
|
7020
7167
|
);
|
|
@@ -7022,7 +7169,7 @@ w(
|
|
|
7022
7169
|
"chrome_desktopCapture_chooseDesktopMedia",
|
|
7023
7170
|
["desktopCapture"],
|
|
7024
7171
|
"Choose desktop media",
|
|
7025
|
-
|
|
7172
|
+
E,
|
|
7026
7173
|
'chrome.desktopCapture.chooseDesktopMedia(["screen"], (id) => id)',
|
|
7027
7174
|
"string"
|
|
7028
7175
|
);
|
|
@@ -7030,7 +7177,7 @@ w(
|
|
|
7030
7177
|
"chrome_desktopCapture_cancelChooseDesktopMedia",
|
|
7031
7178
|
["desktopCapture"],
|
|
7032
7179
|
"Cancel desktop media picker",
|
|
7033
|
-
|
|
7180
|
+
E,
|
|
7034
7181
|
"chrome.desktopCapture.cancelChooseDesktopMedia(123)",
|
|
7035
7182
|
"null"
|
|
7036
7183
|
);
|
|
@@ -7039,7 +7186,7 @@ p(
|
|
|
7039
7186
|
"chrome",
|
|
7040
7187
|
"Download a file",
|
|
7041
7188
|
["downloads"],
|
|
7042
|
-
|
|
7189
|
+
to,
|
|
7043
7190
|
"ECHROME",
|
|
7044
7191
|
"extension",
|
|
7045
7192
|
[],
|
|
@@ -7050,7 +7197,7 @@ p(
|
|
|
7050
7197
|
"chrome",
|
|
7051
7198
|
"Search downloads",
|
|
7052
7199
|
["downloads"],
|
|
7053
|
-
|
|
7200
|
+
Zt,
|
|
7054
7201
|
"ECHROME",
|
|
7055
7202
|
"extension",
|
|
7056
7203
|
[],
|
|
@@ -7061,7 +7208,7 @@ p(
|
|
|
7061
7208
|
"chrome",
|
|
7062
7209
|
"Erase downloads",
|
|
7063
7210
|
["downloads"],
|
|
7064
|
-
|
|
7211
|
+
Zt,
|
|
7065
7212
|
"ECHROME",
|
|
7066
7213
|
"extension",
|
|
7067
7214
|
[],
|
|
@@ -7138,7 +7285,7 @@ p(
|
|
|
7138
7285
|
"chrome",
|
|
7139
7286
|
"Search history",
|
|
7140
7287
|
["history"],
|
|
7141
|
-
|
|
7288
|
+
Ge,
|
|
7142
7289
|
"ECHROME",
|
|
7143
7290
|
"extension",
|
|
7144
7291
|
[],
|
|
@@ -7200,7 +7347,7 @@ p(
|
|
|
7200
7347
|
"chrome",
|
|
7201
7348
|
"Get visits for URL",
|
|
7202
7349
|
["history"],
|
|
7203
|
-
|
|
7350
|
+
Ge,
|
|
7204
7351
|
"ECHROME",
|
|
7205
7352
|
"extension",
|
|
7206
7353
|
[],
|
|
@@ -7210,7 +7357,7 @@ w(
|
|
|
7210
7357
|
"chrome_identity_getAuthToken",
|
|
7211
7358
|
["identity"],
|
|
7212
7359
|
"Get OAuth auth token",
|
|
7213
|
-
|
|
7360
|
+
E,
|
|
7214
7361
|
"chrome.identity.getAuthToken({ interactive: true })",
|
|
7215
7362
|
"{ accessToken: string }"
|
|
7216
7363
|
);
|
|
@@ -7218,7 +7365,7 @@ w(
|
|
|
7218
7365
|
"chrome_identity_getProfileUserInfo",
|
|
7219
7366
|
["identity"],
|
|
7220
7367
|
"Get profile user info",
|
|
7221
|
-
|
|
7368
|
+
E,
|
|
7222
7369
|
"chrome.identity.getProfileUserInfo()",
|
|
7223
7370
|
"{ email: string, id: string }"
|
|
7224
7371
|
);
|
|
@@ -7226,7 +7373,7 @@ w(
|
|
|
7226
7373
|
"chrome_identity_launchWebAuthFlow",
|
|
7227
7374
|
["identity"],
|
|
7228
7375
|
"Launch web auth flow",
|
|
7229
|
-
|
|
7376
|
+
E,
|
|
7230
7377
|
'chrome.identity.launchWebAuthFlow({ url: "https://example.com/auth" })',
|
|
7231
7378
|
"string"
|
|
7232
7379
|
);
|
|
@@ -7234,7 +7381,7 @@ w(
|
|
|
7234
7381
|
"chrome_idle_queryState",
|
|
7235
7382
|
["idle"],
|
|
7236
7383
|
"Query idle state",
|
|
7237
|
-
|
|
7384
|
+
E,
|
|
7238
7385
|
"chrome.idle.queryState(60)",
|
|
7239
7386
|
'"active" | "idle" | "locked"'
|
|
7240
7387
|
);
|
|
@@ -7242,7 +7389,7 @@ w(
|
|
|
7242
7389
|
"chrome_management_get",
|
|
7243
7390
|
["management"],
|
|
7244
7391
|
"Get extension info",
|
|
7245
|
-
|
|
7392
|
+
E,
|
|
7246
7393
|
'chrome.management.get("extensionId")',
|
|
7247
7394
|
"ExtensionInfo"
|
|
7248
7395
|
);
|
|
@@ -7250,7 +7397,7 @@ w(
|
|
|
7250
7397
|
"chrome_management_getAll",
|
|
7251
7398
|
["management"],
|
|
7252
7399
|
"Get all extensions",
|
|
7253
|
-
|
|
7400
|
+
E,
|
|
7254
7401
|
"chrome.management.getAll()",
|
|
7255
7402
|
"ExtensionInfo[]"
|
|
7256
7403
|
);
|
|
@@ -7258,7 +7405,7 @@ w(
|
|
|
7258
7405
|
"chrome_management_setEnabled",
|
|
7259
7406
|
["management"],
|
|
7260
7407
|
"Enable or disable extension",
|
|
7261
|
-
|
|
7408
|
+
J,
|
|
7262
7409
|
'chrome.management.setEnabled("extensionId", true)',
|
|
7263
7410
|
"null"
|
|
7264
7411
|
);
|
|
@@ -7266,7 +7413,7 @@ w(
|
|
|
7266
7413
|
"chrome_management_uninstall",
|
|
7267
7414
|
["management"],
|
|
7268
7415
|
"Uninstall extension",
|
|
7269
|
-
|
|
7416
|
+
J,
|
|
7270
7417
|
'chrome.management.uninstall("extensionId")',
|
|
7271
7418
|
"null"
|
|
7272
7419
|
);
|
|
@@ -7275,7 +7422,7 @@ p(
|
|
|
7275
7422
|
"chrome",
|
|
7276
7423
|
"Create a notification",
|
|
7277
7424
|
["notifications"],
|
|
7278
|
-
|
|
7425
|
+
Kt,
|
|
7279
7426
|
"ECHROME",
|
|
7280
7427
|
"extension",
|
|
7281
7428
|
[
|
|
@@ -7299,7 +7446,7 @@ p(
|
|
|
7299
7446
|
"chrome",
|
|
7300
7447
|
"Clear a notification",
|
|
7301
7448
|
["notifications"],
|
|
7302
|
-
|
|
7449
|
+
Vt,
|
|
7303
7450
|
"ECHROME",
|
|
7304
7451
|
"extension",
|
|
7305
7452
|
[
|
|
@@ -7339,7 +7486,7 @@ w(
|
|
|
7339
7486
|
"chrome_offscreen_closeDocument",
|
|
7340
7487
|
["offscreen"],
|
|
7341
7488
|
"Close offscreen document",
|
|
7342
|
-
|
|
7489
|
+
J,
|
|
7343
7490
|
"chrome.offscreen.closeDocument()",
|
|
7344
7491
|
"null"
|
|
7345
7492
|
);
|
|
@@ -7347,7 +7494,7 @@ w(
|
|
|
7347
7494
|
"chrome_offscreen_createDocument",
|
|
7348
7495
|
["offscreen"],
|
|
7349
7496
|
"Create offscreen document",
|
|
7350
|
-
|
|
7497
|
+
E,
|
|
7351
7498
|
'chrome.offscreen.createDocument({ url: "offscreen.html", reasons: ["WORKERS"] })',
|
|
7352
7499
|
"null"
|
|
7353
7500
|
);
|
|
@@ -7355,11 +7502,11 @@ w(
|
|
|
7355
7502
|
"chrome_pageCapture_saveAsMHTML",
|
|
7356
7503
|
["pageCapture"],
|
|
7357
7504
|
"Save page as MHTML",
|
|
7358
|
-
|
|
7505
|
+
E,
|
|
7359
7506
|
"chrome.pageCapture.saveAsMHTML({ tabId: 123 })",
|
|
7360
7507
|
"Blob"
|
|
7361
7508
|
);
|
|
7362
|
-
async function
|
|
7509
|
+
async function ar(e, r, n, a) {
|
|
7363
7510
|
var l;
|
|
7364
7511
|
const o = window.chrome;
|
|
7365
7512
|
if (!((l = o == null ? void 0 : o.runtime) != null && l.id))
|
|
@@ -7370,15 +7517,15 @@ async function rr(e, r, n, a) {
|
|
|
7370
7517
|
);
|
|
7371
7518
|
const i = je(
|
|
7372
7519
|
e,
|
|
7373
|
-
|
|
7374
|
-
), s =
|
|
7375
|
-
return await
|
|
7520
|
+
He(a, e)
|
|
7521
|
+
), s = vt(o, r, n), c = await Promise.resolve(It(s, i));
|
|
7522
|
+
return await gt(), c;
|
|
7376
7523
|
}
|
|
7377
7524
|
w(
|
|
7378
7525
|
"chrome_permissions_contains",
|
|
7379
7526
|
["permissions"],
|
|
7380
7527
|
"Check permission",
|
|
7381
|
-
|
|
7528
|
+
E,
|
|
7382
7529
|
'chrome.permissions.contains({ permissions: ["tabs"] })',
|
|
7383
7530
|
"boolean"
|
|
7384
7531
|
);
|
|
@@ -7386,7 +7533,7 @@ w(
|
|
|
7386
7533
|
"chrome_permissions_getAll",
|
|
7387
7534
|
["permissions"],
|
|
7388
7535
|
"Get all permissions",
|
|
7389
|
-
|
|
7536
|
+
E,
|
|
7390
7537
|
"chrome.permissions.getAll()",
|
|
7391
7538
|
"{ permissions: string[], origins: string[] }"
|
|
7392
7539
|
);
|
|
@@ -7396,10 +7543,10 @@ m({
|
|
|
7396
7543
|
name: "remove",
|
|
7397
7544
|
description: "Remove permissions",
|
|
7398
7545
|
params: t.unknown(),
|
|
7399
|
-
returns:
|
|
7546
|
+
returns: J,
|
|
7400
7547
|
owner: "main-thread",
|
|
7401
7548
|
returnType: "boolean",
|
|
7402
|
-
handler: async (e) =>
|
|
7549
|
+
handler: async (e) => ar(
|
|
7403
7550
|
"chrome_permissions_remove",
|
|
7404
7551
|
["permissions"],
|
|
7405
7552
|
"remove",
|
|
@@ -7416,10 +7563,10 @@ m({
|
|
|
7416
7563
|
name: "request",
|
|
7417
7564
|
description: "Request permissions",
|
|
7418
7565
|
params: t.unknown(),
|
|
7419
|
-
returns:
|
|
7566
|
+
returns: J,
|
|
7420
7567
|
owner: "main-thread",
|
|
7421
7568
|
returnType: "boolean",
|
|
7422
|
-
handler: async (e) =>
|
|
7569
|
+
handler: async (e) => ar(
|
|
7423
7570
|
"chrome_permissions_request",
|
|
7424
7571
|
["permissions"],
|
|
7425
7572
|
"request",
|
|
@@ -7482,7 +7629,7 @@ p(
|
|
|
7482
7629
|
"chrome",
|
|
7483
7630
|
"Execute a script",
|
|
7484
7631
|
["scripting"],
|
|
7485
|
-
|
|
7632
|
+
Va,
|
|
7486
7633
|
"ECHROME",
|
|
7487
7634
|
"extension",
|
|
7488
7635
|
[],
|
|
@@ -7493,7 +7640,7 @@ p(
|
|
|
7493
7640
|
"chrome",
|
|
7494
7641
|
"Insert CSS into a tab",
|
|
7495
7642
|
["scripting"],
|
|
7496
|
-
|
|
7643
|
+
E,
|
|
7497
7644
|
"ECHROME",
|
|
7498
7645
|
"extension",
|
|
7499
7646
|
[],
|
|
@@ -7505,7 +7652,7 @@ p(
|
|
|
7505
7652
|
"chrome",
|
|
7506
7653
|
"Remove CSS from a tab",
|
|
7507
7654
|
["scripting"],
|
|
7508
|
-
|
|
7655
|
+
E,
|
|
7509
7656
|
"ECHROME",
|
|
7510
7657
|
"extension",
|
|
7511
7658
|
[],
|
|
@@ -7517,7 +7664,7 @@ p(
|
|
|
7517
7664
|
"chrome",
|
|
7518
7665
|
"Get recently closed sessions",
|
|
7519
7666
|
["sessions"],
|
|
7520
|
-
|
|
7667
|
+
Be,
|
|
7521
7668
|
"ECHROME",
|
|
7522
7669
|
"extension",
|
|
7523
7670
|
[],
|
|
@@ -7528,7 +7675,7 @@ p(
|
|
|
7528
7675
|
"chrome",
|
|
7529
7676
|
"Restore a session",
|
|
7530
7677
|
["sessions"],
|
|
7531
|
-
|
|
7678
|
+
Be,
|
|
7532
7679
|
"ECHROME",
|
|
7533
7680
|
"extension",
|
|
7534
7681
|
[
|
|
@@ -7546,7 +7693,7 @@ p(
|
|
|
7546
7693
|
"chrome",
|
|
7547
7694
|
"Get synced devices",
|
|
7548
7695
|
["sessions"],
|
|
7549
|
-
|
|
7696
|
+
Ya,
|
|
7550
7697
|
"ECHROME",
|
|
7551
7698
|
"extension",
|
|
7552
7699
|
[],
|
|
@@ -7579,7 +7726,7 @@ p(
|
|
|
7579
7726
|
"chrome",
|
|
7580
7727
|
"Get CPU info",
|
|
7581
7728
|
["system", "cpu"],
|
|
7582
|
-
|
|
7729
|
+
ro,
|
|
7583
7730
|
"ECHROME",
|
|
7584
7731
|
"extension",
|
|
7585
7732
|
[],
|
|
@@ -7590,7 +7737,7 @@ p(
|
|
|
7590
7737
|
"chrome",
|
|
7591
7738
|
"Get memory info",
|
|
7592
7739
|
["system", "memory"],
|
|
7593
|
-
|
|
7740
|
+
no,
|
|
7594
7741
|
"ECHROME",
|
|
7595
7742
|
"extension",
|
|
7596
7743
|
[],
|
|
@@ -7601,7 +7748,7 @@ p(
|
|
|
7601
7748
|
"chrome",
|
|
7602
7749
|
"Get storage info",
|
|
7603
7750
|
["system", "storage"],
|
|
7604
|
-
|
|
7751
|
+
ao,
|
|
7605
7752
|
"ECHROME",
|
|
7606
7753
|
"extension",
|
|
7607
7754
|
[],
|
|
@@ -7612,7 +7759,7 @@ p(
|
|
|
7612
7759
|
"chrome",
|
|
7613
7760
|
"Query tab groups",
|
|
7614
7761
|
["tabGroups"],
|
|
7615
|
-
|
|
7762
|
+
Xa,
|
|
7616
7763
|
"ECHROME",
|
|
7617
7764
|
"extension",
|
|
7618
7765
|
[],
|
|
@@ -7801,7 +7948,7 @@ w(
|
|
|
7801
7948
|
"chrome_topSites_get",
|
|
7802
7949
|
["topSites"],
|
|
7803
7950
|
"Get top sites",
|
|
7804
|
-
|
|
7951
|
+
E,
|
|
7805
7952
|
"chrome.topSites.get()",
|
|
7806
7953
|
"MostVisitedURL[]"
|
|
7807
7954
|
);
|
|
@@ -7809,7 +7956,7 @@ w(
|
|
|
7809
7956
|
"chrome_tts_getVoices",
|
|
7810
7957
|
["tts"],
|
|
7811
7958
|
"Get TTS voices",
|
|
7812
|
-
|
|
7959
|
+
E,
|
|
7813
7960
|
"chrome.tts.getVoices()",
|
|
7814
7961
|
"TtsVoice[]"
|
|
7815
7962
|
);
|
|
@@ -7817,7 +7964,7 @@ w(
|
|
|
7817
7964
|
"chrome_tts_speak",
|
|
7818
7965
|
["tts"],
|
|
7819
7966
|
"Speak text",
|
|
7820
|
-
|
|
7967
|
+
J,
|
|
7821
7968
|
'chrome.tts.speak("Hello world")',
|
|
7822
7969
|
"null"
|
|
7823
7970
|
);
|
|
@@ -7825,7 +7972,7 @@ w(
|
|
|
7825
7972
|
"chrome_tts_stop",
|
|
7826
7973
|
["tts"],
|
|
7827
7974
|
"Stop TTS",
|
|
7828
|
-
|
|
7975
|
+
J,
|
|
7829
7976
|
"chrome.tts.stop()",
|
|
7830
7977
|
"null"
|
|
7831
7978
|
);
|
|
@@ -7852,7 +7999,7 @@ p(
|
|
|
7852
7999
|
"chrome",
|
|
7853
8000
|
"Get all windows",
|
|
7854
8001
|
["windows"],
|
|
7855
|
-
|
|
8002
|
+
$a,
|
|
7856
8003
|
"ECHROME",
|
|
7857
8004
|
"extension",
|
|
7858
8005
|
[],
|
|
@@ -7898,7 +8045,7 @@ p(
|
|
|
7898
8045
|
],
|
|
7899
8046
|
"chrome.windows.remove(1)"
|
|
7900
8047
|
);
|
|
7901
|
-
function
|
|
8048
|
+
function Ni(e, r) {
|
|
7902
8049
|
if (r.length === 1 && typeof r[0] == "string")
|
|
7903
8050
|
switch (e) {
|
|
7904
8051
|
case "history_delete":
|
|
@@ -7917,7 +8064,7 @@ function _i(e, r) {
|
|
|
7917
8064
|
return [...r];
|
|
7918
8065
|
}
|
|
7919
8066
|
function F(e, r, n, a, o = [], i) {
|
|
7920
|
-
const s = e.split("_"), c = s[s.length - 1], l = s.length > 1 ? s[0] : "", d = l ? `web.${l}` : "web", u =
|
|
8067
|
+
const s = e.split("_"), c = s[s.length - 1], l = s.length > 1 ? s[0] : "", d = l ? `web.${l}` : "web", u = _t(r);
|
|
7921
8068
|
m({
|
|
7922
8069
|
action: e,
|
|
7923
8070
|
namespace: d,
|
|
@@ -7927,14 +8074,14 @@ function F(e, r, n, a, o = [], i) {
|
|
|
7927
8074
|
returns: a,
|
|
7928
8075
|
owner: "main-thread",
|
|
7929
8076
|
permission: u ?? void 0,
|
|
7930
|
-
handler: async (
|
|
8077
|
+
handler: async (b, h) => {
|
|
7931
8078
|
const S = f.child("alias");
|
|
7932
|
-
|
|
7933
|
-
const I =
|
|
8079
|
+
Le(e, u);
|
|
8080
|
+
const I = Ni(
|
|
7934
8081
|
e,
|
|
7935
|
-
|
|
8082
|
+
He(b, e)
|
|
7936
8083
|
);
|
|
7937
|
-
return S.debug("alias_dispatch", { action: e, target: r, argCount: I.length }),
|
|
8084
|
+
return S.debug("alias_dispatch", { action: e, target: r, argCount: I.length }), v(await x(r, I));
|
|
7938
8085
|
},
|
|
7939
8086
|
paramTypes: o,
|
|
7940
8087
|
returnDoc: "Alias result",
|
|
@@ -8016,7 +8163,7 @@ F(
|
|
|
8016
8163
|
"cookies_list",
|
|
8017
8164
|
"chrome_cookies_getAll",
|
|
8018
8165
|
"Get all cookies",
|
|
8019
|
-
|
|
8166
|
+
Bt,
|
|
8020
8167
|
[
|
|
8021
8168
|
{
|
|
8022
8169
|
name: "url",
|
|
@@ -8031,7 +8178,7 @@ F(
|
|
|
8031
8178
|
"history_search",
|
|
8032
8179
|
"chrome_history_search",
|
|
8033
8180
|
"Search history",
|
|
8034
|
-
|
|
8181
|
+
Ge,
|
|
8035
8182
|
[
|
|
8036
8183
|
{
|
|
8037
8184
|
name: "text",
|
|
@@ -8124,7 +8271,7 @@ F(
|
|
|
8124
8271
|
"notifications_create",
|
|
8125
8272
|
"chrome_notifications_create",
|
|
8126
8273
|
"Create a notification",
|
|
8127
|
-
|
|
8274
|
+
Kt,
|
|
8128
8275
|
[
|
|
8129
8276
|
{
|
|
8130
8277
|
name: "id",
|
|
@@ -8145,7 +8292,7 @@ F(
|
|
|
8145
8292
|
"notifications_clear",
|
|
8146
8293
|
"chrome_notifications_clear",
|
|
8147
8294
|
"Clear a notification",
|
|
8148
|
-
|
|
8295
|
+
Vt,
|
|
8149
8296
|
[
|
|
8150
8297
|
{
|
|
8151
8298
|
name: "id",
|
|
@@ -8161,13 +8308,13 @@ m({
|
|
|
8161
8308
|
namespace: "host",
|
|
8162
8309
|
name: "call",
|
|
8163
8310
|
description: "Call a host handler",
|
|
8164
|
-
params:
|
|
8165
|
-
returns:
|
|
8311
|
+
params: aa,
|
|
8312
|
+
returns: oa,
|
|
8166
8313
|
fields: ["action", "params"],
|
|
8167
8314
|
owner: "main-thread",
|
|
8168
8315
|
handler: async (e, r) => {
|
|
8169
|
-
const n =
|
|
8170
|
-
return
|
|
8316
|
+
const n = H(e), a = n.action, o = n.params;
|
|
8317
|
+
return v(await xt(a, o));
|
|
8171
8318
|
},
|
|
8172
8319
|
paramTypes: [
|
|
8173
8320
|
{
|
|
@@ -8188,19 +8335,19 @@ m({
|
|
|
8188
8335
|
errorCategory: "host",
|
|
8189
8336
|
example: 'host.call(["title", "url"])'
|
|
8190
8337
|
});
|
|
8191
|
-
const
|
|
8338
|
+
const Mi = /* @__PURE__ */ new Set([
|
|
8192
8339
|
"page_snapshot_text",
|
|
8193
8340
|
"page_snapshot_data",
|
|
8194
8341
|
"page_snapshot",
|
|
8195
8342
|
"page_snapshot_query"
|
|
8196
8343
|
]);
|
|
8197
|
-
function
|
|
8198
|
-
return
|
|
8344
|
+
function Di(e) {
|
|
8345
|
+
return Mi.has(e);
|
|
8199
8346
|
}
|
|
8200
|
-
function
|
|
8347
|
+
function qi(e) {
|
|
8201
8348
|
return e === "page_snapshot_text" || e === "page_snapshot";
|
|
8202
8349
|
}
|
|
8203
|
-
async function
|
|
8350
|
+
async function Oi(e) {
|
|
8204
8351
|
const r = window.chrome;
|
|
8205
8352
|
try {
|
|
8206
8353
|
const n = await new Promise((a, o) => {
|
|
@@ -8214,7 +8361,7 @@ async function vi(e) {
|
|
|
8214
8361
|
}
|
|
8215
8362
|
return [{ frameId: 0, url: "" }];
|
|
8216
8363
|
}
|
|
8217
|
-
async function
|
|
8364
|
+
async function Pi(e, r, n, a) {
|
|
8218
8365
|
const o = window.chrome;
|
|
8219
8366
|
return Promise.all(
|
|
8220
8367
|
e.map(async (i) => {
|
|
@@ -8231,7 +8378,7 @@ async function Ei(e, r, n, a) {
|
|
|
8231
8378
|
runId: r.runId
|
|
8232
8379
|
},
|
|
8233
8380
|
c
|
|
8234
|
-
), d =
|
|
8381
|
+
), d = Ve(l);
|
|
8235
8382
|
return d.ok ? typeof d.value == "string" ? {
|
|
8236
8383
|
frameId: i.frameId,
|
|
8237
8384
|
url: i.url,
|
|
@@ -8259,10 +8406,10 @@ async function Ei(e, r, n, a) {
|
|
|
8259
8406
|
})
|
|
8260
8407
|
);
|
|
8261
8408
|
}
|
|
8262
|
-
function
|
|
8409
|
+
function or(e, r) {
|
|
8263
8410
|
return r === 0 ? e : e.replace(/\[e(\d+)\]/g, (n, a) => `[f${r}_e${a}]`);
|
|
8264
8411
|
}
|
|
8265
|
-
function
|
|
8412
|
+
function Li(e, r) {
|
|
8266
8413
|
if (r === 0) return e;
|
|
8267
8414
|
const n = `f${r}_`;
|
|
8268
8415
|
return e.map((a) => ({
|
|
@@ -8271,7 +8418,7 @@ function xi(e, r) {
|
|
|
8271
8418
|
parentRefId: a.parentRefId ? n + a.parentRefId : void 0
|
|
8272
8419
|
}));
|
|
8273
8420
|
}
|
|
8274
|
-
function
|
|
8421
|
+
function ji(e) {
|
|
8275
8422
|
const r = [];
|
|
8276
8423
|
for (const n of e) {
|
|
8277
8424
|
if (!n.ok) {
|
|
@@ -8280,7 +8427,7 @@ function Si(e) {
|
|
|
8280
8427
|
);
|
|
8281
8428
|
continue;
|
|
8282
8429
|
}
|
|
8283
|
-
const a =
|
|
8430
|
+
const a = or(n.text ?? "", n.frameId);
|
|
8284
8431
|
n.frameId === 0 ? r.push(a) : r.push(`--- Frame ${n.frameId}: ${n.url} ---
|
|
8285
8432
|
${a}`);
|
|
8286
8433
|
}
|
|
@@ -8288,7 +8435,7 @@ ${a}`);
|
|
|
8288
8435
|
|
|
8289
8436
|
`);
|
|
8290
8437
|
}
|
|
8291
|
-
function
|
|
8438
|
+
function Hi(e) {
|
|
8292
8439
|
const r = [], n = [];
|
|
8293
8440
|
let a = "", o = "", i = { width: 0, height: 0 }, s;
|
|
8294
8441
|
for (const l of e) {
|
|
@@ -8298,7 +8445,7 @@ function Ti(e) {
|
|
|
8298
8445
|
);
|
|
8299
8446
|
continue;
|
|
8300
8447
|
}
|
|
8301
|
-
const d =
|
|
8448
|
+
const d = or(String(l.data.text ?? ""), l.frameId), u = Li(
|
|
8302
8449
|
Array.isArray(l.data.nodes) ? l.data.nodes : [],
|
|
8303
8450
|
l.frameId
|
|
8304
8451
|
);
|
|
@@ -8316,26 +8463,26 @@ ${d}`), n.push(...u);
|
|
|
8316
8463
|
};
|
|
8317
8464
|
return s && (c.observationId = s), c;
|
|
8318
8465
|
}
|
|
8319
|
-
async function
|
|
8320
|
-
const a = await
|
|
8321
|
-
return
|
|
8466
|
+
async function Ui(e, r, n) {
|
|
8467
|
+
const a = await Oi(r), o = await Pi(a, e, r, n);
|
|
8468
|
+
return qi(e.action) ? { ok: !0, value: ji(o) } : { ok: !0, value: Hi(o) };
|
|
8322
8469
|
}
|
|
8323
|
-
const
|
|
8324
|
-
function
|
|
8470
|
+
const Fi = /^f(\d+)_(e\d+)$/;
|
|
8471
|
+
function Wi(e) {
|
|
8325
8472
|
const r = typeof e.refId == "string" ? e.refId : void 0;
|
|
8326
8473
|
if (!r) return null;
|
|
8327
|
-
const n = r.match(
|
|
8474
|
+
const n = r.match(Fi);
|
|
8328
8475
|
return n ? { frameId: Number.parseInt(n[1], 10), localRefId: n[2] } : null;
|
|
8329
8476
|
}
|
|
8330
|
-
class
|
|
8477
|
+
class ir {
|
|
8331
8478
|
constructor() {
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8479
|
+
L(this, "worker", null);
|
|
8480
|
+
L(this, "pendingCalls", /* @__PURE__ */ new Map());
|
|
8481
|
+
L(this, "inFlightRelays", /* @__PURE__ */ new Map());
|
|
8482
|
+
L(this, "disposed", !1);
|
|
8483
|
+
L(this, "onCleanupComplete", null);
|
|
8484
|
+
L(this, "abortController", null);
|
|
8485
|
+
L(this, "runQueue", Promise.resolve());
|
|
8339
8486
|
}
|
|
8340
8487
|
/**
|
|
8341
8488
|
* Initialize the extension-js runtime.
|
|
@@ -8350,21 +8497,21 @@ class ar {
|
|
|
8350
8497
|
*/
|
|
8351
8498
|
static async init() {
|
|
8352
8499
|
var c;
|
|
8353
|
-
if (f.trace("init_start"),
|
|
8354
|
-
|
|
8355
|
-
const { initCapabilities: l } = await Promise.resolve().then(() =>
|
|
8500
|
+
if (f.trace("init_start"), Me(new AbortController()), typeof chrome < "u" && ((c = chrome.runtime) != null && c.id)) {
|
|
8501
|
+
Rr(chrome);
|
|
8502
|
+
const { initCapabilities: l } = await Promise.resolve().then(() => qr);
|
|
8356
8503
|
await l();
|
|
8357
8504
|
}
|
|
8358
|
-
const { freezeJsRegistry: r } = await Promise.resolve().then(() =>
|
|
8505
|
+
const { freezeJsRegistry: r } = await Promise.resolve().then(() => Xe);
|
|
8359
8506
|
r();
|
|
8360
|
-
const { getSerializableJsManifest: n } = await Promise.resolve().then(() =>
|
|
8507
|
+
const { getSerializableJsManifest: n } = await Promise.resolve().then(() => Xe), a = n(), o = new ir(), [i, s] = o.startWorker(a);
|
|
8361
8508
|
return await i, f.trace("init_ready"), [o, s];
|
|
8362
8509
|
}
|
|
8363
8510
|
startWorker(r) {
|
|
8364
8511
|
var d;
|
|
8365
8512
|
let n, a;
|
|
8366
|
-
const o = new Promise((u,
|
|
8367
|
-
n = u, a =
|
|
8513
|
+
const o = new Promise((u, b) => {
|
|
8514
|
+
n = u, a = b;
|
|
8368
8515
|
});
|
|
8369
8516
|
let i = () => {
|
|
8370
8517
|
};
|
|
@@ -8384,15 +8531,15 @@ class ar {
|
|
|
8384
8531
|
}, c.onmessageerror = (u) => {
|
|
8385
8532
|
a(new Error(`Worker message deserialization error: ${u.data}`));
|
|
8386
8533
|
}, c.onmessage = async (u) => {
|
|
8387
|
-
var
|
|
8388
|
-
const
|
|
8389
|
-
switch (
|
|
8534
|
+
var h;
|
|
8535
|
+
const b = u.data;
|
|
8536
|
+
switch (b.type) {
|
|
8390
8537
|
case "ready": {
|
|
8391
8538
|
c.onmessage = this.handleWorkerMessage.bind(this), n();
|
|
8392
8539
|
break;
|
|
8393
8540
|
}
|
|
8394
8541
|
case "error": {
|
|
8395
|
-
const S = typeof
|
|
8542
|
+
const S = typeof b.error == "string" ? b.error : ((h = b.error) == null ? void 0 : h.message) || "Worker init error";
|
|
8396
8543
|
a(new Error(S));
|
|
8397
8544
|
break;
|
|
8398
8545
|
}
|
|
@@ -8469,27 +8616,27 @@ class ar {
|
|
|
8469
8616
|
runId: n.runId,
|
|
8470
8617
|
tabPolicy: l
|
|
8471
8618
|
});
|
|
8472
|
-
const
|
|
8473
|
-
|
|
8619
|
+
const b = i;
|
|
8620
|
+
b.runId = n.runId, this.executeContextCommand(
|
|
8474
8621
|
c,
|
|
8475
|
-
|
|
8622
|
+
b,
|
|
8476
8623
|
l,
|
|
8477
8624
|
d,
|
|
8478
8625
|
u.signal
|
|
8479
|
-
).then((
|
|
8626
|
+
).then((h) => {
|
|
8480
8627
|
var S;
|
|
8481
|
-
if (!(u.signal.aborted && !(typeof
|
|
8628
|
+
if (!(u.signal.aborted && !(typeof h == "object" && h !== null && "ok" in h && h.ok === !0))) {
|
|
8482
8629
|
f.trace("asyncRelayResult", {
|
|
8483
8630
|
action: s,
|
|
8484
8631
|
id: d,
|
|
8485
|
-
resultType: typeof
|
|
8632
|
+
resultType: typeof h
|
|
8486
8633
|
});
|
|
8487
8634
|
try {
|
|
8488
8635
|
(S = this.worker) == null || S.postMessage({
|
|
8489
8636
|
type: "asyncRelayResult",
|
|
8490
8637
|
id: d,
|
|
8491
|
-
result:
|
|
8492
|
-
callId:
|
|
8638
|
+
result: h,
|
|
8639
|
+
callId: b.call_id
|
|
8493
8640
|
});
|
|
8494
8641
|
} catch (I) {
|
|
8495
8642
|
const A = I instanceof Error ? I.message : String(I);
|
|
@@ -8500,11 +8647,11 @@ class ar {
|
|
|
8500
8647
|
});
|
|
8501
8648
|
}
|
|
8502
8649
|
}
|
|
8503
|
-
}).catch((
|
|
8650
|
+
}).catch((h) => {
|
|
8504
8651
|
var I;
|
|
8505
8652
|
if (u.signal.aborted)
|
|
8506
8653
|
return;
|
|
8507
|
-
const S =
|
|
8654
|
+
const S = h instanceof Error ? h.message : String(h);
|
|
8508
8655
|
f.error("asyncRelay_error", {
|
|
8509
8656
|
action: s,
|
|
8510
8657
|
id: d,
|
|
@@ -8518,14 +8665,14 @@ class ar {
|
|
|
8518
8665
|
ok: !1,
|
|
8519
8666
|
error: { message: S, code: "E_RUNNER" }
|
|
8520
8667
|
},
|
|
8521
|
-
callId:
|
|
8668
|
+
callId: b.call_id
|
|
8522
8669
|
});
|
|
8523
8670
|
} catch (A) {
|
|
8524
|
-
const
|
|
8671
|
+
const D = A instanceof Error ? A.message : String(A);
|
|
8525
8672
|
f.error("asyncRelayResult_post_failed", {
|
|
8526
8673
|
action: s,
|
|
8527
8674
|
id: d,
|
|
8528
|
-
error:
|
|
8675
|
+
error: D
|
|
8529
8676
|
});
|
|
8530
8677
|
}
|
|
8531
8678
|
}).finally(() => {
|
|
@@ -8552,8 +8699,8 @@ class ar {
|
|
|
8552
8699
|
}), i != null && i.aborted ? Promise.resolve({
|
|
8553
8700
|
ok: !1,
|
|
8554
8701
|
error: { message: "Relay aborted", code: "E_ABORT" }
|
|
8555
|
-
}) : r === "main-thread" ?
|
|
8556
|
-
|
|
8702
|
+
}) : r === "main-thread" ? Et(n.action) ? this.withMainThreadTimeout(
|
|
8703
|
+
zr(n, i),
|
|
8557
8704
|
n.action
|
|
8558
8705
|
) : Promise.resolve({
|
|
8559
8706
|
ok: !1,
|
|
@@ -8621,7 +8768,7 @@ class ar {
|
|
|
8621
8768
|
const s = typeof r.params == "object" && r.params !== null ? r.params : {};
|
|
8622
8769
|
let c;
|
|
8623
8770
|
try {
|
|
8624
|
-
c =
|
|
8771
|
+
c = Mr(n, s);
|
|
8625
8772
|
} catch (I) {
|
|
8626
8773
|
return {
|
|
8627
8774
|
ok: !1,
|
|
@@ -8637,18 +8784,18 @@ class ar {
|
|
|
8637
8784
|
l = (await i.tabs.get(c)).url ?? "";
|
|
8638
8785
|
} catch {
|
|
8639
8786
|
}
|
|
8640
|
-
const d = await
|
|
8787
|
+
const d = await Yt(c);
|
|
8641
8788
|
if (d && !d.ok) return d;
|
|
8642
|
-
const u = await
|
|
8789
|
+
const u = await Te(c, Tt);
|
|
8643
8790
|
if (!u.ok) return u;
|
|
8644
|
-
if (
|
|
8645
|
-
return
|
|
8646
|
-
const
|
|
8791
|
+
if (Di(r.action))
|
|
8792
|
+
return Ui(r, c, a);
|
|
8793
|
+
const b = Wi(s), h = b ? { ...r, params: { ...s, refId: b.localRefId } } : r;
|
|
8647
8794
|
return this.sendToFrame(
|
|
8648
8795
|
i,
|
|
8649
|
-
|
|
8796
|
+
h,
|
|
8650
8797
|
c,
|
|
8651
|
-
(
|
|
8798
|
+
(b == null ? void 0 : b.frameId) ?? 0,
|
|
8652
8799
|
a,
|
|
8653
8800
|
o,
|
|
8654
8801
|
l
|
|
@@ -8665,7 +8812,7 @@ class ar {
|
|
|
8665
8812
|
};
|
|
8666
8813
|
s == null || s.addEventListener("abort", u, { once: !0 });
|
|
8667
8814
|
try {
|
|
8668
|
-
const
|
|
8815
|
+
const b = await r.tabs.sendMessage(
|
|
8669
8816
|
a,
|
|
8670
8817
|
{
|
|
8671
8818
|
type: "registryCall",
|
|
@@ -8676,18 +8823,18 @@ class ar {
|
|
|
8676
8823
|
runId: n.runId
|
|
8677
8824
|
},
|
|
8678
8825
|
{ frameId: o }
|
|
8679
|
-
),
|
|
8680
|
-
return l &&
|
|
8826
|
+
), h = Ve(b);
|
|
8827
|
+
return l && h.ok ? h : l ? {
|
|
8681
8828
|
ok: !1,
|
|
8682
8829
|
error: { message: "Relay aborted", code: "E_ABORT" }
|
|
8683
|
-
} :
|
|
8684
|
-
} catch (
|
|
8830
|
+
} : h;
|
|
8831
|
+
} catch (b) {
|
|
8685
8832
|
return l || s != null && s.aborted ? {
|
|
8686
8833
|
ok: !1,
|
|
8687
8834
|
error: { message: "Relay aborted", code: "E_ABORT" }
|
|
8688
8835
|
} : {
|
|
8689
8836
|
ok: !1,
|
|
8690
|
-
error:
|
|
8837
|
+
error: ct(b, {
|
|
8691
8838
|
tabId: a,
|
|
8692
8839
|
url: c,
|
|
8693
8840
|
action: n.action
|
|
@@ -8746,9 +8893,9 @@ class ar {
|
|
|
8746
8893
|
), s;
|
|
8747
8894
|
}
|
|
8748
8895
|
setLogLevel(r) {
|
|
8749
|
-
f.trace("setLogLevel", { level: r }),
|
|
8896
|
+
f.trace("setLogLevel", { level: r }), ur(r), !(!this.worker || this.disposed) && this.worker.postMessage({
|
|
8750
8897
|
type: "setLogLevel",
|
|
8751
|
-
level:
|
|
8898
|
+
level: Ne[r]
|
|
8752
8899
|
});
|
|
8753
8900
|
}
|
|
8754
8901
|
reset() {
|
|
@@ -8890,10 +9037,10 @@ class ar {
|
|
|
8890
9037
|
*/
|
|
8891
9038
|
async stopWith(r) {
|
|
8892
9039
|
if (!this.disposed) {
|
|
8893
|
-
this.disposed = !0, this.abortController = new AbortController(),
|
|
9040
|
+
this.disposed = !0, this.abortController = new AbortController(), Me(this.abortController), this.abortController.abort();
|
|
8894
9041
|
for (const [, n] of this.inFlightRelays)
|
|
8895
9042
|
n.abort();
|
|
8896
|
-
this.inFlightRelays.clear(), this.worker && this.worker.postMessage({ type: "stop", id: this.generateId() }),
|
|
9043
|
+
this.inFlightRelays.clear(), this.worker && this.worker.postMessage({ type: "stop", id: this.generateId() }), Ar(), await new Promise((n) => setTimeout(n, 50)), this.worker && (this.worker.terminate(), this.worker = null);
|
|
8897
9044
|
for (const [, n] of this.pendingCalls)
|
|
8898
9045
|
n.reject(new Error("ExtensionSession stopped"));
|
|
8899
9046
|
this.pendingCalls.clear(), this.onCleanupComplete && (this.onCleanupComplete(), this.onCleanupComplete = null);
|
|
@@ -8908,14 +9055,14 @@ class ar {
|
|
|
8908
9055
|
return Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
8909
9056
|
}
|
|
8910
9057
|
}
|
|
8911
|
-
function
|
|
9058
|
+
function Zi(e, r, n) {
|
|
8912
9059
|
e.registerWorkerRelayPort(r, n);
|
|
8913
9060
|
}
|
|
8914
9061
|
export {
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
9062
|
+
ir as ExtensionSession,
|
|
9063
|
+
Ne as LOG_LEVEL_NUMERIC,
|
|
9064
|
+
Ki as registerHostHandler,
|
|
9065
|
+
Vi as registerHostHandlers,
|
|
9066
|
+
Zi as registerWorkerRelayPort,
|
|
9067
|
+
ur as setLogLevel
|
|
8921
9068
|
};
|