@pi-oxide/extension-js 0.10.2 → 0.11.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 -2
- package/extension_js.d.ts +54 -43
- package/extension_js.js +63415 -16937
- package/index.js +1076 -726
- package/package.json +21 -8
- package/worker.js +992 -934
- package/content-script.d.ts +0 -7
- package/generated.d.ts +0 -251
- package/logger.d.ts +0 -16
- package/runner.d.ts +0 -17
- package/schemas.d.ts +0 -694
- package/tool-registry.d.ts +0 -115
package/worker.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
1
|
+
import er, { setLogLevel as Ye, ExtensionSession as tr, registerJsCallBatch as rr, takeCachedVfsWriteBase64 as nr, webFsReadBase64 as sr, clearVfsWriteCache as ir } from "./extension_js.js";
|
|
2
|
+
const je = {
|
|
3
3
|
trace: 0,
|
|
4
4
|
debug: 1,
|
|
5
5
|
info: 2,
|
|
6
6
|
warn: 3,
|
|
7
7
|
error: 4,
|
|
8
8
|
none: 5
|
|
9
|
-
},
|
|
9
|
+
}, ar = [
|
|
10
10
|
"trace",
|
|
11
11
|
"debug",
|
|
12
12
|
"info",
|
|
@@ -14,19 +14,19 @@ const $e = {
|
|
|
14
14
|
"error",
|
|
15
15
|
"none"
|
|
16
16
|
];
|
|
17
|
-
function
|
|
17
|
+
function or(t) {
|
|
18
18
|
const e = Math.max(0, Math.min(5, Math.round(t)));
|
|
19
|
-
return
|
|
19
|
+
return ar[e] ?? "error";
|
|
20
20
|
}
|
|
21
21
|
let dt = "trace", Ke = null;
|
|
22
|
-
function
|
|
23
|
-
dt = t, Ke && Ke(
|
|
22
|
+
function cr(t) {
|
|
23
|
+
dt = t, Ke && Ke(je[t]);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
Ke = t, t(
|
|
25
|
+
function dr(t) {
|
|
26
|
+
Ke = t, t(je[dt]);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
28
|
+
function lr(t) {
|
|
29
|
+
return je[t] >= je[dt];
|
|
30
30
|
}
|
|
31
31
|
function Nt(t, e = "info") {
|
|
32
32
|
var r;
|
|
@@ -51,10 +51,10 @@ function Nt(t, e = "info") {
|
|
|
51
51
|
}
|
|
52
52
|
return String(t);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function ur(t) {
|
|
55
55
|
return `[extension-js][${t}]`;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function fr(t, e) {
|
|
58
58
|
if (!t) return "";
|
|
59
59
|
const r = [];
|
|
60
60
|
try {
|
|
@@ -65,7 +65,7 @@ function lr(t, e) {
|
|
|
65
65
|
}
|
|
66
66
|
return r.length > 0 ? ` ${r.join(" ")}` : "";
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function _e(t, e) {
|
|
69
69
|
return e.length === 0 ? { event: t } : e.length === 1 && typeof e[0] == "object" && e[0] !== null && !Array.isArray(e[0]) ? { event: t, metadata: e[0] } : {
|
|
70
70
|
event: t,
|
|
71
71
|
metadata: { _args: e.map((r) => Nt(r)).join(" ") }
|
|
@@ -77,19 +77,19 @@ class lt {
|
|
|
77
77
|
}
|
|
78
78
|
log(e, r, n) {
|
|
79
79
|
try {
|
|
80
|
-
if (!
|
|
81
|
-
const s =
|
|
80
|
+
if (!lr(e)) return;
|
|
81
|
+
const s = ur(this.namespace), i = fr(n, e), c = `${s} ${r}${i}`;
|
|
82
82
|
switch (e) {
|
|
83
83
|
case "trace":
|
|
84
84
|
case "debug":
|
|
85
85
|
case "info":
|
|
86
|
-
console.log(
|
|
86
|
+
console.log(c);
|
|
87
87
|
break;
|
|
88
88
|
case "warn":
|
|
89
|
-
console.warn(
|
|
89
|
+
console.warn(c);
|
|
90
90
|
break;
|
|
91
91
|
case "error":
|
|
92
|
-
console.error(
|
|
92
|
+
console.error(c);
|
|
93
93
|
break;
|
|
94
94
|
case "none":
|
|
95
95
|
break;
|
|
@@ -102,23 +102,23 @@ class lt {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
trace(e, ...r) {
|
|
105
|
-
const { event: n, metadata: s } =
|
|
105
|
+
const { event: n, metadata: s } = _e(e, r);
|
|
106
106
|
this.log("trace", n, s);
|
|
107
107
|
}
|
|
108
108
|
debug(e, ...r) {
|
|
109
|
-
const { event: n, metadata: s } =
|
|
109
|
+
const { event: n, metadata: s } = _e(e, r);
|
|
110
110
|
this.log("debug", n, s);
|
|
111
111
|
}
|
|
112
112
|
info(e, ...r) {
|
|
113
|
-
const { event: n, metadata: s } =
|
|
113
|
+
const { event: n, metadata: s } = _e(e, r);
|
|
114
114
|
this.log("info", n, s);
|
|
115
115
|
}
|
|
116
116
|
warn(e, ...r) {
|
|
117
|
-
const { event: n, metadata: s } =
|
|
117
|
+
const { event: n, metadata: s } = _e(e, r);
|
|
118
118
|
this.log("warn", n, s);
|
|
119
119
|
}
|
|
120
120
|
error(e, ...r) {
|
|
121
|
-
const { event: n, metadata: s } =
|
|
121
|
+
const { event: n, metadata: s } = _e(e, r);
|
|
122
122
|
this.log("error", n, s);
|
|
123
123
|
}
|
|
124
124
|
child(e) {
|
|
@@ -126,11 +126,11 @@ class lt {
|
|
|
126
126
|
}
|
|
127
127
|
timer(e, r, n = "info") {
|
|
128
128
|
const s = typeof performance < "u" && performance.now, i = s ? performance.now() : Date.now();
|
|
129
|
-
return (
|
|
129
|
+
return (c) => {
|
|
130
130
|
try {
|
|
131
131
|
const a = s ? performance.now() : Date.now(), h = Math.round(a - i), d = {
|
|
132
132
|
...r,
|
|
133
|
-
...
|
|
133
|
+
...c,
|
|
134
134
|
duration_ms: h
|
|
135
135
|
};
|
|
136
136
|
this.log(n, e, d);
|
|
@@ -140,15 +140,15 @@ class lt {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
const C = new lt("root");
|
|
143
|
-
function
|
|
143
|
+
function he(t) {
|
|
144
144
|
return t == null ? {} : t instanceof Map ? Object.fromEntries(
|
|
145
145
|
[...t.entries()].map(([e, r]) => [
|
|
146
146
|
e,
|
|
147
|
-
|
|
147
|
+
he(r)
|
|
148
148
|
])
|
|
149
|
-
) : Array.isArray(t) ? t.map(
|
|
149
|
+
) : Array.isArray(t) ? t.map(he) : t;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function hr(t) {
|
|
152
152
|
return {
|
|
153
153
|
action: t.action,
|
|
154
154
|
namespace: t.namespace,
|
|
@@ -181,7 +181,7 @@ function ur(t) {
|
|
|
181
181
|
relatedApis: t.relatedApis ?? null
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
var
|
|
184
|
+
var E;
|
|
185
185
|
(function(t) {
|
|
186
186
|
t.assertEqual = (s) => {
|
|
187
187
|
};
|
|
@@ -193,31 +193,31 @@ var I;
|
|
|
193
193
|
}
|
|
194
194
|
t.assertNever = r, t.arrayToEnum = (s) => {
|
|
195
195
|
const i = {};
|
|
196
|
-
for (const
|
|
197
|
-
i[
|
|
196
|
+
for (const c of s)
|
|
197
|
+
i[c] = c;
|
|
198
198
|
return i;
|
|
199
199
|
}, t.getValidEnumValues = (s) => {
|
|
200
|
-
const i = t.objectKeys(s).filter((a) => typeof s[s[a]] != "number"),
|
|
200
|
+
const i = t.objectKeys(s).filter((a) => typeof s[s[a]] != "number"), c = {};
|
|
201
201
|
for (const a of i)
|
|
202
|
-
|
|
203
|
-
return t.objectValues(
|
|
202
|
+
c[a] = s[a];
|
|
203
|
+
return t.objectValues(c);
|
|
204
204
|
}, t.objectValues = (s) => t.objectKeys(s).map(function(i) {
|
|
205
205
|
return s[i];
|
|
206
206
|
}), t.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
|
|
207
207
|
const i = [];
|
|
208
|
-
for (const
|
|
209
|
-
Object.prototype.hasOwnProperty.call(s,
|
|
208
|
+
for (const c in s)
|
|
209
|
+
Object.prototype.hasOwnProperty.call(s, c) && i.push(c);
|
|
210
210
|
return i;
|
|
211
211
|
}, t.find = (s, i) => {
|
|
212
|
-
for (const
|
|
213
|
-
if (i(
|
|
214
|
-
return
|
|
212
|
+
for (const c of s)
|
|
213
|
+
if (i(c))
|
|
214
|
+
return c;
|
|
215
215
|
}, t.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && Number.isFinite(s) && Math.floor(s) === s;
|
|
216
216
|
function n(s, i = " | ") {
|
|
217
|
-
return s.map((
|
|
217
|
+
return s.map((c) => typeof c == "string" ? `'${c}'` : c).join(i);
|
|
218
218
|
}
|
|
219
219
|
t.joinValues = n, t.jsonStringifyReplacer = (s, i) => typeof i == "bigint" ? i.toString() : i;
|
|
220
|
-
})(
|
|
220
|
+
})(E || (E = {}));
|
|
221
221
|
var _t;
|
|
222
222
|
(function(t) {
|
|
223
223
|
t.mergeShapes = (e, r) => ({
|
|
@@ -226,7 +226,7 @@ var _t;
|
|
|
226
226
|
// second overwrites first
|
|
227
227
|
});
|
|
228
228
|
})(_t || (_t = {}));
|
|
229
|
-
const g =
|
|
229
|
+
const g = E.arrayToEnum([
|
|
230
230
|
"string",
|
|
231
231
|
"nan",
|
|
232
232
|
"number",
|
|
@@ -247,7 +247,7 @@ const g = I.arrayToEnum([
|
|
|
247
247
|
"never",
|
|
248
248
|
"map",
|
|
249
249
|
"set"
|
|
250
|
-
]),
|
|
250
|
+
]), te = (t) => {
|
|
251
251
|
switch (typeof t) {
|
|
252
252
|
case "undefined":
|
|
253
253
|
return g.undefined;
|
|
@@ -268,7 +268,7 @@ const g = I.arrayToEnum([
|
|
|
268
268
|
default:
|
|
269
269
|
return g.unknown;
|
|
270
270
|
}
|
|
271
|
-
}, u =
|
|
271
|
+
}, u = E.arrayToEnum([
|
|
272
272
|
"invalid_type",
|
|
273
273
|
"invalid_literal",
|
|
274
274
|
"custom",
|
|
@@ -303,20 +303,20 @@ class j extends Error {
|
|
|
303
303
|
const r = e || function(i) {
|
|
304
304
|
return i.message;
|
|
305
305
|
}, n = { _errors: [] }, s = (i) => {
|
|
306
|
-
for (const
|
|
307
|
-
if (
|
|
308
|
-
|
|
309
|
-
else if (
|
|
310
|
-
s(
|
|
311
|
-
else if (
|
|
312
|
-
s(
|
|
313
|
-
else if (
|
|
314
|
-
n._errors.push(r(
|
|
306
|
+
for (const c of i.issues)
|
|
307
|
+
if (c.code === "invalid_union")
|
|
308
|
+
c.unionErrors.map(s);
|
|
309
|
+
else if (c.code === "invalid_return_type")
|
|
310
|
+
s(c.returnTypeError);
|
|
311
|
+
else if (c.code === "invalid_arguments")
|
|
312
|
+
s(c.argumentsError);
|
|
313
|
+
else if (c.path.length === 0)
|
|
314
|
+
n._errors.push(r(c));
|
|
315
315
|
else {
|
|
316
316
|
let a = n, h = 0;
|
|
317
|
-
for (; h <
|
|
318
|
-
const d =
|
|
319
|
-
h ===
|
|
317
|
+
for (; h < c.path.length; ) {
|
|
318
|
+
const d = c.path[h];
|
|
319
|
+
h === c.path.length - 1 ? (a[d] = a[d] || { _errors: [] }, a[d]._errors.push(r(c))) : a[d] = a[d] || { _errors: [] }, a = a[d], h++;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
};
|
|
@@ -330,7 +330,7 @@ class j extends Error {
|
|
|
330
330
|
return this.message;
|
|
331
331
|
}
|
|
332
332
|
get message() {
|
|
333
|
-
return JSON.stringify(this.issues,
|
|
333
|
+
return JSON.stringify(this.issues, E.jsonStringifyReplacer, 2);
|
|
334
334
|
}
|
|
335
335
|
get isEmpty() {
|
|
336
336
|
return this.issues.length === 0;
|
|
@@ -350,26 +350,26 @@ class j extends Error {
|
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
j.create = (t) => new j(t);
|
|
353
|
-
const
|
|
353
|
+
const xe = (t, e) => {
|
|
354
354
|
let r;
|
|
355
355
|
switch (t.code) {
|
|
356
356
|
case u.invalid_type:
|
|
357
357
|
t.received === g.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
|
|
358
358
|
break;
|
|
359
359
|
case u.invalid_literal:
|
|
360
|
-
r = `Invalid literal value, expected ${JSON.stringify(t.expected,
|
|
360
|
+
r = `Invalid literal value, expected ${JSON.stringify(t.expected, E.jsonStringifyReplacer)}`;
|
|
361
361
|
break;
|
|
362
362
|
case u.unrecognized_keys:
|
|
363
|
-
r = `Unrecognized key(s) in object: ${
|
|
363
|
+
r = `Unrecognized key(s) in object: ${E.joinValues(t.keys, ", ")}`;
|
|
364
364
|
break;
|
|
365
365
|
case u.invalid_union:
|
|
366
366
|
r = "Invalid input";
|
|
367
367
|
break;
|
|
368
368
|
case u.invalid_union_discriminator:
|
|
369
|
-
r = `Invalid discriminator value. Expected ${
|
|
369
|
+
r = `Invalid discriminator value. Expected ${E.joinValues(t.options)}`;
|
|
370
370
|
break;
|
|
371
371
|
case u.invalid_enum_value:
|
|
372
|
-
r = `Invalid enum value. Expected ${
|
|
372
|
+
r = `Invalid enum value. Expected ${E.joinValues(t.options)}, received '${t.received}'`;
|
|
373
373
|
break;
|
|
374
374
|
case u.invalid_arguments:
|
|
375
375
|
r = "Invalid function arguments";
|
|
@@ -381,7 +381,7 @@ const Te = (t, e) => {
|
|
|
381
381
|
r = "Invalid date";
|
|
382
382
|
break;
|
|
383
383
|
case u.invalid_string:
|
|
384
|
-
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` :
|
|
384
|
+
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` : E.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` : r = "Invalid";
|
|
385
385
|
break;
|
|
386
386
|
case u.too_small:
|
|
387
387
|
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "bigint" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
|
|
@@ -402,16 +402,16 @@ const Te = (t, e) => {
|
|
|
402
402
|
r = "Number must be finite";
|
|
403
403
|
break;
|
|
404
404
|
default:
|
|
405
|
-
r = e.defaultError,
|
|
405
|
+
r = e.defaultError, E.assertNever(t);
|
|
406
406
|
}
|
|
407
407
|
return { message: r };
|
|
408
408
|
};
|
|
409
|
-
let
|
|
409
|
+
let pr = xe;
|
|
410
410
|
function Qe() {
|
|
411
|
-
return
|
|
411
|
+
return pr;
|
|
412
412
|
}
|
|
413
413
|
const Xe = (t) => {
|
|
414
|
-
const { data: e, path: r, errorMaps: n, issueData: s } = t, i = [...r, ...s.path || []],
|
|
414
|
+
const { data: e, path: r, errorMaps: n, issueData: s } = t, i = [...r, ...s.path || []], c = {
|
|
415
415
|
...s,
|
|
416
416
|
path: i
|
|
417
417
|
};
|
|
@@ -424,7 +424,7 @@ const Xe = (t) => {
|
|
|
424
424
|
let a = "";
|
|
425
425
|
const h = n.filter((d) => !!d).slice().reverse();
|
|
426
426
|
for (const d of h)
|
|
427
|
-
a = d(
|
|
427
|
+
a = d(c, { data: e, defaultError: a }).message;
|
|
428
428
|
return {
|
|
429
429
|
...s,
|
|
430
430
|
path: i,
|
|
@@ -443,7 +443,7 @@ function p(t, e) {
|
|
|
443
443
|
// then schema-bound map if available
|
|
444
444
|
r,
|
|
445
445
|
// then global override map
|
|
446
|
-
r ===
|
|
446
|
+
r === xe ? void 0 : xe
|
|
447
447
|
// then global default map
|
|
448
448
|
].filter((s) => !!s)
|
|
449
449
|
});
|
|
@@ -471,10 +471,10 @@ class $ {
|
|
|
471
471
|
static async mergeObjectAsync(e, r) {
|
|
472
472
|
const n = [];
|
|
473
473
|
for (const s of r) {
|
|
474
|
-
const i = await s.key,
|
|
474
|
+
const i = await s.key, c = await s.value;
|
|
475
475
|
n.push({
|
|
476
476
|
key: i,
|
|
477
|
-
value:
|
|
477
|
+
value: c
|
|
478
478
|
});
|
|
479
479
|
}
|
|
480
480
|
return $.mergeObjectSync(e, n);
|
|
@@ -482,22 +482,22 @@ class $ {
|
|
|
482
482
|
static mergeObjectSync(e, r) {
|
|
483
483
|
const n = {};
|
|
484
484
|
for (const s of r) {
|
|
485
|
-
const { key: i, value:
|
|
486
|
-
if (i.status === "aborted" ||
|
|
485
|
+
const { key: i, value: c } = s;
|
|
486
|
+
if (i.status === "aborted" || c.status === "aborted")
|
|
487
487
|
return v;
|
|
488
|
-
i.status === "dirty" && e.dirty(),
|
|
488
|
+
i.status === "dirty" && e.dirty(), c.status === "dirty" && e.dirty(), i.value !== "__proto__" && (typeof c.value < "u" || s.alwaysSet) && (n[i.value] = c.value);
|
|
489
489
|
}
|
|
490
490
|
return { status: e.value, value: n };
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
const v = Object.freeze({
|
|
494
494
|
status: "aborted"
|
|
495
|
-
}),
|
|
495
|
+
}), ve = (t) => ({ status: "dirty", value: t }), L = (t) => ({ status: "valid", value: t }), vt = (t) => t.status === "aborted", kt = (t) => t.status === "dirty", pe = (t) => t.status === "valid", De = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
496
496
|
var y;
|
|
497
497
|
(function(t) {
|
|
498
498
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
499
499
|
})(y || (y = {}));
|
|
500
|
-
class
|
|
500
|
+
class z {
|
|
501
501
|
constructor(e, r, n, s) {
|
|
502
502
|
this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
|
|
503
503
|
}
|
|
@@ -506,7 +506,7 @@ class B {
|
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
const wt = (t, e) => {
|
|
509
|
-
if (
|
|
509
|
+
if (pe(e))
|
|
510
510
|
return { success: !0, data: e.value };
|
|
511
511
|
if (!t.common.issues.length)
|
|
512
512
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -520,15 +520,15 @@ const wt = (t, e) => {
|
|
|
520
520
|
}
|
|
521
521
|
};
|
|
522
522
|
};
|
|
523
|
-
function
|
|
523
|
+
function T(t) {
|
|
524
524
|
if (!t)
|
|
525
525
|
return {};
|
|
526
526
|
const { errorMap: e, invalid_type_error: r, required_error: n, description: s } = t;
|
|
527
527
|
if (e && (r || n))
|
|
528
528
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
529
|
-
return e ? { errorMap: e, description: s } : { errorMap: (
|
|
529
|
+
return e ? { errorMap: e, description: s } : { errorMap: (c, a) => {
|
|
530
530
|
const { message: h } = t;
|
|
531
|
-
return
|
|
531
|
+
return c.code === "invalid_enum_value" ? { message: h ?? a.defaultError } : typeof a.data > "u" ? { message: h ?? n ?? a.defaultError } : c.code !== "invalid_type" ? { message: a.defaultError } : { message: h ?? r ?? a.defaultError };
|
|
532
532
|
}, description: s };
|
|
533
533
|
}
|
|
534
534
|
class S {
|
|
@@ -536,13 +536,13 @@ class S {
|
|
|
536
536
|
return this._def.description;
|
|
537
537
|
}
|
|
538
538
|
_getType(e) {
|
|
539
|
-
return
|
|
539
|
+
return te(e.data);
|
|
540
540
|
}
|
|
541
541
|
_getOrReturnCtx(e, r) {
|
|
542
542
|
return r || {
|
|
543
543
|
common: e.parent.common,
|
|
544
544
|
data: e.data,
|
|
545
|
-
parsedType:
|
|
545
|
+
parsedType: te(e.data),
|
|
546
546
|
schemaErrorMap: this._def.errorMap,
|
|
547
547
|
path: e.path,
|
|
548
548
|
parent: e.parent
|
|
@@ -554,7 +554,7 @@ class S {
|
|
|
554
554
|
ctx: {
|
|
555
555
|
common: e.parent.common,
|
|
556
556
|
data: e.data,
|
|
557
|
-
parsedType:
|
|
557
|
+
parsedType: te(e.data),
|
|
558
558
|
schemaErrorMap: this._def.errorMap,
|
|
559
559
|
path: e.path,
|
|
560
560
|
parent: e.parent
|
|
@@ -563,7 +563,7 @@ class S {
|
|
|
563
563
|
}
|
|
564
564
|
_parseSync(e) {
|
|
565
565
|
const r = this._parse(e);
|
|
566
|
-
if (
|
|
566
|
+
if (De(r))
|
|
567
567
|
throw new Error("Synchronous parse encountered promise.");
|
|
568
568
|
return r;
|
|
569
569
|
}
|
|
@@ -588,7 +588,7 @@ class S {
|
|
|
588
588
|
schemaErrorMap: this._def.errorMap,
|
|
589
589
|
parent: null,
|
|
590
590
|
data: e,
|
|
591
|
-
parsedType:
|
|
591
|
+
parsedType: te(e)
|
|
592
592
|
}, s = this._parseSync({ data: e, path: n.path, parent: n });
|
|
593
593
|
return wt(n, s);
|
|
594
594
|
}
|
|
@@ -603,12 +603,12 @@ class S {
|
|
|
603
603
|
schemaErrorMap: this._def.errorMap,
|
|
604
604
|
parent: null,
|
|
605
605
|
data: e,
|
|
606
|
-
parsedType:
|
|
606
|
+
parsedType: te(e)
|
|
607
607
|
};
|
|
608
608
|
if (!this["~standard"].async)
|
|
609
609
|
try {
|
|
610
610
|
const i = this._parseSync({ data: e, path: [], parent: r });
|
|
611
|
-
return
|
|
611
|
+
return pe(i) ? {
|
|
612
612
|
value: i.value
|
|
613
613
|
} : {
|
|
614
614
|
issues: r.common.issues
|
|
@@ -619,7 +619,7 @@ class S {
|
|
|
619
619
|
async: !0
|
|
620
620
|
};
|
|
621
621
|
}
|
|
622
|
-
return this._parseAsync({ data: e, path: [], parent: r }).then((i) =>
|
|
622
|
+
return this._parseAsync({ data: e, path: [], parent: r }).then((i) => pe(i) ? {
|
|
623
623
|
value: i.value
|
|
624
624
|
} : {
|
|
625
625
|
issues: r.common.issues
|
|
@@ -642,25 +642,25 @@ class S {
|
|
|
642
642
|
schemaErrorMap: this._def.errorMap,
|
|
643
643
|
parent: null,
|
|
644
644
|
data: e,
|
|
645
|
-
parsedType:
|
|
646
|
-
}, s = this._parse({ data: e, path: n.path, parent: n }), i = await (
|
|
645
|
+
parsedType: te(e)
|
|
646
|
+
}, s = this._parse({ data: e, path: n.path, parent: n }), i = await (De(s) ? s : Promise.resolve(s));
|
|
647
647
|
return wt(n, i);
|
|
648
648
|
}
|
|
649
649
|
refine(e, r) {
|
|
650
650
|
const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
|
|
651
651
|
return this._refinement((s, i) => {
|
|
652
|
-
const
|
|
652
|
+
const c = e(s), a = () => i.addIssue({
|
|
653
653
|
code: u.custom,
|
|
654
654
|
...n(s)
|
|
655
655
|
});
|
|
656
|
-
return typeof Promise < "u" &&
|
|
656
|
+
return typeof Promise < "u" && c instanceof Promise ? c.then((h) => h ? !0 : (a(), !1)) : c ? !0 : (a(), !1);
|
|
657
657
|
});
|
|
658
658
|
}
|
|
659
659
|
refinement(e, r) {
|
|
660
660
|
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
|
|
661
661
|
}
|
|
662
662
|
_refinement(e) {
|
|
663
|
-
return new
|
|
663
|
+
return new Y({
|
|
664
664
|
schema: this,
|
|
665
665
|
typeName: k.ZodEffects,
|
|
666
666
|
effect: { type: "refinement", refinement: e }
|
|
@@ -680,7 +680,7 @@ class S {
|
|
|
680
680
|
return V.create(this, this._def);
|
|
681
681
|
}
|
|
682
682
|
nullable() {
|
|
683
|
-
return
|
|
683
|
+
return se.create(this, this._def);
|
|
684
684
|
}
|
|
685
685
|
nullish() {
|
|
686
686
|
return this.nullable().optional();
|
|
@@ -689,17 +689,17 @@ class S {
|
|
|
689
689
|
return W.create(this);
|
|
690
690
|
}
|
|
691
691
|
promise() {
|
|
692
|
-
return
|
|
692
|
+
return ge.create(this, this._def);
|
|
693
693
|
}
|
|
694
694
|
or(e) {
|
|
695
|
-
return
|
|
695
|
+
return Ee.create([this, e], this._def);
|
|
696
696
|
}
|
|
697
697
|
and(e) {
|
|
698
|
-
return
|
|
698
|
+
return Re.create(this, e, this._def);
|
|
699
699
|
}
|
|
700
700
|
transform(e) {
|
|
701
|
-
return new
|
|
702
|
-
...
|
|
701
|
+
return new Y({
|
|
702
|
+
...T(this._def),
|
|
703
703
|
schema: this,
|
|
704
704
|
typeName: k.ZodEffects,
|
|
705
705
|
effect: { type: "transform", transform: e }
|
|
@@ -707,8 +707,8 @@ class S {
|
|
|
707
707
|
}
|
|
708
708
|
default(e) {
|
|
709
709
|
const r = typeof e == "function" ? e : () => e;
|
|
710
|
-
return new
|
|
711
|
-
...
|
|
710
|
+
return new Ne({
|
|
711
|
+
...T(this._def),
|
|
712
712
|
innerType: this,
|
|
713
713
|
defaultValue: r,
|
|
714
714
|
typeName: k.ZodDefault
|
|
@@ -718,13 +718,13 @@ class S {
|
|
|
718
718
|
return new ut({
|
|
719
719
|
typeName: k.ZodBranded,
|
|
720
720
|
type: this,
|
|
721
|
-
...
|
|
721
|
+
...T(this._def)
|
|
722
722
|
});
|
|
723
723
|
}
|
|
724
724
|
catch(e) {
|
|
725
725
|
const r = typeof e == "function" ? e : () => e;
|
|
726
|
-
return new
|
|
727
|
-
...
|
|
726
|
+
return new Me({
|
|
727
|
+
...T(this._def),
|
|
728
728
|
innerType: this,
|
|
729
729
|
catchValue: r,
|
|
730
730
|
typeName: k.ZodCatch
|
|
@@ -741,7 +741,7 @@ class S {
|
|
|
741
741
|
return qe.create(this, e);
|
|
742
742
|
}
|
|
743
743
|
readonly() {
|
|
744
|
-
return
|
|
744
|
+
return Pe.create(this);
|
|
745
745
|
}
|
|
746
746
|
isOptional() {
|
|
747
747
|
return this.safeParse(void 0).success;
|
|
@@ -750,28 +750,28 @@ class S {
|
|
|
750
750
|
return this.safeParse(null).success;
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
|
-
const
|
|
753
|
+
const mr = /^c[^\s-]{8,}$/i, gr = /^[0-9a-z]+$/, yr = /^[0-9A-HJKMNP-TV-Z]{26}$/i, br = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, _r = /^[a-z0-9_-]{21}$/i, vr = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, kr = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, wr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Tr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
754
754
|
let Ge;
|
|
755
|
-
const
|
|
755
|
+
const xr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Sr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ir = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Er = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Rr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ar = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Mt = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Cr = new RegExp(`^${Mt}$`);
|
|
756
756
|
function Pt(t) {
|
|
757
757
|
let e = "[0-5]\\d";
|
|
758
758
|
t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
759
759
|
const r = t.precision ? "+" : "?";
|
|
760
760
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`;
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function Or(t) {
|
|
763
763
|
return new RegExp(`^${Pt(t)}$`);
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function Nr(t) {
|
|
766
766
|
let e = `${Mt}T${Pt(t)}`;
|
|
767
767
|
const r = [];
|
|
768
768
|
return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
|
|
769
769
|
}
|
|
770
|
-
function
|
|
771
|
-
return !!((e === "v4" || !e) &&
|
|
770
|
+
function Mr(t, e) {
|
|
771
|
+
return !!((e === "v4" || !e) && xr.test(t) || (e === "v6" || !e) && Ir.test(t));
|
|
772
772
|
}
|
|
773
|
-
function
|
|
774
|
-
if (!
|
|
773
|
+
function Pr(t, e) {
|
|
774
|
+
if (!vr.test(t))
|
|
775
775
|
return !1;
|
|
776
776
|
try {
|
|
777
777
|
const [r] = t.split(".");
|
|
@@ -783,10 +783,10 @@ function Nr(t, e) {
|
|
|
783
783
|
return !1;
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
|
-
function
|
|
787
|
-
return !!((e === "v4" || !e) &&
|
|
786
|
+
function $r(t, e) {
|
|
787
|
+
return !!((e === "v4" || !e) && Sr.test(t) || (e === "v6" || !e) && Er.test(t));
|
|
788
788
|
}
|
|
789
|
-
class
|
|
789
|
+
class B extends S {
|
|
790
790
|
_parse(e) {
|
|
791
791
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== g.string) {
|
|
792
792
|
const i = this._getOrReturnCtx(e);
|
|
@@ -818,8 +818,8 @@ class U extends S {
|
|
|
818
818
|
message: i.message
|
|
819
819
|
}), n.dirty());
|
|
820
820
|
else if (i.kind === "length") {
|
|
821
|
-
const
|
|
822
|
-
(
|
|
821
|
+
const c = e.data.length > i.value, a = e.data.length < i.value;
|
|
822
|
+
(c || a) && (s = this._getOrReturnCtx(e, s), c ? p(s, {
|
|
823
823
|
code: u.too_big,
|
|
824
824
|
maximum: i.value,
|
|
825
825
|
type: "string",
|
|
@@ -835,43 +835,43 @@ class U extends S {
|
|
|
835
835
|
message: i.message
|
|
836
836
|
}), n.dirty());
|
|
837
837
|
} else if (i.kind === "email")
|
|
838
|
-
|
|
838
|
+
wr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
839
839
|
validation: "email",
|
|
840
840
|
code: u.invalid_string,
|
|
841
841
|
message: i.message
|
|
842
842
|
}), n.dirty());
|
|
843
843
|
else if (i.kind === "emoji")
|
|
844
|
-
Ge || (Ge = new RegExp(
|
|
844
|
+
Ge || (Ge = new RegExp(Tr, "u")), Ge.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
845
845
|
validation: "emoji",
|
|
846
846
|
code: u.invalid_string,
|
|
847
847
|
message: i.message
|
|
848
848
|
}), n.dirty());
|
|
849
849
|
else if (i.kind === "uuid")
|
|
850
|
-
|
|
850
|
+
br.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
851
851
|
validation: "uuid",
|
|
852
852
|
code: u.invalid_string,
|
|
853
853
|
message: i.message
|
|
854
854
|
}), n.dirty());
|
|
855
855
|
else if (i.kind === "nanoid")
|
|
856
|
-
|
|
856
|
+
_r.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
857
857
|
validation: "nanoid",
|
|
858
858
|
code: u.invalid_string,
|
|
859
859
|
message: i.message
|
|
860
860
|
}), n.dirty());
|
|
861
861
|
else if (i.kind === "cuid")
|
|
862
|
-
|
|
862
|
+
mr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
863
863
|
validation: "cuid",
|
|
864
864
|
code: u.invalid_string,
|
|
865
865
|
message: i.message
|
|
866
866
|
}), n.dirty());
|
|
867
867
|
else if (i.kind === "cuid2")
|
|
868
|
-
|
|
868
|
+
gr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
869
869
|
validation: "cuid2",
|
|
870
870
|
code: u.invalid_string,
|
|
871
871
|
message: i.message
|
|
872
872
|
}), n.dirty());
|
|
873
873
|
else if (i.kind === "ulid")
|
|
874
|
-
|
|
874
|
+
yr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
875
875
|
validation: "ulid",
|
|
876
876
|
code: u.invalid_string,
|
|
877
877
|
message: i.message
|
|
@@ -902,43 +902,43 @@ class U extends S {
|
|
|
902
902
|
code: u.invalid_string,
|
|
903
903
|
validation: { endsWith: i.value },
|
|
904
904
|
message: i.message
|
|
905
|
-
}), n.dirty()) : i.kind === "datetime" ?
|
|
905
|
+
}), n.dirty()) : i.kind === "datetime" ? Nr(i).test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
906
906
|
code: u.invalid_string,
|
|
907
907
|
validation: "datetime",
|
|
908
908
|
message: i.message
|
|
909
|
-
}), n.dirty()) : i.kind === "date" ?
|
|
909
|
+
}), n.dirty()) : i.kind === "date" ? Cr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
910
910
|
code: u.invalid_string,
|
|
911
911
|
validation: "date",
|
|
912
912
|
message: i.message
|
|
913
|
-
}), n.dirty()) : i.kind === "time" ?
|
|
913
|
+
}), n.dirty()) : i.kind === "time" ? Or(i).test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
914
914
|
code: u.invalid_string,
|
|
915
915
|
validation: "time",
|
|
916
916
|
message: i.message
|
|
917
|
-
}), n.dirty()) : i.kind === "duration" ?
|
|
917
|
+
}), n.dirty()) : i.kind === "duration" ? kr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
918
918
|
validation: "duration",
|
|
919
919
|
code: u.invalid_string,
|
|
920
920
|
message: i.message
|
|
921
|
-
}), n.dirty()) : i.kind === "ip" ?
|
|
921
|
+
}), n.dirty()) : i.kind === "ip" ? Mr(e.data, i.version) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
922
922
|
validation: "ip",
|
|
923
923
|
code: u.invalid_string,
|
|
924
924
|
message: i.message
|
|
925
|
-
}), n.dirty()) : i.kind === "jwt" ?
|
|
925
|
+
}), n.dirty()) : i.kind === "jwt" ? Pr(e.data, i.alg) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
926
926
|
validation: "jwt",
|
|
927
927
|
code: u.invalid_string,
|
|
928
928
|
message: i.message
|
|
929
|
-
}), n.dirty()) : i.kind === "cidr" ?
|
|
929
|
+
}), n.dirty()) : i.kind === "cidr" ? $r(e.data, i.version) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
930
930
|
validation: "cidr",
|
|
931
931
|
code: u.invalid_string,
|
|
932
932
|
message: i.message
|
|
933
|
-
}), n.dirty()) : i.kind === "base64" ?
|
|
933
|
+
}), n.dirty()) : i.kind === "base64" ? Rr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
934
934
|
validation: "base64",
|
|
935
935
|
code: u.invalid_string,
|
|
936
936
|
message: i.message
|
|
937
|
-
}), n.dirty()) : i.kind === "base64url" ?
|
|
937
|
+
}), n.dirty()) : i.kind === "base64url" ? Ar.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
938
938
|
validation: "base64url",
|
|
939
939
|
code: u.invalid_string,
|
|
940
940
|
message: i.message
|
|
941
|
-
}), n.dirty()) :
|
|
941
|
+
}), n.dirty()) : E.assertNever(i);
|
|
942
942
|
return { status: n.value, value: e.data };
|
|
943
943
|
}
|
|
944
944
|
_regex(e, r, n) {
|
|
@@ -949,7 +949,7 @@ class U extends S {
|
|
|
949
949
|
});
|
|
950
950
|
}
|
|
951
951
|
_addCheck(e) {
|
|
952
|
-
return new
|
|
952
|
+
return new B({
|
|
953
953
|
...this._def,
|
|
954
954
|
checks: [...this._def.checks, e]
|
|
955
955
|
});
|
|
@@ -1085,19 +1085,19 @@ class U extends S {
|
|
|
1085
1085
|
return this.min(1, y.errToObj(e));
|
|
1086
1086
|
}
|
|
1087
1087
|
trim() {
|
|
1088
|
-
return new
|
|
1088
|
+
return new B({
|
|
1089
1089
|
...this._def,
|
|
1090
1090
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1091
1091
|
});
|
|
1092
1092
|
}
|
|
1093
1093
|
toLowerCase() {
|
|
1094
|
-
return new
|
|
1094
|
+
return new B({
|
|
1095
1095
|
...this._def,
|
|
1096
1096
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1097
1097
|
});
|
|
1098
1098
|
}
|
|
1099
1099
|
toUpperCase() {
|
|
1100
|
-
return new
|
|
1100
|
+
return new B({
|
|
1101
1101
|
...this._def,
|
|
1102
1102
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1103
1103
|
});
|
|
@@ -1163,17 +1163,17 @@ class U extends S {
|
|
|
1163
1163
|
return e;
|
|
1164
1164
|
}
|
|
1165
1165
|
}
|
|
1166
|
-
|
|
1166
|
+
B.create = (t) => new B({
|
|
1167
1167
|
checks: [],
|
|
1168
1168
|
typeName: k.ZodString,
|
|
1169
1169
|
coerce: (t == null ? void 0 : t.coerce) ?? !1,
|
|
1170
|
-
...
|
|
1170
|
+
...T(t)
|
|
1171
1171
|
});
|
|
1172
|
-
function
|
|
1173
|
-
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, i = Number.parseInt(t.toFixed(s).replace(".", "")),
|
|
1174
|
-
return i %
|
|
1172
|
+
function Lr(t, e) {
|
|
1173
|
+
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, i = Number.parseInt(t.toFixed(s).replace(".", "")), c = Number.parseInt(e.toFixed(s).replace(".", ""));
|
|
1174
|
+
return i % c / 10 ** s;
|
|
1175
1175
|
}
|
|
1176
|
-
class
|
|
1176
|
+
class oe extends S {
|
|
1177
1177
|
constructor() {
|
|
1178
1178
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1179
1179
|
}
|
|
@@ -1189,7 +1189,7 @@ class ae extends S {
|
|
|
1189
1189
|
let n;
|
|
1190
1190
|
const s = new $();
|
|
1191
1191
|
for (const i of this._def.checks)
|
|
1192
|
-
i.kind === "int" ?
|
|
1192
|
+
i.kind === "int" ? E.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), p(n, {
|
|
1193
1193
|
code: u.invalid_type,
|
|
1194
1194
|
expected: "integer",
|
|
1195
1195
|
received: "float",
|
|
@@ -1208,14 +1208,14 @@ class ae extends S {
|
|
|
1208
1208
|
inclusive: i.inclusive,
|
|
1209
1209
|
exact: !1,
|
|
1210
1210
|
message: i.message
|
|
1211
|
-
}), s.dirty()) : i.kind === "multipleOf" ?
|
|
1211
|
+
}), s.dirty()) : i.kind === "multipleOf" ? Lr(e.data, i.value) !== 0 && (n = this._getOrReturnCtx(e, n), p(n, {
|
|
1212
1212
|
code: u.not_multiple_of,
|
|
1213
1213
|
multipleOf: i.value,
|
|
1214
1214
|
message: i.message
|
|
1215
1215
|
}), s.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), p(n, {
|
|
1216
1216
|
code: u.not_finite,
|
|
1217
1217
|
message: i.message
|
|
1218
|
-
}), s.dirty()) :
|
|
1218
|
+
}), s.dirty()) : E.assertNever(i);
|
|
1219
1219
|
return { status: s.value, value: e.data };
|
|
1220
1220
|
}
|
|
1221
1221
|
gte(e, r) {
|
|
@@ -1231,7 +1231,7 @@ class ae extends S {
|
|
|
1231
1231
|
return this.setLimit("max", e, !1, y.toString(r));
|
|
1232
1232
|
}
|
|
1233
1233
|
setLimit(e, r, n, s) {
|
|
1234
|
-
return new
|
|
1234
|
+
return new oe({
|
|
1235
1235
|
...this._def,
|
|
1236
1236
|
checks: [
|
|
1237
1237
|
...this._def.checks,
|
|
@@ -1245,7 +1245,7 @@ class ae extends S {
|
|
|
1245
1245
|
});
|
|
1246
1246
|
}
|
|
1247
1247
|
_addCheck(e) {
|
|
1248
|
-
return new
|
|
1248
|
+
return new oe({
|
|
1249
1249
|
...this._def,
|
|
1250
1250
|
checks: [...this._def.checks, e]
|
|
1251
1251
|
});
|
|
@@ -1327,7 +1327,7 @@ class ae extends S {
|
|
|
1327
1327
|
return e;
|
|
1328
1328
|
}
|
|
1329
1329
|
get isInt() {
|
|
1330
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1330
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && E.isInteger(e.value));
|
|
1331
1331
|
}
|
|
1332
1332
|
get isFinite() {
|
|
1333
1333
|
let e = null, r = null;
|
|
@@ -1339,13 +1339,13 @@ class ae extends S {
|
|
|
1339
1339
|
return Number.isFinite(r) && Number.isFinite(e);
|
|
1340
1340
|
}
|
|
1341
1341
|
}
|
|
1342
|
-
|
|
1342
|
+
oe.create = (t) => new oe({
|
|
1343
1343
|
checks: [],
|
|
1344
1344
|
typeName: k.ZodNumber,
|
|
1345
1345
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1346
|
-
...
|
|
1346
|
+
...T(t)
|
|
1347
1347
|
});
|
|
1348
|
-
class
|
|
1348
|
+
class ce extends S {
|
|
1349
1349
|
constructor() {
|
|
1350
1350
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1351
1351
|
}
|
|
@@ -1377,7 +1377,7 @@ class oe extends S {
|
|
|
1377
1377
|
code: u.not_multiple_of,
|
|
1378
1378
|
multipleOf: i.value,
|
|
1379
1379
|
message: i.message
|
|
1380
|
-
}), s.dirty()) :
|
|
1380
|
+
}), s.dirty()) : E.assertNever(i);
|
|
1381
1381
|
return { status: s.value, value: e.data };
|
|
1382
1382
|
}
|
|
1383
1383
|
_getInvalidInput(e) {
|
|
@@ -1401,7 +1401,7 @@ class oe extends S {
|
|
|
1401
1401
|
return this.setLimit("max", e, !1, y.toString(r));
|
|
1402
1402
|
}
|
|
1403
1403
|
setLimit(e, r, n, s) {
|
|
1404
|
-
return new
|
|
1404
|
+
return new ce({
|
|
1405
1405
|
...this._def,
|
|
1406
1406
|
checks: [
|
|
1407
1407
|
...this._def.checks,
|
|
@@ -1415,7 +1415,7 @@ class oe extends S {
|
|
|
1415
1415
|
});
|
|
1416
1416
|
}
|
|
1417
1417
|
_addCheck(e) {
|
|
1418
|
-
return new
|
|
1418
|
+
return new ce({
|
|
1419
1419
|
...this._def,
|
|
1420
1420
|
checks: [...this._def.checks, e]
|
|
1421
1421
|
});
|
|
@@ -1472,13 +1472,13 @@ class oe extends S {
|
|
|
1472
1472
|
return e;
|
|
1473
1473
|
}
|
|
1474
1474
|
}
|
|
1475
|
-
|
|
1475
|
+
ce.create = (t) => new ce({
|
|
1476
1476
|
checks: [],
|
|
1477
1477
|
typeName: k.ZodBigInt,
|
|
1478
1478
|
coerce: (t == null ? void 0 : t.coerce) ?? !1,
|
|
1479
|
-
...
|
|
1479
|
+
...T(t)
|
|
1480
1480
|
});
|
|
1481
|
-
class
|
|
1481
|
+
class Ze extends S {
|
|
1482
1482
|
_parse(e) {
|
|
1483
1483
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== g.boolean) {
|
|
1484
1484
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1491,12 +1491,12 @@ class je extends S {
|
|
|
1491
1491
|
return L(e.data);
|
|
1492
1492
|
}
|
|
1493
1493
|
}
|
|
1494
|
-
|
|
1494
|
+
Ze.create = (t) => new Ze({
|
|
1495
1495
|
typeName: k.ZodBoolean,
|
|
1496
1496
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1497
|
-
...
|
|
1497
|
+
...T(t)
|
|
1498
1498
|
});
|
|
1499
|
-
class
|
|
1499
|
+
class Se extends S {
|
|
1500
1500
|
_parse(e) {
|
|
1501
1501
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== g.date) {
|
|
1502
1502
|
const i = this._getOrReturnCtx(e);
|
|
@@ -1529,14 +1529,14 @@ class xe extends S {
|
|
|
1529
1529
|
exact: !1,
|
|
1530
1530
|
maximum: i.value,
|
|
1531
1531
|
type: "date"
|
|
1532
|
-
}), n.dirty()) :
|
|
1532
|
+
}), n.dirty()) : E.assertNever(i);
|
|
1533
1533
|
return {
|
|
1534
1534
|
status: n.value,
|
|
1535
1535
|
value: new Date(e.data.getTime())
|
|
1536
1536
|
};
|
|
1537
1537
|
}
|
|
1538
1538
|
_addCheck(e) {
|
|
1539
|
-
return new
|
|
1539
|
+
return new Se({
|
|
1540
1540
|
...this._def,
|
|
1541
1541
|
checks: [...this._def.checks, e]
|
|
1542
1542
|
});
|
|
@@ -1568,11 +1568,11 @@ class xe extends S {
|
|
|
1568
1568
|
return e != null ? new Date(e) : null;
|
|
1569
1569
|
}
|
|
1570
1570
|
}
|
|
1571
|
-
|
|
1571
|
+
Se.create = (t) => new Se({
|
|
1572
1572
|
checks: [],
|
|
1573
1573
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1574
1574
|
typeName: k.ZodDate,
|
|
1575
|
-
...
|
|
1575
|
+
...T(t)
|
|
1576
1576
|
});
|
|
1577
1577
|
class Tt extends S {
|
|
1578
1578
|
_parse(e) {
|
|
@@ -1589,9 +1589,9 @@ class Tt extends S {
|
|
|
1589
1589
|
}
|
|
1590
1590
|
Tt.create = (t) => new Tt({
|
|
1591
1591
|
typeName: k.ZodSymbol,
|
|
1592
|
-
...
|
|
1592
|
+
...T(t)
|
|
1593
1593
|
});
|
|
1594
|
-
class
|
|
1594
|
+
class We extends S {
|
|
1595
1595
|
_parse(e) {
|
|
1596
1596
|
if (this._getType(e) !== g.undefined) {
|
|
1597
1597
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1604,11 +1604,11 @@ class De extends S {
|
|
|
1604
1604
|
return L(e.data);
|
|
1605
1605
|
}
|
|
1606
1606
|
}
|
|
1607
|
-
|
|
1607
|
+
We.create = (t) => new We({
|
|
1608
1608
|
typeName: k.ZodUndefined,
|
|
1609
|
-
...
|
|
1609
|
+
...T(t)
|
|
1610
1610
|
});
|
|
1611
|
-
class
|
|
1611
|
+
class Ie extends S {
|
|
1612
1612
|
_parse(e) {
|
|
1613
1613
|
if (this._getType(e) !== g.null) {
|
|
1614
1614
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1621,9 +1621,9 @@ class Se extends S {
|
|
|
1621
1621
|
return L(e.data);
|
|
1622
1622
|
}
|
|
1623
1623
|
}
|
|
1624
|
-
|
|
1624
|
+
Ie.create = (t) => new Ie({
|
|
1625
1625
|
typeName: k.ZodNull,
|
|
1626
|
-
...
|
|
1626
|
+
...T(t)
|
|
1627
1627
|
});
|
|
1628
1628
|
class et extends S {
|
|
1629
1629
|
constructor() {
|
|
@@ -1635,9 +1635,9 @@ class et extends S {
|
|
|
1635
1635
|
}
|
|
1636
1636
|
et.create = (t) => new et({
|
|
1637
1637
|
typeName: k.ZodAny,
|
|
1638
|
-
...
|
|
1638
|
+
...T(t)
|
|
1639
1639
|
});
|
|
1640
|
-
class
|
|
1640
|
+
class ae extends S {
|
|
1641
1641
|
constructor() {
|
|
1642
1642
|
super(...arguments), this._unknown = !0;
|
|
1643
1643
|
}
|
|
@@ -1645,11 +1645,11 @@ class ie extends S {
|
|
|
1645
1645
|
return L(e.data);
|
|
1646
1646
|
}
|
|
1647
1647
|
}
|
|
1648
|
-
|
|
1648
|
+
ae.create = (t) => new ae({
|
|
1649
1649
|
typeName: k.ZodUnknown,
|
|
1650
|
-
...
|
|
1650
|
+
...T(t)
|
|
1651
1651
|
});
|
|
1652
|
-
class
|
|
1652
|
+
class re extends S {
|
|
1653
1653
|
_parse(e) {
|
|
1654
1654
|
const r = this._getOrReturnCtx(e);
|
|
1655
1655
|
return p(r, {
|
|
@@ -1659,9 +1659,9 @@ class te extends S {
|
|
|
1659
1659
|
}), v;
|
|
1660
1660
|
}
|
|
1661
1661
|
}
|
|
1662
|
-
|
|
1662
|
+
re.create = (t) => new re({
|
|
1663
1663
|
typeName: k.ZodNever,
|
|
1664
|
-
...
|
|
1664
|
+
...T(t)
|
|
1665
1665
|
});
|
|
1666
1666
|
class tt extends S {
|
|
1667
1667
|
_parse(e) {
|
|
@@ -1678,7 +1678,7 @@ class tt extends S {
|
|
|
1678
1678
|
}
|
|
1679
1679
|
tt.create = (t) => new tt({
|
|
1680
1680
|
typeName: k.ZodVoid,
|
|
1681
|
-
...
|
|
1681
|
+
...T(t)
|
|
1682
1682
|
});
|
|
1683
1683
|
class W extends S {
|
|
1684
1684
|
_parse(e) {
|
|
@@ -1690,11 +1690,11 @@ class W extends S {
|
|
|
1690
1690
|
received: r.parsedType
|
|
1691
1691
|
}), v;
|
|
1692
1692
|
if (s.exactLength !== null) {
|
|
1693
|
-
const
|
|
1694
|
-
(
|
|
1695
|
-
code:
|
|
1693
|
+
const c = r.data.length > s.exactLength.value, a = r.data.length < s.exactLength.value;
|
|
1694
|
+
(c || a) && (p(r, {
|
|
1695
|
+
code: c ? u.too_big : u.too_small,
|
|
1696
1696
|
minimum: a ? s.exactLength.value : void 0,
|
|
1697
|
-
maximum:
|
|
1697
|
+
maximum: c ? s.exactLength.value : void 0,
|
|
1698
1698
|
type: "array",
|
|
1699
1699
|
inclusive: !0,
|
|
1700
1700
|
exact: !0,
|
|
@@ -1716,8 +1716,8 @@ class W extends S {
|
|
|
1716
1716
|
exact: !1,
|
|
1717
1717
|
message: s.maxLength.message
|
|
1718
1718
|
}), n.dirty()), r.common.async)
|
|
1719
|
-
return Promise.all([...r.data].map((
|
|
1720
|
-
const i = [...r.data].map((
|
|
1719
|
+
return Promise.all([...r.data].map((c, a) => s.type._parseAsync(new z(r, c, r.path, a)))).then((c) => $.mergeArray(n, c));
|
|
1720
|
+
const i = [...r.data].map((c, a) => s.type._parseSync(new z(r, c, r.path, a)));
|
|
1721
1721
|
return $.mergeArray(n, i);
|
|
1722
1722
|
}
|
|
1723
1723
|
get element() {
|
|
@@ -1751,14 +1751,14 @@ W.create = (t, e) => new W({
|
|
|
1751
1751
|
maxLength: null,
|
|
1752
1752
|
exactLength: null,
|
|
1753
1753
|
typeName: k.ZodArray,
|
|
1754
|
-
...
|
|
1754
|
+
...T(e)
|
|
1755
1755
|
});
|
|
1756
|
-
function
|
|
1756
|
+
function ue(t) {
|
|
1757
1757
|
if (t instanceof A) {
|
|
1758
1758
|
const e = {};
|
|
1759
1759
|
for (const r in t.shape) {
|
|
1760
1760
|
const n = t.shape[r];
|
|
1761
|
-
e[r] = V.create(
|
|
1761
|
+
e[r] = V.create(ue(n));
|
|
1762
1762
|
}
|
|
1763
1763
|
return new A({
|
|
1764
1764
|
...t._def,
|
|
@@ -1766,8 +1766,8 @@ function fe(t) {
|
|
|
1766
1766
|
});
|
|
1767
1767
|
} else return t instanceof W ? new W({
|
|
1768
1768
|
...t._def,
|
|
1769
|
-
type:
|
|
1770
|
-
}) : t instanceof V ? V.create(
|
|
1769
|
+
type: ue(t.element)
|
|
1770
|
+
}) : t instanceof V ? V.create(ue(t.unwrap())) : t instanceof se ? se.create(ue(t.unwrap())) : t instanceof q ? q.create(t.items.map((e) => ue(e))) : t;
|
|
1771
1771
|
}
|
|
1772
1772
|
class A extends S {
|
|
1773
1773
|
constructor() {
|
|
@@ -1776,7 +1776,7 @@ class A extends S {
|
|
|
1776
1776
|
_getCached() {
|
|
1777
1777
|
if (this._cached !== null)
|
|
1778
1778
|
return this._cached;
|
|
1779
|
-
const e = this._def.shape(), r =
|
|
1779
|
+
const e = this._def.shape(), r = E.objectKeys(e);
|
|
1780
1780
|
return this._cached = { shape: e, keys: r }, this._cached;
|
|
1781
1781
|
}
|
|
1782
1782
|
_parse(e) {
|
|
@@ -1788,20 +1788,20 @@ class A extends S {
|
|
|
1788
1788
|
received: d.parsedType
|
|
1789
1789
|
}), v;
|
|
1790
1790
|
}
|
|
1791
|
-
const { status: n, ctx: s } = this._processInputParams(e), { shape: i, keys:
|
|
1792
|
-
if (!(this._def.catchall instanceof
|
|
1791
|
+
const { status: n, ctx: s } = this._processInputParams(e), { shape: i, keys: c } = this._getCached(), a = [];
|
|
1792
|
+
if (!(this._def.catchall instanceof re && this._def.unknownKeys === "strip"))
|
|
1793
1793
|
for (const d in s.data)
|
|
1794
|
-
|
|
1794
|
+
c.includes(d) || a.push(d);
|
|
1795
1795
|
const h = [];
|
|
1796
|
-
for (const d of
|
|
1796
|
+
for (const d of c) {
|
|
1797
1797
|
const m = i[d], R = s.data[d];
|
|
1798
1798
|
h.push({
|
|
1799
1799
|
key: { status: "valid", value: d },
|
|
1800
|
-
value: m._parse(new
|
|
1800
|
+
value: m._parse(new z(s, R, s.path, d)),
|
|
1801
1801
|
alwaysSet: d in s.data
|
|
1802
1802
|
});
|
|
1803
1803
|
}
|
|
1804
|
-
if (this._def.catchall instanceof
|
|
1804
|
+
if (this._def.catchall instanceof re) {
|
|
1805
1805
|
const d = this._def.unknownKeys;
|
|
1806
1806
|
if (d === "passthrough")
|
|
1807
1807
|
for (const m of a)
|
|
@@ -1822,7 +1822,7 @@ class A extends S {
|
|
|
1822
1822
|
h.push({
|
|
1823
1823
|
key: { status: "valid", value: m },
|
|
1824
1824
|
value: d._parse(
|
|
1825
|
-
new
|
|
1825
|
+
new z(s, R, s.path, m)
|
|
1826
1826
|
//, ctx.child(key), value, getParsedType(value)
|
|
1827
1827
|
),
|
|
1828
1828
|
alwaysSet: m in s.data
|
|
@@ -1851,8 +1851,8 @@ class A extends S {
|
|
|
1851
1851
|
unknownKeys: "strict",
|
|
1852
1852
|
...e !== void 0 ? {
|
|
1853
1853
|
errorMap: (r, n) => {
|
|
1854
|
-
var i,
|
|
1855
|
-
const s = ((
|
|
1854
|
+
var i, c;
|
|
1855
|
+
const s = ((c = (i = this._def).errorMap) == null ? void 0 : c.call(i, r, n).message) ?? n.defaultError;
|
|
1856
1856
|
return r.code === "unrecognized_keys" ? {
|
|
1857
1857
|
message: y.errToObj(e).message ?? s
|
|
1858
1858
|
} : {
|
|
@@ -1983,7 +1983,7 @@ class A extends S {
|
|
|
1983
1983
|
}
|
|
1984
1984
|
pick(e) {
|
|
1985
1985
|
const r = {};
|
|
1986
|
-
for (const n of
|
|
1986
|
+
for (const n of E.objectKeys(e))
|
|
1987
1987
|
e[n] && this.shape[n] && (r[n] = this.shape[n]);
|
|
1988
1988
|
return new A({
|
|
1989
1989
|
...this._def,
|
|
@@ -1992,7 +1992,7 @@ class A extends S {
|
|
|
1992
1992
|
}
|
|
1993
1993
|
omit(e) {
|
|
1994
1994
|
const r = {};
|
|
1995
|
-
for (const n of
|
|
1995
|
+
for (const n of E.objectKeys(this.shape))
|
|
1996
1996
|
e[n] || (r[n] = this.shape[n]);
|
|
1997
1997
|
return new A({
|
|
1998
1998
|
...this._def,
|
|
@@ -2003,11 +2003,11 @@ class A extends S {
|
|
|
2003
2003
|
* @deprecated
|
|
2004
2004
|
*/
|
|
2005
2005
|
deepPartial() {
|
|
2006
|
-
return
|
|
2006
|
+
return ue(this);
|
|
2007
2007
|
}
|
|
2008
2008
|
partial(e) {
|
|
2009
2009
|
const r = {};
|
|
2010
|
-
for (const n of
|
|
2010
|
+
for (const n of E.objectKeys(this.shape)) {
|
|
2011
2011
|
const s = this.shape[n];
|
|
2012
2012
|
e && !e[n] ? r[n] = s : r[n] = s.optional();
|
|
2013
2013
|
}
|
|
@@ -2018,7 +2018,7 @@ class A extends S {
|
|
|
2018
2018
|
}
|
|
2019
2019
|
required(e) {
|
|
2020
2020
|
const r = {};
|
|
2021
|
-
for (const n of
|
|
2021
|
+
for (const n of E.objectKeys(this.shape))
|
|
2022
2022
|
if (e && !e[n])
|
|
2023
2023
|
r[n] = this.shape[n];
|
|
2024
2024
|
else {
|
|
@@ -2033,31 +2033,31 @@ class A extends S {
|
|
|
2033
2033
|
});
|
|
2034
2034
|
}
|
|
2035
2035
|
keyof() {
|
|
2036
|
-
return $t(
|
|
2036
|
+
return $t(E.objectKeys(this.shape));
|
|
2037
2037
|
}
|
|
2038
2038
|
}
|
|
2039
2039
|
A.create = (t, e) => new A({
|
|
2040
2040
|
shape: () => t,
|
|
2041
2041
|
unknownKeys: "strip",
|
|
2042
|
-
catchall:
|
|
2042
|
+
catchall: re.create(),
|
|
2043
2043
|
typeName: k.ZodObject,
|
|
2044
|
-
...
|
|
2044
|
+
...T(e)
|
|
2045
2045
|
});
|
|
2046
2046
|
A.strictCreate = (t, e) => new A({
|
|
2047
2047
|
shape: () => t,
|
|
2048
2048
|
unknownKeys: "strict",
|
|
2049
|
-
catchall:
|
|
2049
|
+
catchall: re.create(),
|
|
2050
2050
|
typeName: k.ZodObject,
|
|
2051
|
-
...
|
|
2051
|
+
...T(e)
|
|
2052
2052
|
});
|
|
2053
2053
|
A.lazycreate = (t, e) => new A({
|
|
2054
2054
|
shape: t,
|
|
2055
2055
|
unknownKeys: "strip",
|
|
2056
|
-
catchall:
|
|
2056
|
+
catchall: re.create(),
|
|
2057
2057
|
typeName: k.ZodObject,
|
|
2058
|
-
...
|
|
2058
|
+
...T(e)
|
|
2059
2059
|
});
|
|
2060
|
-
class
|
|
2060
|
+
class Ee extends S {
|
|
2061
2061
|
_parse(e) {
|
|
2062
2062
|
const { ctx: r } = this._processInputParams(e), n = this._def.options;
|
|
2063
2063
|
function s(i) {
|
|
@@ -2067,15 +2067,15 @@ class Ie extends S {
|
|
|
2067
2067
|
for (const a of i)
|
|
2068
2068
|
if (a.result.status === "dirty")
|
|
2069
2069
|
return r.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2070
|
-
const
|
|
2070
|
+
const c = i.map((a) => new j(a.ctx.common.issues));
|
|
2071
2071
|
return p(r, {
|
|
2072
2072
|
code: u.invalid_union,
|
|
2073
|
-
unionErrors:
|
|
2073
|
+
unionErrors: c
|
|
2074
2074
|
}), v;
|
|
2075
2075
|
}
|
|
2076
2076
|
if (r.common.async)
|
|
2077
2077
|
return Promise.all(n.map(async (i) => {
|
|
2078
|
-
const
|
|
2078
|
+
const c = {
|
|
2079
2079
|
...r,
|
|
2080
2080
|
common: {
|
|
2081
2081
|
...r.common,
|
|
@@ -2087,14 +2087,14 @@ class Ie extends S {
|
|
|
2087
2087
|
result: await i._parseAsync({
|
|
2088
2088
|
data: r.data,
|
|
2089
2089
|
path: r.path,
|
|
2090
|
-
parent:
|
|
2090
|
+
parent: c
|
|
2091
2091
|
}),
|
|
2092
|
-
ctx:
|
|
2092
|
+
ctx: c
|
|
2093
2093
|
};
|
|
2094
2094
|
})).then(s);
|
|
2095
2095
|
{
|
|
2096
2096
|
let i;
|
|
2097
|
-
const
|
|
2097
|
+
const c = [];
|
|
2098
2098
|
for (const h of n) {
|
|
2099
2099
|
const d = {
|
|
2100
2100
|
...r,
|
|
@@ -2110,11 +2110,11 @@ class Ie extends S {
|
|
|
2110
2110
|
});
|
|
2111
2111
|
if (m.status === "valid")
|
|
2112
2112
|
return m;
|
|
2113
|
-
m.status === "dirty" && !i && (i = { result: m, ctx: d }), d.common.issues.length &&
|
|
2113
|
+
m.status === "dirty" && !i && (i = { result: m, ctx: d }), d.common.issues.length && c.push(d.common.issues);
|
|
2114
2114
|
}
|
|
2115
2115
|
if (i)
|
|
2116
2116
|
return r.common.issues.push(...i.ctx.common.issues), i.result;
|
|
2117
|
-
const a =
|
|
2117
|
+
const a = c.map((h) => new j(h));
|
|
2118
2118
|
return p(r, {
|
|
2119
2119
|
code: u.invalid_union,
|
|
2120
2120
|
unionErrors: a
|
|
@@ -2125,12 +2125,12 @@ class Ie extends S {
|
|
|
2125
2125
|
return this._def.options;
|
|
2126
2126
|
}
|
|
2127
2127
|
}
|
|
2128
|
-
|
|
2128
|
+
Ee.create = (t, e) => new Ee({
|
|
2129
2129
|
options: t,
|
|
2130
2130
|
typeName: k.ZodUnion,
|
|
2131
|
-
...
|
|
2131
|
+
...T(e)
|
|
2132
2132
|
});
|
|
2133
|
-
const
|
|
2133
|
+
const J = (t) => t instanceof Ce ? J(t.schema) : t instanceof Y ? J(t.innerType()) : t instanceof Oe ? [t.value] : t instanceof ne ? t.options : t instanceof st ? E.objectValues(t.enum) : t instanceof Ne ? J(t._def.innerType) : t instanceof We ? [void 0] : t instanceof Ie ? [null] : t instanceof V ? [void 0, ...J(t.unwrap())] : t instanceof se ? [null, ...J(t.unwrap())] : t instanceof ut || t instanceof Pe ? J(t.unwrap()) : t instanceof Me ? J(t._def.innerType) : [];
|
|
2134
2134
|
class ze extends S {
|
|
2135
2135
|
_parse(e) {
|
|
2136
2136
|
const { ctx: r } = this._processInputParams(e);
|
|
@@ -2175,10 +2175,10 @@ class ze extends S {
|
|
|
2175
2175
|
static create(e, r, n) {
|
|
2176
2176
|
const s = /* @__PURE__ */ new Map();
|
|
2177
2177
|
for (const i of r) {
|
|
2178
|
-
const
|
|
2179
|
-
if (!
|
|
2178
|
+
const c = J(i.shape[e]);
|
|
2179
|
+
if (!c.length)
|
|
2180
2180
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2181
|
-
for (const a of
|
|
2181
|
+
for (const a of c) {
|
|
2182
2182
|
if (s.has(a))
|
|
2183
2183
|
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);
|
|
2184
2184
|
s.set(a, i);
|
|
@@ -2189,29 +2189,29 @@ class ze extends S {
|
|
|
2189
2189
|
discriminator: e,
|
|
2190
2190
|
options: r,
|
|
2191
2191
|
optionsMap: s,
|
|
2192
|
-
...
|
|
2192
|
+
...T(n)
|
|
2193
2193
|
});
|
|
2194
2194
|
}
|
|
2195
2195
|
}
|
|
2196
2196
|
function rt(t, e) {
|
|
2197
|
-
const r =
|
|
2197
|
+
const r = te(t), n = te(e);
|
|
2198
2198
|
if (t === e)
|
|
2199
2199
|
return { valid: !0, data: t };
|
|
2200
2200
|
if (r === g.object && n === g.object) {
|
|
2201
|
-
const s =
|
|
2201
|
+
const s = E.objectKeys(e), i = E.objectKeys(t).filter((a) => s.indexOf(a) !== -1), c = { ...t, ...e };
|
|
2202
2202
|
for (const a of i) {
|
|
2203
2203
|
const h = rt(t[a], e[a]);
|
|
2204
2204
|
if (!h.valid)
|
|
2205
2205
|
return { valid: !1 };
|
|
2206
|
-
|
|
2206
|
+
c[a] = h.data;
|
|
2207
2207
|
}
|
|
2208
|
-
return { valid: !0, data:
|
|
2208
|
+
return { valid: !0, data: c };
|
|
2209
2209
|
} else if (r === g.array && n === g.array) {
|
|
2210
2210
|
if (t.length !== e.length)
|
|
2211
2211
|
return { valid: !1 };
|
|
2212
2212
|
const s = [];
|
|
2213
2213
|
for (let i = 0; i < t.length; i++) {
|
|
2214
|
-
const
|
|
2214
|
+
const c = t[i], a = e[i], h = rt(c, a);
|
|
2215
2215
|
if (!h.valid)
|
|
2216
2216
|
return { valid: !1 };
|
|
2217
2217
|
s.push(h.data);
|
|
@@ -2219,13 +2219,13 @@ function rt(t, e) {
|
|
|
2219
2219
|
return { valid: !0, data: s };
|
|
2220
2220
|
} else return r === g.date && n === g.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
|
|
2221
2221
|
}
|
|
2222
|
-
class
|
|
2222
|
+
class Re extends S {
|
|
2223
2223
|
_parse(e) {
|
|
2224
|
-
const { status: r, ctx: n } = this._processInputParams(e), s = (i,
|
|
2225
|
-
if (vt(i) || vt(
|
|
2224
|
+
const { status: r, ctx: n } = this._processInputParams(e), s = (i, c) => {
|
|
2225
|
+
if (vt(i) || vt(c))
|
|
2226
2226
|
return v;
|
|
2227
|
-
const a = rt(i.value,
|
|
2228
|
-
return a.valid ? ((kt(i) || kt(
|
|
2227
|
+
const a = rt(i.value, c.value);
|
|
2228
|
+
return a.valid ? ((kt(i) || kt(c)) && r.dirty(), { status: r.value, value: a.data }) : (p(n, {
|
|
2229
2229
|
code: u.invalid_intersection_types
|
|
2230
2230
|
}), v);
|
|
2231
2231
|
};
|
|
@@ -2240,7 +2240,7 @@ class Ee extends S {
|
|
|
2240
2240
|
path: n.path,
|
|
2241
2241
|
parent: n
|
|
2242
2242
|
})
|
|
2243
|
-
]).then(([i,
|
|
2243
|
+
]).then(([i, c]) => s(i, c)) : s(this._def.left._parseSync({
|
|
2244
2244
|
data: n.data,
|
|
2245
2245
|
path: n.path,
|
|
2246
2246
|
parent: n
|
|
@@ -2251,13 +2251,13 @@ class Ee extends S {
|
|
|
2251
2251
|
}));
|
|
2252
2252
|
}
|
|
2253
2253
|
}
|
|
2254
|
-
|
|
2254
|
+
Re.create = (t, e, r) => new Re({
|
|
2255
2255
|
left: t,
|
|
2256
2256
|
right: e,
|
|
2257
2257
|
typeName: k.ZodIntersection,
|
|
2258
|
-
...
|
|
2258
|
+
...T(r)
|
|
2259
2259
|
});
|
|
2260
|
-
class
|
|
2260
|
+
class q extends S {
|
|
2261
2261
|
_parse(e) {
|
|
2262
2262
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2263
2263
|
if (n.parsedType !== g.array)
|
|
@@ -2281,33 +2281,33 @@ class z extends S {
|
|
|
2281
2281
|
exact: !1,
|
|
2282
2282
|
type: "array"
|
|
2283
2283
|
}), r.dirty());
|
|
2284
|
-
const i = [...n.data].map((
|
|
2284
|
+
const i = [...n.data].map((c, a) => {
|
|
2285
2285
|
const h = this._def.items[a] || this._def.rest;
|
|
2286
|
-
return h ? h._parse(new
|
|
2287
|
-
}).filter((
|
|
2288
|
-
return n.common.async ? Promise.all(i).then((
|
|
2286
|
+
return h ? h._parse(new z(n, c, n.path, a)) : null;
|
|
2287
|
+
}).filter((c) => !!c);
|
|
2288
|
+
return n.common.async ? Promise.all(i).then((c) => $.mergeArray(r, c)) : $.mergeArray(r, i);
|
|
2289
2289
|
}
|
|
2290
2290
|
get items() {
|
|
2291
2291
|
return this._def.items;
|
|
2292
2292
|
}
|
|
2293
2293
|
rest(e) {
|
|
2294
|
-
return new
|
|
2294
|
+
return new q({
|
|
2295
2295
|
...this._def,
|
|
2296
2296
|
rest: e
|
|
2297
2297
|
});
|
|
2298
2298
|
}
|
|
2299
2299
|
}
|
|
2300
|
-
|
|
2300
|
+
q.create = (t, e) => {
|
|
2301
2301
|
if (!Array.isArray(t))
|
|
2302
2302
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2303
|
-
return new
|
|
2303
|
+
return new q({
|
|
2304
2304
|
items: t,
|
|
2305
2305
|
typeName: k.ZodTuple,
|
|
2306
2306
|
rest: null,
|
|
2307
|
-
...
|
|
2307
|
+
...T(e)
|
|
2308
2308
|
});
|
|
2309
2309
|
};
|
|
2310
|
-
class
|
|
2310
|
+
class Ae extends S {
|
|
2311
2311
|
get keySchema() {
|
|
2312
2312
|
return this._def.keyType;
|
|
2313
2313
|
}
|
|
@@ -2322,11 +2322,11 @@ class Re extends S {
|
|
|
2322
2322
|
expected: g.object,
|
|
2323
2323
|
received: n.parsedType
|
|
2324
2324
|
}), v;
|
|
2325
|
-
const s = [], i = this._def.keyType,
|
|
2325
|
+
const s = [], i = this._def.keyType, c = this._def.valueType;
|
|
2326
2326
|
for (const a in n.data)
|
|
2327
2327
|
s.push({
|
|
2328
|
-
key: i._parse(new
|
|
2329
|
-
value:
|
|
2328
|
+
key: i._parse(new z(n, a, n.path, a)),
|
|
2329
|
+
value: c._parse(new z(n, n.data[a], n.path, a)),
|
|
2330
2330
|
alwaysSet: a in n.data
|
|
2331
2331
|
});
|
|
2332
2332
|
return n.common.async ? $.mergeObjectAsync(r, s) : $.mergeObjectSync(r, s);
|
|
@@ -2335,16 +2335,16 @@ class Re extends S {
|
|
|
2335
2335
|
return this._def.valueType;
|
|
2336
2336
|
}
|
|
2337
2337
|
static create(e, r, n) {
|
|
2338
|
-
return r instanceof S ? new
|
|
2338
|
+
return r instanceof S ? new Ae({
|
|
2339
2339
|
keyType: e,
|
|
2340
2340
|
valueType: r,
|
|
2341
2341
|
typeName: k.ZodRecord,
|
|
2342
|
-
...
|
|
2343
|
-
}) : new
|
|
2344
|
-
keyType:
|
|
2342
|
+
...T(n)
|
|
2343
|
+
}) : new Ae({
|
|
2344
|
+
keyType: B.create(),
|
|
2345
2345
|
valueType: e,
|
|
2346
2346
|
typeName: k.ZodRecord,
|
|
2347
|
-
...
|
|
2347
|
+
...T(r)
|
|
2348
2348
|
});
|
|
2349
2349
|
}
|
|
2350
2350
|
}
|
|
@@ -2363,14 +2363,14 @@ class nt extends S {
|
|
|
2363
2363
|
expected: g.map,
|
|
2364
2364
|
received: n.parsedType
|
|
2365
2365
|
}), v;
|
|
2366
|
-
const s = this._def.keyType, i = this._def.valueType,
|
|
2367
|
-
key: s._parse(new
|
|
2368
|
-
value: i._parse(new
|
|
2366
|
+
const s = this._def.keyType, i = this._def.valueType, c = [...n.data.entries()].map(([a, h], d) => ({
|
|
2367
|
+
key: s._parse(new z(n, a, n.path, [d, "key"])),
|
|
2368
|
+
value: i._parse(new z(n, h, n.path, [d, "value"]))
|
|
2369
2369
|
}));
|
|
2370
2370
|
if (n.common.async) {
|
|
2371
2371
|
const a = /* @__PURE__ */ new Map();
|
|
2372
2372
|
return Promise.resolve().then(async () => {
|
|
2373
|
-
for (const h of
|
|
2373
|
+
for (const h of c) {
|
|
2374
2374
|
const d = await h.key, m = await h.value;
|
|
2375
2375
|
if (d.status === "aborted" || m.status === "aborted")
|
|
2376
2376
|
return v;
|
|
@@ -2380,7 +2380,7 @@ class nt extends S {
|
|
|
2380
2380
|
});
|
|
2381
2381
|
} else {
|
|
2382
2382
|
const a = /* @__PURE__ */ new Map();
|
|
2383
|
-
for (const h of
|
|
2383
|
+
for (const h of c) {
|
|
2384
2384
|
const d = h.key, m = h.value;
|
|
2385
2385
|
if (d.status === "aborted" || m.status === "aborted")
|
|
2386
2386
|
return v;
|
|
@@ -2394,9 +2394,9 @@ nt.create = (t, e, r) => new nt({
|
|
|
2394
2394
|
valueType: e,
|
|
2395
2395
|
keyType: t,
|
|
2396
2396
|
typeName: k.ZodMap,
|
|
2397
|
-
...
|
|
2397
|
+
...T(r)
|
|
2398
2398
|
});
|
|
2399
|
-
class
|
|
2399
|
+
class me extends S {
|
|
2400
2400
|
_parse(e) {
|
|
2401
2401
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2402
2402
|
if (n.parsedType !== g.set)
|
|
@@ -2422,7 +2422,7 @@ class ge extends S {
|
|
|
2422
2422
|
message: s.maxSize.message
|
|
2423
2423
|
}), r.dirty());
|
|
2424
2424
|
const i = this._def.valueType;
|
|
2425
|
-
function
|
|
2425
|
+
function c(h) {
|
|
2426
2426
|
const d = /* @__PURE__ */ new Set();
|
|
2427
2427
|
for (const m of h) {
|
|
2428
2428
|
if (m.status === "aborted")
|
|
@@ -2431,17 +2431,17 @@ class ge extends S {
|
|
|
2431
2431
|
}
|
|
2432
2432
|
return { status: r.value, value: d };
|
|
2433
2433
|
}
|
|
2434
|
-
const a = [...n.data.values()].map((h, d) => i._parse(new
|
|
2435
|
-
return n.common.async ? Promise.all(a).then((h) =>
|
|
2434
|
+
const a = [...n.data.values()].map((h, d) => i._parse(new z(n, h, n.path, d)));
|
|
2435
|
+
return n.common.async ? Promise.all(a).then((h) => c(h)) : c(a);
|
|
2436
2436
|
}
|
|
2437
2437
|
min(e, r) {
|
|
2438
|
-
return new
|
|
2438
|
+
return new me({
|
|
2439
2439
|
...this._def,
|
|
2440
2440
|
minSize: { value: e, message: y.toString(r) }
|
|
2441
2441
|
});
|
|
2442
2442
|
}
|
|
2443
2443
|
max(e, r) {
|
|
2444
|
-
return new
|
|
2444
|
+
return new me({
|
|
2445
2445
|
...this._def,
|
|
2446
2446
|
maxSize: { value: e, message: y.toString(r) }
|
|
2447
2447
|
});
|
|
@@ -2453,14 +2453,14 @@ class ge extends S {
|
|
|
2453
2453
|
return this.min(1, e);
|
|
2454
2454
|
}
|
|
2455
2455
|
}
|
|
2456
|
-
|
|
2456
|
+
me.create = (t, e) => new me({
|
|
2457
2457
|
valueType: t,
|
|
2458
2458
|
minSize: null,
|
|
2459
2459
|
maxSize: null,
|
|
2460
2460
|
typeName: k.ZodSet,
|
|
2461
|
-
...
|
|
2461
|
+
...T(e)
|
|
2462
2462
|
});
|
|
2463
|
-
class
|
|
2463
|
+
class we extends S {
|
|
2464
2464
|
constructor() {
|
|
2465
2465
|
super(...arguments), this.validate = this.implement;
|
|
2466
2466
|
}
|
|
@@ -2476,7 +2476,7 @@ class ke extends S {
|
|
|
2476
2476
|
return Xe({
|
|
2477
2477
|
data: a,
|
|
2478
2478
|
path: r.path,
|
|
2479
|
-
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, Qe(),
|
|
2479
|
+
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, Qe(), xe].filter((d) => !!d),
|
|
2480
2480
|
issueData: {
|
|
2481
2481
|
code: u.invalid_arguments,
|
|
2482
2482
|
argumentsError: h
|
|
@@ -2487,22 +2487,22 @@ class ke extends S {
|
|
|
2487
2487
|
return Xe({
|
|
2488
2488
|
data: a,
|
|
2489
2489
|
path: r.path,
|
|
2490
|
-
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, Qe(),
|
|
2490
|
+
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, Qe(), xe].filter((d) => !!d),
|
|
2491
2491
|
issueData: {
|
|
2492
2492
|
code: u.invalid_return_type,
|
|
2493
2493
|
returnTypeError: h
|
|
2494
2494
|
}
|
|
2495
2495
|
});
|
|
2496
2496
|
}
|
|
2497
|
-
const i = { errorMap: r.common.contextualErrorMap },
|
|
2498
|
-
if (this._def.returns instanceof
|
|
2497
|
+
const i = { errorMap: r.common.contextualErrorMap }, c = r.data;
|
|
2498
|
+
if (this._def.returns instanceof ge) {
|
|
2499
2499
|
const a = this;
|
|
2500
2500
|
return L(async function(...h) {
|
|
2501
|
-
const d = new j([]), m = await a._def.args.parseAsync(h, i).catch((
|
|
2502
|
-
throw d.addIssue(n(h,
|
|
2503
|
-
}), R = await Reflect.apply(
|
|
2504
|
-
return await a._def.returns._def.type.parseAsync(R, i).catch((
|
|
2505
|
-
throw d.addIssue(s(R,
|
|
2501
|
+
const d = new j([]), m = await a._def.args.parseAsync(h, i).catch((X) => {
|
|
2502
|
+
throw d.addIssue(n(h, X)), d;
|
|
2503
|
+
}), R = await Reflect.apply(c, this, m);
|
|
2504
|
+
return await a._def.returns._def.type.parseAsync(R, i).catch((X) => {
|
|
2505
|
+
throw d.addIssue(s(R, X)), d;
|
|
2506
2506
|
});
|
|
2507
2507
|
});
|
|
2508
2508
|
} else {
|
|
@@ -2511,7 +2511,7 @@ class ke extends S {
|
|
|
2511
2511
|
const d = a._def.args.safeParse(h, i);
|
|
2512
2512
|
if (!d.success)
|
|
2513
2513
|
throw new j([n(h, d.error)]);
|
|
2514
|
-
const m = Reflect.apply(
|
|
2514
|
+
const m = Reflect.apply(c, this, d.data), R = a._def.returns.safeParse(m, i);
|
|
2515
2515
|
if (!R.success)
|
|
2516
2516
|
throw new j([s(m, R.error)]);
|
|
2517
2517
|
return R.data;
|
|
@@ -2525,13 +2525,13 @@ class ke extends S {
|
|
|
2525
2525
|
return this._def.returns;
|
|
2526
2526
|
}
|
|
2527
2527
|
args(...e) {
|
|
2528
|
-
return new
|
|
2528
|
+
return new we({
|
|
2529
2529
|
...this._def,
|
|
2530
|
-
args:
|
|
2530
|
+
args: q.create(e).rest(ae.create())
|
|
2531
2531
|
});
|
|
2532
2532
|
}
|
|
2533
2533
|
returns(e) {
|
|
2534
|
-
return new
|
|
2534
|
+
return new we({
|
|
2535
2535
|
...this._def,
|
|
2536
2536
|
returns: e
|
|
2537
2537
|
});
|
|
@@ -2543,15 +2543,15 @@ class ke extends S {
|
|
|
2543
2543
|
return this.parse(e);
|
|
2544
2544
|
}
|
|
2545
2545
|
static create(e, r, n) {
|
|
2546
|
-
return new
|
|
2547
|
-
args: e ||
|
|
2548
|
-
returns: r ||
|
|
2546
|
+
return new we({
|
|
2547
|
+
args: e || q.create([]).rest(ae.create()),
|
|
2548
|
+
returns: r || ae.create(),
|
|
2549
2549
|
typeName: k.ZodFunction,
|
|
2550
|
-
...
|
|
2550
|
+
...T(n)
|
|
2551
2551
|
});
|
|
2552
2552
|
}
|
|
2553
2553
|
}
|
|
2554
|
-
class
|
|
2554
|
+
class Ce extends S {
|
|
2555
2555
|
get schema() {
|
|
2556
2556
|
return this._def.getter();
|
|
2557
2557
|
}
|
|
@@ -2560,12 +2560,12 @@ class Ze extends S {
|
|
|
2560
2560
|
return this._def.getter()._parse({ data: r.data, path: r.path, parent: r });
|
|
2561
2561
|
}
|
|
2562
2562
|
}
|
|
2563
|
-
|
|
2563
|
+
Ce.create = (t, e) => new Ce({
|
|
2564
2564
|
getter: t,
|
|
2565
2565
|
typeName: k.ZodLazy,
|
|
2566
|
-
...
|
|
2566
|
+
...T(e)
|
|
2567
2567
|
});
|
|
2568
|
-
class
|
|
2568
|
+
class Oe extends S {
|
|
2569
2569
|
_parse(e) {
|
|
2570
2570
|
if (e.data !== this._def.value) {
|
|
2571
2571
|
const r = this._getOrReturnCtx(e);
|
|
@@ -2581,24 +2581,24 @@ class Ae extends S {
|
|
|
2581
2581
|
return this._def.value;
|
|
2582
2582
|
}
|
|
2583
2583
|
}
|
|
2584
|
-
|
|
2584
|
+
Oe.create = (t, e) => new Oe({
|
|
2585
2585
|
value: t,
|
|
2586
2586
|
typeName: k.ZodLiteral,
|
|
2587
|
-
...
|
|
2587
|
+
...T(e)
|
|
2588
2588
|
});
|
|
2589
2589
|
function $t(t, e) {
|
|
2590
|
-
return new
|
|
2590
|
+
return new ne({
|
|
2591
2591
|
values: t,
|
|
2592
2592
|
typeName: k.ZodEnum,
|
|
2593
|
-
...
|
|
2593
|
+
...T(e)
|
|
2594
2594
|
});
|
|
2595
2595
|
}
|
|
2596
|
-
class
|
|
2596
|
+
class ne extends S {
|
|
2597
2597
|
_parse(e) {
|
|
2598
2598
|
if (typeof e.data != "string") {
|
|
2599
2599
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
2600
2600
|
return p(r, {
|
|
2601
|
-
expected:
|
|
2601
|
+
expected: E.joinValues(n),
|
|
2602
2602
|
received: r.parsedType,
|
|
2603
2603
|
code: u.invalid_type
|
|
2604
2604
|
}), v;
|
|
@@ -2635,32 +2635,32 @@ class re extends S {
|
|
|
2635
2635
|
return e;
|
|
2636
2636
|
}
|
|
2637
2637
|
extract(e, r = this._def) {
|
|
2638
|
-
return
|
|
2638
|
+
return ne.create(e, {
|
|
2639
2639
|
...this._def,
|
|
2640
2640
|
...r
|
|
2641
2641
|
});
|
|
2642
2642
|
}
|
|
2643
2643
|
exclude(e, r = this._def) {
|
|
2644
|
-
return
|
|
2644
|
+
return ne.create(this.options.filter((n) => !e.includes(n)), {
|
|
2645
2645
|
...this._def,
|
|
2646
2646
|
...r
|
|
2647
2647
|
});
|
|
2648
2648
|
}
|
|
2649
2649
|
}
|
|
2650
|
-
|
|
2650
|
+
ne.create = $t;
|
|
2651
2651
|
class st extends S {
|
|
2652
2652
|
_parse(e) {
|
|
2653
|
-
const r =
|
|
2653
|
+
const r = E.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2654
2654
|
if (n.parsedType !== g.string && n.parsedType !== g.number) {
|
|
2655
|
-
const s =
|
|
2655
|
+
const s = E.objectValues(r);
|
|
2656
2656
|
return p(n, {
|
|
2657
|
-
expected:
|
|
2657
|
+
expected: E.joinValues(s),
|
|
2658
2658
|
received: n.parsedType,
|
|
2659
2659
|
code: u.invalid_type
|
|
2660
2660
|
}), v;
|
|
2661
2661
|
}
|
|
2662
|
-
if (this._cache || (this._cache = new Set(
|
|
2663
|
-
const s =
|
|
2662
|
+
if (this._cache || (this._cache = new Set(E.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
2663
|
+
const s = E.objectValues(r);
|
|
2664
2664
|
return p(n, {
|
|
2665
2665
|
received: n.data,
|
|
2666
2666
|
code: u.invalid_enum_value,
|
|
@@ -2676,9 +2676,9 @@ class st extends S {
|
|
|
2676
2676
|
st.create = (t, e) => new st({
|
|
2677
2677
|
values: t,
|
|
2678
2678
|
typeName: k.ZodNativeEnum,
|
|
2679
|
-
...
|
|
2679
|
+
...T(e)
|
|
2680
2680
|
});
|
|
2681
|
-
class
|
|
2681
|
+
class ge extends S {
|
|
2682
2682
|
unwrap() {
|
|
2683
2683
|
return this._def.type;
|
|
2684
2684
|
}
|
|
@@ -2697,12 +2697,12 @@ class ye extends S {
|
|
|
2697
2697
|
})));
|
|
2698
2698
|
}
|
|
2699
2699
|
}
|
|
2700
|
-
|
|
2700
|
+
ge.create = (t, e) => new ge({
|
|
2701
2701
|
type: t,
|
|
2702
2702
|
typeName: k.ZodPromise,
|
|
2703
|
-
...
|
|
2703
|
+
...T(e)
|
|
2704
2704
|
});
|
|
2705
|
-
class
|
|
2705
|
+
class Y extends S {
|
|
2706
2706
|
innerType() {
|
|
2707
2707
|
return this._def.schema;
|
|
2708
2708
|
}
|
|
@@ -2711,17 +2711,17 @@ class J extends S {
|
|
|
2711
2711
|
}
|
|
2712
2712
|
_parse(e) {
|
|
2713
2713
|
const { status: r, ctx: n } = this._processInputParams(e), s = this._def.effect || null, i = {
|
|
2714
|
-
addIssue: (
|
|
2715
|
-
p(n,
|
|
2714
|
+
addIssue: (c) => {
|
|
2715
|
+
p(n, c), c.fatal ? r.abort() : r.dirty();
|
|
2716
2716
|
},
|
|
2717
2717
|
get path() {
|
|
2718
2718
|
return n.path;
|
|
2719
2719
|
}
|
|
2720
2720
|
};
|
|
2721
2721
|
if (i.addIssue = i.addIssue.bind(i), s.type === "preprocess") {
|
|
2722
|
-
const
|
|
2722
|
+
const c = s.transform(n.data, i);
|
|
2723
2723
|
if (n.common.async)
|
|
2724
|
-
return Promise.resolve(
|
|
2724
|
+
return Promise.resolve(c).then(async (a) => {
|
|
2725
2725
|
if (r.value === "aborted")
|
|
2726
2726
|
return v;
|
|
2727
2727
|
const h = await this._def.schema._parseAsync({
|
|
@@ -2729,21 +2729,21 @@ class J extends S {
|
|
|
2729
2729
|
path: n.path,
|
|
2730
2730
|
parent: n
|
|
2731
2731
|
});
|
|
2732
|
-
return h.status === "aborted" ? v : h.status === "dirty" || r.value === "dirty" ?
|
|
2732
|
+
return h.status === "aborted" ? v : h.status === "dirty" || r.value === "dirty" ? ve(h.value) : h;
|
|
2733
2733
|
});
|
|
2734
2734
|
{
|
|
2735
2735
|
if (r.value === "aborted")
|
|
2736
2736
|
return v;
|
|
2737
2737
|
const a = this._def.schema._parseSync({
|
|
2738
|
-
data:
|
|
2738
|
+
data: c,
|
|
2739
2739
|
path: n.path,
|
|
2740
2740
|
parent: n
|
|
2741
2741
|
});
|
|
2742
|
-
return a.status === "aborted" ? v : a.status === "dirty" || r.value === "dirty" ?
|
|
2742
|
+
return a.status === "aborted" ? v : a.status === "dirty" || r.value === "dirty" ? ve(a.value) : a;
|
|
2743
2743
|
}
|
|
2744
2744
|
}
|
|
2745
2745
|
if (s.type === "refinement") {
|
|
2746
|
-
const
|
|
2746
|
+
const c = (a) => {
|
|
2747
2747
|
const h = s.refinement(a, i);
|
|
2748
2748
|
if (n.common.async)
|
|
2749
2749
|
return Promise.resolve(h);
|
|
@@ -2757,42 +2757,42 @@ class J extends S {
|
|
|
2757
2757
|
path: n.path,
|
|
2758
2758
|
parent: n
|
|
2759
2759
|
});
|
|
2760
|
-
return a.status === "aborted" ? v : (a.status === "dirty" && r.dirty(),
|
|
2760
|
+
return a.status === "aborted" ? v : (a.status === "dirty" && r.dirty(), c(a.value), { status: r.value, value: a.value });
|
|
2761
2761
|
} else
|
|
2762
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) => a.status === "aborted" ? v : (a.status === "dirty" && r.dirty(),
|
|
2762
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) => a.status === "aborted" ? v : (a.status === "dirty" && r.dirty(), c(a.value).then(() => ({ status: r.value, value: a.value }))));
|
|
2763
2763
|
}
|
|
2764
2764
|
if (s.type === "transform")
|
|
2765
2765
|
if (n.common.async === !1) {
|
|
2766
|
-
const
|
|
2766
|
+
const c = this._def.schema._parseSync({
|
|
2767
2767
|
data: n.data,
|
|
2768
2768
|
path: n.path,
|
|
2769
2769
|
parent: n
|
|
2770
2770
|
});
|
|
2771
|
-
if (!
|
|
2771
|
+
if (!pe(c))
|
|
2772
2772
|
return v;
|
|
2773
|
-
const a = s.transform(
|
|
2773
|
+
const a = s.transform(c.value, i);
|
|
2774
2774
|
if (a instanceof Promise)
|
|
2775
2775
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2776
2776
|
return { status: r.value, value: a };
|
|
2777
2777
|
} else
|
|
2778
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
2778
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((c) => pe(c) ? Promise.resolve(s.transform(c.value, i)).then((a) => ({
|
|
2779
2779
|
status: r.value,
|
|
2780
2780
|
value: a
|
|
2781
2781
|
})) : v);
|
|
2782
|
-
|
|
2782
|
+
E.assertNever(s);
|
|
2783
2783
|
}
|
|
2784
2784
|
}
|
|
2785
|
-
|
|
2785
|
+
Y.create = (t, e, r) => new Y({
|
|
2786
2786
|
schema: t,
|
|
2787
2787
|
typeName: k.ZodEffects,
|
|
2788
2788
|
effect: e,
|
|
2789
|
-
...
|
|
2789
|
+
...T(r)
|
|
2790
2790
|
});
|
|
2791
|
-
|
|
2791
|
+
Y.createWithPreprocess = (t, e, r) => new Y({
|
|
2792
2792
|
schema: e,
|
|
2793
2793
|
effect: { type: "preprocess", transform: t },
|
|
2794
2794
|
typeName: k.ZodEffects,
|
|
2795
|
-
...
|
|
2795
|
+
...T(r)
|
|
2796
2796
|
});
|
|
2797
2797
|
class V extends S {
|
|
2798
2798
|
_parse(e) {
|
|
@@ -2805,9 +2805,9 @@ class V extends S {
|
|
|
2805
2805
|
V.create = (t, e) => new V({
|
|
2806
2806
|
innerType: t,
|
|
2807
2807
|
typeName: k.ZodOptional,
|
|
2808
|
-
...
|
|
2808
|
+
...T(e)
|
|
2809
2809
|
});
|
|
2810
|
-
class
|
|
2810
|
+
class se extends S {
|
|
2811
2811
|
_parse(e) {
|
|
2812
2812
|
return this._getType(e) === g.null ? L(null) : this._def.innerType._parse(e);
|
|
2813
2813
|
}
|
|
@@ -2815,12 +2815,12 @@ class ne extends S {
|
|
|
2815
2815
|
return this._def.innerType;
|
|
2816
2816
|
}
|
|
2817
2817
|
}
|
|
2818
|
-
|
|
2818
|
+
se.create = (t, e) => new se({
|
|
2819
2819
|
innerType: t,
|
|
2820
2820
|
typeName: k.ZodNullable,
|
|
2821
|
-
...
|
|
2821
|
+
...T(e)
|
|
2822
2822
|
});
|
|
2823
|
-
class
|
|
2823
|
+
class Ne extends S {
|
|
2824
2824
|
_parse(e) {
|
|
2825
2825
|
const { ctx: r } = this._processInputParams(e);
|
|
2826
2826
|
let n = r.data;
|
|
@@ -2834,13 +2834,13 @@ class Ce extends S {
|
|
|
2834
2834
|
return this._def.innerType;
|
|
2835
2835
|
}
|
|
2836
2836
|
}
|
|
2837
|
-
|
|
2837
|
+
Ne.create = (t, e) => new Ne({
|
|
2838
2838
|
innerType: t,
|
|
2839
2839
|
typeName: k.ZodDefault,
|
|
2840
2840
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2841
|
-
...
|
|
2841
|
+
...T(e)
|
|
2842
2842
|
});
|
|
2843
|
-
class
|
|
2843
|
+
class Me extends S {
|
|
2844
2844
|
_parse(e) {
|
|
2845
2845
|
const { ctx: r } = this._processInputParams(e), n = {
|
|
2846
2846
|
...r,
|
|
@@ -2855,7 +2855,7 @@ class Oe extends S {
|
|
|
2855
2855
|
...n
|
|
2856
2856
|
}
|
|
2857
2857
|
});
|
|
2858
|
-
return
|
|
2858
|
+
return De(s) ? s.then((i) => ({
|
|
2859
2859
|
status: "valid",
|
|
2860
2860
|
value: i.status === "valid" ? i.value : this._def.catchValue({
|
|
2861
2861
|
get error() {
|
|
@@ -2877,11 +2877,11 @@ class Oe extends S {
|
|
|
2877
2877
|
return this._def.innerType;
|
|
2878
2878
|
}
|
|
2879
2879
|
}
|
|
2880
|
-
|
|
2880
|
+
Me.create = (t, e) => new Me({
|
|
2881
2881
|
innerType: t,
|
|
2882
2882
|
typeName: k.ZodCatch,
|
|
2883
2883
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2884
|
-
...
|
|
2884
|
+
...T(e)
|
|
2885
2885
|
});
|
|
2886
2886
|
class it extends S {
|
|
2887
2887
|
_parse(e) {
|
|
@@ -2898,7 +2898,7 @@ class it extends S {
|
|
|
2898
2898
|
}
|
|
2899
2899
|
it.create = (t) => new it({
|
|
2900
2900
|
typeName: k.ZodNaN,
|
|
2901
|
-
...
|
|
2901
|
+
...T(t)
|
|
2902
2902
|
});
|
|
2903
2903
|
class ut extends S {
|
|
2904
2904
|
_parse(e) {
|
|
@@ -2923,7 +2923,7 @@ class qe extends S {
|
|
|
2923
2923
|
path: n.path,
|
|
2924
2924
|
parent: n
|
|
2925
2925
|
});
|
|
2926
|
-
return i.status === "aborted" ? v : i.status === "dirty" ? (r.dirty(),
|
|
2926
|
+
return i.status === "aborted" ? v : i.status === "dirty" ? (r.dirty(), ve(i.value)) : this._def.out._parseAsync({
|
|
2927
2927
|
data: i.value,
|
|
2928
2928
|
path: n.path,
|
|
2929
2929
|
parent: n
|
|
@@ -2953,157 +2953,157 @@ class qe extends S {
|
|
|
2953
2953
|
});
|
|
2954
2954
|
}
|
|
2955
2955
|
}
|
|
2956
|
-
class
|
|
2956
|
+
class Pe extends S {
|
|
2957
2957
|
_parse(e) {
|
|
2958
|
-
const r = this._def.innerType._parse(e), n = (s) => (
|
|
2959
|
-
return
|
|
2958
|
+
const r = this._def.innerType._parse(e), n = (s) => (pe(s) && (s.value = Object.freeze(s.value)), s);
|
|
2959
|
+
return De(r) ? r.then((s) => n(s)) : n(r);
|
|
2960
2960
|
}
|
|
2961
2961
|
unwrap() {
|
|
2962
2962
|
return this._def.innerType;
|
|
2963
2963
|
}
|
|
2964
2964
|
}
|
|
2965
|
-
|
|
2965
|
+
Pe.create = (t, e) => new Pe({
|
|
2966
2966
|
innerType: t,
|
|
2967
2967
|
typeName: k.ZodReadonly,
|
|
2968
|
-
...
|
|
2968
|
+
...T(e)
|
|
2969
2969
|
});
|
|
2970
2970
|
var k;
|
|
2971
2971
|
(function(t) {
|
|
2972
2972
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
2973
2973
|
})(k || (k = {}));
|
|
2974
|
-
const
|
|
2975
|
-
|
|
2976
|
-
const
|
|
2977
|
-
|
|
2978
|
-
const
|
|
2979
|
-
|
|
2974
|
+
const o = B.create, f = oe.create, H = ce.create, w = Ze.create, Lt = Ie.create, _ = ae.create;
|
|
2975
|
+
re.create;
|
|
2976
|
+
const I = W.create, l = A.create, x = Ee.create, jr = ze.create;
|
|
2977
|
+
Re.create;
|
|
2978
|
+
const Dr = q.create, b = Ae.create, Zr = Ce.create, Te = Oe.create, $e = ne.create;
|
|
2979
|
+
ge.create;
|
|
2980
2980
|
V.create;
|
|
2981
|
-
|
|
2982
|
-
const
|
|
2983
|
-
function
|
|
2981
|
+
se.create;
|
|
2982
|
+
const Q = Y.createWithPreprocess;
|
|
2983
|
+
function M(t, e = 0, r = 2) {
|
|
2984
2984
|
if (e > r) return "...";
|
|
2985
2985
|
if (t instanceof A) {
|
|
2986
|
-
const n = t.shape, s = Object.keys(n).filter((
|
|
2987
|
-
return s.length === 0 ? "{ }" : e >= r - 1 ? "{ ... }" : `{ ${s.map((
|
|
2988
|
-
const a = n[
|
|
2989
|
-
return `${
|
|
2986
|
+
const n = t.shape, s = Object.keys(n).filter((c) => !c.startsWith("__"));
|
|
2987
|
+
return s.length === 0 ? "{ }" : e >= r - 1 ? "{ ... }" : `{ ${s.map((c) => {
|
|
2988
|
+
const a = n[c], h = a instanceof V, d = M(h ? a.unwrap() : a, e + 1, r);
|
|
2989
|
+
return `${c}${h ? "?" : ""}: ${d}`;
|
|
2990
2990
|
}).join(", ")} }`;
|
|
2991
2991
|
}
|
|
2992
|
-
if (t instanceof
|
|
2993
|
-
return t.options.map((n) =>
|
|
2994
|
-
if (t instanceof
|
|
2995
|
-
if (t instanceof
|
|
2996
|
-
if (t instanceof
|
|
2997
|
-
if (t instanceof
|
|
2998
|
-
if (t instanceof
|
|
2992
|
+
if (t instanceof Ee)
|
|
2993
|
+
return t.options.map((n) => M(n, e, r)).join(" or ");
|
|
2994
|
+
if (t instanceof B) return "string";
|
|
2995
|
+
if (t instanceof oe) return "number";
|
|
2996
|
+
if (t instanceof Ze) return "boolean";
|
|
2997
|
+
if (t instanceof ce) return "bigint";
|
|
2998
|
+
if (t instanceof Ie) return "null";
|
|
2999
2999
|
if (t instanceof W) {
|
|
3000
|
-
const n =
|
|
3000
|
+
const n = M(t.element, e + 1, r);
|
|
3001
3001
|
return n === "unknown" || n === "any" ? "array" : `${n}[]`;
|
|
3002
3002
|
}
|
|
3003
|
-
if (t instanceof
|
|
3004
|
-
return `[${t.items.map((n) =>
|
|
3005
|
-
if (t instanceof
|
|
3006
|
-
const n =
|
|
3003
|
+
if (t instanceof q)
|
|
3004
|
+
return `[${t.items.map((n) => M(n, e + 1, r)).join(", ")}]`;
|
|
3005
|
+
if (t instanceof Ae) {
|
|
3006
|
+
const n = M(
|
|
3007
3007
|
t._def.valueType,
|
|
3008
3008
|
e + 1,
|
|
3009
3009
|
r
|
|
3010
3010
|
);
|
|
3011
3011
|
return n === "unknown" || n === "any" ? "{ [key: string]: unknown }" : `{ [key: string]: ${n} }`;
|
|
3012
3012
|
}
|
|
3013
|
-
return t instanceof V ? `${
|
|
3013
|
+
return t instanceof V ? `${M(t.unwrap(), e, r)}?` : t instanceof Oe ? JSON.stringify(t.value) : t instanceof ne ? t.options.map((n) => `"${n}"`).join(" | ") : t instanceof et ? "any" : t instanceof ae ? "unknown" : t instanceof tt ? "void" : t instanceof We ? "undefined" : t instanceof Y ? M(t.innerType(), e, r) : t instanceof Ne ? M(t.removeDefault(), e, r) : t instanceof se ? `${M(t.unwrap(), e, r)} | null` : t instanceof Ce ? "lazy" : t instanceof ge ? `Promise<${M(t.unwrap(), e + 1, r)}>` : t instanceof we ? "function" : t instanceof Se ? "Date" : t instanceof nt ? "Map" : t instanceof me ? "Set" : t instanceof Re ? `${M(t._def.left, e, r)} & ${M(t._def.right, e, r)}` : t instanceof ze ? t.options.map((n) => M(n, e, r)).join(" or ") : t instanceof ut ? M(t.unwrap(), e, r) : t instanceof it ? "NaN" : t instanceof Me ? M(t.removeCatch(), e, r) : t instanceof qe ? M(t._def.in, e, r) : t instanceof Pe ? `readonly ${M(t.unwrap(), e, r)}` : "unknown";
|
|
3014
3014
|
}
|
|
3015
|
-
function
|
|
3015
|
+
function Wr(t) {
|
|
3016
3016
|
return t === null ? "null" : t === void 0 ? "undefined" : Array.isArray(t) ? "array" : typeof t;
|
|
3017
3017
|
}
|
|
3018
|
-
function
|
|
3018
|
+
function Vr(t, e, r, n) {
|
|
3019
3019
|
const s = r.filter((a) => a.path.length === 0), i = r.filter((a) => a.path.length > 0);
|
|
3020
3020
|
if (s.length > 0 && i.length === 0) {
|
|
3021
3021
|
const a = s.some((d) => d.code === "custom"), h = s.some(
|
|
3022
3022
|
(d) => d.code !== "invalid_type" && d.code !== "invalid_literal" && d.code !== "invalid_union"
|
|
3023
3023
|
);
|
|
3024
3024
|
if (!a && !h) {
|
|
3025
|
-
const d =
|
|
3025
|
+
const d = M(e), m = Wr(n);
|
|
3026
3026
|
return `Invalid parameters for ${t}: expected ${d}${d === "{ }" ? " or no args" : ""}, received ${m}`;
|
|
3027
3027
|
}
|
|
3028
3028
|
}
|
|
3029
|
-
const
|
|
3030
|
-
return `Invalid parameters for ${t}: ${
|
|
3029
|
+
const c = r.map((a) => `at '${a.path.length > 0 ? a.path.join(".") : "root"}': ${a.message}`);
|
|
3030
|
+
return `Invalid parameters for ${t}: ${c.join("; ")}`;
|
|
3031
3031
|
}
|
|
3032
|
-
const
|
|
3033
|
-
function
|
|
3034
|
-
return
|
|
3032
|
+
const Fr = /* @__PURE__ */ new Set();
|
|
3033
|
+
function Ur(t) {
|
|
3034
|
+
return Fr.has(t);
|
|
3035
3035
|
}
|
|
3036
3036
|
const jt = /* @__PURE__ */ new Map();
|
|
3037
|
-
function
|
|
3037
|
+
function Br(t, e) {
|
|
3038
3038
|
jt.set(t, e);
|
|
3039
3039
|
}
|
|
3040
|
-
function
|
|
3040
|
+
function zr(t) {
|
|
3041
3041
|
return jt.get(t);
|
|
3042
3042
|
}
|
|
3043
|
-
function
|
|
3043
|
+
function qr(t) {
|
|
3044
3044
|
return t.startsWith("tab_") ? "required" : "active";
|
|
3045
3045
|
}
|
|
3046
|
-
function
|
|
3046
|
+
function Hr(t) {
|
|
3047
3047
|
return t === "content-script" ? "content-script" : t === "main-thread" ? "main-thread" : t === "worker" ? "worker:default" : t.startsWith("worker:") ? t : "main-thread";
|
|
3048
3048
|
}
|
|
3049
|
-
function
|
|
3050
|
-
return e !== "main-thread" ? e :
|
|
3049
|
+
function Gr(t, e) {
|
|
3050
|
+
return e !== "main-thread" ? e : Ur(t) ? "content-script" : e;
|
|
3051
3051
|
}
|
|
3052
|
-
function
|
|
3052
|
+
function Jr(t, e) {
|
|
3053
3053
|
return {
|
|
3054
|
-
endpoint:
|
|
3055
|
-
tabPolicy:
|
|
3054
|
+
endpoint: Hr(Gr(t, e)),
|
|
3055
|
+
tabPolicy: qr(t)
|
|
3056
3056
|
};
|
|
3057
3057
|
}
|
|
3058
|
-
function
|
|
3058
|
+
function Yr(t) {
|
|
3059
3059
|
for (const e of t)
|
|
3060
|
-
|
|
3060
|
+
Br(e.action, Jr(e.action, e.owner));
|
|
3061
3061
|
}
|
|
3062
|
-
const D = () => x([
|
|
3062
|
+
const D = () => x([H(), f().finite()]).transform((t) => BigInt(t));
|
|
3063
3063
|
l({
|
|
3064
|
-
key:
|
|
3064
|
+
key: o().describe("Storage key to retrieve")
|
|
3065
3065
|
});
|
|
3066
3066
|
l({
|
|
3067
|
-
key:
|
|
3068
|
-
value:
|
|
3067
|
+
key: o().describe("Storage key to set"),
|
|
3068
|
+
value: o().describe("Value to store")
|
|
3069
3069
|
});
|
|
3070
3070
|
l({
|
|
3071
|
-
key:
|
|
3071
|
+
key: o().describe("Storage key to delete")
|
|
3072
3072
|
});
|
|
3073
3073
|
l({});
|
|
3074
|
-
const
|
|
3075
|
-
items: b(
|
|
3074
|
+
const Kr = l({
|
|
3075
|
+
items: b(o()).describe("Record of key-value string pairs to store")
|
|
3076
3076
|
});
|
|
3077
|
-
|
|
3078
|
-
const
|
|
3079
|
-
keys:
|
|
3080
|
-
defaults: b(
|
|
3077
|
+
Q((t) => t !== null && typeof t == "object" && !Array.isArray(t) && !("items" in t) ? { items: t } : t, Kr);
|
|
3078
|
+
const Qr = l({
|
|
3079
|
+
keys: I(o()).describe("Array of storage keys to retrieve"),
|
|
3080
|
+
defaults: b(o()).optional().describe("Default string values for missing keys")
|
|
3081
3081
|
});
|
|
3082
|
-
|
|
3082
|
+
Q(
|
|
3083
3083
|
(t) => Array.isArray(t) ? { keys: t } : t,
|
|
3084
|
-
|
|
3084
|
+
Qr
|
|
3085
3085
|
);
|
|
3086
3086
|
l({});
|
|
3087
|
-
const
|
|
3088
|
-
keys:
|
|
3087
|
+
const Xr = l({
|
|
3088
|
+
keys: I(o()).describe("Array of storage keys to delete")
|
|
3089
3089
|
});
|
|
3090
|
-
|
|
3090
|
+
Q(
|
|
3091
3091
|
(t) => Array.isArray(t) ? { keys: t } : t,
|
|
3092
|
-
|
|
3092
|
+
Xr
|
|
3093
3093
|
);
|
|
3094
3094
|
l({});
|
|
3095
3095
|
l({});
|
|
3096
3096
|
x([
|
|
3097
|
-
|
|
3098
|
-
l({ text:
|
|
3097
|
+
Dr([x([l({ text: o() }), o()])]),
|
|
3098
|
+
l({ text: o().optional(), value: o().optional() })
|
|
3099
3099
|
]);
|
|
3100
3100
|
l({
|
|
3101
|
-
url:
|
|
3102
|
-
method:
|
|
3103
|
-
headers: b(
|
|
3104
|
-
body:
|
|
3101
|
+
url: o().describe("URL to fetch"),
|
|
3102
|
+
method: o().default("GET").describe("HTTP method (GET, POST, PUT, DELETE, etc.)"),
|
|
3103
|
+
headers: b(o()).default({}).describe("Request headers as key-value pairs"),
|
|
3104
|
+
body: o().nullable().default(null).describe("Request body string"),
|
|
3105
3105
|
timeout: D().default(30000n).describe("Timeout in milliseconds"),
|
|
3106
|
-
store:
|
|
3106
|
+
store: w().optional().describe(
|
|
3107
3107
|
"When true, store binary responses as a handle instead of returning body bytes"
|
|
3108
3108
|
),
|
|
3109
3109
|
options: l({}).passthrough().optional().describe("Fetch options")
|
|
@@ -3111,11 +3111,11 @@ l({
|
|
|
3111
3111
|
l({
|
|
3112
3112
|
duration: D().describe("Duration to sleep in milliseconds")
|
|
3113
3113
|
});
|
|
3114
|
-
const
|
|
3114
|
+
const K = () => o().regex(/^e\d+$/), en = 'use { refId: "e2" } or { label: "..." } object form, not positional arguments', ft = (t, e) => {
|
|
3115
3115
|
if (t.__invalidPositional !== void 0) {
|
|
3116
3116
|
e.addIssue({
|
|
3117
3117
|
code: u.custom,
|
|
3118
|
-
message:
|
|
3118
|
+
message: en
|
|
3119
3119
|
});
|
|
3120
3120
|
return;
|
|
3121
3121
|
}
|
|
@@ -3125,32 +3125,32 @@ const ce = () => c().regex(/^e\d+$/), Kr = 'use { refId: "e2" } or { label: "...
|
|
|
3125
3125
|
});
|
|
3126
3126
|
}, Dt = (t, e) => {
|
|
3127
3127
|
t.x !== void 0 || t.y !== void 0 || ft(t, e);
|
|
3128
|
-
},
|
|
3128
|
+
}, O = (t) => Q(
|
|
3129
3129
|
(e) => typeof e == "string" || typeof e == "number" ? { __invalidPositional: e } : e,
|
|
3130
3130
|
l({
|
|
3131
|
-
__invalidPositional: x([
|
|
3132
|
-
refId:
|
|
3133
|
-
label:
|
|
3131
|
+
__invalidPositional: x([o(), f()]).optional().describe("Internal flag for positional argument rejection"),
|
|
3132
|
+
refId: K().optional().describe("Element reference ID (e.g. e2)"),
|
|
3133
|
+
label: o().optional().describe("Human-readable element label"),
|
|
3134
3134
|
...t
|
|
3135
3135
|
}).superRefine(ft)
|
|
3136
|
-
),
|
|
3137
|
-
tabId: x([f(),
|
|
3138
|
-
},
|
|
3136
|
+
), be = {
|
|
3137
|
+
tabId: x([f(), H()]).optional().describe("Target tab ID")
|
|
3138
|
+
}, F = (t) => Q(
|
|
3139
3139
|
(e) => typeof e == "string" || typeof e == "number" ? { __invalidPositional: e } : e,
|
|
3140
3140
|
l({
|
|
3141
|
-
__invalidPositional: x([
|
|
3142
|
-
...
|
|
3143
|
-
refId:
|
|
3144
|
-
label:
|
|
3141
|
+
__invalidPositional: x([o(), f()]).optional().describe("Internal flag for positional argument rejection"),
|
|
3142
|
+
...be,
|
|
3143
|
+
refId: K().optional().describe("Element reference ID (e.g. e2)"),
|
|
3144
|
+
label: o().optional().describe("Human-readable element label"),
|
|
3145
3145
|
...t
|
|
3146
3146
|
}).superRefine(ft)
|
|
3147
3147
|
);
|
|
3148
3148
|
l({});
|
|
3149
3149
|
l({});
|
|
3150
3150
|
l({
|
|
3151
|
-
url:
|
|
3151
|
+
url: o().describe("URL to navigate to"),
|
|
3152
3152
|
timeout: D().optional().describe("Navigation timeout in milliseconds"),
|
|
3153
|
-
waitUntil:
|
|
3153
|
+
waitUntil: $e(["load", "networkidle"]).optional().describe(
|
|
3154
3154
|
"When to consider navigation complete: 'load' (tab status complete) or 'networkidle' (no in-flight requests for 500ms)"
|
|
3155
3155
|
)
|
|
3156
3156
|
});
|
|
@@ -3160,8 +3160,8 @@ l({});
|
|
|
3160
3160
|
l({
|
|
3161
3161
|
duration: D().default(1000n).describe("Duration to wait in milliseconds")
|
|
3162
3162
|
});
|
|
3163
|
-
|
|
3164
|
-
const
|
|
3163
|
+
O();
|
|
3164
|
+
const tn = (t, e) => {
|
|
3165
3165
|
[t.url, t.path, t.handle].filter(
|
|
3166
3166
|
(n) => typeof n == "string" && n.length > 0
|
|
3167
3167
|
).length !== 1 && e.addIssue({
|
|
@@ -3169,101 +3169,121 @@ const Qr = (t, e) => {
|
|
|
3169
3169
|
message: "Each file entry requires exactly one of url, path, or handle"
|
|
3170
3170
|
});
|
|
3171
3171
|
}, Zt = l({
|
|
3172
|
-
name:
|
|
3173
|
-
mimeType:
|
|
3174
|
-
url:
|
|
3175
|
-
path:
|
|
3176
|
-
handle:
|
|
3177
|
-
}).superRefine(
|
|
3172
|
+
name: o().optional().describe("File name including extension"),
|
|
3173
|
+
mimeType: o().optional().describe("MIME type (defaults to application/octet-stream)"),
|
|
3174
|
+
url: o().url().optional().describe("HTTP(S) URL to fetch in the target tab"),
|
|
3175
|
+
path: o().min(1).optional().describe("Virtual filesystem path (resolved in worker)"),
|
|
3176
|
+
handle: o().min(1).optional().describe("Binary handle from page.fetch({ store: true })")
|
|
3177
|
+
}).superRefine(tn), Wt = jr("kind", [
|
|
3178
3178
|
l({
|
|
3179
|
-
kind:
|
|
3180
|
-
name:
|
|
3181
|
-
data:
|
|
3182
|
-
mimeType:
|
|
3179
|
+
kind: Te("bytes"),
|
|
3180
|
+
name: o().min(1),
|
|
3181
|
+
data: o().min(1),
|
|
3182
|
+
mimeType: o().optional()
|
|
3183
3183
|
}),
|
|
3184
3184
|
l({
|
|
3185
|
-
kind:
|
|
3186
|
-
url:
|
|
3187
|
-
name:
|
|
3188
|
-
mimeType:
|
|
3185
|
+
kind: Te("url"),
|
|
3186
|
+
url: o().url(),
|
|
3187
|
+
name: o().min(1),
|
|
3188
|
+
mimeType: o().optional()
|
|
3189
3189
|
})
|
|
3190
3190
|
]);
|
|
3191
|
-
|
|
3192
|
-
value:
|
|
3191
|
+
O({
|
|
3192
|
+
value: o().describe("Value to fill into the element")
|
|
3193
3193
|
});
|
|
3194
|
-
const
|
|
3195
|
-
files:
|
|
3194
|
+
const rn = O({
|
|
3195
|
+
files: I(Zt).min(1).describe("Files to attach to the input")
|
|
3196
3196
|
});
|
|
3197
|
-
|
|
3198
|
-
files:
|
|
3197
|
+
O({
|
|
3198
|
+
files: I(Wt).min(1).describe("Resolved files for content-script application")
|
|
3199
3199
|
});
|
|
3200
|
-
|
|
3201
|
-
text:
|
|
3200
|
+
O({
|
|
3201
|
+
text: o().describe("Text to type into the element")
|
|
3202
3202
|
});
|
|
3203
|
-
|
|
3204
|
-
text:
|
|
3203
|
+
O({
|
|
3204
|
+
text: o().describe("Text to append into the element")
|
|
3205
3205
|
});
|
|
3206
3206
|
l({
|
|
3207
|
-
|
|
3207
|
+
refId: K().optional().describe("Element reference ID to dispatch the key on (e.g. e2). Omit to dispatch on document."),
|
|
3208
|
+
label: o().optional().describe("Human-readable element label. Omit to dispatch on document."),
|
|
3209
|
+
key: o().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
|
|
3210
|
+
});
|
|
3211
|
+
O({
|
|
3212
|
+
value: x([
|
|
3213
|
+
o().describe("Value to select in the dropdown"),
|
|
3214
|
+
I(o()).describe("Values to select in a multiple dropdown (empty array clears selection)")
|
|
3215
|
+
]).describe("Value (string) or values (array) to select in the dropdown")
|
|
3208
3216
|
});
|
|
3209
|
-
|
|
3210
|
-
value:
|
|
3217
|
+
O({
|
|
3218
|
+
value: o().describe("Visible text of the option to select (matched case-insensitively)")
|
|
3211
3219
|
});
|
|
3212
|
-
|
|
3213
|
-
checked:
|
|
3220
|
+
O({
|
|
3221
|
+
checked: w().optional().describe("Desired checked state (true to check, false to uncheck)")
|
|
3214
3222
|
});
|
|
3215
|
-
|
|
3223
|
+
l({
|
|
3224
|
+
name: o().min(1).describe("The `name` attribute of the radio group to pick from"),
|
|
3225
|
+
value: o().describe("The `value` of the radio option to check")
|
|
3226
|
+
});
|
|
3227
|
+
O();
|
|
3216
3228
|
l({});
|
|
3229
|
+
O();
|
|
3217
3230
|
l({
|
|
3218
|
-
direction:
|
|
3231
|
+
direction: o().default("down").describe("Scroll direction: up, down, left, or right"),
|
|
3219
3232
|
amount: f().default(300).describe("Pixels to scroll")
|
|
3220
3233
|
});
|
|
3221
|
-
|
|
3234
|
+
Q(
|
|
3222
3235
|
(t) => typeof t == "string" || typeof t == "number" ? { __invalidPositional: t } : t,
|
|
3223
3236
|
l({
|
|
3224
|
-
__invalidPositional: x([
|
|
3225
|
-
refId:
|
|
3226
|
-
label:
|
|
3237
|
+
__invalidPositional: x([o(), f()]).optional().describe("Internal flag for positional argument rejection"),
|
|
3238
|
+
refId: K().optional().describe("Element reference ID (e.g. e2)"),
|
|
3239
|
+
label: o().optional().describe("Human-readable element label"),
|
|
3227
3240
|
x: f().optional().describe("X coordinate to scroll to"),
|
|
3228
3241
|
y: f().optional().describe("Y coordinate to scroll to")
|
|
3229
3242
|
}).superRefine(Dt)
|
|
3230
3243
|
);
|
|
3231
|
-
|
|
3244
|
+
O();
|
|
3232
3245
|
l({
|
|
3233
|
-
selector:
|
|
3246
|
+
selector: o().describe("CSS selector to find elements")
|
|
3234
3247
|
});
|
|
3235
3248
|
l({
|
|
3236
|
-
selector:
|
|
3249
|
+
selector: o().describe("CSS selector for the root element(s) to introspect"),
|
|
3250
|
+
depth: f().int().min(0).max(10).default(2).describe("How many descendant levels to include (0 = root only)"),
|
|
3251
|
+
includeHidden: w().default(!0).describe(
|
|
3252
|
+
"Include elements hidden by CSS/aria (default true — this tool's purpose is to see what the curated snapshot filters out)"
|
|
3253
|
+
)
|
|
3254
|
+
});
|
|
3255
|
+
l({
|
|
3256
|
+
selector: o().describe("CSS selector to wait for"),
|
|
3237
3257
|
timeout: D().default(30000n).describe("Timeout in milliseconds")
|
|
3238
3258
|
});
|
|
3239
|
-
const
|
|
3240
|
-
fields:
|
|
3259
|
+
const nn = l({
|
|
3260
|
+
fields: I(o()).describe("Array of field names to extract")
|
|
3241
3261
|
});
|
|
3242
|
-
|
|
3262
|
+
Q(
|
|
3243
3263
|
(t) => Array.isArray(t) ? { fields: t } : t,
|
|
3244
|
-
|
|
3264
|
+
nn
|
|
3245
3265
|
);
|
|
3246
3266
|
x([
|
|
3247
3267
|
f(),
|
|
3248
|
-
|
|
3268
|
+
I(l({}).passthrough()),
|
|
3249
3269
|
l({}).passthrough()
|
|
3250
3270
|
]);
|
|
3251
3271
|
l({});
|
|
3252
3272
|
l({
|
|
3253
|
-
active:
|
|
3254
|
-
currentWindow:
|
|
3255
|
-
url:
|
|
3273
|
+
active: w().optional().describe("Whether the tabs are active"),
|
|
3274
|
+
currentWindow: w().optional().describe("Whether the tabs are in the current window"),
|
|
3275
|
+
url: o().optional().describe("URL pattern to match tabs against")
|
|
3256
3276
|
}).passthrough();
|
|
3257
|
-
|
|
3277
|
+
Q(
|
|
3258
3278
|
(t) => typeof t == "string" ? { url: t } : t,
|
|
3259
3279
|
l({
|
|
3260
|
-
url:
|
|
3261
|
-
active:
|
|
3280
|
+
url: o().optional().describe("URL to open in the new tab"),
|
|
3281
|
+
active: w().optional().describe("Whether to focus the new tab")
|
|
3262
3282
|
})
|
|
3263
3283
|
);
|
|
3264
3284
|
x([
|
|
3265
3285
|
f(),
|
|
3266
|
-
|
|
3286
|
+
I(
|
|
3267
3287
|
l({
|
|
3268
3288
|
id: f().optional(),
|
|
3269
3289
|
tabId: f().optional(),
|
|
@@ -3276,112 +3296,121 @@ x([
|
|
|
3276
3296
|
tab_id: f().optional()
|
|
3277
3297
|
}).passthrough()
|
|
3278
3298
|
]);
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
value:
|
|
3299
|
+
F();
|
|
3300
|
+
F({
|
|
3301
|
+
value: o().describe("Value to fill into the element")
|
|
3282
3302
|
});
|
|
3283
|
-
const
|
|
3284
|
-
files:
|
|
3303
|
+
const sn = F({
|
|
3304
|
+
files: I(Zt).min(1).describe("Files to attach to the input")
|
|
3285
3305
|
});
|
|
3286
|
-
|
|
3287
|
-
files:
|
|
3306
|
+
F({
|
|
3307
|
+
files: I(Wt).min(1).describe("Resolved files for content-script application")
|
|
3288
3308
|
});
|
|
3289
|
-
|
|
3309
|
+
Q(
|
|
3290
3310
|
(t) => typeof t == "string" || typeof t == "number" ? { __invalidPositional: t } : t,
|
|
3291
3311
|
l({
|
|
3292
|
-
__invalidPositional: x([
|
|
3293
|
-
...
|
|
3294
|
-
refId:
|
|
3295
|
-
label:
|
|
3312
|
+
__invalidPositional: x([o(), f()]).optional().describe("Internal flag for positional argument rejection"),
|
|
3313
|
+
...be,
|
|
3314
|
+
refId: K().optional().describe("Element reference ID (e.g. e2)"),
|
|
3315
|
+
label: o().optional().describe("Human-readable element label"),
|
|
3296
3316
|
x: f().optional().describe("X coordinate to scroll to"),
|
|
3297
3317
|
y: f().optional().describe("Y coordinate to scroll to")
|
|
3298
3318
|
}).superRefine(Dt)
|
|
3299
3319
|
);
|
|
3300
|
-
|
|
3301
|
-
text:
|
|
3320
|
+
F({
|
|
3321
|
+
text: o().describe("Text to type into the element")
|
|
3302
3322
|
});
|
|
3303
3323
|
l({
|
|
3304
|
-
...
|
|
3305
|
-
key:
|
|
3324
|
+
...be,
|
|
3325
|
+
key: o().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
|
|
3326
|
+
});
|
|
3327
|
+
F({
|
|
3328
|
+
value: o().describe("Value to select in the dropdown")
|
|
3306
3329
|
});
|
|
3307
|
-
|
|
3308
|
-
value:
|
|
3330
|
+
F({
|
|
3331
|
+
value: o().describe("Visible text of the option to select (matched case-insensitively)")
|
|
3309
3332
|
});
|
|
3310
|
-
|
|
3311
|
-
checked:
|
|
3333
|
+
F({
|
|
3334
|
+
checked: w().optional().describe("Desired checked state (true to check, false to uncheck)")
|
|
3312
3335
|
});
|
|
3313
|
-
|
|
3336
|
+
F();
|
|
3337
|
+
F();
|
|
3314
3338
|
l({
|
|
3315
|
-
...
|
|
3339
|
+
...be,
|
|
3340
|
+
name: o().min(1).describe("The `name` attribute of the radio group to pick from"),
|
|
3341
|
+
value: o().describe("The `value` of the radio option to check")
|
|
3316
3342
|
});
|
|
3317
3343
|
l({
|
|
3318
|
-
...
|
|
3319
|
-
|
|
3344
|
+
...be
|
|
3345
|
+
});
|
|
3346
|
+
l({
|
|
3347
|
+
...be,
|
|
3348
|
+
direction: o().default("down").describe("Scroll direction: up, down, left, or right"),
|
|
3320
3349
|
amount: f().default(300).describe("Pixels to scroll")
|
|
3321
3350
|
});
|
|
3322
|
-
|
|
3351
|
+
F();
|
|
3323
3352
|
l({
|
|
3324
|
-
tabId: x([f(),
|
|
3325
|
-
script:
|
|
3326
|
-
code:
|
|
3327
|
-
js:
|
|
3353
|
+
tabId: x([f(), H()]).optional().describe("Target tab ID"),
|
|
3354
|
+
script: o().optional().describe("Script to evaluate"),
|
|
3355
|
+
code: o().optional().describe("Alternative script code"),
|
|
3356
|
+
js: o().optional().describe("Alternative JS code")
|
|
3328
3357
|
}).passthrough();
|
|
3329
3358
|
l({
|
|
3330
|
-
tabId: x([f(),
|
|
3359
|
+
tabId: x([f(), H()]).optional().describe("Target tab ID")
|
|
3331
3360
|
}).passthrough();
|
|
3332
3361
|
l({
|
|
3333
|
-
tabId: x([f(),
|
|
3362
|
+
tabId: x([f(), H()]).optional().describe("Target tab ID")
|
|
3334
3363
|
}).passthrough();
|
|
3335
3364
|
l({
|
|
3336
|
-
tabId: x([f(),
|
|
3365
|
+
tabId: x([f(), H()]).optional().describe("Target tab ID"),
|
|
3337
3366
|
timeout: f().optional().describe("Timeout in milliseconds")
|
|
3338
3367
|
}).passthrough();
|
|
3339
3368
|
l({
|
|
3340
|
-
tabId: x([f(),
|
|
3341
|
-
url:
|
|
3369
|
+
tabId: x([f(), H()]).optional().describe("Target tab ID"),
|
|
3370
|
+
url: o().optional().describe("URL to fetch"),
|
|
3342
3371
|
options: l({}).passthrough().optional().describe("Fetch options")
|
|
3343
3372
|
}).passthrough();
|
|
3344
3373
|
l({
|
|
3345
|
-
tabId: x([f(),
|
|
3374
|
+
tabId: x([f(), H()]).optional().describe("Target tab ID"),
|
|
3346
3375
|
max_nodes: f().optional().describe("Maximum nodes to include"),
|
|
3347
3376
|
options: l({}).passthrough().optional().describe("Snapshot options")
|
|
3348
3377
|
}).passthrough();
|
|
3349
3378
|
l({
|
|
3350
|
-
tabId: x([f(),
|
|
3379
|
+
tabId: x([f(), H()]).optional().describe("Target tab ID"),
|
|
3351
3380
|
max_nodes: f().optional().describe("Maximum nodes to include"),
|
|
3352
3381
|
options: l({}).passthrough().optional().describe("Snapshot options")
|
|
3353
3382
|
}).passthrough();
|
|
3354
3383
|
l({
|
|
3355
|
-
tabId: x([f(),
|
|
3384
|
+
tabId: x([f(), H()]).optional().describe("Target tab ID"),
|
|
3356
3385
|
max_nodes: f().optional().describe("Maximum nodes to include"),
|
|
3357
3386
|
options: l({}).passthrough().optional().describe("Snapshot options")
|
|
3358
3387
|
}).passthrough();
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
value:
|
|
3388
|
+
O();
|
|
3389
|
+
O();
|
|
3390
|
+
O({
|
|
3391
|
+
value: o().optional().describe("Value to fill into the element")
|
|
3363
3392
|
});
|
|
3364
|
-
|
|
3365
|
-
text:
|
|
3393
|
+
O({
|
|
3394
|
+
text: o().optional().describe("Text to type into the element")
|
|
3366
3395
|
});
|
|
3367
3396
|
l({
|
|
3368
|
-
key:
|
|
3397
|
+
key: o().optional().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
|
|
3369
3398
|
});
|
|
3370
|
-
|
|
3371
|
-
value:
|
|
3399
|
+
O({
|
|
3400
|
+
value: o().optional().describe("Value to select in the dropdown")
|
|
3372
3401
|
});
|
|
3373
|
-
|
|
3374
|
-
checked:
|
|
3402
|
+
O({
|
|
3403
|
+
checked: w().optional().describe("Desired checked state (true to check, false to uncheck)")
|
|
3375
3404
|
});
|
|
3376
|
-
|
|
3405
|
+
O();
|
|
3377
3406
|
l({});
|
|
3378
3407
|
l({
|
|
3379
|
-
direction:
|
|
3408
|
+
direction: o().optional().describe("Scroll direction: up, down, left, or right"),
|
|
3380
3409
|
amount: f().optional().describe("Pixels to scroll")
|
|
3381
3410
|
});
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
text:
|
|
3411
|
+
O();
|
|
3412
|
+
O({
|
|
3413
|
+
text: o().optional().describe("Text to append into the element")
|
|
3385
3414
|
});
|
|
3386
3415
|
l({});
|
|
3387
3416
|
l({});
|
|
@@ -3389,24 +3418,24 @@ l({
|
|
|
3389
3418
|
duration: D().default(1000n).describe("Duration to wait in milliseconds")
|
|
3390
3419
|
});
|
|
3391
3420
|
l({
|
|
3392
|
-
interactive_only:
|
|
3421
|
+
interactive_only: w().default(!1).describe("Only include interactive elements"),
|
|
3393
3422
|
max_nodes: D().default(500n).describe("Maximum number of nodes to include in snapshot")
|
|
3394
3423
|
});
|
|
3395
3424
|
l({
|
|
3396
|
-
interactive_only:
|
|
3425
|
+
interactive_only: w().default(!1).describe("Only include interactive elements"),
|
|
3397
3426
|
max_nodes: D().default(500n).describe("Maximum number of nodes to include in snapshot")
|
|
3398
3427
|
});
|
|
3399
3428
|
l({
|
|
3400
|
-
interactive_only:
|
|
3429
|
+
interactive_only: w().default(!1).describe("Only include interactive elements"),
|
|
3401
3430
|
max_nodes: D().default(500n).describe("Maximum number of nodes to include in snapshot")
|
|
3402
3431
|
});
|
|
3403
3432
|
l({
|
|
3404
|
-
interactive_only:
|
|
3433
|
+
interactive_only: w().default(!1).describe("Only include interactive elements"),
|
|
3405
3434
|
max_nodes: D().default(500n).describe("Maximum number of nodes to include in snapshot")
|
|
3406
3435
|
});
|
|
3407
3436
|
l({
|
|
3408
3437
|
snapshot: l({}).passthrough().describe("Raw DOM snapshot data to format"),
|
|
3409
|
-
format:
|
|
3438
|
+
format: o().optional().describe("Output format (e.g. markdown, html)")
|
|
3410
3439
|
});
|
|
3411
3440
|
l({
|
|
3412
3441
|
max_nodes: f().optional().describe("Maximum nodes to include"),
|
|
@@ -3420,43 +3449,43 @@ l({
|
|
|
3420
3449
|
max_nodes: f().optional().describe("Maximum nodes to include"),
|
|
3421
3450
|
options: l({}).passthrough().optional().describe("Snapshot options")
|
|
3422
3451
|
}).passthrough();
|
|
3423
|
-
const
|
|
3424
|
-
role: x([
|
|
3425
|
-
tag: x([
|
|
3426
|
-
text:
|
|
3427
|
-
name:
|
|
3428
|
-
interactiveOnly:
|
|
3429
|
-
href:
|
|
3430
|
-
src:
|
|
3452
|
+
const an = l({
|
|
3453
|
+
role: x([o(), I(o())]).optional().describe("Filter by ARIA role"),
|
|
3454
|
+
tag: x([o(), I(o())]).optional().describe("Filter by HTML tag"),
|
|
3455
|
+
text: o().optional().describe("Filter by text content (case-insensitive substring)"),
|
|
3456
|
+
name: o().optional().describe("Filter by accessible name (case-insensitive substring)"),
|
|
3457
|
+
interactiveOnly: w().optional().describe("Only include interactive elements"),
|
|
3458
|
+
href: o().optional().describe("Filter by href pattern (case-insensitive substring)"),
|
|
3459
|
+
src: o().optional().describe("Filter by src pattern (case-insensitive substring)"),
|
|
3431
3460
|
limit: f().positive().optional().describe("Maximum filtered nodes to return")
|
|
3432
|
-
}).passthrough(),
|
|
3433
|
-
filter:
|
|
3461
|
+
}).passthrough(), on = l({
|
|
3462
|
+
filter: an.optional().describe(
|
|
3434
3463
|
"Semantic filter criteria"
|
|
3435
3464
|
),
|
|
3436
3465
|
max_nodes: f().optional().describe("Maximum nodes to collect before filtering")
|
|
3437
3466
|
}).passthrough();
|
|
3438
|
-
|
|
3467
|
+
on.extend({
|
|
3439
3468
|
tabId: f().describe("Tab ID")
|
|
3440
3469
|
});
|
|
3441
|
-
const
|
|
3442
|
-
path:
|
|
3470
|
+
const ee = l({
|
|
3471
|
+
path: o().describe("File or directory path")
|
|
3443
3472
|
}), xt = l({
|
|
3444
|
-
from:
|
|
3445
|
-
to:
|
|
3446
|
-
}),
|
|
3447
|
-
path:
|
|
3448
|
-
data:
|
|
3449
|
-
}),
|
|
3450
|
-
path:
|
|
3473
|
+
from: o().describe("Source path"),
|
|
3474
|
+
to: o().describe("Destination path")
|
|
3475
|
+
}), le = l({
|
|
3476
|
+
path: o().describe("File path to write to"),
|
|
3477
|
+
data: o().describe("Data to write")
|
|
3478
|
+
}), cn = l({
|
|
3479
|
+
path: o().describe("File path to read from"),
|
|
3451
3480
|
offset: D().describe("Byte offset to start reading"),
|
|
3452
3481
|
len: f().describe("Number of bytes to read")
|
|
3453
|
-
}),
|
|
3454
|
-
path:
|
|
3482
|
+
}), dn = l({
|
|
3483
|
+
path: o().describe("File path to update"),
|
|
3455
3484
|
offset: D().describe("Byte offset to start writing"),
|
|
3456
|
-
data:
|
|
3457
|
-
}),
|
|
3458
|
-
path:
|
|
3459
|
-
algo:
|
|
3485
|
+
data: o().describe("Data to write")
|
|
3486
|
+
}), ln = l({
|
|
3487
|
+
path: o().describe("File path to hash"),
|
|
3488
|
+
algo: o().default("sha256").describe("Hash algorithm (e.g. sha256, md5)")
|
|
3460
3489
|
});
|
|
3461
3490
|
b(_());
|
|
3462
3491
|
b(_());
|
|
@@ -3474,7 +3503,7 @@ b(_());
|
|
|
3474
3503
|
b(_());
|
|
3475
3504
|
b(_());
|
|
3476
3505
|
x([
|
|
3477
|
-
|
|
3506
|
+
o(),
|
|
3478
3507
|
b(_())
|
|
3479
3508
|
]);
|
|
3480
3509
|
b(_());
|
|
@@ -3485,7 +3514,7 @@ b(_());
|
|
|
3485
3514
|
b(_());
|
|
3486
3515
|
b(_());
|
|
3487
3516
|
x([
|
|
3488
|
-
|
|
3517
|
+
o(),
|
|
3489
3518
|
f(),
|
|
3490
3519
|
b(_())
|
|
3491
3520
|
]);
|
|
@@ -3501,24 +3530,24 @@ b(_());
|
|
|
3501
3530
|
b(_());
|
|
3502
3531
|
b(_());
|
|
3503
3532
|
b(_());
|
|
3504
|
-
|
|
3533
|
+
I(_());
|
|
3505
3534
|
x([
|
|
3506
|
-
|
|
3535
|
+
o(),
|
|
3507
3536
|
b(_())
|
|
3508
3537
|
]);
|
|
3509
3538
|
b(_());
|
|
3510
3539
|
x([
|
|
3511
|
-
|
|
3540
|
+
o(),
|
|
3512
3541
|
b(_())
|
|
3513
3542
|
]);
|
|
3514
3543
|
b(_());
|
|
3515
3544
|
x([
|
|
3516
|
-
|
|
3545
|
+
o(),
|
|
3517
3546
|
b(_())
|
|
3518
3547
|
]);
|
|
3519
3548
|
b(_());
|
|
3520
3549
|
x([
|
|
3521
|
-
|
|
3550
|
+
o(),
|
|
3522
3551
|
b(_())
|
|
3523
3552
|
]);
|
|
3524
3553
|
b(_());
|
|
@@ -3537,7 +3566,7 @@ b(
|
|
|
3537
3566
|
_()
|
|
3538
3567
|
);
|
|
3539
3568
|
x([
|
|
3540
|
-
|
|
3569
|
+
o(),
|
|
3541
3570
|
f(),
|
|
3542
3571
|
b(_())
|
|
3543
3572
|
]);
|
|
@@ -3569,239 +3598,273 @@ b(_());
|
|
|
3569
3598
|
b(_());
|
|
3570
3599
|
b(_());
|
|
3571
3600
|
l({
|
|
3572
|
-
action:
|
|
3601
|
+
action: o().describe("Host action name"),
|
|
3573
3602
|
params: l({}).passthrough().optional().describe("Parameters for the host action")
|
|
3574
3603
|
}).passthrough();
|
|
3575
3604
|
x([
|
|
3576
|
-
|
|
3605
|
+
o(),
|
|
3577
3606
|
f(),
|
|
3578
|
-
|
|
3607
|
+
w(),
|
|
3579
3608
|
Lt(),
|
|
3580
|
-
|
|
3609
|
+
I(_()),
|
|
3581
3610
|
b(_())
|
|
3582
3611
|
]);
|
|
3583
|
-
const
|
|
3584
|
-
ok:
|
|
3585
|
-
action:
|
|
3586
|
-
refId:
|
|
3587
|
-
tag:
|
|
3588
|
-
role:
|
|
3589
|
-
name:
|
|
3590
|
-
value:
|
|
3591
|
-
checked:
|
|
3592
|
-
disabled:
|
|
3593
|
-
readOnly:
|
|
3594
|
-
text:
|
|
3595
|
-
key:
|
|
3596
|
-
direction:
|
|
3612
|
+
const un = l({
|
|
3613
|
+
ok: Te(!0).describe("Whether the action succeeded"),
|
|
3614
|
+
action: o().describe("Action identifier (e.g. 'page_fill')"),
|
|
3615
|
+
refId: K().optional().describe("Element reference ID that was acted upon (e.g. e2)"),
|
|
3616
|
+
tag: o().optional().describe("HTML tag name of the element"),
|
|
3617
|
+
role: o().optional().describe("ARIA role of the element"),
|
|
3618
|
+
name: o().optional().describe("Accessible name of the element"),
|
|
3619
|
+
value: x([o(), I(o())]).optional().describe("Final value of the element after the action (string, or string[] for multi-select)"),
|
|
3620
|
+
checked: w().optional().describe("Checked state after the action"),
|
|
3621
|
+
disabled: w().optional().describe("Whether the element is disabled"),
|
|
3622
|
+
readOnly: w().optional().describe("Whether the element is read-only"),
|
|
3623
|
+
text: o().optional().describe("Text content of the element"),
|
|
3624
|
+
key: o().optional().describe("Key that was pressed (for press actions)"),
|
|
3625
|
+
direction: o().optional().describe("Scroll direction (for scroll actions)"),
|
|
3597
3626
|
amount: f().optional().describe("Scroll amount in pixels (for scroll actions)"),
|
|
3598
3627
|
fileCount: f().optional().describe("Number of files attached (for setFiles actions)"),
|
|
3599
|
-
fileNames:
|
|
3600
|
-
observationId:
|
|
3628
|
+
fileNames: I(o()).optional().describe("Names of attached files (for setFiles actions)"),
|
|
3629
|
+
observationId: o().optional().describe(
|
|
3601
3630
|
"Opaque ID of the observation lease authorizing this action (snapshot-scoped)"
|
|
3602
3631
|
),
|
|
3603
|
-
dispatched:
|
|
3632
|
+
dispatched: Te(!0).optional().describe(
|
|
3604
3633
|
"True if the action was dispatched to the DOM. Does NOT prove the application accepted it."
|
|
3605
3634
|
),
|
|
3606
|
-
verification:
|
|
3635
|
+
verification: Te("required").optional().describe(
|
|
3607
3636
|
"Always 'required': a fresh observation is required to verify the effect."
|
|
3608
3637
|
)
|
|
3609
3638
|
});
|
|
3610
|
-
x([
|
|
3639
|
+
x([un, Lt()]);
|
|
3611
3640
|
l({
|
|
3612
3641
|
status: f().describe("HTTP response status code"),
|
|
3613
|
-
ok:
|
|
3614
|
-
headers: b(
|
|
3615
|
-
body:
|
|
3616
|
-
bodyEncoding:
|
|
3617
|
-
handle:
|
|
3642
|
+
ok: w().describe("Whether the response status is 2xx"),
|
|
3643
|
+
headers: b(o()).describe("Response headers as key-value pairs"),
|
|
3644
|
+
body: o().optional().describe("Response body (omitted when bodyEncoding is handle)"),
|
|
3645
|
+
bodyEncoding: $e(["text", "base64", "handle"]).describe("Encoding of the body field"),
|
|
3646
|
+
handle: o().optional().describe("Binary handle when bodyEncoding is handle"),
|
|
3618
3647
|
byteLength: f().describe("Length of the body in bytes"),
|
|
3619
|
-
contentType:
|
|
3620
|
-
finalUrl:
|
|
3648
|
+
contentType: o().describe("Response Content-Type header"),
|
|
3649
|
+
finalUrl: o().describe("Final URL after redirects")
|
|
3621
3650
|
});
|
|
3622
3651
|
l({
|
|
3623
3652
|
data: l({}).passthrough().describe("Structured snapshot data"),
|
|
3624
|
-
text:
|
|
3653
|
+
text: o().describe("Plain text representation of the snapshot")
|
|
3625
3654
|
});
|
|
3626
3655
|
l({});
|
|
3627
3656
|
l({
|
|
3628
3657
|
tabId: f(),
|
|
3629
|
-
url:
|
|
3630
|
-
title:
|
|
3631
|
-
contentScript:
|
|
3632
|
-
domApis:
|
|
3633
|
-
mutationsReady:
|
|
3634
|
-
hint:
|
|
3635
|
-
recovery:
|
|
3658
|
+
url: o(),
|
|
3659
|
+
title: o(),
|
|
3660
|
+
contentScript: $e(["connected", "missing"]),
|
|
3661
|
+
domApis: $e(["ok", "blocked"]),
|
|
3662
|
+
mutationsReady: w(),
|
|
3663
|
+
hint: o().optional(),
|
|
3664
|
+
recovery: I(o()).optional()
|
|
3636
3665
|
});
|
|
3637
|
-
const
|
|
3638
|
-
refId:
|
|
3639
|
-
role:
|
|
3640
|
-
tag:
|
|
3641
|
-
name:
|
|
3642
|
-
text:
|
|
3643
|
-
value:
|
|
3644
|
-
checked:
|
|
3645
|
-
disabled:
|
|
3646
|
-
readOnly:
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3666
|
+
const fn = l({
|
|
3667
|
+
refId: K().describe("Element reference ID (e.g. e2)"),
|
|
3668
|
+
role: o().describe("ARIA role of the element"),
|
|
3669
|
+
tag: o().describe("HTML tag name"),
|
|
3670
|
+
name: o().optional().describe("Accessible name of the element"),
|
|
3671
|
+
text: o().optional().describe("Visible text content of the element"),
|
|
3672
|
+
value: o().optional().describe("Element value"),
|
|
3673
|
+
checked: w().optional().describe("Checked state"),
|
|
3674
|
+
disabled: w().optional().describe("Whether the element is disabled"),
|
|
3675
|
+
readOnly: w().optional().describe("Whether the element is read-only"),
|
|
3676
|
+
selected: w().optional().describe("For <option>: selected state"),
|
|
3677
|
+
href: o().optional().describe("Absolute URL for link elements"),
|
|
3678
|
+
src: o().optional().describe("Absolute URL for image elements"),
|
|
3679
|
+
alt: o().optional().describe("Alternative text for image elements"),
|
|
3680
|
+
title: o().optional().describe("Title attribute"),
|
|
3681
|
+
parentRefId: K().optional().describe("Reference ID of the parent container element"),
|
|
3682
|
+
postId: o().optional().describe("Stable post identifier from data-post-id attribute"),
|
|
3683
|
+
permalink: o().optional().describe("Stable permalink URL from anchor element"),
|
|
3684
|
+
imageUrls: I(o()).optional().describe("Image URLs contained within this element")
|
|
3655
3685
|
});
|
|
3656
3686
|
l({
|
|
3657
|
-
text:
|
|
3658
|
-
nodes:
|
|
3659
|
-
url:
|
|
3660
|
-
title:
|
|
3687
|
+
text: o().describe("Plain text representation of the page"),
|
|
3688
|
+
nodes: I(fn).describe("Array of interactive nodes"),
|
|
3689
|
+
url: o().describe("Current page URL"),
|
|
3690
|
+
title: o().describe("Current page title"),
|
|
3661
3691
|
viewport: l({
|
|
3662
3692
|
width: f().describe("Viewport width in pixels"),
|
|
3663
3693
|
height: f().describe("Viewport height in pixels")
|
|
3664
3694
|
}).describe("Viewport dimensions"),
|
|
3665
|
-
observationId:
|
|
3695
|
+
observationId: o().optional().describe(
|
|
3666
3696
|
"Opaque ID of the observation lease granted by this snapshot. Pass to subsequent actions to prove they act on fresh observations."
|
|
3667
3697
|
)
|
|
3668
3698
|
});
|
|
3669
3699
|
const Vt = l({
|
|
3700
|
+
refId: K().optional(),
|
|
3701
|
+
tag: o(),
|
|
3702
|
+
role: o().optional(),
|
|
3703
|
+
name: o().optional(),
|
|
3704
|
+
text: o().optional(),
|
|
3705
|
+
attributes: b(o()).optional().describe("All HTML attributes (raw)"),
|
|
3706
|
+
hidden: w().optional(),
|
|
3707
|
+
hiddenReason: $e([
|
|
3708
|
+
"display-none",
|
|
3709
|
+
"visibility-hidden",
|
|
3710
|
+
"aria-hidden",
|
|
3711
|
+
"opacity-zero",
|
|
3712
|
+
"hidden-attr",
|
|
3713
|
+
"inert"
|
|
3714
|
+
]).optional(),
|
|
3715
|
+
value: o().optional(),
|
|
3716
|
+
checked: w().optional(),
|
|
3717
|
+
disabled: w().optional(),
|
|
3718
|
+
readOnly: w().optional(),
|
|
3719
|
+
selected: w().optional().describe("For <option>: selected state"),
|
|
3720
|
+
href: o().optional(),
|
|
3721
|
+
src: o().optional(),
|
|
3722
|
+
alt: o().optional(),
|
|
3723
|
+
accept: o().optional().describe("For input[type=file]: accepted MIME/extensions"),
|
|
3724
|
+
filesCount: f().optional().describe("For input[type=file]: selected file count"),
|
|
3725
|
+
children: I(Zr(() => Vt)).optional().describe("Nested descendants up to `depth`")
|
|
3726
|
+
});
|
|
3727
|
+
l({
|
|
3728
|
+
nodes: I(Vt),
|
|
3729
|
+
url: o(),
|
|
3730
|
+
title: o()
|
|
3731
|
+
});
|
|
3732
|
+
const Ft = l({
|
|
3670
3733
|
id: f().optional().describe("Tab ID"),
|
|
3671
3734
|
tabId: f().optional().describe("Tab ID (added by runner)"),
|
|
3672
3735
|
index: f().optional().describe("Tab index in the window"),
|
|
3673
3736
|
windowId: f().optional().describe("Window ID"),
|
|
3674
|
-
url:
|
|
3675
|
-
title:
|
|
3676
|
-
status:
|
|
3677
|
-
active:
|
|
3678
|
-
pinned:
|
|
3679
|
-
highlighted:
|
|
3680
|
-
incognito:
|
|
3681
|
-
favIconUrl:
|
|
3682
|
-
audible:
|
|
3737
|
+
url: o().optional().describe("Tab URL"),
|
|
3738
|
+
title: o().optional().describe("Tab title"),
|
|
3739
|
+
status: o().optional().describe("Tab status (loading or complete)"),
|
|
3740
|
+
active: w().optional().describe("Whether the tab is active"),
|
|
3741
|
+
pinned: w().optional().describe("Whether the tab is pinned"),
|
|
3742
|
+
highlighted: w().optional().describe("Whether the tab is highlighted"),
|
|
3743
|
+
incognito: w().optional().describe("Whether the tab is incognito"),
|
|
3744
|
+
favIconUrl: o().optional().describe("Favicon URL"),
|
|
3745
|
+
audible: w().optional().describe("Whether the tab is audible"),
|
|
3683
3746
|
groupId: f().optional().describe("Group ID"),
|
|
3684
3747
|
openerTabId: f().optional().describe("Opener tab ID"),
|
|
3685
|
-
discarded:
|
|
3686
|
-
autoDiscardable:
|
|
3748
|
+
discarded: w().optional().describe("Whether the tab is discarded"),
|
|
3749
|
+
autoDiscardable: w().optional().describe("Whether the tab is auto-discardable"),
|
|
3687
3750
|
width: f().optional().describe("Tab width"),
|
|
3688
3751
|
height: f().optional().describe("Tab height"),
|
|
3689
|
-
sessionId:
|
|
3690
|
-
}).passthrough(),
|
|
3752
|
+
sessionId: o().optional().describe("Session ID")
|
|
3753
|
+
}).passthrough(), hn = I(Ft), Ut = l({
|
|
3691
3754
|
id: f().optional().describe("Window ID"),
|
|
3692
|
-
focused:
|
|
3755
|
+
focused: w().optional().describe("Whether the window is focused"),
|
|
3693
3756
|
top: f().optional().describe("Window top position"),
|
|
3694
3757
|
left: f().optional().describe("Window left position"),
|
|
3695
3758
|
width: f().optional().describe("Window width"),
|
|
3696
3759
|
height: f().optional().describe("Window height"),
|
|
3697
|
-
tabs:
|
|
3760
|
+
tabs: hn.optional().describe(
|
|
3698
3761
|
"Array of tabs in the window"
|
|
3699
3762
|
),
|
|
3700
|
-
incognito:
|
|
3701
|
-
type:
|
|
3702
|
-
state:
|
|
3703
|
-
alwaysOnTop:
|
|
3704
|
-
sessionId:
|
|
3763
|
+
incognito: w().optional().describe("Whether the window is incognito"),
|
|
3764
|
+
type: o().optional().describe("Window type"),
|
|
3765
|
+
state: o().optional().describe("Window state"),
|
|
3766
|
+
alwaysOnTop: w().optional().describe("Whether the window is always on top"),
|
|
3767
|
+
sessionId: o().optional().describe("Session ID")
|
|
3705
3768
|
}).passthrough();
|
|
3706
|
-
|
|
3707
|
-
const
|
|
3708
|
-
name:
|
|
3709
|
-
value:
|
|
3710
|
-
domain:
|
|
3711
|
-
hostOnly:
|
|
3712
|
-
path:
|
|
3713
|
-
secure:
|
|
3714
|
-
httpOnly:
|
|
3715
|
-
sameSite:
|
|
3716
|
-
session:
|
|
3769
|
+
I(Ut);
|
|
3770
|
+
const pn = l({
|
|
3771
|
+
name: o().describe("Cookie name"),
|
|
3772
|
+
value: o().describe("Cookie value"),
|
|
3773
|
+
domain: o().optional().describe("Cookie domain"),
|
|
3774
|
+
hostOnly: w().optional().describe("Whether the cookie is host-only"),
|
|
3775
|
+
path: o().optional().describe("Cookie path"),
|
|
3776
|
+
secure: w().optional().describe("Whether the cookie is secure"),
|
|
3777
|
+
httpOnly: w().optional().describe("Whether the cookie is HTTP-only"),
|
|
3778
|
+
sameSite: o().optional().describe("SameSite policy"),
|
|
3779
|
+
session: w().optional().describe("Whether the cookie is a session cookie"),
|
|
3717
3780
|
expirationDate: f().optional().describe("Expiration date as Unix timestamp"),
|
|
3718
|
-
storeId:
|
|
3781
|
+
storeId: o().optional().describe("Store ID")
|
|
3719
3782
|
}).nullable();
|
|
3720
|
-
|
|
3721
|
-
|
|
3783
|
+
I(
|
|
3784
|
+
pn.nullable().unwrap()
|
|
3722
3785
|
);
|
|
3723
|
-
const
|
|
3724
|
-
id:
|
|
3725
|
-
parentId:
|
|
3786
|
+
const mn = l({
|
|
3787
|
+
id: o().describe("Bookmark ID"),
|
|
3788
|
+
parentId: o().optional().describe("Parent folder ID"),
|
|
3726
3789
|
index: f().optional().describe("Bookmark index"),
|
|
3727
|
-
url:
|
|
3728
|
-
title:
|
|
3790
|
+
url: o().optional().describe("Bookmark URL"),
|
|
3791
|
+
title: o().describe("Bookmark title"),
|
|
3729
3792
|
dateAdded: f().optional().describe("Date added"),
|
|
3730
3793
|
dateGroupModified: f().optional().describe("Date group modified"),
|
|
3731
|
-
children:
|
|
3794
|
+
children: I(l({ id: o() }).passthrough()).optional().describe("Child bookmarks")
|
|
3732
3795
|
}).passthrough();
|
|
3733
|
-
|
|
3734
|
-
const
|
|
3735
|
-
id:
|
|
3736
|
-
url:
|
|
3737
|
-
title:
|
|
3796
|
+
I(mn);
|
|
3797
|
+
const gn = l({
|
|
3798
|
+
id: o().describe("History item ID"),
|
|
3799
|
+
url: o().optional().describe("URL"),
|
|
3800
|
+
title: o().optional().describe("Title"),
|
|
3738
3801
|
lastVisitTime: f().optional().describe("Last visit time"),
|
|
3739
3802
|
visitCount: f().optional().describe("Visit count"),
|
|
3740
3803
|
typedCount: f().optional().describe("Typed count")
|
|
3741
3804
|
}).passthrough();
|
|
3742
|
-
|
|
3743
|
-
const
|
|
3805
|
+
I(gn);
|
|
3806
|
+
const yn = l({
|
|
3744
3807
|
frameId: f().describe("Frame ID"),
|
|
3745
3808
|
result: _().optional().describe("Script result")
|
|
3746
3809
|
});
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
x([
|
|
3751
|
-
|
|
3752
|
-
const
|
|
3810
|
+
I(yn);
|
|
3811
|
+
o();
|
|
3812
|
+
w();
|
|
3813
|
+
x([o(), f()]);
|
|
3814
|
+
w();
|
|
3815
|
+
const bn = l({
|
|
3753
3816
|
id: f().optional().describe("Group ID"),
|
|
3754
|
-
collapsed:
|
|
3755
|
-
color:
|
|
3756
|
-
title:
|
|
3817
|
+
collapsed: w().optional().describe("Whether the group is collapsed"),
|
|
3818
|
+
color: o().optional().describe("Group color"),
|
|
3819
|
+
title: o().optional().describe("Group title"),
|
|
3757
3820
|
windowId: f().optional().describe("Window ID")
|
|
3758
3821
|
}).passthrough();
|
|
3759
|
-
|
|
3760
|
-
const
|
|
3822
|
+
I(bn);
|
|
3823
|
+
const _n = l({
|
|
3761
3824
|
lastModified: f().optional().describe("Last modified time"),
|
|
3762
|
-
tab:
|
|
3763
|
-
window:
|
|
3764
|
-
}).passthrough(),
|
|
3765
|
-
deviceName:
|
|
3766
|
-
sessions:
|
|
3825
|
+
tab: Ft.optional().describe("Tab info"),
|
|
3826
|
+
window: Ut.optional().describe("Window info")
|
|
3827
|
+
}).passthrough(), vn = I(_n), kn = l({
|
|
3828
|
+
deviceName: o().optional().describe("Device name"),
|
|
3829
|
+
sessions: vn.optional().describe("Sessions")
|
|
3767
3830
|
}).passthrough();
|
|
3768
|
-
|
|
3769
|
-
const
|
|
3831
|
+
I(kn);
|
|
3832
|
+
const wn = l({
|
|
3770
3833
|
id: f().optional().describe("Download ID"),
|
|
3771
|
-
url:
|
|
3772
|
-
filename:
|
|
3773
|
-
startTime:
|
|
3774
|
-
endTime:
|
|
3775
|
-
state:
|
|
3776
|
-
danger:
|
|
3777
|
-
paused:
|
|
3778
|
-
error:
|
|
3834
|
+
url: o().optional().describe("Download URL"),
|
|
3835
|
+
filename: o().optional().describe("Filename"),
|
|
3836
|
+
startTime: o().optional().describe("Start time"),
|
|
3837
|
+
endTime: o().optional().describe("End time"),
|
|
3838
|
+
state: o().optional().describe("Download state"),
|
|
3839
|
+
danger: o().optional().describe("Danger type"),
|
|
3840
|
+
paused: w().optional().describe("Whether the download is paused"),
|
|
3841
|
+
error: o().optional().describe("Error message"),
|
|
3779
3842
|
bytesReceived: f().optional().describe("Bytes received"),
|
|
3780
3843
|
totalBytes: f().optional().describe("Total bytes"),
|
|
3781
3844
|
fileSize: f().optional().describe("File size"),
|
|
3782
|
-
mime:
|
|
3783
|
-
incognito:
|
|
3784
|
-
referrer:
|
|
3785
|
-
byExtensionId:
|
|
3786
|
-
byExtensionName:
|
|
3845
|
+
mime: o().optional().describe("MIME type"),
|
|
3846
|
+
incognito: w().optional().describe("Whether the download is incognito"),
|
|
3847
|
+
referrer: o().optional().describe("Referrer URL"),
|
|
3848
|
+
byExtensionId: o().optional().describe("Extension ID"),
|
|
3849
|
+
byExtensionName: o().optional().describe("Extension name")
|
|
3787
3850
|
}).passthrough();
|
|
3788
|
-
|
|
3851
|
+
I(wn);
|
|
3789
3852
|
f();
|
|
3790
3853
|
l({
|
|
3791
|
-
archName:
|
|
3792
|
-
modelName:
|
|
3854
|
+
archName: o().describe("CPU architecture"),
|
|
3855
|
+
modelName: o().describe("CPU model"),
|
|
3793
3856
|
numOfProcessors: f().describe("Number of processors"),
|
|
3794
|
-
features:
|
|
3857
|
+
features: I(o()).describe("CPU features")
|
|
3795
3858
|
});
|
|
3796
3859
|
l({
|
|
3797
3860
|
capacity: f().describe("Total memory capacity"),
|
|
3798
3861
|
availableCapacity: f().describe("Available memory capacity")
|
|
3799
3862
|
});
|
|
3800
|
-
|
|
3863
|
+
I(
|
|
3801
3864
|
l({
|
|
3802
|
-
id:
|
|
3803
|
-
name:
|
|
3804
|
-
type:
|
|
3865
|
+
id: o().describe("Storage ID"),
|
|
3866
|
+
name: o().describe("Storage name"),
|
|
3867
|
+
type: o().describe("Storage type"),
|
|
3805
3868
|
capacity: f().describe("Storage capacity")
|
|
3806
3869
|
})
|
|
3807
3870
|
);
|
|
@@ -3810,26 +3873,26 @@ const Ve = /* @__PURE__ */ new Map(), Fe = /* @__PURE__ */ new Map();
|
|
|
3810
3873
|
function ht(t) {
|
|
3811
3874
|
return t && t.length > 0 ? t : "__default__";
|
|
3812
3875
|
}
|
|
3813
|
-
function
|
|
3876
|
+
function Bt(t) {
|
|
3814
3877
|
const e = ht(t);
|
|
3815
3878
|
let r = Ve.get(e);
|
|
3816
3879
|
return r || (r = /* @__PURE__ */ new Map(), Ve.set(e, r)), r;
|
|
3817
3880
|
}
|
|
3818
|
-
function
|
|
3881
|
+
function Tn(t, e, r) {
|
|
3819
3882
|
const n = ht(t), s = (Fe.get(n) ?? 0) + 1;
|
|
3820
3883
|
Fe.set(n, s);
|
|
3821
3884
|
const i = `blob_${s}`;
|
|
3822
|
-
return
|
|
3885
|
+
return Bt(t).set(i, {
|
|
3823
3886
|
bytes: e,
|
|
3824
3887
|
mimeType: r == null ? void 0 : r.mimeType,
|
|
3825
3888
|
contentType: r == null ? void 0 : r.contentType
|
|
3826
3889
|
}), i;
|
|
3827
3890
|
}
|
|
3828
|
-
function
|
|
3829
|
-
const r =
|
|
3891
|
+
function xn(t, e) {
|
|
3892
|
+
const r = Bt(t), n = r.get(e) ?? null;
|
|
3830
3893
|
return n && r.delete(e), n;
|
|
3831
3894
|
}
|
|
3832
|
-
function
|
|
3895
|
+
function Sn(t) {
|
|
3833
3896
|
const e = ht(t);
|
|
3834
3897
|
Ve.delete(e), Fe.delete(e);
|
|
3835
3898
|
}
|
|
@@ -3837,13 +3900,13 @@ function St() {
|
|
|
3837
3900
|
Ve.clear(), Fe.clear();
|
|
3838
3901
|
}
|
|
3839
3902
|
const It = 8 * 1024;
|
|
3840
|
-
function
|
|
3903
|
+
function In(t) {
|
|
3841
3904
|
const e = atob(t), r = new Uint8Array(e.length);
|
|
3842
3905
|
for (let n = 0; n < e.length; n++)
|
|
3843
3906
|
r[n] = e.charCodeAt(n);
|
|
3844
3907
|
return r;
|
|
3845
3908
|
}
|
|
3846
|
-
function
|
|
3909
|
+
function En(t) {
|
|
3847
3910
|
let e = "";
|
|
3848
3911
|
for (let r = 0; r < t.length; r += It) {
|
|
3849
3912
|
const n = t.subarray(r, r + It);
|
|
@@ -3852,23 +3915,23 @@ function xn(t) {
|
|
|
3852
3915
|
}
|
|
3853
3916
|
return btoa(e);
|
|
3854
3917
|
}
|
|
3855
|
-
function
|
|
3918
|
+
function Rn(t) {
|
|
3856
3919
|
if (typeof t != "object" || t === null) return !1;
|
|
3857
3920
|
const e = t;
|
|
3858
3921
|
if (e.store === !0) return !0;
|
|
3859
3922
|
const r = e.options;
|
|
3860
3923
|
return typeof r == "object" && r !== null ? r.store === !0 : !1;
|
|
3861
3924
|
}
|
|
3862
|
-
function
|
|
3863
|
-
if (!
|
|
3925
|
+
function zt(t, e, r) {
|
|
3926
|
+
if (!Rn(t) || typeof e != "object" || e === null || !("bodyEncoding" in e))
|
|
3864
3927
|
return e;
|
|
3865
3928
|
const n = e;
|
|
3866
3929
|
if (n.bodyEncoding !== "base64" || !n.body)
|
|
3867
3930
|
return e;
|
|
3868
|
-
const s =
|
|
3931
|
+
const s = In(n.body), i = Tn(r, s, {
|
|
3869
3932
|
contentType: n.contentType,
|
|
3870
3933
|
mimeType: n.contentType
|
|
3871
|
-
}), { body:
|
|
3934
|
+
}), { body: c, ...a } = n;
|
|
3872
3935
|
return {
|
|
3873
3936
|
...a,
|
|
3874
3937
|
bodyEncoding: "handle",
|
|
@@ -3889,15 +3952,15 @@ function Je(t) {
|
|
|
3889
3952
|
}
|
|
3890
3953
|
};
|
|
3891
3954
|
}
|
|
3892
|
-
async function
|
|
3955
|
+
async function An(t, e, r, n) {
|
|
3893
3956
|
var h;
|
|
3894
|
-
const i = (t === "tab_set_files" ?
|
|
3957
|
+
const i = (t === "tab_set_files" ? sn : rn).safeParse(e);
|
|
3895
3958
|
if (!i.success)
|
|
3896
3959
|
return Je(
|
|
3897
3960
|
((h = i.error.issues[0]) == null ? void 0 : h.message) ?? "Invalid setFiles params"
|
|
3898
3961
|
);
|
|
3899
|
-
const
|
|
3900
|
-
for (const d of
|
|
3962
|
+
const c = i.data, a = [];
|
|
3963
|
+
for (const d of c.files) {
|
|
3901
3964
|
if (d.url) {
|
|
3902
3965
|
a.push({
|
|
3903
3966
|
kind: "url",
|
|
@@ -3923,13 +3986,13 @@ async function In(t, e, r, n) {
|
|
|
3923
3986
|
continue;
|
|
3924
3987
|
}
|
|
3925
3988
|
if (d.handle) {
|
|
3926
|
-
const m =
|
|
3989
|
+
const m = xn(r, d.handle);
|
|
3927
3990
|
if (!m)
|
|
3928
3991
|
return Je(`Unknown or expired handle: ${d.handle}`);
|
|
3929
3992
|
a.push({
|
|
3930
3993
|
kind: "bytes",
|
|
3931
3994
|
name: d.name ?? d.handle,
|
|
3932
|
-
data:
|
|
3995
|
+
data: En(m.bytes),
|
|
3933
3996
|
mimeType: d.mimeType ?? m.mimeType ?? m.contentType
|
|
3934
3997
|
});
|
|
3935
3998
|
}
|
|
@@ -3937,25 +4000,25 @@ async function In(t, e, r, n) {
|
|
|
3937
4000
|
return {
|
|
3938
4001
|
ok: !0,
|
|
3939
4002
|
value: {
|
|
3940
|
-
...
|
|
4003
|
+
...c,
|
|
3941
4004
|
files: a
|
|
3942
4005
|
}
|
|
3943
4006
|
};
|
|
3944
4007
|
}
|
|
3945
4008
|
const Ue = /* @__PURE__ */ new Map();
|
|
3946
|
-
function
|
|
4009
|
+
function Cn(t, e) {
|
|
3947
4010
|
Ue.set(t, e);
|
|
3948
4011
|
}
|
|
3949
|
-
function
|
|
4012
|
+
function On(t) {
|
|
3950
4013
|
const e = Ue.get(t);
|
|
3951
4014
|
return e !== void 0 && Ue.delete(t), e;
|
|
3952
4015
|
}
|
|
3953
|
-
function
|
|
4016
|
+
function Nn() {
|
|
3954
4017
|
Ue.clear();
|
|
3955
4018
|
}
|
|
3956
|
-
const
|
|
3957
|
-
let
|
|
3958
|
-
const
|
|
4019
|
+
const qt = /* @__PURE__ */ new Set(["page_set_files", "tab_set_files"]), Ht = /* @__PURE__ */ new Set(["page_fetch", "tab_fetch"]);
|
|
4020
|
+
let ie = null, at = !1;
|
|
4021
|
+
const fe = /* @__PURE__ */ new Map();
|
|
3959
4022
|
function Be(t, e) {
|
|
3960
4023
|
try {
|
|
3961
4024
|
return t.postMessage(e), !0;
|
|
@@ -3965,19 +4028,19 @@ function Be(t, e) {
|
|
|
3965
4028
|
}
|
|
3966
4029
|
}
|
|
3967
4030
|
const Rt = 1e3;
|
|
3968
|
-
function
|
|
4031
|
+
function Gt(t, e, r) {
|
|
3969
4032
|
e === "main-thread" || e === "content-script" ? Be(r, { type: "relayCancel", id: t, owner: e }) : Be(r, { type: "registryCallCancel", id: t });
|
|
3970
4033
|
}
|
|
3971
4034
|
function At(t, e) {
|
|
3972
|
-
for (const [r, n] of
|
|
3973
|
-
clearTimeout(n.timeoutId),
|
|
4035
|
+
for (const [r, n] of fe)
|
|
4036
|
+
clearTimeout(n.timeoutId), Gt(r, n.owner, n.port), n.settle({
|
|
3974
4037
|
ok: !1,
|
|
3975
4038
|
error: { message: e, code: t }
|
|
3976
|
-
}),
|
|
4039
|
+
}), fe.delete(r);
|
|
3977
4040
|
}
|
|
3978
|
-
const
|
|
4041
|
+
const ye = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map();
|
|
3979
4042
|
let Ct = Promise.resolve(), Z = null;
|
|
3980
|
-
function
|
|
4043
|
+
function Mn(t) {
|
|
3981
4044
|
C.trace("sessionQueue_enqueue");
|
|
3982
4045
|
const e = Ct.then(t);
|
|
3983
4046
|
return Ct = e.then(
|
|
@@ -3987,7 +4050,7 @@ function Cn(t) {
|
|
|
3987
4050
|
}
|
|
3988
4051
|
), e;
|
|
3989
4052
|
}
|
|
3990
|
-
function
|
|
4053
|
+
function Jt(t) {
|
|
3991
4054
|
Z && (C.error("runCell_worker_failure", {
|
|
3992
4055
|
runId: Z.runId,
|
|
3993
4056
|
callId: Z.id,
|
|
@@ -4001,39 +4064,39 @@ function Gt(t) {
|
|
|
4001
4064
|
}
|
|
4002
4065
|
self.addEventListener("error", (t) => {
|
|
4003
4066
|
const e = t.message || (t.error instanceof Error ? t.error.message : "Worker uncaught error");
|
|
4004
|
-
C.error("worker_uncaught_error", { error: e }),
|
|
4067
|
+
C.error("worker_uncaught_error", { error: e }), Jt(e);
|
|
4005
4068
|
});
|
|
4006
4069
|
self.addEventListener("unhandledrejection", (t) => {
|
|
4007
4070
|
const e = t.reason, r = e instanceof Error ? e.message : String(e ?? "Unhandled rejection");
|
|
4008
|
-
C.error("worker_unhandled_rejection", { error: r }),
|
|
4071
|
+
C.error("worker_unhandled_rejection", { error: r }), Jt(r);
|
|
4009
4072
|
});
|
|
4010
|
-
function
|
|
4011
|
-
|
|
4073
|
+
function Pn(t, e) {
|
|
4074
|
+
ye.set(t, e);
|
|
4012
4075
|
}
|
|
4013
|
-
function
|
|
4014
|
-
|
|
4015
|
-
const i = e.safeParse(
|
|
4076
|
+
function N(t, e, r) {
|
|
4077
|
+
Pn(t, async (n, s) => {
|
|
4078
|
+
const i = e.safeParse(he(n));
|
|
4016
4079
|
if (!i.success) {
|
|
4017
|
-
const
|
|
4080
|
+
const c = Vr(
|
|
4018
4081
|
t,
|
|
4019
4082
|
e,
|
|
4020
4083
|
i.error.issues,
|
|
4021
4084
|
n
|
|
4022
|
-
), a = new Error(
|
|
4085
|
+
), a = new Error(c);
|
|
4023
4086
|
throw a.code = "E_INVALID_PARAMS", a;
|
|
4024
4087
|
}
|
|
4025
4088
|
return await r(i.data, s);
|
|
4026
4089
|
});
|
|
4027
4090
|
}
|
|
4028
|
-
function
|
|
4091
|
+
function $n() {
|
|
4029
4092
|
const t = new Uint8Array(16);
|
|
4030
4093
|
return crypto.getRandomValues(t), Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
4031
4094
|
}
|
|
4032
|
-
function
|
|
4033
|
-
return
|
|
4095
|
+
function Ln(t) {
|
|
4096
|
+
return or(t);
|
|
4034
4097
|
}
|
|
4035
|
-
const ot = /* @__PURE__ */ new Map(),
|
|
4036
|
-
function
|
|
4098
|
+
const ot = /* @__PURE__ */ new Map(), Le = /* @__PURE__ */ new Map();
|
|
4099
|
+
function jn(t, e) {
|
|
4037
4100
|
var r;
|
|
4038
4101
|
if (ot.has(t))
|
|
4039
4102
|
throw new Error(`Worker port already registered for owner: ${t}`);
|
|
@@ -4049,13 +4112,13 @@ function Pn(t, e) {
|
|
|
4049
4112
|
return;
|
|
4050
4113
|
}
|
|
4051
4114
|
if (s !== null && s.type === "registryCallCancel" && typeof s.id == "string") {
|
|
4052
|
-
(i =
|
|
4115
|
+
(i = Le.get(s.id)) == null || i.abort(), Le.delete(s.id);
|
|
4053
4116
|
return;
|
|
4054
4117
|
}
|
|
4055
4118
|
if (s !== null && s.type === "registryCall" && typeof s.id == "string" && typeof s.action == "string") {
|
|
4056
|
-
const
|
|
4057
|
-
|
|
4058
|
-
const h =
|
|
4119
|
+
const c = s.id, a = new AbortController();
|
|
4120
|
+
Le.set(c, a);
|
|
4121
|
+
const h = ye.get(s.action);
|
|
4059
4122
|
let d;
|
|
4060
4123
|
if (!h)
|
|
4061
4124
|
d = {
|
|
@@ -4086,7 +4149,7 @@ function Pn(t, e) {
|
|
|
4086
4149
|
}
|
|
4087
4150
|
};
|
|
4088
4151
|
}
|
|
4089
|
-
|
|
4152
|
+
Le.delete(c), Be(e, { type: "registryCallResult", id: c, result: d }) || ct(c, {
|
|
4090
4153
|
ok: !1,
|
|
4091
4154
|
error: {
|
|
4092
4155
|
message: "Failed to deliver worker handler response",
|
|
@@ -4098,38 +4161,38 @@ function Pn(t, e) {
|
|
|
4098
4161
|
}
|
|
4099
4162
|
function ct(t, e) {
|
|
4100
4163
|
C.trace("resolveAsyncRelayResult", { id: t });
|
|
4101
|
-
const r =
|
|
4164
|
+
const r = fe.get(t);
|
|
4102
4165
|
return r ? (r.settle(e), !0) : (C.warn("asyncRelayResult_no_pending_relay", { id: t }), !1);
|
|
4103
4166
|
}
|
|
4104
|
-
function
|
|
4167
|
+
function Dn(t) {
|
|
4105
4168
|
if (t === "main-thread" || t === "content-script")
|
|
4106
4169
|
return self;
|
|
4107
4170
|
const e = ot.get(t);
|
|
4108
4171
|
return e || null;
|
|
4109
4172
|
}
|
|
4110
|
-
function
|
|
4111
|
-
const { owner: e, action: r, tabPolicy: n, resolveTimeoutMs: s } = t, i = t.timeoutMs ??
|
|
4112
|
-
return (
|
|
4173
|
+
function Yt(t) {
|
|
4174
|
+
const { owner: e, action: r, tabPolicy: n, resolveTimeoutMs: s } = t, i = t.timeoutMs ?? ke;
|
|
4175
|
+
return (c, a) => {
|
|
4113
4176
|
C.trace("safePostAsCall_invoke", {
|
|
4114
4177
|
owner: e,
|
|
4115
4178
|
action: r,
|
|
4116
4179
|
callId: a == null ? void 0 : a.callId,
|
|
4117
4180
|
runId: a == null ? void 0 : a.runId
|
|
4118
4181
|
});
|
|
4119
|
-
const h = (s == null ? void 0 : s(
|
|
4182
|
+
const h = (s == null ? void 0 : s(c)) ?? i;
|
|
4120
4183
|
return new Promise((d, m) => {
|
|
4121
4184
|
var bt;
|
|
4122
4185
|
if ((bt = a == null ? void 0 : a.signal) != null && bt.aborted) {
|
|
4123
|
-
const
|
|
4124
|
-
|
|
4186
|
+
const G = new Error(`Relay aborted for action: ${r}`);
|
|
4187
|
+
G.code = "E_ABORT", m(G);
|
|
4125
4188
|
return;
|
|
4126
4189
|
}
|
|
4127
|
-
const R =
|
|
4190
|
+
const R = Dn(e);
|
|
4128
4191
|
if (!R) {
|
|
4129
4192
|
m(new Error(`No port available for action: ${r}`));
|
|
4130
4193
|
return;
|
|
4131
4194
|
}
|
|
4132
|
-
if (
|
|
4195
|
+
if (fe.size >= Rt) {
|
|
4133
4196
|
m(
|
|
4134
4197
|
new Error(
|
|
4135
4198
|
`Too many pending calls (${Rt} limit exceeded). Action: ${r}`
|
|
@@ -4137,23 +4200,23 @@ function Jt(t) {
|
|
|
4137
4200
|
);
|
|
4138
4201
|
return;
|
|
4139
4202
|
}
|
|
4140
|
-
const P =
|
|
4141
|
-
let
|
|
4142
|
-
const
|
|
4143
|
-
|
|
4203
|
+
const P = $n();
|
|
4204
|
+
let X = !1;
|
|
4205
|
+
const de = (G) => {
|
|
4206
|
+
X || (X = !0, clearTimeout(mt), a != null && a.signal && a.signal.removeEventListener("abort", He), fe.delete(P), G());
|
|
4144
4207
|
}, pt = () => {
|
|
4145
|
-
|
|
4208
|
+
Gt(P, e, R);
|
|
4146
4209
|
}, He = () => {
|
|
4147
4210
|
pt();
|
|
4148
|
-
const
|
|
4149
|
-
|
|
4211
|
+
const G = new Error(`Relay aborted for action: ${r}`);
|
|
4212
|
+
G.code = "E_ABORT", de(() => m(G));
|
|
4150
4213
|
};
|
|
4151
4214
|
a != null && a.signal && a.signal.addEventListener("abort", He);
|
|
4152
4215
|
const mt = setTimeout(() => {
|
|
4153
|
-
pt(),
|
|
4216
|
+
pt(), de(() => m(new Error(`Relay timeout for action: ${r}`)));
|
|
4154
4217
|
}, h);
|
|
4155
|
-
|
|
4156
|
-
settle: (
|
|
4218
|
+
fe.set(P, {
|
|
4219
|
+
settle: (G) => de(() => d(G)),
|
|
4157
4220
|
timeoutId: mt,
|
|
4158
4221
|
abort: He,
|
|
4159
4222
|
owner: e,
|
|
@@ -4165,18 +4228,18 @@ function Jt(t) {
|
|
|
4165
4228
|
id: P,
|
|
4166
4229
|
owner: e,
|
|
4167
4230
|
action: r,
|
|
4168
|
-
params:
|
|
4231
|
+
params: c,
|
|
4169
4232
|
callId: yt,
|
|
4170
4233
|
tabPolicy: n,
|
|
4171
|
-
command: { action: r, params:
|
|
4234
|
+
command: { action: r, params: c, runId: gt, callId: yt },
|
|
4172
4235
|
runId: gt
|
|
4173
|
-
}) ||
|
|
4236
|
+
}) || de(
|
|
4174
4237
|
() => m(new Error(`Failed to post relay for action: ${r}`))
|
|
4175
4238
|
);
|
|
4176
4239
|
});
|
|
4177
4240
|
};
|
|
4178
4241
|
}
|
|
4179
|
-
const
|
|
4242
|
+
const Zn = "worker", ke = 3e4, Ot = 5e3, Wn = 500, Vn = {
|
|
4180
4243
|
page_goto: "timeout",
|
|
4181
4244
|
page_wait_for: "timeout",
|
|
4182
4245
|
tab_wait_for_load: "timeout",
|
|
@@ -4184,57 +4247,52 @@ const Ln = "worker", ve = 3e4, Ot = 5e3, jn = 500, Dn = {
|
|
|
4184
4247
|
sleep: "duration",
|
|
4185
4248
|
page_wait: "duration",
|
|
4186
4249
|
sidepanel_wait: "duration"
|
|
4187
|
-
},
|
|
4188
|
-
function
|
|
4250
|
+
}, Kt = /* @__PURE__ */ new Set(["page_goto"]);
|
|
4251
|
+
function Fn(t, e) {
|
|
4189
4252
|
if (t === null || typeof t != "object" || Array.isArray(t))
|
|
4190
4253
|
return null;
|
|
4191
4254
|
const r = t[e];
|
|
4192
4255
|
return typeof r == "bigint" ? Number(r) : typeof r == "number" && Number.isFinite(r) ? r : null;
|
|
4193
4256
|
}
|
|
4194
|
-
function
|
|
4195
|
-
return
|
|
4257
|
+
function Un(t, e) {
|
|
4258
|
+
return Kt.has(t) ? e * 3 + Wn + Ot : e + Ot;
|
|
4196
4259
|
}
|
|
4197
|
-
const
|
|
4198
|
-
function
|
|
4199
|
-
if (
|
|
4200
|
-
return
|
|
4201
|
-
const r =
|
|
4202
|
-
if (!r) return
|
|
4203
|
-
let n =
|
|
4204
|
-
return n === null &&
|
|
4205
|
-
|
|
4206
|
-
|
|
4260
|
+
const Bn = 6e4;
|
|
4261
|
+
function Qt(t, e) {
|
|
4262
|
+
if (qt.has(t))
|
|
4263
|
+
return Bn;
|
|
4264
|
+
const r = Vn[t];
|
|
4265
|
+
if (!r) return ke;
|
|
4266
|
+
let n = Fn(e, r);
|
|
4267
|
+
return n === null && Kt.has(t) && (n = ke), n === null ? ke : Math.max(
|
|
4268
|
+
ke,
|
|
4269
|
+
Un(t, n)
|
|
4207
4270
|
);
|
|
4208
4271
|
}
|
|
4209
|
-
async function
|
|
4210
|
-
if (!
|
|
4272
|
+
async function Xt(t, e, r) {
|
|
4273
|
+
if (!qt.has(t))
|
|
4211
4274
|
return { ok: !0, params: e };
|
|
4212
|
-
if (!
|
|
4275
|
+
if (!ie)
|
|
4213
4276
|
return {
|
|
4214
4277
|
ok: !1,
|
|
4215
4278
|
error: { message: "Session not initialized", code: "E_INTERNAL" }
|
|
4216
4279
|
};
|
|
4217
|
-
const n = await
|
|
4280
|
+
const n = await An(
|
|
4218
4281
|
t,
|
|
4219
4282
|
e,
|
|
4220
4283
|
r,
|
|
4221
4284
|
async (s) => {
|
|
4222
|
-
const i =
|
|
4285
|
+
const i = nr(s);
|
|
4223
4286
|
if (i !== void 0)
|
|
4224
4287
|
return i;
|
|
4225
|
-
const
|
|
4226
|
-
|
|
4227
|
-
return o;
|
|
4228
|
-
const a = de.get("readBase64");
|
|
4229
|
-
if (!a)
|
|
4230
|
-
throw new Error("readBase64 handler not registered");
|
|
4231
|
-
return (await a({ path: s })).data;
|
|
4288
|
+
const c = On(s);
|
|
4289
|
+
return c !== void 0 ? c : await sr(s);
|
|
4232
4290
|
}
|
|
4233
4291
|
);
|
|
4234
4292
|
return n.ok ? { ok: !0, params: n.value } : n;
|
|
4235
4293
|
}
|
|
4236
|
-
function
|
|
4237
|
-
t =
|
|
4294
|
+
function Jn(t, e) {
|
|
4295
|
+
t = he(t);
|
|
4238
4296
|
const r = e == null ? void 0 : e.action;
|
|
4239
4297
|
if (C.trace("extensionDispatch", {
|
|
4240
4298
|
action: r,
|
|
@@ -4251,25 +4309,25 @@ function qn(t, e) {
|
|
|
4251
4309
|
const n = t;
|
|
4252
4310
|
return (async () => {
|
|
4253
4311
|
var h, d;
|
|
4254
|
-
const s = await
|
|
4312
|
+
const s = await Xt(
|
|
4255
4313
|
r,
|
|
4256
4314
|
t,
|
|
4257
4315
|
e == null ? void 0 : e.runId
|
|
4258
4316
|
);
|
|
4259
4317
|
if (!s.ok)
|
|
4260
4318
|
return s;
|
|
4261
|
-
if (t = s.params,
|
|
4262
|
-
const m =
|
|
4319
|
+
if (t = s.params, ye.has(r)) {
|
|
4320
|
+
const m = ye.get(r), R = (e == null ? void 0 : e.signal) ?? (e != null && e.runId ? (h = U.get(e.runId)) == null ? void 0 : h.signal : void 0);
|
|
4263
4321
|
return (async () => {
|
|
4264
4322
|
try {
|
|
4265
4323
|
return { ok: !0, value: await m(t, { ...e, signal: R }) };
|
|
4266
4324
|
} catch (P) {
|
|
4267
|
-
const
|
|
4268
|
-
return { ok: !1, error: { message:
|
|
4325
|
+
const X = P instanceof Error ? P.message : String(P), de = typeof P == "object" && P !== null && "code" in P && typeof P.code == "string" ? P.code : "E_WORKER_HANDLER";
|
|
4326
|
+
return { ok: !1, error: { message: X, code: de } };
|
|
4269
4327
|
}
|
|
4270
4328
|
})();
|
|
4271
4329
|
}
|
|
4272
|
-
const i =
|
|
4330
|
+
const i = zr(r);
|
|
4273
4331
|
if (!i)
|
|
4274
4332
|
return Promise.resolve({
|
|
4275
4333
|
ok: !1,
|
|
@@ -4278,18 +4336,18 @@ function qn(t, e) {
|
|
|
4278
4336
|
code: "E_NO_ROUTE"
|
|
4279
4337
|
}
|
|
4280
4338
|
});
|
|
4281
|
-
const a = await
|
|
4339
|
+
const a = await Yt({
|
|
4282
4340
|
owner: i.endpoint,
|
|
4283
4341
|
action: r,
|
|
4284
|
-
resolveTimeoutMs: (m) =>
|
|
4342
|
+
resolveTimeoutMs: (m) => Qt(r, m),
|
|
4285
4343
|
tabPolicy: i.tabPolicy
|
|
4286
4344
|
})(t, {
|
|
4287
4345
|
...e,
|
|
4288
|
-
signal: (e == null ? void 0 : e.signal) ?? (e != null && e.runId ? (d =
|
|
4346
|
+
signal: (e == null ? void 0 : e.signal) ?? (e != null && e.runId ? (d = U.get(e.runId)) == null ? void 0 : d.signal : void 0)
|
|
4289
4347
|
});
|
|
4290
|
-
return
|
|
4348
|
+
return Ht.has(r) && typeof a == "object" && a !== null && "ok" in a && a.ok ? {
|
|
4291
4349
|
ok: !0,
|
|
4292
|
-
value:
|
|
4350
|
+
value: zt(
|
|
4293
4351
|
n,
|
|
4294
4352
|
a.value,
|
|
4295
4353
|
e == null ? void 0 : e.runId
|
|
@@ -4297,37 +4355,37 @@ function qn(t, e) {
|
|
|
4297
4355
|
} : a;
|
|
4298
4356
|
})();
|
|
4299
4357
|
}
|
|
4300
|
-
function
|
|
4301
|
-
if (t.owner ===
|
|
4302
|
-
const e =
|
|
4358
|
+
function zn(t) {
|
|
4359
|
+
if (t.owner === Zn) {
|
|
4360
|
+
const e = ye.get(t.action);
|
|
4303
4361
|
if (!e)
|
|
4304
4362
|
throw new Error(
|
|
4305
4363
|
`No worker-local handler registered for action: ${t.action}`
|
|
4306
4364
|
);
|
|
4307
4365
|
return async (r, n) => {
|
|
4308
4366
|
var i;
|
|
4309
|
-
r =
|
|
4310
|
-
const s = (n == null ? void 0 : n.signal) ?? (n != null && n.runId ? (i =
|
|
4367
|
+
r = he(r);
|
|
4368
|
+
const s = (n == null ? void 0 : n.signal) ?? (n != null && n.runId ? (i = U.get(n.runId)) == null ? void 0 : i.signal : void 0);
|
|
4311
4369
|
try {
|
|
4312
4370
|
return { ok: !0, value: await e(r, {
|
|
4313
4371
|
...n,
|
|
4314
4372
|
action: t.action,
|
|
4315
4373
|
signal: s
|
|
4316
4374
|
}) };
|
|
4317
|
-
} catch (
|
|
4318
|
-
const a =
|
|
4375
|
+
} catch (c) {
|
|
4376
|
+
const a = c instanceof Error ? c.message : String(c), h = typeof c == "object" && c !== null && "code" in c && typeof c.code == "string" ? c.code : t.errorCode;
|
|
4319
4377
|
return { ok: !1, error: { message: a, code: h } };
|
|
4320
4378
|
}
|
|
4321
4379
|
};
|
|
4322
4380
|
} else {
|
|
4323
|
-
const e =
|
|
4381
|
+
const e = Yt({
|
|
4324
4382
|
owner: t.owner,
|
|
4325
4383
|
action: t.action,
|
|
4326
|
-
resolveTimeoutMs: (r) =>
|
|
4384
|
+
resolveTimeoutMs: (r) => Qt(t.action, r)
|
|
4327
4385
|
});
|
|
4328
4386
|
return async (r, n) => {
|
|
4329
|
-
var
|
|
4330
|
-
const s =
|
|
4387
|
+
var c;
|
|
4388
|
+
const s = he(r), i = await Xt(
|
|
4331
4389
|
t.action,
|
|
4332
4390
|
s,
|
|
4333
4391
|
n == null ? void 0 : n.runId
|
|
@@ -4337,11 +4395,11 @@ function Fn(t) {
|
|
|
4337
4395
|
try {
|
|
4338
4396
|
const a = await e(i.params, {
|
|
4339
4397
|
...n,
|
|
4340
|
-
signal: (n == null ? void 0 : n.signal) ?? (n != null && n.runId ? (
|
|
4398
|
+
signal: (n == null ? void 0 : n.signal) ?? (n != null && n.runId ? (c = U.get(n.runId)) == null ? void 0 : c.signal : void 0)
|
|
4341
4399
|
});
|
|
4342
|
-
return typeof a == "object" && a !== null && "ok" in a && a.ok &&
|
|
4400
|
+
return typeof a == "object" && a !== null && "ok" in a && a.ok && Ht.has(t.action) ? {
|
|
4343
4401
|
ok: !0,
|
|
4344
|
-
value:
|
|
4402
|
+
value: zt(
|
|
4345
4403
|
s,
|
|
4346
4404
|
a.value,
|
|
4347
4405
|
n == null ? void 0 : n.runId
|
|
@@ -4354,111 +4412,111 @@ function Fn(t) {
|
|
|
4354
4412
|
};
|
|
4355
4413
|
}
|
|
4356
4414
|
}
|
|
4357
|
-
function
|
|
4358
|
-
|
|
4415
|
+
function qn(t) {
|
|
4416
|
+
N(
|
|
4359
4417
|
"exists",
|
|
4360
|
-
|
|
4418
|
+
ee,
|
|
4361
4419
|
(e) => t.fsExists(e)
|
|
4362
|
-
),
|
|
4420
|
+
), N(
|
|
4363
4421
|
"stat",
|
|
4364
|
-
|
|
4422
|
+
ee,
|
|
4365
4423
|
(e) => t.fsStat(e)
|
|
4366
|
-
),
|
|
4424
|
+
), N(
|
|
4367
4425
|
"read",
|
|
4368
|
-
|
|
4426
|
+
ee,
|
|
4369
4427
|
(e) => t.fsRead(e)
|
|
4370
|
-
),
|
|
4428
|
+
), N(
|
|
4371
4429
|
"readText",
|
|
4372
|
-
|
|
4430
|
+
ee,
|
|
4373
4431
|
(e) => t.fsReadText(e)
|
|
4374
|
-
),
|
|
4432
|
+
), N(
|
|
4375
4433
|
"readBase64",
|
|
4376
|
-
|
|
4434
|
+
ee,
|
|
4377
4435
|
(e) => t.fsReadBase64(e)
|
|
4378
|
-
),
|
|
4436
|
+
), N(
|
|
4379
4437
|
"list",
|
|
4380
|
-
|
|
4438
|
+
ee,
|
|
4381
4439
|
(e) => t.fsList(e)
|
|
4382
|
-
),
|
|
4440
|
+
), N(
|
|
4383
4441
|
"mkdir",
|
|
4384
|
-
|
|
4442
|
+
ee,
|
|
4385
4443
|
(e) => t.fsMkdir(e)
|
|
4386
|
-
),
|
|
4444
|
+
), N(
|
|
4387
4445
|
"delete",
|
|
4388
|
-
|
|
4446
|
+
ee,
|
|
4389
4447
|
(e) => t.fsDelete(e)
|
|
4390
|
-
),
|
|
4448
|
+
), N(
|
|
4391
4449
|
"copy",
|
|
4392
4450
|
xt,
|
|
4393
4451
|
(e) => t.fsCopy(e)
|
|
4394
|
-
),
|
|
4452
|
+
), N(
|
|
4395
4453
|
"move",
|
|
4396
4454
|
xt,
|
|
4397
4455
|
(e) => t.fsMove(e)
|
|
4398
|
-
),
|
|
4456
|
+
), N(
|
|
4399
4457
|
"write",
|
|
4400
|
-
|
|
4458
|
+
le,
|
|
4401
4459
|
(e) => t.fsWrite(e)
|
|
4402
|
-
),
|
|
4460
|
+
), N(
|
|
4403
4461
|
"writeText",
|
|
4404
|
-
|
|
4462
|
+
le,
|
|
4405
4463
|
(e) => t.fsWriteText(e)
|
|
4406
|
-
),
|
|
4464
|
+
), N(
|
|
4407
4465
|
"writeBase64",
|
|
4408
|
-
|
|
4466
|
+
le,
|
|
4409
4467
|
async (e) => {
|
|
4410
4468
|
const r = e;
|
|
4411
|
-
return
|
|
4469
|
+
return Cn(r.path, r.data), t.fsWriteBase64(r);
|
|
4412
4470
|
}
|
|
4413
|
-
),
|
|
4471
|
+
), N(
|
|
4414
4472
|
"append",
|
|
4415
|
-
|
|
4473
|
+
le,
|
|
4416
4474
|
(e) => t.fsAppend(e)
|
|
4417
|
-
),
|
|
4475
|
+
), N(
|
|
4418
4476
|
"appendText",
|
|
4419
|
-
|
|
4477
|
+
le,
|
|
4420
4478
|
(e) => t.fsAppendText(e)
|
|
4421
|
-
),
|
|
4479
|
+
), N(
|
|
4422
4480
|
"appendBase64",
|
|
4423
|
-
|
|
4481
|
+
le,
|
|
4424
4482
|
(e) => t.fsAppendBase64(e)
|
|
4425
|
-
),
|
|
4483
|
+
), N(
|
|
4426
4484
|
"readRange",
|
|
4427
|
-
|
|
4485
|
+
cn,
|
|
4428
4486
|
(e) => t.fsReadRange(e)
|
|
4429
|
-
),
|
|
4487
|
+
), N(
|
|
4430
4488
|
"update",
|
|
4431
|
-
|
|
4489
|
+
dn,
|
|
4432
4490
|
(e) => t.fsUpdate(e)
|
|
4433
|
-
),
|
|
4491
|
+
), N(
|
|
4434
4492
|
"hash",
|
|
4435
|
-
|
|
4493
|
+
ln,
|
|
4436
4494
|
(e) => t.fsHash(e)
|
|
4437
4495
|
);
|
|
4438
4496
|
}
|
|
4439
|
-
async function
|
|
4497
|
+
async function Hn(t, e) {
|
|
4440
4498
|
if (at) return;
|
|
4441
|
-
await
|
|
4499
|
+
await er(), ie = new tr(), Ye(0), dr(Ye), C.trace("initWasm_start"), qn(ie), Yr(t);
|
|
4442
4500
|
const n = t.map((i) => ({
|
|
4443
|
-
entry:
|
|
4444
|
-
callback:
|
|
4501
|
+
entry: hr(i),
|
|
4502
|
+
callback: zn(i)
|
|
4445
4503
|
}));
|
|
4446
4504
|
try {
|
|
4447
|
-
|
|
4505
|
+
rr(n);
|
|
4448
4506
|
} catch (i) {
|
|
4449
|
-
const
|
|
4450
|
-
throw new Error(`Registry registration failed: ${
|
|
4507
|
+
const c = i instanceof Error ? i.message : String(i);
|
|
4508
|
+
throw new Error(`Registry registration failed: ${c}`);
|
|
4451
4509
|
}
|
|
4452
4510
|
const { freezeManifest: s } = await import("./extension_js.js");
|
|
4453
4511
|
try {
|
|
4454
4512
|
s();
|
|
4455
4513
|
} catch (i) {
|
|
4456
|
-
const
|
|
4457
|
-
throw new Error(`Manifest freeze failed: ${
|
|
4514
|
+
const c = i instanceof Error ? i.message : String(i);
|
|
4515
|
+
throw new Error(`Manifest freeze failed: ${c}`);
|
|
4458
4516
|
}
|
|
4459
|
-
if (
|
|
4517
|
+
if (ie.injectRegistryBindings(), e) {
|
|
4460
4518
|
const i = JSON.stringify(e);
|
|
4461
|
-
await
|
|
4519
|
+
await ie.runCellAsync(
|
|
4462
4520
|
`(function(){var r=globalThis.chrome&&globalThis.chrome.runtime;if(!r){r={};if(!globalThis.chrome)globalThis.chrome={};globalThis.chrome.runtime=r;}r.id=${i};})();`,
|
|
4463
4521
|
"",
|
|
4464
4522
|
"inject-runtime-id"
|
|
@@ -4481,12 +4539,12 @@ self.onmessage = async (t) => {
|
|
|
4481
4539
|
C.error("register_worker_port_missing", { owner: e.owner });
|
|
4482
4540
|
return;
|
|
4483
4541
|
}
|
|
4484
|
-
|
|
4542
|
+
jn(e.owner, n);
|
|
4485
4543
|
return;
|
|
4486
4544
|
}
|
|
4487
4545
|
if (e.type === "init") {
|
|
4488
4546
|
try {
|
|
4489
|
-
await
|
|
4547
|
+
await Hn(e.manifest, e.extensionId), self.postMessage({ type: "ready" });
|
|
4490
4548
|
} catch (n) {
|
|
4491
4549
|
const s = n instanceof Error ? n.message : String(n);
|
|
4492
4550
|
C.error("worker_init_failed", { error: s }), self.postMessage({
|
|
@@ -4497,10 +4555,10 @@ self.onmessage = async (t) => {
|
|
|
4497
4555
|
return;
|
|
4498
4556
|
}
|
|
4499
4557
|
if (e.type === "setLogLevel") {
|
|
4500
|
-
Ye(e.level),
|
|
4558
|
+
Ye(e.level), cr(Ln(e.level)), C.trace("set_log_level", { level: e.level });
|
|
4501
4559
|
return;
|
|
4502
4560
|
}
|
|
4503
|
-
if (!at || !
|
|
4561
|
+
if (!at || !ie) {
|
|
4504
4562
|
self.postMessage({
|
|
4505
4563
|
type: "error",
|
|
4506
4564
|
id: e.id,
|
|
@@ -4508,12 +4566,12 @@ self.onmessage = async (t) => {
|
|
|
4508
4566
|
});
|
|
4509
4567
|
return;
|
|
4510
4568
|
}
|
|
4511
|
-
const r =
|
|
4512
|
-
await
|
|
4569
|
+
const r = ie;
|
|
4570
|
+
await Mn(async () => {
|
|
4513
4571
|
switch (e.type) {
|
|
4514
4572
|
case "runCell": {
|
|
4515
4573
|
const n = e.runId, s = new AbortController();
|
|
4516
|
-
n &&
|
|
4574
|
+
n && U.set(n, s), Z = { id: e.id, runId: n }, C.trace("runCell_start", {
|
|
4517
4575
|
runId: n,
|
|
4518
4576
|
callId: e.id,
|
|
4519
4577
|
codeLen: e.code.length
|
|
@@ -4535,19 +4593,19 @@ self.onmessage = async (t) => {
|
|
|
4535
4593
|
runId: n
|
|
4536
4594
|
});
|
|
4537
4595
|
} catch (i) {
|
|
4538
|
-
const
|
|
4596
|
+
const c = i instanceof Error ? i.message : String(i), a = i instanceof Error ? i.name : void 0, h = i instanceof Error ? i.stack : void 0;
|
|
4539
4597
|
let d;
|
|
4540
4598
|
if (h) {
|
|
4541
4599
|
const R = h.match(/:(\d+):\d+\)?$/m);
|
|
4542
4600
|
R && (d = parseInt(R[1], 10));
|
|
4543
4601
|
}
|
|
4544
|
-
C.error("runCell_error", { runId: n, error:
|
|
4602
|
+
C.error("runCell_error", { runId: n, error: c, name: a, line: d });
|
|
4545
4603
|
const m = i instanceof Error ? {
|
|
4546
4604
|
name: a,
|
|
4547
|
-
message:
|
|
4605
|
+
message: c,
|
|
4548
4606
|
stack: h,
|
|
4549
4607
|
...d !== void 0 ? { line: d } : {}
|
|
4550
|
-
} : { message:
|
|
4608
|
+
} : { message: c };
|
|
4551
4609
|
self.postMessage({
|
|
4552
4610
|
type: "error",
|
|
4553
4611
|
id: e.id,
|
|
@@ -4555,15 +4613,15 @@ self.onmessage = async (t) => {
|
|
|
4555
4613
|
runId: n
|
|
4556
4614
|
});
|
|
4557
4615
|
} finally {
|
|
4558
|
-
(Z == null ? void 0 : Z.id) === e.id && (Z = null), n && (
|
|
4616
|
+
(Z == null ? void 0 : Z.id) === e.id && (Z = null), n && (U.delete(n), Sn(n));
|
|
4559
4617
|
}
|
|
4560
4618
|
break;
|
|
4561
4619
|
}
|
|
4562
4620
|
case "reset": {
|
|
4563
4621
|
r.setAborted(!0);
|
|
4564
|
-
for (const n of
|
|
4622
|
+
for (const n of U.values())
|
|
4565
4623
|
n.abort();
|
|
4566
|
-
|
|
4624
|
+
U.clear(), St(), Nn(), ir(), At("E_RESET", "Worker reset");
|
|
4567
4625
|
try {
|
|
4568
4626
|
r.reset(), self.postMessage({ type: "result", id: e.id, data: { ok: !0 } });
|
|
4569
4627
|
} catch (n) {
|
|
@@ -4574,9 +4632,9 @@ self.onmessage = async (t) => {
|
|
|
4574
4632
|
}
|
|
4575
4633
|
case "stop": {
|
|
4576
4634
|
r.setAborted(!0);
|
|
4577
|
-
for (const n of
|
|
4635
|
+
for (const n of U.values())
|
|
4578
4636
|
n.abort();
|
|
4579
|
-
|
|
4637
|
+
U.clear(), St(), At("E_STOPPED", "Worker stopped"), self.postMessage({ type: "result", id: e.id, data: { ok: !0 } });
|
|
4580
4638
|
break;
|
|
4581
4639
|
}
|
|
4582
4640
|
case "setFuelLimit": {
|
|
@@ -4625,7 +4683,7 @@ self.onmessage = async (t) => {
|
|
|
4625
4683
|
break;
|
|
4626
4684
|
}
|
|
4627
4685
|
case "fsCall": {
|
|
4628
|
-
const n =
|
|
4686
|
+
const n = ye.get(e.action);
|
|
4629
4687
|
if (!n) {
|
|
4630
4688
|
self.postMessage({
|
|
4631
4689
|
type: "error",
|
|
@@ -4653,14 +4711,14 @@ self.onmessage = async (t) => {
|
|
|
4653
4711
|
});
|
|
4654
4712
|
};
|
|
4655
4713
|
export {
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4714
|
+
ke as DEFAULT_RELAY_TIMEOUT_MS,
|
|
4715
|
+
zn as createExecutableCallback,
|
|
4716
|
+
Jn as extensionDispatch,
|
|
4717
|
+
Pn as registerWorkerHandler,
|
|
4718
|
+
N as registerWorkerHandlerValidated,
|
|
4719
|
+
jn as registerWorkerPort,
|
|
4662
4720
|
ct as resolveAsyncRelayResult,
|
|
4663
|
-
|
|
4664
|
-
|
|
4721
|
+
Qt as resolveRelayTimeoutMs,
|
|
4722
|
+
Yt as safePostAsCall,
|
|
4665
4723
|
At as settleAllPendingRelays
|
|
4666
4724
|
};
|