@pi-oxide/extension-js 0.9.0 → 0.9.1

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/worker.js CHANGED
@@ -1,4 +1,186 @@
1
1
  import Xt, { setLogLevel as Je, ExtensionSession as er, registerJsCallBatch as tr, takeCachedVfsWriteBase64 as rr, clearVfsWriteCache as nr } from "./extension_js.js";
2
+ const $e = {
3
+ trace: 0,
4
+ debug: 1,
5
+ info: 2,
6
+ warn: 3,
7
+ error: 4,
8
+ none: 5
9
+ }, sr = [
10
+ "trace",
11
+ "debug",
12
+ "info",
13
+ "warn",
14
+ "error",
15
+ "none"
16
+ ];
17
+ function ir(t) {
18
+ const e = Math.max(0, Math.min(5, Math.round(t)));
19
+ return sr[e] ?? "error";
20
+ }
21
+ let dt = "trace", Ye = null;
22
+ function ar(t) {
23
+ dt = t, Ye && Ye($e[t]);
24
+ }
25
+ function or(t) {
26
+ Ye = t, t($e[dt]);
27
+ }
28
+ function cr(t) {
29
+ return $e[t] >= $e[dt];
30
+ }
31
+ function Nt(t, e = "info") {
32
+ var r;
33
+ if (t === null) return "null";
34
+ if (t === void 0) return "undefined";
35
+ if (typeof t == "string") return t;
36
+ if (typeof t == "number" || typeof t == "boolean")
37
+ return String(t);
38
+ if (typeof t == "bigint") return `${t}n`;
39
+ if (t instanceof Error) {
40
+ const n = e === "debug" || e === "trace" ? t.stack : (r = t.stack) == null ? void 0 : r.split(`
41
+ `)[0];
42
+ return JSON.stringify({ message: t.message, name: t.name, stack: n });
43
+ }
44
+ if (typeof t == "function") return "[Function]";
45
+ if (typeof t == "symbol") return String(t);
46
+ if (typeof t == "object")
47
+ try {
48
+ return JSON.stringify(t);
49
+ } catch (n) {
50
+ return n instanceof TypeError && n.message.includes("circular") ? "[Circular]" : `[Unserializable: ${n instanceof Error ? n.message : String(n)}]`;
51
+ }
52
+ return String(t);
53
+ }
54
+ function dr(t) {
55
+ return `[extension-js][${t}]`;
56
+ }
57
+ function lr(t, e) {
58
+ if (!t) return "";
59
+ const r = [];
60
+ try {
61
+ for (const [n, s] of Object.entries(t))
62
+ r.push(`${n}=${Nt(s, e)}`);
63
+ } catch {
64
+ return " metadata=[unreadable]";
65
+ }
66
+ return r.length > 0 ? ` ${r.join(" ")}` : "";
67
+ }
68
+ function be(t, e) {
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
+ event: t,
71
+ metadata: { _args: e.map((r) => Nt(r)).join(" ") }
72
+ };
73
+ }
74
+ class lt {
75
+ constructor(e = "root") {
76
+ this.namespace = e;
77
+ }
78
+ log(e, r, n) {
79
+ try {
80
+ if (!cr(e)) return;
81
+ const s = dr(this.namespace), i = lr(n, e), o = `${s} ${r}${i}`;
82
+ switch (e) {
83
+ case "trace":
84
+ case "debug":
85
+ case "info":
86
+ console.log(o);
87
+ break;
88
+ case "warn":
89
+ console.warn(o);
90
+ break;
91
+ case "error":
92
+ console.error(o);
93
+ break;
94
+ case "none":
95
+ break;
96
+ default: {
97
+ const a = e;
98
+ break;
99
+ }
100
+ }
101
+ } catch {
102
+ }
103
+ }
104
+ trace(e, ...r) {
105
+ const { event: n, metadata: s } = be(e, r);
106
+ this.log("trace", n, s);
107
+ }
108
+ debug(e, ...r) {
109
+ const { event: n, metadata: s } = be(e, r);
110
+ this.log("debug", n, s);
111
+ }
112
+ info(e, ...r) {
113
+ const { event: n, metadata: s } = be(e, r);
114
+ this.log("info", n, s);
115
+ }
116
+ warn(e, ...r) {
117
+ const { event: n, metadata: s } = be(e, r);
118
+ this.log("warn", n, s);
119
+ }
120
+ error(e, ...r) {
121
+ const { event: n, metadata: s } = be(e, r);
122
+ this.log("error", n, s);
123
+ }
124
+ child(e) {
125
+ return new lt(`${this.namespace}.${e}`);
126
+ }
127
+ timer(e, r, n = "info") {
128
+ const s = typeof performance < "u" && performance.now, i = s ? performance.now() : Date.now();
129
+ return (o) => {
130
+ try {
131
+ const a = s ? performance.now() : Date.now(), h = Math.round(a - i), d = {
132
+ ...r,
133
+ ...o,
134
+ duration_ms: h
135
+ };
136
+ this.log(n, e, d);
137
+ } catch {
138
+ }
139
+ };
140
+ }
141
+ }
142
+ const C = new lt("root");
143
+ function pe(t) {
144
+ return t == null ? {} : t instanceof Map ? Object.fromEntries(
145
+ [...t.entries()].map(([e, r]) => [
146
+ e,
147
+ pe(r)
148
+ ])
149
+ ) : Array.isArray(t) ? t.map(pe) : t;
150
+ }
151
+ function ur(t) {
152
+ return {
153
+ action: t.action,
154
+ namespace: t.namespace,
155
+ name: t.name,
156
+ publicName: t.publicName,
157
+ description: t.description,
158
+ fields: t.fields,
159
+ aliases: (t.aliases ?? []).map((e) => ({
160
+ namespace: e.namespace,
161
+ name: e.name,
162
+ fields: e.fields
163
+ })),
164
+ paramsDoc: t.paramsDoc.map((e) => ({
165
+ name: e.name,
166
+ type: e.type,
167
+ required: e.required,
168
+ description: e.description
169
+ })),
170
+ returnsDoc: {
171
+ type: t.returnsDoc.type,
172
+ description: t.returnsDoc.description
173
+ },
174
+ errorCode: t.errorCode,
175
+ errorCategory: t.errorCategory ?? null,
176
+ permission: t.permission ?? null,
177
+ example: t.example ?? null,
178
+ prerequisites: t.prerequisites ?? null,
179
+ notes: t.notes ?? null,
180
+ tags: t.tags ?? null,
181
+ relatedApis: t.relatedApis ?? null
182
+ };
183
+ }
2
184
  var I;
