@omg-dev/app 0.5.1 → 0.6.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.
Files changed (113) hide show
  1. package/dist-lib/{ChangelogPage-BzsTWlhq.js → ChangelogPage-Cjj_DiYL.js} +33 -1
  2. package/dist-lib/{File-B-qYa2zY.js → File-DQRr5F_e.js} +1761 -1826
  3. package/dist-lib/FileEditor-BrI3dfcp.js +6895 -0
  4. package/dist-lib/FileTreePane-J8P-OiHb.js +8413 -0
  5. package/dist-lib/{FileViewer-Clmf04v1.js → FileViewer-DRrfus7c.js} +1 -1
  6. package/dist-lib/{SessionFilesPanel-K4lGGdJ4.js → SessionFilesPanel-DxVJ43fE.js} +69 -69
  7. package/dist-lib/{TermView-CWr-zJmM.js → TermView-B4V-DyD-.js} +521 -530
  8. package/dist-lib/{abnfDiagram-VRR7QNED-Chn1Z_p9.js → abnfDiagram-VRR7QNED-CiXfOnAu.js} +4 -4
  9. package/dist-lib/{arc-B652oHQ-.js → arc-QOMNKQA5.js} +1 -1
  10. package/dist-lib/{architectureDiagram-ZJ3FMSHR-CMatArpz.js → architectureDiagram-ZJ3FMSHR-BcFBTmfD.js} +2059 -2064
  11. package/dist-lib/{blockDiagram-677ZJIJ3-CEOPfI9A.js → blockDiagram-677ZJIJ3-Qj8-RIV3.js} +920 -925
  12. package/dist-lib/{c4Diagram-LMCZKHZV-DcUHrESL.js → c4Diagram-LMCZKHZV-BpinEmj4.js} +598 -593
  13. package/dist-lib/{channel-B5lJFbed.js → channel-D6YHMmF7.js} +1 -1
  14. package/dist-lib/{chat-engine-P0yDhFOX.js → chat-engine-CUiDTHFP.js} +1173 -1218
  15. package/dist-lib/chunk-2Q5K7J3B-CFSi414U.js +18 -0
  16. package/dist-lib/{chunk-32BRIVSS-IYmNSvH8.js → chunk-32BRIVSS-DvywQiCk.js} +1 -1
  17. package/dist-lib/{chunk-5VM5RSS4-DO2g-xIj.js → chunk-5VM5RSS4-xd6XuI9Q.js} +1 -1
  18. package/dist-lib/{chunk-BO2N2NFS-kYiI5SD9.js → chunk-BO2N2NFS-BbJdm-59.js} +4892 -4903
  19. package/dist-lib/{chunk-EX3LRPZG-N96wfks9.js → chunk-EX3LRPZG-BLDKx-Yg.js} +507 -514
  20. package/dist-lib/chunk-JWPE2WC7-DnwG7Xzp.js +8 -0
  21. package/dist-lib/chunk-MOJQB5TN-BrENeFT5.js +670 -0
  22. package/dist-lib/chunk-RYQCIY6F-I-J4fVFd.js +313 -0
  23. package/dist-lib/{chunk-V7JOEXUC-DQwf2vkP.js → chunk-V7JOEXUC-Bkakcs1-.js} +458 -453
  24. package/dist-lib/chunk-VR4S4FIN-BDq3jZ0m.js +19 -0
  25. package/dist-lib/{chunk-XXDRQBXY-Ccv4aRcn.js → chunk-XXDRQBXY-DRKeYnrF.js} +1 -1
  26. package/dist-lib/{classDiagram-v2-EOCWNBFH-DOn-rhuL.js → classDiagram-OUVF2IWQ-DISUfvR5.js} +2 -2
  27. package/dist-lib/{classDiagram-OUVF2IWQ-DOn-rhuL.js → classDiagram-v2-EOCWNBFH-DISUfvR5.js} +2 -2
  28. package/dist-lib/{coding-agents-page-DCafIpWL.js → coding-agents-page-DtxZ0nbQ.js} +152 -131
  29. package/dist-lib/computer-page-DIJeFOZz.js +8860 -0
  30. package/dist-lib/{cose-bilkent-JH36ORCC-C-tACTrT.js → cose-bilkent-JH36ORCC-DCfmoChv.js} +281 -281
  31. package/dist-lib/{create-BrnHvSDE.js → create-CBk9uwJH.js} +2 -2
  32. package/dist-lib/cynefin-VYW2F7L2-XAY3mHv8.js +24430 -0
  33. package/dist-lib/{cynefinDiagram-TSTJHNR4-Be7CamD2.js → cynefinDiagram-TSTJHNR4-CrgvPEr1.js} +3 -3
  34. package/dist-lib/{cytoscape.esm-B0ledd6M.js → cytoscape.esm-BB6Ga9He.js} +3 -3
  35. package/dist-lib/dagre-VKFMJZFB-CE5k06mJ.js +343 -0
  36. package/dist-lib/{diagram-FQU43EPY-Jg12ow4Z.js → diagram-FQU43EPY-gOcCiJEN.js} +136 -139
  37. package/dist-lib/diagram-G47NLZAW-BVJLfRsd.js +531 -0
  38. package/dist-lib/diagram-NH7WQ7WH-u6QnHasL.js +145 -0
  39. package/dist-lib/diagram-OA4YK3LP-D4Kcl3uM.js +350 -0
  40. package/dist-lib/{diagram-WEI45ONY-D1kKPOc_.js → diagram-WEI45ONY-6a__oIb0.js} +38 -42
  41. package/dist-lib/{ebnfDiagram-CCIWWBDH-BhQWrGMc.js → ebnfDiagram-CCIWWBDH-PXSrB6lG.js} +4 -4
  42. package/dist-lib/{embedded-CLYU5z7h.js → embedded-PUsgcSTE.js} +10592 -10725
  43. package/dist-lib/{engine-compile-BeDRSL6Y.js → engine-compile-D_stzVMa.js} +2939 -2991
  44. package/dist-lib/{erDiagram-Q63AITRT-D2q6Nmwa.js → erDiagram-Q63AITRT-BbsttUCs.js} +286 -284
  45. package/dist-lib/flowDiagram-23GEKE2U-CX5x3zVA.js +1641 -0
  46. package/dist-lib/{ganttDiagram-NO4QXBWP-C_Lj-cJB.js → ganttDiagram-NO4QXBWP-Bq0aSPs8.js} +2 -2
  47. package/dist-lib/gitGraphDiagram-IHSO6WYX-BjAezjIv.js +815 -0
  48. package/dist-lib/{graph-B68L3K2T.js → graph-DAHC4kPm.js} +2 -2
  49. package/dist-lib/{highlighted-body-OFNGDK62-C2DGVKV8.js → highlighted-body-OFNGDK62-DWhG_ijx.js} +1 -1
  50. package/dist-lib/index-B0neMIbR.js +16520 -0
  51. package/dist-lib/index-BBC0E3Qg.js +4994 -0
  52. package/dist-lib/{index-Dtkd4mEk.js → index-CE7H8LiZ.js} +2 -2
  53. package/dist-lib/{index-DWkBvb-9.js → index-FgVvPpIY.js} +2 -2
  54. package/dist-lib/index.js +1 -1
  55. package/dist-lib/{infoDiagram-FWYZ7A6U-BbUkT0KS.js → infoDiagram-FWYZ7A6U-Bo_FNR91.js} +2 -2
  56. package/dist-lib/ishikawaDiagram-FXEZZL3T-C5bGD-Eb.js +624 -0
  57. package/dist-lib/{journeyDiagram-5HDEW3XC-CgykmVSC.js → journeyDiagram-5HDEW3XC-C8qM7SxF.js} +4 -4
  58. package/dist-lib/kanban-definition-HUTT4EX6-C-EK5Puz.js +724 -0
  59. package/dist-lib/{katex-jHfnQmlp.js → katex-DoRnZ_sp.js} +1 -1
  60. package/dist-lib/{layout-BGrtsiRL.js → layout-DBbo_M5I.js} +2 -2
  61. package/dist-lib/{linear-B5ZSwawJ.js → linear-zGzX0-I0.js} +1 -1
  62. package/dist-lib/{map-hbfFlSln.js → map-DRdzG8Ho.js} +1 -1
  63. package/dist-lib/mermaid-GHXKKRXX-hOE9C3qW.js +4 -0
  64. package/dist-lib/{mindmap-definition-LN4V7U3C-CfhfeEht.js → mindmap-definition-LN4V7U3C-DlVCRx6k.js} +310 -311
  65. package/dist-lib/{pegDiagram-2B236MQR-CYDAJHPF.js → pegDiagram-2B236MQR-DrKNikeG.js} +4 -4
  66. package/dist-lib/{pieDiagram-ENE6RG2P-udKxQm4p.js → pieDiagram-ENE6RG2P-Fm_jc0HL.js} +83 -84
  67. package/dist-lib/quadrantDiagram-ABIIQ3AL-zDRY0VtB.js +1029 -0
  68. package/dist-lib/{railroadDiagram-RFXS5EU6-q0Svkmuy.js → railroadDiagram-RFXS5EU6-BQuFX39y.js} +4 -4
  69. package/dist-lib/{requirementDiagram-TGXJPOKE-tNxRI1gc.js → requirementDiagram-TGXJPOKE-BWwBQZXn.js} +269 -268
  70. package/dist-lib/{resume-session-sheet-CHwpwguS.js → resume-session-sheet-DTe_2QtJ.js} +2 -3
  71. package/dist-lib/sankeyDiagram-HTMAVEWB-BjRyuB6L.js +859 -0
  72. package/dist-lib/{sequenceDiagram-DBY2YBRQ-Dvl2_CXL.js → sequenceDiagram-DBY2YBRQ-69pcw_2M.js} +892 -899
  73. package/dist-lib/{session-token-usage-BUz6b-IB.js → session-token-usage-DY4vFlfs.js} +82 -83
  74. package/dist-lib/{shadow-text-size-CBCTdbYU.js → shadow-text-size-smWA4wIU.js} +1 -2
  75. package/dist-lib/{shipped-page-CXy85bsL.js → shipped-page-B-ruG8li.js} +233 -236
  76. package/dist-lib/sizeCapture-X5ZJPWSS-DqkV8s1N.js +46 -0
  77. package/dist-lib/{stateDiagram-2N3HPSRC-CnWB7HvU.js → stateDiagram-2N3HPSRC-0vE3REl_.js} +4 -4
  78. package/dist-lib/{stateDiagram-v2-6OUMAXLB-DnZ0UI2p.js → stateDiagram-v2-6OUMAXLB-u_56Obsh.js} +2 -2
  79. package/dist-lib/{streamdown-response-CUB9sK6V.js → streamdown-response-BQy3geXs.js} +290 -297
  80. package/dist-lib/styles.css +1 -1
  81. package/dist-lib/swimlanes-5IMT3BWC-H0raIBd1.js +5332 -0
  82. package/dist-lib/{swimlanesDiagram-G3AALYLV-CKyOeqF_.js → swimlanesDiagram-G3AALYLV-By52HaDu.js} +2 -2
  83. package/dist-lib/timeline-definition-FHXFAJF6-h1LLYUQk.js +1055 -0
  84. package/dist-lib/vennDiagram-L72KCM5P-B4wDw_Kh.js +1578 -0
  85. package/dist-lib/wardleyDiagram-EHGQE667-DLMBGiwD.js +678 -0
  86. package/dist-lib/{xychartDiagram-FW5EYKEG-m3s7caPv.js → xychartDiagram-FW5EYKEG-BHvf5Noj.js} +526 -496
  87. package/package.json +4 -3
  88. package/dist-lib/FileEditor-BIz0qCyW.js +0 -6892
  89. package/dist-lib/FileTreePane-BG2k7gTc.js +0 -8422
  90. package/dist-lib/chunk-2Q5K7J3B-Ex8Ly28R.js +0 -15
  91. package/dist-lib/chunk-JWPE2WC7-DFPBClX_.js +0 -9
  92. package/dist-lib/chunk-MOJQB5TN-dusfI9ob.js +0 -664
  93. package/dist-lib/chunk-RYQCIY6F-fkeERzIG.js +0 -315
  94. package/dist-lib/chunk-VR4S4FIN-hOZG7eF3.js +0 -20
  95. package/dist-lib/cynefin-VYW2F7L2-DQXPWaog.js +0 -23853
  96. package/dist-lib/dagre-VKFMJZFB-BhCjK7XQ.js +0 -346
  97. package/dist-lib/diagram-G47NLZAW-C3_z2t6T.js +0 -530
  98. package/dist-lib/diagram-NH7WQ7WH-DUdK08IT.js +0 -143
  99. package/dist-lib/diagram-OA4YK3LP-TUUyRYY3.js +0 -353
  100. package/dist-lib/flowDiagram-23GEKE2U-DU3S3biU.js +0 -1645
  101. package/dist-lib/gitGraphDiagram-IHSO6WYX-CvGu0XAR.js +0 -828
  102. package/dist-lib/index-DcwavxA1.js +0 -5062
  103. package/dist-lib/index-JkCQXUYs.js +0 -16566
  104. package/dist-lib/ishikawaDiagram-FXEZZL3T-D_Y6Tuyb.js +0 -622
  105. package/dist-lib/kanban-definition-HUTT4EX6-CPFLTskY.js +0 -726
  106. package/dist-lib/mermaid-GHXKKRXX-Ox_2d3uB.js +0 -4
  107. package/dist-lib/quadrantDiagram-ABIIQ3AL-BmDmLczk.js +0 -1025
  108. package/dist-lib/sankeyDiagram-HTMAVEWB-B9Bl7f2P.js +0 -847
  109. package/dist-lib/sizeCapture-X5ZJPWSS-B1EeO3N9.js +0 -47
  110. package/dist-lib/swimlanes-5IMT3BWC-CvqDJcS9.js +0 -5353
  111. package/dist-lib/timeline-definition-FHXFAJF6-b15X0Oru.js +0 -1066
  112. package/dist-lib/vennDiagram-L72KCM5P-C4lh5m77.js +0 -1585
  113. package/dist-lib/wardleyDiagram-EHGQE667-Cev6fT_D.js +0 -684
@@ -1,7 +1,7 @@
1
1
  import { jsx as ao } from "react/jsx-runtime";
2
2
  import { useRef as Dt, useCallback as Lt, useSyncExternalStore as ut, useEffect as so } from "react";
3
3
  import { g as io } from "./_commonjsHelpers-C6fGbg64.js";
4
- import { ac as uo } from "./embedded-CLYU5z7h.js";
4
+ import { ad as uo } from "./embedded-PUsgcSTE.js";
5
5
  var Ar = "vercel.ai.error", co = Symbol.for(Ar), Ut, Ft, se = class Nr extends (Ft = Error, Ut = co, Ft) {
6
6
  /**
7
7
  * Creates an AI SDK Error.
@@ -64,7 +64,7 @@ Error message: ${Pr(t)}`,
64
64
  context: n
65
65
  }) {
66
66
  let o = "Type validation failed";
67
- if (n != null && n.field && (o += ` for ${n.field}`), n != null && n.entityName || n != null && n.entityId) {
67
+ if (n?.field && (o += ` for ${n.field}`), n?.entityName || n?.entityId) {
68
68
  o += " (";
69
69
  const a = [];
70
70
  n.entityName && a.push(n.entityName), n.entityId && a.push(`id: "${n.entityId}"`), o += a.join(", "), o += ")";
@@ -96,44 +96,41 @@ Error message: ${Pr(r)}`,
96
96
  context: n
97
97
  }) {
98
98
  var o, a, i;
99
- return vt.isInstance(r) && r.value === t && ((o = r.context) == null ? void 0 : o.field) === (n == null ? void 0 : n.field) && ((a = r.context) == null ? void 0 : a.entityName) === (n == null ? void 0 : n.entityName) && ((i = r.context) == null ? void 0 : i.entityId) === (n == null ? void 0 : n.entityId) ? r : new vt({ value: t, cause: r, context: n });
99
+ return vt.isInstance(r) && r.value === t && ((o = r.context) == null ? void 0 : o.field) === n?.field && ((a = r.context) == null ? void 0 : a.entityName) === n?.entityName && ((i = r.context) == null ? void 0 : i.entityId) === n?.entityId ? r : new vt({ value: t, cause: r, context: n });
100
100
  }
101
101
  }, Ht;
102
- function m(e, t, r) {
103
- function n(s, d) {
102
+ function f(e, t, r) {
103
+ function n(s, l) {
104
104
  if (s._zod || Object.defineProperty(s, "_zod", {
105
105
  value: {
106
- def: d,
106
+ def: l,
107
107
  constr: i,
108
108
  traits: /* @__PURE__ */ new Set()
109
109
  },
110
110
  enumerable: !1
111
111
  }), s._zod.traits.has(e))
112
112
  return;
113
- s._zod.traits.add(e), t(s, d);
114
- const u = i.prototype, l = Object.keys(u);
115
- for (let p = 0; p < l.length; p++) {
116
- const h = l[p];
117
- h in s || (s[h] = u[h].bind(s));
113
+ s._zod.traits.add(e), t(s, l);
114
+ const u = i.prototype, d = Object.keys(u);
115
+ for (let p = 0; p < d.length; p++) {
116
+ const m = d[p];
117
+ m in s || (s[m] = u[m].bind(s));
118
118
  }
119
119
  }
120
- const o = (r == null ? void 0 : r.Parent) ?? Object;
120
+ const o = r?.Parent ?? Object;
121
121
  class a extends o {
122
122
  }
123
123
  Object.defineProperty(a, "name", { value: e });
124
124
  function i(s) {
125
- var d;
126
- const u = r != null && r.Parent ? new a() : this;
127
- n(u, s), (d = u._zod).deferred ?? (d.deferred = []);
128
- for (const l of u._zod.deferred)
129
- l();
125
+ var l;
126
+ const u = r?.Parent ? new a() : this;
127
+ n(u, s), (l = u._zod).deferred ?? (l.deferred = []);
128
+ for (const d of u._zod.deferred)
129
+ d();
130
130
  return u;
131
131
  }
132
132
  return Object.defineProperty(i, "init", { value: n }), Object.defineProperty(i, Symbol.hasInstance, {
133
- value: (s) => {
134
- var d, u;
135
- return r != null && r.Parent && s instanceof r.Parent ? !0 : (u = (d = s == null ? void 0 : s._zod) == null ? void 0 : d.traits) == null ? void 0 : u.has(e);
136
- }
133
+ value: (s) => r?.Parent && s instanceof r.Parent ? !0 : s?._zod?.traits?.has(e)
137
134
  }), Object.defineProperty(i, "name", { value: e }), i;
138
135
  }
