@8wave/ai-elements 0.121.0-beta.25 → 0.121.0-beta.27

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 (99) hide show
  1. package/dist/_chunks/Agent-wt8Vi99H.js.map +1 -1
  2. package/dist/_chunks/{PkStreamingMarkdown-Br7Z60Vm.js → PkStreamingMarkdown-UzW6Wv-y.js} +4 -4
  3. package/dist/_chunks/PkStreamingMarkdown-UzW6Wv-y.js.map +1 -0
  4. package/dist/_chunks/{PkToolShowArtifact-DtstlRsL.js → PkToolShowArtifact-Du5sSnTg.js} +2 -2
  5. package/dist/_chunks/{PkToolShowArtifact-DtstlRsL.js.map → PkToolShowArtifact-Du5sSnTg.js.map} +1 -1
  6. package/dist/_chunks/{PkToolShowContactForm-BKaKlYGJ.js → PkToolShowContactForm-CB046Ks4.js} +2 -2
  7. package/dist/_chunks/{PkToolShowContactForm-BKaKlYGJ.js.map → PkToolShowContactForm-CB046Ks4.js.map} +1 -1
  8. package/dist/_chunks/{PkToolShowForm-OxANKx0g.js → PkToolShowForm-RGbMaC_e.js} +2 -2
  9. package/dist/_chunks/{PkToolShowForm-OxANKx0g.js.map → PkToolShowForm-RGbMaC_e.js.map} +1 -1
  10. package/dist/_chunks/{PkToolShowSources-BQnaaL2a.js → PkToolShowSources-Cad5zT51.js} +2 -2
  11. package/dist/_chunks/{PkToolShowSources-BQnaaL2a.js.map → PkToolShowSources-Cad5zT51.js.map} +1 -1
  12. package/dist/ai-elements.es.js +1688 -1640
  13. package/dist/ai-elements.es.js.map +1 -1
  14. package/dist-vue/PkChatbot.js +1 -1
  15. package/dist-vue/PkChatbotEmptyState.js +1 -1
  16. package/dist-vue/PkChatbotInput.js +1 -1
  17. package/dist-vue/PkChatbotMessages.js +1 -1
  18. package/dist-vue/PkChatbotStepPayload.js +1 -1
  19. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  20. package/dist-vue/PkChatbotSteps.js +1 -1
  21. package/dist-vue/PkChatbotViewChat.js +1 -1
  22. package/dist-vue/PkChatbotViewConversations.js +1 -1
  23. package/dist-vue/PkChatbotViewFiles.js +1 -1
  24. package/dist-vue/PkChatbotViewProfile.js +1 -1
  25. package/dist-vue/_chunks/{Agent-DcoF75y8.js → Agent-CeteYjj7.js} +3 -2
  26. package/dist-vue/_chunks/Agent-CeteYjj7.js.map +1 -0
  27. package/dist-vue/_chunks/{Document-C1bD6VNU.js → Document-Bqt29i1g.js} +2 -2
  28. package/dist-vue/_chunks/{Document-C1bD6VNU.js.map → Document-Bqt29i1g.js.map} +1 -1
  29. package/dist-vue/_chunks/{PkChatbot-BF4OzQEE.js → PkChatbot-C6RQaC57.js} +8 -8
  30. package/dist-vue/_chunks/{PkChatbot-BF4OzQEE.js.map → PkChatbot-C6RQaC57.js.map} +1 -1
  31. package/dist-vue/_chunks/{PkChatbotEmptyState-h2qZ0JOD.js → PkChatbotEmptyState-DyfVQV1L.js} +2 -2
  32. package/dist-vue/_chunks/{PkChatbotEmptyState-h2qZ0JOD.js.map → PkChatbotEmptyState-DyfVQV1L.js.map} +1 -1
  33. package/dist-vue/_chunks/{PkChatbotInput-C-bMNHC-.js → PkChatbotInput-CGrW71Yz.js} +2 -2
  34. package/dist-vue/_chunks/{PkChatbotInput-C-bMNHC-.js.map → PkChatbotInput-CGrW71Yz.js.map} +1 -1
  35. package/dist-vue/_chunks/{PkChatbotMessages-C0922gNt.js → PkChatbotMessages-CSY0yAVd.js} +17 -17
  36. package/dist-vue/_chunks/{PkChatbotMessages-C0922gNt.js.map → PkChatbotMessages-CSY0yAVd.js.map} +1 -1
  37. package/dist-vue/_chunks/{PkChatbotStepPayload-BOxfKD1b.js → PkChatbotStepPayload-CGvRYp_H.js} +2 -2
  38. package/dist-vue/_chunks/{PkChatbotStepPayload-BOxfKD1b.js.map → PkChatbotStepPayload-CGvRYp_H.js.map} +1 -1
  39. package/dist-vue/_chunks/{PkChatbotStepToolDetail-Df6EOYxj.js → PkChatbotStepToolDetail-CvFdxw5H.js} +3 -3
  40. package/dist-vue/_chunks/{PkChatbotStepToolDetail-Df6EOYxj.js.map → PkChatbotStepToolDetail-CvFdxw5H.js.map} +1 -1
  41. package/dist-vue/_chunks/{PkChatbotSteps-DnDtN4Q7.js → PkChatbotSteps-CYXy__Wx.js} +5 -5
  42. package/dist-vue/_chunks/{PkChatbotSteps-DnDtN4Q7.js.map → PkChatbotSteps-CYXy__Wx.js.map} +1 -1
  43. package/dist-vue/_chunks/{PkChatbotViewChat-CZBRaIn-.js → PkChatbotViewChat-DlDZwo7m.js} +7 -7
  44. package/dist-vue/_chunks/{PkChatbotViewChat-CZBRaIn-.js.map → PkChatbotViewChat-DlDZwo7m.js.map} +1 -1
  45. package/dist-vue/_chunks/{PkChatbotViewConversations-DSSWFPod.js → PkChatbotViewConversations-CGhSt4ES.js} +3 -3
  46. package/dist-vue/_chunks/{PkChatbotViewConversations-DSSWFPod.js.map → PkChatbotViewConversations-CGhSt4ES.js.map} +1 -1
  47. package/dist-vue/_chunks/{PkChatbotViewFiles-CnAKz2X8.js → PkChatbotViewFiles-CrPd-Y2d.js} +3 -3
  48. package/dist-vue/_chunks/{PkChatbotViewFiles-CnAKz2X8.js.map → PkChatbotViewFiles-CrPd-Y2d.js.map} +1 -1
  49. package/dist-vue/_chunks/{PkChatbotViewProfile-42pXpWbn.js → PkChatbotViewProfile-vw8r9Pdo.js} +2 -2
  50. package/dist-vue/_chunks/{PkChatbotViewProfile-42pXpWbn.js.map → PkChatbotViewProfile-vw8r9Pdo.js.map} +1 -1
  51. package/dist-vue/_chunks/{PkStreamingMarkdown-BYV68skc.js → PkStreamingMarkdown-CgydvfPX.js} +3 -3
  52. package/dist-vue/_chunks/{PkStreamingMarkdown-BYV68skc.js.map → PkStreamingMarkdown-CgydvfPX.js.map} +1 -1
  53. package/dist-vue/_chunks/{PkToolEditSpreadsheet-DQxJQIY0.js → PkToolEditSpreadsheet-BJ5yxQTX.js} +2 -2
  54. package/dist-vue/_chunks/{PkToolEditSpreadsheet-DQxJQIY0.js.map → PkToolEditSpreadsheet-BJ5yxQTX.js.map} +1 -1
  55. package/dist-vue/_chunks/{PkToolRequestGeolocation-BpjglRbg.js → PkToolRequestGeolocation-FIvZM_BB.js} +2 -2
  56. package/dist-vue/_chunks/{PkToolRequestGeolocation-BpjglRbg.js.map → PkToolRequestGeolocation-FIvZM_BB.js.map} +1 -1
  57. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-CD3M5DWj.js → PkToolRequestOAuthConnection-CB6ukVv1.js} +2 -2
  58. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-CD3M5DWj.js.map → PkToolRequestOAuthConnection-CB6ukVv1.js.map} +1 -1
  59. package/dist-vue/_chunks/{PkToolShowArtifact-Bm5VBF_n.js → PkToolShowArtifact--Ut-C6en.js} +2 -2
  60. package/dist-vue/_chunks/{PkToolShowArtifact-Bm5VBF_n.js.map → PkToolShowArtifact--Ut-C6en.js.map} +1 -1
  61. package/dist-vue/_chunks/{PkToolShowContactForm-CMQTQsU-.js → PkToolShowContactForm-DwLwlkCt.js} +2 -2
  62. package/dist-vue/_chunks/{PkToolShowContactForm-CMQTQsU-.js.map → PkToolShowContactForm-DwLwlkCt.js.map} +1 -1
  63. package/dist-vue/_chunks/{PkToolShowDiagram-adGuj4AF.js → PkToolShowDiagram-Czl46bbI.js} +2 -2
  64. package/dist-vue/_chunks/{PkToolShowDiagram-adGuj4AF.js.map → PkToolShowDiagram-Czl46bbI.js.map} +1 -1
  65. package/dist-vue/_chunks/{PkToolShowForm-Cx5KdTlZ.js → PkToolShowForm-iz6g6jXJ.js} +4 -4
  66. package/dist-vue/_chunks/{PkToolShowForm-Cx5KdTlZ.js.map → PkToolShowForm-iz6g6jXJ.js.map} +1 -1
  67. package/dist-vue/_chunks/{PkToolShowImageGallery-BtQ0gnGB.js → PkToolShowImageGallery-Goytzhpx.js} +2 -2
  68. package/dist-vue/_chunks/{PkToolShowImageGallery-BtQ0gnGB.js.map → PkToolShowImageGallery-Goytzhpx.js.map} +1 -1
  69. package/dist-vue/_chunks/{PkToolShowProductList-Dvatk6p-.js → PkToolShowProductList-DHXm_0yk.js} +2 -2
  70. package/dist-vue/_chunks/{PkToolShowProductList-Dvatk6p-.js.map → PkToolShowProductList-DHXm_0yk.js.map} +1 -1
  71. package/dist-vue/_chunks/{PkToolShowSources-DKkIYQ9r.js → PkToolShowSources-BzwULCGN.js} +3 -3
  72. package/dist-vue/_chunks/{PkToolShowSources-DKkIYQ9r.js.map → PkToolShowSources-BzwULCGN.js.map} +1 -1
  73. package/dist-vue/_chunks/{PkToolShowSuggestedReply-BbAfjJP9.js → PkToolShowSuggestedReply-CWnw4Ybp.js} +2 -2
  74. package/dist-vue/_chunks/{PkToolShowSuggestedReply-BbAfjJP9.js.map → PkToolShowSuggestedReply-CWnw4Ybp.js.map} +1 -1
  75. package/dist-vue/_chunks/{PkToolShowVideo-DTNszfdU.js → PkToolShowVideo-BpplYU7J.js} +2 -2
  76. package/dist-vue/_chunks/{PkToolShowVideo-DTNszfdU.js.map → PkToolShowVideo-BpplYU7J.js.map} +1 -1
  77. package/dist-vue/_chunks/{PkToolShowWebPages-euov57FB.js → PkToolShowWebPages-CMKyI7Id.js} +2 -2
  78. package/dist-vue/_chunks/{PkToolShowWebPages-euov57FB.js.map → PkToolShowWebPages-CMKyI7Id.js.map} +1 -1
  79. package/dist-vue/_chunks/{createChatbotApiClient-qHjpFqPL.js → createChatbotApiClient-Qwv4G6rH.js} +12 -4
  80. package/dist-vue/_chunks/createChatbotApiClient-Qwv4G6rH.js.map +1 -0
  81. package/dist-vue/_chunks/{useChatbotStore-CnCoo6j3.js → useChatbotStore-BFOUiojG.js} +828 -790
  82. package/dist-vue/_chunks/useChatbotStore-BFOUiojG.js.map +1 -0
  83. package/dist-vue/_chunks/{utils-BCGK2AFl.js → utils-CzMEd-lR.js} +5 -5
  84. package/dist-vue/_chunks/utils-CzMEd-lR.js.map +1 -0
  85. package/dist-vue/api.js +1 -1
  86. package/dist-vue/composables.js +6 -4
  87. package/dist-vue/composables.js.map +1 -1
  88. package/dist-vue/index.js +24 -24
  89. package/dist-vue/locales.js +2 -0
  90. package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +7 -0
  91. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +9 -0
  92. package/dist-vue/packages/models/src/schema/Chat.d.ts +2 -0
  93. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +1 -0
  94. package/package.json +1 -1
  95. package/dist/_chunks/PkStreamingMarkdown-Br7Z60Vm.js.map +0 -1
  96. package/dist-vue/_chunks/Agent-DcoF75y8.js.map +0 -1
  97. package/dist-vue/_chunks/createChatbotApiClient-qHjpFqPL.js.map +0 -1
  98. package/dist-vue/_chunks/useChatbotStore-CnCoo6j3.js.map +0 -1
  99. package/dist-vue/_chunks/utils-BCGK2AFl.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { C as e, D as t, O as n, S as r, _ as i, a, g as o, h as s, i as c, l, m as u, o as d, p as f, r as p, s as m, u as h, v as g, w as _, x as v } from "./schemas-Bu1lick6.js";
2
- import { F as y, G as b, J as ee, K as te, U as ne, V as re, q as ie, z as ae } from "./Agent-DcoF75y8.js";
3
- import { r as oe, t as se } from "./createChatbotApiClient-qHjpFqPL.js";
2
+ import { F as y, G as b, J as ee, K as te, U as ne, V as re, q as ie, z as ae } from "./Agent-CeteYjj7.js";
3
+ import { r as oe, t as se } from "./createChatbotApiClient-Qwv4G6rH.js";
4
4
  import { n as ce } from "./src-BZRiAJsH.js";
5
5
  import { d as le, r as ue } from "./message-DZvfzt9j.js";
6
6
  import { n as de, t as fe } from "./useSafeLocalStorage-C1BlCeKw.js";
@@ -184,18 +184,18 @@ var ze = "AI_InvalidArgumentError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.fo
184
184
  static isInstance(e) {
185
185
  return T.hasMarker(e, Be);
186
186
  }
187
- }, k = "AI_JSONParseError", Ue = `vercel.ai.error.${k}`, We = Symbol.for(Ue), Ge = class extends T {
187
+ }, Ue = "AI_JSONParseError", We = `vercel.ai.error.${Ue}`, Ge = Symbol.for(We), Ke = class extends T {
188
188
  constructor({ text: e, cause: t }) {
189
189
  super({
190
- name: k,
190
+ name: Ue,
191
191
  message: `JSON parsing failed: Text: ${e}.\nError message: ${Re(t)}`,
192
192
  cause: t
193
- }), this[We] = !0, this.text = e;
193
+ }), this[Ge] = !0, this.text = e;
194
194
  }
195
195
  static isInstance(e) {
196
- return T.hasMarker(e, Ue);
196
+ return T.hasMarker(e, We);
197
197
  }