3
185
  (function(t) {
4
186
  t.assertEqual = (s) => {
@@ -224,11 +406,11 @@ const we = (t, e) => {
224
406
  }
225
407
  return { message: r };
226
408
  };
227
- let sr = we;
228
- function Ye() {
229
- return sr;
409
+ let fr = we;
410
+ function Ke() {
411
+ return fr;
230
412
  }
231
- const Ke = (t) => {
413
+ const Qe = (t) => {
232
414
  const { data: e, path: r, errorMaps: n, issueData: s } = t, i = [...r, ...s.path || []], o = {
233
415
  ...s,
234
416
  path: i
@@ -250,7 +432,7 @@ const Ke = (t) => {
250
432
  };
251
433
  };
252
434
  function p(t, e) {
253
- const r = Ye(), n = Ke({
435
+ const r = Ke(), n = Qe({
254
436
  issueData: e,
255
437
  data: t.data,
256
438
  path: t.path,
@@ -310,7 +492,7 @@ class P {
310
492
  }
311
493
  const v = Object.freeze({
312
494
  status: "aborted"
313
- }), _e = (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", $e = (t) => typeof Promise < "u" && t instanceof Promise;
495
+ }), _e = (t) => ({ status: "dirty", value: t }), L = (t) => ({ status: "valid", value: t }), vt = (t) => t.status === "aborted", kt = (t) => t.status === "dirty", me = (t) => t.status === "valid", Pe = (t) => typeof Promise < "u" && t instanceof Promise;
314
496
  var y;
315
497
  (function(t) {
316
498
  t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
@@ -324,7 +506,7 @@ class B {
324
506
  }
325
507
  }
326
508
  const wt = (t, e) => {
327
- if (pe(e))
509
+ if (me(e))
328
510
  return { success: !0, data: e.value };
329
511
  if (!t.common.issues.length)
330
512
  throw new Error("Validation failed but no issues detected.");
@@ -381,7 +563,7 @@ class S {
381
563
  }
382
564
  _parseSync(e) {
383
565
  const r = this._parse(e);
384
- if ($e(r))
566
+ if (Pe(r))
385
567
  throw new Error("Synchronous parse encountered promise.");
386
568
  return r;
387
569
  }
@@ -426,7 +608,7 @@ class S {
426
608
  if (!this["~standard"].async)
427
609
  try {
428
610
  const i = this._parseSync({ data: e, path: [], parent: r });
429
- return pe(i) ? {
611
+ return me(i) ? {
430
612
  value: i.value
431
613
  } : {
432
614
  issues: r.common.issues
@@ -437,7 +619,7 @@ class S {
437
619
  async: !0
438
620
  };
439
621
  }
440
- return this._parseAsync({ data: e, path: [], parent: r }).then((i) => pe(i) ? {
622
+ return this._parseAsync({ data: e, path: [], parent: r }).then((i) => me(i) ? {
441
623
  value: i.value
442
624
  } : {
443
625
  issues: r.common.issues
@@ -461,7 +643,7 @@ class S {
461
643
  parent: null,
462
644
  data: e,
463
645
  parsedType: ee(e)
464
- }, s = this._parse({ data: e, path: n.path, parent: n }), i = await ($e(s) ? s : Promise.resolve(s));
646
+ }, s = this._parse({ data: e, path: n.path, parent: n }), i = await (Pe(s) ? s : Promise.resolve(s));
465
647
  return wt(n, i);
466
648
  }
467
649
  refine(e, r) {
@@ -507,7 +689,7 @@ class S {
507
689
  return W.create(this);
508
690
  }
509
691
  promise() {
510
- return ge.create(this, this._def);
692
+ return ye.create(this, this._def);
511
693
  }
512
694
  or(e) {
513
695
  return Se.create([this, e], this._def);
@@ -533,7 +715,7 @@ class S {
533
715
  });
534
716
  }
535
717
  brand() {
536
- return new dt({
718
+ return new ut({
537
719
  typeName: k.ZodBranded,
538
720
  type: this,
539
721
  ...w(this._def)
@@ -568,28 +750,28 @@ class S {
568
750
  return this.safeParse(null).success;
569
751
  }
570
752
  }
571
- const ir = /^c[^\s-]{8,}$/i, ar = /^[0-9a-z]+$/, or = /^[0-9A-HJKMNP-TV-Z]{26}$/i, cr = /^[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, dr = /^[a-z0-9_-]{21}$/i, lr = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ur = /^[-+]?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)?)??$/, fr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, hr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
753
+ const hr = /^c[^\s-]{8,}$/i, pr = /^[0-9a-z]+$/, mr = /^[0-9A-HJKMNP-TV-Z]{26}$/i, gr = /^[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, yr = /^[a-z0-9_-]{21}$/i, br = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, _r = /^[-+]?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)?)??$/, vr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, kr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
572
754
  let He;
573
- const pr = /^(?:(?: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])$/, mr = /^(?:(?: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])$/, gr = /^(([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]))$/, yr = /^(([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])$/, br = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, _r = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Nt = "((\\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])))", vr = new RegExp(`^${Nt}$`);
574
- function Mt(t) {
755
+ const wr = /^(?:(?: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])$/, Tr = /^(?:(?: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])$/, xr = /^(([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]))$/, Sr = /^(([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])$/, Ir = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Er = /^([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])))", Rr = new RegExp(`^${Mt}$`);
756
+ function $t(t) {
575
757
  let e = "[0-5]\\d";
576
758
  t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
577
759
  const r = t.precision ? "+" : "?";
578
760
  return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`;
579
761
  }
580
- function kr(t) {
581
- return new RegExp(`^${Mt(t)}$`);
762
+ function Ar(t) {
763
+ return new RegExp(`^${$t(t)}$`);
582
764
  }
583
- function wr(t) {
584
- let e = `${Nt}T${Mt(t)}`;
765
+ function Cr(t) {
766
+ let e = `${Mt}T${$t(t)}`;
585
767
  const r = [];
586
768
  return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
587
769
  }
588
- function Tr(t, e) {
589
- return !!((e === "v4" || !e) && pr.test(t) || (e === "v6" || !e) && gr.test(t));
770
+ function Or(t, e) {
771
+ return !!((e === "v4" || !e) && wr.test(t) || (e === "v6" || !e) && xr.test(t));
590
772
  }
591
- function xr(t, e) {
592
- if (!lr.test(t))
773
+ function Nr(t, e) {
774
+ if (!br.test(t))
593
775
  return !1;
594
776
  try {
595
777
  const [r] = t.split(".");
@@ -601,8 +783,8 @@ function xr(t, e) {
601
783
  return !1;
602
784
  }
603
785
  }
604
- function Sr(t, e) {
605
- return !!((e === "v4" || !e) && mr.test(t) || (e === "v6" || !e) && yr.test(t));
786
+ function Mr(t, e) {
787
+ return !!((e === "v4" || !e) && Tr.test(t) || (e === "v6" || !e) && Sr.test(t));
606
788
  }
607
789
  class U extends S {
608
790
  _parse(e) {
@@ -653,43 +835,43 @@ class U extends S {
653
835
  message: i.message
654
836
  }), n.dirty());
655
837
  } else if (i.kind === "email")
656
- fr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
838
+ vr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
657
839
  validation: "email",
658
840
  code: u.invalid_string,
659
841
  message: i.message
660
842
  }), n.dirty());
661
843
  else if (i.kind === "emoji")
662
- He || (He = new RegExp(hr, "u")), He.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
844
+ He || (He = new RegExp(kr, "u")), He.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
663
845
  validation: "emoji",
664
846
  code: u.invalid_string,
665
847
  message: i.message
666
848
  }), n.dirty());
667
849
  else if (i.kind === "uuid")
668
- cr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
850
+ gr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
669
851
  validation: "uuid",
670
852
  code: u.invalid_string,
671
853
  message: i.message
672
854
  }), n.dirty());
673
855
  else if (i.kind === "nanoid")
674
- dr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
856
+ yr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
675
857
  validation: "nanoid",
676
858
  code: u.invalid_string,
677
859
  message: i.message
678
860
  }), n.dirty());
679
861
  else if (i.kind === "cuid")
680
- ir.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
862
+ hr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
681
863
  validation: "cuid",
682
864
  code: u.invalid_string,
683
865
  message: i.message
684
866
  }), n.dirty());
685
867
  else if (i.kind === "cuid2")
686
- ar.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
868
+ pr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
687
869
  validation: "cuid2",
688
870
  code: u.invalid_string,
689
871
  message: i.message
690
872
  }), n.dirty());
691
873
  else if (i.kind === "ulid")
692
- or.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
874
+ mr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
693
875
  validation: "ulid",
694
876
  code: u.invalid_string,
695
877
  message: i.message
@@ -720,39 +902,39 @@ class U extends S {
720
902
  code: u.invalid_string,
721
903
  validation: { endsWith: i.value },
722
904
  message: i.message
723
- }), n.dirty()) : i.kind === "datetime" ? wr(i).test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
905
+ }), n.dirty()) : i.kind === "datetime" ? Cr(i).test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
724
906
  code: u.invalid_string,
725
907
  validation: "datetime",
726
908
  message: i.message
727
- }), n.dirty()) : i.kind === "date" ? vr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
909
+ }), n.dirty()) : i.kind === "date" ? Rr.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
728
910
  code: u.invalid_string,
729
911
  validation: "date",
730
912
  message: i.message
731
- }), n.dirty()) : i.kind === "time" ? kr(i).test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
913
+ }), n.dirty()) : i.kind === "time" ? Ar(i).test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
732
914
  code: u.invalid_string,
733
915
  validation: "time",
734
916
  message: i.message
735
- }), n.dirty()) : i.kind === "duration" ? ur.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
917
+ }), n.dirty()) : i.kind === "duration" ? _r.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
736
918
  validation: "duration",
737
919
  code: u.invalid_string,
738
920
  message: i.message
739
- }), n.dirty()) : i.kind === "ip" ? Tr(e.data, i.version) || (s = this._getOrReturnCtx(e, s), p(s, {
921
+ }), n.dirty()) : i.kind === "ip" ? Or(e.data, i.version) || (s = this._getOrReturnCtx(e, s), p(s, {
740
922
  validation: "ip",
741
923
  code: u.invalid_string,
742
924
  message: i.message
743
- }), n.dirty()) : i.kind === "jwt" ? xr(e.data, i.alg) || (s = this._getOrReturnCtx(e, s), p(s, {
925
+ }), n.dirty()) : i.kind === "jwt" ? Nr(e.data, i.alg) || (s = this._getOrReturnCtx(e, s), p(s, {
744
926
  validation: "jwt",
745
927
  code: u.invalid_string,
746
928
  message: i.message
747
- }), n.dirty()) : i.kind === "cidr" ? Sr(e.data, i.version) || (s = this._getOrReturnCtx(e, s), p(s, {
929
+ }), n.dirty()) : i.kind === "cidr" ? Mr(e.data, i.version) || (s = this._getOrReturnCtx(e, s), p(s, {
748
930
  validation: "cidr",
749
931
  code: u.invalid_string,
750
932
  message: i.message
751
- }), n.dirty()) : i.kind === "base64" ? br.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
933
+ }), n.dirty()) : i.kind === "base64" ? Ir.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
752
934
  validation: "base64",
753
935
  code: u.invalid_string,
754
936
  message: i.message
755
- }), n.dirty()) : i.kind === "base64url" ? _r.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
937
+ }), n.dirty()) : i.kind === "base64url" ? Er.test(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
756
938
  validation: "base64url",
757
939
  code: u.invalid_string,
758
940
  message: i.message
@@ -987,7 +1169,7 @@ U.create = (t) => new U({
987
1169
  coerce: (t == null ? void 0 : t.coerce) ?? !1,
988
1170
  ...w(t)
989
1171
  });
990
- function Ir(t, e) {
1172
+ function $r(t, e) {
991
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(".", "")), o = Number.parseInt(e.toFixed(s).replace(".", ""));
992
1174
  return i % o / 10 ** s;
993
1175
  }
@@ -1026,7 +1208,7 @@ class ae extends S {
1026
1208
  inclusive: i.inclusive,
1027
1209
  exact: !1,
1028
1210
  message: i.message
1029
- }), s.dirty()) : i.kind === "multipleOf" ? Ir(e.data, i.value) !== 0 && (n = this._getOrReturnCtx(e, n), p(n, {
1211
+ }), s.dirty()) : i.kind === "multipleOf" ? $r(e.data, i.value) !== 0 && (n = this._getOrReturnCtx(e, n), p(n, {
1030
1212
  code: u.not_multiple_of,
1031
1213
  multipleOf: i.value,
1032
1214
  message: i.message
@@ -1296,7 +1478,7 @@ oe.create = (t) => new oe({
1296
1478
  coerce: (t == null ? void 0 : t.coerce) ?? !1,
1297
1479
  ...w(t)
1298
1480
  });
1299
- class Pe extends S {
1481
+ class Le extends S {
1300
1482
  _parse(e) {
1301
1483
  if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== g.boolean) {
1302
1484
  const n = this._getOrReturnCtx(e);
@@ -1309,7 +1491,7 @@ class Pe extends S {
1309
1491
  return L(e.data);
1310
1492
  }
1311
1493
  }
1312
- Pe.create = (t) => new Pe({
1494
+ Le.create = (t) => new Le({
1313
1495
  typeName: k.ZodBoolean,
1314
1496
  coerce: (t == null ? void 0 : t.coerce) || !1,
1315
1497
  ...w(t)
@@ -1409,7 +1591,7 @@ Tt.create = (t) => new Tt({
1409
1591
  typeName: k.ZodSymbol,
1410
1592
  ...w(t)
1411
1593
  });
1412
- class Le extends S {
1594
+ class je extends S {
1413
1595
  _parse(e) {
1414
1596
  if (this._getType(e) !== g.undefined) {
1415
1597
  const n = this._getOrReturnCtx(e);
@@ -1422,7 +1604,7 @@ class Le extends S {
1422
1604
  return L(e.data);
1423
1605
  }
1424
1606
  }
1425
- Le.create = (t) => new Le({
1607
+ je.create = (t) => new je({
1426
1608
  typeName: k.ZodUndefined,
1427
1609
  ...w(t)
1428
1610
  });
@@ -1443,7 +1625,7 @@ xe.create = (t) => new xe({
1443
1625
  typeName: k.ZodNull,
1444
1626
  ...w(t)
1445
1627
  });
1446
- class Qe extends S {
1628
+ class Xe extends S {
1447
1629
  constructor() {
1448
1630
  super(...arguments), this._any = !0;
1449
1631
  }
@@ -1451,7 +1633,7 @@ class Qe extends S {
1451
1633
  return L(e.data);
1452
1634
  }
1453
1635
  }
1454
- Qe.create = (t) => new Qe({
1636
+ Xe.create = (t) => new Xe({
1455
1637
  typeName: k.ZodAny,
1456
1638
  ...w(t)
1457
1639
  });
@@ -1481,7 +1663,7 @@ te.create = (t) => new te({
1481
1663
  typeName: k.ZodNever,
1482
1664
  ...w(t)
1483
1665
  });
1484
- class Xe extends S {
1666
+ class et extends S {
1485
1667
  _parse(e) {
1486
1668
  if (this._getType(e) !== g.undefined) {
1487
1669
  const n = this._getOrReturnCtx(e);
@@ -1494,7 +1676,7 @@ class Xe extends S {
1494
1676
  return L(e.data);
1495
1677
  }
1496
1678
  }
1497
- Xe.create = (t) => new Xe({
1679
+ et.create = (t) => new et({
1498
1680
  typeName: k.ZodVoid,
1499
1681
  ...w(t)
1500
1682
  });
@@ -1851,7 +2033,7 @@ class A extends S {
1851
2033
  });
1852
2034
  }
1853
2035
  keyof() {
1854
- return $t(I.objectKeys(this.shape));
2036
+ return Pt(I.objectKeys(this.shape));
1855
2037
  }
1856
2038
  }
1857
2039
  A.create = (t, e) => new A({
@@ -1948,7 +2130,7 @@ Se.create = (t, e) => new Se({
1948
2130
  typeName: k.ZodUnion,
1949
2131
  ...w(e)
1950
2132
  });
1951
- const G = (t) => t instanceof je ? G(t.schema) : t instanceof J ? G(t.innerType()) : t instanceof Re ? [t.value] : t instanceof re ? t.options : t instanceof rt ? I.objectValues(t.enum) : t instanceof Ae ? G(t._def.innerType) : t instanceof Le ? [void 0] : t instanceof xe ? [null] : t instanceof V ? [void 0, ...G(t.unwrap())] : t instanceof ne ? [null, ...G(t.unwrap())] : t instanceof dt || t instanceof Oe ? G(t.unwrap()) : t instanceof Ce ? G(t._def.innerType) : [];
2133
+ const G = (t) => t instanceof De ? G(t.schema) : t instanceof J ? G(t.innerType()) : t instanceof Re ? [t.value] : t instanceof re ? t.options : t instanceof nt ? I.objectValues(t.enum) : t instanceof Ae ? G(t._def.innerType) : t instanceof je ? [void 0] : t instanceof xe ? [null] : t instanceof V ? [void 0, ...G(t.unwrap())] : t instanceof ne ? [null, ...G(t.unwrap())] : t instanceof ut || t instanceof Oe ? G(t.unwrap()) : t instanceof Ce ? G(t._def.innerType) : [];
1952
2134
  class Be extends S {
1953
2135
  _parse(e) {
1954
2136
  const { ctx: r } = this._processInputParams(e);
@@ -2011,14 +2193,14 @@ class Be extends S {
2011
2193
  });
2012
2194
  }
2013
2195
  }
2014
- function et(t, e) {
2196
+ function tt(t, e) {
2015
2197
  const r = ee(t), n = ee(e);
2016
2198
  if (t === e)
2017
2199
  return { valid: !0, data: t };
2018
2200
  if (r === g.object && n === g.object) {
2019
2201
  const s = I.objectKeys(e), i = I.objectKeys(t).filter((a) => s.indexOf(a) !== -1), o = { ...t, ...e };
2020
2202
  for (const a of i) {
2021
- const h = et(t[a], e[a]);
2203
+ const h = tt(t[a], e[a]);
2022
2204
  if (!h.valid)
2023
2205
  return { valid: !1 };
2024
2206
  o[a] = h.data;
@@ -2029,7 +2211,7 @@ function et(t, e) {
2029
2211
  return { valid: !1 };
2030
2212
  const s = [];
2031
2213
  for (let i = 0; i < t.length; i++) {
2032
- const o = t[i], a = e[i], h = et(o, a);
2214
+ const o = t[i], a = e[i], h = tt(o, a);
2033
2215
  if (!h.valid)
2034
2216
  return { valid: !1 };
2035
2217
  s.push(h.data);
@@ -2042,7 +2224,7 @@ class Ie extends S {
2042
2224
  const { status: r, ctx: n } = this._processInputParams(e), s = (i, o) => {
2043
2225
  if (vt(i) || vt(o))
2044
2226
  return v;
2045
- const a = et(i.value, o.value);
2227
+ const a = tt(i.value, o.value);
2046
2228
  return a.valid ? ((kt(i) || kt(o)) && r.dirty(), { status: r.value, value: a.data }) : (p(n, {
2047
2229
  code: u.invalid_intersection_types
2048
2230
  }), v);
@@ -2166,7 +2348,7 @@ class Ee extends S {
2166
2348
  });
2167
2349
  }
2168
2350
  }
2169
- class tt extends S {
2351
+ class rt extends S {
2170
2352
  get keySchema() {
2171
2353
  return this._def.keyType;
2172
2354
  }
@@ -2208,13 +2390,13 @@ class tt extends S {
2208
2390
  }
2209
2391
  }
2210
2392
  }
2211
- tt.create = (t, e, r) => new tt({
2393
+ rt.create = (t, e, r) => new rt({
2212
2394
  valueType: e,
2213
2395
  keyType: t,
2214
2396
  typeName: k.ZodMap,
2215
2397
  ...w(r)
2216
2398
  });
2217
- class me extends S {
2399
+ class ge extends S {
2218
2400
  _parse(e) {
2219
2401
  const { status: r, ctx: n } = this._processInputParams(e);
2220
2402
  if (n.parsedType !== g.set)
@@ -2253,13 +2435,13 @@ class me extends S {
2253
2435
  return n.common.async ? Promise.all(a).then((h) => o(h)) : o(a);
2254
2436
  }
2255
2437
  min(e, r) {
2256
- return new me({
2438
+ return new ge({
2257
2439
  ...this._def,
2258
2440
  minSize: { value: e, message: y.toString(r) }
2259
2441
  });
2260
2442
  }
2261
2443
  max(e, r) {
2262
- return new me({
2444
+ return new ge({
2263
2445
  ...this._def,
2264
2446
  maxSize: { value: e, message: y.toString(r) }
2265
2447
  });
@@ -2271,7 +2453,7 @@ class me extends S {
2271
2453
  return this.min(1, e);
2272
2454
  }
2273
2455
  }
2274
- me.create = (t, e) => new me({
2456
+ ge.create = (t, e) => new ge({
2275
2457
  valueType: t,
2276
2458
  minSize: null,
2277
2459
  maxSize: null,
@@ -2291,10 +2473,10 @@ class ke extends S {
2291
2473
  received: r.parsedType
2292
2474
  }), v;
2293
2475
  function n(a, h) {
2294
- return Ke({
2476
+ return Qe({
2295
2477
  data: a,
2296
2478
  path: r.path,
2297
- errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, Ye(), we].filter((d) => !!d),
2479
+ errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, Ke(), we].filter((d) => !!d),
2298
2480
  issueData: {
2299
2481
  code: u.invalid_arguments,
2300
2482
  argumentsError: h
@@ -2302,10 +2484,10 @@ class ke extends S {
2302
2484
  });
2303
2485
  }
2304
2486
  function s(a, h) {
2305
- return Ke({
2487
+ return Qe({
2306
2488
  data: a,
2307
2489
  path: r.path,
2308
- errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, Ye(), we].filter((d) => !!d),
2490
+ errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, Ke(), we].filter((d) => !!d),
2309
2491
  issueData: {
2310
2492
  code: u.invalid_return_type,
2311
2493
  returnTypeError: h
@@ -2313,7 +2495,7 @@ class ke extends S {
2313
2495
  });
2314
2496
  }
2315
2497
  const i = { errorMap: r.common.contextualErrorMap }, o = r.data;
2316
- if (this._def.returns instanceof ge) {
2498
+ if (this._def.returns instanceof ye) {
2317
2499
  const a = this;
2318
2500
  return L(async function(...h) {
2319
2501
  const d = new j([]), m = await a._def.args.parseAsync(h, i).catch((Q) => {
@@ -2369,7 +2551,7 @@ class ke extends S {
2369
2551
  });
2370
2552
  }
2371
2553
  }
2372
- class je extends S {
2554
+ class De extends S {
2373
2555
  get schema() {
2374
2556
  return this._def.getter();
2375
2557
  }
@@ -2378,7 +2560,7 @@ class je extends S {
2378
2560
  return this._def.getter()._parse({ data: r.data, path: r.path, parent: r });
2379
2561
  }
2380
2562
  }
2381
- je.create = (t, e) => new je({
2563
+ De.create = (t, e) => new De({
2382
2564
  getter: t,
2383
2565
  typeName: k.ZodLazy,
2384
2566
  ...w(e)
@@ -2404,7 +2586,7 @@ Re.create = (t, e) => new Re({
2404
2586
  typeName: k.ZodLiteral,
2405
2587
  ...w(e)
2406
2588
  });
2407
- function $t(t, e) {
2589
+ function Pt(t, e) {
2408
2590
  return new re({
2409
2591
  values: t,
2410
2592
  typeName: k.ZodEnum,
@@ -2465,8 +2647,8 @@ class re extends S {
2465
2647
  });
2466
2648
  }
2467
2649
  }
2468
- re.create = $t;
2469
- class rt extends S {
2650
+ re.create = Pt;
2651
+ class nt extends S {
2470
2652
  _parse(e) {
2471
2653
  const r = I.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
2472
2654
  if (n.parsedType !== g.string && n.parsedType !== g.number) {
@@ -2491,12 +2673,12 @@ class rt extends S {
2491
2673
  return this._def.values;
2492
2674
  }
2493
2675
  }
2494
- rt.create = (t, e) => new rt({
2676
+ nt.create = (t, e) => new nt({
2495
2677
  values: t,
2496
2678
  typeName: k.ZodNativeEnum,
2497
2679
  ...w(e)
2498
2680
  });
2499
- class ge extends S {
2681
+ class ye extends S {
2500
2682
  unwrap() {
2501
2683
  return this._def.type;
2502
2684
  }
@@ -2515,7 +2697,7 @@ class ge extends S {
2515
2697
  })));
2516
2698
  }
2517
2699
  }
2518
- ge.create = (t, e) => new ge({
2700
+ ye.create = (t, e) => new ye({
2519
2701
  type: t,
2520
2702
  typeName: k.ZodPromise,
2521
2703
  ...w(e)
@@ -2586,14 +2768,14 @@ class J extends S {
2586
2768
  path: n.path,
2587
2769
  parent: n
2588
2770
  });
2589
- if (!pe(o))
2771
+ if (!me(o))
2590
2772
  return v;
2591
2773
  const a = s.transform(o.value, i);
2592
2774
  if (a instanceof Promise)
2593
2775
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2594
2776
  return { status: r.value, value: a };
2595
2777
  } else
2596
- return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => pe(o) ? Promise.resolve(s.transform(o.value, i)).then((a) => ({
2778
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => me(o) ? Promise.resolve(s.transform(o.value, i)).then((a) => ({
2597
2779
  status: r.value,
2598
2780
  value: a
2599
2781
  })) : v);
@@ -2673,7 +2855,7 @@ class Ce extends S {
2673
2855
  ...n
2674
2856
  }
2675
2857
  });
2676
- return $e(s) ? s.then((i) => ({
2858
+ return Pe(s) ? s.then((i) => ({
2677
2859
  status: "valid",
2678
2860
  value: i.status === "valid" ? i.value : this._def.catchValue({
2679
2861
  get error() {
@@ -2701,7 +2883,7 @@ Ce.create = (t, e) => new Ce({
2701
2883
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2702
2884
  ...w(e)
2703
2885
  });
2704
- class nt extends S {
2886
+ class st extends S {
2705
2887
  _parse(e) {
2706
2888
  if (this._getType(e) !== g.nan) {
2707
2889
  const n = this._getOrReturnCtx(e);
@@ -2714,11 +2896,11 @@ class nt extends S {
2714
2896
  return { status: "valid", value: e.data };
2715
2897
  }
2716
2898
  }
2717
- nt.create = (t) => new nt({
2899
+ st.create = (t) => new st({
2718
2900
  typeName: k.ZodNaN,
2719
2901
  ...w(t)
2720
2902
  });
2721
- class dt extends S {
2903
+ class ut extends S {
2722
2904
  _parse(e) {
2723
2905
  const { ctx: r } = this._processInputParams(e), n = r.data;
2724
2906
  return this._def.type._parse({
@@ -2773,8 +2955,8 @@ class ze extends S {
2773
2955
  }
2774
2956
  class Oe extends S {
2775
2957
  _parse(e) {
2776
- const r = this._def.innerType._parse(e), n = (s) => (pe(s) && (s.value = Object.freeze(s.value)), s);
2777
- return $e(r) ? r.then((s) => n(s)) : n(r);
2958
+ const r = this._def.innerType._parse(e), n = (s) => (me(s) && (s.value = Object.freeze(s.value)), s);
2959
+ return Pe(r) ? r.then((s) => n(s)) : n(r);
2778
2960
  }
2779
2961
  unwrap() {
2780
2962
  return this._def.innerType;
@@ -2789,15 +2971,95 @@ var k;
2789
2971
  (function(t) {
2790
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";
2791
2973
  })(k || (k = {}));
2792
- const c = U.create, f = ae.create, q = oe.create, T = Pe.create, Pt = xe.create, _ = ie.create;
2974
+ const c = U.create, f = ae.create, q = oe.create, T = Le.create, Lt = xe.create, _ = ie.create;
2793
2975
  te.create;
2794
- const E = W.create, l = A.create, x = Se.create, Er = Be.create;
2976
+ const E = W.create, l = A.create, x = Se.create, Pr = Be.create;
2795
2977
  Ie.create;
2796
- const Rr = z.create, b = Ee.create, st = Re.create, De = re.create;
2797
- ge.create;
2978
+ const Lr = z.create, b = Ee.create, it = Re.create, Ze = re.create;
2979
+ ye.create;
2798
2980
  V.create;
2799
2981
  ne.create;
2800
- const Y = J.createWithPreprocess, D = () => x([q(), f().finite()]).transform((t) => BigInt(t));
2982
+ const Y = J.createWithPreprocess;
2983
+ function N(t, e = 0, r = 2) {
2984
+ if (e > r) return "...";
2985
+ if (t instanceof A) {
2986
+ const n = t.shape, s = Object.keys(n).filter((o) => !o.startsWith("__"));
2987
+ return s.length === 0 ? "{ }" : e >= r - 1 ? "{ ... }" : `{ ${s.map((o) => {
2988
+ const a = n[o], h = a instanceof V, d = N(h ? a.unwrap() : a, e + 1, r);
2989
+ return `${o}${h ? "?" : ""}: ${d}`;
2990
+ }).join(", ")} }`;
2991
+ }
2992
+ if (t instanceof Se)
2993
+ return t.options.map((n) => N(n, e, r)).join(" or ");
2994
+ if (t instanceof U) return "string";
2995
+ if (t instanceof ae) return "number";
2996
+ if (t instanceof Le) return "boolean";
2997
+ if (t instanceof oe) return "bigint";
2998
+ if (t instanceof xe) return "null";
2999
+ if (t instanceof W) {
3000
+ const n = N(t.element, e + 1, r);
3001
+ return n === "unknown" || n === "any" ? "array" : `${n}[]`;
3002
+ }
3003
+ if (t instanceof z)
3004
+ return `[${t.items.map((n) => N(n, e + 1, r)).join(", ")}]`;
3005
+ if (t instanceof Ee) {
3006
+ const n = N(
3007
+ t._def.valueType,
3008
+ e + 1,
3009
+ r
3010
+ );
3011
+ return n === "unknown" || n === "any" ? "{ [key: string]: unknown }" : `{ [key: string]: ${n} }`;
3012
+ }
3013
+ return t instanceof V ? `${N(t.unwrap(), e, r)}?` : t instanceof Re ? JSON.stringify(t.value) : t instanceof re ? t.options.map((n) => `"${n}"`).join(" | ") : t instanceof Xe ? "any" : t instanceof ie ? "unknown" : t instanceof et ? "void" : t instanceof je ? "undefined" : t instanceof J ? N(t.innerType(), e, r) : t instanceof Ae ? N(t.removeDefault(), e, r) : t instanceof ne ? `${N(t.unwrap(), e, r)} | null` : t instanceof De ? "lazy" : t instanceof ye ? `Promise<${N(t.unwrap(), e + 1, r)}>` : t instanceof ke ? "function" : t instanceof Te ? "Date" : t instanceof rt ? "Map" : t instanceof ge ? "Set" : t instanceof Ie ? `${N(t._def.left, e, r)} & ${N(t._def.right, e, r)}` : t instanceof Be ? t.options.map((n) => N(n, e, r)).join(" or ") : t instanceof ut ? N(t.unwrap(), e, r) : t instanceof st ? "NaN" : t instanceof Ce ? N(t.removeCatch(), e, r) : t instanceof ze ? N(t._def.in, e, r) : t instanceof Oe ? `readonly ${N(t.unwrap(), e, r)}` : "unknown";
3014
+ }
3015
+ function jr(t) {
3016
+ return t === null ? "null" : t === void 0 ? "undefined" : Array.isArray(t) ? "array" : typeof t;
3017
+ }
3018
+ function Dr(t, e, r, n) {
3019
+ const s = r.filter((a) => a.path.length === 0), i = r.filter((a) => a.path.length > 0);
3020
+ if (s.length > 0 && i.length === 0) {
3021
+ const a = s.some((d) => d.code === "custom"), h = s.some(
3022
+ (d) => d.code !== "invalid_type" && d.code !== "invalid_literal" && d.code !== "invalid_union"
3023
+ );
3024
+ if (!a && !h) {
3025
+ const d = N(e), m = jr(n);
3026
+ return `Invalid parameters for ${t}: expected ${d}${d === "{ }" ? " or no args" : ""}, received ${m}`;
3027
+ }
3028
+ }
3029
+ const o = r.map((a) => `at '${a.path.length > 0 ? a.path.join(".") : "root"}': ${a.message}`);
3030
+ return `Invalid parameters for ${t}: ${o.join("; ")}`;
3031
+ }
3032
+ const Zr = /* @__PURE__ */ new Set();
3033
+ function Wr(t) {
3034
+ return Zr.has(t);
3035
+ }
3036
+ const jt = /* @__PURE__ */ new Map();
3037
+ function Vr(t, e) {
3038
+ jt.set(t, e);
3039
+ }
3040
+ function Fr(t) {
3041
+ return jt.get(t);
3042
+ }
3043
+ function Ur(t) {
3044
+ return t.startsWith("tab_") ? "required" : "active";
3045
+ }
3046
+ function Br(t) {
3047
+ return t === "content-script" ? "content-script" : t === "main-thread" ? "main-thread" : t === "worker" ? "worker:default" : t.startsWith("worker:") ? t : "main-thread";
3048
+ }
3049
+ function zr(t, e) {
3050
+ return e !== "main-thread" ? e : Wr(t) ? "content-script" : e;
3051
+ }
3052
+ function qr(t, e) {
3053
+ return {
3054
+ endpoint: Br(zr(t, e)),
3055
+ tabPolicy: Ur(t)
3056
+ };
3057
+ }
3058
+ function Hr(t) {
3059
+ for (const e of t)
3060
+ Vr(e.action, qr(e.action, e.owner));
3061
+ }
3062
+ const D = () => x([q(), f().finite()]).transform((t) => BigInt(t));
2801
3063
  l({
2802
3064
  key: c().describe("Storage key to retrieve")
2803
3065
  });
@@ -2809,30 +3071,30 @@ l({
2809
3071
  key: c().describe("Storage key to delete")
2810
3072
  });
2811
3073
  l({});
2812
- const Ar = l({
3074
+ const Gr = l({
2813
3075
  items: b(c()).describe("Record of key-value string pairs to store")
2814
3076
  });
2815
- Y((t) => t !== null && typeof t == "object" && !Array.isArray(t) && !("items" in t) ? { items: t } : t, Ar);
2816
- const Cr = l({
3077
+ Y((t) => t !== null && typeof t == "object" && !Array.isArray(t) && !("items" in t) ? { items: t } : t, Gr);
3078
+ const Jr = l({
2817
3079
  keys: E(c()).describe("Array of storage keys to retrieve"),
2818
3080
  defaults: b(c()).optional().describe("Default string values for missing keys")
2819
3081
  });
2820
3082
  Y(
2821
3083
  (t) => Array.isArray(t) ? { keys: t } : t,
2822
- Cr
3084
+ Jr
2823
3085
  );
2824
3086
  l({});
2825
- const Or = l({
3087
+ const Yr = l({
2826
3088
  keys: E(c()).describe("Array of storage keys to delete")
2827
3089
  });
2828
3090
  Y(
2829
3091
  (t) => Array.isArray(t) ? { keys: t } : t,
2830
- Or
3092
+ Yr
2831
3093
  );
2832
3094
  l({});
2833
3095
  l({});
2834
3096
  x([
2835
- Rr([x([l({ text: c() }), c()])]),
3097
+ Lr([x([l({ text: c() }), c()])]),
2836
3098
  l({ text: c().optional(), value: c().optional() })
2837
3099
  ]);
2838
3100
  l({
@@ -2841,17 +3103,19 @@ l({
2841
3103
  headers: b(c()).default({}).describe("Request headers as key-value pairs"),
2842
3104
  body: c().nullable().default(null).describe("Request body string"),
2843
3105
  timeout: D().default(30000n).describe("Timeout in milliseconds"),
2844
- store: T().optional().describe("When true, store binary responses as a handle instead of returning body bytes"),
3106
+ store: T().optional().describe(
3107
+ "When true, store binary responses as a handle instead of returning body bytes"
3108
+ ),
2845
3109
  options: l({}).passthrough().optional().describe("Fetch options")
2846
3110
  }).passthrough();
2847
3111
  l({
2848
3112
  duration: D().describe("Duration to sleep in milliseconds")
2849
3113
  });
2850
- const ce = () => c().regex(/^e\d+$/), Nr = 'use { refId: "e2" } or { label: "..." } object form, not positional arguments', lt = (t, e) => {
3114
+ const ce = () => c().regex(/^e\d+$/), Kr = 'use { refId: "e2" } or { label: "..." } object form, not positional arguments', ft = (t, e) => {
2851
3115
  if (t.__invalidPositional !== void 0) {
2852
3116
  e.addIssue({
2853
3117
  code: u.custom,
2854
- message: Nr
3118
+ message: Kr
2855
3119
  });
2856
3120
  return;
2857
3121
  }
@@ -2859,8 +3123,8 @@ const ce = () => c().regex(/^e\d+$/), Nr = 'use { refId: "e2" } or { label: "...
2859
3123
  code: u.custom,
2860
3124
  message: "Either refId or label is required"
2861
3125
  });
2862
- }, Lt = (t, e) => {
2863
- t.x !== void 0 || t.y !== void 0 || lt(t, e);
3126
+ }, Dt = (t, e) => {
3127
+ t.x !== void 0 || t.y !== void 0 || ft(t, e);
2864
3128
  }, M = (t) => Y(
2865
3129
  (e) => typeof e == "string" || typeof e == "number" ? { __invalidPositional: e } : e,
2866
3130
  l({
@@ -2868,8 +3132,10 @@ const ce = () => c().regex(/^e\d+$/), Nr = 'use { refId: "e2" } or { label: "...
2868
3132
  refId: ce().optional().describe("Element reference ID (e.g. e2)"),
2869
3133
  label: c().optional().describe("Human-readable element label"),
2870
3134
  ...t
2871
- }).superRefine(lt)
2872
- ), Ne = { tabId: x([f(), q()]).optional().describe("Target tab ID") }, K = (t) => Y(
3135
+ }).superRefine(ft)
3136
+ ), Ne = {
3137
+ tabId: x([f(), q()]).optional().describe("Target tab ID")
3138
+ }, K = (t) => Y(
2873
3139
  (e) => typeof e == "string" || typeof e == "number" ? { __invalidPositional: e } : e,
2874
3140
  l({
2875
3141
  __invalidPositional: x([c(), f()]).optional().describe("Internal flag for positional argument rejection"),
@@ -2877,14 +3143,16 @@ const ce = () => c().regex(/^e\d+$/), Nr = 'use { refId: "e2" } or { label: "...
2877
3143
  refId: ce().optional().describe("Element reference ID (e.g. e2)"),
2878
3144
  label: c().optional().describe("Human-readable element label"),
2879
3145
  ...t
2880
- }).superRefine(lt)
3146
+ }).superRefine(ft)
2881
3147
  );
2882
3148
  l({});
2883
3149
  l({});
2884
3150
  l({
2885
3151
  url: c().describe("URL to navigate to"),
2886
3152
  timeout: D().optional().describe("Navigation timeout in milliseconds"),
2887
- waitUntil: De(["load", "networkidle"]).optional().describe("When to consider navigation complete: 'load' (tab status complete) or 'networkidle' (no in-flight requests for 500ms)")
3153
+ waitUntil: Ze(["load", "networkidle"]).optional().describe(
3154
+ "When to consider navigation complete: 'load' (tab status complete) or 'networkidle' (no in-flight requests for 500ms)"
3155
+ )
2888
3156
  });
2889
3157
  l({});
2890
3158
  l({});
@@ -2893,46 +3161,54 @@ l({
2893
3161
  duration: D().default(1000n).describe("Duration to wait in milliseconds")
2894
3162
  });
2895
3163
  M();
2896
- const Mr = (t, e) => {
3164
+ const Qr = (t, e) => {
2897
3165
  [t.url, t.path, t.handle].filter(
2898
3166
  (n) => typeof n == "string" && n.length > 0
2899
3167
  ).length !== 1 && e.addIssue({
2900
3168
  code: u.custom,
2901
3169
  message: "Each file entry requires exactly one of url, path, or handle"
2902
3170
  });
2903
- }, jt = l({
3171
+ }, Zt = l({
2904
3172
  name: c().optional().describe("File name including extension"),
2905
3173
  mimeType: c().optional().describe("MIME type (defaults to application/octet-stream)"),
2906
3174
  url: c().url().optional().describe("HTTP(S) URL to fetch in the target tab"),
2907
3175
  path: c().min(1).optional().describe("Virtual filesystem path (resolved in worker)"),
2908
3176
  handle: c().min(1).optional().describe("Binary handle from page.fetch({ store: true })")
2909
- }).superRefine(Mr), Dt = Er("kind", [
3177
+ }).superRefine(Qr), Wt = Pr("kind", [
2910
3178
  l({
2911
- kind: st("bytes"),
3179
+ kind: it("bytes"),
2912
3180
  name: c().min(1),
2913
3181
  data: c().min(1),
2914
3182
  mimeType: c().optional()
2915
3183
  }),
2916
3184
  l({
2917
- kind: st("url"),
3185
+ kind: it("url"),
2918
3186
  url: c().url(),
2919
3187
  name: c().min(1),
2920
3188
  mimeType: c().optional()
2921
3189
  })
2922
3190
  ]);
2923
- M({ value: c().describe("Value to fill into the element") });
2924
- const $r = M({
2925
- files: E(jt).min(1).describe("Files to attach to the input")
3191
+ M({
3192
+ value: c().describe("Value to fill into the element")
3193
+ });
3194
+ const Xr = M({
3195
+ files: E(Zt).min(1).describe("Files to attach to the input")
3196
+ });
3197
+ M({
3198
+ files: E(Wt).min(1).describe("Resolved files for content-script application")
2926
3199
  });
2927
3200
  M({
2928
- files: E(Dt).min(1).describe("Resolved files for content-script application")
3201
+ text: c().describe("Text to type into the element")
3202
+ });
3203
+ M({
3204
+ text: c().describe("Text to append into the element")
2929
3205
  });
2930
- M({ text: c().describe("Text to type into the element") });
2931
- M({ text: c().describe("Text to append into the element") });
2932
3206
  l({
2933
3207
  key: c().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
2934
3208
  });
2935
- M({ value: c().describe("Value to select in the dropdown") });
3209
+ M({
3210
+ value: c().describe("Value to select in the dropdown")
3211
+ });
2936
3212
  M({
2937
3213
  checked: T().optional().describe("Desired checked state (true to check, false to uncheck)")
2938
3214
  });
@@ -2950,7 +3226,7 @@ Y(
2950
3226
  label: c().optional().describe("Human-readable element label"),
2951
3227
  x: f().optional().describe("X coordinate to scroll to"),
2952
3228
  y: f().optional().describe("Y coordinate to scroll to")
2953
- }).superRefine(Lt)
3229
+ }).superRefine(Dt)
2954
3230
  );
2955
3231
  M();
2956
3232
  l({
@@ -2960,12 +3236,12 @@ l({
2960
3236
  selector: c().describe("CSS selector to wait for"),
2961
3237
  timeout: D().default(30000n).describe("Timeout in milliseconds")
2962
3238
  });
2963
- const Pr = l({
3239
+ const en = l({
2964
3240
  fields: E(c()).describe("Array of field names to extract")
2965
3241
  });
2966
3242
  Y(
2967
3243
  (t) => Array.isArray(t) ? { fields: t } : t,
2968
- Pr
3244
+ en
2969
3245
  );
2970
3246
  x([
2971
3247
  f(),
@@ -2987,16 +3263,28 @@ Y(
2987
3263
  );
2988
3264
  x([
2989
3265
  f(),
2990
- E(l({ id: f().optional(), tabId: f().optional(), tab_id: f().optional() }).passthrough()),
2991
- l({ id: f().optional(), tabId: f().optional(), tab_id: f().optional() }).passthrough()
3266
+ E(
3267
+ l({
3268
+ id: f().optional(),
3269
+ tabId: f().optional(),
3270
+ tab_id: f().optional()
3271
+ }).passthrough()
3272
+ ),
3273
+ l({
3274
+ id: f().optional(),
3275
+ tabId: f().optional(),
3276
+ tab_id: f().optional()
3277
+ }).passthrough()
2992
3278
  ]);
2993
3279
  K();
2994
- K({ value: c().describe("Value to fill into the element") });
2995
- const Lr = K({
2996
- files: E(jt).min(1).describe("Files to attach to the input")
3280
+ K({
3281
+ value: c().describe("Value to fill into the element")
3282
+ });
3283
+ const tn = K({
3284
+ files: E(Zt).min(1).describe("Files to attach to the input")
2997
3285
  });
2998
3286
  K({
2999
- files: E(Dt).min(1).describe("Resolved files for content-script application")
3287
+ files: E(Wt).min(1).describe("Resolved files for content-script application")
3000
3288
  });
3001
3289
  Y(
3002
3290
  (t) => typeof t == "string" || typeof t == "number" ? { __invalidPositional: t } : t,
@@ -3007,14 +3295,18 @@ Y(
3007
3295
  label: c().optional().describe("Human-readable element label"),
3008
3296
  x: f().optional().describe("X coordinate to scroll to"),
3009
3297
  y: f().optional().describe("Y coordinate to scroll to")
3010
- }).superRefine(Lt)
3298
+ }).superRefine(Dt)
3011
3299
  );
3012
- K({ text: c().describe("Text to type into the element") });
3300
+ K({
3301
+ text: c().describe("Text to type into the element")
3302
+ });
3013
3303
  l({
3014
3304
  ...Ne,
3015
3305
  key: c().describe("Key to press (e.g. Enter, Escape, ArrowDown)")
3016
3306
  });
3017
- K({ value: c().describe("Value to select in the dropdown") });
3307
+ K({
3308
+ value: c().describe("Value to select in the dropdown")
3309
+ });
3018
3310
  K({
3019
3311
  checked: T().optional().describe("Desired checked state (true to check, false to uncheck)")
3020
3312
  });
@@ -3128,7 +3420,7 @@ l({
3128
3420
  max_nodes: f().optional().describe("Maximum nodes to include"),
3129
3421
  options: l({}).passthrough().optional().describe("Snapshot options")
3130
3422
  }).passthrough();
3131
- const jr = l({
3423
+ const rn = l({
3132
3424
  role: x([c(), E(c())]).optional().describe("Filter by ARIA role"),
3133
3425
  tag: x([c(), E(c())]).optional().describe("Filter by HTML tag"),
3134
3426
  text: c().optional().describe("Filter by text content (case-insensitive substring)"),
@@ -3137,11 +3429,13 @@ const jr = l({
3137
3429
  href: c().optional().describe("Filter by href pattern (case-insensitive substring)"),
3138
3430
  src: c().optional().describe("Filter by src pattern (case-insensitive substring)"),
3139
3431
  limit: f().positive().optional().describe("Maximum filtered nodes to return")
3140
- }).passthrough(), Dr = l({
3141
- filter: jr.optional().describe("Semantic filter criteria"),
3432
+ }).passthrough(), nn = l({
3433
+ filter: rn.optional().describe(
3434
+ "Semantic filter criteria"
3435
+ ),
3142
3436
  max_nodes: f().optional().describe("Maximum nodes to collect before filtering")
3143
3437
  }).passthrough();
3144
- Dr.extend({
3438
+ nn.extend({
3145
3439
  tabId: f().describe("Tab ID")
3146
3440
  });
3147
3441
  const X = l({
@@ -3152,15 +3446,15 @@ const X = l({
3152
3446
  }), ue = l({
3153
3447
  path: c().describe("File path to write to"),
3154
3448
  data: c().describe("Data to write")
3155
- }), Zr = l({
3449
+ }), sn = l({
3156
3450
  path: c().describe("File path to read from"),
3157
3451
  offset: D().describe("Byte offset to start reading"),
3158
3452
  len: f().describe("Number of bytes to read")
3159
- }), Wr = l({
3453
+ }), an = l({
3160
3454
  path: c().describe("File path to update"),
3161
3455
  offset: D().describe("Byte offset to start writing"),
3162
3456
  data: c().describe("Data to write")
3163
- }), Vr = l({
3457
+ }), on = l({
3164
3458
  path: c().describe("File path to hash"),
3165
3459
  algo: c().default("sha256").describe("Hash algorithm (e.g. sha256, md5)")
3166
3460
  });
@@ -3282,12 +3576,12 @@ x([
3282
3576
  c(),
3283
3577
  f(),
3284
3578
  T(),
3285
- Pt(),
3579
+ Lt(),
3286
3580
  E(_()),
3287
3581
  b(_())
3288
3582
  ]);
3289
- const Fr = l({
3290
- ok: st(!0).describe("Whether the action succeeded"),
3583
+ const cn = l({
3584
+ ok: it(!0).describe("Whether the action succeeded"),
3291
3585
  action: c().describe("Action identifier (e.g. 'page_fill')"),
3292
3586
  refId: ce().optional().describe("Element reference ID that was acted upon (e.g. e2)"),
3293
3587
  tag: c().optional().describe("HTML tag name of the element"),
@@ -3304,16 +3598,13 @@ const Fr = l({
3304
3598
  fileCount: f().optional().describe("Number of files attached (for setFiles actions)"),
3305
3599
  fileNames: E(c()).optional().describe("Names of attached files (for setFiles actions)")
3306
3600
  });
3307
- x([
3308
- Fr,
3309
- Pt()
3310
- ]);
3601
+ x([cn, Lt()]);
3311
3602
  l({
3312
3603
  status: f().describe("HTTP response status code"),
3313
3604
  ok: T().describe("Whether the response status is 2xx"),
3314
3605
  headers: b(c()).describe("Response headers as key-value pairs"),
3315
3606
  body: c().optional().describe("Response body (omitted when bodyEncoding is handle)"),
3316
- bodyEncoding: De(["text", "base64", "handle"]).describe("Encoding of the body field"),
3607
+ bodyEncoding: Ze(["text", "base64", "handle"]).describe("Encoding of the body field"),
3317
3608
  handle: c().optional().describe("Binary handle when bodyEncoding is handle"),
3318
3609
  byteLength: f().describe("Length of the body in bytes"),
3319
3610
  contentType: c().describe("Response Content-Type header"),
@@ -3328,13 +3619,13 @@ l({
3328
3619
  tabId: f(),
3329
3620
  url: c(),
3330
3621
  title: c(),
3331
- contentScript: De(["connected", "missing"]),
3332
- domApis: De(["ok", "blocked"]),
3622
+ contentScript: Ze(["connected", "missing"]),
3623
+ domApis: Ze(["ok", "blocked"]),
3333
3624
  mutationsReady: T(),
3334
3625
  hint: c().optional(),
3335
3626
  recovery: E(c()).optional()
3336
3627
  });
3337
- const Ur = l({
3628
+ const dn = l({
3338
3629
  refId: ce().describe("Element reference ID (e.g. e2)"),
3339
3630
  role: c().describe("ARIA role of the element"),
3340
3631
  tag: c().describe("HTML tag name"),
@@ -3355,7 +3646,7 @@ const Ur = l({
3355
3646
  });
3356
3647
  l({
3357
3648
  text: c().describe("Plain text representation of the page"),
3358
- nodes: E(Ur).describe("Array of interactive nodes"),
3649
+ nodes: E(dn).describe("Array of interactive nodes"),
3359
3650
  url: c().describe("Current page URL"),
3360
3651
  title: c().describe("Current page title"),
3361
3652
  viewport: l({
@@ -3363,7 +3654,7 @@ l({
3363
3654
  height: f().describe("Viewport height in pixels")
3364
3655
  }).describe("Viewport dimensions")
3365
3656
  });
3366
- const Zt = l({
3657
+ const Vt = l({
3367
3658
  id: f().optional().describe("Tab ID"),
3368
3659
  tabId: f().optional().describe("Tab ID (added by runner)"),
3369
3660
  index: f().optional().describe("Tab index in the window"),
@@ -3384,22 +3675,24 @@ const Zt = l({
3384
3675
  width: f().optional().describe("Tab width"),
3385
3676
  height: f().optional().describe("Tab height"),
3386
3677
  sessionId: c().optional().describe("Session ID")
3387
- }).passthrough(), Br = E(Zt), Wt = l({
3678
+ }).passthrough(), ln = E(Vt), Ft = l({
3388
3679
  id: f().optional().describe("Window ID"),
3389
3680
  focused: T().optional().describe("Whether the window is focused"),
3390
3681
  top: f().optional().describe("Window top position"),
3391
3682
  left: f().optional().describe("Window left position"),
3392
3683
  width: f().optional().describe("Window width"),
3393
3684
  height: f().optional().describe("Window height"),
3394
- tabs: Br.optional().describe("Array of tabs in the window"),
3685
+ tabs: ln.optional().describe(
3686
+ "Array of tabs in the window"
3687
+ ),
3395
3688
  incognito: T().optional().describe("Whether the window is incognito"),
3396
3689
  type: c().optional().describe("Window type"),
3397
3690
  state: c().optional().describe("Window state"),
3398
3691
  alwaysOnTop: T().optional().describe("Whether the window is always on top"),
3399
3692
  sessionId: c().optional().describe("Session ID")
3400
3693
  }).passthrough();
3401
- E(Wt);
3402
- const zr = l({
3694
+ E(Ft);
3695
+ const un = l({
3403
3696
  name: c().describe("Cookie name"),
3404
3697
  value: c().describe("Cookie value"),
3405
3698
  domain: c().optional().describe("Cookie domain"),
@@ -3412,8 +3705,10 @@ const zr = l({
3412
3705
  expirationDate: f().optional().describe("Expiration date as Unix timestamp"),
3413
3706
  storeId: c().optional().describe("Store ID")
3414
3707
  }).nullable();
3415
- E(zr.nullable().unwrap());
3416
- const qr = l({
3708
+ E(
3709
+ un.nullable().unwrap()
3710
+ );
3711
+ const fn = l({
3417
3712
  id: c().describe("Bookmark ID"),
3418
3713
  parentId: c().optional().describe("Parent folder ID"),
3419
3714
  index: f().optional().describe("Bookmark index"),
@@ -3423,8 +3718,8 @@ const qr = l({
3423
3718
  dateGroupModified: f().optional().describe("Date group modified"),
3424
3719
  children: E(l({ id: c() }).passthrough()).optional().describe("Child bookmarks")
3425
3720
  }).passthrough();
3426
- E(qr);
3427
- const Hr = l({
3721
+ E(fn);
3722
+ const hn = l({
3428
3723
  id: c().describe("History item ID"),
3429
3724
  url: c().optional().describe("URL"),
3430
3725
  title: c().optional().describe("Title"),
@@ -3432,34 +3727,34 @@ const Hr = l({
3432
3727
  visitCount: f().optional().describe("Visit count"),
3433
3728
  typedCount: f().optional().describe("Typed count")
3434
3729
  }).passthrough();
3435
- E(Hr);
3436
- const Gr = l({
3730
+ E(hn);
3731
+ const pn = l({
3437
3732
  frameId: f().describe("Frame ID"),
3438
3733
  result: _().optional().describe("Script result")
3439
3734
  });
3440
- E(Gr);
3735
+ E(pn);
3441
3736
  c();
3442
3737
  T();
3443
3738
  x([c(), f()]);
3444
3739
  T();
3445
- const Jr = l({
3740
+ const mn = l({
3446
3741
  id: f().optional().describe("Group ID"),
3447
3742
  collapsed: T().optional().describe("Whether the group is collapsed"),
3448
3743
  color: c().optional().describe("Group color"),
3449
3744
  title: c().optional().describe("Group title"),
3450
3745
  windowId: f().optional().describe("Window ID")
3451
3746
  }).passthrough();
3452
- E(Jr);
3453
- const Yr = l({
3747
+ E(mn);
3748
+ const gn = l({
3454
3749
  lastModified: f().optional().describe("Last modified time"),
3455
- tab: Zt.optional().describe("Tab info"),
3456
- window: Wt.optional().describe("Window info")
3457
- }).passthrough(), Kr = E(Yr), Qr = l({
3750
+ tab: Vt.optional().describe("Tab info"),
3751
+ window: Ft.optional().describe("Window info")
3752
+ }).passthrough(), yn = E(gn), bn = l({
3458
3753
  deviceName: c().optional().describe("Device name"),
3459
- sessions: Kr.optional().describe("Sessions")
3754
+ sessions: yn.optional().describe("Sessions")
3460
3755
  }).passthrough();
3461
- E(Qr);
3462
- const Xr = l({
3756
+ E(bn);
3757
+ const _n = l({
3463
3758
  id: f().optional().describe("Download ID"),
3464
3759
  url: c().optional().describe("Download URL"),
3465
3760
  filename: c().optional().describe("Filename"),
@@ -3478,7 +3773,7 @@ const Xr = l({
3478
3773
  byExtensionId: c().optional().describe("Extension ID"),
3479
3774
  byExtensionName: c().optional().describe("Extension name")
3480
3775
  }).passthrough();
3481
- E(Xr);
3776
+ E(_n);
3482
3777
  f();
3483
3778
  l({
3484
3779
  archName: c().describe("CPU architecture"),
@@ -3490,265 +3785,14 @@ l({
3490
3785
  capacity: f().describe("Total memory capacity"),
3491
3786
  availableCapacity: f().describe("Available memory capacity")
3492
3787
  });
3493
- E(l({
3494
- id: c().describe("Storage ID"),
3495
- name: c().describe("Storage name"),
3496
- type: c().describe("Storage type"),
3497
- capacity: f().describe("Storage capacity")
3498
- }));
3499
- const Ze = {
3500
- trace: 0,
3501
- debug: 1,
3502
- info: 2,
3503
- warn: 3,
3504
- error: 4,
3505
- none: 5
3506
- }, en = [
3507
- "trace",
3508
- "debug",
3509
- "info",
3510
- "warn",
3511
- "error",
3512
- "none"
3513
- ];
3514
- function tn(t) {
3515
- const e = Math.max(0, Math.min(5, Math.round(t)));
3516
- return en[e] ?? "error";
3517
- }
3518
- let ut = "trace", it = null;
3519
- function rn(t) {
3520
- ut = t, it && it(Ze[t]);
3521
- }
3522
- function nn(t) {
3523
- it = t, t(Ze[ut]);
3524
- }
3525
- function sn(t) {
3526
- return Ze[t] >= Ze[ut];
3527
- }
3528
- function Vt(t, e = "info") {
3529
- var r;
3530
- if (t === null) return "null";
3531
- if (t === void 0) return "undefined";
3532
- if (typeof t == "string") return t;
3533
- if (typeof t == "number" || typeof t == "boolean")
3534
- return String(t);
3535
- if (typeof t == "bigint") return `${t}n`;
3536
- if (t instanceof Error) {
3537
- const n = e === "debug" || e === "trace" ? t.stack : (r = t.stack) == null ? void 0 : r.split(`
3538
- `)[0];
3539
- return JSON.stringify({ message: t.message, name: t.name, stack: n });
3540
- }
3541
- if (typeof t == "function") return "[Function]";
3542
- if (typeof t == "symbol") return String(t);
3543
- if (typeof t == "object")
3544
- try {
3545
- return JSON.stringify(t);
3546
- } catch (n) {
3547
- return n instanceof TypeError && n.message.includes("circular") ? "[Circular]" : `[Unserializable: ${n instanceof Error ? n.message : String(n)}]`;
3548
- }
3549
- return String(t);
3550
- }
3551
- function an(t) {
3552
- return `[extension-js][${t}]`;
3553
- }
3554
- function on(t, e) {
3555
- if (!t) return "";
3556
- const r = [];
3557
- try {
3558
- for (const [n, s] of Object.entries(t))
3559
- r.push(`${n}=${Vt(s, e)}`);
3560
- } catch {
3561
- return " metadata=[unreadable]";
3562
- }
3563
- return r.length > 0 ? ` ${r.join(" ")}` : "";
3564
- }
3565
- function be(t, e) {
3566
- 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] } : {
3567
- event: t,
3568
- metadata: { _args: e.map((r) => Vt(r)).join(" ") }
3569
- };
3570
- }
3571
- class ft {
3572
- constructor(e = "root") {
3573
- this.namespace = e;
3574
- }
3575
- log(e, r, n) {
3576
- try {
3577
- if (!sn(e)) return;
3578
- const s = an(this.namespace), i = on(n, e), o = `${s} ${r}${i}`;
3579
- switch (e) {
3580
- case "trace":
3581
- case "debug":
3582
- case "info":
3583
- console.log(o);
3584
- break;
3585
- case "warn":
3586
- console.warn(o);
3587
- break;
3588
- case "error":
3589
- console.error(o);
3590
- break;
3591
- case "none":
3592
- break;
3593
- default: {
3594
- const a = e;
3595
- break;
3596
- }
3597
- }
3598
- } catch {
3599
- }
3600
- }
3601
- trace(e, ...r) {
3602
- const { event: n, metadata: s } = be(e, r);
3603
- this.log("trace", n, s);
3604
- }
3605
- debug(e, ...r) {
3606
- const { event: n, metadata: s } = be(e, r);
3607
- this.log("debug", n, s);
3608
- }
3609
- info(e, ...r) {
3610
- const { event: n, metadata: s } = be(e, r);
3611
- this.log("info", n, s);
3612
- }
3613
- warn(e, ...r) {
3614
- const { event: n, metadata: s } = be(e, r);
3615
- this.log("warn", n, s);
3616
- }
3617
- error(e, ...r) {
3618
- const { event: n, metadata: s } = be(e, r);
3619
- this.log("error", n, s);
3620
- }
3621
- child(e) {
3622
- return new ft(`${this.namespace}.${e}`);
3623
- }
3624
- timer(e, r, n = "info") {
3625
- const s = typeof performance < "u" && performance.now, i = s ? performance.now() : Date.now();
3626
- return (o) => {
3627
- try {
3628
- const a = s ? performance.now() : Date.now(), h = Math.round(a - i), d = {
3629
- ...r,
3630
- ...o,
3631
- duration_ms: h
3632
- };
3633
- this.log(n, e, d);
3634
- } catch {
3635
- }
3636
- };
3637
- }
3638
- }
3639
- const C = new ft("root"), cn = /* @__PURE__ */ new Set();
3640
- function dn(t) {
3641
- return cn.has(t);
3642
- }
3643
- const Ft = /* @__PURE__ */ new Map();
3644
- function ln(t, e) {
3645
- Ft.set(t, e);
3646
- }
3647
- function un(t) {
3648
- return Ft.get(t);
3649
- }
3650
- function fn(t) {
3651
- return t.startsWith("tab_") ? "required" : "active";
3652
- }
3653
- function hn(t) {
3654
- return t === "content-script" ? "content-script" : t === "main-thread" ? "main-thread" : t === "worker" ? "worker:default" : t.startsWith("worker:") ? t : "main-thread";
3655
- }
3656
- function pn(t, e) {
3657
- return e !== "main-thread" ? e : dn(t) ? "content-script" : e;
3658
- }
3659
- function mn(t, e) {
3660
- return {
3661
- endpoint: hn(pn(t, e)),
3662
- tabPolicy: fn(t)
3663
- };
3664
- }
3665
- function gn(t) {
3666
- for (const e of t)
3667
- ln(e.action, mn(e.action, e.owner));
3668
- }
3669
- function ye(t) {
3670
- return t == null ? {} : t instanceof Map ? Object.fromEntries(
3671
- [...t.entries()].map(([e, r]) => [e, ye(r)])
3672
- ) : Array.isArray(t) ? t.map(ye) : t;
3673
- }
3674
- function yn(t) {
3675
- return {
3676
- action: t.action,
3677
- namespace: t.namespace,
3678
- name: t.name,
3679
- publicName: t.publicName,
3680
- description: t.description,
3681
- fields: t.fields,
3682
- aliases: (t.aliases ?? []).map((e) => ({
3683
- namespace: e.namespace,
3684
- name: e.name,
3685
- fields: e.fields
3686
- })),
3687
- paramsDoc: t.paramsDoc.map((e) => ({
3688
- name: e.name,
3689
- type: e.type,
3690
- required: e.required,
3691
- description: e.description
3692
- })),
3693
- returnsDoc: {
3694
- type: t.returnsDoc.type,
3695
- description: t.returnsDoc.description
3696
- },
3697
- errorCode: t.errorCode,
3698
- errorCategory: t.errorCategory ?? null,
3699
- permission: t.permission ?? null,
3700
- example: t.example ?? null,
3701
- prerequisites: t.prerequisites ?? null,
3702
- notes: t.notes ?? null,
3703
- tags: t.tags ?? null,
3704
- relatedApis: t.relatedApis ?? null
3705
- };
3706
- }
3707
- function N(t, e = 0, r = 2) {
3708
- if (e > r) return "...";
3709
- if (t instanceof A) {
3710
- const n = t.shape, s = Object.keys(n).filter((o) => !o.startsWith("__"));
3711
- return s.length === 0 ? "{ }" : e >= r - 1 ? "{ ... }" : `{ ${s.map((o) => {
3712
- const a = n[o], h = a instanceof V, d = N(h ? a.unwrap() : a, e + 1, r);
3713
- return `${o}${h ? "?" : ""}: ${d}`;
3714
- }).join(", ")} }`;
3715
- }
3716
- if (t instanceof Se)
3717
- return t.options.map((n) => N(n, e, r)).join(" or ");
3718
- if (t instanceof U) return "string";
3719
- if (t instanceof ae) return "number";
3720
- if (t instanceof Pe) return "boolean";
3721
- if (t instanceof oe) return "bigint";
3722
- if (t instanceof xe) return "null";
3723
- if (t instanceof W) {
3724
- const n = N(t.element, e + 1, r);
3725
- return n === "unknown" || n === "any" ? "array" : `${n}[]`;
3726
- }
3727
- if (t instanceof z)
3728
- return `[${t.items.map((n) => N(n, e + 1, r)).join(", ")}]`;
3729
- if (t instanceof Ee) {
3730
- const n = N(t._def.valueType, e + 1, r);
3731
- return n === "unknown" || n === "any" ? "{ [key: string]: unknown }" : `{ [key: string]: ${n} }`;
3732
- }
3733
- return t instanceof V ? `${N(t.unwrap(), e, r)}?` : t instanceof Re ? JSON.stringify(t.value) : t instanceof re ? t.options.map((n) => `"${n}"`).join(" | ") : t instanceof Qe ? "any" : t instanceof ie ? "unknown" : t instanceof Xe ? "void" : t instanceof Le ? "undefined" : t instanceof J ? N(t.innerType(), e, r) : t instanceof Ae ? N(t.removeDefault(), e, r) : t instanceof ne ? `${N(t.unwrap(), e, r)} | null` : t instanceof je ? "lazy" : t instanceof ge ? `Promise<${N(t.unwrap(), e + 1, r)}>` : t instanceof ke ? "function" : t instanceof Te ? "Date" : t instanceof tt ? "Map" : t instanceof me ? "Set" : t instanceof Ie ? `${N(t._def.left, e, r)} & ${N(t._def.right, e, r)}` : t instanceof Be ? t.options.map((n) => N(n, e, r)).join(" or ") : t instanceof dt ? N(t.unwrap(), e, r) : t instanceof nt ? "NaN" : t instanceof Ce ? N(t.removeCatch(), e, r) : t instanceof ze ? N(t._def.in, e, r) : t instanceof Oe ? `readonly ${N(t.unwrap(), e, r)}` : "unknown";
3734
- }
3735
- function bn(t) {
3736
- return t === null ? "null" : t === void 0 ? "undefined" : Array.isArray(t) ? "array" : typeof t;
3737
- }
3738
- function _n(t, e, r, n) {
3739
- const s = r.filter((a) => a.path.length === 0), i = r.filter((a) => a.path.length > 0);
3740
- if (s.length > 0 && i.length === 0) {
3741
- const a = s.some((d) => d.code === "custom"), h = s.some(
3742
- (d) => d.code !== "invalid_type" && d.code !== "invalid_literal" && d.code !== "invalid_union"
3743
- );
3744
- if (!a && !h) {
3745
- const d = N(e), m = bn(n);
3746
- return `Invalid parameters for ${t}: expected ${d}${d === "{ }" ? " or no args" : ""}, received ${m}`;
3747
- }
3748
- }
3749
- const o = r.map((a) => `at '${a.path.length > 0 ? a.path.join(".") : "root"}': ${a.message}`);
3750
- return `Invalid parameters for ${t}: ${o.join("; ")}`;
3751
- }
3788
+ E(
3789
+ l({
3790
+ id: c().describe("Storage ID"),
3791
+ name: c().describe("Storage name"),
3792
+ type: c().describe("Storage type"),
3793
+ capacity: f().describe("Storage capacity")
3794
+ })
3795
+ );
3752
3796
  C.child("tool-registry");
3753
3797
  const We = /* @__PURE__ */ new Map(), Ve = /* @__PURE__ */ new Map();
3754
3798
  function ht(t) {
@@ -3835,9 +3879,11 @@ function Ge(t) {
3835
3879
  }
3836
3880
  async function In(t, e, r, n) {
3837
3881
  var h;
3838
- const i = (t === "tab_set_files" ? Lr : $r).safeParse(e);
3882
+ const i = (t === "tab_set_files" ? tn : Xr).safeParse(e);
3839
3883
  if (!i.success)
3840
- return Ge(((h = i.error.issues[0]) == null ? void 0 : h.message) ?? "Invalid setFiles params");
3884
+ return Ge(
3885
+ ((h = i.error.issues[0]) == null ? void 0 : h.message) ?? "Invalid setFiles params"
3886
+ );
3841
3887
  const o = i.data, a = [];
3842
3888
  for (const d of o.files) {
3843
3889
  if (d.url) {
@@ -3954,9 +4000,9 @@ function On(t, e) {
3954
4000
  }
3955
4001
  function O(t, e, r) {
3956
4002
  On(t, async (n, s) => {
3957
- const i = e.safeParse(ye(n));
4003
+ const i = e.safeParse(pe(n));
3958
4004
  if (!i.success) {
3959
- const o = _n(
4005
+ const o = Dr(
3960
4006
  t,
3961
4007
  e,
3962
4008
  i.error.issues,
@@ -3972,7 +4018,7 @@ function Nn() {
3972
4018
  return crypto.getRandomValues(t), Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
3973
4019
  }
3974
4020
  function Mn(t) {
3975
- return tn(t);
4021
+ return ir(t);
3976
4022
  }
3977
4023
  const ot = /* @__PURE__ */ new Map(), Me = /* @__PURE__ */ new Map();
3978
4024
  function $n(t, e) {
@@ -3980,7 +4026,9 @@ function $n(t, e) {
3980
4026
  if (ot.has(t))
3981
4027
  throw new Error(`Worker port already registered for owner: ${t}`);
3982
4028
  if (typeof e.addEventListener != "function")
3983
- throw new Error(`Worker port for owner "${t}" cannot receive responses`);
4029
+ throw new Error(
4030
+ `Worker port for owner "${t}" cannot receive responses`
4031
+ );
3984
4032
  ot.set(t, e), e.addEventListener("message", async (n) => {
3985
4033
  var i;
3986
4034
  const s = n.data;
@@ -4000,7 +4048,10 @@ function $n(t, e) {
4000
4048
  if (!h)
4001
4049
  d = {
4002
4050
  ok: !1,
4003
- error: { message: `Unknown worker action: ${s.action}`, code: "E_UNKNOWN" }
4051
+ error: {
4052
+ message: `Unknown worker action: ${s.action}`,
4053
+ code: "E_UNKNOWN"
4054
+ }
4004
4055
  };
4005
4056
  else
4006
4057
  try {
@@ -4010,7 +4061,10 @@ function $n(t, e) {
4010
4061
  runId: s.runId,
4011
4062
  signal: a.signal
4012
4063
  });
4013
- d = a.signal.aborted ? { ok: !1, error: { message: "Relay aborted", code: "E_ABORT" } } : { ok: !0, value: m };
4064
+ d = a.signal.aborted ? {
4065
+ ok: !1,
4066
+ error: { message: "Relay aborted", code: "E_ABORT" }
4067
+ } : { ok: !0, value: m };
4014
4068
  } catch (m) {
4015
4069
  d = {
4016
4070
  ok: !1,
@@ -4022,7 +4076,10 @@ function $n(t, e) {
4022
4076
  }
4023
4077
  Me.delete(o), Ue(e, { type: "registryCallResult", id: o, result: d }) || ct(o, {
4024
4078
  ok: !1,
4025
- error: { message: "Failed to deliver worker handler response", code: "E_PORT" }
4079
+ error: {
4080
+ message: "Failed to deliver worker handler response",
4081
+ code: "E_PORT"
4082
+ }
4026
4083
  });
4027
4084
  }
4028
4085
  }), (r = e.start) == null || r.call(e);
@@ -4041,7 +4098,12 @@ function Pn(t) {
4041
4098
  function Jt(t) {
4042
4099
  const { owner: e, action: r, tabPolicy: n, resolveTimeoutMs: s } = t, i = t.timeoutMs ?? ve;
4043
4100
  return (o, a) => {
4044
- C.trace("safePostAsCall_invoke", { owner: e, action: r, callId: a == null ? void 0 : a.callId, runId: a == null ? void 0 : a.runId });
4101
+ C.trace("safePostAsCall_invoke", {
4102
+ owner: e,
4103
+ action: r,
4104
+ callId: a == null ? void 0 : a.callId,
4105
+ runId: a == null ? void 0 : a.runId
4106
+ });
4045
4107
  const h = (s == null ? void 0 : s(o)) ?? i;
4046
4108
  return new Promise((d, m) => {
4047
4109
  var bt;
@@ -4056,9 +4118,11 @@ function Jt(t) {
4056
4118
  return;
4057
4119
  }
4058
4120
  if (he.size >= Rt) {
4059
- m(new Error(
4060
- `Too many pending calls (${Rt} limit exceeded). Action: ${r}`
4061
- ));
4121
+ m(
4122
+ new Error(
4123
+ `Too many pending calls (${Rt} limit exceeded). Action: ${r}`
4124
+ )
4125
+ );
4062
4126
  return;
4063
4127
  }
4064
4128
  const $ = Nn();
@@ -4094,7 +4158,9 @@ function Jt(t) {
4094
4158
  tabPolicy: n,
4095
4159
  command: { action: r, params: o, runId: gt, callId: yt },
4096
4160
  runId: gt
4097
- }) || le(() => m(new Error(`Failed to post relay for action: ${r}`)));
4161
+ }) || le(
4162
+ () => m(new Error(`Failed to post relay for action: ${r}`))
4163
+ );
4098
4164
  });
4099
4165
  };
4100
4166
  }
@@ -4156,17 +4222,28 @@ async function Qt(t, e, r) {
4156
4222
  return n.ok ? { ok: !0, params: n.value } : n;
4157
4223
  }
4158
4224
  function qn(t, e) {
4159
- t = ye(t);
4225
+ t = pe(t);
4160
4226
  const r = e == null ? void 0 : e.action;
4161
- if (C.trace("extensionDispatch", { action: r, callId: e == null ? void 0 : e.callId, runId: e == null ? void 0 : e.runId }), !r)
4227
+ if (C.trace("extensionDispatch", {
4228
+ action: r,
4229
+ callId: e == null ? void 0 : e.callId,
4230
+ runId: e == null ? void 0 : e.runId
4231
+ }), !r)
4162
4232
  return Promise.resolve({
4163
4233
  ok: !1,
4164
- error: { message: "Missing action in dispatch context", code: "E_MISSING_ACTION" }
4234
+ error: {
4235
+ message: "Missing action in dispatch context",
4236
+ code: "E_MISSING_ACTION"
4237
+ }
4165
4238
  });
4166
4239
  const n = t;
4167
4240
  return (async () => {
4168
4241
  var h, d;
4169
- const s = await Qt(r, t, e == null ? void 0 : e.runId);
4242
+ const s = await Qt(
4243
+ r,
4244
+ t,
4245
+ e == null ? void 0 : e.runId
4246
+ );
4170
4247
  if (!s.ok)
4171
4248
  return s;
4172
4249
  if (t = s.params, de.has(r)) {
@@ -4180,11 +4257,14 @@ function qn(t, e) {
4180
4257
  }
4181
4258
  })();
4182
4259
  }
4183
- const i = un(r);
4260
+ const i = Fr(r);
4184
4261
  if (!i)
4185
4262
  return Promise.resolve({
4186
4263
  ok: !1,
4187
- error: { message: `No route registered for action: ${r}`, code: "E_NO_ROUTE" }
4264
+ error: {
4265
+ message: `No route registered for action: ${r}`,
4266
+ code: "E_NO_ROUTE"
4267
+ }
4188
4268
  });
4189
4269
  const a = await Jt({
4190
4270
  owner: i.endpoint,
@@ -4214,10 +4294,14 @@ function Fn(t) {
4214
4294
  );
4215
4295
  return async (r, n) => {
4216
4296
  var i;
4217
- r = ye(r);
4297
+ r = pe(r);
4218
4298
  const s = (n == null ? void 0 : n.signal) ?? (n != null && n.runId ? (i = F.get(n.runId)) == null ? void 0 : i.signal : void 0);
4219
4299
  try {
4220
- return { ok: !0, value: await e(r, { ...n, action: t.action, signal: s }) };
4300
+ return { ok: !0, value: await e(r, {
4301
+ ...n,
4302
+ action: t.action,
4303
+ signal: s
4304
+ }) };
4221
4305
  } catch (o) {
4222
4306
  const a = o instanceof Error ? o.message : String(o), h = typeof o == "object" && o !== null && "code" in o && typeof o.code == "string" ? o.code : t.errorCode;
4223
4307
  return { ok: !1, error: { message: a, code: h } };
@@ -4231,7 +4315,7 @@ function Fn(t) {
4231
4315
  });
4232
4316
  return async (r, n) => {
4233
4317
  var a;
4234
- const s = ye(r), i = await Qt(
4318
+ const s = pe(r), i = await Qt(
4235
4319
  t.action,
4236
4320
  s,
4237
4321
  n == null ? void 0 : n.runId
@@ -4254,16 +4338,92 @@ function Fn(t) {
4254
4338
  }
4255
4339
  }
4256
4340
  function Un(t) {
4257
- O("exists", X, (e) => t.fsExists(e)), O("stat", X, (e) => t.fsStat(e)), O("read", X, (e) => t.fsRead(e)), O("readText", X, (e) => t.fsReadText(e)), O("readBase64", X, (e) => t.fsReadBase64(e)), O("list", X, (e) => t.fsList(e)), O("mkdir", X, (e) => t.fsMkdir(e)), O("delete", X, (e) => t.fsDelete(e)), O("copy", xt, (e) => t.fsCopy(e)), O("move", xt, (e) => t.fsMove(e)), O("write", ue, (e) => t.fsWrite(e)), O("writeText", ue, (e) => t.fsWriteText(e)), O("writeBase64", ue, async (e) => {
4258
- const r = e;
4259
- return En(r.path, r.data), t.fsWriteBase64(r);
4260
- }), O("append", ue, (e) => t.fsAppend(e)), O("appendText", ue, (e) => t.fsAppendText(e)), O("appendBase64", ue, (e) => t.fsAppendBase64(e)), O("readRange", Zr, (e) => t.fsReadRange(e)), O("update", Wr, (e) => t.fsUpdate(e)), O("hash", Vr, (e) => t.fsHash(e));
4341
+ O(
4342
+ "exists",
4343
+ X,
4344
+ (e) => t.fsExists(e)
4345
+ ), O(
4346
+ "stat",
4347
+ X,
4348
+ (e) => t.fsStat(e)
4349
+ ), O(
4350
+ "read",
4351
+ X,
4352
+ (e) => t.fsRead(e)
4353
+ ), O(
4354
+ "readText",
4355
+ X,
4356
+ (e) => t.fsReadText(e)
4357
+ ), O(
4358
+ "readBase64",
4359
+ X,
4360
+ (e) => t.fsReadBase64(e)
4361
+ ), O(
4362
+ "list",
4363
+ X,
4364
+ (e) => t.fsList(e)
4365
+ ), O(
4366
+ "mkdir",
4367
+ X,
4368
+ (e) => t.fsMkdir(e)
4369
+ ), O(
4370
+ "delete",
4371
+ X,
4372
+ (e) => t.fsDelete(e)
4373
+ ), O(
4374
+ "copy",
4375
+ xt,
4376
+ (e) => t.fsCopy(e)
4377
+ ), O(
4378
+ "move",
4379
+ xt,
4380
+ (e) => t.fsMove(e)
4381
+ ), O(
4382
+ "write",
4383
+ ue,
4384
+ (e) => t.fsWrite(e)
4385
+ ), O(
4386
+ "writeText",
4387
+ ue,
4388
+ (e) => t.fsWriteText(e)
4389
+ ), O(
4390
+ "writeBase64",
4391
+ ue,
4392
+ async (e) => {
4393
+ const r = e;
4394
+ return En(r.path, r.data), t.fsWriteBase64(r);
4395
+ }
4396
+ ), O(
4397
+ "append",
4398
+ ue,
4399
+ (e) => t.fsAppend(e)
4400
+ ), O(
4401
+ "appendText",
4402
+ ue,
4403
+ (e) => t.fsAppendText(e)
4404
+ ), O(
4405
+ "appendBase64",
4406
+ ue,
4407
+ (e) => t.fsAppendBase64(e)
4408
+ ), O(
4409
+ "readRange",
4410
+ sn,
4411
+ (e) => t.fsReadRange(e)
4412
+ ), O(
4413
+ "update",
4414
+ an,
4415
+ (e) => t.fsUpdate(e)
4416
+ ), O(
4417
+ "hash",
4418
+ on,
4419
+ (e) => t.fsHash(e)
4420
+ );
4261
4421
  }
4262
4422
  async function Bn(t, e) {
4263
4423
  if (at) return;
4264
- await Xt(), se = new er(), Je(0), nn(Je), C.trace("initWasm_start"), Un(se), gn(t);
4424
+ await Xt(), se = new er(), Je(0), or(Je), C.trace("initWasm_start"), Un(se), Hr(t);
4265
4425
  const n = t.map((i) => ({
4266
- entry: yn(i),
4426
+ entry: ur(i),
4267
4427
  callback: Fn(i)
4268
4428
  }));
4269
4429
  try {
@@ -4291,7 +4451,10 @@ async function Bn(t, e) {
4291
4451
  }
4292
4452
  self.onmessage = async (t) => {
4293
4453
  const e = t.data;
4294
- if (C.trace("onmessage", { type: e.type, id: "id" in e ? e.id : void 0 }), e.type === "asyncRelayResult") {
4454
+ if (C.trace("onmessage", {
4455
+ type: e.type,
4456
+ id: "id" in e ? e.id : void 0
4457
+ }), e.type === "asyncRelayResult") {
4295
4458
  C.trace("asyncRelayResult", { id: e.id }), ct(e.id, e.result);
4296
4459
  return;
4297
4460
  }
@@ -4309,12 +4472,15 @@ self.onmessage = async (t) => {
4309
4472
  await Bn(e.manifest, e.extensionId), self.postMessage({ type: "ready" });
4310
4473
  } catch (n) {
4311
4474
  const s = n instanceof Error ? n.message : String(n);
4312
- C.error("worker_init_failed", { error: s }), self.postMessage({ type: "error", error: `WASM init failed: ${s}` });
4475
+ C.error("worker_init_failed", { error: s }), self.postMessage({
4476
+ type: "error",
4477
+ error: `WASM init failed: ${s}`
4478
+ });
4313
4479
  }
4314
4480
  return;
4315
4481
  }
4316
4482
  if (e.type === "setLogLevel") {
4317
- Je(e.level), rn(Mn(e.level)), C.trace("set_log_level", { level: e.level });
4483
+ Je(e.level), ar(Mn(e.level)), C.trace("set_log_level", { level: e.level });
4318
4484
  return;
4319
4485
  }
4320
4486
  if (!at || !se) {
@@ -4330,14 +4496,22 @@ self.onmessage = async (t) => {
4330
4496
  switch (e.type) {
4331
4497
  case "runCell": {
4332
4498
  const n = e.runId, s = new AbortController();
4333
- n && F.set(n, s), Z = { id: e.id, runId: n }, C.trace("runCell_start", { runId: n, callId: e.id, codeLen: e.code.length });
4499
+ n && F.set(n, s), Z = { id: e.id, runId: n }, C.trace("runCell_start", {
4500
+ runId: n,
4501
+ callId: e.id,
4502
+ codeLen: e.code.length
4503
+ });
4334
4504
  try {
4335
4505
  const i = await r.runCellAsync(
4336
4506
  e.code,
4337
4507
  e.stdin || "",
4338
4508
  n || ""
4339
4509
  );
4340
- C.trace("runCell_done", { runId: n, callId: e.id, status: i.status }), self.postMessage({
4510
+ C.trace("runCell_done", {
4511
+ runId: n,
4512
+ callId: e.id,
4513
+ status: i.status
4514
+ }), self.postMessage({
4341
4515
  type: "result",
4342
4516
  id: e.id,
4343
4517
  data: i,
@@ -4351,7 +4525,12 @@ self.onmessage = async (t) => {
4351
4525
  R && (d = parseInt(R[1], 10));
4352
4526
  }
4353
4527
  C.error("runCell_error", { runId: n, error: o, name: a, line: d });
4354
- const m = i instanceof Error ? { name: a, message: o, stack: h, ...d !== void 0 ? { line: d } : {} } : { message: o };
4528
+ const m = i instanceof Error ? {
4529
+ name: a,
4530
+ message: o,
4531
+ stack: h,
4532
+ ...d !== void 0 ? { line: d } : {}
4533
+ } : { message: o };
4355
4534
  self.postMessage({
4356
4535
  type: "error",
4357
4536
  id: e.id,
@@ -4365,7 +4544,8 @@ self.onmessage = async (t) => {
4365
4544
  }
4366
4545
  case "reset": {
4367
4546
  r.setAborted(!0);
4368
- for (const n of F.values()) n.abort();
4547
+ for (const n of F.values())
4548
+ n.abort();
4369
4549
  F.clear(), St(), An(), nr(), At("E_RESET", "Worker reset");
4370
4550
  try {
4371
4551
  r.reset(), self.postMessage({ type: "result", id: e.id, data: { ok: !0 } });
@@ -4377,13 +4557,18 @@ self.onmessage = async (t) => {
4377
4557
  }
4378
4558
  case "stop": {
4379
4559
  r.setAborted(!0);
4380
- for (const n of F.values()) n.abort();
4560
+ for (const n of F.values())
4561
+ n.abort();
4381
4562
  F.clear(), St(), At("E_STOPPED", "Worker stopped"), self.postMessage({ type: "result", id: e.id, data: { ok: !0 } });
4382
4563
  break;
4383
4564
  }
4384
4565
  case "setFuelLimit": {
4385
4566
  try {
4386
- r.set_fuel_limit(e.limit), e.id && self.postMessage({ type: "result", id: e.id, data: { ok: !0 } });
4567
+ r.set_fuel_limit(e.limit), e.id && self.postMessage({
4568
+ type: "result",
4569
+ id: e.id,
4570
+ data: { ok: !0 }
4571
+ });
4387
4572
  } catch (n) {
4388
4573
  if (e.id) {
4389
4574
  const s = n instanceof Error ? n.message : String(n);
@@ -4442,7 +4627,9 @@ self.onmessage = async (t) => {
4442
4627
  break;
4443
4628
  }
4444
4629
  default: {
4445
- C.error("unhandled_worker_message", { type: e.type });
4630
+ C.error("unhandled_worker_message", {
4631
+ type: e.type
4632
+ });
4446
4633
  break;
4447
4634
  }
4448
4635
  }