139
136
  class ke extends Error {
@@ -180,7 +177,7 @@ function mo(e, t) {
180
177
  return Math.abs(r - n) < o ? 0 : r - n;
181
178
  }
182
179
  const Xt = /* @__PURE__ */ Symbol("evaluating");
183
- function N(e, t, r) {
180
+ function M(e, t, r) {
184
181
  let n;
185
182
  Object.defineProperty(e, t, {
186
183
  get() {
@@ -224,12 +221,11 @@ function Le(e) {
224
221
  return typeof e == "object" && e !== null && !Array.isArray(e);
225
222
  }
226
223
  const go = /* @__PURE__ */ nt(() => {
227
- var e;
228
- if (zt.jitless || typeof navigator < "u" && ((e = navigator == null ? void 0 : navigator.userAgent) != null && e.includes("Cloudflare")))
224
+ if (zt.jitless || typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
229
225
  return !1;
230
226
  try {
231
- const t = Function;
232
- return new t(""), !0;
227
+ const e = Function;
228
+ return new e(""), !0;
233
229
  } catch {
234
230
  return !1;
235
231
  }
@@ -252,7 +248,7 @@ function Ae(e) {
252
248
  }
253
249
  function he(e, t, r) {
254
250
  const n = new e._zod.constr(t ?? e._zod.def);
255
- return (!t || r != null && r.parent) && (n._zod.parent = e), n;
251
+ return (!t || r?.parent) && (n._zod.parent = e), n;
256
252
  }
257
253
  function w(e) {
258
254
  const t = e;
@@ -260,8 +256,8 @@ function w(e) {
260
256
  return {};
261
257
  if (typeof t == "string")
262
258
  return { error: () => t };
263
- if ((t == null ? void 0 : t.message) !== void 0) {
264
- if ((t == null ? void 0 : t.error) !== void 0)
259
+ if (t?.message !== void 0) {
260
+ if (t?.error !== void 0)
265
261
  throw new Error("Cannot specify both `message` and `error` params");
266
262
  t.error = t.message;
267
263
  }
@@ -343,13 +339,12 @@ function So(e, t) {
343
339
  return he(e, r);
344
340
  }
345
341
  function zo(e, t) {
346
- var n;
347
- if ((n = e._zod.def.checks) != null && n.length)
342
+ if (e._zod.def.checks?.length)
348
343
  throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
349
344
  const r = fe(e._zod.def, {
350
345
  get shape() {
351
- const o = { ...e._zod.def.shape, ...t._zod.def.shape };
352
- return we(this, "shape", o), o;
346
+ const n = { ...e._zod.def.shape, ...t._zod.def.shape };
347
+ return we(this, "shape", n), n;
353
348
  },
354
349
  get catchall() {
355
350
  return t._zod.def.catchall;
@@ -364,23 +359,23 @@ function Oo(e, t, r) {
364
359
  throw new Error(".partial() cannot be used on object schemas containing refinements");
365
360
  const i = fe(t._zod.def, {
366
361
  get shape() {
367
- const s = t._zod.def.shape, d = { ...s };
362
+ const s = t._zod.def.shape, l = { ...s };
368
363
  if (r)
369
364
  for (const u in r) {
370
365
  if (!(u in s))
371
366
  throw new Error(`Unrecognized key: "${u}"`);
372
- r[u] && (d[u] = e ? new e({
367
+ r[u] && (l[u] = e ? new e({
373
368
  type: "optional",
374
369
  innerType: s[u]
375
370
  }) : s[u]);
376
371
  }
377
372
  else
378
373
  for (const u in s)
379
- d[u] = e ? new e({
374
+ l[u] = e ? new e({
380
375
  type: "optional",
381
376
  innerType: s[u]
382
377
  }) : s[u];
383
- return we(this, "shape", d), d;
378
+ return we(this, "shape", l), l;
384
379
  },
385
380
  checks: []
386
381
  });
@@ -411,20 +406,18 @@ function $o(e, t, r) {
411
406
  return he(t, n);
412
407
  }
413
408
  function ze(e, t = 0) {
414
- var r;
415
409
  if (e.aborted === !0)
416
410
  return !0;
417
- for (let n = t; n < e.issues.length; n++)
418
- if (((r = e.issues[n]) == null ? void 0 : r.continue) !== !0)
411
+ for (let r = t; r < e.issues.length; r++)
412
+ if (e.issues[r]?.continue !== !0)
419
413
  return !0;
420
414
  return !1;
421
415
  }
422
416
  function ko(e, t = 0) {
423
- var r;
424
417
  if (e.aborted === !0)
425
418
  return !0;
426
- for (let n = t; n < e.issues.length; n++)
427
- if (((r = e.issues[n]) == null ? void 0 : r.continue) === !1)
419
+ for (let r = t; r < e.issues.length; r++)
420
+ if (e.issues[r]?.continue === !1)
428
421
  return !0;
429
422
  return !1;
430
423
  }
@@ -435,12 +428,11 @@ function Oe(e, t) {
435
428
  });
436
429
  }
437
430
  function We(e) {
438
- return typeof e == "string" ? e : e == null ? void 0 : e.message;
431
+ return typeof e == "string" ? e : e?.message;
439
432
  }
440
433
  function ue(e, t, r) {
441
- var d, u, l, p, h, f;
442
- const n = e.message ? e.message : We((l = (u = (d = e.inst) == null ? void 0 : d._zod.def) == null ? void 0 : u.error) == null ? void 0 : l.call(u, e)) ?? We((p = t == null ? void 0 : t.error) == null ? void 0 : p.call(t, e)) ?? We((h = r.customError) == null ? void 0 : h.call(r, e)) ?? We((f = r.localeError) == null ? void 0 : f.call(r, e)) ?? "Invalid input", { inst: o, continue: a, input: i, ...s } = e;
443
- return s.path ?? (s.path = []), s.message = n, t != null && t.reportInput && (s.input = i), s;
434
+ const n = e.message ? e.message : We(e.inst?._zod.def?.error?.(e)) ?? We(t?.error?.(e)) ?? We(r.customError?.(e)) ?? We(r.localeError?.(e)) ?? "Invalid input", { inst: o, continue: a, input: i, ...s } = e;
435
+ return s.path ?? (s.path = []), s.message = n, t?.reportInput && (s.input = i), s;
444
436
  }
445
437
  function kt(e) {
446
438
  return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
@@ -465,7 +457,7 @@ const Vr = (e, t) => {
465
457
  value: () => e.message,
466
458
  enumerable: !1
467
459
  });
468
- }, Br = m("$ZodError", Vr), Wr = m("$ZodError", Vr, { Parent: Error });
460
+ }, Br = f("$ZodError", Vr), Wr = f("$ZodError", Vr, { Parent: Error });
469
461
  function To(e, t = (r) => r.message) {
470
462
  const r = {}, n = [];
471
463
  for (const o of e.issues)
@@ -486,10 +478,10 @@ function Zo(e, t = (r) => r.message) {
486
478
  if (s.length === 0)
487
479
  r._errors.push(t(i));
488
480
  else {
489
- let d = r, u = 0;
481
+ let l = r, u = 0;
490
482
  for (; u < s.length; ) {
491
- const l = s[u];
492
- u === s.length - 1 ? (d[l] = d[l] || { _errors: [] }, d[l]._errors.push(t(i))) : d[l] = d[l] || { _errors: [] }, d = d[l], u++;
483
+ const d = s[u];
484
+ u === s.length - 1 ? (l[d] = l[d] || { _errors: [] }, l[d]._errors.push(t(i))) : l[d] = l[d] || { _errors: [] }, l = l[d], u++;
493
485
  }
494
486
  }
495
487
  }
@@ -501,16 +493,16 @@ const Tt = (e) => (t, r, n, o) => {
501
493
  if (i instanceof Promise)
502
494
  throw new ke();
503
495
  if (i.issues.length) {
504
- const s = new ((o == null ? void 0 : o.Err) ?? e)(i.issues.map((d) => ue(d, a, ie())));
505
- throw Fr(s, o == null ? void 0 : o.callee), s;
496
+ const s = new (o?.Err ?? e)(i.issues.map((l) => ue(l, a, ie())));
497
+ throw Fr(s, o?.callee), s;
506
498
  }
507
499
  return i.value;
508
500
  }, Zt = (e) => async (t, r, n, o) => {
509
501
  const a = n ? { ...n, async: !0 } : { async: !0 };
510
502
  let i = t._zod.run({ value: r, issues: [] }, a);
511
503
  if (i instanceof Promise && (i = await i), i.issues.length) {
512
- const s = new ((o == null ? void 0 : o.Err) ?? e)(i.issues.map((d) => ue(d, a, ie())));
513
- throw Fr(s, o == null ? void 0 : o.callee), s;
504
+ const s = new (o?.Err ?? e)(i.issues.map((l) => ue(l, a, ie())));
505
+ throw Fr(s, o?.callee), s;
514
506
  }
515
507
  return i.value;
516
508
  }, ot = (e) => (t, r, n) => {
@@ -559,16 +551,16 @@ function ia(e) {
559
551
  return new RegExp(`^${Gr}T(?:${n})$`);
560
552
  }
561
553
  const ua = (e) => {
562
- const t = e ? `[\\s\\S]{${(e == null ? void 0 : e.minimum) ?? 0},${(e == null ? void 0 : e.maximum) ?? ""}}` : "[\\s\\S]*";
554
+ const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
563
555
  return new RegExp(`^${t}$`);
564
- }, ca = /^-?\d+$/, Hr = /^-?\d+(?:\.\d+)?$/, la = /^(?:true|false)$/i, da = /^null$/i, pa = /^[^A-Z]*$/, fa = /^[^a-z]*$/, Y = /* @__PURE__ */ m("$ZodCheck", (e, t) => {
556
+ }, ca = /^-?\d+$/, Hr = /^-?\d+(?:\.\d+)?$/, la = /^(?:true|false)$/i, da = /^null$/i, pa = /^[^A-Z]*$/, fa = /^[^a-z]*$/, Y = /* @__PURE__ */ f("$ZodCheck", (e, t) => {
565
557
  var r;
566
558
  e._zod ?? (e._zod = {}), e._zod.def = t, (r = e._zod).onattach ?? (r.onattach = []);
567
559
  }), Xr = {
568
560
  number: "number",
569
561
  bigint: "bigint",
570
562
  object: "date"
571
- }, Kr = /* @__PURE__ */ m("$ZodCheckLessThan", (e, t) => {
563
+ }, Kr = /* @__PURE__ */ f("$ZodCheckLessThan", (e, t) => {
572
564
  Y.init(e, t);
573
565
  const r = Xr[typeof t.value];
574
566
  e._zod.onattach.push((n) => {
@@ -585,7 +577,7 @@ const ua = (e) => {
585
577
  continue: !t.abort
586
578
  });
587
579
  };
588
- }), Qr = /* @__PURE__ */ m("$ZodCheckGreaterThan", (e, t) => {
580
+ }), Qr = /* @__PURE__ */ f("$ZodCheckGreaterThan", (e, t) => {
589
581
  Y.init(e, t);
590
582
  const r = Xr[typeof t.value];
591
583
  e._zod.onattach.push((n) => {
@@ -602,7 +594,7 @@ const ua = (e) => {
602
594
  continue: !t.abort
603
595
  });
604
596
  };
605
- }), ha = /* @__PURE__ */ m("$ZodCheckMultipleOf", (e, t) => {
597
+ }), ha = /* @__PURE__ */ f("$ZodCheckMultipleOf", (e, t) => {
606
598
  Y.init(e, t), e._zod.onattach.push((r) => {
607
599
  var n;
608
600
  (n = r._zod.bag).multipleOf ?? (n.multipleOf = t.value);
@@ -618,30 +610,29 @@ const ua = (e) => {
618
610
  continue: !t.abort
619
611
  });
620
612
  };
621
- }), ma = /* @__PURE__ */ m("$ZodCheckNumberFormat", (e, t) => {
622
- var i;
613
+ }), ma = /* @__PURE__ */ f("$ZodCheckNumberFormat", (e, t) => {
623
614
  Y.init(e, t), t.format = t.format || "float64";
624
- const r = (i = t.format) == null ? void 0 : i.includes("int"), n = r ? "int" : "number", [o, a] = bo[t.format];
625
- e._zod.onattach.push((s) => {
626
- const d = s._zod.bag;
627
- d.format = t.format, d.minimum = o, d.maximum = a, r && (d.pattern = ca);
628
- }), e._zod.check = (s) => {
629
- const d = s.value;
615
+ const r = t.format?.includes("int"), n = r ? "int" : "number", [o, a] = bo[t.format];
616
+ e._zod.onattach.push((i) => {
617
+ const s = i._zod.bag;
618
+ s.format = t.format, s.minimum = o, s.maximum = a, r && (s.pattern = ca);
619
+ }), e._zod.check = (i) => {
620
+ const s = i.value;
630
621
  if (r) {
631
- if (!Number.isInteger(d)) {
632
- s.issues.push({
622
+ if (!Number.isInteger(s)) {
623
+ i.issues.push({
633
624
  expected: n,
634
625
  format: t.format,
635
626
  code: "invalid_type",
636
627
  continue: !1,
637
- input: d,
628
+ input: s,
638
629
  inst: e
639
630
  });
640
631
  return;
641
632
  }
642
- if (!Number.isSafeInteger(d)) {
643
- d > 0 ? s.issues.push({
644
- input: d,
633
+ if (!Number.isSafeInteger(s)) {
634
+ s > 0 ? i.issues.push({
635
+ input: s,
645
636
  code: "too_big",
646
637
  maximum: Number.MAX_SAFE_INTEGER,
647
638
  note: "Integers must be within the safe integer range.",
@@ -649,8 +640,8 @@ const ua = (e) => {
649
640
  origin: n,
650
641
  inclusive: !0,
651
642
  continue: !t.abort
652
- }) : s.issues.push({
653
- input: d,
643
+ }) : i.issues.push({
644
+ input: s,
654
645
  code: "too_small",
655
646
  minimum: Number.MIN_SAFE_INTEGER,
656
647
  note: "Integers must be within the safe integer range.",
@@ -662,17 +653,17 @@ const ua = (e) => {
662
653
  return;
663
654
  }
664
655
  }
665
- d < o && s.issues.push({
656
+ s < o && i.issues.push({
666
657
  origin: "number",
667
- input: d,
658
+ input: s,
668
659
  code: "too_small",
669
660
  minimum: o,
670
661
  inclusive: !0,
671
662
  inst: e,
672
663
  continue: !t.abort
673
- }), d > a && s.issues.push({
664
+ }), s > a && i.issues.push({
674
665
  origin: "number",
675
- input: d,
666
+ input: s,
676
667
  code: "too_big",
677
668
  maximum: a,
678
669
  inclusive: !0,
@@ -680,7 +671,7 @@ const ua = (e) => {
680
671
  continue: !t.abort
681
672
  });
682
673
  };
683
- }), va = /* @__PURE__ */ m("$ZodCheckMaxLength", (e, t) => {
674
+ }), va = /* @__PURE__ */ f("$ZodCheckMaxLength", (e, t) => {
684
675
  var r;
685
676
  Y.init(e, t), (r = e._zod.def).when ?? (r.when = (n) => {
686
677
  const o = n.value;
@@ -703,7 +694,7 @@ const ua = (e) => {
703
694
  continue: !t.abort
704
695
  });
705
696
  };
706
- }), ga = /* @__PURE__ */ m("$ZodCheckMinLength", (e, t) => {
697
+ }), ga = /* @__PURE__ */ f("$ZodCheckMinLength", (e, t) => {
707
698
  var r;
708
699
  Y.init(e, t), (r = e._zod.def).when ?? (r.when = (n) => {
709
700
  const o = n.value;
@@ -726,7 +717,7 @@ const ua = (e) => {
726
717
  continue: !t.abort
727
718
  });
728
719
  };
729
- }), _a = /* @__PURE__ */ m("$ZodCheckLengthEquals", (e, t) => {
720
+ }), _a = /* @__PURE__ */ f("$ZodCheckLengthEquals", (e, t) => {
730
721
  var r;
731
722
  Y.init(e, t), (r = e._zod.def).when ?? (r.when = (n) => {
732
723
  const o = n.value;
@@ -749,7 +740,7 @@ const ua = (e) => {
749
740
  continue: !t.abort
750
741
  });
751
742
  };
752
- }), st = /* @__PURE__ */ m("$ZodCheckStringFormat", (e, t) => {
743
+ }), st = /* @__PURE__ */ f("$ZodCheckStringFormat", (e, t) => {
753
744
  var r, n;
754
745
  Y.init(e, t), e._zod.onattach.push((o) => {
755
746
  const a = o._zod.bag;
@@ -766,7 +757,7 @@ const ua = (e) => {
766
757
  });
767
758
  }) : (n = e._zod).check ?? (n.check = () => {
768
759
  });
769
- }), ya = /* @__PURE__ */ m("$ZodCheckRegex", (e, t) => {
760
+ }), ya = /* @__PURE__ */ f("$ZodCheckRegex", (e, t) => {
770
761
  st.init(e, t), e._zod.check = (r) => {
771
762
  t.pattern.lastIndex = 0, !t.pattern.test(r.value) && r.issues.push({
772
763
  origin: "string",
@@ -778,11 +769,11 @@ const ua = (e) => {
778
769
  continue: !t.abort
779
770
  });
780
771
  };
781
- }), ba = /* @__PURE__ */ m("$ZodCheckLowerCase", (e, t) => {
772
+ }), ba = /* @__PURE__ */ f("$ZodCheckLowerCase", (e, t) => {
782
773
  t.pattern ?? (t.pattern = pa), st.init(e, t);
783
- }), wa = /* @__PURE__ */ m("$ZodCheckUpperCase", (e, t) => {
774
+ }), wa = /* @__PURE__ */ f("$ZodCheckUpperCase", (e, t) => {
784
775
  t.pattern ?? (t.pattern = fa), st.init(e, t);
785
- }), Ia = /* @__PURE__ */ m("$ZodCheckIncludes", (e, t) => {
776
+ }), Ia = /* @__PURE__ */ f("$ZodCheckIncludes", (e, t) => {
786
777
  Y.init(e, t);
787
778
  const r = Ae(t.includes), n = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${r}` : r);
788
779
  t.pattern = n, e._zod.onattach.push((o) => {
@@ -799,7 +790,7 @@ const ua = (e) => {
799
790
  continue: !t.abort
800
791
  });
801
792
  };
802
- }), Ea = /* @__PURE__ */ m("$ZodCheckStartsWith", (e, t) => {
793
+ }), Ea = /* @__PURE__ */ f("$ZodCheckStartsWith", (e, t) => {
803
794
  Y.init(e, t);
804
795
  const r = new RegExp(`^${Ae(t.prefix)}.*`);
805
796
  t.pattern ?? (t.pattern = r), e._zod.onattach.push((n) => {
@@ -816,7 +807,7 @@ const ua = (e) => {
816
807
  continue: !t.abort
817
808
  });
818
809
  };
819
- }), Sa = /* @__PURE__ */ m("$ZodCheckEndsWith", (e, t) => {
810
+ }), Sa = /* @__PURE__ */ f("$ZodCheckEndsWith", (e, t) => {
820
811
  Y.init(e, t);
821
812
  const r = new RegExp(`.*${Ae(t.suffix)}$`);
822
813
  t.pattern ?? (t.pattern = r), e._zod.onattach.push((n) => {
@@ -833,7 +824,7 @@ const ua = (e) => {
833
824
  continue: !t.abort
834
825
  });
835
826
  };
836
- }), za = /* @__PURE__ */ m("$ZodCheckOverwrite", (e, t) => {
827
+ }), za = /* @__PURE__ */ f("$ZodCheckOverwrite", (e, t) => {
837
828
  Y.init(e, t), e._zod.check = (r) => {
838
829
  r.value = t.tx(r.value);
839
830
  };
@@ -856,7 +847,7 @@ class Oa {
856
847
  this.content.push(i);
857
848
  }
858
849
  compile() {
859
- const t = Function, r = this == null ? void 0 : this.args, o = [...((this == null ? void 0 : this.content) ?? [""]).map((a) => ` ${a}`)];
850
+ const t = Function, r = this?.args, o = [...(this?.content ?? [""]).map((a) => ` ${a}`)];
860
851
  return new t(...r, o.join(`
861
852
  `));
862
853
  }
@@ -865,105 +856,99 @@ const $a = {
865
856
  major: 4,
866
857
  minor: 4,
867
858
  patch: 3
868
- }, L = /* @__PURE__ */ m("$ZodType", (e, t) => {
869
- var o;
859
+ }, L = /* @__PURE__ */ f("$ZodType", (e, t) => {
870
860
  var r;
871
861
  e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = $a;
872
862
  const n = [...e._zod.def.checks ?? []];
873
863
  e._zod.traits.has("$ZodCheck") && n.unshift(e);
874
- for (const a of n)
875
- for (const i of a._zod.onattach)
876
- i(e);
864
+ for (const o of n)
865
+ for (const a of o._zod.onattach)
866
+ a(e);
877
867
  if (n.length === 0)
878
- (r = e._zod).deferred ?? (r.deferred = []), (o = e._zod.deferred) == null || o.push(() => {
868
+ (r = e._zod).deferred ?? (r.deferred = []), e._zod.deferred?.push(() => {
879
869
  e._zod.run = e._zod.parse;
880
870
  });
881
871
  else {
882
- const a = (s, d, u) => {
883
- let l = ze(s), p;
884
- for (const h of d) {
885
- if (h._zod.def.when) {
886
- if (ko(s) || !h._zod.def.when(s))
872
+ const o = (i, s, l) => {
873
+ let u = ze(i), d;
874
+ for (const p of s) {
875
+ if (p._zod.def.when) {
876
+ if (ko(i) || !p._zod.def.when(i))
887
877
  continue;
888
- } else if (l)
878
+ } else if (u)
889
879
  continue;
890
- const f = s.issues.length, z = h._zod.check(s);
891
- if (z instanceof Promise && (u == null ? void 0 : u.async) === !1)
880
+ const m = i.issues.length, h = p._zod.check(i);
881
+ if (h instanceof Promise && l?.async === !1)
892
882
  throw new ke();
893
- if (p || z instanceof Promise)
894
- p = (p ?? Promise.resolve()).then(async () => {
895
- await z, s.issues.length !== f && (l || (l = ze(s, f)));
883
+ if (d || h instanceof Promise)
884
+ d = (d ?? Promise.resolve()).then(async () => {
885
+ await h, i.issues.length !== m && (u || (u = ze(i, m)));
896
886
  });
897
887
  else {
898
- if (s.issues.length === f)
888
+ if (i.issues.length === m)
899
889
  continue;
900
- l || (l = ze(s, f));
890
+ u || (u = ze(i, m));
901
891
  }
902
892
  }
903
- return p ? p.then(() => s) : s;
904
- }, i = (s, d, u) => {
905
- if (ze(s))
906
- return s.aborted = !0, s;
907
- const l = a(d, n, u);
908
- if (l instanceof Promise) {
909
- if (u.async === !1)
893
+ return d ? d.then(() => i) : i;
894
+ }, a = (i, s, l) => {
895
+ if (ze(i))
896
+ return i.aborted = !0, i;
897
+ const u = o(s, n, l);
898
+ if (u instanceof Promise) {
899
+ if (l.async === !1)
910
900
  throw new ke();
911
- return l.then((p) => e._zod.parse(p, u));
901
+ return u.then((d) => e._zod.parse(d, l));
912
902
  }
913
- return e._zod.parse(l, u);
903
+ return e._zod.parse(u, l);
914
904
  };
915
- e._zod.run = (s, d) => {
916
- if (d.skipChecks)
917
- return e._zod.parse(s, d);
918
- if (d.direction === "backward") {
919
- const l = e._zod.parse({ value: s.value, issues: [] }, { ...d, skipChecks: !0 });
920
- return l instanceof Promise ? l.then((p) => i(p, s, d)) : i(l, s, d);
905
+ e._zod.run = (i, s) => {
906
+ if (s.skipChecks)
907
+ return e._zod.parse(i, s);
908
+ if (s.direction === "backward") {
909
+ const u = e._zod.parse({ value: i.value, issues: [] }, { ...s, skipChecks: !0 });
910
+ return u instanceof Promise ? u.then((d) => a(d, i, s)) : a(u, i, s);
921
911
  }
922
- const u = e._zod.parse(s, d);
923
- if (u instanceof Promise) {
924
- if (d.async === !1)
912
+ const l = e._zod.parse(i, s);
913
+ if (l instanceof Promise) {
914
+ if (s.async === !1)
925
915
  throw new ke();
926
- return u.then((l) => a(l, n, d));
916
+ return l.then((u) => o(u, n, s));
927
917
  }
928
- return a(u, n, d);
918
+ return o(l, n, s);
929
919
  };
930
920
  }
931
- N(e, "~standard", () => ({
932
- validate: (a) => {
933
- var i;
921
+ M(e, "~standard", () => ({
922
+ validate: (o) => {
934
923
  try {
935
- const s = Ao(e, a);
936
- return s.success ? { value: s.data } : { issues: (i = s.error) == null ? void 0 : i.issues };
924
+ const a = Ao(e, o);
925
+ return a.success ? { value: a.data } : { issues: a.error?.issues };
937
926
  } catch {
938
- return No(e, a).then((d) => {
939
- var u;
940
- return d.success ? { value: d.data } : { issues: (u = d.error) == null ? void 0 : u.issues };
941
- });
927
+ return No(e, o).then((i) => i.success ? { value: i.data } : { issues: i.error?.issues });
942
928
  }
943
929
  },
944
930
  vendor: "zod",
945
931
  version: 1
946
932
  }));
947
- }), At = /* @__PURE__ */ m("$ZodString", (e, t) => {
948
- var r;
949
- L.init(e, t), e._zod.pattern = [...((r = e == null ? void 0 : e._zod.bag) == null ? void 0 : r.patterns) ?? []].pop() ?? ua(e._zod.bag), e._zod.parse = (n, o) => {
933
+ }), At = /* @__PURE__ */ f("$ZodString", (e, t) => {
934
+ L.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? ua(e._zod.bag), e._zod.parse = (r, n) => {
950
935
  if (t.coerce)
951
936
  try {
952
- n.value = String(n.value);
937
+ r.value = String(r.value);
953
938
  } catch {
954
939
  }
955
- return typeof n.value == "string" || n.issues.push({
940
+ return typeof r.value == "string" || r.issues.push({
956
941
  expected: "string",
957
942
  code: "invalid_type",
958
- input: n.value,
943
+ input: r.value,
959
944
  inst: e
960
- }), n;
945
+ }), r;
961
946
  };
962
- }), F = /* @__PURE__ */ m("$ZodStringFormat", (e, t) => {
947
+ }), F = /* @__PURE__ */ f("$ZodStringFormat", (e, t) => {
963
948
  st.init(e, t), At.init(e, t);
964
- }), ka = /* @__PURE__ */ m("$ZodGUID", (e, t) => {
949
+ }), ka = /* @__PURE__ */ f("$ZodGUID", (e, t) => {
965
950
  t.pattern ?? (t.pattern = Go), F.init(e, t);
966
- }), Ta = /* @__PURE__ */ m("$ZodUUID", (e, t) => {
951
+ }), Ta = /* @__PURE__ */ f("$ZodUUID", (e, t) => {
967
952
  if (t.version) {
968
953
  const n = {
969
954
  v1: 1,
@@ -981,14 +966,13 @@ const $a = {
981
966
  } else
982
967
  t.pattern ?? (t.pattern = Qt());
983
968
  F.init(e, t);
984
- }), Za = /* @__PURE__ */ m("$ZodEmail", (e, t) => {
969
+ }), Za = /* @__PURE__ */ f("$ZodEmail", (e, t) => {
985
970
  t.pattern ?? (t.pattern = Yo), F.init(e, t);
986
- }), Aa = /* @__PURE__ */ m("$ZodURL", (e, t) => {
971
+ }), Aa = /* @__PURE__ */ f("$ZodURL", (e, t) => {
987
972
  F.init(e, t), e._zod.check = (r) => {
988
- var n;
989
973
  try {
990
- const o = r.value.trim();
991
- if (!t.normalize && ((n = t.protocol) == null ? void 0 : n.source) === na.source && !/^https?:\/\//i.test(o)) {
974
+ const n = r.value.trim();
975
+ if (!t.normalize && t.protocol?.source === na.source && !/^https?:\/\//i.test(n)) {
992
976
  r.issues.push({
993
977
  code: "invalid_format",
994
978
  format: "url",
@@ -999,8 +983,8 @@ const $a = {
999
983
  });
1000
984
  return;
1001
985
  }
1002
- const a = new URL(o);
1003
- t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(a.hostname) || r.issues.push({
986
+ const o = new URL(n);
987
+ t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(o.hostname) || r.issues.push({
1004
988
  code: "invalid_format",
1005
989
  format: "url",
1006
990
  note: "Invalid hostname",
@@ -1008,7 +992,7 @@ const $a = {
1008
992
  input: r.value,
1009
993
  inst: e,
1010
994
  continue: !t.abort
1011
- })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(a.protocol.endsWith(":") ? a.protocol.slice(0, -1) : a.protocol) || r.issues.push({
995
+ })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(o.protocol.endsWith(":") ? o.protocol.slice(0, -1) : o.protocol) || r.issues.push({
1012
996
  code: "invalid_format",
1013
997
  format: "url",
1014
998
  note: "Invalid protocol",
@@ -1016,7 +1000,7 @@ const $a = {
1016
1000
  input: r.value,
1017
1001
  inst: e,
1018
1002
  continue: !t.abort
1019
- })), t.normalize ? r.value = a.href : r.value = o;
1003
+ })), t.normalize ? r.value = o.href : r.value = n;
1020
1004
  return;
1021
1005
  } catch {
1022
1006
  r.issues.push({
@@ -1028,31 +1012,31 @@ const $a = {
1028
1012
  });
1029
1013
  }
1030
1014
  };
1031
- }), Na = /* @__PURE__ */ m("$ZodEmoji", (e, t) => {
1015
+ }), Na = /* @__PURE__ */ f("$ZodEmoji", (e, t) => {
1032
1016
  t.pattern ?? (t.pattern = Xo()), F.init(e, t);
1033
- }), Pa = /* @__PURE__ */ m("$ZodNanoID", (e, t) => {
1017
+ }), Pa = /* @__PURE__ */ f("$ZodNanoID", (e, t) => {
1034
1018
  t.pattern ?? (t.pattern = Wo), F.init(e, t);
1035
- }), Ma = /* @__PURE__ */ m("$ZodCUID", (e, t) => {
1019
+ }), Ma = /* @__PURE__ */ f("$ZodCUID", (e, t) => {
1036
1020
  t.pattern ?? (t.pattern = Uo), F.init(e, t);
1037
- }), Ra = /* @__PURE__ */ m("$ZodCUID2", (e, t) => {
1021
+ }), Ra = /* @__PURE__ */ f("$ZodCUID2", (e, t) => {
1038
1022
  t.pattern ?? (t.pattern = Fo), F.init(e, t);
1039
- }), Ca = /* @__PURE__ */ m("$ZodULID", (e, t) => {
1023
+ }), Ca = /* @__PURE__ */ f("$ZodULID", (e, t) => {
1040
1024
  t.pattern ?? (t.pattern = Jo), F.init(e, t);
1041
- }), xa = /* @__PURE__ */ m("$ZodXID", (e, t) => {
1025
+ }), xa = /* @__PURE__ */ f("$ZodXID", (e, t) => {
1042
1026
  t.pattern ?? (t.pattern = Vo), F.init(e, t);
1043
- }), ja = /* @__PURE__ */ m("$ZodKSUID", (e, t) => {
1027
+ }), ja = /* @__PURE__ */ f("$ZodKSUID", (e, t) => {
1044
1028
  t.pattern ?? (t.pattern = Bo), F.init(e, t);
1045
- }), Da = /* @__PURE__ */ m("$ZodISODateTime", (e, t) => {
1029
+ }), Da = /* @__PURE__ */ f("$ZodISODateTime", (e, t) => {
1046
1030
  t.pattern ?? (t.pattern = ia(t)), F.init(e, t);
1047
- }), La = /* @__PURE__ */ m("$ZodISODate", (e, t) => {
1031
+ }), La = /* @__PURE__ */ f("$ZodISODate", (e, t) => {
1048
1032
  t.pattern ?? (t.pattern = aa), F.init(e, t);
1049
- }), Ua = /* @__PURE__ */ m("$ZodISOTime", (e, t) => {
1033
+ }), Ua = /* @__PURE__ */ f("$ZodISOTime", (e, t) => {
1050
1034
  t.pattern ?? (t.pattern = sa(t)), F.init(e, t);
1051
- }), Fa = /* @__PURE__ */ m("$ZodISODuration", (e, t) => {
1035
+ }), Fa = /* @__PURE__ */ f("$ZodISODuration", (e, t) => {
1052
1036
  t.pattern ?? (t.pattern = qo), F.init(e, t);
1053
- }), Ja = /* @__PURE__ */ m("$ZodIPv4", (e, t) => {
1037
+ }), Ja = /* @__PURE__ */ f("$ZodIPv4", (e, t) => {
1054
1038
  t.pattern ?? (t.pattern = Ko), F.init(e, t), e._zod.bag.format = "ipv4";
1055
- }), Va = /* @__PURE__ */ m("$ZodIPv6", (e, t) => {
1039
+ }), Va = /* @__PURE__ */ f("$ZodIPv6", (e, t) => {
1056
1040
  t.pattern ?? (t.pattern = Qo), F.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (r) => {
1057
1041
  try {
1058
1042
  new URL(`http://[${r.value}]`);
@@ -1066,9 +1050,9 @@ const $a = {
1066
1050
  });
1067
1051
  }
1068
1052
  };
1069
- }), Ba = /* @__PURE__ */ m("$ZodCIDRv4", (e, t) => {
1053
+ }), Ba = /* @__PURE__ */ f("$ZodCIDRv4", (e, t) => {
1070
1054
  t.pattern ?? (t.pattern = ea), F.init(e, t);
1071
- }), Wa = /* @__PURE__ */ m("$ZodCIDRv6", (e, t) => {
1055
+ }), Wa = /* @__PURE__ */ f("$ZodCIDRv6", (e, t) => {
1072
1056
  t.pattern ?? (t.pattern = ta), F.init(e, t), e._zod.check = (r) => {
1073
1057
  const n = r.value.split("/");
1074
1058
  try {
@@ -1105,7 +1089,7 @@ function en(e) {
1105
1089
  return !1;
1106
1090
  }
1107
1091
  }
1108
- const qa = /* @__PURE__ */ m("$ZodBase64", (e, t) => {
1092
+ const qa = /* @__PURE__ */ f("$ZodBase64", (e, t) => {
1109
1093
  t.pattern ?? (t.pattern = ra), F.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (r) => {
1110
1094
  en(r.value) || r.issues.push({
1111
1095
  code: "invalid_format",
@@ -1122,7 +1106,7 @@ function Ga(e) {
1122
1106
  const t = e.replace(/[-_]/g, (n) => n === "-" ? "+" : "/"), r = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
1123
1107
  return en(r);
1124
1108
  }
1125
- const Ya = /* @__PURE__ */ m("$ZodBase64URL", (e, t) => {
1109
+ const Ya = /* @__PURE__ */ f("$ZodBase64URL", (e, t) => {
1126
1110
  t.pattern ?? (t.pattern = qr), F.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (r) => {
1127
1111
  Ga(r.value) || r.issues.push({
1128
1112
  code: "invalid_format",
@@ -1132,7 +1116,7 @@ const Ya = /* @__PURE__ */ m("$ZodBase64URL", (e, t) => {
1132
1116
  continue: !t.abort
1133
1117
  });
1134
1118
  };
1135
- }), Ha = /* @__PURE__ */ m("$ZodE164", (e, t) => {
1119
+ }), Ha = /* @__PURE__ */ f("$ZodE164", (e, t) => {
1136
1120
  t.pattern ?? (t.pattern = oa), F.init(e, t);
1137
1121
  });
1138
1122
  function Xa(e, t = null) {
@@ -1144,12 +1128,12 @@ function Xa(e, t = null) {
1144
1128
  if (!n)
1145
1129
  return !1;
1146
1130
  const o = JSON.parse(atob(n));
1147
- return !("typ" in o && (o == null ? void 0 : o.typ) !== "JWT" || !o.alg || t && (!("alg" in o) || o.alg !== t));
1131
+ return !("typ" in o && o?.typ !== "JWT" || !o.alg || t && (!("alg" in o) || o.alg !== t));
1148
1132
  } catch {
1149
1133
  return !1;
1150
1134
  }
1151
1135
  }
1152
- const Ka = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1136
+ const Ka = /* @__PURE__ */ f("$ZodJWT", (e, t) => {
1153
1137
  F.init(e, t), e._zod.check = (r) => {
1154
1138
  Xa(r.value, t.alg) || r.issues.push({
1155
1139
  code: "invalid_format",
@@ -1159,7 +1143,7 @@ const Ka = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1159
1143
  continue: !t.abort
1160
1144
  });
1161
1145
  };
1162
- }), tn = /* @__PURE__ */ m("$ZodNumber", (e, t) => {
1146
+ }), tn = /* @__PURE__ */ f("$ZodNumber", (e, t) => {
1163
1147
  L.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? Hr, e._zod.parse = (r, n) => {
1164
1148
  if (t.coerce)
1165
1149
  try {
@@ -1178,9 +1162,9 @@ const Ka = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1178
1162
  ...a ? { received: a } : {}
1179
1163
  }), r;
1180
1164
  };
1181
- }), Qa = /* @__PURE__ */ m("$ZodNumberFormat", (e, t) => {
1165
+ }), Qa = /* @__PURE__ */ f("$ZodNumberFormat", (e, t) => {
1182
1166
  ma.init(e, t), tn.init(e, t);
1183
- }), es = /* @__PURE__ */ m("$ZodBoolean", (e, t) => {
1167
+ }), es = /* @__PURE__ */ f("$ZodBoolean", (e, t) => {
1184
1168
  L.init(e, t), e._zod.pattern = la, e._zod.parse = (r, n) => {
1185
1169
  if (t.coerce)
1186
1170
  try {
@@ -1195,7 +1179,7 @@ const Ka = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1195
1179
  inst: e
1196
1180
  }), r;
1197
1181
  };
1198
- }), ts = /* @__PURE__ */ m("$ZodNull", (e, t) => {
1182
+ }), ts = /* @__PURE__ */ f("$ZodNull", (e, t) => {
1199
1183
  L.init(e, t), e._zod.pattern = da, e._zod.values = /* @__PURE__ */ new Set([null]), e._zod.parse = (r, n) => {
1200
1184
  const o = r.value;
1201
1185
  return o === null || r.issues.push({
@@ -1205,9 +1189,9 @@ const Ka = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1205
1189
  inst: e
1206
1190
  }), r;
1207
1191
  };
1208
- }), rs = /* @__PURE__ */ m("$ZodUnknown", (e, t) => {
1192
+ }), rs = /* @__PURE__ */ f("$ZodUnknown", (e, t) => {
1209
1193
  L.init(e, t), e._zod.parse = (r) => r;
1210
- }), ns = /* @__PURE__ */ m("$ZodNever", (e, t) => {
1194
+ }), ns = /* @__PURE__ */ f("$ZodNever", (e, t) => {
1211
1195
  L.init(e, t), e._zod.parse = (r, n) => (r.issues.push({
1212
1196
  expected: "never",
1213
1197
  code: "invalid_type",
@@ -1218,7 +1202,7 @@ const Ka = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1218
1202
  function er(e, t, r) {
1219
1203
  e.issues.length && t.issues.push(...Oe(r, e.issues)), t.value[r] = e.value;
1220
1204
  }
1221
- const os = /* @__PURE__ */ m("$ZodArray", (e, t) => {
1205
+ const os = /* @__PURE__ */ f("$ZodArray", (e, t) => {
1222
1206
  L.init(e, t), e._zod.parse = (r, n) => {
1223
1207
  const o = r.value;
1224
1208
  if (!Array.isArray(o))
@@ -1231,11 +1215,11 @@ const os = /* @__PURE__ */ m("$ZodArray", (e, t) => {
1231
1215
  r.value = Array(o.length);
1232
1216
  const a = [];
1233
1217
  for (let i = 0; i < o.length; i++) {
1234
- const s = o[i], d = t.element._zod.run({
1218
+ const s = o[i], l = t.element._zod.run({
1235
1219
  value: s,
1236
1220
  issues: []
1237
1221
  }, n);
1238
- d instanceof Promise ? a.push(d.then((u) => er(u, r, i))) : er(d, r, i);
1222
+ l instanceof Promise ? a.push(l.then((u) => er(u, r, i))) : er(l, r, i);
1239
1223
  }
1240
1224
  return a.length ? Promise.all(a).then(() => r) : r;
1241
1225
  };
@@ -1259,11 +1243,10 @@ function Xe(e, t, r, n, o, a) {
1259
1243
  e.value === void 0 ? i && (t.value[r] = void 0) : t.value[r] = e.value;
1260
1244
  }
1261
1245
  function rn(e) {
1262
- var n, o, a, i;
1263
1246
  const t = Object.keys(e.shape);
1264
- for (const s of t)
1265
- if (!((i = (a = (o = (n = e.shape) == null ? void 0 : n[s]) == null ? void 0 : o._zod) == null ? void 0 : a.traits) != null && i.has("$ZodType")))
1266
- throw new Error(`Invalid element at key "${s}": expected a Zod schema`);
1247
+ for (const n of t)
1248
+ if (!e.shape?.[n]?._zod?.traits?.has("$ZodType"))
1249
+ throw new Error(`Invalid element at key "${n}": expected a Zod schema`);
1267
1250
  const r = yo(e.shape);
1268
1251
  return {
1269
1252
  ...e,
@@ -1274,16 +1257,16 @@ function rn(e) {
1274
1257
  };
1275
1258
  }
1276
1259
  function nn(e, t, r, n, o, a) {
1277
- const i = [], s = o.keySet, d = o.catchall._zod, u = d.def.type, l = d.optin === "optional", p = d.optout === "optional";
1278
- for (const h in t) {
1279
- if (h === "__proto__" || s.has(h))
1260
+ const i = [], s = o.keySet, l = o.catchall._zod, u = l.def.type, d = l.optin === "optional", p = l.optout === "optional";
1261
+ for (const m in t) {
1262
+ if (m === "__proto__" || s.has(m))
1280
1263
  continue;
1281
1264
  if (u === "never") {
1282
- i.push(h);
1265
+ i.push(m);
1283
1266
  continue;
1284
1267
  }
1285
- const f = d.run({ value: t[h], issues: [] }, n);
1286
- f instanceof Promise ? e.push(f.then((z) => Xe(z, r, h, t, l, p))) : Xe(f, r, h, t, l, p);
1268
+ const h = l.run({ value: t[m], issues: [] }, n);
1269
+ h instanceof Promise ? e.push(h.then((I) => Xe(I, r, m, t, d, p))) : Xe(h, r, m, t, d, p);
1287
1270
  }
1288
1271
  return i.length && r.issues.push({
1289
1272
  code: "unrecognized_keys",
@@ -1292,36 +1275,34 @@ function nn(e, t, r, n, o, a) {
1292
1275
  inst: a
1293
1276
  }), e.length ? Promise.all(e).then(() => r) : r;
1294
1277
  }
1295
- const as = /* @__PURE__ */ m("$ZodObject", (e, t) => {
1296
- L.init(e, t);
1297
- const r = Object.getOwnPropertyDescriptor(t, "shape");
1298
- if (!(r != null && r.get)) {
1278
+ const as = /* @__PURE__ */ f("$ZodObject", (e, t) => {
1279
+ if (L.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
1299
1280
  const s = t.shape;
1300
1281
  Object.defineProperty(t, "shape", {
1301
1282
  get: () => {
1302
- const d = { ...s };
1283
+ const l = { ...s };
1303
1284
  return Object.defineProperty(t, "shape", {
1304
- value: d
1305
- }), d;
1285
+ value: l
1286
+ }), l;
1306
1287
  }
1307
1288
  });
1308
1289
  }
1309
1290
  const n = nt(() => rn(t));
1310
- N(e._zod, "propValues", () => {
1311
- const s = t.shape, d = {};
1291
+ M(e._zod, "propValues", () => {
1292
+ const s = t.shape, l = {};
1312
1293
  for (const u in s) {
1313
- const l = s[u]._zod;
1314
- if (l.values) {
1315
- d[u] ?? (d[u] = /* @__PURE__ */ new Set());
1316
- for (const p of l.values)
1317
- d[u].add(p);
1294
+ const d = s[u]._zod;
1295
+ if (d.values) {
1296
+ l[u] ?? (l[u] = /* @__PURE__ */ new Set());
1297
+ for (const p of d.values)
1298
+ l[u].add(p);
1318
1299
  }
1319
1300
  }
1320
- return d;
1301
+ return l;
1321
1302
  });
1322
1303
  const o = Le, a = t.catchall;
1323
1304
  let i;
1324
- e._zod.parse = (s, d) => {
1305
+ e._zod.parse = (s, l) => {
1325
1306
  i ?? (i = n.value);
1326
1307
  const u = s.value;
1327
1308
  if (!o(u))
@@ -1332,72 +1313,71 @@ const as = /* @__PURE__ */ m("$ZodObject", (e, t) => {
1332
1313
  inst: e
1333
1314
  }), s;
1334
1315
  s.value = {};
1335
- const l = [], p = i.shape;
1336
- for (const h of i.keys) {
1337
- const f = p[h], z = f._zod.optin === "optional", S = f._zod.optout === "optional", I = f._zod.run({ value: u[h], issues: [] }, d);
1338
- I instanceof Promise ? l.push(I.then((y) => Xe(y, s, h, u, z, S))) : Xe(I, s, h, u, z, S);
1316
+ const d = [], p = i.shape;
1317
+ for (const m of i.keys) {
1318
+ const h = p[m], I = h._zod.optin === "optional", Z = h._zod.optout === "optional", _ = h._zod.run({ value: u[m], issues: [] }, l);
1319
+ _ instanceof Promise ? d.push(_.then((E) => Xe(E, s, m, u, I, Z))) : Xe(_, s, m, u, I, Z);
1339
1320
  }
1340
- return a ? nn(l, u, s, d, n.value, e) : l.length ? Promise.all(l).then(() => s) : s;
1321
+ return a ? nn(d, u, s, l, n.value, e) : d.length ? Promise.all(d).then(() => s) : s;
1341
1322
  };
1342
- }), ss = /* @__PURE__ */ m("$ZodObjectJIT", (e, t) => {
1323
+ }), ss = /* @__PURE__ */ f("$ZodObjectJIT", (e, t) => {
1343
1324
  as.init(e, t);
1344
- const r = e._zod.parse, n = nt(() => rn(t)), o = (h) => {
1345
- var M, x;
1346
- const f = new Oa(["shape", "payload", "ctx"]), z = n.value, S = (_) => {
1347
- const c = Kt(_);
1348
- return `shape[${c}]._zod.run({ value: input[${c}], issues: [] }, ctx)`;
1325
+ const r = e._zod.parse, n = nt(() => rn(t)), o = (m) => {
1326
+ const h = new Oa(["shape", "payload", "ctx"]), I = n.value, Z = (N) => {
1327
+ const P = Kt(N);
1328
+ return `shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`;
1349
1329
  };
1350
- f.write("const input = payload.value;");
1351
- const I = /* @__PURE__ */ Object.create(null);
1352
- let y = 0;
1353
- for (const _ of z.keys)
1354
- I[_] = `key_${y++}`;
1355
- f.write("const newResult = {};");
1356
- for (const _ of z.keys) {
1357
- const c = I[_], g = Kt(_), $ = h[_], Z = ((M = $ == null ? void 0 : $._zod) == null ? void 0 : M.optin) === "optional", O = ((x = $ == null ? void 0 : $._zod) == null ? void 0 : x.optout) === "optional";
1358
- f.write(`const ${c} = ${S(_)};`), Z && O ? f.write(`
1359
- if (${c}.issues.length) {
1330
+ h.write("const input = payload.value;");
1331
+ const _ = /* @__PURE__ */ Object.create(null);
1332
+ let E = 0;
1333
+ for (const N of I.keys)
1334
+ _[N] = `key_${E++}`;
1335
+ h.write("const newResult = {};");
1336
+ for (const N of I.keys) {
1337
+ const P = _[N], g = Kt(N), c = m[N], b = c?._zod?.optin === "optional", $ = c?._zod?.optout === "optional";
1338
+ h.write(`const ${P} = ${Z(N)};`), b && $ ? h.write(`
1339
+ if (${P}.issues.length) {
1360
1340
  if (${g} in input) {
1361
- payload.issues = payload.issues.concat(${c}.issues.map(iss => ({
1341
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
1362
1342
  ...iss,
1363
1343
  path: iss.path ? [${g}, ...iss.path] : [${g}]
1364
1344
  })));
1365
1345
  }
1366
1346
  }
1367
1347
 
1368
- if (${c}.value === undefined) {
1348
+ if (${P}.value === undefined) {
1369
1349
  if (${g} in input) {
1370
1350
  newResult[${g}] = undefined;
1371
1351
  }
1372
1352
  } else {
1373
- newResult[${g}] = ${c}.value;
1353
+ newResult[${g}] = ${P}.value;
1374
1354
  }
1375
1355
 
1376
- `) : Z ? f.write(`
1377
- if (${c}.issues.length) {
1378
- payload.issues = payload.issues.concat(${c}.issues.map(iss => ({
1356
+ `) : b ? h.write(`
1357
+ if (${P}.issues.length) {
1358
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
1379
1359
  ...iss,
1380
1360
  path: iss.path ? [${g}, ...iss.path] : [${g}]
1381
1361
  })));
1382
1362
  }
1383
1363
 
1384
- if (${c}.value === undefined) {
1364
+ if (${P}.value === undefined) {
1385
1365
  if (${g} in input) {
1386
1366
  newResult[${g}] = undefined;
1387
1367
  }
1388
1368
  } else {
1389
- newResult[${g}] = ${c}.value;
1369
+ newResult[${g}] = ${P}.value;
1390
1370
  }
1391
1371
 
1392
- `) : f.write(`
1393
- const ${c}_present = ${g} in input;
1394
- if (${c}.issues.length) {
1395
- payload.issues = payload.issues.concat(${c}.issues.map(iss => ({
1372
+ `) : h.write(`
1373
+ const ${P}_present = ${g} in input;
1374
+ if (${P}.issues.length) {
1375
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
1396
1376
  ...iss,
1397
1377
  path: iss.path ? [${g}, ...iss.path] : [${g}]
1398
1378
  })));
1399
1379
  }
1400
- if (!${c}_present && !${c}.issues.length) {
1380
+ if (!${P}_present && !${P}.issues.length) {
1401
1381
  payload.issues.push({
1402
1382
  code: "invalid_type",
1403
1383
  expected: "nonoptional",
@@ -1406,32 +1386,32 @@ const as = /* @__PURE__ */ m("$ZodObject", (e, t) => {
1406
1386
  });
1407
1387
  }
1408
1388
 
1409
- if (${c}_present) {
1410
- if (${c}.value === undefined) {
1389
+ if (${P}_present) {
1390
+ if (${P}.value === undefined) {
1411
1391
  newResult[${g}] = undefined;
1412
1392
  } else {
1413
- newResult[${g}] = ${c}.value;
1393
+ newResult[${g}] = ${P}.value;
1414
1394
  }
1415
1395
  }
1416
1396
 
1417
1397
  `);
1418
1398
  }
1419
- f.write("payload.value = newResult;"), f.write("return payload;");
1420
- const E = f.compile();
1421
- return (_, c) => E(h, _, c);
1399
+ h.write("payload.value = newResult;"), h.write("return payload;");
1400
+ const k = h.compile();
1401
+ return (N, P) => k(m, N, P);
1422
1402
  };
1423
1403
  let a;
1424
- const i = Le, s = !zt.jitless, u = s && go.value, l = t.catchall;
1404
+ const i = Le, s = !zt.jitless, u = s && go.value, d = t.catchall;
1425
1405
  let p;
1426
- e._zod.parse = (h, f) => {
1406
+ e._zod.parse = (m, h) => {
1427
1407
  p ?? (p = n.value);
1428
- const z = h.value;
1429
- return i(z) ? s && u && (f == null ? void 0 : f.async) === !1 && f.jitless !== !0 ? (a || (a = o(t.shape)), h = a(h, f), l ? nn([], z, h, f, p, e) : h) : r(h, f) : (h.issues.push({
1408
+ const I = m.value;
1409
+ return i(I) ? s && u && h?.async === !1 && h.jitless !== !0 ? (a || (a = o(t.shape)), m = a(m, h), d ? nn([], I, m, h, p, e) : m) : r(m, h) : (m.issues.push({
1430
1410
  expected: "object",
1431
1411
  code: "invalid_type",
1432
- input: z,
1412
+ input: I,
1433
1413
  inst: e
1434
- }), h);
1414
+ }), m);
1435
1415
  };
1436
1416
  });
1437
1417
  function tr(e, t, r, n) {
@@ -1446,11 +1426,11 @@ function tr(e, t, r, n) {
1446
1426
  errors: e.map((a) => a.issues.map((i) => ue(i, n, ie())))
1447
1427
  }), t);
1448
1428
  }
1449
- const on = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
1450
- L.init(e, t), N(e._zod, "optin", () => t.options.some((n) => n._zod.optin === "optional") ? "optional" : void 0), N(e._zod, "optout", () => t.options.some((n) => n._zod.optout === "optional") ? "optional" : void 0), N(e._zod, "values", () => {
1429
+ const on = /* @__PURE__ */ f("$ZodUnion", (e, t) => {
1430
+ L.init(e, t), M(e._zod, "optin", () => t.options.some((n) => n._zod.optin === "optional") ? "optional" : void 0), M(e._zod, "optout", () => t.options.some((n) => n._zod.optout === "optional") ? "optional" : void 0), M(e._zod, "values", () => {
1451
1431
  if (t.options.every((n) => n._zod.values))
1452
1432
  return new Set(t.options.flatMap((n) => Array.from(n._zod.values)));
1453
- }), N(e._zod, "pattern", () => {
1433
+ }), M(e._zod, "pattern", () => {
1454
1434
  if (t.options.every((n) => n._zod.pattern)) {
1455
1435
  const n = t.options.map((o) => o._zod.pattern);
1456
1436
  return new RegExp(`^(${n.map((o) => $t(o.source)).join("|")})$`);
@@ -1463,48 +1443,47 @@ const on = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
1463
1443
  let a = !1;
1464
1444
  const i = [];
1465
1445
  for (const s of t.options) {
1466
- const d = s._zod.run({
1446
+ const l = s._zod.run({
1467
1447
  value: n.value,
1468
1448
  issues: []
1469
1449
  }, o);
1470
- if (d instanceof Promise)
1471
- i.push(d), a = !0;
1450
+ if (l instanceof Promise)
1451
+ i.push(l), a = !0;
1472
1452
  else {
1473
- if (d.issues.length === 0)
1474
- return d;
1475
- i.push(d);
1453
+ if (l.issues.length === 0)
1454
+ return l;
1455
+ i.push(l);
1476
1456
  }
1477
1457
  }
1478
1458
  return a ? Promise.all(i).then((s) => tr(s, n, e, o)) : tr(i, n, e, o);
1479
1459
  };
1480
- }), is = /* @__PURE__ */ m("$ZodDiscriminatedUnion", (e, t) => {
1460
+ }), is = /* @__PURE__ */ f("$ZodDiscriminatedUnion", (e, t) => {
1481
1461
  t.inclusive = !1, on.init(e, t);
1482
1462
  const r = e._zod.parse;
1483
- N(e._zod, "propValues", () => {
1463
+ M(e._zod, "propValues", () => {
1484
1464
  const o = {};
1485
1465
  for (const a of t.options) {
1486
1466
  const i = a._zod.propValues;
1487
1467
  if (!i || Object.keys(i).length === 0)
1488
1468
  throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);
1489
- for (const [s, d] of Object.entries(i)) {
1469
+ for (const [s, l] of Object.entries(i)) {
1490
1470
  o[s] || (o[s] = /* @__PURE__ */ new Set());
1491
- for (const u of d)
1471
+ for (const u of l)
1492
1472
  o[s].add(u);
1493
1473
  }
1494
1474
  }
1495
1475
  return o;
1496
1476
  });
1497
1477
  const n = nt(() => {
1498
- var i;
1499
1478
  const o = t.options, a = /* @__PURE__ */ new Map();
1500
- for (const s of o) {
1501
- const d = (i = s._zod.propValues) == null ? void 0 : i[t.discriminator];
1502
- if (!d || d.size === 0)
1503
- throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);
1504
- for (const u of d) {
1505
- if (a.has(u))
1506
- throw new Error(`Duplicate discriminator value "${String(u)}"`);
1507
- a.set(u, s);
1479
+ for (const i of o) {
1480
+ const s = i._zod.propValues?.[t.discriminator];
1481
+ if (!s || s.size === 0)
1482
+ throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);
1483
+ for (const l of s) {
1484
+ if (a.has(l))
1485
+ throw new Error(`Duplicate discriminator value "${String(l)}"`);
1486
+ a.set(l, i);
1508
1487
  }
1509
1488
  }
1510
1489
  return a;
@@ -1518,7 +1497,7 @@ const on = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
1518
1497
  input: i,
1519
1498
  inst: e
1520
1499
  }), o;
1521
- const s = n.value.get(i == null ? void 0 : i[t.discriminator]);
1500
+ const s = n.value.get(i?.[t.discriminator]);
1522
1501
  return s ? s._zod.run(o, a) : t.unionFallback || a.direction === "backward" ? r(o, a) : (o.issues.push({
1523
1502
  code: "invalid_union",
1524
1503
  errors: [],
@@ -1530,10 +1509,10 @@ const on = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
1530
1509
  inst: e
1531
1510
  }), o);
1532
1511
  };
1533
- }), us = /* @__PURE__ */ m("$ZodIntersection", (e, t) => {
1512
+ }), us = /* @__PURE__ */ f("$ZodIntersection", (e, t) => {
1534
1513
  L.init(e, t), e._zod.parse = (r, n) => {
1535
1514
  const o = r.value, a = t.left._zod.run({ value: o, issues: [] }, n), i = t.right._zod.run({ value: o, issues: [] }, n);
1536
- return a instanceof Promise || i instanceof Promise ? Promise.all([a, i]).then(([d, u]) => rr(r, d, u)) : rr(r, a, i);
1515
+ return a instanceof Promise || i instanceof Promise ? Promise.all([a, i]).then(([l, u]) => rr(r, l, u)) : rr(r, a, i);
1537
1516
  };
1538
1517
  });
1539
1518
  function _t(e, t) {
@@ -1577,14 +1556,14 @@ function rr(e, t, r) {
1577
1556
  for (const s of t.issues)
1578
1557
  if (s.code === "unrecognized_keys") {
1579
1558
  o ?? (o = s);
1580
- for (const d of s.keys)
1581
- n.has(d) || n.set(d, {}), n.get(d).l = !0;
1559
+ for (const l of s.keys)
1560
+ n.has(l) || n.set(l, {}), n.get(l).l = !0;
1582
1561
  } else
1583
1562
  e.issues.push(s);
1584
1563
  for (const s of r.issues)
1585
1564
  if (s.code === "unrecognized_keys")
1586
- for (const d of s.keys)
1587
- n.has(d) || n.set(d, {}), n.get(d).r = !0;
1565
+ for (const l of s.keys)
1566
+ n.has(l) || n.set(l, {}), n.get(l).r = !0;
1588
1567
  else
1589
1568
  e.issues.push(s);
1590
1569
  const a = [...n].filter(([, s]) => s.l && s.r).map(([s]) => s);
@@ -1595,7 +1574,7 @@ function rr(e, t, r) {
1595
1574
  throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);
1596
1575
  return e.value = i.data, e;
1597
1576
  }
1598
- const cs = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
1577
+ const cs = /* @__PURE__ */ f("$ZodRecord", (e, t) => {
1599
1578
  L.init(e, t), e._zod.parse = (r, n) => {
1600
1579
  const o = r.value;
1601
1580
  if (!Ze(o))
@@ -1612,68 +1591,68 @@ const cs = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
1612
1591
  for (const u of i)
1613
1592
  if (typeof u == "string" || typeof u == "number" || typeof u == "symbol") {
1614
1593
  s.add(typeof u == "number" ? u.toString() : u);
1615
- const l = t.keyType._zod.run({ value: u, issues: [] }, n);
1616
- if (l instanceof Promise)
1594
+ const d = t.keyType._zod.run({ value: u, issues: [] }, n);
1595
+ if (d instanceof Promise)
1617
1596
  throw new Error("Async schemas not supported in object keys currently");
1618
- if (l.issues.length) {
1597
+ if (d.issues.length) {
1619
1598
  r.issues.push({
1620
1599
  code: "invalid_key",
1621
1600
  origin: "record",
1622
- issues: l.issues.map((f) => ue(f, n, ie())),
1601
+ issues: d.issues.map((h) => ue(h, n, ie())),
1623
1602
  input: u,
1624
1603
  path: [u],
1625
1604
  inst: e
1626
1605
  });
1627
1606
  continue;
1628
1607
  }
1629
- const p = l.value, h = t.valueType._zod.run({ value: o[u], issues: [] }, n);
1630
- h instanceof Promise ? a.push(h.then((f) => {
1631
- f.issues.length && r.issues.push(...Oe(u, f.issues)), r.value[p] = f.value;
1632
- })) : (h.issues.length && r.issues.push(...Oe(u, h.issues)), r.value[p] = h.value);
1608
+ const p = d.value, m = t.valueType._zod.run({ value: o[u], issues: [] }, n);
1609
+ m instanceof Promise ? a.push(m.then((h) => {
1610
+ h.issues.length && r.issues.push(...Oe(u, h.issues)), r.value[p] = h.value;
1611
+ })) : (m.issues.length && r.issues.push(...Oe(u, m.issues)), r.value[p] = m.value);
1633
1612
  }
1634
- let d;
1613
+ let l;
1635
1614
  for (const u in o)
1636
- s.has(u) || (d = d ?? [], d.push(u));
1637
- d && d.length > 0 && r.issues.push({
1615
+ s.has(u) || (l = l ?? [], l.push(u));
1616
+ l && l.length > 0 && r.issues.push({
1638
1617
  code: "unrecognized_keys",
1639
1618
  input: o,
1640
1619
  inst: e,
1641
- keys: d
1620
+ keys: l
1642
1621
  });
1643
1622
  } else {
1644
1623
  r.value = {};
1645
1624
  for (const s of Reflect.ownKeys(o)) {
1646
1625
  if (s === "__proto__" || !Object.prototype.propertyIsEnumerable.call(o, s))
1647
1626
  continue;
1648
- let d = t.keyType._zod.run({ value: s, issues: [] }, n);
1649
- if (d instanceof Promise)
1627
+ let l = t.keyType._zod.run({ value: s, issues: [] }, n);
1628
+ if (l instanceof Promise)
1650
1629
  throw new Error("Async schemas not supported in object keys currently");
1651
- if (typeof s == "string" && Hr.test(s) && d.issues.length) {
1630
+ if (typeof s == "string" && Hr.test(s) && l.issues.length) {
1652
1631
  const p = t.keyType._zod.run({ value: Number(s), issues: [] }, n);
1653
1632
  if (p instanceof Promise)
1654
1633
  throw new Error("Async schemas not supported in object keys currently");
1655
- p.issues.length === 0 && (d = p);
1634
+ p.issues.length === 0 && (l = p);
1656
1635
  }
1657
- if (d.issues.length) {
1636
+ if (l.issues.length) {
1658
1637
  t.mode === "loose" ? r.value[s] = o[s] : r.issues.push({
1659
1638
  code: "invalid_key",
1660
1639
  origin: "record",
1661
- issues: d.issues.map((p) => ue(p, n, ie())),
1640
+ issues: l.issues.map((p) => ue(p, n, ie())),
1662
1641
  input: s,
1663
1642
  path: [s],
1664
1643
  inst: e
1665
1644
  });
1666
1645
  continue;
1667
1646
  }
1668
- const l = t.valueType._zod.run({ value: o[s], issues: [] }, n);
1669
- l instanceof Promise ? a.push(l.then((p) => {
1670
- p.issues.length && r.issues.push(...Oe(s, p.issues)), r.value[d.value] = p.value;
1671
- })) : (l.issues.length && r.issues.push(...Oe(s, l.issues)), r.value[d.value] = l.value);
1647
+ const d = t.valueType._zod.run({ value: o[s], issues: [] }, n);
1648
+ d instanceof Promise ? a.push(d.then((p) => {
1649
+ p.issues.length && r.issues.push(...Oe(s, p.issues)), r.value[l.value] = p.value;
1650
+ })) : (d.issues.length && r.issues.push(...Oe(s, d.issues)), r.value[l.value] = d.value);
1672
1651
  }
1673
1652
  }
1674
1653
  return a.length ? Promise.all(a).then(() => r) : r;
1675
1654
  };
1676
- }), ls = /* @__PURE__ */ m("$ZodEnum", (e, t) => {
1655
+ }), ls = /* @__PURE__ */ f("$ZodEnum", (e, t) => {
1677
1656
  L.init(e, t);
1678
1657
  const r = Ur(t.entries), n = new Set(r);
1679
1658
  e._zod.values = n, e._zod.pattern = new RegExp(`^(${r.filter((o) => _o.has(typeof o)).map((o) => typeof o == "string" ? Ae(o) : o.toString()).join("|")})$`), e._zod.parse = (o, a) => {
@@ -1685,7 +1664,7 @@ const cs = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
1685
1664
  inst: e
1686
1665
  }), o;
1687
1666
  };
1688
- }), ds = /* @__PURE__ */ m("$ZodLiteral", (e, t) => {
1667
+ }), ds = /* @__PURE__ */ f("$ZodLiteral", (e, t) => {
1689
1668
  if (L.init(e, t), t.values.length === 0)
1690
1669
  throw new Error("Cannot create literal schema with no valid values");
1691
1670
  const r = new Set(t.values);
@@ -1698,7 +1677,7 @@ const cs = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
1698
1677
  inst: e
1699
1678
  }), n;
1700
1679
  };
1701
- }), ps = /* @__PURE__ */ m("$ZodTransform", (e, t) => {
1680
+ }), ps = /* @__PURE__ */ f("$ZodTransform", (e, t) => {
1702
1681
  L.init(e, t), e._zod.optin = "optional", e._zod.parse = (r, n) => {
1703
1682
  if (n.direction === "backward")
1704
1683
  throw new Lr(e.constructor.name);
@@ -1713,8 +1692,8 @@ const cs = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
1713
1692
  function nr(e, t) {
1714
1693
  return t === void 0 && (e.issues.length || e.fallback) ? { issues: [], value: void 0 } : e;
1715
1694
  }
1716
- const an = /* @__PURE__ */ m("$ZodOptional", (e, t) => {
1717
- L.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", N(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), N(e._zod, "pattern", () => {
1695
+ const an = /* @__PURE__ */ f("$ZodOptional", (e, t) => {
1696
+ L.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", M(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), M(e._zod, "pattern", () => {
1718
1697
  const r = t.innerType._zod.pattern;
1719
1698
  return r ? new RegExp(`^(${$t(r.source)})?$`) : void 0;
1720
1699
  }), e._zod.parse = (r, n) => {
@@ -1724,15 +1703,15 @@ const an = /* @__PURE__ */ m("$ZodOptional", (e, t) => {
1724
1703
  }
1725
1704
  return r.value === void 0 ? r : t.innerType._zod.run(r, n);
1726
1705
  };
1727
- }), fs = /* @__PURE__ */ m("$ZodExactOptional", (e, t) => {
1728
- an.init(e, t), N(e._zod, "values", () => t.innerType._zod.values), N(e._zod, "pattern", () => t.innerType._zod.pattern), e._zod.parse = (r, n) => t.innerType._zod.run(r, n);
1729
- }), hs = /* @__PURE__ */ m("$ZodNullable", (e, t) => {
1730
- L.init(e, t), N(e._zod, "optin", () => t.innerType._zod.optin), N(e._zod, "optout", () => t.innerType._zod.optout), N(e._zod, "pattern", () => {
1706
+ }), fs = /* @__PURE__ */ f("$ZodExactOptional", (e, t) => {
1707
+ an.init(e, t), M(e._zod, "values", () => t.innerType._zod.values), M(e._zod, "pattern", () => t.innerType._zod.pattern), e._zod.parse = (r, n) => t.innerType._zod.run(r, n);
1708
+ }), hs = /* @__PURE__ */ f("$ZodNullable", (e, t) => {
1709
+ L.init(e, t), M(e._zod, "optin", () => t.innerType._zod.optin), M(e._zod, "optout", () => t.innerType._zod.optout), M(e._zod, "pattern", () => {
1731
1710
  const r = t.innerType._zod.pattern;
1732
1711
  return r ? new RegExp(`^(${$t(r.source)}|null)$`) : void 0;
1733
- }), N(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (r, n) => r.value === null ? r : t.innerType._zod.run(r, n);
1734
- }), ms = /* @__PURE__ */ m("$ZodDefault", (e, t) => {
1735
- L.init(e, t), e._zod.optin = "optional", N(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (r, n) => {
1712
+ }), M(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (r, n) => r.value === null ? r : t.innerType._zod.run(r, n);
1713
+ }), ms = /* @__PURE__ */ f("$ZodDefault", (e, t) => {
1714
+ L.init(e, t), e._zod.optin = "optional", M(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (r, n) => {
1736
1715
  if (n.direction === "backward")
1737
1716
  return t.innerType._zod.run(r, n);
1738
1717
  if (r.value === void 0)
@@ -1744,10 +1723,10 @@ const an = /* @__PURE__ */ m("$ZodOptional", (e, t) => {
1744
1723
  function or(e, t) {
1745
1724
  return e.value === void 0 && (e.value = t.defaultValue), e;
1746
1725
  }
1747
- const vs = /* @__PURE__ */ m("$ZodPrefault", (e, t) => {
1748
- L.init(e, t), e._zod.optin = "optional", N(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (r, n) => (n.direction === "backward" || r.value === void 0 && (r.value = t.defaultValue), t.innerType._zod.run(r, n));
1749
- }), gs = /* @__PURE__ */ m("$ZodNonOptional", (e, t) => {
1750
- L.init(e, t), N(e._zod, "values", () => {
1726
+ const vs = /* @__PURE__ */ f("$ZodPrefault", (e, t) => {
1727
+ L.init(e, t), e._zod.optin = "optional", M(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (r, n) => (n.direction === "backward" || r.value === void 0 && (r.value = t.defaultValue), t.innerType._zod.run(r, n));
1728
+ }), gs = /* @__PURE__ */ f("$ZodNonOptional", (e, t) => {
1729
+ L.init(e, t), M(e._zod, "values", () => {
1751
1730
  const r = t.innerType._zod.values;
1752
1731
  return r ? new Set([...r].filter((n) => n !== void 0)) : void 0;
1753
1732
  }), e._zod.parse = (r, n) => {
@@ -1763,8 +1742,8 @@ function ar(e, t) {
1763
1742
  inst: t
1764
1743
  }), e;
1765
1744
  }
1766
- const _s = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
1767
- L.init(e, t), e._zod.optin = "optional", N(e._zod, "optout", () => t.innerType._zod.optout), N(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (r, n) => {
1745
+ const _s = /* @__PURE__ */ f("$ZodCatch", (e, t) => {
1746
+ L.init(e, t), e._zod.optin = "optional", M(e._zod, "optout", () => t.innerType._zod.optout), M(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (r, n) => {
1768
1747
  if (n.direction === "backward")
1769
1748
  return t.innerType._zod.run(r, n);
1770
1749
  const o = t.innerType._zod.run(r, n);
@@ -1782,8 +1761,8 @@ const _s = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
1782
1761
  input: r.value
1783
1762
  }), r.issues = [], r.fallback = !0), r);
1784
1763
  };
1785
- }), ys = /* @__PURE__ */ m("$ZodPipe", (e, t) => {
1786
- L.init(e, t), N(e._zod, "values", () => t.in._zod.values), N(e._zod, "optin", () => t.in._zod.optin), N(e._zod, "optout", () => t.out._zod.optout), N(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (r, n) => {
1764
+ }), ys = /* @__PURE__ */ f("$ZodPipe", (e, t) => {
1765
+ L.init(e, t), M(e._zod, "values", () => t.in._zod.values), M(e._zod, "optin", () => t.in._zod.optin), M(e._zod, "optout", () => t.out._zod.optout), M(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (r, n) => {
1787
1766
  if (n.direction === "backward") {
1788
1767
  const a = t.out._zod.run(r, n);
1789
1768
  return a instanceof Promise ? a.then((i) => qe(i, t.in, n)) : qe(a, t.in, n);
@@ -1795,14 +1774,8 @@ const _s = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
1795
1774
  function qe(e, t, r) {
1796
1775
  return e.issues.length ? (e.aborted = !0, e) : t._zod.run({ value: e.value, issues: e.issues, fallback: e.fallback }, r);
1797
1776
  }
1798
- const bs = /* @__PURE__ */ m("$ZodReadonly", (e, t) => {
1799
- L.init(e, t), N(e._zod, "propValues", () => t.innerType._zod.propValues), N(e._zod, "values", () => t.innerType._zod.values), N(e._zod, "optin", () => {
1800
- var r, n;
1801
- return (n = (r = t.innerType) == null ? void 0 : r._zod) == null ? void 0 : n.optin;
1802
- }), N(e._zod, "optout", () => {
1803
- var r, n;
1804
- return (n = (r = t.innerType) == null ? void 0 : r._zod) == null ? void 0 : n.optout;
1805
- }), e._zod.parse = (r, n) => {
1777
+ const bs = /* @__PURE__ */ f("$ZodReadonly", (e, t) => {
1778
+ L.init(e, t), M(e._zod, "propValues", () => t.innerType._zod.propValues), M(e._zod, "values", () => t.innerType._zod.values), M(e._zod, "optin", () => t.innerType?._zod?.optin), M(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (r, n) => {
1806
1779
  if (n.direction === "backward")
1807
1780
  return t.innerType._zod.run(r, n);
1808
1781
  const o = t.innerType._zod.run(r, n);
@@ -1812,24 +1785,12 @@ const bs = /* @__PURE__ */ m("$ZodReadonly", (e, t) => {
1812
1785
  function sr(e) {
1813
1786
  return e.value = Object.freeze(e.value), e;
1814
1787
  }
1815
- const ws = /* @__PURE__ */ m("$ZodLazy", (e, t) => {
1816
- L.init(e, t), N(e._zod, "innerType", () => {
1788
+ const ws = /* @__PURE__ */ f("$ZodLazy", (e, t) => {
1789
+ L.init(e, t), M(e._zod, "innerType", () => {
1817
1790
  const r = t;
1818
1791
  return r._cachedInner || (r._cachedInner = t.getter()), r._cachedInner;
1819
- }), N(e._zod, "pattern", () => {
1820
- var r, n;
1821
- return (n = (r = e._zod.innerType) == null ? void 0 : r._zod) == null ? void 0 : n.pattern;
1822
- }), N(e._zod, "propValues", () => {
1823
- var r, n;
1824
- return (n = (r = e._zod.innerType) == null ? void 0 : r._zod) == null ? void 0 : n.propValues;
1825
- }), N(e._zod, "optin", () => {
1826
- var r, n;
1827
- return ((n = (r = e._zod.innerType) == null ? void 0 : r._zod) == null ? void 0 : n.optin) ?? void 0;
1828
- }), N(e._zod, "optout", () => {
1829
- var r, n;
1830
- return ((n = (r = e._zod.innerType) == null ? void 0 : r._zod) == null ? void 0 : n.optout) ?? void 0;
1831
- }), e._zod.parse = (r, n) => e._zod.innerType._zod.run(r, n);
1832
- }), Is = /* @__PURE__ */ m("$ZodCustom", (e, t) => {
1792
+ }), M(e._zod, "pattern", () => e._zod.innerType?._zod?.pattern), M(e._zod, "propValues", () => e._zod.innerType?._zod?.propValues), M(e._zod, "optin", () => e._zod.innerType?._zod?.optin ?? void 0), M(e._zod, "optout", () => e._zod.innerType?._zod?.optout ?? void 0), e._zod.parse = (r, n) => e._zod.innerType._zod.run(r, n);
1793
+ }), Is = /* @__PURE__ */ f("$ZodCustom", (e, t) => {
1833
1794
  Y.init(e, t), L.init(e, t), e._zod.parse = (r, n) => r, e._zod.check = (r) => {
1834
1795
  const n = r.value, o = t.fn(n);
1835
1796
  if (o instanceof Promise)
@@ -2400,182 +2361,178 @@ function _i(e, t) {
2400
2361
  return r._zod.check = e, r;
2401
2362
  }
2402
2363
  function Qe(e) {
2403
- let t = (e == null ? void 0 : e.target) ?? "draft-2020-12";
2364
+ let t = e?.target ?? "draft-2020-12";
2404
2365
  return t === "draft-4" && (t = "draft-04"), t === "draft-7" && (t = "draft-07"), {
2405
2366
  processors: e.processors ?? {},
2406
- metadataRegistry: (e == null ? void 0 : e.metadata) ?? Re,
2367
+ metadataRegistry: e?.metadata ?? Re,
2407
2368
  target: t,
2408
- unrepresentable: (e == null ? void 0 : e.unrepresentable) ?? "throw",
2409
- override: (e == null ? void 0 : e.override) ?? (() => {
2369
+ unrepresentable: e?.unrepresentable ?? "throw",
2370
+ override: e?.override ?? (() => {
2410
2371
  }),
2411
- io: (e == null ? void 0 : e.io) ?? "output",
2372
+ io: e?.io ?? "output",
2412
2373
  counter: 0,
2413
2374
  seen: /* @__PURE__ */ new Map(),
2414
- cycles: (e == null ? void 0 : e.cycles) ?? "ref",
2415
- reused: (e == null ? void 0 : e.reused) ?? "inline",
2416
- external: (e == null ? void 0 : e.external) ?? void 0
2375
+ cycles: e?.cycles ?? "ref",
2376
+ reused: e?.reused ?? "inline",
2377
+ external: e?.external ?? void 0
2417
2378
  };
2418
2379
  }
2419
2380
  function j(e, t, r = { path: [], schemaPath: [] }) {
2420
- var l, p;
2421
2381
  var n;
2422
2382
  const o = e._zod.def, a = t.seen.get(e);
2423
2383
  if (a)
2424
2384
  return a.count++, r.schemaPath.includes(e) && (a.cycle = r.path), a.schema;
2425
2385
  const i = { schema: {}, count: 1, cycle: void 0, path: r.path };
2426
2386
  t.seen.set(e, i);
2427
- const s = (p = (l = e._zod).toJSONSchema) == null ? void 0 : p.call(l);
2387
+ const s = e._zod.toJSONSchema?.();
2428
2388
  if (s)
2429
2389
  i.schema = s;
2430
2390
  else {
2431
- const h = {
2391
+ const d = {
2432
2392
  ...r,
2433
2393
  schemaPath: [...r.schemaPath, e],
2434
2394
  path: r.path
2435
2395
  };
2436
2396
  if (e._zod.processJSONSchema)
2437
- e._zod.processJSONSchema(t, i.schema, h);
2397
+ e._zod.processJSONSchema(t, i.schema, d);
2438
2398
  else {
2439
- const z = i.schema, S = t.processors[o.type];
2440
- if (!S)
2399
+ const m = i.schema, h = t.processors[o.type];
2400
+ if (!h)
2441
2401
  throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);
2442
- S(e, t, z, h);
2402
+ h(e, t, m, d);
2443
2403
  }
2444
- const f = e._zod.parent;
2445
- f && (i.ref || (i.ref = f), j(f, t, h), t.seen.get(f).isParent = !0);
2404
+ const p = e._zod.parent;
2405
+ p && (i.ref || (i.ref = p), j(p, t, d), t.seen.get(p).isParent = !0);
2446
2406
  }
2447
- const d = t.metadataRegistry.get(e);
2448
- return d && Object.assign(i.schema, d), t.io === "input" && G(e) && (delete i.schema.examples, delete i.schema.default), t.io === "input" && "_prefault" in i.schema && ((n = i.schema).default ?? (n.default = i.schema._prefault)), delete i.schema._prefault, t.seen.get(e).schema;
2407
+ const l = t.metadataRegistry.get(e);
2408
+ return l && Object.assign(i.schema, l), t.io === "input" && G(e) && (delete i.schema.examples, delete i.schema.default), t.io === "input" && "_prefault" in i.schema && ((n = i.schema).default ?? (n.default = i.schema._prefault)), delete i.schema._prefault, t.seen.get(e).schema;
2449
2409
  }
2450
2410
  function et(e, t) {
2451
- var i, s, d, u;
2452
2411
  const r = e.seen.get(t);
2453
2412
  if (!r)
2454
2413
  throw new Error("Unprocessed schema. This is a bug in Zod.");
2455
2414
  const n = /* @__PURE__ */ new Map();
2456
- for (const l of e.seen.entries()) {
2457
- const p = (i = e.metadataRegistry.get(l[0])) == null ? void 0 : i.id;
2458
- if (p) {
2459
- const h = n.get(p);
2460
- if (h && h !== l[0])
2461
- throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
2462
- n.set(p, l[0]);
2415
+ for (const i of e.seen.entries()) {
2416
+ const s = e.metadataRegistry.get(i[0])?.id;
2417
+ if (s) {
2418
+ const l = n.get(s);
2419
+ if (l && l !== i[0])
2420
+ throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
2421
+ n.set(s, i[0]);
2463
2422
  }
2464
2423
  }
2465
- const o = (l) => {
2466
- var S;
2467
- const p = e.target === "draft-2020-12" ? "$defs" : "definitions";
2424
+ const o = (i) => {
2425
+ const s = e.target === "draft-2020-12" ? "$defs" : "definitions";
2468
2426
  if (e.external) {
2469
- const I = (S = e.external.registry.get(l[0])) == null ? void 0 : S.id, y = e.external.uri ?? ((M) => M);
2470
- if (I)
2471
- return { ref: y(I) };
2472
- const E = l[1].defId ?? l[1].schema.id ?? `schema${e.counter++}`;
2473
- return l[1].defId = E, { defId: E, ref: `${y("__shared")}#/${p}/${E}` };
2427
+ const p = e.external.registry.get(i[0])?.id, m = e.external.uri ?? ((I) => I);
2428
+ if (p)
2429
+ return { ref: m(p) };
2430
+ const h = i[1].defId ?? i[1].schema.id ?? `schema${e.counter++}`;
2431
+ return i[1].defId = h, { defId: h, ref: `${m("__shared")}#/${s}/${h}` };
2474
2432
  }
2475
- if (l[1] === r)
2433
+ if (i[1] === r)
2476
2434
  return { ref: "#" };
2477
- const f = `#/${p}/`, z = l[1].schema.id ?? `__schema${e.counter++}`;
2478
- return { defId: z, ref: f + z };
2479
- }, a = (l) => {
2480
- if (l[1].schema.$ref)
2435
+ const u = `#/${s}/`, d = i[1].schema.id ?? `__schema${e.counter++}`;
2436
+ return { defId: d, ref: u + d };
2437
+ }, a = (i) => {
2438
+ if (i[1].schema.$ref)
2481
2439
  return;
2482
- const p = l[1], { ref: h, defId: f } = o(l);
2483
- p.def = { ...p.schema }, f && (p.defId = f);
2484
- const z = p.schema;
2485
- for (const S in z)
2486
- delete z[S];
2487
- z.$ref = h;
2440
+ const s = i[1], { ref: l, defId: u } = o(i);
2441
+ s.def = { ...s.schema }, u && (s.defId = u);
2442
+ const d = s.schema;
2443
+ for (const p in d)
2444
+ delete d[p];
2445
+ d.$ref = l;
2488
2446
  };
2489
2447
  if (e.cycles === "throw")
2490
- for (const l of e.seen.entries()) {
2491
- const p = l[1];
2492
- if (p.cycle)
2493
- throw new Error(`Cycle detected: #/${(s = p.cycle) == null ? void 0 : s.join("/")}/<root>
2448
+ for (const i of e.seen.entries()) {
2449
+ const s = i[1];
2450
+ if (s.cycle)
2451
+ throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
2494
2452
 
2495
2453
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
2496
2454
  }
2497
- for (const l of e.seen.entries()) {
2498
- const p = l[1];
2499
- if (t === l[0]) {
2500
- a(l);
2455
+ for (const i of e.seen.entries()) {
2456
+ const s = i[1];
2457
+ if (t === i[0]) {
2458
+ a(i);
2501
2459
  continue;
2502
2460
  }
2503
2461
  if (e.external) {
2504
- const f = (d = e.external.registry.get(l[0])) == null ? void 0 : d.id;
2505
- if (t !== l[0] && f) {
2506
- a(l);
2462
+ const u = e.external.registry.get(i[0])?.id;
2463
+ if (t !== i[0] && u) {
2464
+ a(i);
2507
2465
  continue;
2508
2466
  }
2509
2467
  }
2510
- if ((u = e.metadataRegistry.get(l[0])) == null ? void 0 : u.id) {
2511
- a(l);
2468
+ if (e.metadataRegistry.get(i[0])?.id) {
2469
+ a(i);
2512
2470
  continue;
2513
2471
  }
2514
- if (p.cycle) {
2515
- a(l);
2472
+ if (s.cycle) {
2473
+ a(i);
2516
2474
  continue;
2517
2475
  }
2518
- if (p.count > 1 && e.reused === "ref") {
2519
- a(l);
2476
+ if (s.count > 1 && e.reused === "ref") {
2477
+ a(i);
2520
2478
  continue;
2521
2479
  }
2522
2480
  }
2523
2481
  }
2524
2482
  function tt(e, t) {
2525
- var s, d, u, l;
2526
2483
  const r = e.seen.get(t);
2527
2484
  if (!r)
2528
2485
  throw new Error("Unprocessed schema. This is a bug in Zod.");
2529
- const n = (p) => {
2530
- const h = e.seen.get(p);
2531
- if (h.ref === null)
2486
+ const n = (s) => {
2487
+ const l = e.seen.get(s);
2488
+ if (l.ref === null)
2532
2489
  return;
2533
- const f = h.def ?? h.schema, z = { ...f }, S = h.ref;
2534
- if (h.ref = null, S) {
2535
- n(S);
2536
- const y = e.seen.get(S), E = y.schema;
2537
- if (E.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (f.allOf = f.allOf ?? [], f.allOf.push(E)) : Object.assign(f, E), Object.assign(f, z), p._zod.parent === S)
2538
- for (const x in f)
2539
- x === "$ref" || x === "allOf" || x in z || delete f[x];
2540
- if (E.$ref && y.def)
2541
- for (const x in f)
2542
- x === "$ref" || x === "allOf" || x in y.def && JSON.stringify(f[x]) === JSON.stringify(y.def[x]) && delete f[x];
2490
+ const u = l.def ?? l.schema, d = { ...u }, p = l.ref;
2491
+ if (l.ref = null, p) {
2492
+ n(p);
2493
+ const h = e.seen.get(p), I = h.schema;
2494
+ if (I.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (u.allOf = u.allOf ?? [], u.allOf.push(I)) : Object.assign(u, I), Object.assign(u, d), s._zod.parent === p)
2495
+ for (const _ in u)
2496
+ _ === "$ref" || _ === "allOf" || _ in d || delete u[_];
2497
+ if (I.$ref && h.def)
2498
+ for (const _ in u)
2499
+ _ === "$ref" || _ === "allOf" || _ in h.def && JSON.stringify(u[_]) === JSON.stringify(h.def[_]) && delete u[_];
2543
2500
  }
2544
- const I = p._zod.parent;
2545
- if (I && I !== S) {
2546
- n(I);
2547
- const y = e.seen.get(I);
2548
- if (y != null && y.schema.$ref && (f.$ref = y.schema.$ref, y.def))
2549
- for (const E in f)
2550
- E === "$ref" || E === "allOf" || E in y.def && JSON.stringify(f[E]) === JSON.stringify(y.def[E]) && delete f[E];
2501
+ const m = s._zod.parent;
2502
+ if (m && m !== p) {
2503
+ n(m);
2504
+ const h = e.seen.get(m);
2505
+ if (h?.schema.$ref && (u.$ref = h.schema.$ref, h.def))
2506
+ for (const I in u)
2507
+ I === "$ref" || I === "allOf" || I in h.def && JSON.stringify(u[I]) === JSON.stringify(h.def[I]) && delete u[I];
2551
2508
  }
2552
2509
  e.override({
2553
- zodSchema: p,
2554
- jsonSchema: f,
2555
- path: h.path ?? []
2510
+ zodSchema: s,
2511
+ jsonSchema: u,
2512
+ path: l.path ?? []
2556
2513
  });
2557
2514
  };
2558
- for (const p of [...e.seen.entries()].reverse())
2559
- n(p[0]);
2515
+ for (const s of [...e.seen.entries()].reverse())
2516
+ n(s[0]);
2560
2517
  const o = {};
2561
- if (e.target === "draft-2020-12" ? o.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? o.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? o.$schema = "http://json-schema.org/draft-04/schema#" : e.target, (s = e.external) != null && s.uri) {
2562
- const p = (d = e.external.registry.get(t)) == null ? void 0 : d.id;
2563
- if (!p)
2518
+ if (e.target === "draft-2020-12" ? o.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? o.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? o.$schema = "http://json-schema.org/draft-04/schema#" : e.target, e.external?.uri) {
2519
+ const s = e.external.registry.get(t)?.id;
2520
+ if (!s)
2564
2521
  throw new Error("Schema is missing an `id` property");
2565
- o.$id = e.external.uri(p);
2522
+ o.$id = e.external.uri(s);
2566
2523
  }
2567
2524
  Object.assign(o, r.def ?? r.schema);
2568
- const a = (u = e.metadataRegistry.get(t)) == null ? void 0 : u.id;
2525
+ const a = e.metadataRegistry.get(t)?.id;
2569
2526
  a !== void 0 && o.id === a && delete o.id;
2570
- const i = ((l = e.external) == null ? void 0 : l.defs) ?? {};
2571
- for (const p of e.seen.entries()) {
2572
- const h = p[1];
2573
- h.def && h.defId && (h.def.id === h.defId && delete h.def.id, i[h.defId] = h.def);
2527
+ const i = e.external?.defs ?? {};
2528
+ for (const s of e.seen.entries()) {
2529
+ const l = s[1];
2530
+ l.def && l.defId && (l.def.id === l.defId && delete l.def.id, i[l.defId] = l.def);
2574
2531
  }
2575
2532
  e.external || Object.keys(i).length > 0 && (e.target === "draft-2020-12" ? o.$defs = i : o.definitions = i);
2576
2533
  try {
2577
- const p = JSON.parse(JSON.stringify(o));
2578
- return Object.defineProperty(p, "~standard", {
2534
+ const s = JSON.parse(JSON.stringify(o));
2535
+ return Object.defineProperty(s, "~standard", {
2579
2536
  value: {
2580
2537
  ...t["~standard"],
2581
2538
  jsonSchema: {
@@ -2585,7 +2542,7 @@ function tt(e, t) {
2585
2542
  },
2586
2543
  enumerable: !1,
2587
2544
  writable: !1
2588
- }), p;
2545
+ }), s;
2589
2546
  } catch {
2590
2547
  throw new Error("Error converting schema to JSON.");
2591
2548
  }
@@ -2648,21 +2605,21 @@ const yi = (e, t = {}) => (r) => {
2648
2605
  }, cn = (e, t, r, n) => {
2649
2606
  const o = r;
2650
2607
  o.type = "string";
2651
- const { minimum: a, maximum: i, format: s, patterns: d, contentEncoding: u } = e._zod.bag;
2652
- if (typeof a == "number" && (o.minLength = a), typeof i == "number" && (o.maxLength = i), s && (o.format = bi[s] ?? s, o.format === "" && delete o.format, s === "time" && delete o.format), u && (o.contentEncoding = u), d && d.size > 0) {
2653
- const l = [...d];
2654
- l.length === 1 ? o.pattern = l[0].source : l.length > 1 && (o.allOf = [
2655
- ...l.map((p) => ({
2608
+ const { minimum: a, maximum: i, format: s, patterns: l, contentEncoding: u } = e._zod.bag;
2609
+ if (typeof a == "number" && (o.minLength = a), typeof i == "number" && (o.maxLength = i), s && (o.format = bi[s] ?? s, o.format === "" && delete o.format, s === "time" && delete o.format), u && (o.contentEncoding = u), l && l.size > 0) {
2610
+ const d = [...l];
2611
+ d.length === 1 ? o.pattern = d[0].source : d.length > 1 && (o.allOf = [
2612
+ ...d.map((p) => ({
2656
2613
  ...t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0" ? { type: "string" } : {},
2657
2614
  pattern: p.source
2658
2615
  }))
2659
2616
  ]);
2660
2617
  }
2661
2618
  }, ln = (e, t, r, n) => {
2662
- const o = r, { minimum: a, maximum: i, format: s, multipleOf: d, exclusiveMaximum: u, exclusiveMinimum: l } = e._zod.bag;
2619
+ const o = r, { minimum: a, maximum: i, format: s, multipleOf: l, exclusiveMaximum: u, exclusiveMinimum: d } = e._zod.bag;
2663
2620
  typeof s == "string" && s.includes("int") ? o.type = "integer" : o.type = "number";
2664
- const p = typeof l == "number" && l >= (a ?? Number.NEGATIVE_INFINITY), h = typeof u == "number" && u <= (i ?? Number.POSITIVE_INFINITY), f = t.target === "draft-04" || t.target === "openapi-3.0";
2665
- p ? f ? (o.minimum = l, o.exclusiveMinimum = !0) : o.exclusiveMinimum = l : typeof a == "number" && (o.minimum = a), h ? f ? (o.maximum = u, o.exclusiveMaximum = !0) : o.exclusiveMaximum = u : typeof i == "number" && (o.maximum = i), typeof d == "number" && (o.multipleOf = d);
2621
+ const p = typeof d == "number" && d >= (a ?? Number.NEGATIVE_INFINITY), m = typeof u == "number" && u <= (i ?? Number.POSITIVE_INFINITY), h = t.target === "draft-04" || t.target === "openapi-3.0";
2622
+ p ? h ? (o.minimum = d, o.exclusiveMinimum = !0) : o.exclusiveMinimum = d : typeof a == "number" && (o.minimum = a), m ? h ? (o.maximum = u, o.exclusiveMaximum = !0) : o.exclusiveMaximum = u : typeof i == "number" && (o.maximum = i), typeof l == "number" && (o.multipleOf = l);
2666
2623
  }, dn = (e, t, r, n) => {
2667
2624
  r.type = "boolean";
2668
2625
  }, wi = (e, t, r, n) => {
@@ -2719,8 +2676,8 @@ const yi = (e, t = {}) => (r) => {
2719
2676
  type: "string",
2720
2677
  format: "binary",
2721
2678
  contentEncoding: "binary"
2722
- }, { minimum: i, maximum: s, mime: d } = e._zod.bag;
2723
- i !== void 0 && (a.minLength = i), s !== void 0 && (a.maxLength = s), d ? d.length === 1 ? (a.contentMediaType = d[0], Object.assign(o, a)) : (Object.assign(o, a), o.anyOf = d.map((u) => ({ contentMediaType: u }))) : Object.assign(o, a);
2679
+ }, { minimum: i, maximum: s, mime: l } = e._zod.bag;
2680
+ i !== void 0 && (a.minLength = i), s !== void 0 && (a.maxLength = s), l ? l.length === 1 ? (a.contentMediaType = l[0], Object.assign(o, a)) : (Object.assign(o, a), o.anyOf = l.map((u) => ({ contentMediaType: u }))) : Object.assign(o, a);
2724
2681
  }, Zi = (e, t, r, n) => {
2725
2682
  r.type = "boolean";
2726
2683
  }, gn = (e, t, r, n) => {
@@ -2745,27 +2702,26 @@ const yi = (e, t = {}) => (r) => {
2745
2702
  path: [...n.path, "items"]
2746
2703
  });
2747
2704
  }, bn = (e, t, r, n) => {
2748
- var u;
2749
2705
  const o = r, a = e._zod.def;
2750
2706
  o.type = "object", o.properties = {};
2751
2707
  const i = a.shape;
2752
- for (const l in i)
2753
- o.properties[l] = j(i[l], t, {
2708
+ for (const u in i)
2709
+ o.properties[u] = j(i[u], t, {
2754
2710
  ...n,
2755
- path: [...n.path, "properties", l]
2711
+ path: [...n.path, "properties", u]
2756
2712
  });
2757
- const s = new Set(Object.keys(i)), d = new Set([...s].filter((l) => {
2758
- const p = a.shape[l]._zod;
2759
- return t.io === "input" ? p.optin === void 0 : p.optout === void 0;
2713
+ const s = new Set(Object.keys(i)), l = new Set([...s].filter((u) => {
2714
+ const d = a.shape[u]._zod;
2715
+ return t.io === "input" ? d.optin === void 0 : d.optout === void 0;
2760
2716
  }));
2761
- d.size > 0 && (o.required = Array.from(d)), ((u = a.catchall) == null ? void 0 : u._zod.def.type) === "never" ? o.additionalProperties = !1 : a.catchall ? a.catchall && (o.additionalProperties = j(a.catchall, t, {
2717
+ l.size > 0 && (o.required = Array.from(l)), a.catchall?._zod.def.type === "never" ? o.additionalProperties = !1 : a.catchall ? a.catchall && (o.additionalProperties = j(a.catchall, t, {
2762
2718
  ...n,
2763
2719
  path: [...n.path, "additionalProperties"]
2764
2720
  })) : t.io === "output" && (o.additionalProperties = !1);
2765
2721
  }, wn = (e, t, r, n) => {
2766
- const o = e._zod.def, a = o.inclusive === !1, i = o.options.map((s, d) => j(s, t, {
2722
+ const o = e._zod.def, a = o.inclusive === !1, i = o.options.map((s, l) => j(s, t, {
2767
2723
  ...n,
2768
- path: [...n.path, a ? "oneOf" : "anyOf", d]
2724
+ path: [...n.path, a ? "oneOf" : "anyOf", l]
2769
2725
  }));
2770
2726
  a ? r.oneOf = i : r.anyOf = i;
2771
2727
  }, In = (e, t, r, n) => {
@@ -2775,38 +2731,38 @@ const yi = (e, t = {}) => (r) => {
2775
2731
  }), i = j(o.right, t, {
2776
2732
  ...n,
2777
2733
  path: [...n.path, "allOf", 1]
2778
- }), s = (u) => "allOf" in u && Object.keys(u).length === 1, d = [
2734
+ }), s = (u) => "allOf" in u && Object.keys(u).length === 1, l = [
2779
2735
  ...s(a) ? a.allOf : [a],
2780
2736
  ...s(i) ? i.allOf : [i]
2781
2737
  ];
2782
- r.allOf = d;
2738
+ r.allOf = l;
2783
2739
  }, Mi = (e, t, r, n) => {
2784
2740
  const o = r, a = e._zod.def;
2785
2741
  o.type = "array";
2786
- const i = t.target === "draft-2020-12" ? "prefixItems" : "items", s = t.target === "draft-2020-12" || t.target === "openapi-3.0" ? "items" : "additionalItems", d = a.items.map((h, f) => j(h, t, {
2742
+ const i = t.target === "draft-2020-12" ? "prefixItems" : "items", s = t.target === "draft-2020-12" || t.target === "openapi-3.0" ? "items" : "additionalItems", l = a.items.map((m, h) => j(m, t, {
2787
2743
  ...n,
2788
- path: [...n.path, i, f]
2744
+ path: [...n.path, i, h]
2789
2745
  })), u = a.rest ? j(a.rest, t, {
2790
2746
  ...n,
2791
2747
  path: [...n.path, s, ...t.target === "openapi-3.0" ? [a.items.length] : []]
2792
2748
  }) : null;
2793
- t.target === "draft-2020-12" ? (o.prefixItems = d, u && (o.items = u)) : t.target === "openapi-3.0" ? (o.items = {
2794
- anyOf: d
2795
- }, u && o.items.anyOf.push(u), o.minItems = d.length, u || (o.maxItems = d.length)) : (o.items = d, u && (o.additionalItems = u));
2796
- const { minimum: l, maximum: p } = e._zod.bag;
2797
- typeof l == "number" && (o.minItems = l), typeof p == "number" && (o.maxItems = p);
2749
+ t.target === "draft-2020-12" ? (o.prefixItems = l, u && (o.items = u)) : t.target === "openapi-3.0" ? (o.items = {
2750
+ anyOf: l
2751
+ }, u && o.items.anyOf.push(u), o.minItems = l.length, u || (o.maxItems = l.length)) : (o.items = l, u && (o.additionalItems = u));
2752
+ const { minimum: d, maximum: p } = e._zod.bag;
2753
+ typeof d == "number" && (o.minItems = d), typeof p == "number" && (o.maxItems = p);
2798
2754
  }, En = (e, t, r, n) => {
2799
2755
  const o = r, a = e._zod.def;
2800
2756
  o.type = "object";
2801
- const i = a.keyType, s = i._zod.bag, d = s == null ? void 0 : s.patterns;
2802
- if (a.mode === "loose" && d && d.size > 0) {
2803
- const l = j(a.valueType, t, {
2757
+ const i = a.keyType, l = i._zod.bag?.patterns;
2758
+ if (a.mode === "loose" && l && l.size > 0) {
2759
+ const d = j(a.valueType, t, {
2804
2760
  ...n,
2805
2761
  path: [...n.path, "patternProperties", "*"]
2806
2762
  });
2807
2763
  o.patternProperties = {};
2808
- for (const p of d)
2809
- o.patternProperties[p.source] = l;
2764
+ for (const p of l)
2765
+ o.patternProperties[p.source] = d;
2810
2766
  } else
2811
2767
  (t.target === "draft-07" || t.target === "draft-2020-12") && (o.propertyNames = j(a.keyType, t, {
2812
2768
  ...n,
@@ -2817,8 +2773,8 @@ const yi = (e, t = {}) => (r) => {
2817
2773
  });
2818
2774
  const u = i._zod.values;
2819
2775
  if (u) {
2820
- const l = [...u].filter((p) => typeof p == "string" || typeof p == "number");
2821
- l.length > 0 && (o.required = l);
2776
+ const d = [...u].filter((p) => typeof p == "string" || typeof p == "number");
2777
+ d.length > 0 && (o.required = d);
2822
2778
  }
2823
2779
  }, Sn = (e, t, r, n) => {
2824
2780
  const o = e._zod.def, a = j(o.innerType, t, n), i = t.seen.get(e);
@@ -2919,24 +2875,24 @@ const yi = (e, t = {}) => (r) => {
2919
2875
  function Ci(e, t) {
2920
2876
  if ("_idmap" in e) {
2921
2877
  const n = e, o = Qe({ ...t, processors: fr }), a = {};
2922
- for (const d of n._idmap.entries()) {
2923
- const [u, l] = d;
2924
- j(l, o);
2878
+ for (const l of n._idmap.entries()) {
2879
+ const [u, d] = l;
2880
+ j(d, o);
2925
2881
  }
2926
2882
  const i = {}, s = {
2927
2883
  registry: n,
2928
- uri: t == null ? void 0 : t.uri,
2884
+ uri: t?.uri,
2929
2885
  defs: a
2930
2886
  };
2931
2887
  o.external = s;
2932
- for (const d of n._idmap.entries()) {
2933
- const [u, l] = d;
2934
- et(o, l), i[u] = tt(o, l);
2888
+ for (const l of n._idmap.entries()) {
2889
+ const [u, d] = l;
2890
+ et(o, d), i[u] = tt(o, d);
2935
2891
  }
2936
2892
  if (Object.keys(a).length > 0) {
2937
- const d = o.target === "draft-2020-12" ? "$defs" : "definitions";
2893
+ const l = o.target === "draft-2020-12" ? "$defs" : "definitions";
2938
2894
  i.__shared = {
2939
- [d]: a
2895
+ [l]: a
2940
2896
  };
2941
2897
  }
2942
2898
  return { schemas: i };
@@ -2944,25 +2900,25 @@ function Ci(e, t) {
2944
2900
  const r = Qe({ ...t, processors: fr });
2945
2901
  return j(e, r), et(r, e), tt(r, e);
2946
2902
  }
2947
- const xi = /* @__PURE__ */ m("ZodISODateTime", (e, t) => {
2903
+ const xi = /* @__PURE__ */ f("ZodISODateTime", (e, t) => {
2948
2904
  Da.init(e, t), J.init(e, t);
2949
2905
  });
2950
2906
  function ji(e) {
2951
2907
  return /* @__PURE__ */ qs(xi, e);
2952
2908
  }
2953
- const Di = /* @__PURE__ */ m("ZodISODate", (e, t) => {
2909
+ const Di = /* @__PURE__ */ f("ZodISODate", (e, t) => {
2954
2910
  La.init(e, t), J.init(e, t);
2955
2911
  });
2956
2912
  function Li(e) {
2957
2913
  return /* @__PURE__ */ Gs(Di, e);
2958
2914
  }
2959
- const Ui = /* @__PURE__ */ m("ZodISOTime", (e, t) => {
2915
+ const Ui = /* @__PURE__ */ f("ZodISOTime", (e, t) => {
2960
2916
  Ua.init(e, t), J.init(e, t);
2961
2917
  });
2962
2918
  function Fi(e) {
2963
2919
  return /* @__PURE__ */ Ys(Ui, e);
2964
2920
  }
2965
- const Ji = /* @__PURE__ */ m("ZodISODuration", (e, t) => {
2921
+ const Ji = /* @__PURE__ */ f("ZodISODuration", (e, t) => {
2966
2922
  Fa.init(e, t), J.init(e, t);
2967
2923
  });
2968
2924
  function Vi(e) {
@@ -2997,7 +2953,7 @@ const Bi = (e, t) => {
2997
2953
  // enumerable: false,
2998
2954
  }
2999
2955
  });
3000
- }, K = /* @__PURE__ */ m("ZodError", Bi, {
2956
+ }, K = /* @__PURE__ */ f("ZodError", Bi, {
3001
2957
  Parent: Error
3002
2958
  }), Wi = /* @__PURE__ */ Tt(K), qi = /* @__PURE__ */ Zt(K), Gi = /* @__PURE__ */ ot(K), Nn = /* @__PURE__ */ at(K), Yi = /* @__PURE__ */ Po(K), Hi = /* @__PURE__ */ Mo(K), Xi = /* @__PURE__ */ Ro(K), Ki = /* @__PURE__ */ Co(K), Qi = /* @__PURE__ */ xo(K), eu = /* @__PURE__ */ jo(K), tu = /* @__PURE__ */ Do(K), ru = /* @__PURE__ */ Lo(K), hr = /* @__PURE__ */ new WeakMap();
3003
2959
  function Je(e, t, r) {
@@ -3031,7 +2987,7 @@ function Je(e, t, r) {
3031
2987
  }
3032
2988
  }
3033
2989
  }
3034
- const U = /* @__PURE__ */ m("ZodType", (e, t) => (L.init(e, t), Object.assign(e["~standard"], {
2990
+ const U = /* @__PURE__ */ f("ZodType", (e, t) => (L.init(e, t), Object.assign(e["~standard"], {
3035
2991
  jsonSchema: {
3036
2992
  input: rt(e, "input"),
3037
2993
  output: rt(e, "output")
@@ -3130,11 +3086,10 @@ const U = /* @__PURE__ */ m("ZodType", (e, t) => (L.init(e, t), Object.assign(e[
3130
3086
  }
3131
3087
  }), Object.defineProperty(e, "description", {
3132
3088
  get() {
3133
- var r;
3134
- return (r = Re.get(e)) == null ? void 0 : r.description;
3089
+ return Re.get(e)?.description;
3135
3090
  },
3136
3091
  configurable: !0
3137
- }), e)), Pn = /* @__PURE__ */ m("_ZodString", (e, t) => {
3092
+ }), e)), Pn = /* @__PURE__ */ f("_ZodString", (e, t) => {
3138
3093
  At.init(e, t), U.init(e, t), e._zod.processJSONSchema = (n, o, a) => cn(e, n, o);
3139
3094
  const r = e._zod.bag;
3140
3095
  e.format = r.format ?? null, e.minLength = r.minimum ?? null, e.maxLength = r.maximum ?? null, Je(e, "_ZodString", {
@@ -3184,53 +3139,53 @@ const U = /* @__PURE__ */ m("ZodType", (e, t) => (L.init(e, t), Object.assign(e[
3184
3139
  return this.check(/* @__PURE__ */ fi());
3185
3140
  }
3186
3141
  });
3187
- }), nu = /* @__PURE__ */ m("ZodString", (e, t) => {
3142
+ }), nu = /* @__PURE__ */ f("ZodString", (e, t) => {
3188
3143
  At.init(e, t), Pn.init(e, t), e.email = (r) => e.check(/* @__PURE__ */ Os(ou, r)), e.url = (r) => e.check(/* @__PURE__ */ As(au, r)), e.jwt = (r) => e.check(/* @__PURE__ */ Ws(bu, r)), e.emoji = (r) => e.check(/* @__PURE__ */ Ns(su, r)), e.guid = (r) => e.check(/* @__PURE__ */ cr(mr, r)), e.uuid = (r) => e.check(/* @__PURE__ */ $s(Ge, r)), e.uuidv4 = (r) => e.check(/* @__PURE__ */ ks(Ge, r)), e.uuidv6 = (r) => e.check(/* @__PURE__ */ Ts(Ge, r)), e.uuidv7 = (r) => e.check(/* @__PURE__ */ Zs(Ge, r)), e.nanoid = (r) => e.check(/* @__PURE__ */ Ps(iu, r)), e.guid = (r) => e.check(/* @__PURE__ */ cr(mr, r)), e.cuid = (r) => e.check(/* @__PURE__ */ Ms(uu, r)), e.cuid2 = (r) => e.check(/* @__PURE__ */ Rs(cu, r)), e.ulid = (r) => e.check(/* @__PURE__ */ Cs(lu, r)), e.base64 = (r) => e.check(/* @__PURE__ */ Js(gu, r)), e.base64url = (r) => e.check(/* @__PURE__ */ Vs(_u, r)), e.xid = (r) => e.check(/* @__PURE__ */ xs(du, r)), e.ksuid = (r) => e.check(/* @__PURE__ */ js(pu, r)), e.ipv4 = (r) => e.check(/* @__PURE__ */ Ds(fu, r)), e.ipv6 = (r) => e.check(/* @__PURE__ */ Ls(hu, r)), e.cidrv4 = (r) => e.check(/* @__PURE__ */ Us(mu, r)), e.cidrv6 = (r) => e.check(/* @__PURE__ */ Fs(vu, r)), e.e164 = (r) => e.check(/* @__PURE__ */ Bs(yu, r)), e.datetime = (r) => e.check(ji(r)), e.date = (r) => e.check(Li(r)), e.time = (r) => e.check(Fi(r)), e.duration = (r) => e.check(Vi(r));
3189
3144
  });
3190
3145
  function v(e) {
3191
3146
  return /* @__PURE__ */ zs(nu, e);
3192
3147
  }
3193
- const J = /* @__PURE__ */ m("ZodStringFormat", (e, t) => {
3148
+ const J = /* @__PURE__ */ f("ZodStringFormat", (e, t) => {
3194
3149
  F.init(e, t), Pn.init(e, t);
3195
- }), ou = /* @__PURE__ */ m("ZodEmail", (e, t) => {
3150
+ }), ou = /* @__PURE__ */ f("ZodEmail", (e, t) => {
3196
3151
  Za.init(e, t), J.init(e, t);
3197
- }), mr = /* @__PURE__ */ m("ZodGUID", (e, t) => {
3152
+ }), mr = /* @__PURE__ */ f("ZodGUID", (e, t) => {
3198
3153
  ka.init(e, t), J.init(e, t);
3199
- }), Ge = /* @__PURE__ */ m("ZodUUID", (e, t) => {
3154
+ }), Ge = /* @__PURE__ */ f("ZodUUID", (e, t) => {
3200
3155
  Ta.init(e, t), J.init(e, t);
3201
- }), au = /* @__PURE__ */ m("ZodURL", (e, t) => {
3156
+ }), au = /* @__PURE__ */ f("ZodURL", (e, t) => {
3202
3157
  Aa.init(e, t), J.init(e, t);
3203
- }), su = /* @__PURE__ */ m("ZodEmoji", (e, t) => {
3158
+ }), su = /* @__PURE__ */ f("ZodEmoji", (e, t) => {
3204
3159
  Na.init(e, t), J.init(e, t);
3205
- }), iu = /* @__PURE__ */ m("ZodNanoID", (e, t) => {
3160
+ }), iu = /* @__PURE__ */ f("ZodNanoID", (e, t) => {
3206
3161
  Pa.init(e, t), J.init(e, t);
3207
- }), uu = /* @__PURE__ */ m("ZodCUID", (e, t) => {
3162
+ }), uu = /* @__PURE__ */ f("ZodCUID", (e, t) => {
3208
3163
  Ma.init(e, t), J.init(e, t);
3209
- }), cu = /* @__PURE__ */ m("ZodCUID2", (e, t) => {
3164
+ }), cu = /* @__PURE__ */ f("ZodCUID2", (e, t) => {
3210
3165
  Ra.init(e, t), J.init(e, t);
3211
- }), lu = /* @__PURE__ */ m("ZodULID", (e, t) => {
3166
+ }), lu = /* @__PURE__ */ f("ZodULID", (e, t) => {
3212
3167
  Ca.init(e, t), J.init(e, t);
3213
- }), du = /* @__PURE__ */ m("ZodXID", (e, t) => {
3168
+ }), du = /* @__PURE__ */ f("ZodXID", (e, t) => {
3214
3169
  xa.init(e, t), J.init(e, t);
3215
- }), pu = /* @__PURE__ */ m("ZodKSUID", (e, t) => {
3170
+ }), pu = /* @__PURE__ */ f("ZodKSUID", (e, t) => {
3216
3171
  ja.init(e, t), J.init(e, t);
3217
- }), fu = /* @__PURE__ */ m("ZodIPv4", (e, t) => {
3172
+ }), fu = /* @__PURE__ */ f("ZodIPv4", (e, t) => {
3218
3173
  Ja.init(e, t), J.init(e, t);
3219
- }), hu = /* @__PURE__ */ m("ZodIPv6", (e, t) => {
3174
+ }), hu = /* @__PURE__ */ f("ZodIPv6", (e, t) => {
3220
3175
  Va.init(e, t), J.init(e, t);
3221
- }), mu = /* @__PURE__ */ m("ZodCIDRv4", (e, t) => {
3176
+ }), mu = /* @__PURE__ */ f("ZodCIDRv4", (e, t) => {
3222
3177
  Ba.init(e, t), J.init(e, t);
3223
- }), vu = /* @__PURE__ */ m("ZodCIDRv6", (e, t) => {
3178
+ }), vu = /* @__PURE__ */ f("ZodCIDRv6", (e, t) => {
3224
3179
  Wa.init(e, t), J.init(e, t);
3225
- }), gu = /* @__PURE__ */ m("ZodBase64", (e, t) => {
3180
+ }), gu = /* @__PURE__ */ f("ZodBase64", (e, t) => {
3226
3181
  qa.init(e, t), J.init(e, t);
3227
- }), _u = /* @__PURE__ */ m("ZodBase64URL", (e, t) => {
3182
+ }), _u = /* @__PURE__ */ f("ZodBase64URL", (e, t) => {
3228
3183
  Ya.init(e, t), J.init(e, t);
3229
- }), yu = /* @__PURE__ */ m("ZodE164", (e, t) => {
3184
+ }), yu = /* @__PURE__ */ f("ZodE164", (e, t) => {
3230
3185
  Ha.init(e, t), J.init(e, t);
3231
- }), bu = /* @__PURE__ */ m("ZodJWT", (e, t) => {
3186
+ }), bu = /* @__PURE__ */ f("ZodJWT", (e, t) => {
3232
3187
  Ka.init(e, t), J.init(e, t);
3233
- }), Mn = /* @__PURE__ */ m("ZodNumber", (e, t) => {
3188
+ }), Mn = /* @__PURE__ */ f("ZodNumber", (e, t) => {
3234
3189
  tn.init(e, t), U.init(e, t), e._zod.processJSONSchema = (n, o, a) => ln(e, n, o), Je(e, "ZodNumber", {
3235
3190
  gt(n, o) {
3236
3191
  return this.check(/* @__PURE__ */ dr(n, o));
@@ -3284,37 +3239,37 @@ const J = /* @__PURE__ */ m("ZodStringFormat", (e, t) => {
3284
3239
  function wu(e) {
3285
3240
  return /* @__PURE__ */ Xs(Mn, e);
3286
3241
  }
3287
- const Iu = /* @__PURE__ */ m("ZodNumberFormat", (e, t) => {
3242
+ const Iu = /* @__PURE__ */ f("ZodNumberFormat", (e, t) => {
3288
3243
  Qa.init(e, t), Mn.init(e, t);
3289
3244
  });
3290
3245
  function vr(e) {
3291
3246
  return /* @__PURE__ */ Ks(Iu, e);
3292
3247
  }
3293
- const Eu = /* @__PURE__ */ m("ZodBoolean", (e, t) => {
3248
+ const Eu = /* @__PURE__ */ f("ZodBoolean", (e, t) => {
3294
3249
  es.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => dn(e, r, n);
3295
3250
  });
3296
3251
  function B(e) {
3297
3252
  return /* @__PURE__ */ Qs(Eu, e);
3298
3253
  }
3299
- const Su = /* @__PURE__ */ m("ZodNull", (e, t) => {
3254
+ const Su = /* @__PURE__ */ f("ZodNull", (e, t) => {
3300
3255
  ts.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => pn(e, r, n);
3301
3256
  });
3302
3257
  function zu(e) {
3303
3258
  return /* @__PURE__ */ ei(Su, e);
3304
3259
  }
3305
- const Ou = /* @__PURE__ */ m("ZodUnknown", (e, t) => {
3260
+ const Ou = /* @__PURE__ */ f("ZodUnknown", (e, t) => {
3306
3261
  rs.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => hn();
3307
3262
  });
3308
3263
  function re() {
3309
3264
  return /* @__PURE__ */ ti(Ou);
3310
3265
  }
3311
- const $u = /* @__PURE__ */ m("ZodNever", (e, t) => {
3266
+ const $u = /* @__PURE__ */ f("ZodNever", (e, t) => {
3312
3267
  ns.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => fn(e, r, n);
3313
3268
  });
3314
3269
  function ku(e) {
3315
3270
  return /* @__PURE__ */ ri($u, e);
3316
3271
  }
3317
- const Tu = /* @__PURE__ */ m("ZodArray", (e, t) => {
3272
+ const Tu = /* @__PURE__ */ f("ZodArray", (e, t) => {
3318
3273
  os.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => yn(e, r, n, o), e.element = t.element, Je(e, "ZodArray", {
3319
3274
  min(r, n) {
3320
3275
  return this.check(/* @__PURE__ */ Ke(r, n));
@@ -3336,8 +3291,8 @@ const Tu = /* @__PURE__ */ m("ZodArray", (e, t) => {
3336
3291
  function Pe(e, t) {
3337
3292
  return /* @__PURE__ */ hi(Tu, e, t);
3338
3293
  }
3339
- const Rn = /* @__PURE__ */ m("ZodObject", (e, t) => {
3340
- ss.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => bn(e, r, n, o), N(e, "shape", () => t.shape), Je(e, "ZodObject", {
3294
+ const Rn = /* @__PURE__ */ f("ZodObject", (e, t) => {
3295
+ ss.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => bn(e, r, n, o), M(e, "shape", () => t.shape), Je(e, "ZodObject", {
3341
3296
  keyof() {
3342
3297
  return xn(Object.keys(this._zod.def.shape));
3343
3298
  },
@@ -3379,7 +3334,7 @@ const Rn = /* @__PURE__ */ m("ZodObject", (e, t) => {
3379
3334
  }
3380
3335
  });
3381
3336
  });
3382
- function A(e, t) {
3337
+ function T(e, t) {
3383
3338
  const r = {
3384
3339
  type: "object",
3385
3340
  shape: e ?? {},
@@ -3387,7 +3342,7 @@ function A(e, t) {
3387
3342
  };
3388
3343
  return new Rn(r);
3389
3344
  }
3390
- function C(e, t) {
3345
+ function x(e, t) {
3391
3346
  return new Rn({
3392
3347
  type: "object",
3393
3348
  shape: e,
@@ -3395,7 +3350,7 @@ function C(e, t) {
3395
3350
  ...w(t)
3396
3351
  });
3397
3352
  }
3398
- const Cn = /* @__PURE__ */ m("ZodUnion", (e, t) => {
3353
+ const Cn = /* @__PURE__ */ f("ZodUnion", (e, t) => {
3399
3354
  on.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => wn(e, r, n, o), e.options = t.options;
3400
3355
  });
3401
3356
  function W(e, t) {
@@ -3405,7 +3360,7 @@ function W(e, t) {
3405
3360
  ...w(t)
3406
3361
  });
3407
3362
  }
3408
- const Zu = /* @__PURE__ */ m("ZodDiscriminatedUnion", (e, t) => {
3363
+ const Zu = /* @__PURE__ */ f("ZodDiscriminatedUnion", (e, t) => {
3409
3364
  Cn.init(e, t), is.init(e, t);
3410
3365
  });
3411
3366
  function Pt(e, t, r) {
@@ -3416,7 +3371,7 @@ function Pt(e, t, r) {
3416
3371
  ...w(r)
3417
3372
  });
3418
3373
  }
3419
- const Au = /* @__PURE__ */ m("ZodIntersection", (e, t) => {
3374
+ const Au = /* @__PURE__ */ f("ZodIntersection", (e, t) => {
3420
3375
  us.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => In(e, r, n, o);
3421
3376
  });
3422
3377
  function Nu(e, t) {
@@ -3426,7 +3381,7 @@ function Nu(e, t) {
3426
3381
  right: t
3427
3382
  });
3428
3383
  }
3429
- const gr = /* @__PURE__ */ m("ZodRecord", (e, t) => {
3384
+ const gr = /* @__PURE__ */ f("ZodRecord", (e, t) => {
3430
3385
  cs.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => En(e, r, n, o), e.keyType = t.keyType, e.valueType = t.valueType;
3431
3386
  });
3432
3387
  function ne(e, t, r) {
@@ -3442,7 +3397,7 @@ function ne(e, t, r) {
3442
3397
  ...w(r)
3443
3398
  });
3444
3399
  }
3445
- const yt = /* @__PURE__ */ m("ZodEnum", (e, t) => {
3400
+ const yt = /* @__PURE__ */ f("ZodEnum", (e, t) => {
3446
3401
  ls.init(e, t), U.init(e, t), e._zod.processJSONSchema = (n, o, a) => mn(e, n, o), e.enum = t.entries, e.options = Object.values(t.entries);
3447
3402
  const r = new Set(Object.keys(t.entries));
3448
3403
  e.extract = (n, o) => {
@@ -3481,7 +3436,7 @@ function xn(e, t) {
3481
3436
  ...w(t)
3482
3437
  });
3483
3438
  }
3484
- const Pu = /* @__PURE__ */ m("ZodLiteral", (e, t) => {
3439
+ const Pu = /* @__PURE__ */ f("ZodLiteral", (e, t) => {
3485
3440
  ds.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => vn(e, r, n), e.values = new Set(t.values), Object.defineProperty(e, "value", {
3486
3441
  get() {
3487
3442
  if (t.values.length > 1)
@@ -3490,14 +3445,14 @@ const Pu = /* @__PURE__ */ m("ZodLiteral", (e, t) => {
3490
3445
  }
3491
3446
  });
3492
3447
  });
3493
- function b(e, t) {
3448
+ function y(e, t) {
3494
3449
  return new Pu({
3495
3450
  type: "literal",
3496
3451
  values: Array.isArray(e) ? e : [e],
3497
3452
  ...w(t)
3498
3453
  });
3499
3454
  }
3500
- const Mu = /* @__PURE__ */ m("ZodTransform", (e, t) => {
3455
+ const Mu = /* @__PURE__ */ f("ZodTransform", (e, t) => {
3501
3456
  ps.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => _n(e, r), e._zod.parse = (r, n) => {
3502
3457
  if (n.direction === "backward")
3503
3458
  throw new Lr(e.constructor.name);
@@ -3519,7 +3474,7 @@ function Ru(e) {
3519
3474
  transform: e
3520
3475
  });
3521
3476
  }
3522
- const jn = /* @__PURE__ */ m("ZodOptional", (e, t) => {
3477
+ const jn = /* @__PURE__ */ f("ZodOptional", (e, t) => {
3523
3478
  an.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => Nt(e, r, n, o), e.unwrap = () => e._zod.def.innerType;
3524
3479
  });
3525
3480
  function _r(e) {
@@ -3528,7 +3483,7 @@ function _r(e) {
3528
3483
  innerType: e
3529
3484
  });
3530
3485
  }
3531
- const Cu = /* @__PURE__ */ m("ZodExactOptional", (e, t) => {
3486
+ const Cu = /* @__PURE__ */ f("ZodExactOptional", (e, t) => {
3532
3487
  fs.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => Nt(e, r, n, o), e.unwrap = () => e._zod.def.innerType;
3533
3488
  });
3534
3489
  function xu(e) {
@@ -3537,7 +3492,7 @@ function xu(e) {
3537
3492
  innerType: e
3538
3493
  });
3539
3494
  }
3540
- const ju = /* @__PURE__ */ m("ZodNullable", (e, t) => {
3495
+ const ju = /* @__PURE__ */ f("ZodNullable", (e, t) => {
3541
3496
  hs.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => Sn(e, r, n, o), e.unwrap = () => e._zod.def.innerType;
3542
3497
  });
3543
3498
  function yr(e) {
@@ -3546,7 +3501,7 @@ function yr(e) {
3546
3501
  innerType: e
3547
3502
  });
3548
3503
  }
3549
- const Du = /* @__PURE__ */ m("ZodDefault", (e, t) => {
3504
+ const Du = /* @__PURE__ */ f("ZodDefault", (e, t) => {
3550
3505
  ms.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => On(e, r, n, o), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
3551
3506
  });
3552
3507
  function Lu(e, t) {
@@ -3558,7 +3513,7 @@ function Lu(e, t) {
3558
3513
  }
3559
3514
  });
3560
3515
  }
3561
- const Uu = /* @__PURE__ */ m("ZodPrefault", (e, t) => {
3516
+ const Uu = /* @__PURE__ */ f("ZodPrefault", (e, t) => {
3562
3517
  vs.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => $n(e, r, n, o), e.unwrap = () => e._zod.def.innerType;
3563
3518
  });
3564
3519
  function Fu(e, t) {
@@ -3570,7 +3525,7 @@ function Fu(e, t) {
3570
3525
  }
3571
3526
  });
3572
3527
  }
3573
- const Dn = /* @__PURE__ */ m("ZodNonOptional", (e, t) => {
3528
+ const Dn = /* @__PURE__ */ f("ZodNonOptional", (e, t) => {
3574
3529
  gs.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => zn(e, r, n, o), e.unwrap = () => e._zod.def.innerType;
3575
3530
  });
3576
3531
  function Ju(e, t) {
@@ -3580,7 +3535,7 @@ function Ju(e, t) {
3580
3535
  ...w(t)
3581
3536
  });
3582
3537
  }
3583
- const Vu = /* @__PURE__ */ m("ZodCatch", (e, t) => {
3538
+ const Vu = /* @__PURE__ */ f("ZodCatch", (e, t) => {
3584
3539
  _s.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => kn(e, r, n, o), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
3585
3540
  });
3586
3541
  function Bu(e, t) {
@@ -3590,7 +3545,7 @@ function Bu(e, t) {
3590
3545
  catchValue: typeof t == "function" ? t : () => t
3591
3546
  });
3592
3547
  }
3593
- const Wu = /* @__PURE__ */ m("ZodPipe", (e, t) => {
3548
+ const Wu = /* @__PURE__ */ f("ZodPipe", (e, t) => {
3594
3549
  ys.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => Tn(e, r, n, o), e.in = t.in, e.out = t.out;
3595
3550
  });
3596
3551
  function br(e, t) {
@@ -3601,7 +3556,7 @@ function br(e, t) {
3601
3556
  // ...util.normalizeParams(params),
3602
3557
  });
3603
3558
  }
3604
- const qu = /* @__PURE__ */ m("ZodReadonly", (e, t) => {
3559
+ const qu = /* @__PURE__ */ f("ZodReadonly", (e, t) => {
3605
3560
  bs.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => Zn(e, r, n, o), e.unwrap = () => e._zod.def.innerType;
3606
3561
  });
3607
3562
  function Gu(e) {
@@ -3610,7 +3565,7 @@ function Gu(e) {
3610
3565
  innerType: e
3611
3566
  });
3612
3567
  }
3613
- const Yu = /* @__PURE__ */ m("ZodLazy", (e, t) => {
3568
+ const Yu = /* @__PURE__ */ f("ZodLazy", (e, t) => {
3614
3569
  ws.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => An(e, r, n, o), e.unwrap = () => e._zod.def.getter();
3615
3570
  });
3616
3571
  function Hu(e) {
@@ -3619,7 +3574,7 @@ function Hu(e) {
3619
3574
  getter: e
3620
3575
  });
3621
3576
  }
3622
- const Mt = /* @__PURE__ */ m("ZodCustom", (e, t) => {
3577
+ const Mt = /* @__PURE__ */ f("ZodCustom", (e, t) => {
3623
3578
  Is.init(e, t), U.init(e, t), e._zod.processJSONSchema = (r, n, o) => gn(e, r);
3624
3579
  });
3625
3580
  function Ln(e, t) {
@@ -3649,10 +3604,10 @@ function _e(e, t = {}) {
3649
3604
  });
3650
3605
  }, r;
3651
3606
  }
3652
- var T;
3607
+ var O;
3653
3608
  (function(e) {
3654
3609
  e.ZodString = "ZodString", e.ZodNumber = "ZodNumber", e.ZodNaN = "ZodNaN", e.ZodBigInt = "ZodBigInt", e.ZodBoolean = "ZodBoolean", e.ZodDate = "ZodDate", e.ZodSymbol = "ZodSymbol", e.ZodUndefined = "ZodUndefined", e.ZodNull = "ZodNull", e.ZodAny = "ZodAny", e.ZodUnknown = "ZodUnknown", e.ZodNever = "ZodNever", e.ZodVoid = "ZodVoid", e.ZodArray = "ZodArray", e.ZodObject = "ZodObject", e.ZodUnion = "ZodUnion", e.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", e.ZodIntersection = "ZodIntersection", e.ZodTuple = "ZodTuple", e.ZodRecord = "ZodRecord", e.ZodMap = "ZodMap", e.ZodSet = "ZodSet", e.ZodFunction = "ZodFunction", e.ZodLazy = "ZodLazy", e.ZodLiteral = "ZodLiteral", e.ZodEnum = "ZodEnum", e.ZodEffects = "ZodEffects", e.ZodNativeEnum = "ZodNativeEnum", e.ZodOptional = "ZodOptional", e.ZodNullable = "ZodNullable", e.ZodDefault = "ZodDefault", e.ZodCatch = "ZodCatch", e.ZodPromise = "ZodPromise", e.ZodBranded = "ZodBranded", e.ZodPipeline = "ZodPipeline", e.ZodReadonly = "ZodReadonly";
3655
- })(T || (T = {}));
3610
+ })(O || (O = {}));
3656
3611
  class dt extends Error {
3657
3612
  constructor(t, r) {
3658
3613
  super(t), this.name = "ParseError", this.type = r.type, this.field = r.field, this.value = r.value, this.line = r.line;
@@ -3667,118 +3622,118 @@ function ec(e) {
3667
3622
  "`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
3668
3623
  );
3669
3624
  const { onEvent: t = pt, onError: r = pt, onRetry: n = pt, onComment: o, maxBufferSize: a } = e, i = [];
3670
- let s = 0, d = !0, u, l = "", p = 0, h, f = !1;
3671
- function z(_) {
3672
- if (f)
3625
+ let s = 0, l = !0, u, d = "", p = 0, m, h = !1;
3626
+ function I(g) {
3627
+ if (h)
3673
3628
  throw new Error(
3674
3629
  "Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing."
3675
3630
  );
3676
- if (d && (d = !1, _.charCodeAt(0) === 239 && _.charCodeAt(1) === 187 && _.charCodeAt(2) === 191 && (_ = _.slice(3))), i.length === 0) {
3677
- const $ = I(_);
3678
- $ !== "" && (i.push($), s = $.length), S();
3631
+ if (l && (l = !1, g.charCodeAt(0) === 239 && g.charCodeAt(1) === 187 && g.charCodeAt(2) === 191 && (g = g.slice(3))), i.length === 0) {
3632
+ const $ = _(g);
3633
+ $ !== "" && (i.push($), s = $.length), Z();
3679
3634
  return;
3680
3635
  }
3681
- if (_.indexOf(`
3682
- `) === -1 && _.indexOf("\r") === -1) {
3683
- i.push(_), s += _.length, S();
3636
+ if (g.indexOf(`
3637
+ `) === -1 && g.indexOf("\r") === -1) {
3638
+ i.push(g), s += g.length, Z();
3684
3639
  return;
3685
3640
  }
3686
- i.push(_);
3641
+ i.push(g);
3687
3642
  const c = i.join("");
3688
3643
  i.length = 0, s = 0;
3689
- const g = I(c);
3690
- g !== "" && (i.push(g), s = g.length), S();
3644
+ const b = _(c);
3645
+ b !== "" && (i.push(b), s = b.length), Z();
3691
3646
  }
3692
- function S() {
3693
- a !== void 0 && (s + l.length <= a || (f = !0, i.length = 0, s = 0, u = void 0, l = "", p = 0, h = void 0, r(
3647
+ function Z() {
3648
+ a !== void 0 && (s + d.length <= a || (h = !0, i.length = 0, s = 0, u = void 0, d = "", p = 0, m = void 0, r(
3694
3649
  new dt(`Buffered data exceeded max buffer size of ${a} characters`, {
3695
3650
  type: "max-buffer-size-exceeded"
3696
3651
  })
3697
3652
  )));
3698
3653
  }
3699
- function I(_) {
3654
+ function _(g) {
3700
3655
  let c = 0;
3701
- if (_.indexOf("\r") === -1) {
3702
- let g = _.indexOf(`
3656
+ if (g.indexOf("\r") === -1) {
3657
+ let b = g.indexOf(`
3703
3658
  `, c);
3704
- for (; g !== -1; ) {
3705
- if (c === g) {
3706
- p > 0 && t({ id: u, event: h, data: l }), u = void 0, l = "", p = 0, h = void 0, c = g + 1, g = _.indexOf(`
3659
+ for (; b !== -1; ) {
3660
+ if (c === b) {
3661
+ p > 0 && t({ id: u, event: m, data: d }), u = void 0, d = "", p = 0, m = void 0, c = b + 1, b = g.indexOf(`
3707
3662
  `, c);
3708
3663
  continue;
3709
3664
  }
3710
- const $ = _.charCodeAt(c);
3711
- if (Ir(_, c, $)) {
3712
- const Z = _.charCodeAt(c + 5) === me ? c + 6 : c + 5, O = _.slice(Z, g);
3713
- if (p === 0 && _.charCodeAt(g + 1) === wr) {
3714
- t({ id: u, event: h, data: O }), u = void 0, l = "", h = void 0, c = g + 2, g = _.indexOf(`
3665
+ const $ = g.charCodeAt(c);
3666
+ if (Ir(g, c, $)) {
3667
+ const A = g.charCodeAt(c + 5) === me ? c + 6 : c + 5, S = g.slice(A, b);
3668
+ if (p === 0 && g.charCodeAt(b + 1) === wr) {
3669
+ t({ id: u, event: m, data: S }), u = void 0, d = "", m = void 0, c = b + 2, b = g.indexOf(`
3715
3670
  `, c);
3716
3671
  continue;
3717
3672
  }
3718
- l = p === 0 ? O : `${l}
3719
- ${O}`, p++;
3720
- } else Er(_, c, $) ? h = _.slice(
3721
- _.charCodeAt(c + 6) === me ? c + 7 : c + 6,
3722
- g
3723
- ) || void 0 : y(_, c, g);
3724
- c = g + 1, g = _.indexOf(`
3673
+ d = p === 0 ? S : `${d}
3674
+ ${S}`, p++;
3675
+ } else Er(g, c, $) ? m = g.slice(
3676
+ g.charCodeAt(c + 6) === me ? c + 7 : c + 6,
3677
+ b
3678
+ ) || void 0 : E(g, c, b);
3679
+ c = b + 1, b = g.indexOf(`
3725
3680
  `, c);
3726
3681
  }
3727
- return _.slice(c);
3682
+ return g.slice(c);
3728
3683
  }
3729
- for (; c < _.length; ) {
3730
- const g = _.indexOf("\r", c), $ = _.indexOf(`
3684
+ for (; c < g.length; ) {
3685
+ const b = g.indexOf("\r", c), $ = g.indexOf(`
3731
3686
  `, c);
3732
- let Z = -1;
3733
- if (g !== -1 && $ !== -1 ? Z = g < $ ? g : $ : g !== -1 ? g === _.length - 1 ? Z = -1 : Z = g : $ !== -1 && (Z = $), Z === -1)
3687
+ let A = -1;
3688
+ if (b !== -1 && $ !== -1 ? A = b < $ ? b : $ : b !== -1 ? b === g.length - 1 ? A = -1 : A = b : $ !== -1 && (A = $), A === -1)
3734
3689
  break;
3735
- y(_, c, Z), c = Z + 1, _.charCodeAt(c - 1) === Qu && _.charCodeAt(c) === wr && c++;
3690
+ E(g, c, A), c = A + 1, g.charCodeAt(c - 1) === Qu && g.charCodeAt(c) === wr && c++;
3736
3691
  }
3737
- return _.slice(c);
3692
+ return g.slice(c);
3738
3693
  }
3739
- function y(_, c, g) {
3740
- if (c === g) {
3741
- M();
3694
+ function E(g, c, b) {
3695
+ if (c === b) {
3696
+ N();
3742
3697
  return;
3743
3698
  }
3744
- const $ = _.charCodeAt(c);
3745
- if (Ir(_, c, $)) {
3746
- const ce = _.charCodeAt(c + 5) === me ? c + 6 : c + 5, jt = _.slice(ce, g);
3747
- l = p === 0 ? jt : `${l}
3699
+ const $ = g.charCodeAt(c);
3700
+ if (Ir(g, c, $)) {
3701
+ const ce = g.charCodeAt(c + 5) === me ? c + 6 : c + 5, jt = g.slice(ce, b);
3702
+ d = p === 0 ? jt : `${d}
3748
3703
  ${jt}`, p++;
3749
3704
  return;
3750
3705
  }
3751
- if (Er(_, c, $)) {
3752
- h = _.slice(_.charCodeAt(c + 6) === me ? c + 7 : c + 6, g) || void 0;
3706
+ if (Er(g, c, $)) {
3707
+ m = g.slice(g.charCodeAt(c + 6) === me ? c + 7 : c + 6, b) || void 0;
3753
3708
  return;
3754
3709
  }
3755
- if ($ === 105 && _.charCodeAt(c + 1) === 100 && _.charCodeAt(c + 2) === 58) {
3756
- const ce = _.slice(_.charCodeAt(c + 3) === me ? c + 4 : c + 3, g);
3710
+ if ($ === 105 && g.charCodeAt(c + 1) === 100 && g.charCodeAt(c + 2) === 58) {
3711
+ const ce = g.slice(g.charCodeAt(c + 3) === me ? c + 4 : c + 3, b);
3757
3712
  u = ce.includes("\0") ? void 0 : ce;
3758
3713
  return;
3759
3714
  }
3760
3715
  if ($ === 58) {
3761
3716
  if (o) {
3762
- const ce = _.slice(c, g);
3763
- o(ce.slice(_.charCodeAt(c + 1) === me ? 2 : 1));
3717
+ const ce = g.slice(c, b);
3718
+ o(ce.slice(g.charCodeAt(c + 1) === me ? 2 : 1));
3764
3719
  }
3765
3720
  return;
3766
3721
  }
3767
- const Z = _.slice(c, g), O = Z.indexOf(":");
3768
- if (O === -1) {
3769
- E(Z, "", Z);
3722
+ const A = g.slice(c, b), S = A.indexOf(":");
3723
+ if (S === -1) {
3724
+ k(A, "", A);
3770
3725
  return;
3771
3726
  }
3772
- const P = Z.slice(0, O), V = Z.charCodeAt(O + 1) === me ? 2 : 1, oe = Z.slice(O + V);
3773
- E(P, oe, Z);
3727
+ const R = A.slice(0, S), V = A.charCodeAt(S + 1) === me ? 2 : 1, oe = A.slice(S + V);
3728
+ k(R, oe, A);
3774
3729
  }
3775
- function E(_, c, g) {
3776
- switch (_) {
3730
+ function k(g, c, b) {
3731
+ switch (g) {
3777
3732
  case "event":
3778
- h = c || void 0;
3733
+ m = c || void 0;
3779
3734
  break;
3780
3735
  case "data":
3781
- l = p === 0 ? c : `${l}
3736
+ d = p === 0 ? c : `${d}
3782
3737
  ${c}`, p++;
3783
3738
  break;
3784
3739
  case "id":
@@ -3789,35 +3744,35 @@ ${c}`, p++;
3789
3744
  new dt(`Invalid \`retry\` value: "${c}"`, {
3790
3745
  type: "invalid-retry",
3791
3746
  value: c,
3792
- line: g
3747
+ line: b
3793
3748
  })
3794
3749
  );
3795
3750
  break;
3796
3751
  default:
3797
3752
  r(
3798
3753
  new dt(
3799
- `Unknown field "${_.length > 20 ? `${_.slice(0, 20)}…` : _}"`,
3800
- { type: "unknown-field", field: _, value: c, line: g }
3754
+ `Unknown field "${g.length > 20 ? `${g.slice(0, 20)}…` : g}"`,
3755
+ { type: "unknown-field", field: g, value: c, line: b }
3801
3756
  )
3802
3757
  );
3803
3758
  break;
3804
3759
  }
3805
3760
  }
3806
- function M() {
3761
+ function N() {
3807
3762
  p > 0 && t({
3808
3763
  id: u,
3809
- event: h,
3810
- data: l
3811
- }), u = void 0, l = "", p = 0, h = void 0;
3764
+ event: m,
3765
+ data: d
3766
+ }), u = void 0, d = "", p = 0, m = void 0;
3812
3767
  }
3813
- function x(_ = {}) {
3814
- if (_.consume && i.length > 0) {
3768
+ function P(g = {}) {
3769
+ if (g.consume && i.length > 0) {
3815
3770
  const c = i.join("");
3816
- y(c, 0, c.length);
3771
+ E(c, 0, c.length);
3817
3772
  }
3818
- d = !0, u = void 0, l = "", p = 0, h = void 0, i.length = 0, s = 0, f = !1;
3773
+ l = !0, u = void 0, d = "", p = 0, m = void 0, i.length = 0, s = 0, h = !1;
3819
3774
  }
3820
- return { feed: z, reset: x };
3775
+ return { feed: I, reset: P };
3821
3776
  }
3822
3777
  function Ir(e, t, r) {
3823
3778
  return r === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
@@ -3980,7 +3935,7 @@ function lc(e, t) {
3980
3935
  const a = {
3981
3936
  type: "array"
3982
3937
  };
3983
- return (r = e.type) != null && r._def && ((o = (n = e.type) == null ? void 0 : n._def) == null ? void 0 : o.typeName) !== T.ZodAny && (a.items = R(e.type._def, {
3938
+ return (r = e.type) != null && r._def && ((o = (n = e.type) == null ? void 0 : n._def) == null ? void 0 : o.typeName) !== O.ZodAny && (a.items = C(e.type._def, {
3984
3939
  ...t,
3985
3940
  currentPath: [...t.currentPath, "items"]
3986
3941
  })), e.minLength && (a.minItems = e.minLength.value), e.maxLength && (a.maxItems = e.maxLength.value), e.exactLength && (a.minItems = e.exactLength.value, a.maxItems = e.exactLength.value), a;
@@ -4009,9 +3964,9 @@ function pc() {
4009
3964
  return { type: "boolean" };
4010
3965
  }
4011
3966
  function Un(e, t) {
4012
- return R(e.type._def, t);
3967
+ return C(e.type._def, t);
4013
3968
  }
4014
- var fc = (e, t) => R(e.innerType._def, t);
3969
+ var fc = (e, t) => C(e.innerType._def, t);
4015
3970
  function Fn(e, t, r) {
4016
3971
  const n = r ?? t.dateStrategy;
4017
3972
  if (Array.isArray(n))
@@ -4052,12 +4007,12 @@ var hc = (e) => {
4052
4007
  };
4053
4008
  function mc(e, t) {
4054
4009
  return {
4055
- ...R(e.innerType._def, t),
4010
+ ...C(e.innerType._def, t),
4056
4011
  default: e.defaultValue()
4057
4012
  };
4058
4013
  }
4059
4014
  function vc(e, t) {
4060
- return t.effectStrategy === "input" ? R(e.schema._def, t) : H();
4015
+ return t.effectStrategy === "input" ? C(e.schema._def, t) : H();
4061
4016
  }
4062
4017
  function gc(e) {
4063
4018
  return {
@@ -4068,11 +4023,11 @@ function gc(e) {
4068
4023
  var _c = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
4069
4024
  function yc(e, t) {
4070
4025
  const r = [
4071
- R(e.left._def, {
4026
+ C(e.left._def, {
4072
4027
  ...t,
4073
4028
  currentPath: [...t.currentPath, "allOf", "0"]
4074
4029
  }),
4075
- R(e.right._def, {
4030
+ C(e.right._def, {
4076
4031
  ...t,
4077
4032
  currentPath: [...t.currentPath, "allOf", "1"]
4078
4033
  })
@@ -4310,7 +4265,7 @@ function Or(e, t) {
4310
4265
  s: e.flags.includes("s")
4311
4266
  // `.` matches newlines
4312
4267
  }, o = n.i ? e.source.toLowerCase() : e.source;
4313
- let a = "", i = !1, s = !1, d = !1;
4268
+ let a = "", i = !1, s = !1, l = !1;
4314
4269
  for (let u = 0; u < o.length; u++) {
4315
4270
  if (i) {
4316
4271
  a += o[u], i = !1;
@@ -4319,7 +4274,7 @@ function Or(e, t) {
4319
4274
  if (n.i) {
4320
4275
  if (s) {
4321
4276
  if (o[u].match(/[a-z]/)) {
4322
- d ? (a += o[u], a += `${o[u - 2]}-${o[u]}`.toUpperCase(), d = !1) : o[u + 1] === "-" && ((r = o[u + 2]) != null && r.match(/[a-z]/)) ? (a += o[u], d = !0) : a += `${o[u]}${o[u].toUpperCase()}`;
4277
+ l ? (a += o[u], a += `${o[u - 2]}-${o[u]}`.toUpperCase(), l = !1) : o[u + 1] === "-" && ((r = o[u + 2]) != null && r.match(/[a-z]/)) ? (a += o[u], l = !0) : a += `${o[u]}${o[u].toUpperCase()}`;
4323
4278
  continue;
4324
4279
  }
4325
4280
  } else if (o[u].match(/[a-z]/)) {
@@ -4359,47 +4314,47 @@ function Or(e, t) {
4359
4314
  }
4360
4315
  function Vn(e, t) {
4361
4316
  var r, n, o, a, i, s;
4362
- const d = {
4317
+ const l = {
4363
4318
  type: "object",
4364
- additionalProperties: (r = R(e.valueType._def, {
4319
+ additionalProperties: (r = C(e.valueType._def, {
4365
4320
  ...t,
4366
4321
  currentPath: [...t.currentPath, "additionalProperties"]
4367
4322
  })) != null ? r : t.allowedAdditionalProperties
4368
4323
  };
4369
- if (((n = e.keyType) == null ? void 0 : n._def.typeName) === T.ZodString && ((o = e.keyType._def.checks) != null && o.length)) {
4370
- const { type: u, ...l } = Jn(e.keyType._def, t);
4324
+ if (((n = e.keyType) == null ? void 0 : n._def.typeName) === O.ZodString && ((o = e.keyType._def.checks) != null && o.length)) {
4325
+ const { type: u, ...d } = Jn(e.keyType._def, t);
4371
4326
  return {
4372
- ...d,
4373
- propertyNames: l
4327
+ ...l,
4328
+ propertyNames: d
4374
4329
  };
4375
4330
  } else {
4376
- if (((a = e.keyType) == null ? void 0 : a._def.typeName) === T.ZodEnum)
4331
+ if (((a = e.keyType) == null ? void 0 : a._def.typeName) === O.ZodEnum)
4377
4332
  return {
4378
- ...d,
4333
+ ...l,
4379
4334
  propertyNames: {
4380
4335
  enum: e.keyType._def.values
4381
4336
  }
4382
4337
  };
4383
- if (((i = e.keyType) == null ? void 0 : i._def.typeName) === T.ZodBranded && e.keyType._def.type._def.typeName === T.ZodString && ((s = e.keyType._def.type._def.checks) != null && s.length)) {
4384
- const { type: u, ...l } = Un(
4338
+ if (((i = e.keyType) == null ? void 0 : i._def.typeName) === O.ZodBranded && e.keyType._def.type._def.typeName === O.ZodString && ((s = e.keyType._def.type._def.checks) != null && s.length)) {
4339
+ const { type: u, ...d } = Un(
4385
4340
  e.keyType._def,
4386
4341
  t
4387
4342
  );
4388
4343
  return {
4389
- ...d,
4390
- propertyNames: l
4344
+ ...l,
4345
+ propertyNames: d
4391
4346
  };
4392
4347
  }
4393
4348
  }
4394
- return d;
4349
+ return l;
4395
4350
  }
4396
4351
  function Ec(e, t) {
4397
4352
  if (t.mapStrategy === "record")
4398
4353
  return Vn(e, t);
4399
- const r = R(e.keyType._def, {
4354
+ const r = C(e.keyType._def, {
4400
4355
  ...t,
4401
4356
  currentPath: [...t.currentPath, "items", "items", "0"]
4402
- }) || H(), n = R(e.valueType._def, {
4357
+ }) || H(), n = C(e.valueType._def, {
4403
4358
  ...t,
4404
4359
  currentPath: [...t.currentPath, "items", "items", "1"]
4405
4360
  }) || H();
@@ -4497,7 +4452,7 @@ function $c(e, t) {
4497
4452
  }
4498
4453
  var kc = (e, t) => {
4499
4454
  const r = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map(
4500
- (n, o) => R(n._def, {
4455
+ (n, o) => C(n._def, {
4501
4456
  ...t,
4502
4457
  currentPath: [...t.currentPath, "anyOf", `${o}`]
4503
4458
  })
@@ -4516,7 +4471,7 @@ function Tc(e, t) {
4516
4471
  "null"
4517
4472
  ]
4518
4473
  };
4519
- const r = R(e.innerType._def, {
4474
+ const r = C(e.innerType._def, {
4520
4475
  ...t,
4521
4476
  currentPath: [...t.currentPath, "anyOf", "0"]
4522
4477
  });
@@ -4553,12 +4508,12 @@ function Ac(e, t) {
4553
4508
  let s = o[i];
4554
4509
  if (s === void 0 || s._def === void 0)
4555
4510
  continue;
4556
- const d = Pc(s), u = R(s._def, {
4511
+ const l = Pc(s), u = C(s._def, {
4557
4512
  ...t,
4558
4513
  currentPath: [...t.currentPath, "properties", i],
4559
4514
  propertyPath: [...t.currentPath, "properties", i]
4560
4515
  });
4561
- u !== void 0 && (r.properties[i] = u, d || n.push(i));
4516
+ u !== void 0 && (r.properties[i] = u, l || n.push(i));
4562
4517
  }
4563
4518
  n.length && (r.required = n);
4564
4519
  const a = Nc(e, t);
@@ -4566,7 +4521,7 @@ function Ac(e, t) {
4566
4521
  }
4567
4522
  function Nc(e, t) {
4568
4523
  if (e.catchall._def.typeName !== "ZodNever")
4569
- return R(e.catchall._def, {
4524
+ return C(e.catchall._def, {
4570
4525
  ...t,
4571
4526
  currentPath: [...t.currentPath, "additionalProperties"]
4572
4527
  });
@@ -4589,21 +4544,21 @@ function Pc(e) {
4589
4544
  var Mc = (e, t) => {
4590
4545
  var r;
4591
4546
  if (t.currentPath.toString() === ((r = t.propertyPath) == null ? void 0 : r.toString()))
4592
- return R(e.innerType._def, t);
4593
- const n = R(e.innerType._def, {
4547
+ return C(e.innerType._def, t);
4548
+ const n = C(e.innerType._def, {
4594
4549
  ...t,
4595
4550
  currentPath: [...t.currentPath, "anyOf", "1"]
4596
4551
  });
4597
4552
  return n ? { anyOf: [{ not: H() }, n] } : H();
4598
4553
  }, Rc = (e, t) => {
4599
4554
  if (t.pipeStrategy === "input")
4600
- return R(e.in._def, t);
4555
+ return C(e.in._def, t);
4601
4556
  if (t.pipeStrategy === "output")
4602
- return R(e.out._def, t);
4603
- const r = R(e.in._def, {
4557
+ return C(e.out._def, t);
4558
+ const r = C(e.in._def, {
4604
4559
  ...t,
4605
4560
  currentPath: [...t.currentPath, "allOf", "0"]
4606
- }), n = R(e.out._def, {
4561
+ }), n = C(e.out._def, {
4607
4562
  ...t,
4608
4563
  currentPath: [...t.currentPath, "allOf", r ? "1" : "0"]
4609
4564
  });
@@ -4614,13 +4569,13 @@ var Mc = (e, t) => {
4614
4569
  };
4615
4570
  };
4616
4571
  function Cc(e, t) {
4617
- return R(e.type._def, t);
4572
+ return C(e.type._def, t);
4618
4573
  }
4619
4574
  function xc(e, t) {
4620
4575
  const n = {
4621
4576
  type: "array",
4622
4577
  uniqueItems: !0,
4623
- items: R(e.valueType._def, {
4578
+ items: C(e.valueType._def, {
4624
4579
  ...t,
4625
4580
  currentPath: [...t.currentPath, "items"]
4626
4581
  })
@@ -4632,7 +4587,7 @@ function jc(e, t) {
4632
4587
  type: "array",
4633
4588
  minItems: e.items.length,
4634
4589
  items: e.items.map(
4635
- (r, n) => R(r._def, {
4590
+ (r, n) => C(r._def, {
4636
4591
  ...t,
4637
4592
  currentPath: [...t.currentPath, "items", `${n}`]
4638
4593
  })
@@ -4640,7 +4595,7 @@ function jc(e, t) {
4640
4595
  (r, n) => n === void 0 ? r : [...r, n],
4641
4596
  []
4642
4597
  ),
4643
- additionalItems: R(e.rest._def, {
4598
+ additionalItems: C(e.rest._def, {
4644
4599
  ...t,
4645
4600
  currentPath: [...t.currentPath, "additionalItems"]
4646
4601
  })
@@ -4649,7 +4604,7 @@ function jc(e, t) {
4649
4604
  minItems: e.items.length,
4650
4605
  maxItems: e.items.length,
4651
4606
  items: e.items.map(
4652
- (r, n) => R(r._def, {
4607
+ (r, n) => C(r._def, {
4653
4608
  ...t,
4654
4609
  currentPath: [...t.currentPath, "items", `${n}`]
4655
4610
  })
@@ -4667,75 +4622,75 @@ function Dc() {
4667
4622
  function Lc() {
4668
4623
  return H();
4669
4624
  }
4670
- var Uc = (e, t) => R(e.innerType._def, t), Fc = (e, t, r) => {
4625
+ var Uc = (e, t) => C(e.innerType._def, t), Fc = (e, t, r) => {
4671
4626
  switch (t) {
4672
- case T.ZodString:
4627
+ case O.ZodString:
4673
4628
  return Jn(e, r);
4674
- case T.ZodNumber:
4629
+ case O.ZodNumber:
4675
4630
  return Zc(e);
4676
- case T.ZodObject:
4631
+ case O.ZodObject:
4677
4632
  return Ac(e, r);
4678
- case T.ZodBigInt:
4633
+ case O.ZodBigInt:
4679
4634
  return dc(e);
4680
- case T.ZodBoolean:
4635
+ case O.ZodBoolean:
4681
4636
  return pc();
4682
- case T.ZodDate:
4637
+ case O.ZodDate:
4683
4638
  return Fn(e, r);
4684
- case T.ZodUndefined:
4639
+ case O.ZodUndefined:
4685
4640
  return Dc();
4686
- case T.ZodNull:
4641
+ case O.ZodNull:
4687
4642
  return Oc();
4688
- case T.ZodArray:
4643
+ case O.ZodArray:
4689
4644
  return lc(e, r);
4690
- case T.ZodUnion:
4691
- case T.ZodDiscriminatedUnion:
4645
+ case O.ZodUnion:
4646
+ case O.ZodDiscriminatedUnion:
4692
4647
  return $c(e, r);
4693
- case T.ZodIntersection:
4648
+ case O.ZodIntersection:
4694
4649
  return yc(e, r);
4695
- case T.ZodTuple:
4650
+ case O.ZodTuple:
4696
4651
  return jc(e, r);
4697
- case T.ZodRecord:
4652
+ case O.ZodRecord:
4698
4653
  return Vn(e, r);
4699
- case T.ZodLiteral:
4654
+ case O.ZodLiteral:
4700
4655
  return bc(e);
4701
- case T.ZodEnum:
4656
+ case O.ZodEnum:
4702
4657
  return gc(e);
4703
- case T.ZodNativeEnum:
4658
+ case O.ZodNativeEnum:
4704
4659
  return Sc(e);
4705
- case T.ZodNullable:
4660
+ case O.ZodNullable:
4706
4661
  return Tc(e, r);
4707
- case T.ZodOptional:
4662
+ case O.ZodOptional:
4708
4663
  return Mc(e, r);
4709
- case T.ZodMap:
4664
+ case O.ZodMap:
4710
4665
  return Ec(e, r);
4711
- case T.ZodSet:
4666
+ case O.ZodSet:
4712
4667
  return xc(e, r);
4713
- case T.ZodLazy:
4668
+ case O.ZodLazy:
4714
4669
  return () => e.getter()._def;
4715
- case T.ZodPromise:
4670
+ case O.ZodPromise:
4716
4671
  return Cc(e, r);
4717
- case T.ZodNaN:
4718
- case T.ZodNever:
4672
+ case O.ZodNaN:
4673
+ case O.ZodNever:
4719
4674
  return zc();
4720
- case T.ZodEffects:
4675
+ case O.ZodEffects:
4721
4676
  return vc(e, r);
4722
- case T.ZodAny:
4677
+ case O.ZodAny:
4723
4678
  return H();
4724
- case T.ZodUnknown:
4679
+ case O.ZodUnknown:
4725
4680
  return Lc();
4726
- case T.ZodDefault:
4681
+ case O.ZodDefault:
4727
4682
  return mc(e, r);
4728
- case T.ZodBranded:
4683
+ case O.ZodBranded:
4729
4684
  return Un(e, r);
4730
- case T.ZodReadonly:
4685
+ case O.ZodReadonly:
4731
4686
  return Uc(e, r);
4732
- case T.ZodCatch:
4687
+ case O.ZodCatch:
4733
4688
  return fc(e, r);
4734
- case T.ZodPipeline:
4689
+ case O.ZodPipeline:
4735
4690
  return Rc(e, r);
4736
- case T.ZodFunction:
4737
- case T.ZodVoid:
4738
- case T.ZodSymbol:
4691
+ case O.ZodFunction:
4692
+ case O.ZodVoid:
4693
+ case O.ZodSymbol:
4739
4694
  return;
4740
4695
  default:
4741
4696
  return /* @__PURE__ */ ((n) => {
@@ -4747,31 +4702,31 @@ var Uc = (e, t) => R(e.innerType._def, t), Fc = (e, t, r) => {
4747
4702
  ;
4748
4703
  return [(e.length - r).toString(), ...t.slice(r)].join("/");
4749
4704
  };
4750
- function R(e, t, r = !1) {
4705
+ function C(e, t, r = !1) {
4751
4706
  var n;
4752
4707
  const o = t.seen.get(e);
4753
4708
  if (t.override) {
4754
- const d = (n = t.override) == null ? void 0 : n.call(
4709
+ const l = (n = t.override) == null ? void 0 : n.call(
4755
4710
  t,
4756
4711
  e,
4757
4712
  t,
4758
4713
  o,
4759
4714
  r
4760
4715
  );
4761
- if (d !== uc)
4762
- return d;
4716
+ if (l !== uc)
4717
+ return l;
4763
4718
  }
4764
4719
  if (o && !r) {
4765
- const d = Vc(o, t);
4766
- if (d !== void 0)
4767
- return d;
4720
+ const l = Vc(o, t);
4721
+ if (l !== void 0)
4722
+ return l;
4768
4723
  }
4769
4724
  const a = { def: e, path: t.currentPath, jsonSchema: void 0 };
4770
4725
  t.seen.set(e, a);
4771
- const i = Fc(e, e.typeName, t), s = typeof i == "function" ? R(i(), t) : i;
4726
+ const i = Fc(e, e.typeName, t), s = typeof i == "function" ? C(i(), t) : i;
4772
4727
  if (s && Bc(e, t, s), t.postProcess) {
4773
- const d = t.postProcess(s, e, t);
4774
- return a.jsonSchema = s, d;
4728
+ const l = t.postProcess(s, e, t);
4729
+ return a.jsonSchema = s, l;
4775
4730
  }
4776
4731
  return a.jsonSchema = s, s;
4777
4732
  }
@@ -4811,23 +4766,23 @@ var Vc = (e, t) => {
4811
4766
  var r;
4812
4767
  const n = Wc(t);
4813
4768
  let o = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce(
4814
- (u, [l, p]) => {
4815
- var h;
4769
+ (u, [d, p]) => {
4770
+ var m;
4816
4771
  return {
4817
4772
  ...u,
4818
- [l]: (h = R(
4773
+ [d]: (m = C(
4819
4774
  p._def,
4820
4775
  {
4821
4776
  ...n,
4822
- currentPath: [...n.basePath, n.definitionPath, l]
4777
+ currentPath: [...n.basePath, n.definitionPath, d]
4823
4778
  },
4824
4779
  !0
4825
- )) != null ? h : H()
4780
+ )) != null ? m : H()
4826
4781
  };
4827
4782
  },
4828
4783
  {}
4829
4784
  ) : void 0;
4830
- const a = typeof t == "string" ? t : (t == null ? void 0 : t.nameStrategy) === "title" || t == null ? void 0 : t.name, i = (r = R(
4785
+ const a = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, i = (r = C(
4831
4786
  e._def,
4832
4787
  a === void 0 ? n : {
4833
4788
  ...n,
@@ -4836,7 +4791,7 @@ var Vc = (e, t) => {
4836
4791
  !1
4837
4792
  )) != null ? r : H(), s = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
4838
4793
  s !== void 0 && (i.title = s);
4839
- const d = a === void 0 ? o ? {
4794
+ const l = a === void 0 ? o ? {
4840
4795
  ...i,
4841
4796
  [n.definitionPath]: o
4842
4797
  } : i : {
@@ -4850,7 +4805,7 @@ var Vc = (e, t) => {
4850
4805
  [a]: i
4851
4806
  }
4852
4807
  };
4853
- return d.$schema = "http://json-schema.org/draft-07/schema#", d;
4808
+ return l.$schema = "http://json-schema.org/draft-07/schema#", l;
4854
4809
  }, wt = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
4855
4810
  function Gc(e) {
4856
4811
  let t;
@@ -5077,7 +5032,7 @@ var be = Hu(
5077
5032
  ne(v(), be.optional()),
5078
5033
  Pe(be)
5079
5034
  ])
5080
- ), k = ne(
5035
+ ), z = ne(
5081
5036
  v(),
5082
5037
  ne(v(), be.optional())
5083
5038
  ), Ve = W([
@@ -5085,32 +5040,32 @@ var be = Hu(
5085
5040
  _e(Uint8Array),
5086
5041
  _e(ArrayBuffer),
5087
5042
  Ln(nc, { message: "Must be a Buffer" })
5088
- ]), xt = ne(v(), v()), Qn = A({
5089
- type: b("text"),
5043
+ ]), xt = ne(v(), v()), Qn = T({
5044
+ type: y("text"),
5090
5045
  text: v(),
5091
- providerOptions: k.optional()
5092
- }), sl = A({
5093
- type: b("image"),
5046
+ providerOptions: z.optional()
5047
+ }), sl = T({
5048
+ type: y("image"),
5094
5049
  image: W([
5095
5050
  Ve,
5096
5051
  _e(URL),
5097
5052
  xt
5098
5053
  ]),
5099
5054
  mediaType: v().optional(),
5100
- providerOptions: k.optional()
5055
+ providerOptions: z.optional()
5101
5056
  }), eo = Pt("type", [
5102
- A({ type: b("data"), data: Ve }),
5103
- A({ type: b("url"), url: _e(URL) }),
5104
- A({
5105
- type: b("reference"),
5057
+ T({ type: y("data"), data: Ve }),
5058
+ T({ type: y("url"), url: _e(URL) }),
5059
+ T({
5060
+ type: y("reference"),
5106
5061
  reference: xt
5107
5062
  }),
5108
- A({ type: b("text"), text: v() })
5063
+ T({ type: y("text"), text: v() })
5109
5064
  ]), il = Pt("type", [
5110
- A({ type: b("data"), data: Ve }),
5111
- A({ type: b("url"), url: _e(URL) })
5112
- ]), to = A({
5113
- type: b("file"),
5065
+ T({ type: y("data"), data: Ve }),
5066
+ T({ type: y("url"), url: _e(URL) })
5067
+ ]), to = T({
5068
+ type: y("file"),
5114
5069
  data: W([
5115
5070
  eo,
5116
5071
  Ve,
@@ -5119,165 +5074,165 @@ var be = Hu(
5119
5074
  ]),
5120
5075
  filename: v().optional(),
5121
5076
  mediaType: v(),
5122
- providerOptions: k.optional()
5123
- }), ul = A({
5124
- type: b("reasoning"),
5077
+ providerOptions: z.optional()
5078
+ }), ul = T({
5079
+ type: y("reasoning"),
5125
5080
  text: v(),
5126
- providerOptions: k.optional()
5127
- }), cl = A({
5128
- type: b("custom"),
5081
+ providerOptions: z.optional()
5082
+ }), cl = T({
5083
+ type: y("custom"),
5129
5084
  kind: v().transform((e) => e),
5130
- providerOptions: k.optional()
5131
- }), ll = A({
5132
- type: b("reasoning-file"),
5085
+ providerOptions: z.optional()
5086
+ }), ll = T({
5087
+ type: y("reasoning-file"),
5133
5088
  data: W([
5134
5089
  il,
5135
5090
  Ve,
5136
5091
  _e(URL)
5137
5092
  ]),
5138
5093
  mediaType: v(),
5139
- providerOptions: k.optional()
5140
- }), dl = A({
5141
- type: b("tool-call"),
5094
+ providerOptions: z.optional()
5095
+ }), dl = T({
5096
+ type: y("tool-call"),
5142
5097
  toolCallId: v(),
5143
5098
  toolName: v(),
5144
5099
  input: re(),
5145
- providerOptions: k.optional(),
5100
+ providerOptions: z.optional(),
5146
5101
  providerExecuted: B().optional()
5147
5102
  }), pl = Pt(
5148
5103
  "type",
5149
5104
  [
5150
- A({
5151
- type: b("text"),
5105
+ T({
5106
+ type: y("text"),
5152
5107
  value: v(),
5153
- providerOptions: k.optional()
5108
+ providerOptions: z.optional()
5154
5109
  }),
5155
- A({
5156
- type: b("json"),
5110
+ T({
5111
+ type: y("json"),
5157
5112
  value: be,
5158
- providerOptions: k.optional()
5113
+ providerOptions: z.optional()
5159
5114
  }),
5160
- A({
5161
- type: b("execution-denied"),
5115
+ T({
5116
+ type: y("execution-denied"),
5162
5117
  reason: v().optional(),
5163
- providerOptions: k.optional()
5118
+ providerOptions: z.optional()
5164
5119
  }),
5165
- A({
5166
- type: b("error-text"),
5120
+ T({
5121
+ type: y("error-text"),
5167
5122
  value: v(),
5168
- providerOptions: k.optional()
5123
+ providerOptions: z.optional()
5169
5124
  }),
5170
- A({
5171
- type: b("error-json"),
5125
+ T({
5126
+ type: y("error-json"),
5172
5127
  value: be,
5173
- providerOptions: k.optional()
5128
+ providerOptions: z.optional()
5174
5129
  }),
5175
- A({
5176
- type: b("content"),
5130
+ T({
5131
+ type: y("content"),
5177
5132
  value: Pe(
5178
5133
  W([
5179
- A({
5180
- type: b("text"),
5134
+ T({
5135
+ type: y("text"),
5181
5136
  text: v(),
5182
- providerOptions: k.optional()
5137
+ providerOptions: z.optional()
5183
5138
  }),
5184
- A({
5185
- type: b("file"),
5139
+ T({
5140
+ type: y("file"),
5186
5141
  data: eo,
5187
5142
  mediaType: v(),
5188
5143
  filename: v().optional(),
5189
- providerOptions: k.optional()
5144
+ providerOptions: z.optional()
5190
5145
  }),
5191
- A({
5146
+ T({
5192
5147
  // Deprecated.
5193
- type: b("file-data"),
5148
+ type: y("file-data"),
5194
5149
  data: v(),
5195
5150
  mediaType: v(),
5196
5151
  filename: v().optional(),
5197
- providerOptions: k.optional()
5152
+ providerOptions: z.optional()
5198
5153
  }),
5199
- A({
5154
+ T({
5200
5155
  // Deprecated.
5201
- type: b("file-url"),
5156
+ type: y("file-url"),
5202
5157
  url: v(),
5203
5158
  mediaType: v().optional(),
5204
- providerOptions: k.optional()
5159
+ providerOptions: z.optional()
5205
5160
  }),
5206
- A({
5161
+ T({
5207
5162
  // Deprecated.
5208
- type: b("file-id"),
5163
+ type: y("file-id"),
5209
5164
  fileId: W([v(), ne(v(), v())]),
5210
- providerOptions: k.optional()
5165
+ providerOptions: z.optional()
5211
5166
  }),
5212
- A({
5167
+ T({
5213
5168
  // Deprecated.
5214
- type: b("file-reference"),
5169
+ type: y("file-reference"),
5215
5170
  providerReference: ne(v(), v()),
5216
- providerOptions: k.optional()
5171
+ providerOptions: z.optional()
5217
5172
  }),
5218
- A({
5173
+ T({
5219
5174
  // Deprecated.
5220
- type: b("image-data"),
5175
+ type: y("image-data"),
5221
5176
  data: v(),
5222
5177
  mediaType: v(),
5223
- providerOptions: k.optional()
5178
+ providerOptions: z.optional()
5224
5179
  }),
5225
- A({
5180
+ T({
5226
5181
  // Deprecated.
5227
- type: b("image-url"),
5182
+ type: y("image-url"),
5228
5183
  url: v(),
5229
- providerOptions: k.optional()
5184
+ providerOptions: z.optional()
5230
5185
  }),
5231
- A({
5186
+ T({
5232
5187
  // Deprecated.
5233
- type: b("image-file-id"),
5188
+ type: y("image-file-id"),
5234
5189
  fileId: W([v(), ne(v(), v())]),
5235
- providerOptions: k.optional()
5190
+ providerOptions: z.optional()
5236
5191
  }),
5237
- A({
5192
+ T({
5238
5193
  // Deprecated.
5239
- type: b("image-file-reference"),
5194
+ type: y("image-file-reference"),
5240
5195
  providerReference: ne(v(), v()),
5241
- providerOptions: k.optional()
5196
+ providerOptions: z.optional()
5242
5197
  }),
5243
- A({
5244
- type: b("custom"),
5245
- providerOptions: k.optional()
5198
+ T({
5199
+ type: y("custom"),
5200
+ providerOptions: z.optional()
5246
5201
  })
5247
5202
  ])
5248
5203
  )
5249
5204
  })
5250
5205
  ]
5251
- ), ro = A({
5252
- type: b("tool-result"),
5206
+ ), ro = T({
5207
+ type: y("tool-result"),
5253
5208
  toolCallId: v(),
5254
5209
  toolName: v(),
5255
5210
  output: pl,
5256
- providerOptions: k.optional()
5257
- }), fl = A({
5258
- type: b("tool-approval-request"),
5211
+ providerOptions: z.optional()
5212
+ }), fl = T({
5213
+ type: y("tool-approval-request"),
5259
5214
  approvalId: v(),
5260
5215
  toolCallId: v()
5261
- }), hl = A({
5262
- type: b("tool-approval-response"),
5216
+ }), hl = T({
5217
+ type: y("tool-approval-response"),
5263
5218
  approvalId: v(),
5264
5219
  approved: B(),
5265
5220
  reason: v().optional()
5266
- }), ml = A(
5221
+ }), ml = T(
5267
5222
  {
5268
- role: b("system"),
5223
+ role: y("system"),
5269
5224
  content: v(),
5270
- providerOptions: k.optional()
5225
+ providerOptions: z.optional()
5271
5226
  }
5272
- ), vl = A({
5273
- role: b("user"),
5227
+ ), vl = T({
5228
+ role: y("user"),
5274
5229
  content: W([
5275
5230
  v(),
5276
5231
  Pe(W([Qn, sl, to]))
5277
5232
  ]),
5278
- providerOptions: k.optional()
5279
- }), gl = A({
5280
- role: b("assistant"),
5233
+ providerOptions: z.optional()
5234
+ }), gl = T({
5235
+ role: y("assistant"),
5281
5236
  content: W([
5282
5237
  v(),
5283
5238
  Pe(
@@ -5293,11 +5248,11 @@ var be = Hu(
5293
5248
  ])
5294
5249
  )
5295
5250
  ]),
5296
- providerOptions: k.optional()
5297
- }), _l = A({
5298
- role: b("tool"),
5251
+ providerOptions: z.optional()
5252
+ }), _l = T({
5253
+ role: y("tool"),
5299
5254
  content: Pe(W([ro, hl])),
5300
- providerOptions: k.optional()
5255
+ providerOptions: z.optional()
5301
5256
  });
5302
5257
  W([
5303
5258
  ml,
@@ -5316,23 +5271,23 @@ nl(yl, {
5316
5271
  function bl(e) {
5317
5272
  const t = ["ROOT"];
5318
5273
  let r = -1, n = null, o = 0;
5319
- function a(l) {
5320
- return l >= "0" && l <= "9" || l >= "A" && l <= "F" || l >= "a" && l <= "f";
5274
+ function a(d) {
5275
+ return d >= "0" && d <= "9" || d >= "A" && d <= "F" || d >= "a" && d <= "f";
5321
5276
  }
5322
- function i(l, p, h) {
5323
- switch (l) {
5277
+ function i(d, p, m) {
5278
+ switch (d) {
5324
5279
  case '"': {
5325
- r = p, t.pop(), t.push(h), t.push("INSIDE_STRING");
5280
+ r = p, t.pop(), t.push(m), t.push("INSIDE_STRING");
5326
5281
  break;
5327
5282
  }
5328
5283
  case "f":
5329
5284
  case "t":
5330
5285
  case "n": {
5331
- r = p, n = p, t.pop(), t.push(h), t.push("INSIDE_LITERAL");
5286
+ r = p, n = p, t.pop(), t.push(m), t.push("INSIDE_LITERAL");
5332
5287
  break;
5333
5288
  }
5334
5289
  case "-": {
5335
- t.pop(), t.push(h), t.push("INSIDE_NUMBER");
5290
+ t.pop(), t.push(m), t.push("INSIDE_NUMBER");
5336
5291
  break;
5337
5292
  }
5338
5293
  case "0":
@@ -5345,21 +5300,21 @@ function bl(e) {
5345
5300
  case "7":
5346
5301
  case "8":
5347
5302
  case "9": {
5348
- r = p, t.pop(), t.push(h), t.push("INSIDE_NUMBER");
5303
+ r = p, t.pop(), t.push(m), t.push("INSIDE_NUMBER");
5349
5304
  break;
5350
5305
  }
5351
5306
  case "{": {
5352
- r = p, t.pop(), t.push(h), t.push("INSIDE_OBJECT_START");
5307
+ r = p, t.pop(), t.push(m), t.push("INSIDE_OBJECT_START");
5353
5308
  break;
5354
5309
  }
5355
5310
  case "[": {
5356
- r = p, t.pop(), t.push(h), t.push("INSIDE_ARRAY_START");
5311
+ r = p, t.pop(), t.push(m), t.push("INSIDE_ARRAY_START");
5357
5312
  break;
5358
5313
  }
5359
5314
  }
5360
5315
  }
5361
- function s(l, p) {
5362
- switch (l) {
5316
+ function s(d, p) {
5317
+ switch (d) {
5363
5318
  case ",": {
5364
5319
  t.pop(), t.push("INSIDE_OBJECT_AFTER_COMMA");
5365
5320
  break;
@@ -5370,8 +5325,8 @@ function bl(e) {
5370
5325
  }
5371
5326
  }
5372
5327
  }
5373
- function d(l, p) {
5374
- switch (l) {
5328
+ function l(d, p) {
5329
+ switch (d) {
5375
5330
  case ",": {
5376
5331
  t.pop(), t.push("INSIDE_ARRAY_AFTER_COMMA");
5377
5332
  break;
@@ -5382,11 +5337,11 @@ function bl(e) {
5382
5337
  }
5383
5338
  }
5384
5339
  }
5385
- for (let l = 0; l < e.length; l++) {
5386
- const p = e[l];
5340
+ for (let d = 0; d < e.length; d++) {
5341
+ const p = e[d];
5387
5342
  switch (t[t.length - 1]) {
5388
5343
  case "ROOT":
5389
- i(p, l, "FINISH");
5344
+ i(p, d, "FINISH");
5390
5345
  break;
5391
5346
  case "INSIDE_OBJECT_START": {
5392
5347
  switch (p) {
@@ -5395,7 +5350,7 @@ function bl(e) {
5395
5350
  break;
5396
5351
  }
5397
5352
  case "}": {
5398
- r = l, t.pop();
5353
+ r = d, t.pop();
5399
5354
  break;
5400
5355
  }
5401
5356
  }
@@ -5429,17 +5384,17 @@ function bl(e) {
5429
5384
  break;
5430
5385
  }
5431
5386
  case "INSIDE_OBJECT_BEFORE_VALUE": {
5432
- i(p, l, "INSIDE_OBJECT_AFTER_VALUE");
5387
+ i(p, d, "INSIDE_OBJECT_AFTER_VALUE");
5433
5388
  break;
5434
5389
  }
5435
5390
  case "INSIDE_OBJECT_AFTER_VALUE": {
5436
- s(p, l);
5391
+ s(p, d);
5437
5392
  break;
5438
5393
  }
5439
5394
  case "INSIDE_STRING": {
5440
5395
  switch (p) {
5441
5396
  case '"': {
5442
- t.pop(), r = l;
5397
+ t.pop(), r = d;
5443
5398
  break;
5444
5399
  }
5445
5400
  case "\\": {
@@ -5447,18 +5402,18 @@ function bl(e) {
5447
5402
  break;
5448
5403
  }
5449
5404
  default:
5450
- r = l;
5405
+ r = d;
5451
5406
  }
5452
5407
  break;
5453
5408
  }
5454
5409
  case "INSIDE_ARRAY_START": {
5455
5410
  switch (p) {
5456
5411
  case "]": {
5457
- r = l, t.pop();
5412
+ r = d, t.pop();
5458
5413
  break;
5459
5414
  }
5460
5415
  default: {
5461
- r = l, i(p, l, "INSIDE_ARRAY_AFTER_VALUE");
5416
+ r = d, i(p, d, "INSIDE_ARRAY_AFTER_VALUE");
5462
5417
  break;
5463
5418
  }
5464
5419
  }
@@ -5471,26 +5426,26 @@ function bl(e) {
5471
5426
  break;
5472
5427
  }
5473
5428
  case "]": {
5474
- r = l, t.pop();
5429
+ r = d, t.pop();
5475
5430
  break;
5476
5431
  }
5477
5432
  default: {
5478
- r = l;
5433
+ r = d;
5479
5434
  break;
5480
5435
  }
5481
5436
  }
5482
5437
  break;
5483
5438
  }
5484
5439
  case "INSIDE_ARRAY_AFTER_COMMA": {
5485
- i(p, l, "INSIDE_ARRAY_AFTER_VALUE");
5440
+ i(p, d, "INSIDE_ARRAY_AFTER_VALUE");
5486
5441
  break;
5487
5442
  }
5488
5443
  case "INSIDE_STRING_ESCAPE": {
5489
- t.pop(), p === "u" ? (o = 0, t.push("INSIDE_STRING_UNICODE_ESCAPE")) : r = l;
5444
+ t.pop(), p === "u" ? (o = 0, t.push("INSIDE_STRING_UNICODE_ESCAPE")) : r = d;
5490
5445
  break;
5491
5446
  }
5492
5447
  case "INSIDE_STRING_UNICODE_ESCAPE": {
5493
- a(p) && (o++, o === 4 && (t.pop(), r = l));
5448
+ a(p) && (o++, o === 4 && (t.pop(), r = d));
5494
5449
  break;
5495
5450
  }
5496
5451
  case "INSIDE_NUMBER": {
@@ -5505,7 +5460,7 @@ function bl(e) {
5505
5460
  case "7":
5506
5461
  case "8":
5507
5462
  case "9": {
5508
- r = l;
5463
+ r = d;
5509
5464
  break;
5510
5465
  }
5511
5466
  case "e":
@@ -5514,15 +5469,15 @@ function bl(e) {
5514
5469
  case ".":
5515
5470
  break;
5516
5471
  case ",": {
5517
- t.pop(), t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && d(p, l), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" && s(p, l);
5472
+ t.pop(), t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && l(p, d), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" && s(p, d);
5518
5473
  break;
5519
5474
  }
5520
5475
  case "}": {
5521
- t.pop(), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" && s(p, l);
5476
+ t.pop(), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" && s(p, d);
5522
5477
  break;
5523
5478
  }
5524
5479
  case "]": {
5525
- t.pop(), t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && d(p, l);
5480
+ t.pop(), t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && l(p, d);
5526
5481
  break;
5527
5482
  }
5528
5483
  default: {
@@ -5533,15 +5488,15 @@ function bl(e) {
5533
5488
  break;
5534
5489
  }
5535
5490
  case "INSIDE_LITERAL": {
5536
- const f = e.substring(n, l + 1);
5537
- !"false".startsWith(f) && !"true".startsWith(f) && !"null".startsWith(f) ? (t.pop(), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" ? s(p, l) : t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && d(p, l)) : r = l;
5491
+ const h = e.substring(n, d + 1);
5492
+ !"false".startsWith(h) && !"true".startsWith(h) && !"null".startsWith(h) ? (t.pop(), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" ? s(p, d) : t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && l(p, d)) : r = d;
5538
5493
  break;
5539
5494
  }
5540
5495
  }
5541
5496
  }
5542
5497
  let u = e.slice(0, r + 1);
5543
- for (let l = t.length - 1; l >= 0; l--)
5544
- switch (t[l]) {
5498
+ for (let d = t.length - 1; d >= 0; d--)
5499
+ switch (t[d]) {
5545
5500
  case "INSIDE_STRING": {
5546
5501
  u += '"';
5547
5502
  break;
@@ -5562,8 +5517,8 @@ function bl(e) {
5562
5517
  break;
5563
5518
  }
5564
5519
  case "INSIDE_LITERAL": {
5565
- const h = e.substring(n, e.length);
5566
- "true".startsWith(h) ? u += "true".slice(h.length) : "false".startsWith(h) ? u += "false".slice(h.length) : "null".startsWith(h) && (u += "null".slice(h.length));
5520
+ const m = e.substring(n, e.length);
5521
+ "true".startsWith(m) ? u += "true".slice(m.length) : "false".startsWith(m) ? u += "false".slice(m.length) : "null".startsWith(m) && (u += "null".slice(m.length));
5567
5522
  }
5568
5523
  }
5569
5524
  return u;
@@ -5692,24 +5647,24 @@ var wl = () => ({
5692
5647
  usage: a.usage,
5693
5648
  finishReason: a.finishReason
5694
5649
  });
5695
- const d = [];
5650
+ const l = [];
5696
5651
  for (const u of s.elements) {
5697
- const l = await Fe({
5652
+ const d = await Fe({
5698
5653
  value: u,
5699
5654
  schema: n
5700
5655
  });
5701
- if (!l.success)
5656
+ if (!d.success)
5702
5657
  throw new pe({
5703
5658
  message: "No object generated: response did not match schema.",
5704
- cause: l.error,
5659
+ cause: d.error,
5705
5660
  text: o,
5706
5661
  response: a.response,
5707
5662
  usage: a.usage,
5708
5663
  finishReason: a.finishReason
5709
5664
  });
5710
- d.push(l.value);
5665
+ l.push(d.value);
5711
5666
  }
5712
- return d;
5667
+ return l;
5713
5668
  },
5714
5669
  async parsePartialOutput({ text: o }) {
5715
5670
  const a = await Be(o);
@@ -5722,15 +5677,15 @@ var wl = () => ({
5722
5677
  const i = a.value;
5723
5678
  if (i == null || typeof i != "object" || !("elements" in i) || !Array.isArray(i.elements))
5724
5679
  return;
5725
- const s = a.state === "repaired-parse" && i.elements.length > 0 ? i.elements.slice(0, -1) : i.elements, d = [];
5680
+ const s = a.state === "repaired-parse" && i.elements.length > 0 ? i.elements.slice(0, -1) : i.elements, l = [];
5726
5681
  for (const u of s) {
5727
- const l = await Fe({
5682
+ const d = await Fe({
5728
5683
  value: u,
5729
5684
  schema: n
5730
5685
  });
5731
- l.success && d.push(l.value);
5686
+ d.success && l.push(d.value);
5732
5687
  }
5733
- return { partial: d };
5688
+ return { partial: l };
5734
5689
  }
5735
5690
  }
5736
5691
  },
@@ -5881,151 +5836,151 @@ var Me = ne(
5881
5836
  ), Ol = Gc(
5882
5837
  () => Bn(
5883
5838
  W([
5884
- C({
5885
- type: b("text-start"),
5839
+ x({
5840
+ type: y("text-start"),
5886
5841
  id: v(),
5887
- providerMetadata: k.optional()
5842
+ providerMetadata: z.optional()
5888
5843
  }),
5889
- C({
5890
- type: b("text-delta"),
5844
+ x({
5845
+ type: y("text-delta"),
5891
5846
  id: v(),
5892
5847
  delta: v(),
5893
- providerMetadata: k.optional()
5848
+ providerMetadata: z.optional()
5894
5849
  }),
5895
- C({
5896
- type: b("text-end"),
5850
+ x({
5851
+ type: y("text-end"),
5897
5852
  id: v(),
5898
- providerMetadata: k.optional()
5853
+ providerMetadata: z.optional()
5899
5854
  }),
5900
- C({
5901
- type: b("error"),
5855
+ x({
5856
+ type: y("error"),
5902
5857
  errorText: v()
5903
5858
  }),
5904
- C({
5905
- type: b("tool-input-start"),
5859
+ x({
5860
+ type: y("tool-input-start"),
5906
5861
  toolCallId: v(),
5907
5862
  toolName: v(),
5908
5863
  providerExecuted: B().optional(),
5909
- providerMetadata: k.optional(),
5864
+ providerMetadata: z.optional(),
5910
5865
  toolMetadata: Me.optional(),
5911
5866
  dynamic: B().optional(),
5912
5867
  title: v().optional()
5913
5868
  }),
5914
- C({
5915
- type: b("tool-input-delta"),
5869
+ x({
5870
+ type: y("tool-input-delta"),
5916
5871
  toolCallId: v(),
5917
5872
  inputTextDelta: v()
5918
5873
  }),
5919
- C({
5920
- type: b("tool-input-available"),
5874
+ x({
5875
+ type: y("tool-input-available"),
5921
5876
  toolCallId: v(),
5922
5877
  toolName: v(),
5923
5878
  input: re(),
5924
5879
  providerExecuted: B().optional(),
5925
- providerMetadata: k.optional(),
5880
+ providerMetadata: z.optional(),
5926
5881
  toolMetadata: Me.optional(),
5927
5882
  dynamic: B().optional(),
5928
5883
  title: v().optional()
5929
5884
  }),
5930
- C({
5931
- type: b("tool-input-error"),
5885
+ x({
5886
+ type: y("tool-input-error"),
5932
5887
  toolCallId: v(),
5933
5888
  toolName: v(),
5934
5889
  input: re(),
5935
5890
  providerExecuted: B().optional(),
5936
- providerMetadata: k.optional(),
5891
+ providerMetadata: z.optional(),
5937
5892
  toolMetadata: Me.optional(),
5938
5893
  dynamic: B().optional(),
5939
5894
  errorText: v(),
5940
5895
  title: v().optional()
5941
5896
  }),
5942
- C({
5943
- type: b("tool-approval-request"),
5897
+ x({
5898
+ type: y("tool-approval-request"),
5944
5899
  approvalId: v(),
5945
5900
  toolCallId: v(),
5946
5901
  isAutomatic: B().optional(),
5947
5902
  signature: v().optional()
5948
5903
  }),
5949
- C({
5950
- type: b("tool-approval-response"),
5904
+ x({
5905
+ type: y("tool-approval-response"),
5951
5906
  approvalId: v(),
5952
5907
  approved: B(),
5953
5908
  reason: v().optional(),
5954
5909
  providerExecuted: B().optional(),
5955
- providerMetadata: k.optional()
5910
+ providerMetadata: z.optional()
5956
5911
  }),
5957
- C({
5958
- type: b("tool-output-available"),
5912
+ x({
5913
+ type: y("tool-output-available"),
5959
5914
  toolCallId: v(),
5960
5915
  output: re(),
5961
5916
  providerExecuted: B().optional(),
5962
- providerMetadata: k.optional(),
5917
+ providerMetadata: z.optional(),
5963
5918
  toolMetadata: Me.optional(),
5964
5919
  dynamic: B().optional(),
5965
5920
  preliminary: B().optional()
5966
5921
  }),
5967
- C({
5968
- type: b("tool-output-error"),
5922
+ x({
5923
+ type: y("tool-output-error"),
5969
5924
  toolCallId: v(),
5970
5925
  errorText: v(),
5971
5926
  providerExecuted: B().optional(),
5972
- providerMetadata: k.optional(),
5927
+ providerMetadata: z.optional(),
5973
5928
  toolMetadata: Me.optional(),
5974
5929
  dynamic: B().optional()
5975
5930
  }),
5976
- C({
5977
- type: b("tool-output-denied"),
5931
+ x({
5932
+ type: y("tool-output-denied"),
5978
5933
  toolCallId: v()
5979
5934
  }),
5980
- C({
5981
- type: b("reasoning-start"),
5935
+ x({
5936
+ type: y("reasoning-start"),
5982
5937
  id: v(),
5983
- providerMetadata: k.optional()
5938
+ providerMetadata: z.optional()
5984
5939
  }),
5985
- C({
5986
- type: b("reasoning-delta"),
5940
+ x({
5941
+ type: y("reasoning-delta"),
5987
5942
  id: v(),
5988
5943
  delta: v(),
5989
- providerMetadata: k.optional()
5944
+ providerMetadata: z.optional()
5990
5945
  }),
5991
- C({
5992
- type: b("reasoning-end"),
5946
+ x({
5947
+ type: y("reasoning-end"),
5993
5948
  id: v(),
5994
- providerMetadata: k.optional()
5949
+ providerMetadata: z.optional()
5995
5950
  }),
5996
- C({
5997
- type: b("custom"),
5951
+ x({
5952
+ type: y("custom"),
5998
5953
  kind: v().transform((e) => e),
5999
- providerMetadata: k.optional()
5954
+ providerMetadata: z.optional()
6000
5955
  }),
6001
- C({
6002
- type: b("source-url"),
5956
+ x({
5957
+ type: y("source-url"),
6003
5958
  sourceId: v(),
6004
5959
  url: v(),
6005
5960
  title: v().optional(),
6006
- providerMetadata: k.optional()
5961
+ providerMetadata: z.optional()
6007
5962
  }),
6008
- C({
6009
- type: b("source-document"),
5963
+ x({
5964
+ type: y("source-document"),
6010
5965
  sourceId: v(),
6011
5966
  mediaType: v(),
6012
5967
  title: v(),
6013
5968
  filename: v().optional(),
6014
- providerMetadata: k.optional()
5969
+ providerMetadata: z.optional()
6015
5970
  }),
6016
- C({
6017
- type: b("file"),
5971
+ x({
5972
+ type: y("file"),
6018
5973
  url: v(),
6019
5974
  mediaType: v(),
6020
- providerMetadata: k.optional()
5975
+ providerMetadata: z.optional()
6021
5976
  }),
6022
- C({
6023
- type: b("reasoning-file"),
5977
+ x({
5978
+ type: y("reasoning-file"),
6024
5979
  url: v(),
6025
5980
  mediaType: v(),
6026
- providerMetadata: k.optional()
5981
+ providerMetadata: z.optional()
6027
5982
  }),
6028
- C({
5983
+ x({
6029
5984
  type: Ln(
6030
5985
  (e) => typeof e == "string" && e.startsWith("data-"),
6031
5986
  { message: 'Type must start with "data-"' }
@@ -6034,19 +5989,19 @@ var Me = ne(
6034
5989
  data: re(),
6035
5990
  transient: B().optional()
6036
5991
  }),
6037
- C({
6038
- type: b("start-step")
5992
+ x({
5993
+ type: y("start-step")
6039
5994
  }),
6040
- C({
6041
- type: b("finish-step")
5995
+ x({
5996
+ type: y("finish-step")
6042
5997
  }),
6043
- C({
6044
- type: b("start"),
5998
+ x({
5999
+ type: y("start"),
6045
6000
  messageId: v().optional(),
6046
6001
  messageMetadata: re().optional()
6047
6002
  }),
6048
- C({
6049
- type: b("finish"),
6003
+ x({
6004
+ type: y("finish"),
6050
6005
  finishReason: xn([
6051
6006
  "stop",
6052
6007
  "length",
@@ -6057,12 +6012,12 @@ var Me = ne(
6057
6012
  ]).optional(),
6058
6013
  messageMetadata: re().optional()
6059
6014
  }),
6060
- C({
6061
- type: b("abort"),
6015
+ x({
6016
+ type: y("abort"),
6062
6017
  reason: v().optional()
6063
6018
  }),
6064
- C({
6065
- type: b("message-metadata"),
6019
+ x({
6020
+ type: y("message-metadata"),
6066
6021
  messageMetadata: re()
6067
6022
  })
6068
6023
  ])
@@ -6091,7 +6046,7 @@ function Tl({
6091
6046
  messageId: t
6092
6047
  }) {
6093
6048
  return {
6094
- message: (e == null ? void 0 : e.role) === "assistant" ? e : {
6049
+ message: e?.role === "assistant" ? e : {
6095
6050
  id: t,
6096
6051
  metadata: void 0,
6097
6052
  role: "assistant",
@@ -6113,29 +6068,29 @@ function Zl({
6113
6068
  }) {
6114
6069
  return e.pipeThrough(
6115
6070
  new TransformStream({
6116
- async transform(s, d) {
6117
- await n(async ({ state: u, write: l }) => {
6118
- var p, h, f, z;
6119
- function S() {
6071
+ async transform(s, l) {
6072
+ await n(async ({ state: u, write: d }) => {
6073
+ var p, m, h, I;
6074
+ function Z() {
6120
6075
  const c = u.message.parts;
6121
- let g = c.length - 1;
6122
- for (; g >= 0 && c[g].type !== "step-start"; )
6123
- g--;
6124
- return c.slice(g + 1);
6076
+ let b = c.length - 1;
6077
+ for (; b >= 0 && c[b].type !== "step-start"; )
6078
+ b--;
6079
+ return c.slice(b + 1);
6125
6080
  }
6126
- function I() {
6127
- return S().filter($e);
6081
+ function _() {
6082
+ return Z().filter($e);
6128
6083
  }
6129
- function y(c) {
6130
- let $ = I().find(
6131
- (Z) => Z.toolCallId === c
6084
+ function E(c) {
6085
+ let $ = _().find(
6086
+ (A) => A.toolCallId === c
6132
6087
  );
6133
6088
  if ($ == null) {
6134
- const Z = u.message.parts;
6135
- for (let O = Z.length - 1; O >= 0; O--) {
6136
- const P = Z[O];
6137
- if ($e(P) && P.toolCallId === c) {
6138
- $ = P;
6089
+ const A = u.message.parts;
6090
+ for (let S = A.length - 1; S >= 0; S--) {
6091
+ const R = A[S];
6092
+ if ($e(R) && R.toolCallId === c) {
6093
+ $ = R;
6139
6094
  break;
6140
6095
  }
6141
6096
  }
@@ -6148,11 +6103,11 @@ function Zl({
6148
6103
  });
6149
6104
  return $;
6150
6105
  }
6151
- function E(c) {
6106
+ function k(c) {
6152
6107
  const $ = u.message.parts.filter($e).find(
6153
- (Z) => {
6154
- var O;
6155
- return ((O = Z.approval) == null ? void 0 : O.id) === c;
6108
+ (A) => {
6109
+ var S;
6110
+ return ((S = A.approval) == null ? void 0 : S.id) === c;
6156
6111
  }
6157
6112
  );
6158
6113
  if ($ == null)
@@ -6163,20 +6118,20 @@ function Zl({
6163
6118
  });
6164
6119
  return $;
6165
6120
  }
6166
- function M(c, g) {
6121
+ function N(c, b) {
6167
6122
  var $;
6168
- const Z = g ?? S().find(
6123
+ const A = b ?? Z().find(
6169
6124
  (V) => It(V) && V.toolCallId === c.toolCallId
6170
- ), O = c, P = Z;
6171
- if (Z != null) {
6172
- Z.state = c.state, P.input = O.input, P.output = O.output, P.errorText = O.errorText, P.rawInput = O.rawInput, P.preliminary = O.preliminary, c.title !== void 0 && (P.title = c.title), c.toolMetadata !== void 0 && (P.toolMetadata = c.toolMetadata), P.providerExecuted = ($ = O.providerExecuted) != null ? $ : Z.providerExecuted;
6173
- const V = O.providerMetadata;
6125
+ ), S = c, R = A;
6126
+ if (A != null) {
6127
+ A.state = c.state, R.input = S.input, R.output = S.output, R.errorText = S.errorText, R.rawInput = S.rawInput, R.preliminary = S.preliminary, c.title !== void 0 && (R.title = c.title), c.toolMetadata !== void 0 && (R.toolMetadata = c.toolMetadata), R.providerExecuted = ($ = S.providerExecuted) != null ? $ : A.providerExecuted;
6128
+ const V = S.providerMetadata;
6174
6129
  if (V != null)
6175
6130
  if (c.state === "output-available" || c.state === "output-error") {
6176
- const oe = Z;
6131
+ const oe = A;
6177
6132
  oe.resultProviderMetadata = V;
6178
6133
  } else
6179
- Z.callProviderMetadata = V;
6134
+ A.callProviderMetadata = V;
6180
6135
  } else
6181
6136
  u.message.parts.push({
6182
6137
  type: `tool-${c.toolName}`,
@@ -6184,58 +6139,58 @@ function Zl({
6184
6139
  state: c.state,
6185
6140
  title: c.title,
6186
6141
  ...c.toolMetadata !== void 0 ? { toolMetadata: c.toolMetadata } : {},
6187
- input: O.input,
6188
- output: O.output,
6189
- rawInput: O.rawInput,
6190
- errorText: O.errorText,
6191
- providerExecuted: O.providerExecuted,
6192
- preliminary: O.preliminary,
6193
- ...O.providerMetadata != null && (c.state === "output-available" || c.state === "output-error") ? { resultProviderMetadata: O.providerMetadata } : {},
6194
- ...O.providerMetadata != null && !(c.state === "output-available" || c.state === "output-error") ? { callProviderMetadata: O.providerMetadata } : {}
6142
+ input: S.input,
6143
+ output: S.output,
6144
+ rawInput: S.rawInput,
6145
+ errorText: S.errorText,
6146
+ providerExecuted: S.providerExecuted,
6147
+ preliminary: S.preliminary,
6148
+ ...S.providerMetadata != null && (c.state === "output-available" || c.state === "output-error") ? { resultProviderMetadata: S.providerMetadata } : {},
6149
+ ...S.providerMetadata != null && !(c.state === "output-available" || c.state === "output-error") ? { callProviderMetadata: S.providerMetadata } : {}
6195
6150
  });
6196
6151
  }
6197
- function x(c, g) {
6198
- var $, Z;
6199
- const O = g ?? S().find(
6152
+ function P(c, b) {
6153
+ var $, A;
6154
+ const S = b ?? Z().find(
6200
6155
  (oe) => oe.type === "dynamic-tool" && oe.toolCallId === c.toolCallId
6201
- ), P = c, V = O;
6202
- if (O != null) {
6203
- O.state = c.state, V.toolName = c.toolName, V.input = P.input, V.output = P.output, V.errorText = P.errorText, V.rawInput = ($ = P.rawInput) != null ? $ : V.rawInput, V.preliminary = P.preliminary, c.title !== void 0 && (V.title = c.title), c.toolMetadata !== void 0 && (V.toolMetadata = c.toolMetadata), V.providerExecuted = (Z = P.providerExecuted) != null ? Z : O.providerExecuted;
6204
- const oe = P.providerMetadata;
6156
+ ), R = c, V = S;
6157
+ if (S != null) {
6158
+ S.state = c.state, V.toolName = c.toolName, V.input = R.input, V.output = R.output, V.errorText = R.errorText, V.rawInput = ($ = R.rawInput) != null ? $ : V.rawInput, V.preliminary = R.preliminary, c.title !== void 0 && (V.title = c.title), c.toolMetadata !== void 0 && (V.toolMetadata = c.toolMetadata), V.providerExecuted = (A = R.providerExecuted) != null ? A : S.providerExecuted;
6159
+ const oe = R.providerMetadata;
6205
6160
  if (oe != null)
6206
6161
  if (c.state === "output-available" || c.state === "output-error") {
6207
- const ce = O;
6162
+ const ce = S;
6208
6163
  ce.resultProviderMetadata = oe;
6209
6164
  } else
6210
- O.callProviderMetadata = oe;
6165
+ S.callProviderMetadata = oe;
6211
6166
  } else
6212
6167
  u.message.parts.push({
6213
6168
  type: "dynamic-tool",
6214
6169
  toolName: c.toolName,
6215
6170
  toolCallId: c.toolCallId,
6216
6171
  state: c.state,
6217
- input: P.input,
6218
- output: P.output,
6219
- errorText: P.errorText,
6220
- preliminary: P.preliminary,
6221
- providerExecuted: P.providerExecuted,
6172
+ input: R.input,
6173
+ output: R.output,
6174
+ errorText: R.errorText,
6175
+ preliminary: R.preliminary,
6176
+ providerExecuted: R.providerExecuted,
6222
6177
  title: c.title,
6223
6178
  ...c.toolMetadata !== void 0 ? { toolMetadata: c.toolMetadata } : {},
6224
- ...P.providerMetadata != null && (c.state === "output-available" || c.state === "output-error") ? { resultProviderMetadata: P.providerMetadata } : {},
6225
- ...P.providerMetadata != null && !(c.state === "output-available" || c.state === "output-error") ? { callProviderMetadata: P.providerMetadata } : {}
6179
+ ...R.providerMetadata != null && (c.state === "output-available" || c.state === "output-error") ? { resultProviderMetadata: R.providerMetadata } : {},
6180
+ ...R.providerMetadata != null && !(c.state === "output-available" || c.state === "output-error") ? { callProviderMetadata: R.providerMetadata } : {}
6226
6181
  });
6227
6182
  }
6228
- async function _(c) {
6183
+ async function g(c) {
6229
6184
  if (c != null) {
6230
- const g = u.message.metadata != null ? Kn(u.message.metadata, c) : c;
6185
+ const b = u.message.metadata != null ? Kn(u.message.metadata, c) : c;
6231
6186
  t != null && await $r({
6232
- value: g,
6187
+ value: b,
6233
6188
  schema: t,
6234
6189
  context: {
6235
6190
  field: "message.metadata",
6236
6191
  entityId: u.message.id
6237
6192
  }
6238
- }), u.message.metadata = g;
6193
+ }), u.message.metadata = b;
6239
6194
  }
6240
6195
  }
6241
6196
  switch (s.type) {
@@ -6246,7 +6201,7 @@ function Zl({
6246
6201
  providerMetadata: s.providerMetadata,
6247
6202
  state: "streaming"
6248
6203
  };
6249
- u.activeTextParts[s.id] = c, u.message.parts.push(c), l();
6204
+ u.activeTextParts[s.id] = c, u.message.parts.push(c), d();
6250
6205
  break;
6251
6206
  }
6252
6207
  case "text-delta": {
@@ -6257,7 +6212,7 @@ function Zl({
6257
6212
  chunkId: s.id,
6258
6213
  message: `Received text-delta for missing text part with ID "${s.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
6259
6214
  });
6260
- c.text += s.delta, c.providerMetadata = (p = s.providerMetadata) != null ? p : c.providerMetadata, l();
6215
+ c.text += s.delta, c.providerMetadata = (p = s.providerMetadata) != null ? p : c.providerMetadata, d();
6261
6216
  break;
6262
6217
  }
6263
6218
  case "text-end": {
@@ -6268,7 +6223,7 @@ function Zl({
6268
6223
  chunkId: s.id,
6269
6224
  message: `Received text-end for missing text part with ID "${s.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
6270
6225
  });
6271
- c.state = "done", c.providerMetadata = (h = s.providerMetadata) != null ? h : c.providerMetadata, delete u.activeTextParts[s.id], l();
6226
+ c.state = "done", c.providerMetadata = (m = s.providerMetadata) != null ? m : c.providerMetadata, delete u.activeTextParts[s.id], d();
6272
6227
  break;
6273
6228
  }
6274
6229
  case "custom": {
@@ -6277,7 +6232,7 @@ function Zl({
6277
6232
  kind: s.kind,
6278
6233
  providerMetadata: s.providerMetadata
6279
6234
  };
6280
- u.message.parts.push(c), l();
6235
+ u.message.parts.push(c), d();
6281
6236
  break;
6282
6237
  }
6283
6238
  case "reasoning-start": {
@@ -6287,7 +6242,7 @@ function Zl({
6287
6242
  providerMetadata: s.providerMetadata,
6288
6243
  state: "streaming"
6289
6244
  };
6290
- u.activeReasoningParts[s.id] = c, u.message.parts.push(c), l();
6245
+ u.activeReasoningParts[s.id] = c, u.message.parts.push(c), d();
6291
6246
  break;
6292
6247
  }
6293
6248
  case "reasoning-delta": {
@@ -6298,7 +6253,7 @@ function Zl({
6298
6253
  chunkId: s.id,
6299
6254
  message: `Received reasoning-delta for missing reasoning part with ID "${s.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
6300
6255
  });
6301
- c.text += s.delta, c.providerMetadata = (f = s.providerMetadata) != null ? f : c.providerMetadata, l();
6256
+ c.text += s.delta, c.providerMetadata = (h = s.providerMetadata) != null ? h : c.providerMetadata, d();
6302
6257
  break;
6303
6258
  }
6304
6259
  case "reasoning-end": {
@@ -6309,7 +6264,7 @@ function Zl({
6309
6264
  chunkId: s.id,
6310
6265
  message: `Received reasoning-end for missing reasoning part with ID "${s.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
6311
6266
  });
6312
- c.providerMetadata = (z = s.providerMetadata) != null ? z : c.providerMetadata, c.state = "done", delete u.activeReasoningParts[s.id], l();
6267
+ c.providerMetadata = (I = s.providerMetadata) != null ? I : c.providerMetadata, c.state = "done", delete u.activeReasoningParts[s.id], d();
6313
6268
  break;
6314
6269
  }
6315
6270
  case "file":
@@ -6319,7 +6274,7 @@ function Zl({
6319
6274
  mediaType: s.mediaType,
6320
6275
  url: s.url,
6321
6276
  ...s.providerMetadata != null ? { providerMetadata: s.providerMetadata } : {}
6322
- }), l();
6277
+ }), d();
6323
6278
  break;
6324
6279
  }
6325
6280
  case "source-url": {
@@ -6329,7 +6284,7 @@ function Zl({
6329
6284
  url: s.url,
6330
6285
  title: s.title,
6331
6286
  providerMetadata: s.providerMetadata
6332
- }), l();
6287
+ }), d();
6333
6288
  break;
6334
6289
  }
6335
6290
  case "source-document": {
@@ -6340,11 +6295,11 @@ function Zl({
6340
6295
  title: s.title,
6341
6296
  filename: s.filename,
6342
6297
  providerMetadata: s.providerMetadata
6343
- }), l();
6298
+ }), d();
6344
6299
  break;
6345
6300
  }
6346
6301
  case "tool-input-start": {
6347
- const c = S().filter(It);
6302
+ const c = Z().filter(It);
6348
6303
  u.partialToolCalls[s.toolCallId] = {
6349
6304
  text: "",
6350
6305
  toolName: s.toolName,
@@ -6352,7 +6307,7 @@ function Zl({
6352
6307
  dynamic: s.dynamic,
6353
6308
  title: s.title,
6354
6309
  toolMetadata: s.toolMetadata
6355
- }, s.dynamic ? x({
6310
+ }, s.dynamic ? P({
6356
6311
  toolCallId: s.toolCallId,
6357
6312
  toolName: s.toolName,
6358
6313
  state: "input-streaming",
@@ -6361,7 +6316,7 @@ function Zl({
6361
6316
  title: s.title,
6362
6317
  toolMetadata: s.toolMetadata,
6363
6318
  providerMetadata: s.providerMetadata
6364
- }) : M({
6319
+ }) : N({
6365
6320
  toolCallId: s.toolCallId,
6366
6321
  toolName: s.toolName,
6367
6322
  state: "input-streaming",
@@ -6370,7 +6325,7 @@ function Zl({
6370
6325
  title: s.title,
6371
6326
  toolMetadata: s.toolMetadata,
6372
6327
  providerMetadata: s.providerMetadata
6373
- }), l();
6328
+ }), d();
6374
6329
  break;
6375
6330
  }
6376
6331
  case "tool-input-delta": {
@@ -6382,28 +6337,28 @@ function Zl({
6382
6337
  message: `Received tool-input-delta for missing tool call with ID "${s.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
6383
6338
  });
6384
6339
  c.text += s.inputTextDelta;
6385
- const { value: g } = await Be(
6340
+ const { value: b } = await Be(
6386
6341
  c.text
6387
6342
  );
6388
- c.dynamic ? x({
6343
+ c.dynamic ? P({
6389
6344
  toolCallId: s.toolCallId,
6390
6345
  toolName: c.toolName,
6391
6346
  state: "input-streaming",
6392
- input: g,
6347
+ input: b,
6393
6348
  title: c.title,
6394
6349
  toolMetadata: c.toolMetadata
6395
- }) : M({
6350
+ }) : N({
6396
6351
  toolCallId: s.toolCallId,
6397
6352
  toolName: c.toolName,
6398
6353
  state: "input-streaming",
6399
- input: g,
6354
+ input: b,
6400
6355
  title: c.title,
6401
6356
  toolMetadata: c.toolMetadata
6402
- }), l();
6357
+ }), d();
6403
6358
  break;
6404
6359
  }
6405
6360
  case "tool-input-available": {
6406
- s.dynamic ? x({
6361
+ s.dynamic ? P({
6407
6362
  toolCallId: s.toolCallId,
6408
6363
  toolName: s.toolName,
6409
6364
  state: "input-available",
@@ -6412,7 +6367,7 @@ function Zl({
6412
6367
  providerMetadata: s.providerMetadata,
6413
6368
  title: s.title,
6414
6369
  toolMetadata: s.toolMetadata
6415
- }) : M({
6370
+ }) : N({
6416
6371
  toolCallId: s.toolCallId,
6417
6372
  toolName: s.toolName,
6418
6373
  state: "input-available",
@@ -6421,14 +6376,14 @@ function Zl({
6421
6376
  providerMetadata: s.providerMetadata,
6422
6377
  title: s.title,
6423
6378
  toolMetadata: s.toolMetadata
6424
- }), l(), a && !s.providerExecuted && await a({
6379
+ }), d(), a && !s.providerExecuted && await a({
6425
6380
  toolCall: s
6426
6381
  });
6427
6382
  break;
6428
6383
  }
6429
6384
  case "tool-input-error": {
6430
- const c = S().filter($e).find(($) => $.toolCallId === s.toolCallId);
6431
- (c != null ? c.type === "dynamic-tool" : !!s.dynamic) ? x({
6385
+ const c = Z().filter($e).find(($) => $.toolCallId === s.toolCallId);
6386
+ (c != null ? c.type === "dynamic-tool" : !!s.dynamic) ? P({
6432
6387
  toolCallId: s.toolCallId,
6433
6388
  toolName: s.toolName,
6434
6389
  state: "output-error",
@@ -6437,7 +6392,7 @@ function Zl({
6437
6392
  providerExecuted: s.providerExecuted,
6438
6393
  providerMetadata: s.providerMetadata,
6439
6394
  toolMetadata: s.toolMetadata
6440
- }) : M({
6395
+ }) : N({
6441
6396
  toolCallId: s.toolCallId,
6442
6397
  toolName: s.toolName,
6443
6398
  state: "output-error",
@@ -6447,39 +6402,39 @@ function Zl({
6447
6402
  providerExecuted: s.providerExecuted,
6448
6403
  providerMetadata: s.providerMetadata,
6449
6404
  toolMetadata: s.toolMetadata
6450
- }), l();
6405
+ }), d();
6451
6406
  break;
6452
6407
  }
6453
6408
  case "tool-approval-request": {
6454
- const c = y(s.toolCallId);
6409
+ const c = E(s.toolCallId);
6455
6410
  c.state = "approval-requested", c.approval = {
6456
6411
  id: s.approvalId,
6457
6412
  ...s.isAutomatic === !0 ? { isAutomatic: !0 } : {},
6458
6413
  ...s.signature != null ? { signature: s.signature } : {}
6459
- }, l();
6414
+ }, d();
6460
6415
  break;
6461
6416
  }
6462
6417
  case "tool-approval-response": {
6463
- const c = E(
6418
+ const c = k(
6464
6419
  s.approvalId
6465
- ), g = c.approval == null ? { id: s.approvalId } : c.approval;
6420
+ ), b = c.approval == null ? { id: s.approvalId } : c.approval;
6466
6421
  c.state = "approval-responded", c.approval = {
6467
6422
  id: s.approvalId,
6468
6423
  approved: s.approved,
6469
6424
  ...s.reason != null ? { reason: s.reason } : {},
6470
- ...g.isAutomatic === !0 ? { isAutomatic: !0 } : {},
6471
- ...g.signature != null ? { signature: g.signature } : {}
6472
- }, s.providerExecuted != null && (c.providerExecuted = s.providerExecuted), s.providerMetadata != null && (c.callProviderMetadata = s.providerMetadata), l();
6425
+ ...b.isAutomatic === !0 ? { isAutomatic: !0 } : {},
6426
+ ...b.signature != null ? { signature: b.signature } : {}
6427
+ }, s.providerExecuted != null && (c.providerExecuted = s.providerExecuted), s.providerMetadata != null && (c.callProviderMetadata = s.providerMetadata), d();
6473
6428
  break;
6474
6429
  }
6475
6430
  case "tool-output-denied": {
6476
- const c = y(s.toolCallId);
6477
- c.state = "output-denied", l();
6431
+ const c = E(s.toolCallId);
6432
+ c.state = "output-denied", d();
6478
6433
  break;
6479
6434
  }
6480
6435
  case "tool-output-available": {
6481
- const c = y(s.toolCallId);
6482
- c.type === "dynamic-tool" ? x(
6436
+ const c = E(s.toolCallId);
6437
+ c.type === "dynamic-tool" ? P(
6483
6438
  {
6484
6439
  toolCallId: s.toolCallId,
6485
6440
  toolName: c.toolName,
@@ -6493,7 +6448,7 @@ function Zl({
6493
6448
  toolMetadata: c.toolMetadata
6494
6449
  },
6495
6450
  c
6496
- ) : M(
6451
+ ) : N(
6497
6452
  {
6498
6453
  toolCallId: s.toolCallId,
6499
6454
  toolName: kr(c),
@@ -6507,12 +6462,12 @@ function Zl({
6507
6462
  toolMetadata: c.toolMetadata
6508
6463
  },
6509
6464
  c
6510
- ), l();
6465
+ ), d();
6511
6466
  break;
6512
6467
  }
6513
6468
  case "tool-output-error": {
6514
- const c = y(s.toolCallId);
6515
- c.type === "dynamic-tool" ? x(
6469
+ const c = E(s.toolCallId);
6470
+ c.type === "dynamic-tool" ? P(
6516
6471
  {
6517
6472
  toolCallId: s.toolCallId,
6518
6473
  toolName: c.toolName,
@@ -6525,7 +6480,7 @@ function Zl({
6525
6480
  toolMetadata: c.toolMetadata
6526
6481
  },
6527
6482
  c
6528
- ) : M(
6483
+ ) : N(
6529
6484
  {
6530
6485
  toolCallId: s.toolCallId,
6531
6486
  toolName: kr(c),
@@ -6539,7 +6494,7 @@ function Zl({
6539
6494
  toolMetadata: c.toolMetadata
6540
6495
  },
6541
6496
  c
6542
- ), l();
6497
+ ), d();
6543
6498
  break;
6544
6499
  }
6545
6500
  case "start-step": {
@@ -6551,32 +6506,32 @@ function Zl({
6551
6506
  break;
6552
6507
  }
6553
6508
  case "start": {
6554
- s.messageId != null && (u.message.id = s.messageId), await _(s.messageMetadata), (s.messageId != null || s.messageMetadata != null) && l();
6509
+ s.messageId != null && (u.message.id = s.messageId), await g(s.messageMetadata), (s.messageId != null || s.messageMetadata != null) && d();
6555
6510
  break;
6556
6511
  }
6557
6512
  case "finish": {
6558
- s.finishReason != null && (u.finishReason = s.finishReason), await _(s.messageMetadata), s.messageMetadata != null && l();
6513
+ s.finishReason != null && (u.finishReason = s.finishReason), await g(s.messageMetadata), s.messageMetadata != null && d();
6559
6514
  break;
6560
6515
  }
6561
6516
  case "message-metadata": {
6562
- await _(s.messageMetadata), s.messageMetadata != null && l();
6517
+ await g(s.messageMetadata), s.messageMetadata != null && d();
6563
6518
  break;
6564
6519
  }
6565
6520
  case "error": {
6566
- o == null || o(new Error(s.errorText));
6521
+ o?.(new Error(s.errorText));
6567
6522
  break;
6568
6523
  }
6569
6524
  default:
6570
6525
  if ($l(s)) {
6571
- if ((r == null ? void 0 : r[s.type]) != null) {
6526
+ if (r?.[s.type] != null) {
6572
6527
  const $ = u.message.parts.findIndex(
6573
- (O) => "id" in O && "data" in O && O.id === s.id && O.type === s.type
6574
- ), Z = $ >= 0 ? $ : u.message.parts.length;
6528
+ (S) => "id" in S && "data" in S && S.id === s.id && S.type === s.type
6529
+ ), A = $ >= 0 ? $ : u.message.parts.length;
6575
6530
  await $r({
6576
6531
  value: s.data,
6577
6532
  schema: r[s.type],
6578
6533
  context: {
6579
- field: `message.parts[${Z}].data`,
6534
+ field: `message.parts[${A}].data`,
6580
6535
  entityName: s.type,
6581
6536
  entityId: s.id
6582
6537
  }
@@ -6584,16 +6539,16 @@ function Zl({
6584
6539
  }
6585
6540
  const c = s;
6586
6541
  if (c.transient) {
6587
- i == null || i(c);
6542
+ i?.(c);
6588
6543
  break;
6589
6544
  }
6590
- const g = c.id != null ? u.message.parts.find(
6545
+ const b = c.id != null ? u.message.parts.find(
6591
6546
  ($) => c.type === $.type && c.id === $.id
6592
6547
  ) : void 0;
6593
- g != null ? g.data = c.data : u.message.parts.push(c), i == null || i(c), l();
6548
+ b != null ? b.data = c.data : u.message.parts.push(c), i?.(c), d();
6594
6549
  }
6595
6550
  }
6596
- d.enqueue(s);
6551
+ l.enqueue(s);
6597
6552
  });
6598
6553
  }
6599
6554
  })
@@ -6611,7 +6566,7 @@ async function Al({
6611
6566
  break;
6612
6567
  }
6613
6568
  } catch (n) {
6614
- t == null || t(n);
6569
+ t?.(n);
6615
6570
  } finally {
6616
6571
  r.releaseLock();
6617
6572
  }
@@ -6683,10 +6638,10 @@ async function Pl(e) {
6683
6638
  Array.from(e).map(async (t) => {
6684
6639
  const { name: r, type: n } = t, o = await new Promise((a, i) => {
6685
6640
  const s = new FileReader();
6686
- s.onload = (d) => {
6641
+ s.onload = (l) => {
6687
6642
  var u;
6688
- a((u = d.target) == null ? void 0 : u.result);
6689
- }, s.onerror = (d) => i(d), s.readAsDataURL(t);
6643
+ a((u = l.target) == null ? void 0 : u.result);
6644
+ }, s.onerror = (l) => i(l), s.readAsDataURL(t);
6690
6645
  });
6691
6646
  return {
6692
6647
  type: "file",
@@ -6714,70 +6669,70 @@ var Ml = class {
6714
6669
  ...t
6715
6670
  }) {
6716
6671
  var r, n, o, a, i;
6717
- const s = await de(this.body), d = await de(this.headers), u = await de(this.credentials), l = {
6718
- ...Ie(d),
6672
+ const s = await de(this.body), l = await de(this.headers), u = await de(this.credentials), d = {
6673
+ ...Ie(l),
6719
6674
  ...Ie(t.headers)
6720
6675
  }, p = await ((r = this.prepareSendMessagesRequest) == null ? void 0 : r.call(this, {
6721
6676
  api: this.api,
6722
6677
  id: t.chatId,
6723
6678
  messages: t.messages,
6724
6679
  body: { ...s, ...t.body },
6725
- headers: l,
6680
+ headers: d,
6726
6681
  credentials: u,
6727
6682
  requestMetadata: t.metadata,
6728
6683
  trigger: t.trigger,
6729
6684
  messageId: t.messageId
6730
- })), h = (n = p == null ? void 0 : p.api) != null ? n : this.api, f = (p == null ? void 0 : p.headers) !== void 0 ? Ie(p.headers) : l, z = (p == null ? void 0 : p.body) !== void 0 ? p.body : {
6685
+ })), m = (n = p?.api) != null ? n : this.api, h = p?.headers !== void 0 ? Ie(p.headers) : d, I = p?.body !== void 0 ? p.body : {
6731
6686
  ...s,
6732
6687
  ...t.body,
6733
6688
  id: t.chatId,
6734
6689
  messages: t.messages,
6735
6690
  trigger: t.trigger,
6736
6691
  messageId: t.messageId
6737
- }, S = (o = p == null ? void 0 : p.credentials) != null ? o : u, y = await ((a = this.fetch) != null ? a : globalThis.fetch)(h, {
6692
+ }, Z = (o = p?.credentials) != null ? o : u, E = await ((a = this.fetch) != null ? a : globalThis.fetch)(m, {
6738
6693
  method: "POST",
6739
6694
  headers: {
6740
6695
  "Content-Type": "application/json",
6741
- ...f
6696
+ ...h
6742
6697
  },
6743
- body: JSON.stringify(z),
6744
- credentials: S,
6698
+ body: JSON.stringify(I),
6699
+ credentials: Z,
6745
6700
  signal: e
6746
6701
  });
6747
- if (!y.ok)
6702
+ if (!E.ok)
6748
6703
  throw new Error(
6749
- (i = await y.text()) != null ? i : "Failed to fetch the chat response."
6704
+ (i = await E.text()) != null ? i : "Failed to fetch the chat response."
6750
6705
  );
6751
- if (!y.body)
6706
+ if (!E.body)
6752
6707
  throw new Error("The response body is empty.");
6753
- return this.processResponseStream(y.body);
6708
+ return this.processResponseStream(E.body);
6754
6709
  }
6755
6710
  async reconnectToStream(e) {
6756
6711
  var t, r, n, o, a;
6757
- const i = await de(this.body), s = await de(this.headers), d = await de(this.credentials), u = {
6712
+ const i = await de(this.body), s = await de(this.headers), l = await de(this.credentials), u = {
6758
6713
  ...Ie(s),
6759
6714
  ...Ie(e.headers)
6760
- }, l = await ((t = this.prepareReconnectToStreamRequest) == null ? void 0 : t.call(this, {
6715
+ }, d = await ((t = this.prepareReconnectToStreamRequest) == null ? void 0 : t.call(this, {
6761
6716
  api: this.api,
6762
6717
  id: e.chatId,
6763
6718
  body: { ...i, ...e.body },
6764
6719
  headers: u,
6765
- credentials: d,
6720
+ credentials: l,
6766
6721
  requestMetadata: e.metadata
6767
- })), p = (r = l == null ? void 0 : l.api) != null ? r : `${this.api}/${e.chatId}/stream`, h = (l == null ? void 0 : l.headers) !== void 0 ? Ie(l.headers) : u, f = (n = l == null ? void 0 : l.credentials) != null ? n : d, S = await ((o = this.fetch) != null ? o : globalThis.fetch)(p, {
6722
+ })), p = (r = d?.api) != null ? r : `${this.api}/${e.chatId}/stream`, m = d?.headers !== void 0 ? Ie(d.headers) : u, h = (n = d?.credentials) != null ? n : l, Z = await ((o = this.fetch) != null ? o : globalThis.fetch)(p, {
6768
6723
  method: "GET",
6769
- headers: h,
6770
- credentials: f
6724
+ headers: m,
6725
+ credentials: h
6771
6726
  });
6772
- if (S.status === 204)
6727
+ if (Z.status === 204)
6773
6728
  return null;
6774
- if (!S.ok)
6729
+ if (!Z.ok)
6775
6730
  throw new Error(
6776
- (a = await S.text()) != null ? a : "Failed to fetch the chat response."
6731
+ (a = await Z.text()) != null ? a : "Failed to fetch the chat response."
6777
6732
  );
6778
- if (!S.body)
6733
+ if (!Z.body)
6779
6734
  throw new Error("The response body is empty.");
6780
- return this.processResponseStream(S.body);
6735
+ return this.processResponseStream(Z.body);
6781
6736
  }
6782
6737
  }, no = class extends Ml {
6783
6738
  constructor(e = {}) {
@@ -6807,69 +6762,69 @@ var Ml = class {
6807
6762
  state: a,
6808
6763
  onError: i,
6809
6764
  onToolCall: s,
6810
- onFinish: d,
6765
+ onFinish: l,
6811
6766
  onData: u,
6812
- sendAutomaticallyWhen: l
6767
+ sendAutomaticallyWhen: d
6813
6768
  }) {
6814
- this.activeResponse = void 0, this.jobExecutor = new Nl(), this.sendMessage = async (p, h) => {
6815
- var f, z, S, I;
6769
+ this.activeResponse = void 0, this.jobExecutor = new Nl(), this.sendMessage = async (p, m) => {
6770
+ var h, I, Z, _;
6816
6771
  if (p == null) {
6817
6772
  await this.makeRequest({
6818
6773
  trigger: "submit-message",
6819
- messageId: (f = this.lastMessage) == null ? void 0 : f.id,
6820
- ...h
6774
+ messageId: (h = this.lastMessage) == null ? void 0 : h.id,
6775
+ ...m
6821
6776
  });
6822
6777
  return;
6823
6778
  }
6824
- let y;
6825
- if ("text" in p || "files" in p ? y = {
6779
+ let E;
6780
+ if ("text" in p || "files" in p ? E = {
6826
6781
  parts: [
6827
6782
  ...Array.isArray(p.files) ? p.files : await Pl(p.files),
6828
6783
  ..."text" in p && p.text != null ? [{ type: "text", text: p.text }] : []
6829
6784
  ]
6830
- } : y = p, p.messageId != null) {
6831
- const E = this.state.messages.findIndex(
6832
- (M) => M.id === p.messageId
6785
+ } : E = p, p.messageId != null) {
6786
+ const k = this.state.messages.findIndex(
6787
+ (N) => N.id === p.messageId
6833
6788
  );
6834
- if (E === -1)
6789
+ if (k === -1)
6835
6790
  throw new Error(`message with id ${p.messageId} not found`);
6836
- if (this.state.messages[E].role !== "user")
6791
+ if (this.state.messages[k].role !== "user")
6837
6792
  throw new Error(
6838
6793
  `message with id ${p.messageId} is not a user message`
6839
6794
  );
6840
- this.state.messages = this.state.messages.slice(0, E + 1), this.state.replaceMessage(E, {
6841
- ...y,
6795
+ this.state.messages = this.state.messages.slice(0, k + 1), this.state.replaceMessage(k, {
6796
+ ...E,
6842
6797
  id: p.messageId,
6843
- role: (z = y.role) != null ? z : "user",
6798
+ role: (I = E.role) != null ? I : "user",
6844
6799
  metadata: p.metadata
6845
6800
  });
6846
6801
  } else
6847
6802
  this.state.pushMessage({
6848
- ...y,
6849
- id: (S = y.id) != null ? S : this.generateId(),
6850
- role: (I = y.role) != null ? I : "user",
6803
+ ...E,
6804
+ id: (Z = E.id) != null ? Z : this.generateId(),
6805
+ role: (_ = E.role) != null ? _ : "user",
6851
6806
  metadata: p.metadata
6852
6807
  });
6853
6808
  await this.makeRequest({
6854
6809
  trigger: "submit-message",
6855
6810
  messageId: p.messageId,
6856
- ...h
6811
+ ...m
6857
6812
  });
6858
6813
  }, this.regenerate = async ({
6859
6814
  messageId: p,
6860
- ...h
6815
+ ...m
6861
6816
  } = {}) => {
6862
- const f = p == null ? this.state.messages.length - 1 : this.state.messages.findIndex((z) => z.id === p);
6863
- if (f === -1)
6817
+ const h = p == null ? this.state.messages.length - 1 : this.state.messages.findIndex((I) => I.id === p);
6818
+ if (h === -1)
6864
6819
  throw new Error(`message ${p} not found`);
6865
6820
  this.state.messages = this.state.messages.slice(
6866
6821
  0,
6867
6822
  // if the message is a user message, we need to include it in the request:
6868
- this.messages[f].role === "assistant" ? f : f + 1
6823
+ this.messages[h].role === "assistant" ? h : h + 1
6869
6824
  ), await this.makeRequest({
6870
6825
  trigger: "regenerate-message",
6871
6826
  messageId: p,
6872
- ...h
6827
+ ...m
6873
6828
  });
6874
6829
  }, this.resumeStream = async (p = {}) => {
6875
6830
  await this.makeRequest({ trigger: "resume-stream", ...p });
@@ -6877,49 +6832,49 @@ var Ml = class {
6877
6832
  this.status === "error" && (this.state.error = void 0, this.setStatus({ status: "ready" }));
6878
6833
  }, this.addToolApprovalResponse = async ({
6879
6834
  id: p,
6880
- approved: h,
6881
- reason: f,
6882
- options: z
6835
+ approved: m,
6836
+ reason: h,
6837
+ options: I
6883
6838
  }) => this.jobExecutor.run(async () => {
6884
- const S = this.state.messages, I = S[S.length - 1], y = (E) => $e(E) && E.state === "approval-requested" && E.approval.id === p ? {
6885
- ...E,
6839
+ const Z = this.state.messages, _ = Z[Z.length - 1], E = (k) => $e(k) && k.state === "approval-requested" && k.approval.id === p ? {
6840
+ ...k,
6886
6841
  state: "approval-responded",
6887
- approval: { ...E.approval, id: p, approved: h, reason: f }
6888
- } : E;
6889
- this.state.replaceMessage(S.length - 1, {
6890
- ...I,
6891
- parts: I.parts.map(y)
6892
- }), this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(y)), this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen && this.shouldSendAutomatically().then((E) => {
6893
- var M;
6894
- E && this.makeRequest({
6842
+ approval: { ...k.approval, id: p, approved: m, reason: h }
6843
+ } : k;
6844
+ this.state.replaceMessage(Z.length - 1, {
6845
+ ..._,
6846
+ parts: _.parts.map(E)
6847
+ }), this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(E)), this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen && this.shouldSendAutomatically().then((k) => {
6848
+ var N;
6849
+ k && this.makeRequest({
6895
6850
  trigger: "submit-message",
6896
- messageId: (M = this.lastMessage) == null ? void 0 : M.id,
6897
- ...z
6851
+ messageId: (N = this.lastMessage) == null ? void 0 : N.id,
6852
+ ...I
6898
6853
  });
6899
6854
  });
6900
6855
  }), this.addToolOutput = async ({
6901
6856
  state: p = "output-available",
6902
- toolCallId: h,
6903
- output: f,
6904
- errorText: z,
6905
- options: S
6857
+ toolCallId: m,
6858
+ output: h,
6859
+ errorText: I,
6860
+ options: Z
6906
6861
  }) => this.jobExecutor.run(async () => {
6907
- const I = this.state.messages, y = I[I.length - 1], E = (M) => $e(M) && M.toolCallId === h ? { ...M, state: p, output: f, errorText: z } : M;
6908
- this.state.replaceMessage(I.length - 1, {
6909
- ...y,
6910
- parts: y.parts.map(E)
6911
- }), this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(E)), this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen && this.shouldSendAutomatically().then((M) => {
6912
- var x;
6913
- M && this.makeRequest({
6862
+ const _ = this.state.messages, E = _[_.length - 1], k = (N) => $e(N) && N.toolCallId === m ? { ...N, state: p, output: h, errorText: I } : N;
6863
+ this.state.replaceMessage(_.length - 1, {
6864
+ ...E,
6865
+ parts: E.parts.map(k)
6866
+ }), this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(k)), this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen && this.shouldSendAutomatically().then((N) => {
6867
+ var P;
6868
+ N && this.makeRequest({
6914
6869
  trigger: "submit-message",
6915
- messageId: (x = this.lastMessage) == null ? void 0 : x.id,
6916
- ...S
6870
+ messageId: (P = this.lastMessage) == null ? void 0 : P.id,
6871
+ ...Z
6917
6872
  });
6918
6873
  });
6919
6874
  }), this.addToolResult = this.addToolOutput, this.stop = async () => {
6920
6875
  var p;
6921
6876
  this.status !== "streaming" && this.status !== "submitted" || (p = this.activeResponse) != null && p.abortController && this.activeResponse.abortController.abort();
6922
- }, this.id = t, this.transport = r, this.generateId = e, this.messageMetadataSchema = n, this.dataPartSchemas = o, this.state = a, this.onError = i, this.onToolCall = s, this.onFinish = d, this.onData = u, this.sendAutomaticallyWhen = l;
6877
+ }, this.id = t, this.transport = r, this.generateId = e, this.messageMetadataSchema = n, this.dataPartSchemas = o, this.state = a, this.onError = i, this.onToolCall = s, this.onFinish = l, this.onData = u, this.sendAutomaticallyWhen = d;
6923
6878
  }
6924
6879
  /**
6925
6880
  * Hook status:
@@ -6969,93 +6924,93 @@ var Ml = class {
6969
6924
  let s;
6970
6925
  if (e === "resume-stream")
6971
6926
  try {
6972
- const f = await this.transport.reconnectToStream({
6927
+ const h = await this.transport.reconnectToStream({
6973
6928
  chatId: this.id,
6974
6929
  metadata: t,
6975
6930
  headers: r,
6976
6931
  body: n
6977
6932
  });
6978
- if (f == null)
6933
+ if (h == null)
6979
6934
  return;
6980
- s = f;
6981
- } catch (f) {
6982
- this.onError && f instanceof Error && this.onError(f), this.setStatus({ status: "error", error: f });
6935
+ s = h;
6936
+ } catch (h) {
6937
+ this.onError && h instanceof Error && this.onError(h), this.setStatus({ status: "error", error: h });
6983
6938
  return;
6984
6939
  }
6985
6940
  this.setStatus({ status: "submitted", error: void 0 });
6986
- const d = this.lastMessage;
6987
- let u = !1, l = !1, p = !1, h;
6941
+ const l = this.lastMessage;
6942
+ let u = !1, d = !1, p = !1, m;
6988
6943
  try {
6989
- const f = {
6944
+ const h = {
6990
6945
  state: Tl({
6991
- lastMessage: this.state.snapshot(d),
6946
+ lastMessage: this.state.snapshot(l),
6992
6947
  messageId: this.generateId()
6993
6948
  }),
6994
6949
  abortController: new AbortController()
6995
6950
  };
6996
- h = f, f.abortController.signal.addEventListener("abort", () => {
6951
+ m = h, h.abortController.signal.addEventListener("abort", () => {
6997
6952
  u = !0;
6998
- }), this.activeResponse = f;
6999
- let z;
7000
- e === "resume-stream" ? z = s : z = await this.transport.sendMessages({
6953
+ }), this.activeResponse = h;
6954
+ let I;
6955
+ e === "resume-stream" ? I = s : I = await this.transport.sendMessages({
7001
6956
  chatId: this.id,
7002
6957
  messages: this.state.messages,
7003
- abortSignal: f.abortController.signal,
6958
+ abortSignal: h.abortController.signal,
7004
6959
  metadata: t,
7005
6960
  headers: r,
7006
6961
  body: n,
7007
6962
  trigger: e,
7008
6963
  messageId: o
7009
6964
  });
7010
- const S = (I) => (
6965
+ const Z = (_) => (
7011
6966
  // serialize the job execution to avoid race conditions:
7012
6967
  this.jobExecutor.run(
7013
- () => I({
7014
- state: f.state,
6968
+ () => _({
6969
+ state: h.state,
7015
6970
  write: () => {
7016
- var y;
7017
- this.setStatus({ status: "streaming" }), f.state.message.id === ((y = this.lastMessage) == null ? void 0 : y.id) ? this.state.replaceMessage(
6971
+ var E;
6972
+ this.setStatus({ status: "streaming" }), h.state.message.id === ((E = this.lastMessage) == null ? void 0 : E.id) ? this.state.replaceMessage(
7018
6973
  this.state.messages.length - 1,
7019
- f.state.message
7020
- ) : this.state.pushMessage(f.state.message);
6974
+ h.state.message
6975
+ ) : this.state.pushMessage(h.state.message);
7021
6976
  }
7022
6977
  })
7023
6978
  )
7024
6979
  );
7025
6980
  await Al({
7026
6981
  stream: Zl({
7027
- stream: z,
6982
+ stream: I,
7028
6983
  onToolCall: this.onToolCall,
7029
6984
  onData: this.onData,
7030
6985
  messageMetadataSchema: this.messageMetadataSchema,
7031
6986
  dataPartSchemas: this.dataPartSchemas,
7032
- runUpdateMessageJob: S,
7033
- onError: (I) => {
7034
- throw I;
6987
+ runUpdateMessageJob: Z,
6988
+ onError: (_) => {
6989
+ throw _;
7035
6990
  }
7036
6991
  }),
7037
- onError: (I) => {
7038
- throw I;
6992
+ onError: (_) => {
6993
+ throw _;
7039
6994
  }
7040
6995
  }), this.setStatus({ status: "ready" });
7041
- } catch (f) {
7042
- if (u || f.name === "AbortError")
6996
+ } catch (h) {
6997
+ if (u || h.name === "AbortError")
7043
6998
  return u = !0, this.setStatus({ status: "ready" }), null;
7044
- p = !0, f instanceof TypeError && (f.message.toLowerCase().includes("fetch") || f.message.toLowerCase().includes("network")) && (l = !0), this.onError && f instanceof Error && this.onError(f), this.setStatus({ status: "error", error: f });
6999
+ p = !0, h instanceof TypeError && (h.message.toLowerCase().includes("fetch") || h.message.toLowerCase().includes("network")) && (d = !0), this.onError && h instanceof Error && this.onError(h), this.setStatus({ status: "error", error: h });
7045
7000
  } finally {
7046
7001
  try {
7047
- h && ((a = this.onFinish) == null || a.call(this, {
7048
- message: h.state.message,
7002
+ m && ((a = this.onFinish) == null || a.call(this, {
7003
+ message: m.state.message,
7049
7004
  messages: this.state.messages,
7050
7005
  isAbort: u,
7051
- isDisconnect: l,
7006
+ isDisconnect: d,
7052
7007
  isError: p,
7053
- finishReason: h.state.finishReason
7008
+ finishReason: m.state.finishReason
7054
7009
  }));
7055
- } catch (f) {
7056
- console.error(f);
7010
+ } catch (h) {
7011
+ console.error(h);
7057
7012
  }
7058
- this.activeResponse === h && (this.activeResponse = void 0);
7013
+ this.activeResponse === m && (this.activeResponse = void 0);
7059
7014
  }
7060
7015
  !p && await this.shouldSendAutomatically() && await this.makeRequest({
7061
7016
  trigger: "submit-message",
@@ -7075,7 +7030,7 @@ function Cl() {
7075
7030
  let n, o = 0;
7076
7031
  return function(...i) {
7077
7032
  clearTimeout(n);
7078
- const s = Date.now(), d = s - o, u = r - d;
7033
+ const s = Date.now(), l = s - o, u = r - l;
7079
7034
  u <= 0 ? (o = s, t.apply(this, i)) : n = setTimeout(() => {
7080
7035
  o = Date.now(), t.apply(this, i);
7081
7036
  }, u);
@@ -7178,58 +7133,58 @@ function Ul({
7178
7133
  });
7179
7134
  let i;
7180
7135
  const s = () => {
7181
- var I;
7182
- return (I = a.current.transport) != null ? I : i ?? (i = new no());
7183
- }, d = {
7136
+ var _;
7137
+ return (_ = a.current.transport) != null ? _ : i ?? (i = new no());
7138
+ }, l = {
7184
7139
  ...n,
7185
7140
  transport: {
7186
- sendMessages: (I) => s().sendMessages(I),
7187
- reconnectToStream: (I) => s().reconnectToStream(I)
7141
+ sendMessages: (_) => s().sendMessages(_),
7142
+ reconnectToStream: (_) => s().reconnectToStream(_)
7188
7143
  },
7189
- onToolCall: (I) => {
7190
- var y, E;
7191
- return (E = (y = a.current).onToolCall) == null ? void 0 : E.call(y, I);
7144
+ onToolCall: (_) => {
7145
+ var E, k;
7146
+ return (k = (E = a.current).onToolCall) == null ? void 0 : k.call(E, _);
7192
7147
  },
7193
- onData: (I) => {
7194
- var y, E;
7195
- return (E = (y = a.current).onData) == null ? void 0 : E.call(y, I);
7148
+ onData: (_) => {
7149
+ var E, k;
7150
+ return (k = (E = a.current).onData) == null ? void 0 : k.call(E, _);
7196
7151
  },
7197
- onFinish: (I) => {
7198
- var y, E;
7199
- return (E = (y = a.current).onFinish) == null ? void 0 : E.call(y, I);
7152
+ onFinish: (_) => {
7153
+ var E, k;
7154
+ return (k = (E = a.current).onFinish) == null ? void 0 : k.call(E, _);
7200
7155
  },
7201
- onError: (I) => {
7202
- var y, E;
7203
- return (E = (y = a.current).onError) == null ? void 0 : E.call(y, I);
7156
+ onError: (_) => {
7157
+ var E, k;
7158
+ return (k = (E = a.current).onError) == null ? void 0 : k.call(E, _);
7204
7159
  },
7205
- sendAutomaticallyWhen: (I) => {
7206
- var y, E, M;
7207
- return (M = (E = (y = a.current).sendAutomaticallyWhen) == null ? void 0 : E.call(y, I)) != null ? M : !1;
7160
+ sendAutomaticallyWhen: (_) => {
7161
+ var E, k, N;
7162
+ return (N = (k = (E = a.current).sendAutomaticallyWhen) == null ? void 0 : k.call(E, _)) != null ? N : !1;
7208
7163
  }
7209
7164
  }, u = Dt(
7210
- "chat" in n ? n.chat : new Zr(d)
7165
+ "chat" in n ? n.chat : new Zr(l)
7211
7166
  );
7212
- ("chat" in n && n.chat !== u.current || "id" in n && n.id != null && u.current.id !== n.id) && (u.current = "chat" in n ? n.chat : new Zr(d));
7167
+ ("chat" in n && n.chat !== u.current || "id" in n && n.id != null && u.current.id !== n.id) && (u.current = "chat" in n ? n.chat : new Zr(l));
7213
7168
  const p = Lt(
7214
- (I) => u.current["~registerMessagesCallback"](I, o),
7169
+ (_) => u.current["~registerMessagesCallback"](_, o),
7215
7170
  // `chatRef.current.id` is required to trigger re-subscription when the chat ID changes
7216
7171
  // eslint-disable-next-line react-hooks/exhaustive-deps
7217
7172
  [o, u.current.id]
7218
- ), h = ut(
7173
+ ), m = ut(
7219
7174
  p,
7220
7175
  () => u.current.messages,
7221
7176
  () => u.current.messages
7222
- ), f = ut(
7177
+ ), h = ut(
7223
7178
  u.current["~registerStatusCallback"],
7224
7179
  () => u.current.status,
7225
7180
  () => u.current.status
7226
- ), z = ut(
7181
+ ), I = ut(
7227
7182
  u.current["~registerErrorCallback"],
7228
7183
  () => u.current.error,
7229
7184
  () => u.current.error
7230
- ), S = Lt(
7231
- (I) => {
7232
- typeof I == "function" && (I = I(u.current.messages)), u.current.messages = I;
7185
+ ), Z = Lt(
7186
+ (_) => {
7187
+ typeof _ == "function" && (_ = _(u.current.messages)), u.current.messages = _;
7233
7188
  },
7234
7189
  [u]
7235
7190
  );
@@ -7237,15 +7192,15 @@ function Ul({
7237
7192
  r && u.current.resumeStream();
7238
7193
  }, [r, u]), {
7239
7194
  id: u.current.id,
7240
- messages: h,
7241
- setMessages: S,
7195
+ messages: m,
7196
+ setMessages: Z,
7242
7197
  sendMessage: u.current.sendMessage,
7243
7198
  regenerate: u.current.regenerate,
7244
7199
  clearError: u.current.clearError,
7245
7200
  stop: u.current.stop,
7246
- error: z,
7201
+ error: I,
7247
7202
  resumeStream: u.current.resumeStream,
7248
- status: f,
7203
+ status: h,
7249
7204
  /**
7250
7205
  * @deprecated Use `addToolOutput` instead.
7251
7206
  */