198
- }, A = "AI_TypeValidationError", Ke = `vercel.ai.error.${A}`, qe = Symbol.for(Ke), Je = class e extends T {
198
+ }, k = "AI_TypeValidationError", qe = `vercel.ai.error.${k}`, Je = Symbol.for(qe), Ye = class e extends T {
199
199
  constructor({ value: e, cause: t, context: n }) {
200
200
  let r = "Type validation failed";
201
201
  if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
@@ -204,13 +204,13 @@ var ze = "AI_InvalidArgumentError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.fo
204
204
  n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
205
205
  }
206
206
  super({
207
- name: A,
207
+ name: k,
208
208
  message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${Re(t)}`,
209
209
  cause: t
210
- }), this[qe] = !0, this.value = e, this.context = n;
210
+ }), this[Je] = !0, this.value = e, this.context = n;
211
211
  }
212
212
  static isInstance(e) {
213
- return T.hasMarker(e, Ke);
213
+ return T.hasMarker(e, qe);
214
214
  }
215
215
  static wrap({ value: t, cause: n, context: r }) {
216
216
  return e.isInstance(n) && n.value === t && n.context?.field === r?.field && n.context?.entityName === r?.entityName && n.context?.entityId === r?.entityId ? n : new e({
@@ -219,25 +219,25 @@ var ze = "AI_InvalidArgumentError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.fo
219
219
  context: r
220
220
  });
221
221
  }
222
- }, j = "AI_UnsupportedFunctionalityError", Ye = `vercel.ai.error.${j}`, Xe = Symbol.for(Ye), Ze = class extends T {
222
+ }, A = "AI_UnsupportedFunctionalityError", Xe = `vercel.ai.error.${A}`, Ze = Symbol.for(Xe), Qe = class extends T {
223
223
  constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
224
224
  super({
225
- name: j,
225
+ name: A,
226
226
  message: t
227
- }), this[Xe] = !0, this.functionality = e;
227
+ }), this[Ze] = !0, this.functionality = e;
228
228
  }
229
229
  static isInstance(e) {
230
- return T.hasMarker(e, Ye);
230
+ return T.hasMarker(e, Xe);
231
231
  }
232
- }, Qe = class extends Error {
232
+ }, $e = class extends Error {
233
233
  constructor(e, t) {
234
234
  super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
235
235
  }
236
- }, M = 10, $e = 13, N = 32;
237
- function P(e) {}
238
- function et(e) {
236
+ }, j = 10, et = 13, M = 32;
237
+ function N(e) {}
238
+ function tt(e) {
239
239
  if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
240
- let { onEvent: t = P, onError: n = P, onRetry: r = P, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
240
+ let { onEvent: t = N, onError: n = N, onRetry: r = N, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
241
241
  function m(e) {
242
242
  if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
243
243
  if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
@@ -256,7 +256,7 @@ function et(e) {
256
256
  n !== "" && (o.push(n), s = n.length), h();
257
257
  }
258
258
  function h() {
259
- a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new Qe(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
259
+ a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new $e(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
260
260
  }
261
261
  function g(e) {
262
262
  let n = 0;
@@ -272,9 +272,9 @@ function et(e) {
272
272
  continue;
273
273
  }
274
274
  let i = e.charCodeAt(n);
275
- if (tt(e, n, i)) {
276
- let i = e.charCodeAt(n + 5) === N ? n + 6 : n + 5, a = e.slice(i, r);
277
- if (d === 0 && e.charCodeAt(r + 1) === M) {
275
+ if (P(e, n, i)) {
276
+ let i = e.charCodeAt(n + 5) === M ? n + 6 : n + 5, a = e.slice(i, r);
277
+ if (d === 0 && e.charCodeAt(r + 1) === j) {
278
278
  t({
279
279
  id: l,
280
280
  event: f,
@@ -284,7 +284,7 @@ function et(e) {
284
284
  }
285
285
  u = d === 0 ? a : `${u}
286
286
  ${a}`, d++;
287
- } else nt(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === N ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
287
+ } else nt(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === M ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
288
288
  n = r + 1, r = e.indexOf("\n", n);
289
289
  }
290
290
  return e.slice(n);
@@ -292,7 +292,7 @@ ${a}`, d++;
292
292
  for (; n < e.length;) {
293
293
  let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
294
294
  if (t !== -1 && r !== -1 ? i = t < r ? t : r : t === -1 ? r !== -1 && (i = r) : i = t === e.length - 1 ? -1 : t, i === -1) break;
295
- _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === $e && e.charCodeAt(n) === M && n++;
295
+ _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === et && e.charCodeAt(n) === j && n++;
296
296
  }
297
297
  return e.slice(n);
298
298
  }
@@ -302,25 +302,25 @@ ${a}`, d++;
302
302
  return;
303
303
  }
304
304
  let r = e.charCodeAt(t);
305
- if (tt(e, t, r)) {
306
- let r = e.charCodeAt(t + 5) === N ? t + 6 : t + 5, i = e.slice(r, n);
305
+ if (P(e, t, r)) {
306
+ let r = e.charCodeAt(t + 5) === M ? t + 6 : t + 5, i = e.slice(r, n);
307
307
  u = d === 0 ? i : `${u}
308
308
  ${i}`, d++;
309
309
  return;
310
310
  }
311
311
  if (nt(e, t, r)) {
312
- f = e.slice(e.charCodeAt(t + 6) === N ? t + 7 : t + 6, n) || void 0;
312
+ f = e.slice(e.charCodeAt(t + 6) === M ? t + 7 : t + 6, n) || void 0;
313
313
  return;
314
314
  }
315
315
  if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
316
- let r = e.slice(e.charCodeAt(t + 3) === N ? t + 4 : t + 3, n);
316
+ let r = e.slice(e.charCodeAt(t + 3) === M ? t + 4 : t + 3, n);
317
317
  l = r.includes("\0") ? void 0 : r;
318
318
  return;
319
319
  }
320
320
  if (r === 58) {
321
321
  if (i) {
322
322
  let r = e.slice(t, n);
323
- i(r.slice(e.charCodeAt(t + 1) === N ? 2 : 1));
323
+ i(r.slice(e.charCodeAt(t + 1) === M ? 2 : 1));
324
324
  }
325
325
  return;
326
326
  }
@@ -329,7 +329,7 @@ ${i}`, d++;
329
329
  v(a, "", a);
330
330
  return;
331
331
  }
332
- let s = a.slice(0, o), c = a.charCodeAt(o + 1) === N ? 2 : 1;
332
+ let s = a.slice(0, o), c = a.charCodeAt(o + 1) === M ? 2 : 1;
333
333
  v(s, a.slice(o + c), a);
334
334
  }
335
335
  function v(e, t, i) {
@@ -345,13 +345,13 @@ ${t}`, d++;
345
345
  l = t.includes("\0") ? void 0 : t;
346
346
  break;
347
347
  case "retry":
348
- /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new Qe(`Invalid \`retry\` value: "${t}"`, {
348
+ /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new $e(`Invalid \`retry\` value: "${t}"`, {
349
349
  type: "invalid-retry",
350
350
  value: t,
351
351
  line: i
352
352
  }));
353
353
  break;
354
- default: n(new Qe(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
354
+ default: n(new $e(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
355
355
  type: "unknown-field",
356
356
  field: e,
357
357
  value: t,
@@ -378,7 +378,7 @@ ${t}`, d++;
378
378
  reset: b
379
379
  };
380
380
  }
381
- function tt(e, t, n) {
381
+ function P(e, t, n) {
382
382
  return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
383
383
  }
384
384
  function nt(e, t, n) {
@@ -391,7 +391,7 @@ var rt = class extends TransformStream {
391
391
  let i;
392
392
  super({
393
393
  start(a) {
394
- i = et({
394
+ i = tt({
395
395
  onEvent: (e) => {
396
396
  a.enqueue(e);
397
397
  },
@@ -439,10 +439,10 @@ var I = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRS
439
439
  function R(e) {
440
440
  return globalThis.Buffer?.isBuffer(e) ?? !1;
441
441
  }
442
- var ot = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, st = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
443
- function z(e) {
442
+ var ot = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, z = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
443
+ function st(e) {
444
444
  let t = JSON.parse(e);
445
- return typeof t != "object" || !t || ot.test(e) === !1 && st.test(e) === !1 ? t : ct(t);
445
+ return typeof t != "object" || !t || ot.test(e) === !1 && z.test(e) === !1 ? t : ct(t);
446
446
  }
447
447
  function ct(e) {
448
448
  let t = [e];
@@ -459,35 +459,35 @@ function ct(e) {
459
459
  }
460
460
  return e;
461
461
  }
462
- function lt(e) {
462
+ function B(e) {
463
463
  let { stackTraceLimit: t } = Error;
464
464
  try {
465
465
  Error.stackTraceLimit = 0;
466
466
  } catch {
467
- return z(e);
467
+ return st(e);
468
468
  }
469
469
  try {
470
- return z(e);
470
+ return st(e);
471
471
  } finally {
472
472
  Error.stackTraceLimit = t;
473
473
  }
474
474
  }
475
- function ut(e) {
475
+ function V(e) {
476
476
  if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
477
477
  let { additionalProperties: t } = e;
478
- e.additionalProperties = t != null && typeof t != "boolean" && B(t);
478
+ e.additionalProperties = t != null && typeof t != "boolean" && H(t);
479
479
  let { properties: n } = e;
480
- if (n != null) for (let e of Object.keys(n)) n[e] = B(n[e]);
480
+ if (n != null) for (let e of Object.keys(n)) n[e] = H(n[e]);
481
481
  }
482
- e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(B) : B(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(B)), e.allOf != null && (e.allOf = e.allOf.map(B)), e.oneOf != null && (e.oneOf = e.oneOf.map(B));
482
+ e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(H) : H(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(H)), e.allOf != null && (e.allOf = e.allOf.map(H)), e.oneOf != null && (e.oneOf = e.oneOf.map(H));
483
483
  let { definitions: t } = e;
484
- if (t != null) for (let e of Object.keys(t)) t[e] = B(t[e]);
484
+ if (t != null) for (let e of Object.keys(t)) t[e] = H(t[e]);
485
485
  return e;
486
486
  }
487
- function B(e) {
488
- return typeof e == "boolean" ? e : ut(e);
487
+ function H(e) {
488
+ return typeof e == "boolean" ? e : V(e);
489
489
  }
490
- var dt = Symbol("Let zodToJsonSchema decide on which parser to use"), ft = {
490
+ var lt = Symbol("Let zodToJsonSchema decide on which parser to use"), ut = {
491
491
  name: void 0,
492
492
  $refStrategy: "root",
493
493
  basePath: ["#"],
@@ -507,24 +507,24 @@ var dt = Symbol("Let zodToJsonSchema decide on which parser to use"), ft = {
507
507
  emailStrategy: "format:email",
508
508
  base64Strategy: "contentEncoding:base64",
509
509
  nameStrategy: "ref"
510
- }, pt = (e) => typeof e == "string" ? {
511
- ...ft,
510
+ }, dt = (e) => typeof e == "string" ? {
511
+ ...ut,
512
512
  name: e
513
513
  } : {
514
- ...ft,
514
+ ...ut,
515
515
  ...e
516
516
  };
517
- function V() {
517
+ function U() {
518
518
  return {};
519
519
  }
520
- function H(e, t) {
520
+ function ft(e, t) {
521
521
  let n = { type: "array" };
522
- return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = q(e.type._def, {
522
+ return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = Y(e.type._def, {
523
523
  ...t,
524
524
  currentPath: [...t.currentPath, "items"]
525
525
  })), e.minLength && (n.minItems = e.minLength.value), e.maxLength && (n.maxItems = e.maxLength.value), e.exactLength && (n.minItems = e.exactLength.value, n.maxItems = e.exactLength.value), n;
526
526
  }
527
- function U(e) {
527
+ function pt(e) {
528
528
  let t = {
529
529
  type: "integer",
530
530
  format: "int64"
@@ -541,16 +541,16 @@ function U(e) {
541
541
  }
542
542
  return t;
543
543
  }
544
- function mt() {
544
+ function W() {
545
545
  return { type: "boolean" };
546
546
  }
547
- function ht(e, t) {
548
- return q(e.type._def, t);
547
+ function G(e, t) {
548
+ return Y(e.type._def, t);
549
549
  }
550
- var gt = (e, t) => q(e.innerType._def, t);
551
- function _t(e, t, n) {
550
+ var mt = (e, t) => Y(e.innerType._def, t);
551
+ function ht(e, t, n) {
552
552
  let r = n ?? t.dateStrategy;
553
- if (Array.isArray(r)) return { anyOf: r.map((n) => _t(e, t, n)) };
553
+ if (Array.isArray(r)) return { anyOf: r.map((n) => ht(e, t, n)) };
554
554
  switch (r) {
555
555
  case "string":
556
556
  case "format:date-time": return {
@@ -561,10 +561,10 @@ function _t(e, t, n) {
561
561
  type: "string",
562
562
  format: "date"
563
563
  };
564
- case "integer": return vt(e);
564
+ case "integer": return gt(e);
565
565
  }
566
566
  }
567
- var vt = (e) => {
567
+ var gt = (e) => {
568
568
  let t = {
569
569
  type: "integer",
570
570
  format: "unix-time"
@@ -577,31 +577,31 @@ var vt = (e) => {
577
577
  }
578
578
  return t;
579
579
  };
580
- function yt(e, t) {
580
+ function _t(e, t) {
581
581
  return {
582
- ...q(e.innerType._def, t),
582
+ ...Y(e.innerType._def, t),
583
583
  default: e.defaultValue()
584
584
  };
585
585
  }
586
- function bt(e, t) {
587
- return t.effectStrategy === "input" ? q(e.schema._def, t) : V();
586
+ function vt(e, t) {
587
+ return t.effectStrategy === "input" ? Y(e.schema._def, t) : U();
588
588
  }
589
- function xt(e) {
589
+ function yt(e) {
590
590
  return {
591
591
  type: "string",
592
592
  enum: Array.from(e.values)
593
593
  };
594
594
  }
595
- var St = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
596
- function Ct(e, t) {
597
- let n = [q(e.left._def, {
595
+ var bt = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
596
+ function xt(e, t) {
597
+ let n = [Y(e.left._def, {
598
598
  ...t,
599
599
  currentPath: [
600
600
  ...t.currentPath,
601
601
  "allOf",
602
602
  "0"
603
603
  ]
604
- }), q(e.right._def, {
604
+ }), Y(e.right._def, {
605
605
  ...t,
606
606
  currentPath: [
607
607
  ...t.currentPath,
@@ -610,7 +610,7 @@ function Ct(e, t) {
610
610
  ]
611
611
  })].filter((e) => !!e), r = [];
612
612
  return n.forEach((e) => {
613
- if (St(e)) r.push(...e.allOf);
613
+ if (bt(e)) r.push(...e.allOf);
614
614
  else {
615
615
  let t = e;
616
616
  if ("additionalProperties" in e && e.additionalProperties === !1) {
@@ -621,19 +621,19 @@ function Ct(e, t) {
621
621
  }
622
622
  }), r.length ? { allOf: r } : void 0;
623
623
  }
624
- function wt(e) {
624
+ function St(e) {
625
625
  let t = typeof e.value;
626
626
  return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
627
627
  type: t === "bigint" ? "integer" : t,
628
628
  const: e.value
629
629
  };
630
630
  }
631
- var Tt = void 0, W = {
631
+ var Ct = void 0, K = {
632
632
  cuid: /^[cC][^\s-]{8,}$/,
633
633
  cuid2: /^[0-9a-z]+$/,
634
634
  ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
635
635
  email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
636
- emoji: () => (Tt === void 0 && (Tt = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), Tt),
636
+ emoji: () => (Ct === void 0 && (Ct = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), Ct),
637
637
  uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
638
638
  ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
639
639
  ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
@@ -644,7 +644,7 @@ var Tt = void 0, W = {
644
644
  nanoid: /^[a-zA-Z0-9_-]{21}$/,
645
645
  jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
646
646
  };
647
- function Et(e, t) {
647
+ function wt(e, t) {
648
648
  let n = { type: "string" };
649
649
  if (e.checks) for (let r of e.checks) switch (r.kind) {
650
650
  case "min":
@@ -656,108 +656,108 @@ function Et(e, t) {
656
656
  case "email":
657
657
  switch (t.emailStrategy) {
658
658
  case "format:email":
659
- G(n, "email", r.message, t);
659
+ q(n, "email", r.message, t);
660
660
  break;
661
661
  case "format:idn-email":
662
- G(n, "idn-email", r.message, t);
662
+ q(n, "idn-email", r.message, t);
663
663
  break;
664
- case "pattern:zod": K(n, W.email, r.message, t);
664
+ case "pattern:zod": J(n, K.email, r.message, t);
665
665
  }
666
666
  break;
667
667
  case "url":
668
- G(n, "uri", r.message, t);
668
+ q(n, "uri", r.message, t);
669
669
  break;
670
670
  case "uuid":
671
- G(n, "uuid", r.message, t);
671
+ q(n, "uuid", r.message, t);
672
672
  break;
673
673
  case "regex":
674
- K(n, r.regex, r.message, t);
674
+ J(n, r.regex, r.message, t);
675
675
  break;
676
676
  case "cuid":
677
- K(n, W.cuid, r.message, t);
677
+ J(n, K.cuid, r.message, t);
678
678
  break;
679
679
  case "cuid2":
680
- K(n, W.cuid2, r.message, t);
680
+ J(n, K.cuid2, r.message, t);
681
681
  break;
682
682
  case "startsWith":
683
- K(n, RegExp(`^${Dt(r.value, t)}`), r.message, t);
683
+ J(n, RegExp(`^${Tt(r.value, t)}`), r.message, t);
684
684
  break;
685
685
  case "endsWith":
686
- K(n, RegExp(`${Dt(r.value, t)}$`), r.message, t);
686
+ J(n, RegExp(`${Tt(r.value, t)}$`), r.message, t);
687
687
  break;
688
688
  case "datetime":
689
- G(n, "date-time", r.message, t);
689
+ q(n, "date-time", r.message, t);
690
690
  break;
691
691
  case "date":
692
- G(n, "date", r.message, t);
692
+ q(n, "date", r.message, t);
693
693
  break;
694
694
  case "time":
695
- G(n, "time", r.message, t);
695
+ q(n, "time", r.message, t);
696
696
  break;
697
697
  case "duration":
698
- G(n, "duration", r.message, t);
698
+ q(n, "duration", r.message, t);
699
699
  break;
700
700
  case "length":
701
701
  n.minLength = typeof n.minLength == "number" ? Math.max(n.minLength, r.value) : r.value, n.maxLength = typeof n.maxLength == "number" ? Math.min(n.maxLength, r.value) : r.value;
702
702
  break;
703
703
  case "includes":
704
- K(n, RegExp(Dt(r.value, t)), r.message, t);
704
+ J(n, RegExp(Tt(r.value, t)), r.message, t);
705
705
  break;
706
706
  case "ip":
707
- r.version !== "v6" && G(n, "ipv4", r.message, t), r.version !== "v4" && G(n, "ipv6", r.message, t);
707
+ r.version !== "v6" && q(n, "ipv4", r.message, t), r.version !== "v4" && q(n, "ipv6", r.message, t);
708
708
  break;
709
709
  case "base64url":
710
- K(n, W.base64url, r.message, t);
710
+ J(n, K.base64url, r.message, t);
711
711
  break;
712
712
  case "jwt":
713
- K(n, W.jwt, r.message, t);
713
+ J(n, K.jwt, r.message, t);
714
714
  break;
715
715
  case "cidr":
716
- r.version !== "v6" && K(n, W.ipv4Cidr, r.message, t), r.version !== "v4" && K(n, W.ipv6Cidr, r.message, t);
716
+ r.version !== "v6" && J(n, K.ipv4Cidr, r.message, t), r.version !== "v4" && J(n, K.ipv6Cidr, r.message, t);
717
717
  break;
718
718
  case "emoji":
719
- K(n, W.emoji(), r.message, t);
719
+ J(n, K.emoji(), r.message, t);
720
720
  break;
721
721
  case "ulid":
722
- K(n, W.ulid, r.message, t);
722
+ J(n, K.ulid, r.message, t);
723
723
  break;
724
724
  case "base64":
725
725
  switch (t.base64Strategy) {
726
726
  case "format:binary":
727
- G(n, "binary", r.message, t);
727
+ q(n, "binary", r.message, t);
728
728
  break;
729
729
  case "contentEncoding:base64":
730
730
  n.contentEncoding = "base64";
731
731
  break;
732
- case "pattern:zod": K(n, W.base64, r.message, t);
732
+ case "pattern:zod": J(n, K.base64, r.message, t);
733
733
  }
734
734
  break;
735
- case "nanoid": K(n, W.nanoid, r.message, t);
735
+ case "nanoid": J(n, K.nanoid, r.message, t);
736
736
  }
737
737
  return n;
738
738
  }
739
- function Dt(e, t) {
740
- return t.patternStrategy === "escape" ? kt(e) : e;
739
+ function Tt(e, t) {
740
+ return t.patternStrategy === "escape" ? Dt(e) : e;
741
741
  }
742
- var Ot = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
743
- function kt(e) {
742
+ var Et = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
743
+ function Dt(e) {
744
744
  let t = "";
745
- for (let n = 0; n < e.length; n++) Ot.has(e[n]) || (t += "\\"), t += e[n];
745
+ for (let n = 0; n < e.length; n++) Et.has(e[n]) || (t += "\\"), t += e[n];
746
746
  return t;
747
747
  }
748
- function G(e, t, n, r) {
748
+ function q(e, t, n, r) {
749
749
  e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
750
750
  format: t,
751
751
  ...n && r.errorMessages && { errorMessage: { format: n } }
752
752
  })) : e.format = t;
753
753
  }
754
- function K(e, t, n, r) {
754
+ function J(e, t, n, r) {
755
755
  e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
756
- pattern: At(t, r),
756
+ pattern: Ot(t, r),
757
757
  ...n && r.errorMessages && { errorMessage: { pattern: n } }
758
- })) : e.pattern = At(t, r);
758
+ })) : e.pattern = Ot(t, r);
759
759
  }
760
- function At(e, t) {
760
+ function Ot(e, t) {
761
761
  if (!t.applyRegexFlags || !e.flags) return e.source;
762
762
  let n = {
763
763
  i: e.flags.includes("i"),
@@ -796,16 +796,16 @@ function At(e, t) {
796
796
  }
797
797
  return i;
798
798
  }
799
- function jt(e, t) {
799
+ function kt(e, t) {
800
800
  let n = {
801
801
  type: "object",
802
- additionalProperties: q(e.valueType._def, {
802
+ additionalProperties: Y(e.valueType._def, {
803
803
  ...t,
804
804
  currentPath: [...t.currentPath, "additionalProperties"]
805
805
  }) ?? t.allowedAdditionalProperties
806
806
  };
807
807
  if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
808
- let { type: r, ...i } = Et(e.keyType._def, t);
808
+ let { type: r, ...i } = wt(e.keyType._def, t);
809
809
  return {
810
810
  ...n,
811
811
  propertyNames: i
@@ -816,7 +816,7 @@ function jt(e, t) {
816
816
  propertyNames: { enum: e.keyType._def.values }
817
817
  };
818
818
  if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
819
- let { type: r, ...i } = ht(e.keyType._def, t);
819
+ let { type: r, ...i } = G(e.keyType._def, t);
820
820
  return {
821
821
  ...n,
822
822
  propertyNames: i
@@ -824,13 +824,13 @@ function jt(e, t) {
824
824
  }
825
825
  return n;
826
826
  }
827
- function Mt(e, t) {
828
- return t.mapStrategy === "record" ? jt(e, t) : {
827
+ function At(e, t) {
828
+ return t.mapStrategy === "record" ? kt(e, t) : {
829
829
  type: "array",
830
830
  maxItems: 125,
831
831
  items: {
832
832
  type: "array",
833
- items: [q(e.keyType._def, {
833
+ items: [Y(e.keyType._def, {
834
834
  ...t,
835
835
  currentPath: [
836
836
  ...t.currentPath,
@@ -838,7 +838,7 @@ function Mt(e, t) {
838
838
  "items",
839
839
  "0"
840
840
  ]
841
- }) || V(), q(e.valueType._def, {
841
+ }) || U(), Y(e.valueType._def, {
842
842
  ...t,
843
843
  currentPath: [
844
844
  ...t.currentPath,
@@ -846,37 +846,37 @@ function Mt(e, t) {
846
846
  "items",
847
847
  "1"
848
848
  ]
849
- }) || V()],
849
+ }) || U()],
850
850
  minItems: 2,
851
851
  maxItems: 2
852
852
  }
853
853
  };
854
854
  }
855
- function Nt(e) {
855
+ function jt(e) {
856
856
  let t = e.values, n = Object.keys(e.values).filter((e) => typeof t[t[e]] != "number").map((e) => t[e]), r = Array.from(new Set(n.map((e) => typeof e)));
857
857
  return {
858
858
  type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
859
859
  enum: n
860
860
  };
861
861
  }
862
- function Pt() {
863
- return { not: V() };
862
+ function Mt() {
863
+ return { not: U() };
864
864
  }
865
- function Ft() {
865
+ function Nt() {
866
866
  return { type: "null" };
867
867
  }
868
- var It = {
868
+ var Pt = {
869
869
  ZodString: "string",
870
870
  ZodNumber: "number",
871
871
  ZodBigInt: "integer",
872
872
  ZodBoolean: "boolean",
873
873
  ZodNull: "null"
874
874
  };
875
- function Lt(e, t) {
875
+ function Ft(e, t) {
876
876
  let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
877
- if (n.every((e) => e._def.typeName in It && (!e._def.checks || !e._def.checks.length))) {
877
+ if (n.every((e) => e._def.typeName in Pt && (!e._def.checks || !e._def.checks.length))) {
878
878
  let e = n.reduce((e, t) => {
879
- let n = It[t._def.typeName];
879
+ let n = Pt[t._def.typeName];
880
880
  return n && !e.includes(n) ? [...e, n] : e;
881
881
  }, []);
882
882
  return { type: e.length > 1 ? e : e[0] };
@@ -904,10 +904,10 @@ function Lt(e, t) {
904
904
  type: "string",
905
905
  enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
906
906
  };
907
- return Rt(e, t);
907
+ return It(e, t);
908
908
  }
909
- var Rt = (e, t) => {
910
- let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => q(e._def, {
909
+ var It = (e, t) => {
910
+ let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => Y(e._def, {
911
911
  ...t,
912
912
  currentPath: [
913
913
  ...t.currentPath,
@@ -917,15 +917,15 @@ var Rt = (e, t) => {
917
917
  })).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
918
918
  return n.length ? { anyOf: n } : void 0;
919
919
  };
920
- function zt(e, t) {
920
+ function Lt(e, t) {
921
921
  if ([
922
922
  "ZodString",
923
923
  "ZodNumber",
924
924
  "ZodBigInt",
925
925
  "ZodBoolean",
926
926
  "ZodNull"
927
- ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [It[e.innerType._def.typeName], "null"] };
928
- let n = q(e.innerType._def, {
927
+ ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Pt[e.innerType._def.typeName], "null"] };
928
+ let n = Y(e.innerType._def, {
929
929
  ...t,
930
930
  currentPath: [
931
931
  ...t.currentPath,
@@ -935,7 +935,7 @@ function zt(e, t) {
935
935
  });
936
936
  return n && { anyOf: [n, { type: "null" }] };
937
937
  }
938
- function Bt(e) {
938
+ function Rt(e) {
939
939
  let t = { type: "number" };
940
940
  if (!e.checks) return t;
941
941
  for (let n of e.checks) switch (n.kind) {
@@ -952,7 +952,7 @@ function Bt(e) {
952
952
  }
953
953
  return t;
954
954
  }
955
- function Vt(e, t) {
955
+ function zt(e, t) {
956
956
  let n = {
957
957
  type: "object",
958
958
  properties: {}
@@ -960,7 +960,7 @@ function Vt(e, t) {
960
960
  for (let e in i) {
961
961
  let a = i[e];
962
962
  if (a === void 0 || a._def === void 0) continue;
963
- let o = Ut(a), s = q(a._def, {
963
+ let o = Vt(a), s = Y(a._def, {
964
964
  ...t,
965
965
  currentPath: [
966
966
  ...t.currentPath,
@@ -976,11 +976,11 @@ function Vt(e, t) {
976
976
  s !== void 0 && (n.properties[e] = s, o || r.push(e));
977
977
  }
978
978
  r.length && (n.required = r);
979
- let a = Ht(e, t);
979
+ let a = Bt(e, t);
980
980
  return a !== void 0 && (n.additionalProperties = a), n;
981
981
  }
982
- function Ht(e, t) {
983
- if (e.catchall._def.typeName !== "ZodNever") return q(e.catchall._def, {
982
+ function Bt(e, t) {
983
+ if (e.catchall._def.typeName !== "ZodNever") return Y(e.catchall._def, {
984
984
  ...t,
985
985
  currentPath: [...t.currentPath, "additionalProperties"]
986
986
  });
@@ -990,16 +990,16 @@ function Ht(e, t) {
990
990
  case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
991
991
  }
992
992
  }
993
- function Ut(e) {
993
+ function Vt(e) {
994
994
  try {
995
995
  return e.isOptional();
996
996
  } catch {
997
997
  return !0;
998
998
  }
999
999
  }
1000
- var Wt = (e, t) => {
1001
- if (t.currentPath.toString() === t.propertyPath?.toString()) return q(e.innerType._def, t);
1002
- let n = q(e.innerType._def, {
1000
+ var Ht = (e, t) => {
1001
+ if (t.currentPath.toString() === t.propertyPath?.toString()) return Y(e.innerType._def, t);
1002
+ let n = Y(e.innerType._def, {
1003
1003
  ...t,
1004
1004
  currentPath: [
1005
1005
  ...t.currentPath,
@@ -1007,11 +1007,11 @@ var Wt = (e, t) => {
1007
1007
  "1"
1008
1008
  ]
1009
1009
  });
1010
- return n ? { anyOf: [{ not: V() }, n] } : V();
1011
- }, Gt = (e, t) => {
1012
- if (t.pipeStrategy === "input") return q(e.in._def, t);
1013
- if (t.pipeStrategy === "output") return q(e.out._def, t);
1014
- let n = q(e.in._def, {
1010
+ return n ? { anyOf: [{ not: U() }, n] } : U();
1011
+ }, Ut = (e, t) => {
1012
+ if (t.pipeStrategy === "input") return Y(e.in._def, t);
1013
+ if (t.pipeStrategy === "output") return Y(e.out._def, t);
1014
+ let n = Y(e.in._def, {
1015
1015
  ...t,
1016
1016
  currentPath: [
1017
1017
  ...t.currentPath,
@@ -1019,7 +1019,7 @@ var Wt = (e, t) => {
1019
1019
  "0"
1020
1020
  ]
1021
1021
  });
1022
- return { allOf: [n, q(e.out._def, {
1022
+ return { allOf: [n, Y(e.out._def, {
1023
1023
  ...t,
1024
1024
  currentPath: [
1025
1025
  ...t.currentPath,
@@ -1028,25 +1028,25 @@ var Wt = (e, t) => {
1028
1028
  ]
1029
1029
  })].filter((e) => e !== void 0) };
1030
1030
  };
1031
- function Kt(e, t) {
1032
- return q(e.type._def, t);
1031
+ function Wt(e, t) {
1032
+ return Y(e.type._def, t);
1033
1033
  }
1034
- function qt(e, t) {
1034
+ function Gt(e, t) {
1035
1035
  let n = {
1036
1036
  type: "array",
1037
1037
  uniqueItems: !0,
1038
- items: q(e.valueType._def, {
1038
+ items: Y(e.valueType._def, {
1039
1039
  ...t,
1040
1040
  currentPath: [...t.currentPath, "items"]
1041
1041
  })
1042
1042
  };
1043
1043
  return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
1044
1044
  }
1045
- function Jt(e, t) {
1045
+ function Kt(e, t) {
1046
1046
  return e.rest ? {
1047
1047
  type: "array",
1048
1048
  minItems: e.items.length,
1049
- items: e.items.map((e, n) => q(e._def, {
1049
+ items: e.items.map((e, n) => Y(e._def, {
1050
1050
  ...t,
1051
1051
  currentPath: [
1052
1052
  ...t.currentPath,
@@ -1054,7 +1054,7 @@ function Jt(e, t) {
1054
1054
  `${n}`
1055
1055
  ]
1056
1056
  })).reduce((e, t) => t === void 0 ? e : [...e, t], []),
1057
- additionalItems: q(e.rest._def, {
1057
+ additionalItems: Y(e.rest._def, {
1058
1058
  ...t,
1059
1059
  currentPath: [...t.currentPath, "additionalItems"]
1060
1060
  })
@@ -1062,7 +1062,7 @@ function Jt(e, t) {
1062
1062
  type: "array",
1063
1063
  minItems: e.items.length,
1064
1064
  maxItems: e.items.length,
1065
- items: e.items.map((e, n) => q(e._def, {
1065
+ items: e.items.map((e, n) => Y(e._def, {
1066
1066
  ...t,
1067
1067
  currentPath: [
1068
1068
  ...t.currentPath,
@@ -1072,47 +1072,47 @@ function Jt(e, t) {
1072
1072
  })).reduce((e, t) => t === void 0 ? e : [...e, t], [])
1073
1073
  };
1074
1074
  }
1075
- function Yt() {
1076
- return { not: V() };
1075
+ function qt() {
1076
+ return { not: U() };
1077
1077
  }
1078
- function Xt() {
1079
- return V();
1078
+ function Jt() {
1079
+ return U();
1080
1080
  }
1081
- var Zt = (e, t) => q(e.innerType._def, t), Qt = (e, t, n) => {
1081
+ var Yt = (e, t) => Y(e.innerType._def, t), Xt = (e, t, n) => {
1082
1082
  switch (t) {
1083
- case "ZodString": return Et(e, n);
1084
- case "ZodNumber": return Bt(e);
1085
- case "ZodObject": return Vt(e, n);
1086
- case "ZodBigInt": return U(e);
1087
- case "ZodBoolean": return mt();
1088
- case "ZodDate": return _t(e, n);
1089
- case "ZodUndefined": return Yt();
1090
- case "ZodNull": return Ft();
1091
- case "ZodArray": return H(e, n);
1083
+ case "ZodString": return wt(e, n);
1084
+ case "ZodNumber": return Rt(e);
1085
+ case "ZodObject": return zt(e, n);
1086
+ case "ZodBigInt": return pt(e);
1087
+ case "ZodBoolean": return W();
1088
+ case "ZodDate": return ht(e, n);
1089
+ case "ZodUndefined": return qt();
1090
+ case "ZodNull": return Nt();
1091
+ case "ZodArray": return ft(e, n);
1092
1092
  case "ZodUnion":
1093
- case "ZodDiscriminatedUnion": return Lt(e, n);
1094
- case "ZodIntersection": return Ct(e, n);
1095
- case "ZodTuple": return Jt(e, n);
1096
- case "ZodRecord": return jt(e, n);
1097
- case "ZodLiteral": return wt(e);
1098
- case "ZodEnum": return xt(e);
1099
- case "ZodNativeEnum": return Nt(e);
1100
- case "ZodNullable": return zt(e, n);
1101
- case "ZodOptional": return Wt(e, n);
1102
- case "ZodMap": return Mt(e, n);
1103
- case "ZodSet": return qt(e, n);
1093
+ case "ZodDiscriminatedUnion": return Ft(e, n);
1094
+ case "ZodIntersection": return xt(e, n);
1095
+ case "ZodTuple": return Kt(e, n);
1096
+ case "ZodRecord": return kt(e, n);
1097
+ case "ZodLiteral": return St(e);
1098
+ case "ZodEnum": return yt(e);
1099
+ case "ZodNativeEnum": return jt(e);
1100
+ case "ZodNullable": return Lt(e, n);
1101
+ case "ZodOptional": return Ht(e, n);
1102
+ case "ZodMap": return At(e, n);
1103
+ case "ZodSet": return Gt(e, n);
1104
1104
  case "ZodLazy": return () => e.getter()._def;
1105
- case "ZodPromise": return Kt(e, n);
1105
+ case "ZodPromise": return Wt(e, n);
1106
1106
  case "ZodNaN":
1107
- case "ZodNever": return Pt();
1108
- case "ZodEffects": return bt(e, n);
1109
- case "ZodAny": return V();
1110
- case "ZodUnknown": return Xt();
1111
- case "ZodDefault": return yt(e, n);
1112
- case "ZodBranded": return ht(e, n);
1113
- case "ZodReadonly": return Zt(e, n);
1114
- case "ZodCatch": return gt(e, n);
1115
- case "ZodPipeline": return Gt(e, n);
1107
+ case "ZodNever": return Mt();
1108
+ case "ZodEffects": return vt(e, n);
1109
+ case "ZodAny": return U();
1110
+ case "ZodUnknown": return Jt();
1111
+ case "ZodDefault": return _t(e, n);
1112
+ case "ZodBranded": return G(e, n);
1113
+ case "ZodReadonly": return Yt(e, n);
1114
+ case "ZodCatch": return mt(e, n);
1115
+ case "ZodPipeline": return Ut(e, n);
1116
1116
  case "ZodFunction":
1117
1117
  case "ZodVoid":
1118
1118
  case "ZodSymbol": return;
@@ -1120,19 +1120,19 @@ var Zt = (e, t) => q(e.innerType._def, t), Qt = (e, t, n) => {
1120
1120
  /* c8 ignore next */
1121
1121
  return ((e) => void 0)(t);
1122
1122
  }
1123
- }, $t = (e, t) => {
1123
+ }, Zt = (e, t) => {
1124
1124
  let n = 0;
1125
1125
  for (; n < e.length && n < t.length && e[n] === t[n]; n++);
1126
1126
  return [(e.length - n).toString(), ...t.slice(n)].join("/");
1127
1127
  };
1128
- function q(e, t, n = !1) {
1128
+ function Y(e, t, n = !1) {
1129
1129
  let r = t.seen.get(e);
1130
1130
  if (t.override) {
1131
1131
  let i = t.override?.(e, t, r, n);
1132
- if (i !== dt) return i;
1132
+ if (i !== lt) return i;
1133
1133
  }
1134
1134
  if (r && !n) {
1135
- let e = en(r, t);
1135
+ let e = Qt(r, t);
1136
1136
  if (e !== void 0) return e;
1137
1137
  }
1138
1138
  let i = {
@@ -1141,22 +1141,22 @@ function q(e, t, n = !1) {
1141
1141
  jsonSchema: void 0
1142
1142
  };
1143
1143
  t.seen.set(e, i);
1144
- let a = Qt(e, e.typeName, t), o = typeof a == "function" ? q(a(), t) : a;
1145
- if (o && tn(e, t, o), t.postProcess) {
1144
+ let a = Xt(e, e.typeName, t), o = typeof a == "function" ? Y(a(), t) : a;
1145
+ if (o && $t(e, t, o), t.postProcess) {
1146
1146
  let n = t.postProcess(o, e, t);
1147
1147
  return i.jsonSchema = o, n;
1148
1148
  }
1149
1149
  return i.jsonSchema = o, o;
1150
1150
  }
1151
- var en = (e, t) => {
1151
+ var Qt = (e, t) => {
1152
1152
  switch (t.$refStrategy) {
1153
1153
  case "root": return { $ref: e.path.join("/") };
1154
- case "relative": return { $ref: $t(t.currentPath, e.path) };
1154
+ case "relative": return { $ref: Zt(t.currentPath, e.path) };
1155
1155
  case "none":
1156
- case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), V()) : t.$refStrategy === "seen" ? V() : void 0;
1156
+ case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), U()) : t.$refStrategy === "seen" ? U() : void 0;
1157
1157
  }
1158
- }, tn = (e, t, n) => (e.description && (n.description = e.description), n), nn = (e) => {
1159
- let t = pt(e), n = t.name === void 0 ? t.basePath : [
1158
+ }, $t = (e, t, n) => (e.description && (n.description = e.description), n), en = (e) => {
1159
+ let t = dt(e), n = t.name === void 0 ? t.basePath : [
1160
1160
  ...t.basePath,
1161
1161
  t.definitionPath,
1162
1162
  t.name
@@ -1175,25 +1175,25 @@ var en = (e, t) => {
1175
1175
  jsonSchema: void 0
1176
1176
  }]))
1177
1177
  };
1178
- }, rn = (e, t) => {
1179
- let n = nn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1178
+ }, tn = (e, t) => {
1179
+ let n = en(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1180
1180
  ...e,
1181
- [t]: q(r._def, {
1181
+ [t]: Y(r._def, {
1182
1182
  ...n,
1183
1183
  currentPath: [
1184
1184
  ...n.basePath,
1185
1185
  n.definitionPath,
1186
1186
  t
1187
1187
  ]
1188
- }, !0) ?? V()
1189
- }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = q(e._def, i === void 0 ? n : {
1188
+ }, !0) ?? U()
1189
+ }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = Y(e._def, i === void 0 ? n : {
1190
1190
  ...n,
1191
1191
  currentPath: [
1192
1192
  ...n.basePath,
1193
1193
  n.definitionPath,
1194
1194
  i
1195
1195
  ]
1196
- }, !1) ?? V(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1196
+ }, !1) ?? U(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1197
1197
  o !== void 0 && (a.title = o);
1198
1198
  let s = i === void 0 ? r ? {
1199
1199
  ...a,
@@ -1210,14 +1210,14 @@ var en = (e, t) => {
1210
1210
  }
1211
1211
  };
1212
1212
  return s.$schema = "http://json-schema.org/draft-07/schema#", s;
1213
- }, an = Symbol.for("vercel.ai.schema");
1214
- function on(e) {
1213
+ }, nn = Symbol.for("vercel.ai.schema");
1214
+ function rn(e) {
1215
1215
  let t;
1216
1216
  return () => (t ??= e(), t);
1217
1217
  }
1218
- function sn(e, { validate: t } = {}) {
1218
+ function an(e, { validate: t } = {}) {
1219
1219
  return {
1220
- [an]: !0,
1220
+ [nn]: !0,
1221
1221
  _type: void 0,
1222
1222
  get jsonSchema() {
1223
1223
  return typeof e == "function" && (e = e()), e;
@@ -1225,20 +1225,20 @@ function sn(e, { validate: t } = {}) {
1225
1225
  validate: t
1226
1226
  };
1227
1227
  }
1228
- function cn(e) {
1229
- return typeof e == "object" && !!e && an in e && e[an] === !0 && "jsonSchema" in e && "validate" in e;
1228
+ function on(e) {
1229
+ return typeof e == "object" && !!e && nn in e && e[nn] === !0 && "jsonSchema" in e && "validate" in e;
1230
1230
  }
1231
- function ln(e) {
1232
- return e == null ? sn({
1231
+ function sn(e) {
1232
+ return e == null ? an({
1233
1233
  type: "object",
1234
1234
  properties: {},
1235
1235
  additionalProperties: !1
1236
- }) : cn(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? hn(e) : un(e) : e();
1236
+ }) : on(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? pn(e) : cn(e) : e();
1237
1237
  }
1238
- function un(e) {
1239
- return sn(() => {
1240
- if (!dn(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1241
- return ut(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1238
+ function cn(e) {
1239
+ return an(() => {
1240
+ if (!ln(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1241
+ return V(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1242
1242
  }, { validate: async (t) => {
1243
1243
  let n = await e["~standard"].validate(t);
1244
1244
  return "value" in n ? {
@@ -1246,19 +1246,19 @@ function un(e) {
1246
1246
  value: n.value
1247
1247
  } : {
1248
1248
  success: !1,
1249
- error: new Je({
1249
+ error: new Ye({
1250
1250
  value: t,
1251
1251
  cause: n.issues
1252
1252
  })
1253
1253
  };
1254
1254
  } });
1255
1255
  }
1256
- function dn(e) {
1256
+ function ln(e) {
1257
1257
  return e["~standard"].jsonSchema != null;
1258
1258
  }
1259
- function fn(e, t) {
1259
+ function un(e, t) {
1260
1260
  let n = t?.useReferences ?? !1;
1261
- return sn(() => rn(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
1261
+ return an(() => tn(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
1262
1262
  let n = await e.safeParseAsync(t);
1263
1263
  return n.success ? {
1264
1264
  success: !0,
@@ -1269,9 +1269,9 @@ function fn(e, t) {
1269
1269
  };
1270
1270
  } });
1271
1271
  }
1272
- function pn(e, r) {
1272
+ function dn(e, r) {
1273
1273
  let i = r?.useReferences ?? !1;
1274
- return sn(() => ut(n(e, {
1274
+ return an(() => V(n(e, {
1275
1275
  target: "draft-7",
1276
1276
  io: "input",
1277
1277
  reused: i ? "ref" : "inline"
@@ -1286,27 +1286,27 @@ function pn(e, r) {
1286
1286
  };
1287
1287
  } });
1288
1288
  }
1289
- function mn(e) {
1289
+ function fn(e) {
1290
1290
  return "_zod" in e;
1291
1291
  }
1292
- function hn(e, t) {
1293
- return mn(e) ? pn(e, t) : fn(e, t);
1292
+ function pn(e, t) {
1293
+ return fn(e) ? dn(e, t) : un(e, t);
1294
1294
  }
1295
- async function gn({ value: e, schema: t, context: n }) {
1296
- let r = await _n({
1295
+ async function mn({ value: e, schema: t, context: n }) {
1296
+ let r = await hn({
1297
1297
  value: e,
1298
1298
  schema: t,
1299
1299
  context: n
1300
1300
  });
1301
- if (!r.success) throw Je.wrap({
1301
+ if (!r.success) throw Ye.wrap({
1302
1302
  value: e,
1303
1303
  cause: r.error,
1304
1304
  context: n
1305
1305
  });
1306
1306
  return r.value;
1307
1307
  }
1308
- async function _n({ value: e, schema: t, context: n }) {
1309
- let r = ln(t);
1308
+ async function hn({ value: e, schema: t, context: n }) {
1309
+ let r = sn(t);
1310
1310
  try {
1311
1311
  if (r.validate == null) return {
1312
1312
  success: !0,
@@ -1320,7 +1320,7 @@ async function _n({ value: e, schema: t, context: n }) {
1320
1320
  rawValue: e
1321
1321
  } : {
1322
1322
  success: !1,
1323
- error: Je.wrap({
1323
+ error: Ye.wrap({
1324
1324
  value: e,
1325
1325
  cause: t.error,
1326
1326
  context: n
@@ -1330,7 +1330,7 @@ async function _n({ value: e, schema: t, context: n }) {
1330
1330
  } catch (t) {
1331
1331
  return {
1332
1332
  success: !1,
1333
- error: Je.wrap({
1333
+ error: Ye.wrap({
1334
1334
  value: e,
1335
1335
  cause: t,
1336
1336
  context: n
@@ -1339,21 +1339,21 @@ async function _n({ value: e, schema: t, context: n }) {
1339
1339
  };
1340
1340
  }
1341
1341
  }
1342
- async function vn({ text: e, schema: t }) {
1342
+ async function gn({ text: e, schema: t }) {
1343
1343
  try {
1344
- let n = lt(e);
1344
+ let n = B(e);
1345
1345
  return t == null ? {
1346
1346
  success: !0,
1347
1347
  value: n,
1348
1348
  rawValue: n
1349
- } : await _n({
1349
+ } : await hn({
1350
1350
  value: n,
1351
1351
  schema: t
1352
1352
  });
1353
1353
  } catch (t) {
1354
1354
  return {
1355
1355
  success: !1,
1356
- error: Ge.isInstance(t) ? t : new Ge({
1356
+ error: Ke.isInstance(t) ? t : new Ke({
1357
1357
  text: e,
1358
1358
  cause: t
1359
1359
  }),
@@ -1361,42 +1361,42 @@ async function vn({ text: e, schema: t }) {
1361
1361
  };
1362
1362
  }
1363
1363
  }
1364
- function yn({ stream: e, schema: t }) {
1364
+ function _n({ stream: e, schema: t }) {
1365
1365
  return e.pipeThrough(new TextDecoderStream()).pipeThrough(new rt()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1366
- e !== "[DONE]" && n.enqueue(await vn({
1366
+ e !== "[DONE]" && n.enqueue(await gn({
1367
1367
  text: e,
1368
1368
  schema: t
1369
1369
  }));
1370
1370
  } }));
1371
1371
  }
1372
- async function bn(e) {
1372
+ async function vn(e) {
1373
1373
  return typeof e == "function" && (e = e()), e;
1374
1374
  }
1375
1375
  new TextDecoder();
1376
1376
  //#endregion
1377
1377
  //#region ../../node_modules/.pnpm/ai@7.0.140_zod@4.6.7/node_modules/ai/dist/index.js
1378
- var xn = "AI_InvalidArgumentError", Sn = `vercel.ai.error.${xn}`, Cn = Symbol.for(Sn), wn = class extends T {
1378
+ var yn = "AI_InvalidArgumentError", bn = `vercel.ai.error.${yn}`, xn = Symbol.for(bn), Sn = class extends T {
1379
1379
  constructor({ parameter: e, value: t, message: n }) {
1380
1380
  super({
1381
- name: xn,
1381
+ name: yn,
1382
1382
  message: `Invalid argument for parameter ${e}: ${n}`
1383
- }), this[Cn] = !0, this.parameter = e, this.value = t;
1383
+ }), this[xn] = !0, this.parameter = e, this.value = t;
1384
1384
  }
1385
1385
  static isInstance(e) {
1386
- return T.hasMarker(e, Sn);
1386
+ return T.hasMarker(e, bn);
1387
1387
  }
1388
- }, Tn = "AI_UIMessageStreamError", En = `vercel.ai.error.${Tn}`, Dn = Symbol.for(En), J = class extends T {
1388
+ }, Cn = "AI_UIMessageStreamError", wn = `vercel.ai.error.${Cn}`, Tn = Symbol.for(wn), En = class extends T {
1389
1389
  constructor({ chunkType: e, chunkId: t, message: n }) {
1390
1390
  super({
1391
- name: Tn,
1391
+ name: Cn,
1392
1392
  message: n
1393
- }), this[Dn] = !0, this.chunkType = e, this.chunkId = t;
1393
+ }), this[Tn] = !0, this.chunkType = e, this.chunkId = t;
1394
1394
  }
1395
1395
  static isInstance(e) {
1396
- return T.hasMarker(e, En);
1396
+ return T.hasMarker(e, wn);
1397
1397
  }
1398
1398
  };
1399
- function On(e, t) {
1399
+ function Dn(e, t) {
1400
1400
  if (e === void 0 && t === void 0) return;
1401
1401
  if (e === void 0) return t;
1402
1402
  if (t === void 0) return e;
@@ -1405,11 +1405,11 @@ function On(e, t) {
1405
1405
  let i = t[r];
1406
1406
  if (i === void 0) continue;
1407
1407
  let a = r in e ? e[r] : void 0, o = typeof i == "object" && !!i && !Array.isArray(i) && !(i instanceof Date) && !(i instanceof RegExp), s = typeof a == "object" && !!a && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof RegExp);
1408
- n[r] = o && s ? On(a, i) : i;
1408
+ n[r] = o && s ? Dn(a, i) : i;
1409
1409
  }
1410
1410
  return n;
1411
1411
  }
1412
- var Y = {
1412
+ var X = {
1413
1413
  array: d,
1414
1414
  boolean: m,
1415
1415
  custom: l,
@@ -1427,214 +1427,214 @@ var Y = {
1427
1427
  string: r,
1428
1428
  union: e,
1429
1429
  unknown: _
1430
- }, X = Y.lazy(() => Y.union([
1431
- Y.null(),
1432
- Y.string(),
1433
- Y.number(),
1434
- Y.boolean(),
1435
- Y.record(Y.string(), X.optional()),
1436
- Y.array(X)
1437
- ])), Z = Y.record(Y.string(), Y.record(Y.string(), X.optional())), kn = Y.union([
1438
- Y.string(),
1439
- Y.instanceof(Uint8Array),
1440
- Y.instanceof(ArrayBuffer),
1441
- Y.custom(R, { message: "Must be a Buffer" })
1442
- ]), An = Y.record(Y.string(), Y.string()), jn = Y.object({
1443
- type: Y.literal("text"),
1444
- text: Y.string(),
1430
+ }, On = X.lazy(() => X.union([
1431
+ X.null(),
1432
+ X.string(),
1433
+ X.number(),
1434
+ X.boolean(),
1435
+ X.record(X.string(), On.optional()),
1436
+ X.array(On)
1437
+ ])), Z = X.record(X.string(), X.record(X.string(), On.optional())), kn = X.union([
1438
+ X.string(),
1439
+ X.instanceof(Uint8Array),
1440
+ X.instanceof(ArrayBuffer),
1441
+ X.custom(R, { message: "Must be a Buffer" })
1442
+ ]), An = X.record(X.string(), X.string()), jn = X.object({
1443
+ type: X.literal("text"),
1444
+ text: X.string(),
1445
1445
  providerOptions: Z.optional()
1446
- }), Mn = Y.object({
1447
- type: Y.literal("image"),
1448
- image: Y.union([
1446
+ }), Mn = X.object({
1447
+ type: X.literal("image"),
1448
+ image: X.union([
1449
1449
  kn,
1450
- Y.instanceof(URL),
1450
+ X.instanceof(URL),
1451
1451
  An
1452
1452
  ]),
1453
- mediaType: Y.string().optional(),
1453
+ mediaType: X.string().optional(),
1454
1454
  providerOptions: Z.optional()
1455
- }), Nn = Y.discriminatedUnion("type", [
1456
- Y.object({
1457
- type: Y.literal("data"),
1455
+ }), Nn = X.discriminatedUnion("type", [
1456
+ X.object({
1457
+ type: X.literal("data"),
1458
1458
  data: kn
1459
1459
  }),
1460
- Y.object({
1461
- type: Y.literal("url"),
1462
- url: Y.instanceof(URL)
1460
+ X.object({
1461
+ type: X.literal("url"),
1462
+ url: X.instanceof(URL)
1463
1463
  }),
1464
- Y.object({
1465
- type: Y.literal("reference"),
1464
+ X.object({
1465
+ type: X.literal("reference"),
1466
1466
  reference: An
1467
1467
  }),
1468
- Y.object({
1469
- type: Y.literal("text"),
1470
- text: Y.string()
1468
+ X.object({
1469
+ type: X.literal("text"),
1470
+ text: X.string()
1471
1471
  })
1472
- ]), Pn = Y.discriminatedUnion("type", [Y.object({
1473
- type: Y.literal("data"),
1472
+ ]), Pn = X.discriminatedUnion("type", [X.object({
1473
+ type: X.literal("data"),
1474
1474
  data: kn
1475
- }), Y.object({
1476
- type: Y.literal("url"),
1477
- url: Y.instanceof(URL)
1478
- })]), Fn = Y.object({
1479
- type: Y.literal("file"),
1480
- data: Y.union([
1475
+ }), X.object({
1476
+ type: X.literal("url"),
1477
+ url: X.instanceof(URL)
1478
+ })]), Fn = X.object({
1479
+ type: X.literal("file"),
1480
+ data: X.union([
1481
1481
  Nn,
1482
1482
  kn,
1483
- Y.instanceof(URL),
1483
+ X.instanceof(URL),
1484
1484
  An
1485
1485
  ]),
1486
- filename: Y.string().optional(),
1487
- mediaType: Y.string(),
1486
+ filename: X.string().optional(),
1487
+ mediaType: X.string(),
1488
1488
  providerOptions: Z.optional()
1489
- }), In = Y.object({
1490
- type: Y.literal("reasoning"),
1491
- text: Y.string(),
1489
+ }), In = X.object({
1490
+ type: X.literal("reasoning"),
1491
+ text: X.string(),
1492
1492
  providerOptions: Z.optional()
1493
- }), Ln = Y.object({
1494
- type: Y.literal("custom"),
1495
- kind: Y.string().transform((e) => e),
1493
+ }), Ln = X.object({
1494
+ type: X.literal("custom"),
1495
+ kind: X.string().transform((e) => e),
1496
1496
  providerOptions: Z.optional()
1497
- }), Rn = Y.object({
1498
- type: Y.literal("reasoning-file"),
1499
- data: Y.union([
1497
+ }), Rn = X.object({
1498
+ type: X.literal("reasoning-file"),
1499
+ data: X.union([
1500
1500
  Pn,
1501
1501
  kn,
1502
- Y.instanceof(URL)
1502
+ X.instanceof(URL)
1503
1503
  ]),
1504
- mediaType: Y.string(),
1504
+ mediaType: X.string(),
1505
1505
  providerOptions: Z.optional()
1506
- }), zn = Y.object({
1507
- type: Y.literal("tool-call"),
1508
- toolCallId: Y.string(),
1509
- toolName: Y.string(),
1510
- input: Y.unknown(),
1506
+ }), zn = X.object({
1507
+ type: X.literal("tool-call"),
1508
+ toolCallId: X.string(),
1509
+ toolName: X.string(),
1510
+ input: X.unknown(),
1511
1511
  providerOptions: Z.optional(),
1512
- providerExecuted: Y.boolean().optional()
1513
- }), Bn = Y.discriminatedUnion("type", [
1514
- Y.object({
1515
- type: Y.literal("text"),
1516
- value: Y.string(),
1512
+ providerExecuted: X.boolean().optional()
1513
+ }), Bn = X.discriminatedUnion("type", [
1514
+ X.object({
1515
+ type: X.literal("text"),
1516
+ value: X.string(),
1517
1517
  providerOptions: Z.optional()
1518
1518
  }),
1519
- Y.object({
1520
- type: Y.literal("json"),
1521
- value: X,
1519
+ X.object({
1520
+ type: X.literal("json"),
1521
+ value: On,
1522
1522
  providerOptions: Z.optional()
1523
1523
  }),
1524
- Y.object({
1525
- type: Y.literal("execution-denied"),
1526
- reason: Y.string().optional(),
1524
+ X.object({
1525
+ type: X.literal("execution-denied"),
1526
+ reason: X.string().optional(),
1527
1527
  providerOptions: Z.optional()
1528
1528
  }),
1529
- Y.object({
1530
- type: Y.literal("error-text"),
1531
- value: Y.string(),
1529
+ X.object({
1530
+ type: X.literal("error-text"),
1531
+ value: X.string(),
1532
1532
  providerOptions: Z.optional()
1533
1533
  }),
1534
- Y.object({
1535
- type: Y.literal("error-json"),
1536
- value: X,
1534
+ X.object({
1535
+ type: X.literal("error-json"),
1536
+ value: On,
1537
1537
  providerOptions: Z.optional()
1538
1538
  }),
1539
- Y.object({
1540
- type: Y.literal("content"),
1541
- value: Y.array(Y.union([
1542
- Y.object({
1543
- type: Y.literal("text"),
1544
- text: Y.string(),
1539
+ X.object({
1540
+ type: X.literal("content"),
1541
+ value: X.array(X.union([
1542
+ X.object({
1543
+ type: X.literal("text"),
1544
+ text: X.string(),
1545
1545
  providerOptions: Z.optional()
1546
1546
  }),
1547
- Y.object({
1548
- type: Y.literal("file"),
1547
+ X.object({
1548
+ type: X.literal("file"),
1549
1549
  data: Nn,
1550
- mediaType: Y.string(),
1551
- filename: Y.string().optional(),
1550
+ mediaType: X.string(),
1551
+ filename: X.string().optional(),
1552
1552
  providerOptions: Z.optional()
1553
1553
  }),
1554
- Y.object({
1555
- type: Y.literal("file-data"),
1556
- data: Y.string(),
1557
- mediaType: Y.string(),
1558
- filename: Y.string().optional(),
1554
+ X.object({
1555
+ type: X.literal("file-data"),
1556
+ data: X.string(),
1557
+ mediaType: X.string(),
1558
+ filename: X.string().optional(),
1559
1559
  providerOptions: Z.optional()
1560
1560
  }),
1561
- Y.object({
1562
- type: Y.literal("file-url"),
1563
- url: Y.string(),
1564
- mediaType: Y.string().optional(),
1561
+ X.object({
1562
+ type: X.literal("file-url"),
1563
+ url: X.string(),
1564
+ mediaType: X.string().optional(),
1565
1565
  providerOptions: Z.optional()
1566
1566
  }),
1567
- Y.object({
1568
- type: Y.literal("file-id"),
1569
- fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1567
+ X.object({
1568
+ type: X.literal("file-id"),
1569
+ fileId: X.union([X.string(), X.record(X.string(), X.string())]),
1570
1570
  providerOptions: Z.optional()
1571
1571
  }),
1572
- Y.object({
1573
- type: Y.literal("file-reference"),
1574
- providerReference: Y.record(Y.string(), Y.string()),
1572
+ X.object({
1573
+ type: X.literal("file-reference"),
1574
+ providerReference: X.record(X.string(), X.string()),
1575
1575
  providerOptions: Z.optional()
1576
1576
  }),
1577
- Y.object({
1578
- type: Y.literal("image-data"),
1579
- data: Y.string(),
1580
- mediaType: Y.string(),
1577
+ X.object({
1578
+ type: X.literal("image-data"),
1579
+ data: X.string(),
1580
+ mediaType: X.string(),
1581
1581
  providerOptions: Z.optional()
1582
1582
  }),
1583
- Y.object({
1584
- type: Y.literal("image-url"),
1585
- url: Y.string(),
1583
+ X.object({
1584
+ type: X.literal("image-url"),
1585
+ url: X.string(),
1586
1586
  providerOptions: Z.optional()
1587
1587
  }),
1588
- Y.object({
1589
- type: Y.literal("image-file-id"),
1590
- fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1588
+ X.object({
1589
+ type: X.literal("image-file-id"),
1590
+ fileId: X.union([X.string(), X.record(X.string(), X.string())]),
1591
1591
  providerOptions: Z.optional()
1592
1592
  }),
1593
- Y.object({
1594
- type: Y.literal("image-file-reference"),
1595
- providerReference: Y.record(Y.string(), Y.string()),
1593
+ X.object({
1594
+ type: X.literal("image-file-reference"),
1595
+ providerReference: X.record(X.string(), X.string()),
1596
1596
  providerOptions: Z.optional()
1597
1597
  }),
1598
- Y.object({
1599
- type: Y.literal("custom"),
1598
+ X.object({
1599
+ type: X.literal("custom"),
1600
1600
  providerOptions: Z.optional()
1601
1601
  })
1602
1602
  ]))
1603
1603
  })
1604
- ]), Vn = Y.object({
1605
- type: Y.literal("tool-result"),
1606
- toolCallId: Y.string(),
1607
- toolName: Y.string(),
1604
+ ]), Vn = X.object({
1605
+ type: X.literal("tool-result"),
1606
+ toolCallId: X.string(),
1607
+ toolName: X.string(),
1608
1608
  output: Bn,
1609
1609
  providerOptions: Z.optional()
1610
- }), Hn = Y.object({
1611
- type: Y.literal("tool-approval-request"),
1612
- approvalId: Y.string(),
1613
- toolCallId: Y.string(),
1614
- reason: Y.string().optional(),
1615
- isAutomatic: Y.boolean().optional(),
1616
- signature: Y.string().optional(),
1617
- inputSchemaInput: Y.unknown().optional()
1618
- }), Un = Y.object({
1619
- type: Y.literal("tool-approval-response"),
1620
- approvalId: Y.string(),
1621
- approved: Y.boolean(),
1622
- reason: Y.string().optional()
1623
- }), Wn = Y.object({
1624
- role: Y.literal("system"),
1625
- content: Y.string(),
1610
+ }), Hn = X.object({
1611
+ type: X.literal("tool-approval-request"),
1612
+ approvalId: X.string(),
1613
+ toolCallId: X.string(),
1614
+ reason: X.string().optional(),
1615
+ isAutomatic: X.boolean().optional(),
1616
+ signature: X.string().optional(),
1617
+ inputSchemaInput: X.unknown().optional()
1618
+ }), Un = X.object({
1619
+ type: X.literal("tool-approval-response"),
1620
+ approvalId: X.string(),
1621
+ approved: X.boolean(),
1622
+ reason: X.string().optional()
1623
+ }), Wn = X.object({
1624
+ role: X.literal("system"),
1625
+ content: X.string(),
1626
1626
  providerOptions: Z.optional()
1627
- }), Gn = Y.object({
1628
- role: Y.literal("user"),
1629
- content: Y.union([Y.string(), Y.array(Y.union([
1627
+ }), Gn = X.object({
1628
+ role: X.literal("user"),
1629
+ content: X.union([X.string(), X.array(X.union([
1630
1630
  jn,
1631
1631
  Mn,
1632
1632
  Fn
1633
1633
  ]))]),
1634
1634
  providerOptions: Z.optional()
1635
- }), Kn = Y.object({
1636
- role: Y.literal("assistant"),
1637
- content: Y.union([Y.string(), Y.array(Y.union([
1635
+ }), Kn = X.object({
1636
+ role: X.literal("assistant"),
1637
+ content: X.union([X.string(), X.array(X.union([
1638
1638
  jn,
1639
1639
  Ln,
1640
1640
  Fn,
@@ -1645,12 +1645,12 @@ var Y = {
1645
1645
  Hn
1646
1646
  ]))]),
1647
1647
  providerOptions: Z.optional()
1648
- }), qn = Y.object({
1649
- role: Y.literal("tool"),
1650
- content: Y.array(Y.union([Vn, Un])),
1648
+ }), qn = X.object({
1649
+ role: X.literal("tool"),
1650
+ content: X.array(X.union([Vn, Un])),
1651
1651
  providerOptions: Z.optional()
1652
1652
  });
1653
- Y.union([
1653
+ X.union([
1654
1654
  Wn,
1655
1655
  Gn,
1656
1656
  Kn,
@@ -1843,11 +1843,11 @@ async function Yn(e) {
1843
1843
  value: void 0,
1844
1844
  state: "undefined-input"
1845
1845
  };
1846
- let t = await vn({ text: e });
1846
+ let t = await gn({ text: e });
1847
1847
  return t.success ? {
1848
1848
  value: t.value,
1849
1849
  state: "successful-parse"
1850
- } : (t = await vn({ text: Jn(e) }), t.success ? {
1850
+ } : (t = await gn({ text: Jn(e) }), t.success ? {
1851
1851
  value: t.value,
1852
1852
  state: "repaired-parse"
1853
1853
  } : {
@@ -1862,192 +1862,192 @@ new TextEncoder(), new TextEncoder(), I({
1862
1862
  prefix: "call",
1863
1863
  size: 24
1864
1864
  }), TransformStream;
1865
- var Xn = Y.object({
1866
- source: Y.discriminatedUnion("sourceType", [Y.object({
1867
- type: Y.literal("source"),
1868
- sourceType: Y.literal("url"),
1869
- id: Y.string(),
1870
- url: Y.string(),
1871
- title: Y.string().optional(),
1865
+ var Xn = X.object({
1866
+ source: X.discriminatedUnion("sourceType", [X.object({
1867
+ type: X.literal("source"),
1868
+ sourceType: X.literal("url"),
1869
+ id: X.string(),
1870
+ url: X.string(),
1871
+ title: X.string().optional(),
1872
1872
  providerMetadata: Z.optional()
1873
- }), Y.object({
1874
- type: Y.literal("source"),
1875
- sourceType: Y.literal("document"),
1876
- id: Y.string(),
1877
- mediaType: Y.string(),
1878
- title: Y.string(),
1879
- filename: Y.string().optional(),
1873
+ }), X.object({
1874
+ type: X.literal("source"),
1875
+ sourceType: X.literal("document"),
1876
+ id: X.string(),
1877
+ mediaType: X.string(),
1878
+ title: X.string(),
1879
+ filename: X.string().optional(),
1880
1880
  providerMetadata: Z.optional()
1881
1881
  })]),
1882
- startIndex: Y.number().int().nonnegative().optional(),
1883
- endIndex: Y.number().int().nonnegative().optional(),
1884
- citedText: Y.string().optional()
1885
- }), Zn = Y.record(Y.string(), X.optional()), Qn = on(() => hn(Y.union([
1886
- Y.looseObject({
1887
- type: Y.literal("text-start"),
1888
- id: Y.string(),
1882
+ startIndex: X.number().int().nonnegative().optional(),
1883
+ endIndex: X.number().int().nonnegative().optional(),
1884
+ citedText: X.string().optional()
1885
+ }), Zn = X.record(X.string(), On.optional()), Qn = rn(() => pn(X.union([
1886
+ X.looseObject({
1887
+ type: X.literal("text-start"),
1888
+ id: X.string(),
1889
1889
  providerMetadata: Z.optional()
1890
1890
  }),
1891
- Y.looseObject({
1892
- type: Y.literal("text-delta"),
1893
- id: Y.string(),
1894
- delta: Y.string(),
1891
+ X.looseObject({
1892
+ type: X.literal("text-delta"),
1893
+ id: X.string(),
1894
+ delta: X.string(),
1895
1895
  providerMetadata: Z.optional()
1896
1896
  }),
1897
- Y.looseObject({
1898
- type: Y.literal("text-end"),
1899
- id: Y.string(),
1900
- citations: Y.array(Xn).optional(),
1897
+ X.looseObject({
1898
+ type: X.literal("text-end"),
1899
+ id: X.string(),
1900
+ citations: X.array(Xn).optional(),
1901
1901
  providerMetadata: Z.optional()
1902
1902
  }),
1903
- Y.looseObject({
1904
- type: Y.literal("error"),
1905
- errorText: Y.string()
1903
+ X.looseObject({
1904
+ type: X.literal("error"),
1905
+ errorText: X.string()
1906
1906
  }),
1907
- Y.looseObject({
1908
- type: Y.literal("tool-input-start"),
1909
- toolCallId: Y.string(),
1910
- toolName: Y.string(),
1911
- providerExecuted: Y.boolean().optional(),
1907
+ X.looseObject({
1908
+ type: X.literal("tool-input-start"),
1909
+ toolCallId: X.string(),
1910
+ toolName: X.string(),
1911
+ providerExecuted: X.boolean().optional(),
1912
1912
  providerMetadata: Z.optional(),
1913
1913
  toolMetadata: Zn.optional(),
1914
- dynamic: Y.boolean().optional(),
1915
- title: Y.string().optional()
1914
+ dynamic: X.boolean().optional(),
1915
+ title: X.string().optional()
1916
1916
  }),
1917
- Y.looseObject({
1918
- type: Y.literal("tool-input-delta"),
1919
- toolCallId: Y.string(),
1920
- inputTextDelta: Y.string()
1917
+ X.looseObject({
1918
+ type: X.literal("tool-input-delta"),
1919
+ toolCallId: X.string(),
1920
+ inputTextDelta: X.string()
1921
1921
  }),
1922
- Y.looseObject({
1923
- type: Y.literal("tool-input-available"),
1924
- toolCallId: Y.string(),
1925
- toolName: Y.string(),
1926
- input: Y.unknown(),
1927
- providerExecuted: Y.boolean().optional(),
1922
+ X.looseObject({
1923
+ type: X.literal("tool-input-available"),
1924
+ toolCallId: X.string(),
1925
+ toolName: X.string(),
1926
+ input: X.unknown(),
1927
+ providerExecuted: X.boolean().optional(),
1928
1928
  providerMetadata: Z.optional(),
1929
1929
  toolMetadata: Zn.optional(),
1930
- dynamic: Y.boolean().optional(),
1931
- title: Y.string().optional()
1930
+ dynamic: X.boolean().optional(),
1931
+ title: X.string().optional()
1932
1932
  }),
1933
- Y.looseObject({
1934
- type: Y.literal("tool-input-error"),
1935
- toolCallId: Y.string(),
1936
- toolName: Y.string(),
1937
- input: Y.unknown(),
1938
- providerExecuted: Y.boolean().optional(),
1933
+ X.looseObject({
1934
+ type: X.literal("tool-input-error"),
1935
+ toolCallId: X.string(),
1936
+ toolName: X.string(),
1937
+ input: X.unknown(),
1938
+ providerExecuted: X.boolean().optional(),
1939
1939
  providerMetadata: Z.optional(),
1940
1940
  toolMetadata: Zn.optional(),
1941
- dynamic: Y.boolean().optional(),
1942
- errorText: Y.string(),
1943
- title: Y.string().optional()
1941
+ dynamic: X.boolean().optional(),
1942
+ errorText: X.string(),
1943
+ title: X.string().optional()
1944
1944
  }),
1945
- Y.looseObject({
1946
- type: Y.literal("tool-approval-request"),
1947
- approvalId: Y.string(),
1948
- toolCallId: Y.string(),
1949
- approvalDescriptor: Y.unknown().optional(),
1950
- inputSchemaInput: Y.unknown().optional(),
1951
- reason: Y.string().optional(),
1952
- isAutomatic: Y.boolean().optional(),
1953
- signature: Y.string().optional()
1945
+ X.looseObject({
1946
+ type: X.literal("tool-approval-request"),
1947
+ approvalId: X.string(),
1948
+ toolCallId: X.string(),
1949
+ approvalDescriptor: X.unknown().optional(),
1950
+ inputSchemaInput: X.unknown().optional(),
1951
+ reason: X.string().optional(),
1952
+ isAutomatic: X.boolean().optional(),
1953
+ signature: X.string().optional()
1954
1954
  }),
1955
- Y.looseObject({
1956
- type: Y.literal("tool-approval-response"),
1957
- approvalId: Y.string(),
1958
- approved: Y.boolean(),
1959
- reason: Y.string().optional(),
1960
- providerExecuted: Y.boolean().optional(),
1955
+ X.looseObject({
1956
+ type: X.literal("tool-approval-response"),
1957
+ approvalId: X.string(),
1958
+ approved: X.boolean(),
1959
+ reason: X.string().optional(),
1960
+ providerExecuted: X.boolean().optional(),
1961
1961
  providerMetadata: Z.optional()
1962
1962
  }),
1963
- Y.looseObject({
1964
- type: Y.literal("tool-output-available"),
1965
- toolCallId: Y.string(),
1966
- output: Y.unknown(),
1967
- providerExecuted: Y.boolean().optional(),
1963
+ X.looseObject({
1964
+ type: X.literal("tool-output-available"),
1965
+ toolCallId: X.string(),
1966
+ output: X.unknown(),
1967
+ providerExecuted: X.boolean().optional(),
1968
1968
  providerMetadata: Z.optional(),
1969
1969
  toolMetadata: Zn.optional(),
1970
- dynamic: Y.boolean().optional(),
1971
- preliminary: Y.boolean().optional()
1970
+ dynamic: X.boolean().optional(),
1971
+ preliminary: X.boolean().optional()
1972
1972
  }),
1973
- Y.looseObject({
1974
- type: Y.literal("tool-output-error"),
1975
- toolCallId: Y.string(),
1976
- errorText: Y.string(),
1977
- providerExecuted: Y.boolean().optional(),
1973
+ X.looseObject({
1974
+ type: X.literal("tool-output-error"),
1975
+ toolCallId: X.string(),
1976
+ errorText: X.string(),
1977
+ providerExecuted: X.boolean().optional(),
1978
1978
  providerMetadata: Z.optional(),
1979
1979
  toolMetadata: Zn.optional(),
1980
- dynamic: Y.boolean().optional()
1980
+ dynamic: X.boolean().optional()
1981
1981
  }),
1982
- Y.looseObject({
1983
- type: Y.literal("tool-output-denied"),
1984
- toolCallId: Y.string()
1982
+ X.looseObject({
1983
+ type: X.literal("tool-output-denied"),
1984
+ toolCallId: X.string()
1985
1985
  }),
1986
- Y.looseObject({
1987
- type: Y.literal("reasoning-start"),
1988
- id: Y.string(),
1986
+ X.looseObject({
1987
+ type: X.literal("reasoning-start"),
1988
+ id: X.string(),
1989
1989
  providerMetadata: Z.optional()
1990
1990
  }),
1991
- Y.looseObject({
1992
- type: Y.literal("reasoning-delta"),
1993
- id: Y.string(),
1994
- delta: Y.string(),
1991
+ X.looseObject({
1992
+ type: X.literal("reasoning-delta"),
1993
+ id: X.string(),
1994
+ delta: X.string(),
1995
1995
  providerMetadata: Z.optional()
1996
1996
  }),
1997
- Y.looseObject({
1998
- type: Y.literal("reasoning-end"),
1999
- id: Y.string(),
1997
+ X.looseObject({
1998
+ type: X.literal("reasoning-end"),
1999
+ id: X.string(),
2000
2000
  providerMetadata: Z.optional()
2001
2001
  }),
2002
- Y.looseObject({
2003
- type: Y.literal("custom"),
2004
- kind: Y.string().transform((e) => e),
2002
+ X.looseObject({
2003
+ type: X.literal("custom"),
2004
+ kind: X.string().transform((e) => e),
2005
2005
  providerMetadata: Z.optional()
2006
2006
  }),
2007
- Y.looseObject({
2008
- type: Y.literal("source-url"),
2009
- sourceId: Y.string(),
2010
- url: Y.string(),
2011
- title: Y.string().optional(),
2007
+ X.looseObject({
2008
+ type: X.literal("source-url"),
2009
+ sourceId: X.string(),
2010
+ url: X.string(),
2011
+ title: X.string().optional(),
2012
2012
  providerMetadata: Z.optional()
2013
2013
  }),
2014
- Y.looseObject({
2015
- type: Y.literal("source-document"),
2016
- sourceId: Y.string(),
2017
- mediaType: Y.string(),
2018
- title: Y.string(),
2019
- filename: Y.string().optional(),
2014
+ X.looseObject({
2015
+ type: X.literal("source-document"),
2016
+ sourceId: X.string(),
2017
+ mediaType: X.string(),
2018
+ title: X.string(),
2019
+ filename: X.string().optional(),
2020
2020
  providerMetadata: Z.optional()
2021
2021
  }),
2022
- Y.looseObject({
2023
- type: Y.literal("file"),
2024
- url: Y.string(),
2025
- mediaType: Y.string(),
2022
+ X.looseObject({
2023
+ type: X.literal("file"),
2024
+ url: X.string(),
2025
+ mediaType: X.string(),
2026
2026
  providerMetadata: Z.optional()
2027
2027
  }),
2028
- Y.looseObject({
2029
- type: Y.literal("reasoning-file"),
2030
- url: Y.string(),
2031
- mediaType: Y.string(),
2028
+ X.looseObject({
2029
+ type: X.literal("reasoning-file"),
2030
+ url: X.string(),
2031
+ mediaType: X.string(),
2032
2032
  providerMetadata: Z.optional()
2033
2033
  }),
2034
- Y.looseObject({
2035
- type: Y.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2036
- id: Y.string().optional(),
2037
- data: Y.unknown(),
2038
- transient: Y.boolean().optional()
2034
+ X.looseObject({
2035
+ type: X.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2036
+ id: X.string().optional(),
2037
+ data: X.unknown(),
2038
+ transient: X.boolean().optional()
2039
2039
  }),
2040
- Y.looseObject({ type: Y.literal("start-step") }),
2041
- Y.looseObject({ type: Y.literal("finish-step") }),
2042
- Y.looseObject({ type: Y.literal("reset-step") }),
2043
- Y.looseObject({
2044
- type: Y.literal("start"),
2045
- messageId: Y.string().optional(),
2046
- messageMetadata: Y.unknown().optional()
2040
+ X.looseObject({ type: X.literal("start-step") }),
2041
+ X.looseObject({ type: X.literal("finish-step") }),
2042
+ X.looseObject({ type: X.literal("reset-step") }),
2043
+ X.looseObject({
2044
+ type: X.literal("start"),
2045
+ messageId: X.string().optional(),
2046
+ messageMetadata: X.unknown().optional()
2047
2047
  }),
2048
- Y.looseObject({
2049
- type: Y.literal("finish"),
2050
- finishReason: Y.enum([
2048
+ X.looseObject({
2049
+ type: X.literal("finish"),
2050
+ finishReason: X.enum([
2051
2051
  "stop",
2052
2052
  "length",
2053
2053
  "content-filter",
@@ -2055,15 +2055,15 @@ var Xn = Y.object({
2055
2055
  "error",
2056
2056
  "other"
2057
2057
  ]).optional(),
2058
- messageMetadata: Y.unknown().optional()
2058
+ messageMetadata: X.unknown().optional()
2059
2059
  }),
2060
- Y.looseObject({
2061
- type: Y.literal("abort"),
2062
- reason: Y.string().optional()
2060
+ X.looseObject({
2061
+ type: X.literal("abort"),
2062
+ reason: X.string().optional()
2063
2063
  }),
2064
- Y.looseObject({
2065
- type: Y.literal("message-metadata"),
2066
- messageMetadata: Y.unknown()
2064
+ X.looseObject({
2065
+ type: X.literal("message-metadata"),
2066
+ messageMetadata: X.unknown()
2067
2067
  })
2068
2068
  ])));
2069
2069
  function $n(e) {
@@ -2134,7 +2134,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2134
2134
  }
2135
2135
  }
2136
2136
  }
2137
- if (t == null) throw new J({
2137
+ if (t == null) throw new En({
2138
2138
  chunkType: "tool-invocation",
2139
2139
  chunkId: e,
2140
2140
  message: `No tool invocation found for tool call ID "${e}".`
@@ -2143,7 +2143,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2143
2143
  }
2144
2144
  function h(e) {
2145
2145
  let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
2146
- if (t == null) throw new J({
2146
+ if (t == null) throw new En({
2147
2147
  chunkType: "tool-approval-response",
2148
2148
  chunkId: e,
2149
2149
  message: `No tool invocation found for approval ID "${e}".`
@@ -2206,8 +2206,8 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2206
2206
  }
2207
2207
  async function v(e) {
2208
2208
  if (e != null) {
2209
- let n = r.message.metadata == null ? e : On(r.message.metadata, e);
2210
- t != null && await gn({
2209
+ let n = r.message.metadata == null ? e : Dn(r.message.metadata, e);
2210
+ t != null && await mn({
2211
2211
  value: n,
2212
2212
  schema: t,
2213
2213
  context: {
@@ -2230,7 +2230,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2230
2230
  }
2231
2231
  case "text-delta": {
2232
2232
  let t = r.activeTextParts[e.id];
2233
- if (t == null) throw new J({
2233
+ if (t == null) throw new En({
2234
2234
  chunkType: "text-delta",
2235
2235
  chunkId: e.id,
2236
2236
  message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
@@ -2240,7 +2240,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2240
2240
  }
2241
2241
  case "text-end": {
2242
2242
  let t = r.activeTextParts[e.id];
2243
- if (t == null) throw new J({
2243
+ if (t == null) throw new En({
2244
2244
  chunkType: "text-end",
2245
2245
  chunkId: e.id,
2246
2246
  message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
@@ -2270,7 +2270,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2270
2270
  }
2271
2271
  case "reasoning-delta": {
2272
2272
  let t = r.activeReasoningParts[e.id];
2273
- if (t == null) throw new J({
2273
+ if (t == null) throw new En({
2274
2274
  chunkType: "reasoning-delta",
2275
2275
  chunkId: e.id,
2276
2276
  message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
@@ -2280,7 +2280,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2280
2280
  }
2281
2281
  case "reasoning-end": {
2282
2282
  let t = r.activeReasoningParts[e.id];
2283
- if (t == null) throw new J({
2283
+ if (t == null) throw new En({
2284
2284
  chunkType: "reasoning-end",
2285
2285
  chunkId: e.id,
2286
2286
  message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
@@ -2348,7 +2348,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2348
2348
  }
2349
2349
  case "tool-input-delta": {
2350
2350
  let t = r.partialToolCalls[e.toolCallId];
2351
- if (t == null) throw new J({
2351
+ if (t == null) throw new En({
2352
2352
  chunkType: "tool-input-delta",
2353
2353
  chunkId: e.toolCallId,
2354
2354
  message: `Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
@@ -2527,7 +2527,7 @@ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2527
2527
  default: if ($n(e)) {
2528
2528
  if (n?.[e.type] != null) {
2529
2529
  let t = r.message.parts.findIndex((t) => "id" in t && "data" in t && t.id === e.id && t.type === e.type), i = t >= 0 ? t : r.message.parts.length;
2530
- await gn({
2530
+ await mn({
2531
2531
  value: e.data,
2532
2532
  schema: n[e.type],
2533
2533
  context: {
@@ -2588,7 +2588,7 @@ I({
2588
2588
  }), I({
2589
2589
  prefix: "call",
2590
2590
  size: 24
2591
- }), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()), I({
2591
+ }), X.record(X.string(), On.optional()), X.record(X.string(), X.string()), I({
2592
2592
  prefix: "call",
2593
2593
  size: 24
2594
2594
  }), I({
@@ -2639,9 +2639,9 @@ I({
2639
2639
  }), I({
2640
2640
  prefix: "call",
2641
2641
  size: 24
2642
- }), Y.object({
2643
- token: Y.string().refine((e) => e.trim().length > 0),
2644
- url: Y.string().refine((e) => {
2642
+ }), X.object({
2643
+ token: X.string().refine((e) => e.trim().length > 0),
2644
+ url: X.string().refine((e) => {
2645
2645
  try {
2646
2646
  let t = new URL(e);
2647
2647
  return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
@@ -2649,12 +2649,12 @@ I({
2649
2649
  return !1;
2650
2650
  }
2651
2651
  }),
2652
- expiresAt: Y.number().positive().max(2 ** 53 - 1).optional(),
2653
- tools: Y.array(Y.object({
2654
- type: Y.literal("function"),
2655
- name: Y.string().min(1),
2656
- description: Y.string().optional(),
2657
- parameters: Y.record(Y.string(), Y.unknown())
2652
+ expiresAt: X.number().positive().max(2 ** 53 - 1).optional(),
2653
+ tools: X.array(X.object({
2654
+ type: X.literal("function"),
2655
+ name: X.string().min(1),
2656
+ description: X.string().optional(),
2657
+ parameters: X.record(X.string(), X.unknown())
2658
2658
  })).optional()
2659
2659
  }), I({
2660
2660
  prefix: "call",
@@ -2678,7 +2678,7 @@ async function ur({ response: e, url: t, fallbackMessage: n }) {
2678
2678
  }
2679
2679
  async function dr(e) {
2680
2680
  if (e == null) return [];
2681
- if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Ze({
2681
+ if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Qe({
2682
2682
  functionality: "FileList",
2683
2683
  message: "FileList is not supported in the current environment"
2684
2684
  });
@@ -2706,7 +2706,7 @@ var pr = class {
2706
2706
  this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
2707
2707
  }
2708
2708
  async sendMessages({ abortSignal: e, ...t }) {
2709
- let n = await bn(this.body), r = await bn(this.headers), i = await bn(this.credentials), a = {
2709
+ let n = await vn(this.body), r = await vn(this.headers), i = await vn(this.credentials), a = {
2710
2710
  ...F(r),
2711
2711
  ...F(t.headers)
2712
2712
  }, o = await this.prepareSendMessagesRequest?.({
@@ -2748,7 +2748,7 @@ var pr = class {
2748
2748
  return this.processResponseStream(d.body);
2749
2749
  }
2750
2750
  async reconnectToStream(e) {
2751
- let t = await bn(this.body), n = await bn(this.headers), r = await bn(this.credentials), i = {
2751
+ let t = await vn(this.body), n = await vn(this.headers), r = await vn(this.credentials), i = {
2752
2752
  ...F(n),
2753
2753
  ...F(e.headers)
2754
2754
  }, a = await this.prepareReconnectToStreamRequest?.({
@@ -2763,7 +2763,7 @@ var pr = class {
2763
2763
  requestMetadata: e.metadata
2764
2764
  }), o = a?.api;
2765
2765
  if (o == null) {
2766
- if (e.chatId === "." || e.chatId === "..") throw new wn({
2766
+ if (e.chatId === "." || e.chatId === "..") throw new Sn({
2767
2767
  parameter: "chatId",
2768
2768
  value: e.chatId,
2769
2769
  message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
@@ -2790,7 +2790,7 @@ var pr = class {
2790
2790
  super(t), this.resumeStreamIsReplay = e;
2791
2791
  }
2792
2792
  processResponseStream(e) {
2793
- return yn({
2793
+ return _n({
2794
2794
  stream: e,
2795
2795
  schema: Qn
2796
2796
  }).pipeThrough(new TransformStream({ async transform(e, t) {
@@ -2839,12 +2839,12 @@ var pr = class {
2839
2839
  } else n = e;
2840
2840
  if (e.messageId != null) {
2841
2841
  let t = this.state.messages.findIndex((t) => t.id === e.messageId);
2842
- if (t === -1) throw new wn({
2842
+ if (t === -1) throw new Sn({
2843
2843
  parameter: "message.messageId",
2844
2844
  value: e.messageId,
2845
2845
  message: `message with id ${e.messageId} not found`
2846
2846
  });
2847
- if (this.state.messages[t].role !== "user") throw new wn({
2847
+ if (this.state.messages[t].role !== "user") throw new Sn({
2848
2848
  parameter: "message.messageId",
2849
2849
  value: e.messageId,
2850
2850
  message: `message with id ${e.messageId} is not a user message`
@@ -2868,7 +2868,7 @@ var pr = class {
2868
2868
  });
2869
2869
  }, this.regenerate = async ({ messageId: e, ...t } = {}) => {
2870
2870
  let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
2871
- if (n === -1) throw new wn({
2871
+ if (n === -1) throw new Sn({
2872
2872
  parameter: "messageId",
2873
2873
  value: e,
2874
2874
  message: `message ${e} not found`
@@ -3632,16 +3632,16 @@ var Gr = "voice-", Kr = (e) => e?.role === "assistant" && e.parts.some((e) => e.
3632
3632
  let t = Jr(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Yr && t.endsWith(e.text)));
3633
3633
  return !r || (r.taken = !0, !1);
3634
3634
  });
3635
- }, Zr = (e) => {
3635
+ }, Zr = 12e4, Qr = 1e3, $r = (e) => {
3636
3636
  let t = e.type ?? "";
3637
3637
  return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
3638
- }, Qr = ({ messages: e }) => {
3638
+ }, ei = ({ messages: e }) => {
3639
3639
  let t = e[e.length - 1];
3640
3640
  if (!t || t.role !== "assistant") return !1;
3641
- let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && (y(Zr(e)) || ee(e)));
3641
+ let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && (y($r(e)) || ee(e)));
3642
3642
  return r.length > 0 && r.every((e) => oe.has(e.state ?? ""));
3643
3643
  };
3644
- function $r(e) {
3644
+ function ti(e) {
3645
3645
  return Ce(`chatbot-${e}`, () => {
3646
3646
  let { t, te: n, locale: r } = xe({ useScope: "global" }), i = S(""), a = S(), o = S(e), s = S(), c = S(), l = S(), u = S(), d = S(), f = S(), p = S(), m = S(), h = S(), g = S(), _ = S(), v = S(), y = S(), b = S(), te = S(), ie = S(), oe = C(), pe = S(0), me = S(), ge = C(), ve = C(), ye = S(), Ce = S(!1), De = S(0), je = S(), Me = S(!1), T = Se(), Ne = x(() => {
3647
3647
  let e = u.value?.theme;
@@ -3666,8 +3666,8 @@ function $r(e) {
3666
3666
  function Ve() {
3667
3667
  ze.value = me.value?.level ?? null;
3668
3668
  }
3669
- let He = S(), k = S(!1), Ue = x(() => He.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3670
- function We(e) {
3669
+ let He = S(), Ue = S(!1), We = x(() => He.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3670
+ function Ge(e) {
3671
3671
  try {
3672
3672
  let t = JSON.parse(e.message);
3673
3673
  return t.status === 404 || t.type?.includes("entity-not-found");
@@ -3675,22 +3675,22 @@ function $r(e) {
3675
3675
  return !1;
3676
3676
  }
3677
3677
  }
3678
- function Ge(e) {
3679
- if (We(e)) {
3678
+ function Ke(e) {
3679
+ if (Ge(e)) {
3680
3680
  let e = P.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? ue(t) : void 0;
3681
3681
  D.value = L(), He.value = void 0, he(() => {
3682
3682
  P.value.clearError(), n && P.value.sendMessage({ text: n });
3683
3683
  });
3684
- } else ce.error(e), He.value = e, Ue.value && (k.value = !0);
3684
+ } else ce.error(e), He.value = e, We.value && (Ue.value = !0);
3685
3685
  }
3686
- let A = x(() => se({
3686
+ let k = x(() => se({
3687
3687
  baseUrl: i.value,
3688
3688
  basePath: a.value,
3689
3689
  headers: () => p.value
3690
- })), Ke = S(null), qe = () => ({
3690
+ })), qe = S(null), Je = () => ({
3691
3691
  ...we(),
3692
- ...Ke.value ?? {}
3693
- }), Je = () => {
3692
+ ...qe.value ?? {}
3693
+ }), Ye = () => {
3694
3694
  let e = De.value;
3695
3695
  return new Promise((t) => {
3696
3696
  let n = setTimeout(() => {
@@ -3699,19 +3699,19 @@ function $r(e) {
3699
3699
  i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
3700
3700
  });
3701
3701
  });
3702
- }, j = C(), Ye = (e, t) => new Promise((n) => {
3703
- j.value?.answer(!1), j.value = {
3702
+ }, A = C(), Xe = (e, t) => new Promise((n) => {
3703
+ A.value?.answer(!1), A.value = {
3704
3704
  toolCallId: e.toolCallId,
3705
3705
  question: t,
3706
3706
  answer: (e) => {
3707
- j.value = void 0, n(e);
3707
+ A.value = void 0, n(e);
3708
3708
  }
3709
3709
  };
3710
3710
  });
3711
- function Xe(e) {
3712
- j.value?.answer(e);
3711
+ function Ze(e) {
3712
+ A.value?.answer(e);
3713
3713
  }
3714
- let Ze = Ae({
3714
+ let Qe = Ae({
3715
3715
  registry: () => [
3716
3716
  ...(oe.value ?? []).filter((e) => !re(e.name)),
3717
3717
  ...Ie.value,
@@ -3719,8 +3719,8 @@ function $r(e) {
3719
3719
  ],
3720
3720
  capability: () => ie.value,
3721
3721
  addToolOutput: (e) => void P.value.addToolOutput(e),
3722
- confirm: Ye,
3723
- waitForResume: Je,
3722
+ confirm: Xe,
3723
+ waitForResume: Ye,
3724
3724
  onPendingChange: (e) => {
3725
3725
  pe.value = e;
3726
3726
  },
@@ -3733,20 +3733,21 @@ function $r(e) {
3733
3733
  ye.value = { title: t?.annotations?.title ?? e.toolName }, Ce.value = !0;
3734
3734
  }
3735
3735
  });
3736
- async function Qe() {
3737
- M(), ye.value = void 0, Ce.value = !1, U.value = "", await P.value.stop();
3736
+ async function $e() {
3737
+ j(), ye.value = void 0, Ce.value = !1, G.value = "", await P.value.stop();
3738
3738
  }
3739
- function M() {
3740
- Ze.cancelAll(), j.value?.answer(!1);
3739
+ function j() {
3740
+ Qe.cancelAll(), A.value?.answer(!1);
3741
3741
  }
3742
- async function $e(e) {
3743
- O.value = e, e && await Qe();
3742
+ async function et(e) {
3743
+ O.value = e, e && await $e();
3744
3744
  }
3745
- w(D, () => M());
3746
- let N = Wr(() => ({
3745
+ w(D, () => j(), { flush: "sync" });
3746
+ let M = !1, N, tt = Wr(() => ({
3747
3747
  id: D.value,
3748
3748
  transport: new mr({
3749
- api: A.value.getChatEndpoint(o.value, E.value ? "reasoning" : "chat"),
3749
+ api: k.value.getChatEndpoint(o.value, E.value ? "reasoning" : "chat"),
3750
+ prepareReconnectToStreamRequest: ({ id: e }) => ({ api: k.value.getChatStreamEndpoint(o.value, e) }),
3750
3751
  prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
3751
3752
  id: t,
3752
3753
  messages: [e[e.length - 1]],
@@ -3761,7 +3762,7 @@ function $r(e) {
3761
3762
  reasoning: d.value?.reasoning,
3762
3763
  webSearch: f.value?.webSearch,
3763
3764
  smoothStream: u.value?.smoothStream,
3764
- deviceContext: qe(),
3765
+ deviceContext: Je(),
3765
3766
  externalContext: te.value,
3766
3767
  disabledTools: f.value?.disabled,
3767
3768
  fallbackModels: y.value,
@@ -3780,16 +3781,18 @@ function $r(e) {
3780
3781
  credentials: "include",
3781
3782
  headers: () => p.value ?? {}
3782
3783
  }),
3783
- sendAutomaticallyWhen: (e) => Qr(e) || gr(e),
3784
- onError: Ge,
3784
+ sendAutomaticallyWhen: (e) => ei(e) || gr(e),
3785
+ onError: (e) => {
3786
+ M ? ce.warn(e) : Ke(e);
3787
+ },
3785
3788
  onToolCall: ({ toolCall: e }) => {
3786
- if (!Oe(e)) return;
3789
+ if (!Oe(e) || M) return;
3787
3790
  let t = e;
3788
- Ze.enqueue({
3791
+ Qe.enqueue({
3789
3792
  toolCallId: t.toolCallId,
3790
3793
  toolName: t.toolName,
3791
3794
  input: t.input,
3792
- messageId: et()?.id ?? "",
3795
+ messageId: nt()?.id ?? "",
3793
3796
  readOnly: t.toolMetadata?.readOnly === !0,
3794
3797
  provider: t.toolMetadata?.provider === "page" ? "page" : "app"
3795
3798
  });
@@ -3799,19 +3802,23 @@ function $r(e) {
3799
3802
  },
3800
3803
  onFinish: () => {
3801
3804
  let e = D.value;
3802
- !E.value && !F.value.some((t) => t.id === e) && ht(o.value);
3805
+ !E.value && !R.value.some((t) => t.id === e) && ht(o.value);
3803
3806
  }
3804
- })), P = x(() => _e(N)), et = () => P.value.messages[P.value.messages.length - 1], tt = x(() => {
3807
+ })), P = x(() => _e(tt)), nt = () => P.value.messages[P.value.messages.length - 1];
3808
+ w(D, () => {
3809
+ P.value.stop();
3810
+ }, { flush: "sync" });
3811
+ let rt = x(() => {
3805
3812
  let e = u.value?.initialMessage;
3806
3813
  return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
3807
- }), nt = L(), rt = x(() => ({
3808
- id: nt,
3814
+ }), it = L(), at = x(() => ({
3815
+ id: it,
3809
3816
  role: "assistant",
3810
3817
  parts: [{
3811
3818
  type: "text",
3812
- text: tt.value
3819
+ text: rt.value
3813
3820
  }]
3814
- })), it = x(() => {
3821
+ })), F = x(() => {
3815
3822
  let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
3816
3823
  ...e,
3817
3824
  parts: e.parts.map((e) => {
@@ -3821,66 +3828,95 @@ function $r(e) {
3821
3828
  let e = t.url.slice(13);
3822
3829
  return {
3823
3830
  ...t,
3824
- url: A.value.getMediaUrl(o.value, D.value, e)
3831
+ url: k.value.getMediaUrl(o.value, D.value, e)
3825
3832
  };
3826
3833
  }
3827
3834
  return t.url.startsWith("blob:") ? t : {
3828
3835
  ...t,
3829
- url: A.value.appendAuthToken(t.url)
3836
+ url: k.value.appendAuthToken(t.url)
3830
3837
  };
3831
3838
  })
3832
3839
  }), t = P.value.id === D.value ? P.value.messages : [];
3833
- return E.value ? e(t) : !Me.value && t[0]?.role !== "assistant" ? [rt.value, ...e(t)] : e(t);
3834
- }), at = x(() => {
3840
+ return E.value ? e(t) : !Me.value && t[0]?.role !== "assistant" ? [at.value, ...e(t)] : e(t);
3841
+ }), I = x(() => {
3835
3842
  let e = u.value?.messagePlaceholder;
3836
3843
  return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
3837
- }), F = S([]), I = S(!1), R = S([]), ot = S(!1), st = S("chat"), z = S([]), ct = S(), lt = S(!1), ut = S(!1), B = S(), dt = S(!1), ft = S(!1), pt = S(), V = S(""), H = S([]), U = S(""), mt = S(0);
3844
+ }), R = S([]), ot = S(!1), z = S([]), st = S(!1), ct = S("chat"), B = S([]), V = S(), H = S(!1), lt = S(!1), ut = S(), dt = S(!1), U = S(!1), ft = S(), pt = S(""), W = S([]), G = S(""), mt = S(0);
3838
3845
  async function ht(e) {
3839
- if (E.value) F.value = [];
3846
+ if (E.value) R.value = [];
3840
3847
  else {
3841
- I.value = !0;
3848
+ ot.value = !0;
3842
3849
  try {
3843
- F.value = await A.value.getConversations(e, l.value);
3850
+ R.value = await k.value.getConversations(e, l.value);
3844
3851
  } catch {
3845
- F.value = [];
3852
+ R.value = [];
3846
3853
  } finally {
3847
- I.value = !1;
3854
+ ot.value = !1;
3848
3855
  }
3849
3856
  }
3850
3857
  }
3851
3858
  async function gt() {
3852
3859
  let e = D.value;
3853
- if (!e) R.value = [];
3860
+ if (!e) z.value = [];
3854
3861
  else {
3855
- ot.value = !0;
3862
+ st.value = !0;
3856
3863
  try {
3857
- R.value = await A.value.getChatFiles(e);
3864
+ z.value = await k.value.getChatFiles(e);
3858
3865
  } catch {
3859
- R.value = [];
3866
+ z.value = [];
3860
3867
  } finally {
3861
- ot.value = !1;
3868
+ st.value = !1;
3862
3869
  }
3863
3870
  }
3864
3871
  }
3865
3872
  function _t(e, t = !1) {
3866
- return A.value.getChatFileDownloadUrl(e, t);
3873
+ return k.value.getChatFileDownloadUrl(e, t);
3867
3874
  }
3868
3875
  function vt(e) {
3869
- return A.value.getChatFilePreviewUrl(e);
3876
+ return k.value.getChatFilePreviewUrl(e);
3870
3877
  }
3871
3878
  async function yt(e) {
3872
- await A.value.deleteChatFile(e);
3873
- let t = R.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
3874
- R.value = R.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
3879
+ await k.value.deleteChatFile(e);
3880
+ let t = z.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
3881
+ z.value = z.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
3875
3882
  }
3876
3883
  async function bt(e, t) {
3877
3884
  if (!E.value) try {
3878
- let n = await A.value.getChat(e, t);
3885
+ let n = await k.value.getChat(e, t);
3879
3886
  if (t !== D.value || P.value.status !== "ready" || P.value.messages.length > 0) return;
3880
- n && (P.value.messages = n.messages, k.value = n.blocked ?? !1, xt(e, t));
3887
+ n && (P.value.messages = n.messages, Ue.value = n.blocked ?? !1, xt(e, t, n.turnInProgress === !0));
3881
3888
  } catch {}
3882
3889
  }
3883
- async function xt(e, t) {
3890
+ async function xt(e, t, n) {
3891
+ n && (await St(t), t !== D.value || K()) || await Ct(e, t);
3892
+ }
3893
+ async function St(e) {
3894
+ let t = { chatId: e };
3895
+ N = t;
3896
+ let n = () => N === t && e === D.value, r = Date.now() + Zr;
3897
+ try {
3898
+ for (; n() && !K() && Date.now() < r;) {
3899
+ M = !0;
3900
+ try {
3901
+ await P.value.resumeStream();
3902
+ } finally {
3903
+ M = !1;
3904
+ }
3905
+ if (!n()) return;
3906
+ P.value.clearError();
3907
+ let t = await k.value.getChat(o.value, e).catch(() => null);
3908
+ if (!t || !n() || K()) return;
3909
+ if (!t.turnInProgress) {
3910
+ P.value.messages = t.messages;
3911
+ return;
3912
+ }
3913
+ await new Promise((e) => setTimeout(e, Qr));
3914
+ }
3915
+ } finally {
3916
+ N === t && (N = void 0);
3917
+ }
3918
+ }
3919
+ async function Ct(e, t) {
3884
3920
  let n;
3885
3921
  try {
3886
3922
  n = Number(sessionStorage.getItem(Ee)), sessionStorage.removeItem(Ee);
@@ -3892,7 +3928,7 @@ function $r(e) {
3892
3928
  if (n?.role === "assistant") {
3893
3929
  let e = n.parts.filter((e) => ee(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
3894
3930
  if (e.length > 0) {
3895
- if (t.length === e.length && !O.value) for (let e of t) Ze.enqueue({
3931
+ if (t.length === e.length && !O.value) for (let e of t) Qe.enqueue({
3896
3932
  toolCallId: e.toolCallId,
3897
3933
  toolName: e.toolName,
3898
3934
  input: e.input,
@@ -3906,45 +3942,45 @@ function $r(e) {
3906
3942
  }
3907
3943
  if (await new Promise((e) => setTimeout(e, 1500)), t !== D.value || P.value.status !== "ready") return;
3908
3944
  try {
3909
- let n = await A.value.getChat(e, t);
3945
+ let n = await k.value.getChat(e, t);
3910
3946
  n && t === D.value && (P.value.messages = n.messages);
3911
3947
  } catch {
3912
3948
  return;
3913
3949
  }
3914
3950
  }
3915
3951
  }
3916
- let St = () => {
3952
+ let K = () => {
3917
3953
  let e = P.value.status;
3918
3954
  return e === "submitted" || e === "streaming";
3919
- }, Ct = 0, wt = 0;
3920
- async function Tt() {
3921
- if (E.value || St()) return "indeterminate";
3922
- let e = D.value, t = Ct += 1;
3955
+ }, wt = 0, Tt = 0;
3956
+ async function Et() {
3957
+ if (E.value || K()) return "indeterminate";
3958
+ let e = D.value, t = wt += 1;
3923
3959
  try {
3924
- let n = await A.value.getChat(o.value, e);
3925
- if (!n || e !== D.value || St() || t <= wt) return "indeterminate";
3926
- wt = t;
3960
+ let n = await k.value.getChat(o.value, e);
3961
+ if (!n || e !== D.value || K() || t <= Tt) return "indeterminate";
3962
+ Tt = t;
3927
3963
  let r = n.messages, i = Xr(r, P.value.messages);
3928
- return P.value.messages = [...r, ...i], k.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
3964
+ return P.value.messages = [...r, ...i], Ue.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
3929
3965
  } catch {}
3930
3966
  return "indeterminate";
3931
3967
  }
3932
- function W(e) {
3968
+ function Dt(e) {
3933
3969
  P.value.messages = [...P.value.messages, e];
3934
3970
  }
3935
- async function Et(e) {
3971
+ async function q(e) {
3936
3972
  try {
3937
- z.value = await A.value.getMessageFeedbacks(e);
3973
+ B.value = await k.value.getMessageFeedbacks(e);
3938
3974
  } catch {
3939
- z.value = [];
3975
+ B.value = [];
3940
3976
  }
3941
3977
  }
3942
- function Dt(e) {
3943
- let t = z.value.findIndex((t) => t.messageId === e.messageId);
3944
- t >= 0 ? z.value[t] = e : z.value.push(e);
3978
+ function J(e) {
3979
+ let t = B.value.findIndex((t) => t.messageId === e.messageId);
3980
+ t >= 0 ? B.value[t] = e : B.value.push(e);
3945
3981
  }
3946
3982
  function Ot(e) {
3947
- let t = it.value, n = t.findIndex((t) => t.id === e.id), r = ue(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
3983
+ let t = F.value, n = t.findIndex((t) => t.id === e.id), r = ue(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
3948
3984
  return {
3949
3985
  userQuestion: ue(i ?? e) ?? "",
3950
3986
  assistantMessage: r
@@ -3954,27 +3990,27 @@ function $r(e) {
3954
3990
  await Promise.all([
3955
3991
  bt(e, t),
3956
3992
  ht(e),
3957
- Et(t)
3958
- ]), Ke.value || Te((e, t) => A.value.reverseGeocode(e, t, r.value)).then((e) => {
3959
- e && (Ke.value = e);
3993
+ q(t)
3994
+ ]), qe.value || Te((e, t) => k.value.reverseGeocode(e, t, r.value)).then((e) => {
3995
+ e && (qe.value = e);
3960
3996
  });
3961
3997
  }
3962
- async function G() {
3963
- let e = V.value.trim(), t = H.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
3998
+ async function At() {
3999
+ let e = pt.value.trim(), t = W.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
3964
4000
  type: "file",
3965
4001
  mediaType: e.mediaSource.mimeType,
3966
4002
  url: e.localUrl,
3967
4003
  filename: e.mediaSource.name,
3968
4004
  providerMetadata: { "8bot": { media: e.mediaSource } }
3969
4005
  }));
3970
- E.value && it.value.length > 0 && await Ft(), M(), U.value = e, mt.value = P.value.messages.length;
4006
+ E.value && F.value.length > 0 && await Lt(), j(), G.value = e, mt.value = P.value.messages.length;
3971
4007
  let n = P.value.sendMessage;
3972
4008
  n({
3973
4009
  text: e,
3974
4010
  files: t.length > 0 ? t : void 0
3975
- }), V.value = "", Pt();
4011
+ }), pt.value = "", It();
3976
4012
  }
3977
- function K(e) {
4013
+ function jt(e) {
3978
4014
  let t = e.trim();
3979
4015
  if (!t) return;
3980
4016
  if (P.value.status !== "ready") {
@@ -3982,46 +4018,48 @@ function $r(e) {
3982
4018
  return;
3983
4019
  }
3984
4020
  let n = P.value.sendMessage;
3985
- M(), n({ text: t });
4021
+ j(), n({ text: t });
3986
4022
  }
3987
- async function At() {
3988
- let e = P.value.messages.slice(mt.value).some((e) => e.parts.some(ee)), t = U.value, n = t.length > 0 && !e;
3989
- M(), await P.value.stop(), n && (V.value = t, P.value.messages = P.value.messages.slice(0, mt.value), U.value = "");
4023
+ async function Mt() {
4024
+ let e = P.value.messages.slice(mt.value).some((e) => e.parts.some(ee)), t = G.value, n = t.length > 0 && !e, r = D.value, i = mt.value, a = N?.chatId === r;
4025
+ N = void 0, j(), await P.value.stop();
4026
+ let s = E.value || e && !a || await k.value.stopChatTurn(o.value, r).catch(() => !0);
4027
+ r !== D.value || K() || mt.value !== i || ((a || !s) && (await Et(), a || P.value.messages.length > mt.value) ? G.value = "" : n && (pt.value = t, P.value.messages = P.value.messages.slice(0, mt.value), G.value = ""));
3990
4028
  }
3991
4029
  w(() => P.value.messages, (e) => {
3992
- let t = j.value?.toolCallId;
3993
- t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && M();
4030
+ let t = A.value?.toolCallId;
4031
+ t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && j();
3994
4032
  }), w(() => P.value.status, (e) => {
3995
4033
  e === "submitted" && De.value++;
3996
4034
  });
3997
- let jt;
4035
+ let Nt;
3998
4036
  w(() => [P.value.status, pe.value], ([e, t]) => {
3999
- clearTimeout(jt), e === "ready" && t === 0 && (jt = setTimeout(() => {
4037
+ clearTimeout(Nt), e === "ready" && t === 0 && (Nt = setTimeout(() => {
4000
4038
  Ce.value = !1;
4001
4039
  }, 1500));
4002
4040
  });
4003
- let Mt = S(!1), Nt;
4004
- w(() => !j.value && !Kr(et()) && (St() || pe.value > 0), (e) => {
4005
- clearTimeout(Nt), e ? Mt.value = !0 : Nt = setTimeout(() => {
4006
- Mt.value = !1;
4041
+ let Pt = S(!1), Ft;
4042
+ w(() => !A.value && !Kr(nt()) && (K() || pe.value > 0), (e) => {
4043
+ clearTimeout(Ft), e ? Pt.value = !0 : Ft = setTimeout(() => {
4044
+ Pt.value = !1;
4007
4045
  }, 400);
4008
4046
  }, { immediate: !0 }), w(() => P.value.status, (e) => {
4009
- e === "ready" && U.value.length > 0 && (U.value = "");
4047
+ e === "ready" && G.value.length > 0 && (G.value = "");
4010
4048
  });
4011
- function Pt(e = !1) {
4012
- for (let t of H.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4013
- H.value = [], Wt.value = null;
4049
+ function It(e = !1) {
4050
+ for (let t of W.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4051
+ W.value = [], Kt.value = null;
4014
4052
  }
4015
- async function Ft() {
4016
- return U.value = "", await At(), D.value = L(), await he(), P.value.clearError(), He.value = void 0, k.value = !1, Pt(!0), en("chat"), D.value;
4053
+ async function Lt() {
4054
+ return G.value = "", D.value = L(), await he(), P.value.clearError(), He.value = void 0, Ue.value = !1, It(!0), nn("chat"), D.value;
4017
4055
  }
4018
- async function It(e) {
4019
- P.value.status !== "ready" && (U.value = "", await At()), M(), await P.value.regenerate(e);
4056
+ async function Rt(e) {
4057
+ P.value.status !== "ready" && (G.value = "", await Mt()), j(), await P.value.regenerate(e);
4020
4058
  }
4021
- function Lt(e) {
4059
+ function zt(e) {
4022
4060
  if (e.tool === "requestGeolocation") {
4023
4061
  let t = e.output;
4024
- "latitude" in t && (Ke.value = {
4062
+ "latitude" in t && (qe.value = {
4025
4063
  geolocationLatitude: t.latitude,
4026
4064
  geolocationLongitude: t.longitude,
4027
4065
  geolocationAccuracy: t.accuracy,
@@ -4030,23 +4068,23 @@ function $r(e) {
4030
4068
  }
4031
4069
  P.value.addToolOutput(e);
4032
4070
  }
4033
- function Rt(e) {
4071
+ function Bt(e) {
4034
4072
  P.value.addToolApprovalResponse(e);
4035
4073
  }
4036
- let zt = x(() => P.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Bt = x(() => _.value?.maxFilesPerMessage ?? 5), Vt = x(() => _.value?.maxFilesPerChat ?? 20), Ht = x(() => Math.max(0, Math.min(Bt.value - H.value.length, Vt.value - zt.value - H.value.length))), Ut = x(() => Ht.value <= 0), Wt = S(null), Gt = () => {
4037
- Wt.value = null;
4074
+ let Vt = x(() => P.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Ht = x(() => _.value?.maxFilesPerMessage ?? 5), Ut = x(() => _.value?.maxFilesPerChat ?? 20), Wt = x(() => Math.max(0, Math.min(Ht.value - W.value.length, Ut.value - Vt.value - W.value.length))), Gt = x(() => Wt.value <= 0), Kt = S(null), qt = () => {
4075
+ Kt.value = null;
4038
4076
  };
4039
- w(Ut, (e) => {
4040
- e || (Wt.value = null);
4077
+ w(Gt, (e) => {
4078
+ e || (Kt.value = null);
4041
4079
  });
4042
- async function Kt(e) {
4043
- if (Ut.value) {
4044
- Wt.value = Vt.value - zt.value - H.value.length <= Bt.value - H.value.length ? {
4080
+ async function Jt(e) {
4081
+ if (Gt.value) {
4082
+ Kt.value = Ut.value - Vt.value - W.value.length <= Ht.value - W.value.length ? {
4045
4083
  reason: "per-chat",
4046
- max: Vt.value
4084
+ max: Ut.value
4047
4085
  } : {
4048
4086
  reason: "per-message",
4049
- max: Bt.value
4087
+ max: Ht.value
4050
4088
  };
4051
4089
  return;
4052
4090
  }
@@ -4056,26 +4094,26 @@ function $r(e) {
4056
4094
  localUrl: URL.createObjectURL(e),
4057
4095
  state: "uploading"
4058
4096
  };
4059
- H.value = [...H.value, n];
4097
+ W.value = [...W.value, n];
4060
4098
  try {
4061
- let n = await A.value.uploadMedia(o.value, D.value, e);
4062
- H.value = H.value.map((e) => e.id === t ? {
4099
+ let n = await k.value.uploadMedia(o.value, D.value, e);
4100
+ W.value = W.value.map((e) => e.id === t ? {
4063
4101
  ...e,
4064
4102
  state: "done",
4065
4103
  mediaSource: n
4066
4104
  } : e);
4067
4105
  } catch (e) {
4068
4106
  let n = e instanceof Error ? e.message : "Upload failed";
4069
- H.value = H.value.map((e) => e.id === t ? {
4107
+ W.value = W.value.map((e) => e.id === t ? {
4070
4108
  ...e,
4071
4109
  state: "error",
4072
4110
  error: n
4073
4111
  } : e);
4074
4112
  }
4075
4113
  }
4076
- async function qt(e, t) {
4114
+ async function Yt(e, t) {
4077
4115
  let { userQuestion: n, assistantMessage: r } = Ot(e);
4078
- Dt(await A.value.submitMessageFeedback({
4116
+ J(await k.value.submitMessageFeedback({
4079
4117
  messageId: e.id,
4080
4118
  chatId: D.value,
4081
4119
  agentId: o.value,
@@ -4084,72 +4122,72 @@ function $r(e) {
4084
4122
  assistantMessage: r
4085
4123
  }));
4086
4124
  }
4087
- async function Jt(e) {
4088
- await qt(e, "upvote");
4125
+ async function Xt(e) {
4126
+ await Yt(e, "upvote");
4089
4127
  }
4090
- async function Yt(e) {
4091
- await qt(e, "downvote");
4128
+ async function Zt(e) {
4129
+ await Yt(e, "downvote");
4092
4130
  }
4093
- function Xt(e) {
4094
- ut.value = !1, B.value = void 0, ct.value = e;
4131
+ function Y(e) {
4132
+ lt.value = !1, ut.value = void 0, V.value = e;
4095
4133
  }
4096
- async function Zt(e) {
4097
- if (ct.value) try {
4098
- lt.value = !0, ut.value = !1, B.value = void 0;
4099
- let { userQuestion: t, assistantMessage: n } = Ot(ct.value);
4100
- Dt(await A.value.submitMessageFeedback({
4101
- messageId: ct.value.id,
4134
+ async function Qt(e) {
4135
+ if (V.value) try {
4136
+ H.value = !0, lt.value = !1, ut.value = void 0;
4137
+ let { userQuestion: t, assistantMessage: n } = Ot(V.value);
4138
+ J(await k.value.submitMessageFeedback({
4139
+ messageId: V.value.id,
4102
4140
  chatId: D.value,
4103
4141
  agentId: o.value,
4104
4142
  userQuestion: t,
4105
4143
  assistantMessage: n,
4106
4144
  comment: e
4107
- })), ut.value = !0, await Et(D.value);
4145
+ })), lt.value = !0, await q(D.value);
4108
4146
  } catch {
4109
- B.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4147
+ ut.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4110
4148
  } finally {
4111
- lt.value = !1;
4149
+ H.value = !1;
4112
4150
  }
4113
4151
  }
4114
- async function Qt(e) {
4152
+ async function $t(e) {
4115
4153
  try {
4116
- ft.value = !0, dt.value = !1, pt.value = void 0, await A.value.submitLead({
4154
+ U.value = !0, dt.value = !1, ft.value = void 0, await k.value.submitLead({
4117
4155
  agentId: o.value,
4118
4156
  chatId: D.value,
4119
4157
  ...e
4120
4158
  }), dt.value = !0;
4121
4159
  } catch {
4122
- pt.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4160
+ ft.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4123
4161
  } finally {
4124
- ft.value = !1;
4162
+ U.value = !1;
4125
4163
  }
4126
4164
  }
4127
- async function $t(e, t) {
4128
- let n = await A.value.updateChatTitle(o.value, e, t);
4129
- F.value = F.value.map((t) => t.id === e ? {
4165
+ async function en(e, t) {
4166
+ let n = await k.value.updateChatTitle(o.value, e, t);
4167
+ R.value = R.value.map((t) => t.id === e ? {
4130
4168
  ...t,
4131
4169
  title: n.title
4132
4170
  } : t);
4133
4171
  }
4134
- async function q(e) {
4135
- await A.value.deleteChat(o.value, e), F.value = F.value.filter((t) => t.id !== e), D.value === e && await Ft();
4136
- }
4137
- function en(e) {
4138
- st.value = e;
4172
+ async function tn(e) {
4173
+ await k.value.deleteChat(o.value, e), R.value = R.value.filter((t) => t.id !== e), D.value === e && await Lt();
4139
4174
  }
4140
- let tn;
4141
4175
  function nn(e) {
4142
- let t = () => A.value.getChat(o.value, e).then((e) => e !== null);
4176
+ ct.value = e;
4177
+ }
4178
+ let rn;
4179
+ function an(e) {
4180
+ let t = () => k.value.getChat(o.value, e).then((e) => e !== null);
4143
4181
  return t().catch(() => t().catch(() => !1));
4144
4182
  }
4145
4183
  return w(l, async (e) => {
4146
- if (!e || e === tn) return;
4147
- let t = tn;
4148
- if (tn = e, t === void 0) return;
4149
- let n = D.value, r = !E.value && await nn(n);
4150
- l.value === e && D.value === n && (r ? ht(o.value) : (F.value = [], z.value = [], R.value = [], await Ft(), V.value = ""));
4184
+ if (!e || e === rn) return;
4185
+ let t = rn;
4186
+ if (rn = e, t === void 0) return;
4187
+ let n = D.value, r = !E.value && await an(n);
4188
+ l.value === e && D.value === n && (r ? ht(o.value) : (R.value = [], B.value = [], z.value = [], await Lt(), pt.value = ""));
4151
4189
  }), {
4152
- apiClient: A,
4190
+ apiClient: k,
4153
4191
  baseUrl: i,
4154
4192
  basePath: a,
4155
4193
  agentId: o,
@@ -4177,72 +4215,72 @@ function $r(e) {
4177
4215
  pageFormsProvider: ve,
4178
4216
  pageAction: ye,
4179
4217
  pageControlActive: Ce,
4180
- isWorking: Mt,
4181
- stopHostActions: Qe,
4218
+ isWorking: Pt,
4219
+ stopHostActions: $e,
4182
4220
  pageNoticeLevel: Be,
4183
4221
  closePageNotice: Ve,
4184
- hostConfirmation: j,
4185
- respondHostConfirmation: Xe,
4222
+ hostConfirmation: A,
4223
+ respondHostConfirmation: Ze,
4186
4224
  pageAccessAvailable: Re,
4187
4225
  pageAccessOff: O,
4188
- setPageAccessOff: $e,
4226
+ setPageAccessOff: et,
4189
4227
  systemTheme: je,
4190
4228
  hideWelcomeMessage: Me,
4191
4229
  isDark: Ne,
4192
4230
  chat: P,
4193
- messages: it,
4194
- conversations: F,
4195
- isLoadingConversations: I,
4196
- chatFiles: R,
4197
- isLoadingChatFiles: ot,
4198
- input: V,
4199
- pendingAttachments: H,
4200
- isAttachmentLimitReached: Ut,
4201
- fileLimitError: Wt,
4231
+ messages: F,
4232
+ conversations: R,
4233
+ isLoadingConversations: ot,
4234
+ chatFiles: z,
4235
+ isLoadingChatFiles: st,
4236
+ input: pt,
4237
+ pendingAttachments: W,
4238
+ isAttachmentLimitReached: Gt,
4239
+ fileLimitError: Kt,
4202
4240
  localChatId: D,
4203
- isConversationBlocked: k,
4204
- inputMessagePlaceholder: at,
4241
+ isConversationBlocked: Ue,
4242
+ inputMessagePlaceholder: I,
4205
4243
  chatError: He,
4206
- activeView: st,
4207
- messageFeedbacks: z,
4208
- feedbackDialogMessage: ct,
4209
- isFeedbackSubmitting: lt,
4210
- isFeedbackSubmitted: ut,
4211
- feedbackSubmitError: B,
4244
+ activeView: ct,
4245
+ messageFeedbacks: B,
4246
+ feedbackDialogMessage: V,
4247
+ isFeedbackSubmitting: H,
4248
+ isFeedbackSubmitted: lt,
4249
+ feedbackSubmitError: ut,
4212
4250
  isLeadSubmitted: dt,
4213
- isLoadingSubmitLead: ft,
4214
- submitLeadError: pt,
4215
- buildDeviceContext: qe,
4251
+ isLoadingSubmitLead: U,
4252
+ submitLeadError: ft,
4253
+ buildDeviceContext: Je,
4216
4254
  initialize: kt,
4217
4255
  loadConversations: ht,
4218
4256
  loadChatFiles: gt,
4219
- refreshMessages: Tt,
4220
- appendMessage: W,
4257
+ refreshMessages: Et,
4258
+ appendMessage: Dt,
4221
4259
  getChatFileUrl: _t,
4222
4260
  getChatFilePreviewUrl: vt,
4223
4261
  deleteChatFile: yt,
4224
- handleSubmit: G,
4225
- sendMessage: K,
4226
- stopGeneration: At,
4227
- startNewChat: Ft,
4228
- regenerate: It,
4229
- addToolOutput: Lt,
4230
- addToolApprovalResponse: Rt,
4231
- handleFileSelect: Kt,
4232
- clearFileLimitError: Gt,
4233
- clearPendingAttachments: Pt,
4234
- onUpvote: Jt,
4235
- onDownvote: Yt,
4236
- onFeedback: Xt,
4237
- onFeedbackSubmit: Zt,
4238
- onLeadSubmit: Qt,
4239
- navigate: en,
4240
- renameChatTitle: $t,
4241
- deleteChat: q
4262
+ handleSubmit: At,
4263
+ sendMessage: jt,
4264
+ stopGeneration: Mt,
4265
+ startNewChat: Lt,
4266
+ regenerate: Rt,
4267
+ addToolOutput: zt,
4268
+ addToolApprovalResponse: Bt,
4269
+ handleFileSelect: Jt,
4270
+ clearFileLimitError: qt,
4271
+ clearPendingAttachments: It,
4272
+ onUpvote: Xt,
4273
+ onDownvote: Zt,
4274
+ onFeedback: Y,
4275
+ onFeedbackSubmit: Qt,
4276
+ onLeadSubmit: $t,
4277
+ navigate: nn,
4278
+ renameChatTitle: en,
4279
+ deleteChat: tn
4242
4280
  };
4243
4281
  })();
4244
4282
  }
4245
4283
  //#endregion
4246
- export { L as a, mr as i, $r as n, Wr as r, Gr as t };
4284
+ export { L as a, mr as i, ti as n, Wr as r, Gr as t };
4247
4285
 
4248
- //# sourceMappingURL=useChatbotStore-CnCoo6j3.js.map
4286
+ //# sourceMappingURL=useChatbotStore-BFOUiojG.js.map