@8wave/ai-elements 0.123.0-beta.11 → 0.123.0-beta.13

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 (146) hide show
  1. package/README.md +30 -3
  2. package/dist/_chunks/{Agent-C0JtGK2t.js → Agent-CsSvagZw.js} +13 -2
  3. package/dist/_chunks/Agent-CsSvagZw.js.map +1 -0
  4. package/dist/_chunks/{PkStreamingMarkdown-DGdyf4_3.js → PkStreamingMarkdown-ReRKQNAO.js} +3 -3
  5. package/dist/_chunks/{PkStreamingMarkdown-DGdyf4_3.js.map → PkStreamingMarkdown-ReRKQNAO.js.map} +1 -1
  6. package/dist/_chunks/{PkToolChatFile-NrOBCzk2.js → PkToolChatFile-QJi6bOuS.js} +2 -2
  7. package/dist/_chunks/{PkToolChatFile-NrOBCzk2.js.map → PkToolChatFile-QJi6bOuS.js.map} +1 -1
  8. package/dist/_chunks/{PkToolRequestGeolocation-BIfpxvX5.js → PkToolRequestGeolocation-CUjRsNs9.js} +2 -2
  9. package/dist/_chunks/{PkToolRequestGeolocation-BIfpxvX5.js.map → PkToolRequestGeolocation-CUjRsNs9.js.map} +1 -1
  10. package/dist/_chunks/{PkToolRequestOAuthConnection-CJgoiSgi.js → PkToolRequestOAuthConnection-CbxVIAPg.js} +2 -2
  11. package/dist/_chunks/{PkToolRequestOAuthConnection-CJgoiSgi.js.map → PkToolRequestOAuthConnection-CbxVIAPg.js.map} +1 -1
  12. package/dist/_chunks/{PkToolShareDocument-CFGH4rKt.js → PkToolShareDocument-B5EC6KQS.js} +2 -2
  13. package/dist/_chunks/PkToolShareDocument-B5EC6KQS.js.map +1 -0
  14. package/dist/_chunks/{PkToolShowArtifact-DmZEQMSm.js → PkToolShowArtifact-D0HZ_qWx.js} +2 -2
  15. package/dist/_chunks/{PkToolShowArtifact-DmZEQMSm.js.map → PkToolShowArtifact-D0HZ_qWx.js.map} +1 -1
  16. package/dist/_chunks/{PkToolShowContactForm-BaX3d5Yq.js → PkToolShowContactForm-DkJB0EO1.js} +2 -2
  17. package/dist/_chunks/{PkToolShowContactForm-BaX3d5Yq.js.map → PkToolShowContactForm-DkJB0EO1.js.map} +1 -1
  18. package/dist/_chunks/{PkToolShowForm-BKyZnpPB.js → PkToolShowForm-zAprG0yl.js} +3 -3
  19. package/dist/_chunks/{PkToolShowForm-BKyZnpPB.js.map → PkToolShowForm-zAprG0yl.js.map} +1 -1
  20. package/dist/_chunks/{PkToolShowImageGallery-GBaXxucK.js → PkToolShowImageGallery-o62SZ6tq.js} +2 -2
  21. package/dist/_chunks/{PkToolShowImageGallery-GBaXxucK.js.map → PkToolShowImageGallery-o62SZ6tq.js.map} +1 -1
  22. package/dist/_chunks/{PkToolShowProductList-DBVtBJXU.js → PkToolShowProductList-CWLxVreB.js} +2 -2
  23. package/dist/_chunks/{PkToolShowProductList-DBVtBJXU.js.map → PkToolShowProductList-CWLxVreB.js.map} +1 -1
  24. package/dist/_chunks/{PkToolShowSources-Ciuizdl3.js → PkToolShowSources-dJEqZn6T.js} +3 -3
  25. package/dist/_chunks/{PkToolShowSources-Ciuizdl3.js.map → PkToolShowSources-dJEqZn6T.js.map} +1 -1
  26. package/dist/_chunks/{PkToolShowSuggestedReply-Dbti20SV.js → PkToolShowSuggestedReply-BHAltyxH.js} +2 -2
  27. package/dist/_chunks/{PkToolShowSuggestedReply-Dbti20SV.js.map → PkToolShowSuggestedReply-BHAltyxH.js.map} +1 -1
  28. package/dist/_chunks/{PkToolShowVideo-DKDR3zmI.js → PkToolShowVideo-DtJ0nEJk.js} +2 -2
  29. package/dist/_chunks/{PkToolShowVideo-DKDR3zmI.js.map → PkToolShowVideo-DtJ0nEJk.js.map} +1 -1
  30. package/dist/_chunks/{PkToolShowWebPages-CuJ12tdE.js → PkToolShowWebPages-D-tG9JH8.js} +2 -2
  31. package/dist/_chunks/{PkToolShowWebPages-CuJ12tdE.js.map → PkToolShowWebPages-D-tG9JH8.js.map} +1 -1
  32. package/dist/_chunks/{chatImagePolicy-D3zIP7-i.js → chatImagePolicy-Dhxqcirq.js} +2 -2
  33. package/dist/_chunks/{chatImagePolicy-D3zIP7-i.js.map → chatImagePolicy-Dhxqcirq.js.map} +1 -1
  34. package/dist/_chunks/{markdown-BxOlM5SY.js → markdown-CUaXq5OY.js} +2 -2
  35. package/dist/_chunks/{markdown-BxOlM5SY.js.map → markdown-CUaXq5OY.js.map} +1 -1
  36. package/dist/ai-elements.es.js +2721 -2270
  37. package/dist/ai-elements.es.js.map +1 -1
  38. package/dist-vue/PkChatbot.js +1 -1
  39. package/dist-vue/PkChatbotEmptyState.js +1 -1
  40. package/dist-vue/PkChatbotInput.js +1 -1
  41. package/dist-vue/PkChatbotMessages.js +1 -1
  42. package/dist-vue/PkChatbotStepPayload.js +1 -1
  43. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  44. package/dist-vue/PkChatbotSteps.js +1 -1
  45. package/dist-vue/PkChatbotViewChat.js +1 -1
  46. package/dist-vue/PkChatbotViewConversations.js +1 -1
  47. package/dist-vue/PkChatbotViewFiles.js +1 -1
  48. package/dist-vue/PkChatbotViewProfile.js +1 -1
  49. package/dist-vue/_chunks/{Agent-Dsi_xGvV.js → Agent-D3US-D1x.js} +13 -2
  50. package/dist-vue/_chunks/Agent-D3US-D1x.js.map +1 -0
  51. package/dist-vue/_chunks/{Document-B5R1PJnc.js → Document-D5FVOcP9.js} +2 -2
  52. package/dist-vue/_chunks/{Document-B5R1PJnc.js.map → Document-D5FVOcP9.js.map} +1 -1
  53. package/dist-vue/_chunks/{PkChatbot-CBpViucq.js → PkChatbot-Bwzq2vRC.js} +8 -8
  54. package/dist-vue/_chunks/{PkChatbot-CBpViucq.js.map → PkChatbot-Bwzq2vRC.js.map} +1 -1
  55. package/dist-vue/_chunks/{PkChatbotEmptyState-DKrmLdVU.js → PkChatbotEmptyState-3VeE3lFA.js} +2 -2
  56. package/dist-vue/_chunks/{PkChatbotEmptyState-DKrmLdVU.js.map → PkChatbotEmptyState-3VeE3lFA.js.map} +1 -1
  57. package/dist-vue/_chunks/{PkChatbotInput-C1i14Ur_.js → PkChatbotInput-SWQVz3m7.js} +212 -175
  58. package/dist-vue/_chunks/PkChatbotInput-SWQVz3m7.js.map +1 -0
  59. package/dist-vue/_chunks/{PkChatbotMessages-Ce8h0QNX.js → PkChatbotMessages-3hraizdN.js} +123 -115
  60. package/dist-vue/_chunks/PkChatbotMessages-3hraizdN.js.map +1 -0
  61. package/dist-vue/_chunks/{PkChatbotStepPayload-Dp_akrQu.js → PkChatbotStepPayload-Di0FNaTC.js} +2 -2
  62. package/dist-vue/_chunks/{PkChatbotStepPayload-Dp_akrQu.js.map → PkChatbotStepPayload-Di0FNaTC.js.map} +1 -1
  63. package/dist-vue/_chunks/{PkChatbotStepToolDetail-CKxl4_lQ.js → PkChatbotStepToolDetail-Bne48uS8.js} +3 -3
  64. package/dist-vue/_chunks/{PkChatbotStepToolDetail-CKxl4_lQ.js.map → PkChatbotStepToolDetail-Bne48uS8.js.map} +1 -1
  65. package/dist-vue/_chunks/{PkChatbotSteps-ChaHkHjG.js → PkChatbotSteps-Cr9nwMQj.js} +5 -5
  66. package/dist-vue/_chunks/{PkChatbotSteps-ChaHkHjG.js.map → PkChatbotSteps-Cr9nwMQj.js.map} +1 -1
  67. package/dist-vue/_chunks/{PkChatbotViewChat-Bjw6x7VD.js → PkChatbotViewChat-BSRRz4ma.js} +417 -404
  68. package/dist-vue/_chunks/PkChatbotViewChat-BSRRz4ma.js.map +1 -0
  69. package/dist-vue/_chunks/{PkChatbotViewConversations-D-UK4paq.js → PkChatbotViewConversations-Bng-dyqd.js} +3 -3
  70. package/dist-vue/_chunks/{PkChatbotViewConversations-D-UK4paq.js.map → PkChatbotViewConversations-Bng-dyqd.js.map} +1 -1
  71. package/dist-vue/_chunks/{PkChatbotViewFiles-57kQRbZm.js → PkChatbotViewFiles-Ccti1JAS.js} +3 -3
  72. package/dist-vue/_chunks/{PkChatbotViewFiles-57kQRbZm.js.map → PkChatbotViewFiles-Ccti1JAS.js.map} +1 -1
  73. package/dist-vue/_chunks/{PkChatbotViewProfile-BZTify2Q.js → PkChatbotViewProfile-ChEItAHZ.js} +2 -2
  74. package/dist-vue/_chunks/{PkChatbotViewProfile-BZTify2Q.js.map → PkChatbotViewProfile-ChEItAHZ.js.map} +1 -1
  75. package/dist-vue/_chunks/{PkStreamingMarkdown-4Ez-DDFq.js → PkStreamingMarkdown-92GXUXrG.js} +3 -3
  76. package/dist-vue/_chunks/{PkStreamingMarkdown-4Ez-DDFq.js.map → PkStreamingMarkdown-92GXUXrG.js.map} +1 -1
  77. package/dist-vue/_chunks/{PkToolChatFile-DaivFIhK.js → PkToolChatFile-Ca45de6q.js} +2 -2
  78. package/dist-vue/_chunks/{PkToolChatFile-DaivFIhK.js.map → PkToolChatFile-Ca45de6q.js.map} +1 -1
  79. package/dist-vue/_chunks/{PkToolRequestGeolocation-B__wk6m3.js → PkToolRequestGeolocation-gEDbmudT.js} +2 -2
  80. package/dist-vue/_chunks/{PkToolRequestGeolocation-B__wk6m3.js.map → PkToolRequestGeolocation-gEDbmudT.js.map} +1 -1
  81. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BAttadSC.js → PkToolRequestOAuthConnection-Dy0GXNwC.js} +2 -2
  82. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BAttadSC.js.map → PkToolRequestOAuthConnection-Dy0GXNwC.js.map} +1 -1
  83. package/dist-vue/_chunks/{PkToolShareDocument-IreRCu-j.js → PkToolShareDocument-DeUo345m.js} +2 -2
  84. package/dist-vue/_chunks/PkToolShareDocument-DeUo345m.js.map +1 -0
  85. package/dist-vue/_chunks/{PkToolShowArtifact-CncSr7Z8.js → PkToolShowArtifact-B-BUIMju.js} +2 -2
  86. package/dist-vue/_chunks/{PkToolShowArtifact-CncSr7Z8.js.map → PkToolShowArtifact-B-BUIMju.js.map} +1 -1
  87. package/dist-vue/_chunks/{PkToolShowContactForm-Bi5N1fFe.js → PkToolShowContactForm-NRfvmPLV.js} +2 -2
  88. package/dist-vue/_chunks/{PkToolShowContactForm-Bi5N1fFe.js.map → PkToolShowContactForm-NRfvmPLV.js.map} +1 -1
  89. package/dist-vue/_chunks/{PkToolShowDiagram-D8NF9lZu.js → PkToolShowDiagram-VTi8vwcN.js} +2 -2
  90. package/dist-vue/_chunks/{PkToolShowDiagram-D8NF9lZu.js.map → PkToolShowDiagram-VTi8vwcN.js.map} +1 -1
  91. package/dist-vue/_chunks/{PkToolShowForm-Dmyn6cMU.js → PkToolShowForm-C4JnalBU.js} +4 -4
  92. package/dist-vue/_chunks/{PkToolShowForm-Dmyn6cMU.js.map → PkToolShowForm-C4JnalBU.js.map} +1 -1
  93. package/dist-vue/_chunks/{PkToolShowImageGallery-XZiRk6FK.js → PkToolShowImageGallery-ORfqyhhh.js} +2 -2
  94. package/dist-vue/_chunks/{PkToolShowImageGallery-XZiRk6FK.js.map → PkToolShowImageGallery-ORfqyhhh.js.map} +1 -1
  95. package/dist-vue/_chunks/{PkToolShowProductList-DzvPUdbo.js → PkToolShowProductList-C9kbfutK.js} +2 -2
  96. package/dist-vue/_chunks/{PkToolShowProductList-DzvPUdbo.js.map → PkToolShowProductList-C9kbfutK.js.map} +1 -1
  97. package/dist-vue/_chunks/{PkToolShowSources-NOSBkQCi.js → PkToolShowSources-BVfcp1iE.js} +3 -3
  98. package/dist-vue/_chunks/{PkToolShowSources-NOSBkQCi.js.map → PkToolShowSources-BVfcp1iE.js.map} +1 -1
  99. package/dist-vue/_chunks/{PkToolShowSuggestedReply-C7dUB3dz.js → PkToolShowSuggestedReply-Bb7Inxa4.js} +2 -2
  100. package/dist-vue/_chunks/{PkToolShowSuggestedReply-C7dUB3dz.js.map → PkToolShowSuggestedReply-Bb7Inxa4.js.map} +1 -1
  101. package/dist-vue/_chunks/{PkToolShowVideo-sSZyISJH.js → PkToolShowVideo-CUNITpHh.js} +2 -2
  102. package/dist-vue/_chunks/{PkToolShowVideo-sSZyISJH.js.map → PkToolShowVideo-CUNITpHh.js.map} +1 -1
  103. package/dist-vue/_chunks/{PkToolShowWebPages-B1c4X_cH.js → PkToolShowWebPages-C-yl2smm.js} +2 -2
  104. package/dist-vue/_chunks/{PkToolShowWebPages-B1c4X_cH.js.map → PkToolShowWebPages-C-yl2smm.js.map} +1 -1
  105. package/dist-vue/_chunks/{createChatbotApiClient-BmBo5IQR.js → createChatbotApiClient-CuqGJGHD.js} +2 -2
  106. package/dist-vue/_chunks/createChatbotApiClient-CuqGJGHD.js.map +1 -0
  107. package/dist-vue/_chunks/{useChatbotStore-D7ZMA7Tr.js → useChatbotStore-C1lW6qXE.js} +1143 -1134
  108. package/dist-vue/_chunks/useChatbotStore-C1lW6qXE.js.map +1 -0
  109. package/dist-vue/_chunks/{utils-CKsn0vxx.js → utils-CoLdYTZq.js} +2 -2
  110. package/dist-vue/_chunks/{utils-CKsn0vxx.js.map → utils-CoLdYTZq.js.map} +1 -1
  111. package/dist-vue/api.js +1 -1
  112. package/dist-vue/apps/web-component/src/components/EmbeddedChatWidget.ce.d.ts +4 -4
  113. package/dist-vue/apps/web-component/src/composables/useChatbotAgent.d.ts +2 -0
  114. package/dist-vue/apps/web-component/src/composables/useChatbotAuth.d.ts +3 -3
  115. package/dist-vue/apps/web-component/src/composables/usePagePointer.d.ts +50 -0
  116. package/dist-vue/apps/web-component/src/composables/usePageTools.d.ts +21 -0
  117. package/dist-vue/apps/web-component/src/pageTools/index.d.ts +8 -1
  118. package/dist-vue/apps/web-component/src/pageTools/pointing.d.ts +41 -0
  119. package/dist-vue/apps/web-component/src/pageTools/snapshot.d.ts +2 -0
  120. package/dist-vue/composables.js +24 -8
  121. package/dist-vue/composables.js.map +1 -1
  122. package/dist-vue/index.js +48 -31
  123. package/dist-vue/index.js.map +1 -1
  124. package/dist-vue/locales.js +20 -0
  125. package/dist-vue/packages/components/src/chat/PkAgentPageAccessSettings.d.ts +2 -0
  126. package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +2 -0
  127. package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +16 -3
  128. package/dist-vue/packages/components/src/chat/PkPagePointer.d.ts +41 -0
  129. package/dist-vue/packages/components/src/chat/PkToolShareDocument.d.ts +4 -3
  130. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +150 -6
  131. package/dist-vue/packages/models/src/schema/Agent.d.ts +7 -0
  132. package/dist-vue/packages/models/src/schema/Chat.d.ts +8 -0
  133. package/dist-vue/packages/models/src/schema/PageAccess.d.ts +29 -1
  134. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +2 -0
  135. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +2 -0
  136. package/dist-vue/style.css +1 -1
  137. package/package.json +1 -1
  138. package/dist/_chunks/Agent-C0JtGK2t.js.map +0 -1
  139. package/dist/_chunks/PkToolShareDocument-CFGH4rKt.js.map +0 -1
  140. package/dist-vue/_chunks/Agent-Dsi_xGvV.js.map +0 -1
  141. package/dist-vue/_chunks/PkChatbotInput-C1i14Ur_.js.map +0 -1
  142. package/dist-vue/_chunks/PkChatbotMessages-Ce8h0QNX.js.map +0 -1
  143. package/dist-vue/_chunks/PkChatbotViewChat-Bjw6x7VD.js.map +0 -1
  144. package/dist-vue/_chunks/PkToolShareDocument-IreRCu-j.js.map +0 -1
  145. package/dist-vue/_chunks/createChatbotApiClient-BmBo5IQR.js.map +0 -1
  146. package/dist-vue/_chunks/useChatbotStore-D7ZMA7Tr.js.map +0 -1
@@ -1,10 +1,10 @@
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-BO5QlXAp.js";
2
- import { $ as y, B as b, G as ee, Q as te, W as ne, Y as re, et as ie, q as ae } from "./Agent-Dsi_xGvV.js";
3
- import { r as oe, t as se } from "./createChatbotApiClient-BmBo5IQR.js";
4
- import { n as ce } from "./src-j7iLdNe4.js";
5
- import { d as le, r as ue } from "./message-DuibQyHy.js";
6
- import { n as de, t as fe } from "./useSafeLocalStorage-DImmddot.js";
7
- import { computed as x, getCurrentScope as pe, isReadonly as me, nextTick as he, onScopeDispose as ge, reactive as _e, ref as S, shallowRef as ve, toRefs as ye, toValue as be, watch as C, watchEffect as xe } from "vue";
2
+ import { $ as ee, B as y, G as te, Q as ne, W as re, Y as ie, et as ae, q as oe } from "./Agent-D3US-D1x.js";
3
+ import { r as se, t as ce } from "./createChatbotApiClient-CuqGJGHD.js";
4
+ import { n as le } from "./src-j7iLdNe4.js";
5
+ import { d as ue, r as de } from "./message-DuibQyHy.js";
6
+ import { n as fe, t as pe } from "./useSafeLocalStorage-DImmddot.js";
7
+ import { computed as b, getCurrentScope as me, isReadonly as he, nextTick as ge, onScopeDispose as _e, reactive as ve, ref as x, shallowRef as S, toRefs as ye, toValue as be, watch as C, watchEffect as xe } from "vue";
8
8
  import { useI18n as Se } from "vue-i18n";
9
9
  import { useDocumentVisibility as Ce, usePreferredDark as we } from "@vueuse/core";
10
10
  import { defineStore as Te } from "pinia";
@@ -57,9 +57,9 @@ async function De(e) {
57
57
  }
58
58
  }
59
59
  // ../../packages/composable/src/chatbot/hostTools.ts
60
- var Oe = "agentstudio:page-navigation", ke = (e) => typeof e?.afterOutput == "function", Ae = (e) => e.toolMetadata?.source === te, je = (e, t) => {
60
+ var Oe = "agentstudio:page-navigation", ke = (e) => typeof e?.afterOutput == "function", Ae = (e) => e.toolMetadata?.source === ne, je = (e, t) => {
61
61
  if (!t || !e?.length) return;
62
- let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !ae(e.name)).map(({ execute: e, confirmation: t, policy: n, ...r }) => r);
62
+ let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !oe(e.name)).map(({ execute: e, confirmation: t, policy: n, ...r }) => r);
63
63
  return r.length > 0 ? r : void 0;
64
64
  };
65
65
  function Me(e) {
@@ -80,7 +80,7 @@ function Me(e) {
80
80
  async function d(n, r) {
81
81
  let i = () => r === t, d = e.capability(), f = e.registry()?.find((e) => e.name === n.toolName), p = f?.policy?.timeoutMs ?? d?.timeoutMs;
82
82
  if (!f || p === void 0) {
83
- u(n, y(n.readOnly));
83
+ u(n, ee(n.readOnly));
84
84
  return;
85
85
  }
86
86
  let m;
@@ -129,7 +129,7 @@ function Me(e) {
129
129
  } catch (e) {
130
130
  if (v?.then(s, () => void 0), !i()) return;
131
131
  let t = g.signal.aborted;
132
- u(n, t ? y(n.readOnly) : e instanceof Error && e.message ? e.message : "The host app failed to run this call.");
132
+ u(n, t ? ee(n.readOnly) : e instanceof Error && e.message ? e.message : "The host app failed to run this call.");
133
133
  } finally {
134
134
  clearTimeout(_), a.delete(n.toolCallId), e.onActivity?.(void 0);
135
135
  }
@@ -172,43 +172,43 @@ var Ne = "vercel.ai.error", Pe = Symbol.for(Ne), w = class e extends Error {
172
172
  static isInstance(e) {
173
173
  return w.hasMarker(e, Ie);
174
174
  }
175
- }, ze = "AI_EmptyResponseBodyError", T = `vercel.ai.error.${ze}`, Be = Symbol.for(T), Ve = class extends w {
175
+ }, ze = "AI_EmptyResponseBodyError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.for(Be), He = class extends w {
176
176
  constructor({ message: e = "Empty response body" } = {}) {
177
177
  super({
178
178
  name: ze,
179
179
  message: e
180
- }), this[Be] = !0;
180
+ }), this[Ve] = !0;
181
181
  }
182
182
  static isInstance(e) {
183
- return w.hasMarker(e, T);
183
+ return w.hasMarker(e, Be);
184
184
  }
185
185
  };
186
- function E(e) {
186
+ function T(e) {
187
187
  return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
188
188
  }
189
- var He = "AI_InvalidArgumentError", Ue = `vercel.ai.error.${He}`, We = Symbol.for(Ue), Ge = class extends w {
189
+ var Ue = "AI_InvalidArgumentError", We = `vercel.ai.error.${Ue}`, E = Symbol.for(We), Ge = class extends w {
190
190
  constructor({ message: e, cause: t, argument: n }) {
191
191
  super({
192
- name: He,
192
+ name: Ue,
193
193
  message: e,
194
194
  cause: t
195
- }), this[We] = !0, this.argument = n;
195
+ }), this[E] = !0, this.argument = n;
196
196
  }
197
197
  static isInstance(e) {
198
- return w.hasMarker(e, Ue);
198
+ return w.hasMarker(e, We);
199
199
  }
200
- }, Ke = "AI_JSONParseError", qe = `vercel.ai.error.${Ke}`, Je = Symbol.for(qe), Ye = class extends w {
200
+ }, D = "AI_JSONParseError", Ke = `vercel.ai.error.${D}`, qe = Symbol.for(Ke), Je = class extends w {
201
201
  constructor({ text: e, cause: t }) {
202
202
  super({
203
- name: Ke,
204
- message: `JSON parsing failed: Text: ${e}.\nError message: ${E(t)}`,
203
+ name: D,
204
+ message: `JSON parsing failed: Text: ${e}.\nError message: ${T(t)}`,
205
205
  cause: t
206
- }), this[Je] = !0, this.text = e;
206
+ }), this[qe] = !0, this.text = e;
207
207
  }
208
208
  static isInstance(e) {
209
- return w.hasMarker(e, qe);
209
+ return w.hasMarker(e, Ke);
210
210
  }
211
- }, Xe = "AI_TypeValidationError", Ze = `vercel.ai.error.${Xe}`, Qe = Symbol.for(Ze), $e = class e extends w {
211
+ }, Ye = "AI_TypeValidationError", Xe = `vercel.ai.error.${Ye}`, Ze = Symbol.for(Xe), O = class e extends w {
212
212
  constructor({ value: e, cause: t, context: n }) {
213
213
  let r = "Type validation failed";
214
214
  if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
@@ -217,13 +217,13 @@ var He = "AI_InvalidArgumentError", Ue = `vercel.ai.error.${He}`, We = Symbol.fo
217
217
  n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
218
218
  }
219
219
  super({
220
- name: Xe,
221
- message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${E(t)}`,
220
+ name: Ye,
221
+ message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${T(t)}`,
222
222
  cause: t
223
- }), this[Qe] = !0, this.value = e, this.context = n;
223
+ }), this[Ze] = !0, this.value = e, this.context = n;
224
224
  }
225
225
  static isInstance(e) {
226
- return w.hasMarker(e, Ze);
226
+ return w.hasMarker(e, Xe);
227
227
  }
228
228
  static wrap({ value: t, cause: n, context: r }) {
229
229
  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({
@@ -232,25 +232,25 @@ var He = "AI_InvalidArgumentError", Ue = `vercel.ai.error.${He}`, We = Symbol.fo
232
232
  context: r
233
233
  });
234
234
  }
235
- }, D = "AI_UnsupportedFunctionalityError", et = `vercel.ai.error.${D}`, tt = Symbol.for(et), nt = class extends w {
235
+ }, Qe = "AI_UnsupportedFunctionalityError", $e = `vercel.ai.error.${Qe}`, et = Symbol.for($e), tt = class extends w {
236
236
  constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
237
237
  super({
238
- name: D,
238
+ name: Qe,
239
239
  message: t
240
- }), this[tt] = !0, this.functionality = e;
240
+ }), this[et] = !0, this.functionality = e;
241
241
  }
242
242
  static isInstance(e) {
243
- return w.hasMarker(e, et);
243
+ return w.hasMarker(e, $e);
244
244
  }
245
- }, O = class extends Error {
245
+ }, k = class extends Error {
246
246
  constructor(e, t) {
247
247
  super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
248
248
  }
249
- }, rt = 10, it = 13, k = 32;
250
- function at(e) {}
251
- function ot(e) {
249
+ }, nt = 10, rt = 13, it = 32;
250
+ function A(e) {}
251
+ function at(e) {
252
252
  if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
253
- let { onEvent: t = at, onError: n = at, onRetry: r = at, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
253
+ let { onEvent: t = A, onError: n = A, onRetry: r = A, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
254
254
  function m(e) {
255
255
  if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
256
256
  if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
@@ -269,7 +269,7 @@ function ot(e) {
269
269
  n !== "" && (o.push(n), s = n.length), h();
270
270
  }
271
271
  function h() {
272
- 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 O(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
272
+ 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 k(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
273
273
  }
274
274
  function g(e) {
275
275
  let n = 0;
@@ -285,9 +285,9 @@ function ot(e) {
285
285
  continue;
286
286
  }
287
287
  let i = e.charCodeAt(n);
288
- if (A(e, n, i)) {
289
- let i = e.charCodeAt(n + 5) === k ? n + 6 : n + 5, a = e.slice(i, r);
290
- if (d === 0 && e.charCodeAt(r + 1) === rt) {
288
+ if (ot(e, n, i)) {
289
+ let i = e.charCodeAt(n + 5) === it ? n + 6 : n + 5, a = e.slice(i, r);
290
+ if (d === 0 && e.charCodeAt(r + 1) === nt) {
291
291
  t({
292
292
  id: l,
293
293
  event: f,
@@ -297,7 +297,7 @@ function ot(e) {
297
297
  }
298
298
  u = d === 0 ? a : `${u}
299
299
  ${a}`, d++;
300
- } else st(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === k ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
300
+ } else st(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === it ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
301
301
  n = r + 1, r = e.indexOf("\n", n);
302
302
  }
303
303
  return e.slice(n);
@@ -305,35 +305,35 @@ ${a}`, d++;
305
305
  for (; n < e.length;) {
306
306
  let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
307
307
  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;
308
- _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === it && e.charCodeAt(n) === rt && n++;
308
+ _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === rt && e.charCodeAt(n) === nt && n++;
309
309
  }
310
310
  return e.slice(n);
311
311
  }
312
312
  function _(e, t, n) {
313
313
  if (t === n) {
314
- y();
314
+ ee();
315
315
  return;
316
316
  }
317
317
  let r = e.charCodeAt(t);
318
- if (A(e, t, r)) {
319
- let r = e.charCodeAt(t + 5) === k ? t + 6 : t + 5, i = e.slice(r, n);
318
+ if (ot(e, t, r)) {
319
+ let r = e.charCodeAt(t + 5) === it ? t + 6 : t + 5, i = e.slice(r, n);
320
320
  u = d === 0 ? i : `${u}
321
321
  ${i}`, d++;
322
322
  return;
323
323
  }
324
324
  if (st(e, t, r)) {
325
- f = e.slice(e.charCodeAt(t + 6) === k ? t + 7 : t + 6, n) || void 0;
325
+ f = e.slice(e.charCodeAt(t + 6) === it ? t + 7 : t + 6, n) || void 0;
326
326
  return;
327
327
  }
328
328
  if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
329
- let r = e.slice(e.charCodeAt(t + 3) === k ? t + 4 : t + 3, n);
329
+ let r = e.slice(e.charCodeAt(t + 3) === it ? t + 4 : t + 3, n);
330
330
  l = r.includes("\0") ? void 0 : r;
331
331
  return;
332
332
  }
333
333
  if (r === 58) {
334
334
  if (i) {
335
335
  let r = e.slice(t, n);
336
- i(r.slice(e.charCodeAt(t + 1) === k ? 2 : 1));
336
+ i(r.slice(e.charCodeAt(t + 1) === it ? 2 : 1));
337
337
  }
338
338
  return;
339
339
  }
@@ -342,7 +342,7 @@ ${i}`, d++;
342
342
  v(a, "", a);
343
343
  return;
344
344
  }
345
- let s = a.slice(0, o), c = a.charCodeAt(o + 1) === k ? 2 : 1;
345
+ let s = a.slice(0, o), c = a.charCodeAt(o + 1) === it ? 2 : 1;
346
346
  v(s, a.slice(o + c), a);
347
347
  }
348
348
  function v(e, t, i) {
@@ -358,13 +358,13 @@ ${t}`, d++;
358
358
  l = t.includes("\0") ? void 0 : t;
359
359
  break;
360
360
  case "retry":
361
- /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new O(`Invalid \`retry\` value: "${t}"`, {
361
+ /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new k(`Invalid \`retry\` value: "${t}"`, {
362
362
  type: "invalid-retry",
363
363
  value: t,
364
364
  line: i
365
365
  }));
366
366
  break;
367
- default: n(new O(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
367
+ default: n(new k(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
368
368
  type: "unknown-field",
369
369
  field: e,
370
370
  value: t,
@@ -372,14 +372,14 @@ ${t}`, d++;
372
372
  }));
373
373
  }
374
374
  }
375
- function y() {
375
+ function ee() {
376
376
  d > 0 && t({
377
377
  id: l,
378
378
  event: f,
379
379
  data: u
380
380
  }), l = void 0, u = "", d = 0, f = void 0;
381
381
  }
382
- function b(e = {}) {
382
+ function y(e = {}) {
383
383
  if (e.consume && o.length > 0) {
384
384
  let e = o.join("");
385
385
  _(e, 0, e.length);
@@ -388,10 +388,10 @@ ${t}`, d++;
388
388
  }
389
389
  return {
390
390
  feed: m,
391
- reset: b
391
+ reset: y
392
392
  };
393
393
  }
394
- function A(e, t, n) {
394
+ function ot(e, t, n) {
395
395
  return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
396
396
  }
397
397
  function st(e, t, n) {
@@ -403,7 +403,7 @@ var ct = class extends TransformStream {
403
403
  let i;
404
404
  super({
405
405
  start(a) {
406
- i = ot({
406
+ i = at({
407
407
  onEvent: (e) => {
408
408
  a.enqueue(e);
409
409
  },
@@ -452,11 +452,11 @@ function pt(e) {
452
452
  return globalThis.Buffer?.isBuffer(e) ?? !1;
453
453
  }
454
454
  var mt = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, ht = /"(?: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*:/;
455
- function M(e) {
455
+ function gt(e) {
456
456
  let t = JSON.parse(e);
457
- return typeof t != "object" || !t || mt.test(e) === !1 && ht.test(e) === !1 ? t : gt(t);
457
+ return typeof t != "object" || !t || mt.test(e) === !1 && ht.test(e) === !1 ? t : _t(t);
458
458
  }
459
- function gt(e) {
459
+ function _t(e) {
460
460
  let t = [e];
461
461
  for (; t.length;) {
462
462
  let e = t;
@@ -471,35 +471,35 @@ function gt(e) {
471
471
  }
472
472
  return e;
473
473
  }
474
- function _t(e) {
474
+ function vt(e) {
475
475
  let { stackTraceLimit: t } = Error;
476
476
  try {
477
477
  Error.stackTraceLimit = 0;
478
478
  } catch {
479
- return M(e);
479
+ return gt(e);
480
480
  }
481
481
  try {
482
- return M(e);
482
+ return gt(e);
483
483
  } finally {
484
484
  Error.stackTraceLimit = t;
485
485
  }
486
486
  }
487
- function vt(e) {
487
+ function yt(e) {
488
488
  if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
489
489
  let { additionalProperties: t } = e;
490
- e.additionalProperties = t != null && typeof t != "boolean" && N(t);
490
+ e.additionalProperties = t != null && typeof t != "boolean" && M(t);
491
491
  let { properties: n } = e;
492
- if (n != null) for (let e of Object.keys(n)) n[e] = N(n[e]);
492
+ if (n != null) for (let e of Object.keys(n)) n[e] = M(n[e]);
493
493
  }
494
- e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(N) : N(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(N)), e.allOf != null && (e.allOf = e.allOf.map(N)), e.oneOf != null && (e.oneOf = e.oneOf.map(N));
494
+ e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(M) : M(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(M)), e.allOf != null && (e.allOf = e.allOf.map(M)), e.oneOf != null && (e.oneOf = e.oneOf.map(M));
495
495
  let { definitions: t } = e;
496
- if (t != null) for (let e of Object.keys(t)) t[e] = N(t[e]);
496
+ if (t != null) for (let e of Object.keys(t)) t[e] = M(t[e]);
497
497
  return e;
498
498
  }
499
- function N(e) {
500
- return typeof e == "boolean" ? e : vt(e);
499
+ function M(e) {
500
+ return typeof e == "boolean" ? e : yt(e);
501
501
  }
502
- var P = Symbol("Let zodToJsonSchema decide on which parser to use"), F = {
502
+ var bt = Symbol("Let zodToJsonSchema decide on which parser to use"), xt = {
503
503
  name: void 0,
504
504
  $refStrategy: "root",
505
505
  basePath: ["#"],
@@ -519,24 +519,24 @@ var P = Symbol("Let zodToJsonSchema decide on which parser to use"), F = {
519
519
  emailStrategy: "format:email",
520
520
  base64Strategy: "contentEncoding:base64",
521
521
  nameStrategy: "ref"
522
- }, yt = (e) => typeof e == "string" ? {
523
- ...F,
522
+ }, St = (e) => typeof e == "string" ? {
523
+ ...xt,
524
524
  name: e
525
525
  } : {
526
- ...F,
526
+ ...xt,
527
527
  ...e
528
528
  };
529
- function I() {
529
+ function N() {
530
530
  return {};
531
531
  }
532
- function bt(e, t) {
532
+ function P(e, t) {
533
533
  let n = { type: "array" };
534
- return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = q(e.type._def, {
534
+ return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = G(e.type._def, {
535
535
  ...t,
536
536
  currentPath: [...t.currentPath, "items"]
537
537
  })), 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;
538
538
  }
539
- function xt(e) {
539
+ function F(e) {
540
540
  let t = {
541
541
  type: "integer",
542
542
  format: "int64"
@@ -553,16 +553,16 @@ function xt(e) {
553
553
  }
554
554
  return t;
555
555
  }
556
- function St() {
556
+ function Ct() {
557
557
  return { type: "boolean" };
558
558
  }
559
- function Ct(e, t) {
560
- return q(e.type._def, t);
559
+ function wt(e, t) {
560
+ return G(e.type._def, t);
561
561
  }
562
- var L = (e, t) => q(e.innerType._def, t);
563
- function wt(e, t, n) {
562
+ var Tt = (e, t) => G(e.innerType._def, t);
563
+ function Et(e, t, n) {
564
564
  let r = n ?? t.dateStrategy;
565
- if (Array.isArray(r)) return { anyOf: r.map((n) => wt(e, t, n)) };
565
+ if (Array.isArray(r)) return { anyOf: r.map((n) => Et(e, t, n)) };
566
566
  switch (r) {
567
567
  case "string":
568
568
  case "format:date-time": return {
@@ -573,10 +573,10 @@ function wt(e, t, n) {
573
573
  type: "string",
574
574
  format: "date"
575
575
  };
576
- case "integer": return Tt(e);
576
+ case "integer": return Dt(e);
577
577
  }
578
578
  }
579
- var Tt = (e) => {
579
+ var Dt = (e) => {
580
580
  let t = {
581
581
  type: "integer",
582
582
  format: "unix-time"
@@ -589,31 +589,31 @@ var Tt = (e) => {
589
589
  }
590
590
  return t;
591
591
  };
592
- function Et(e, t) {
592
+ function Ot(e, t) {
593
593
  return {
594
- ...q(e.innerType._def, t),
594
+ ...G(e.innerType._def, t),
595
595
  default: e.defaultValue()
596
596
  };
597
597
  }
598
- function Dt(e, t) {
599
- return t.effectStrategy === "input" ? q(e.schema._def, t) : I();
598
+ function I(e, t) {
599
+ return t.effectStrategy === "input" ? G(e.schema._def, t) : N();
600
600
  }
601
- function Ot(e) {
601
+ function kt(e) {
602
602
  return {
603
603
  type: "string",
604
604
  enum: Array.from(e.values)
605
605
  };
606
606
  }
607
- var kt = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
608
- function R(e, t) {
609
- let n = [q(e.left._def, {
607
+ var At = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
608
+ function jt(e, t) {
609
+ let n = [G(e.left._def, {
610
610
  ...t,
611
611
  currentPath: [
612
612
  ...t.currentPath,
613
613
  "allOf",
614
614
  "0"
615
615
  ]
616
- }), q(e.right._def, {
616
+ }), G(e.right._def, {
617
617
  ...t,
618
618
  currentPath: [
619
619
  ...t.currentPath,
@@ -622,7 +622,7 @@ function R(e, t) {
622
622
  ]
623
623
  })].filter((e) => !!e), r = [];
624
624
  return n.forEach((e) => {
625
- if (kt(e)) r.push(...e.allOf);
625
+ if (At(e)) r.push(...e.allOf);
626
626
  else {
627
627
  let t = e;
628
628
  if ("additionalProperties" in e && e.additionalProperties === !1) {
@@ -633,19 +633,19 @@ function R(e, t) {
633
633
  }
634
634
  }), r.length ? { allOf: r } : void 0;
635
635
  }
636
- function At(e) {
636
+ function Mt(e) {
637
637
  let t = typeof e.value;
638
638
  return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
639
639
  type: t === "bigint" ? "integer" : t,
640
640
  const: e.value
641
641
  };
642
642
  }
643
- var z = void 0, B = {
643
+ var Nt = void 0, L = {
644
644
  cuid: /^[cC][^\s-]{8,}$/,
645
645
  cuid2: /^[0-9a-z]+$/,
646
646
  ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
647
647
  email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
648
- emoji: () => (z === void 0 && (z = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), z),
648
+ emoji: () => (Nt === void 0 && (Nt = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), Nt),
649
649
  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}$/,
650
650
  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])$/,
651
651
  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])$/,
@@ -656,7 +656,7 @@ var z = void 0, B = {
656
656
  nanoid: /^[a-zA-Z0-9_-]{21}$/,
657
657
  jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
658
658
  };
659
- function jt(e, t) {
659
+ function R(e, t) {
660
660
  let n = { type: "string" };
661
661
  if (e.checks) for (let r of e.checks) switch (r.kind) {
662
662
  case "min":
@@ -668,108 +668,108 @@ function jt(e, t) {
668
668
  case "email":
669
669
  switch (t.emailStrategy) {
670
670
  case "format:email":
671
- H(n, "email", r.message, t);
671
+ z(n, "email", r.message, t);
672
672
  break;
673
673
  case "format:idn-email":
674
- H(n, "idn-email", r.message, t);
674
+ z(n, "idn-email", r.message, t);
675
675
  break;
676
- case "pattern:zod": U(n, B.email, r.message, t);
676
+ case "pattern:zod": B(n, L.email, r.message, t);
677
677
  }
678
678
  break;
679
679
  case "url":
680
- H(n, "uri", r.message, t);
680
+ z(n, "uri", r.message, t);
681
681
  break;
682
682
  case "uuid":
683
- H(n, "uuid", r.message, t);
683
+ z(n, "uuid", r.message, t);
684
684
  break;
685
685
  case "regex":
686
- U(n, r.regex, r.message, t);
686
+ B(n, r.regex, r.message, t);
687
687
  break;
688
688
  case "cuid":
689
- U(n, B.cuid, r.message, t);
689
+ B(n, L.cuid, r.message, t);
690
690
  break;
691
691
  case "cuid2":
692
- U(n, B.cuid2, r.message, t);
692
+ B(n, L.cuid2, r.message, t);
693
693
  break;
694
694
  case "startsWith":
695
- U(n, RegExp(`^${Mt(r.value, t)}`), r.message, t);
695
+ B(n, RegExp(`^${Pt(r.value, t)}`), r.message, t);
696
696
  break;
697
697
  case "endsWith":
698
- U(n, RegExp(`${Mt(r.value, t)}$`), r.message, t);
698
+ B(n, RegExp(`${Pt(r.value, t)}$`), r.message, t);
699
699
  break;
700
700
  case "datetime":
701
- H(n, "date-time", r.message, t);
701
+ z(n, "date-time", r.message, t);
702
702
  break;
703
703
  case "date":
704
- H(n, "date", r.message, t);
704
+ z(n, "date", r.message, t);
705
705
  break;
706
706
  case "time":
707
- H(n, "time", r.message, t);
707
+ z(n, "time", r.message, t);
708
708
  break;
709
709
  case "duration":
710
- H(n, "duration", r.message, t);
710
+ z(n, "duration", r.message, t);
711
711
  break;
712
712
  case "length":
713
713
  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;
714
714
  break;
715
715
  case "includes":
716
- U(n, RegExp(Mt(r.value, t)), r.message, t);
716
+ B(n, RegExp(Pt(r.value, t)), r.message, t);
717
717
  break;
718
718
  case "ip":
719
- r.version !== "v6" && H(n, "ipv4", r.message, t), r.version !== "v4" && H(n, "ipv6", r.message, t);
719
+ r.version !== "v6" && z(n, "ipv4", r.message, t), r.version !== "v4" && z(n, "ipv6", r.message, t);
720
720
  break;
721
721
  case "base64url":
722
- U(n, B.base64url, r.message, t);
722
+ B(n, L.base64url, r.message, t);
723
723
  break;
724
724
  case "jwt":
725
- U(n, B.jwt, r.message, t);
725
+ B(n, L.jwt, r.message, t);
726
726
  break;
727
727
  case "cidr":
728
- r.version !== "v6" && U(n, B.ipv4Cidr, r.message, t), r.version !== "v4" && U(n, B.ipv6Cidr, r.message, t);
728
+ r.version !== "v6" && B(n, L.ipv4Cidr, r.message, t), r.version !== "v4" && B(n, L.ipv6Cidr, r.message, t);
729
729
  break;
730
730
  case "emoji":
731
- U(n, B.emoji(), r.message, t);
731
+ B(n, L.emoji(), r.message, t);
732
732
  break;
733
733
  case "ulid":
734
- U(n, B.ulid, r.message, t);
734
+ B(n, L.ulid, r.message, t);
735
735
  break;
736
736
  case "base64":
737
737
  switch (t.base64Strategy) {
738
738
  case "format:binary":
739
- H(n, "binary", r.message, t);
739
+ z(n, "binary", r.message, t);
740
740
  break;
741
741
  case "contentEncoding:base64":
742
742
  n.contentEncoding = "base64";
743
743
  break;
744
- case "pattern:zod": U(n, B.base64, r.message, t);
744
+ case "pattern:zod": B(n, L.base64, r.message, t);
745
745
  }
746
746
  break;
747
- case "nanoid": U(n, B.nanoid, r.message, t);
747
+ case "nanoid": B(n, L.nanoid, r.message, t);
748
748
  }
749
749
  return n;
750
750
  }
751
- function Mt(e, t) {
752
- return t.patternStrategy === "escape" ? Nt(e) : e;
751
+ function Pt(e, t) {
752
+ return t.patternStrategy === "escape" ? It(e) : e;
753
753
  }
754
- var V = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
755
- function Nt(e) {
754
+ var Ft = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
755
+ function It(e) {
756
756
  let t = "";
757
- for (let n = 0; n < e.length; n++) V.has(e[n]) || (t += "\\"), t += e[n];
757
+ for (let n = 0; n < e.length; n++) Ft.has(e[n]) || (t += "\\"), t += e[n];
758
758
  return t;
759
759
  }
760
- function H(e, t, n, r) {
760
+ function z(e, t, n, r) {
761
761
  e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
762
762
  format: t,
763
763
  ...n && r.errorMessages && { errorMessage: { format: n } }
764
764
  })) : e.format = t;
765
765
  }
766
- function U(e, t, n, r) {
766
+ function B(e, t, n, r) {
767
767
  e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
768
- pattern: Pt(t, r),
768
+ pattern: V(t, r),
769
769
  ...n && r.errorMessages && { errorMessage: { pattern: n } }
770
- })) : e.pattern = Pt(t, r);
770
+ })) : e.pattern = V(t, r);
771
771
  }
772
- function Pt(e, t) {
772
+ function V(e, t) {
773
773
  if (!t.applyRegexFlags || !e.flags) return e.source;
774
774
  let n = {
775
775
  i: e.flags.includes("i"),
@@ -808,16 +808,16 @@ function Pt(e, t) {
808
808
  }
809
809
  return i;
810
810
  }
811
- function Ft(e, t) {
811
+ function Lt(e, t) {
812
812
  let n = {
813
813
  type: "object",
814
- additionalProperties: q(e.valueType._def, {
814
+ additionalProperties: G(e.valueType._def, {
815
815
  ...t,
816
816
  currentPath: [...t.currentPath, "additionalProperties"]
817
817
  }) ?? t.allowedAdditionalProperties
818
818
  };
819
819
  if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
820
- let { type: r, ...i } = jt(e.keyType._def, t);
820
+ let { type: r, ...i } = R(e.keyType._def, t);
821
821
  return {
822
822
  ...n,
823
823
  propertyNames: i
@@ -828,7 +828,7 @@ function Ft(e, t) {
828
828
  propertyNames: { enum: e.keyType._def.values }
829
829
  };
830
830
  if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
831
- let { type: r, ...i } = Ct(e.keyType._def, t);
831
+ let { type: r, ...i } = wt(e.keyType._def, t);
832
832
  return {
833
833
  ...n,
834
834
  propertyNames: i
@@ -836,13 +836,13 @@ function Ft(e, t) {
836
836
  }
837
837
  return n;
838
838
  }
839
- function It(e, t) {
840
- return t.mapStrategy === "record" ? Ft(e, t) : {
839
+ function Rt(e, t) {
840
+ return t.mapStrategy === "record" ? Lt(e, t) : {
841
841
  type: "array",
842
842
  maxItems: 125,
843
843
  items: {
844
844
  type: "array",
845
- items: [q(e.keyType._def, {
845
+ items: [G(e.keyType._def, {
846
846
  ...t,
847
847
  currentPath: [
848
848
  ...t.currentPath,
@@ -850,7 +850,7 @@ function It(e, t) {
850
850
  "items",
851
851
  "0"
852
852
  ]
853
- }) || I(), q(e.valueType._def, {
853
+ }) || N(), G(e.valueType._def, {
854
854
  ...t,
855
855
  currentPath: [
856
856
  ...t.currentPath,
@@ -858,37 +858,37 @@ function It(e, t) {
858
858
  "items",
859
859
  "1"
860
860
  ]
861
- }) || I()],
861
+ }) || N()],
862
862
  minItems: 2,
863
863
  maxItems: 2
864
864
  }
865
865
  };
866
866
  }
867
- function Lt(e) {
867
+ function zt(e) {
868
868
  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)));
869
869
  return {
870
870
  type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
871
871
  enum: n
872
872
  };
873
873
  }
874
- function Rt() {
875
- return { not: I() };
874
+ function Bt() {
875
+ return { not: N() };
876
876
  }
877
- function zt() {
877
+ function Vt() {
878
878
  return { type: "null" };
879
879
  }
880
- var Bt = {
880
+ var Ht = {
881
881
  ZodString: "string",
882
882
  ZodNumber: "number",
883
883
  ZodBigInt: "integer",
884
884
  ZodBoolean: "boolean",
885
885
  ZodNull: "null"
886
886
  };
887
- function Vt(e, t) {
887
+ function Ut(e, t) {
888
888
  let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
889
- if (n.every((e) => e._def.typeName in Bt && (!e._def.checks || !e._def.checks.length))) {
889
+ if (n.every((e) => e._def.typeName in Ht && (!e._def.checks || !e._def.checks.length))) {
890
890
  let e = n.reduce((e, t) => {
891
- let n = Bt[t._def.typeName];
891
+ let n = Ht[t._def.typeName];
892
892
  return n && !e.includes(n) ? [...e, n] : e;
893
893
  }, []);
894
894
  return { type: e.length > 1 ? e : e[0] };
@@ -916,10 +916,10 @@ function Vt(e, t) {
916
916
  type: "string",
917
917
  enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
918
918
  };
919
- return W(e, t);
919
+ return Wt(e, t);
920
920
  }
921
- var W = (e, t) => {
922
- let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => q(e._def, {
921
+ var Wt = (e, t) => {
922
+ let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => G(e._def, {
923
923
  ...t,
924
924
  currentPath: [
925
925
  ...t.currentPath,
@@ -929,15 +929,15 @@ var W = (e, t) => {
929
929
  })).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
930
930
  return n.length ? { anyOf: n } : void 0;
931
931
  };
932
- function G(e, t) {
932
+ function Gt(e, t) {
933
933
  if ([
934
934
  "ZodString",
935
935
  "ZodNumber",
936
936
  "ZodBigInt",
937
937
  "ZodBoolean",
938
938
  "ZodNull"
939
- ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Bt[e.innerType._def.typeName], "null"] };
940
- let n = q(e.innerType._def, {
939
+ ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Ht[e.innerType._def.typeName], "null"] };
940
+ let n = G(e.innerType._def, {
941
941
  ...t,
942
942
  currentPath: [
943
943
  ...t.currentPath,
@@ -947,7 +947,7 @@ function G(e, t) {
947
947
  });
948
948
  return n && { anyOf: [n, { type: "null" }] };
949
949
  }
950
- function K(e) {
950
+ function Kt(e) {
951
951
  let t = { type: "number" };
952
952
  if (!e.checks) return t;
953
953
  for (let n of e.checks) switch (n.kind) {
@@ -964,7 +964,7 @@ function K(e) {
964
964
  }
965
965
  return t;
966
966
  }
967
- function Ht(e, t) {
967
+ function qt(e, t) {
968
968
  let n = {
969
969
  type: "object",
970
970
  properties: {}
@@ -972,7 +972,7 @@ function Ht(e, t) {
972
972
  for (let e in i) {
973
973
  let a = i[e];
974
974
  if (a === void 0 || a._def === void 0) continue;
975
- let o = Wt(a), s = q(a._def, {
975
+ let o = U(a), s = G(a._def, {
976
976
  ...t,
977
977
  currentPath: [
978
978
  ...t.currentPath,
@@ -988,11 +988,11 @@ function Ht(e, t) {
988
988
  s !== void 0 && (n.properties[e] = s, o || r.push(e));
989
989
  }
990
990
  r.length && (n.required = r);
991
- let a = Ut(e, t);
991
+ let a = H(e, t);
992
992
  return a !== void 0 && (n.additionalProperties = a), n;
993
993
  }
994
- function Ut(e, t) {
995
- if (e.catchall._def.typeName !== "ZodNever") return q(e.catchall._def, {
994
+ function H(e, t) {
995
+ if (e.catchall._def.typeName !== "ZodNever") return G(e.catchall._def, {
996
996
  ...t,
997
997
  currentPath: [...t.currentPath, "additionalProperties"]
998
998
  });
@@ -1002,16 +1002,16 @@ function Ut(e, t) {
1002
1002
  case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
1003
1003
  }
1004
1004
  }
1005
- function Wt(e) {
1005
+ function U(e) {
1006
1006
  try {
1007
1007
  return e.isOptional();
1008
1008
  } catch {
1009
1009
  return !0;
1010
1010
  }
1011
1011
  }
1012
- var Gt = (e, t) => {
1013
- if (t.currentPath.toString() === t.propertyPath?.toString()) return q(e.innerType._def, t);
1014
- let n = q(e.innerType._def, {
1012
+ var W = (e, t) => {
1013
+ if (t.currentPath.toString() === t.propertyPath?.toString()) return G(e.innerType._def, t);
1014
+ let n = G(e.innerType._def, {
1015
1015
  ...t,
1016
1016
  currentPath: [
1017
1017
  ...t.currentPath,
@@ -1019,11 +1019,11 @@ var Gt = (e, t) => {
1019
1019
  "1"
1020
1020
  ]
1021
1021
  });
1022
- return n ? { anyOf: [{ not: I() }, n] } : I();
1023
- }, Kt = (e, t) => {
1024
- if (t.pipeStrategy === "input") return q(e.in._def, t);
1025
- if (t.pipeStrategy === "output") return q(e.out._def, t);
1026
- let n = q(e.in._def, {
1022
+ return n ? { anyOf: [{ not: N() }, n] } : N();
1023
+ }, Jt = (e, t) => {
1024
+ if (t.pipeStrategy === "input") return G(e.in._def, t);
1025
+ if (t.pipeStrategy === "output") return G(e.out._def, t);
1026
+ let n = G(e.in._def, {
1027
1027
  ...t,
1028
1028
  currentPath: [
1029
1029
  ...t.currentPath,
@@ -1031,7 +1031,7 @@ var Gt = (e, t) => {
1031
1031
  "0"
1032
1032
  ]
1033
1033
  });
1034
- return { allOf: [n, q(e.out._def, {
1034
+ return { allOf: [n, G(e.out._def, {
1035
1035
  ...t,
1036
1036
  currentPath: [
1037
1037
  ...t.currentPath,
@@ -1040,25 +1040,25 @@ var Gt = (e, t) => {
1040
1040
  ]
1041
1041
  })].filter((e) => e !== void 0) };
1042
1042
  };
1043
- function qt(e, t) {
1044
- return q(e.type._def, t);
1043
+ function Yt(e, t) {
1044
+ return G(e.type._def, t);
1045
1045
  }
1046
- function Jt(e, t) {
1046
+ function Xt(e, t) {
1047
1047
  let n = {
1048
1048
  type: "array",
1049
1049
  uniqueItems: !0,
1050
- items: q(e.valueType._def, {
1050
+ items: G(e.valueType._def, {
1051
1051
  ...t,
1052
1052
  currentPath: [...t.currentPath, "items"]
1053
1053
  })
1054
1054
  };
1055
1055
  return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
1056
1056
  }
1057
- function Yt(e, t) {
1057
+ function Zt(e, t) {
1058
1058
  return e.rest ? {
1059
1059
  type: "array",
1060
1060
  minItems: e.items.length,
1061
- items: e.items.map((e, n) => q(e._def, {
1061
+ items: e.items.map((e, n) => G(e._def, {
1062
1062
  ...t,
1063
1063
  currentPath: [
1064
1064
  ...t.currentPath,
@@ -1066,7 +1066,7 @@ function Yt(e, t) {
1066
1066
  `${n}`
1067
1067
  ]
1068
1068
  })).reduce((e, t) => t === void 0 ? e : [...e, t], []),
1069
- additionalItems: q(e.rest._def, {
1069
+ additionalItems: G(e.rest._def, {
1070
1070
  ...t,
1071
1071
  currentPath: [...t.currentPath, "additionalItems"]
1072
1072
  })
@@ -1074,7 +1074,7 @@ function Yt(e, t) {
1074
1074
  type: "array",
1075
1075
  minItems: e.items.length,
1076
1076
  maxItems: e.items.length,
1077
- items: e.items.map((e, n) => q(e._def, {
1077
+ items: e.items.map((e, n) => G(e._def, {
1078
1078
  ...t,
1079
1079
  currentPath: [
1080
1080
  ...t.currentPath,
@@ -1084,47 +1084,47 @@ function Yt(e, t) {
1084
1084
  })).reduce((e, t) => t === void 0 ? e : [...e, t], [])
1085
1085
  };
1086
1086
  }
1087
- function Xt() {
1088
- return { not: I() };
1087
+ function Qt() {
1088
+ return { not: N() };
1089
1089
  }
1090
- function Zt() {
1091
- return I();
1090
+ function $t() {
1091
+ return N();
1092
1092
  }
1093
- var Qt = (e, t) => q(e.innerType._def, t), $t = (e, t, n) => {
1093
+ var en = (e, t) => G(e.innerType._def, t), tn = (e, t, n) => {
1094
1094
  switch (t) {
1095
- case "ZodString": return jt(e, n);
1096
- case "ZodNumber": return K(e);
1097
- case "ZodObject": return Ht(e, n);
1098
- case "ZodBigInt": return xt(e);
1099
- case "ZodBoolean": return St();
1100
- case "ZodDate": return wt(e, n);
1101
- case "ZodUndefined": return Xt();
1102
- case "ZodNull": return zt();
1103
- case "ZodArray": return bt(e, n);
1095
+ case "ZodString": return R(e, n);
1096
+ case "ZodNumber": return Kt(e);
1097
+ case "ZodObject": return qt(e, n);
1098
+ case "ZodBigInt": return F(e);
1099
+ case "ZodBoolean": return Ct();
1100
+ case "ZodDate": return Et(e, n);
1101
+ case "ZodUndefined": return Qt();
1102
+ case "ZodNull": return Vt();
1103
+ case "ZodArray": return P(e, n);
1104
1104
  case "ZodUnion":
1105
- case "ZodDiscriminatedUnion": return Vt(e, n);
1106
- case "ZodIntersection": return R(e, n);
1107
- case "ZodTuple": return Yt(e, n);
1108
- case "ZodRecord": return Ft(e, n);
1109
- case "ZodLiteral": return At(e);
1110
- case "ZodEnum": return Ot(e);
1111
- case "ZodNativeEnum": return Lt(e);
1112
- case "ZodNullable": return G(e, n);
1113
- case "ZodOptional": return Gt(e, n);
1114
- case "ZodMap": return It(e, n);
1115
- case "ZodSet": return Jt(e, n);
1105
+ case "ZodDiscriminatedUnion": return Ut(e, n);
1106
+ case "ZodIntersection": return jt(e, n);
1107
+ case "ZodTuple": return Zt(e, n);
1108
+ case "ZodRecord": return Lt(e, n);
1109
+ case "ZodLiteral": return Mt(e);
1110
+ case "ZodEnum": return kt(e);
1111
+ case "ZodNativeEnum": return zt(e);
1112
+ case "ZodNullable": return Gt(e, n);
1113
+ case "ZodOptional": return W(e, n);
1114
+ case "ZodMap": return Rt(e, n);
1115
+ case "ZodSet": return Xt(e, n);
1116
1116
  case "ZodLazy": return () => e.getter()._def;
1117
- case "ZodPromise": return qt(e, n);
1117
+ case "ZodPromise": return Yt(e, n);
1118
1118
  case "ZodNaN":
1119
- case "ZodNever": return Rt();
1120
- case "ZodEffects": return Dt(e, n);
1121
- case "ZodAny": return I();
1122
- case "ZodUnknown": return Zt();
1123
- case "ZodDefault": return Et(e, n);
1124
- case "ZodBranded": return Ct(e, n);
1125
- case "ZodReadonly": return Qt(e, n);
1126
- case "ZodCatch": return L(e, n);
1127
- case "ZodPipeline": return Kt(e, n);
1119
+ case "ZodNever": return Bt();
1120
+ case "ZodEffects": return I(e, n);
1121
+ case "ZodAny": return N();
1122
+ case "ZodUnknown": return $t();
1123
+ case "ZodDefault": return Ot(e, n);
1124
+ case "ZodBranded": return wt(e, n);
1125
+ case "ZodReadonly": return en(e, n);
1126
+ case "ZodCatch": return Tt(e, n);
1127
+ case "ZodPipeline": return Jt(e, n);
1128
1128
  case "ZodFunction":
1129
1129
  case "ZodVoid":
1130
1130
  case "ZodSymbol": return;
@@ -1132,19 +1132,19 @@ var Qt = (e, t) => q(e.innerType._def, t), $t = (e, t, n) => {
1132
1132
  /* c8 ignore next */
1133
1133
  return ((e) => void 0)(t);
1134
1134
  }
1135
- }, en = (e, t) => {
1135
+ }, nn = (e, t) => {
1136
1136
  let n = 0;
1137
1137
  for (; n < e.length && n < t.length && e[n] === t[n]; n++);
1138
1138
  return [(e.length - n).toString(), ...t.slice(n)].join("/");
1139
1139
  };
1140
- function q(e, t, n = !1) {
1140
+ function G(e, t, n = !1) {
1141
1141
  let r = t.seen.get(e);
1142
1142
  if (t.override) {
1143
1143
  let i = t.override?.(e, t, r, n);
1144
- if (i !== P) return i;
1144
+ if (i !== bt) return i;
1145
1145
  }
1146
1146
  if (r && !n) {
1147
- let e = tn(r, t);
1147
+ let e = rn(r, t);
1148
1148
  if (e !== void 0) return e;
1149
1149
  }
1150
1150
  let i = {
@@ -1153,22 +1153,22 @@ function q(e, t, n = !1) {
1153
1153
  jsonSchema: void 0
1154
1154
  };
1155
1155
  t.seen.set(e, i);
1156
- let a = $t(e, e.typeName, t), o = typeof a == "function" ? q(a(), t) : a;
1157
- if (o && nn(e, t, o), t.postProcess) {
1156
+ let a = tn(e, e.typeName, t), o = typeof a == "function" ? G(a(), t) : a;
1157
+ if (o && an(e, t, o), t.postProcess) {
1158
1158
  let n = t.postProcess(o, e, t);
1159
1159
  return i.jsonSchema = o, n;
1160
1160
  }
1161
1161
  return i.jsonSchema = o, o;
1162
1162
  }
1163
- var tn = (e, t) => {
1163
+ var rn = (e, t) => {
1164
1164
  switch (t.$refStrategy) {
1165
1165
  case "root": return { $ref: e.path.join("/") };
1166
- case "relative": return { $ref: en(t.currentPath, e.path) };
1166
+ case "relative": return { $ref: nn(t.currentPath, e.path) };
1167
1167
  case "none":
1168
- 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`), I()) : t.$refStrategy === "seen" ? I() : void 0;
1168
+ 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`), N()) : t.$refStrategy === "seen" ? N() : void 0;
1169
1169
  }
1170
- }, nn = (e, t, n) => (e.description && (n.description = e.description), n), rn = (e) => {
1171
- let t = yt(e), n = t.name === void 0 ? t.basePath : [
1170
+ }, an = (e, t, n) => (e.description && (n.description = e.description), n), on = (e) => {
1171
+ let t = St(e), n = t.name === void 0 ? t.basePath : [
1172
1172
  ...t.basePath,
1173
1173
  t.definitionPath,
1174
1174
  t.name
@@ -1187,25 +1187,25 @@ var tn = (e, t) => {
1187
1187
  jsonSchema: void 0
1188
1188
  }]))
1189
1189
  };
1190
- }, an = (e, t) => {
1191
- let n = rn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1190
+ }, sn = (e, t) => {
1191
+ let n = on(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1192
1192
  ...e,
1193
- [t]: q(r._def, {
1193
+ [t]: G(r._def, {
1194
1194
  ...n,
1195
1195
  currentPath: [
1196
1196
  ...n.basePath,
1197
1197
  n.definitionPath,
1198
1198
  t
1199
1199
  ]
1200
- }, !0) ?? I()
1201
- }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = q(e._def, i === void 0 ? n : {
1200
+ }, !0) ?? N()
1201
+ }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = G(e._def, i === void 0 ? n : {
1202
1202
  ...n,
1203
1203
  currentPath: [
1204
1204
  ...n.basePath,
1205
1205
  n.definitionPath,
1206
1206
  i
1207
1207
  ]
1208
- }, !1) ?? I(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1208
+ }, !1) ?? N(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1209
1209
  o !== void 0 && (a.title = o);
1210
1210
  let s = i === void 0 ? r ? {
1211
1211
  ...a,
@@ -1222,14 +1222,14 @@ var tn = (e, t) => {
1222
1222
  }
1223
1223
  };
1224
1224
  return s.$schema = "http://json-schema.org/draft-07/schema#", s;
1225
- }, on = Symbol.for("vercel.ai.schema");
1226
- function sn(e) {
1225
+ }, cn = Symbol.for("vercel.ai.schema");
1226
+ function ln(e) {
1227
1227
  let t;
1228
1228
  return () => (t ??= e(), t);
1229
1229
  }
1230
- function J(e, { validate: t } = {}) {
1230
+ function un(e, { validate: t } = {}) {
1231
1231
  return {
1232
- [on]: !0,
1232
+ [cn]: !0,
1233
1233
  _type: void 0,
1234
1234
  get jsonSchema() {
1235
1235
  return typeof e == "function" && (e = e()), e;
@@ -1237,20 +1237,20 @@ function J(e, { validate: t } = {}) {
1237
1237
  validate: t
1238
1238
  };
1239
1239
  }
1240
- function cn(e) {
1241
- return typeof e == "object" && !!e && on in e && e[on] === !0 && "jsonSchema" in e && "validate" in e;
1240
+ function dn(e) {
1241
+ return typeof e == "object" && !!e && cn in e && e[cn] === !0 && "jsonSchema" in e && "validate" in e;
1242
1242
  }
1243
- function ln(e) {
1244
- return e == null ? J({
1243
+ function fn(e) {
1244
+ return e == null ? un({
1245
1245
  type: "object",
1246
1246
  properties: {},
1247
1247
  additionalProperties: !1
1248
- }) : cn(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? hn(e) : un(e) : e();
1248
+ }) : dn(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? _n(e) : pn(e) : e();
1249
1249
  }
1250
- function un(e) {
1251
- return J(() => {
1252
- if (!dn(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1253
- return vt(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1250
+ function pn(e) {
1251
+ return un(() => {
1252
+ if (!mn(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1253
+ return yt(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1254
1254
  }, { validate: async (t) => {
1255
1255
  let n = await e["~standard"].validate(t);
1256
1256
  return "value" in n ? {
@@ -1258,19 +1258,19 @@ function un(e) {
1258
1258
  value: n.value
1259
1259
  } : {
1260
1260
  success: !1,
1261
- error: new $e({
1261
+ error: new O({
1262
1262
  value: t,
1263
1263
  cause: n.issues
1264
1264
  })
1265
1265
  };
1266
1266
  } });
1267
1267
  }
1268
- function dn(e) {
1268
+ function mn(e) {
1269
1269
  return e["~standard"].jsonSchema != null;
1270
1270
  }
1271
- function fn(e, t) {
1271
+ function K(e, t) {
1272
1272
  let n = t?.useReferences ?? !1;
1273
- return J(() => an(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
1273
+ return un(() => sn(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
1274
1274
  let n = await e.safeParseAsync(t);
1275
1275
  return n.success ? {
1276
1276
  success: !0,
@@ -1281,9 +1281,9 @@ function fn(e, t) {
1281
1281
  };
1282
1282
  } });
1283
1283
  }
1284
- function pn(e, r) {
1284
+ function hn(e, r) {
1285
1285
  let i = r?.useReferences ?? !1;
1286
- return J(() => vt(n(e, {
1286
+ return un(() => yt(n(e, {
1287
1287
  target: "draft-7",
1288
1288
  io: "input",
1289
1289
  reused: i ? "ref" : "inline"
@@ -1298,27 +1298,27 @@ function pn(e, r) {
1298
1298
  };
1299
1299
  } });
1300
1300
  }
1301
- function mn(e) {
1301
+ function gn(e) {
1302
1302
  return "_zod" in e;
1303
1303
  }
1304
- function hn(e, t) {
1305
- return mn(e) ? pn(e, t) : fn(e, t);
1304
+ function _n(e, t) {
1305
+ return gn(e) ? hn(e, t) : K(e, t);
1306
1306
  }
1307
- async function gn({ value: e, schema: t, context: n }) {
1308
- let r = await _n({
1307
+ async function vn({ value: e, schema: t, context: n }) {
1308
+ let r = await yn({
1309
1309
  value: e,
1310
1310
  schema: t,
1311
1311
  context: n
1312
1312
  });
1313
- if (!r.success) throw $e.wrap({
1313
+ if (!r.success) throw O.wrap({
1314
1314
  value: e,
1315
1315
  cause: r.error,
1316
1316
  context: n
1317
1317
  });
1318
1318
  return r.value;
1319
1319
  }
1320
- async function _n({ value: e, schema: t, context: n }) {
1321
- let r = ln(t);
1320
+ async function yn({ value: e, schema: t, context: n }) {
1321
+ let r = fn(t);
1322
1322
  try {
1323
1323
  if (r.validate == null) return {
1324
1324
  success: !0,
@@ -1332,7 +1332,7 @@ async function _n({ value: e, schema: t, context: n }) {
1332
1332
  rawValue: e
1333
1333
  } : {
1334
1334
  success: !1,
1335
- error: $e.wrap({
1335
+ error: O.wrap({
1336
1336
  value: e,
1337
1337
  cause: t.error,
1338
1338
  context: n
@@ -1342,7 +1342,7 @@ async function _n({ value: e, schema: t, context: n }) {
1342
1342
  } catch (t) {
1343
1343
  return {
1344
1344
  success: !1,
1345
- error: $e.wrap({
1345
+ error: O.wrap({
1346
1346
  value: e,
1347
1347
  cause: t,
1348
1348
  context: n
@@ -1351,21 +1351,21 @@ async function _n({ value: e, schema: t, context: n }) {
1351
1351
  };
1352
1352
  }
1353
1353
  }
1354
- async function vn({ text: e, schema: t }) {
1354
+ async function bn({ text: e, schema: t }) {
1355
1355
  try {
1356
- let n = _t(e);
1356
+ let n = vt(e);
1357
1357
  return t == null ? {
1358
1358
  success: !0,
1359
1359
  value: n,
1360
1360
  rawValue: n
1361
- } : await _n({
1361
+ } : await yn({
1362
1362
  value: n,
1363
1363
  schema: t
1364
1364
  });
1365
1365
  } catch (t) {
1366
1366
  return {
1367
1367
  success: !1,
1368
- error: Ye.isInstance(t) ? t : new Ye({
1368
+ error: Je.isInstance(t) ? t : new Je({
1369
1369
  text: e,
1370
1370
  cause: t
1371
1371
  }),
@@ -1373,41 +1373,41 @@ async function vn({ text: e, schema: t }) {
1373
1373
  };
1374
1374
  }
1375
1375
  }
1376
- function yn({ stream: e, schema: t }) {
1376
+ function xn({ stream: e, schema: t }) {
1377
1377
  return e.pipeThrough(new TextDecoderStream()).pipeThrough(new ct()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1378
- e !== "[DONE]" && n.enqueue(await vn({
1378
+ e !== "[DONE]" && n.enqueue(await bn({
1379
1379
  text: e,
1380
1380
  schema: t
1381
1381
  }));
1382
1382
  } }));
1383
1383
  }
1384
- async function bn(e) {
1384
+ async function Sn(e) {
1385
1385
  return typeof e == "function" && (e = e()), e;
1386
1386
  }
1387
1387
  new TextDecoder();
1388
1388
  // ../../node_modules/.pnpm/ai@7.0.154_zod@4.6.7/node_modules/ai/dist/index.js
1389
- var xn = "AI_InvalidArgumentError", Sn = `vercel.ai.error.${xn}`, Cn = Symbol.for(Sn), wn = class extends w {
1389
+ var Cn = "AI_InvalidArgumentError", wn = `vercel.ai.error.${Cn}`, Tn = Symbol.for(wn), En = class extends w {
1390
1390
  constructor({ parameter: e, value: t, message: n }) {
1391
1391
  super({
1392
- name: xn,
1392
+ name: Cn,
1393
1393
  message: `Invalid argument for parameter ${e}: ${n}`
1394
- }), this[Cn] = !0, this.parameter = e, this.value = t;
1394
+ }), this[Tn] = !0, this.parameter = e, this.value = t;
1395
1395
  }
1396
1396
  static isInstance(e) {
1397
- return w.hasMarker(e, Sn);
1397
+ return w.hasMarker(e, wn);
1398
1398
  }
1399
- }, Tn = "AI_UIMessageStreamError", En = `vercel.ai.error.${Tn}`, Dn = Symbol.for(En), Y = class extends w {
1399
+ }, Dn = "AI_UIMessageStreamError", On = `vercel.ai.error.${Dn}`, kn = Symbol.for(On), An = class extends w {
1400
1400
  constructor({ chunkType: e, chunkId: t, message: n }) {
1401
1401
  super({
1402
- name: Tn,
1402
+ name: Dn,
1403
1403
  message: n
1404
- }), this[Dn] = !0, this.chunkType = e, this.chunkId = t;
1404
+ }), this[kn] = !0, this.chunkType = e, this.chunkId = t;
1405
1405
  }
1406
1406
  static isInstance(e) {
1407
- return w.hasMarker(e, En);
1407
+ return w.hasMarker(e, On);
1408
1408
  }
1409
1409
  };
1410
- function On(e, t) {
1410
+ function jn(e, t) {
1411
1411
  if (e === void 0 && t === void 0) return;
1412
1412
  if (e === void 0) return t;
1413
1413
  if (t === void 0) return e;
@@ -1416,11 +1416,11 @@ function On(e, t) {
1416
1416
  let i = t[r];
1417
1417
  if (i === void 0) continue;
1418
1418
  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);
1419
- n[r] = o && s ? On(a, i) : i;
1419
+ n[r] = o && s ? jn(a, i) : i;
1420
1420
  }
1421
1421
  return n;
1422
1422
  }
1423
- var X = {
1423
+ var q = {
1424
1424
  array: d,
1425
1425
  boolean: m,
1426
1426
  custom: l,
@@ -1438,215 +1438,215 @@ var X = {
1438
1438
  string: r,
1439
1439
  union: e,
1440
1440
  unknown: _
1441
- }, kn = X.lazy(() => X.union([
1442
- X.null(),
1443
- X.string(),
1444
- X.number(),
1445
- X.boolean(),
1446
- X.record(X.string(), kn.optional()),
1447
- X.array(kn)
1448
- ])), Z = X.record(X.string(), X.record(X.string(), kn.optional())), An = X.union([
1449
- X.string(),
1450
- X.instanceof(Uint8Array),
1451
- X.instanceof(ArrayBuffer),
1452
- X.custom(pt, { message: "Must be a Buffer" })
1453
- ]), jn = X.record(X.string(), X.string()), Mn = X.object({
1454
- type: X.literal("text"),
1455
- text: X.string(),
1456
- providerOptions: Z.optional()
1457
- }), Nn = X.object({
1458
- type: X.literal("image"),
1459
- image: X.union([
1460
- An,
1461
- X.instanceof(URL),
1462
- jn
1441
+ }, J = q.lazy(() => q.union([
1442
+ q.null(),
1443
+ q.string(),
1444
+ q.number(),
1445
+ q.boolean(),
1446
+ q.record(q.string(), J.optional()),
1447
+ q.array(J)
1448
+ ])), Y = q.record(q.string(), q.record(q.string(), J.optional())), X = q.union([
1449
+ q.string(),
1450
+ q.instanceof(Uint8Array),
1451
+ q.instanceof(ArrayBuffer),
1452
+ q.custom(pt, { message: "Must be a Buffer" })
1453
+ ]), Mn = q.record(q.string(), q.string()), Z = q.object({
1454
+ type: q.literal("text"),
1455
+ text: q.string(),
1456
+ providerOptions: Y.optional()
1457
+ }), Nn = q.object({
1458
+ type: q.literal("image"),
1459
+ image: q.union([
1460
+ X,
1461
+ q.instanceof(URL),
1462
+ Mn
1463
1463
  ]),
1464
- mediaType: X.string().optional(),
1465
- providerOptions: Z.optional()
1466
- }), Pn = X.discriminatedUnion("type", [
1467
- X.object({
1468
- type: X.literal("data"),
1469
- data: An
1464
+ mediaType: q.string().optional(),
1465
+ providerOptions: Y.optional()
1466
+ }), Pn = q.discriminatedUnion("type", [
1467
+ q.object({
1468
+ type: q.literal("data"),
1469
+ data: X
1470
1470
  }),
1471
- X.object({
1472
- type: X.literal("url"),
1473
- url: X.instanceof(URL)
1471
+ q.object({
1472
+ type: q.literal("url"),
1473
+ url: q.instanceof(URL)
1474
1474
  }),
1475
- X.object({
1476
- type: X.literal("reference"),
1477
- reference: jn
1475
+ q.object({
1476
+ type: q.literal("reference"),
1477
+ reference: Mn
1478
1478
  }),
1479
- X.object({
1480
- type: X.literal("text"),
1481
- text: X.string()
1479
+ q.object({
1480
+ type: q.literal("text"),
1481
+ text: q.string()
1482
1482
  })
1483
- ]), Fn = X.discriminatedUnion("type", [X.object({
1484
- type: X.literal("data"),
1485
- data: An
1486
- }), X.object({
1487
- type: X.literal("url"),
1488
- url: X.instanceof(URL)
1489
- })]), In = X.object({
1490
- type: X.literal("file"),
1491
- data: X.union([
1483
+ ]), Fn = q.discriminatedUnion("type", [q.object({
1484
+ type: q.literal("data"),
1485
+ data: X
1486
+ }), q.object({
1487
+ type: q.literal("url"),
1488
+ url: q.instanceof(URL)
1489
+ })]), In = q.object({
1490
+ type: q.literal("file"),
1491
+ data: q.union([
1492
1492
  Pn,
1493
- An,
1494
- X.instanceof(URL),
1495
- jn
1493
+ X,
1494
+ q.instanceof(URL),
1495
+ Mn
1496
1496
  ]),
1497
- filename: X.string().optional(),
1498
- mediaType: X.string(),
1499
- providerOptions: Z.optional()
1500
- }), Ln = X.object({
1501
- type: X.literal("reasoning"),
1502
- text: X.string(),
1503
- providerOptions: Z.optional()
1504
- }), Rn = X.object({
1505
- type: X.literal("custom"),
1506
- kind: X.string().transform((e) => e),
1507
- providerOptions: Z.optional()
1508
- }), zn = X.object({
1509
- type: X.literal("reasoning-file"),
1510
- data: X.union([
1497
+ filename: q.string().optional(),
1498
+ mediaType: q.string(),
1499
+ providerOptions: Y.optional()
1500
+ }), Ln = q.object({
1501
+ type: q.literal("reasoning"),
1502
+ text: q.string(),
1503
+ providerOptions: Y.optional()
1504
+ }), Rn = q.object({
1505
+ type: q.literal("custom"),
1506
+ kind: q.string().transform((e) => e),
1507
+ providerOptions: Y.optional()
1508
+ }), zn = q.object({
1509
+ type: q.literal("reasoning-file"),
1510
+ data: q.union([
1511
1511
  Fn,
1512
- An,
1513
- X.instanceof(URL)
1512
+ X,
1513
+ q.instanceof(URL)
1514
1514
  ]),
1515
- mediaType: X.string(),
1516
- providerOptions: Z.optional()
1517
- }), Bn = X.object({
1518
- type: X.literal("tool-call"),
1519
- toolCallId: X.string(),
1520
- toolName: X.string(),
1521
- input: X.unknown(),
1522
- providerOptions: Z.optional(),
1523
- providerExecuted: X.boolean().optional()
1524
- }), Vn = X.discriminatedUnion("type", [
1525
- X.object({
1526
- type: X.literal("text"),
1527
- value: X.string(),
1528
- providerOptions: Z.optional()
1515
+ mediaType: q.string(),
1516
+ providerOptions: Y.optional()
1517
+ }), Bn = q.object({
1518
+ type: q.literal("tool-call"),
1519
+ toolCallId: q.string(),
1520
+ toolName: q.string(),
1521
+ input: q.unknown(),
1522
+ providerOptions: Y.optional(),
1523
+ providerExecuted: q.boolean().optional()
1524
+ }), Vn = q.discriminatedUnion("type", [
1525
+ q.object({
1526
+ type: q.literal("text"),
1527
+ value: q.string(),
1528
+ providerOptions: Y.optional()
1529
1529
  }),
1530
- X.object({
1531
- type: X.literal("json"),
1532
- value: kn,
1533
- providerOptions: Z.optional()
1530
+ q.object({
1531
+ type: q.literal("json"),
1532
+ value: J,
1533
+ providerOptions: Y.optional()
1534
1534
  }),
1535
- X.object({
1536
- type: X.literal("execution-denied"),
1537
- reason: X.string().optional(),
1538
- providerOptions: Z.optional()
1535
+ q.object({
1536
+ type: q.literal("execution-denied"),
1537
+ reason: q.string().optional(),
1538
+ providerOptions: Y.optional()
1539
1539
  }),
1540
- X.object({
1541
- type: X.literal("error-text"),
1542
- value: X.string(),
1543
- providerOptions: Z.optional()
1540
+ q.object({
1541
+ type: q.literal("error-text"),
1542
+ value: q.string(),
1543
+ providerOptions: Y.optional()
1544
1544
  }),
1545
- X.object({
1546
- type: X.literal("error-json"),
1547
- value: kn,
1548
- providerOptions: Z.optional()
1545
+ q.object({
1546
+ type: q.literal("error-json"),
1547
+ value: J,
1548
+ providerOptions: Y.optional()
1549
1549
  }),
1550
- X.object({
1551
- type: X.literal("content"),
1552
- value: X.array(X.union([
1553
- X.object({
1554
- type: X.literal("text"),
1555
- text: X.string(),
1556
- providerOptions: Z.optional()
1550
+ q.object({
1551
+ type: q.literal("content"),
1552
+ value: q.array(q.union([
1553
+ q.object({
1554
+ type: q.literal("text"),
1555
+ text: q.string(),
1556
+ providerOptions: Y.optional()
1557
1557
  }),
1558
- X.object({
1559
- type: X.literal("file"),
1558
+ q.object({
1559
+ type: q.literal("file"),
1560
1560
  data: Pn,
1561
- mediaType: X.string(),
1562
- filename: X.string().optional(),
1563
- providerOptions: Z.optional()
1561
+ mediaType: q.string(),
1562
+ filename: q.string().optional(),
1563
+ providerOptions: Y.optional()
1564
1564
  }),
1565
- X.object({
1566
- type: X.literal("file-data"),
1567
- data: X.string(),
1568
- mediaType: X.string(),
1569
- filename: X.string().optional(),
1570
- providerOptions: Z.optional()
1565
+ q.object({
1566
+ type: q.literal("file-data"),
1567
+ data: q.string(),
1568
+ mediaType: q.string(),
1569
+ filename: q.string().optional(),
1570
+ providerOptions: Y.optional()
1571
1571
  }),
1572
- X.object({
1573
- type: X.literal("file-url"),
1574
- url: X.string(),
1575
- mediaType: X.string().optional(),
1576
- providerOptions: Z.optional()
1572
+ q.object({
1573
+ type: q.literal("file-url"),
1574
+ url: q.string(),
1575
+ mediaType: q.string().optional(),
1576
+ providerOptions: Y.optional()
1577
1577
  }),
1578
- X.object({
1579
- type: X.literal("file-id"),
1580
- fileId: X.union([X.string(), X.record(X.string(), X.string())]),
1581
- providerOptions: Z.optional()
1578
+ q.object({
1579
+ type: q.literal("file-id"),
1580
+ fileId: q.union([q.string(), q.record(q.string(), q.string())]),
1581
+ providerOptions: Y.optional()
1582
1582
  }),
1583
- X.object({
1584
- type: X.literal("file-reference"),
1585
- providerReference: X.record(X.string(), X.string()),
1586
- providerOptions: Z.optional()
1583
+ q.object({
1584
+ type: q.literal("file-reference"),
1585
+ providerReference: q.record(q.string(), q.string()),
1586
+ providerOptions: Y.optional()
1587
1587
  }),
1588
- X.object({
1589
- type: X.literal("image-data"),
1590
- data: X.string(),
1591
- mediaType: X.string(),
1592
- providerOptions: Z.optional()
1588
+ q.object({
1589
+ type: q.literal("image-data"),
1590
+ data: q.string(),
1591
+ mediaType: q.string(),
1592
+ providerOptions: Y.optional()
1593
1593
  }),
1594
- X.object({
1595
- type: X.literal("image-url"),
1596
- url: X.string(),
1597
- providerOptions: Z.optional()
1594
+ q.object({
1595
+ type: q.literal("image-url"),
1596
+ url: q.string(),
1597
+ providerOptions: Y.optional()
1598
1598
  }),
1599
- X.object({
1600
- type: X.literal("image-file-id"),
1601
- fileId: X.union([X.string(), X.record(X.string(), X.string())]),
1602
- providerOptions: Z.optional()
1599
+ q.object({
1600
+ type: q.literal("image-file-id"),
1601
+ fileId: q.union([q.string(), q.record(q.string(), q.string())]),
1602
+ providerOptions: Y.optional()
1603
1603
  }),
1604
- X.object({
1605
- type: X.literal("image-file-reference"),
1606
- providerReference: X.record(X.string(), X.string()),
1607
- providerOptions: Z.optional()
1604
+ q.object({
1605
+ type: q.literal("image-file-reference"),
1606
+ providerReference: q.record(q.string(), q.string()),
1607
+ providerOptions: Y.optional()
1608
1608
  }),
1609
- X.object({
1610
- type: X.literal("custom"),
1611
- providerOptions: Z.optional()
1609
+ q.object({
1610
+ type: q.literal("custom"),
1611
+ providerOptions: Y.optional()
1612
1612
  })
1613
1613
  ]))
1614
1614
  })
1615
- ]), Hn = X.object({
1616
- type: X.literal("tool-result"),
1617
- toolCallId: X.string(),
1618
- toolName: X.string(),
1615
+ ]), Hn = q.object({
1616
+ type: q.literal("tool-result"),
1617
+ toolCallId: q.string(),
1618
+ toolName: q.string(),
1619
1619
  output: Vn,
1620
- providerOptions: Z.optional()
1621
- }), Un = X.object({
1622
- type: X.literal("tool-approval-request"),
1623
- approvalId: X.string(),
1624
- toolCallId: X.string(),
1625
- reason: X.string().optional(),
1626
- isAutomatic: X.boolean().optional(),
1627
- signature: X.string().optional(),
1628
- inputSchemaInput: X.unknown().optional()
1629
- }), Wn = X.object({
1630
- type: X.literal("tool-approval-response"),
1631
- approvalId: X.string(),
1632
- approved: X.boolean(),
1633
- reason: X.string().optional()
1634
- }), Gn = X.object({
1635
- role: X.literal("system"),
1636
- content: X.string(),
1637
- providerOptions: Z.optional()
1638
- }), Kn = X.object({
1639
- role: X.literal("user"),
1640
- content: X.union([X.string(), X.array(X.union([
1641
- Mn,
1620
+ providerOptions: Y.optional()
1621
+ }), Un = q.object({
1622
+ type: q.literal("tool-approval-request"),
1623
+ approvalId: q.string(),
1624
+ toolCallId: q.string(),
1625
+ reason: q.string().optional(),
1626
+ isAutomatic: q.boolean().optional(),
1627
+ signature: q.string().optional(),
1628
+ inputSchemaInput: q.unknown().optional()
1629
+ }), Wn = q.object({
1630
+ type: q.literal("tool-approval-response"),
1631
+ approvalId: q.string(),
1632
+ approved: q.boolean(),
1633
+ reason: q.string().optional()
1634
+ }), Gn = q.object({
1635
+ role: q.literal("system"),
1636
+ content: q.string(),
1637
+ providerOptions: Y.optional()
1638
+ }), Kn = q.object({
1639
+ role: q.literal("user"),
1640
+ content: q.union([q.string(), q.array(q.union([
1641
+ Z,
1642
1642
  Nn,
1643
1643
  In
1644
1644
  ]))]),
1645
- providerOptions: Z.optional()
1646
- }), qn = X.object({
1647
- role: X.literal("assistant"),
1648
- content: X.union([X.string(), X.array(X.union([
1649
- Mn,
1645
+ providerOptions: Y.optional()
1646
+ }), qn = q.object({
1647
+ role: q.literal("assistant"),
1648
+ content: q.union([q.string(), q.array(q.union([
1649
+ Z,
1650
1650
  Rn,
1651
1651
  In,
1652
1652
  Ln,
@@ -1655,13 +1655,13 @@ var X = {
1655
1655
  Hn,
1656
1656
  Un
1657
1657
  ]))]),
1658
- providerOptions: Z.optional()
1659
- }), Jn = X.object({
1660
- role: X.literal("tool"),
1661
- content: X.array(X.union([Hn, Wn])),
1662
- providerOptions: Z.optional()
1658
+ providerOptions: Y.optional()
1659
+ }), Jn = q.object({
1660
+ role: q.literal("tool"),
1661
+ content: q.array(q.union([Hn, Wn])),
1662
+ providerOptions: Y.optional()
1663
1663
  });
1664
- X.union([
1664
+ q.union([
1665
1665
  Gn,
1666
1666
  Kn,
1667
1667
  qn,
@@ -1854,11 +1854,11 @@ async function Xn(e) {
1854
1854
  value: void 0,
1855
1855
  state: "undefined-input"
1856
1856
  };
1857
- let t = await vn({ text: e });
1857
+ let t = await bn({ text: e });
1858
1858
  return t.success ? {
1859
1859
  value: t.value,
1860
1860
  state: "successful-parse"
1861
- } : (t = await vn({ text: Yn(e) }), t.success ? {
1861
+ } : (t = await bn({ text: Yn(e) }), t.success ? {
1862
1862
  value: t.value,
1863
1863
  state: "repaired-parse"
1864
1864
  } : {
@@ -1876,193 +1876,193 @@ j({
1876
1876
  prefix: "call",
1877
1877
  size: 24
1878
1878
  }), TransformStream;
1879
- var Zn = X.object({
1880
- source: X.discriminatedUnion("sourceType", [X.object({
1881
- type: X.literal("source"),
1882
- sourceType: X.literal("url"),
1883
- id: X.string(),
1884
- url: X.string(),
1885
- title: X.string().optional(),
1886
- providerMetadata: Z.optional()
1887
- }), X.object({
1888
- type: X.literal("source"),
1889
- sourceType: X.literal("document"),
1890
- id: X.string(),
1891
- mediaType: X.string(),
1892
- title: X.string(),
1893
- filename: X.string().optional(),
1894
- providerMetadata: Z.optional()
1879
+ var Zn = q.object({
1880
+ source: q.discriminatedUnion("sourceType", [q.object({
1881
+ type: q.literal("source"),
1882
+ sourceType: q.literal("url"),
1883
+ id: q.string(),
1884
+ url: q.string(),
1885
+ title: q.string().optional(),
1886
+ providerMetadata: Y.optional()
1887
+ }), q.object({
1888
+ type: q.literal("source"),
1889
+ sourceType: q.literal("document"),
1890
+ id: q.string(),
1891
+ mediaType: q.string(),
1892
+ title: q.string(),
1893
+ filename: q.string().optional(),
1894
+ providerMetadata: Y.optional()
1895
1895
  })]),
1896
- startIndex: X.number().int().nonnegative().optional(),
1897
- endIndex: X.number().int().nonnegative().optional(),
1898
- citedText: X.string().optional()
1899
- }), Qn = X.record(X.string(), kn.optional()), $n = sn(() => hn(X.union([
1900
- X.looseObject({
1901
- type: X.literal("text-start"),
1902
- id: X.string(),
1903
- providerMetadata: Z.optional()
1896
+ startIndex: q.number().int().nonnegative().optional(),
1897
+ endIndex: q.number().int().nonnegative().optional(),
1898
+ citedText: q.string().optional()
1899
+ }), Qn = q.record(q.string(), J.optional()), $n = ln(() => _n(q.union([
1900
+ q.looseObject({
1901
+ type: q.literal("text-start"),
1902
+ id: q.string(),
1903
+ providerMetadata: Y.optional()
1904
1904
  }),
1905
- X.looseObject({
1906
- type: X.literal("text-delta"),
1907
- id: X.string(),
1908
- delta: X.string(),
1909
- providerMetadata: Z.optional()
1905
+ q.looseObject({
1906
+ type: q.literal("text-delta"),
1907
+ id: q.string(),
1908
+ delta: q.string(),
1909
+ providerMetadata: Y.optional()
1910
1910
  }),
1911
- X.looseObject({
1912
- type: X.literal("text-end"),
1913
- id: X.string(),
1914
- citations: X.array(Zn).optional(),
1915
- providerMetadata: Z.optional()
1911
+ q.looseObject({
1912
+ type: q.literal("text-end"),
1913
+ id: q.string(),
1914
+ citations: q.array(Zn).optional(),
1915
+ providerMetadata: Y.optional()
1916
1916
  }),
1917
- X.looseObject({
1918
- type: X.literal("error"),
1919
- errorText: X.string()
1917
+ q.looseObject({
1918
+ type: q.literal("error"),
1919
+ errorText: q.string()
1920
1920
  }),
1921
- X.looseObject({
1922
- type: X.literal("tool-input-start"),
1923
- toolCallId: X.string(),
1924
- toolName: X.string(),
1925
- inputEncoding: X.enum(["json", "text"]).optional(),
1926
- providerExecuted: X.boolean().optional(),
1927
- providerMetadata: Z.optional(),
1921
+ q.looseObject({
1922
+ type: q.literal("tool-input-start"),
1923
+ toolCallId: q.string(),
1924
+ toolName: q.string(),
1925
+ inputEncoding: q.enum(["json", "text"]).optional(),
1926
+ providerExecuted: q.boolean().optional(),
1927
+ providerMetadata: Y.optional(),
1928
1928
  toolMetadata: Qn.optional(),
1929
- dynamic: X.boolean().optional(),
1930
- title: X.string().optional()
1929
+ dynamic: q.boolean().optional(),
1930
+ title: q.string().optional()
1931
1931
  }),
1932
- X.looseObject({
1933
- type: X.literal("tool-input-delta"),
1934
- toolCallId: X.string(),
1935
- inputTextDelta: X.string()
1932
+ q.looseObject({
1933
+ type: q.literal("tool-input-delta"),
1934
+ toolCallId: q.string(),
1935
+ inputTextDelta: q.string()
1936
1936
  }),
1937
- X.looseObject({
1938
- type: X.literal("tool-input-available"),
1939
- toolCallId: X.string(),
1940
- toolName: X.string(),
1941
- input: X.unknown(),
1942
- providerExecuted: X.boolean().optional(),
1943
- providerMetadata: Z.optional(),
1937
+ q.looseObject({
1938
+ type: q.literal("tool-input-available"),
1939
+ toolCallId: q.string(),
1940
+ toolName: q.string(),
1941
+ input: q.unknown(),
1942
+ providerExecuted: q.boolean().optional(),
1943
+ providerMetadata: Y.optional(),
1944
1944
  toolMetadata: Qn.optional(),
1945
- dynamic: X.boolean().optional(),
1946
- title: X.string().optional()
1945
+ dynamic: q.boolean().optional(),
1946
+ title: q.string().optional()
1947
1947
  }),
1948
- X.looseObject({
1949
- type: X.literal("tool-input-error"),
1950
- toolCallId: X.string(),
1951
- toolName: X.string(),
1952
- input: X.unknown(),
1953
- providerExecuted: X.boolean().optional(),
1954
- providerMetadata: Z.optional(),
1948
+ q.looseObject({
1949
+ type: q.literal("tool-input-error"),
1950
+ toolCallId: q.string(),
1951
+ toolName: q.string(),
1952
+ input: q.unknown(),
1953
+ providerExecuted: q.boolean().optional(),
1954
+ providerMetadata: Y.optional(),
1955
1955
  toolMetadata: Qn.optional(),
1956
- dynamic: X.boolean().optional(),
1957
- errorText: X.string(),
1958
- title: X.string().optional()
1956
+ dynamic: q.boolean().optional(),
1957
+ errorText: q.string(),
1958
+ title: q.string().optional()
1959
1959
  }),
1960
- X.looseObject({
1961
- type: X.literal("tool-approval-request"),
1962
- approvalId: X.string(),
1963
- toolCallId: X.string(),
1964
- approvalDescriptor: X.unknown().optional(),
1965
- inputSchemaInput: X.unknown().optional(),
1966
- reason: X.string().optional(),
1967
- isAutomatic: X.boolean().optional(),
1968
- signature: X.string().optional()
1960
+ q.looseObject({
1961
+ type: q.literal("tool-approval-request"),
1962
+ approvalId: q.string(),
1963
+ toolCallId: q.string(),
1964
+ approvalDescriptor: q.unknown().optional(),
1965
+ inputSchemaInput: q.unknown().optional(),
1966
+ reason: q.string().optional(),
1967
+ isAutomatic: q.boolean().optional(),
1968
+ signature: q.string().optional()
1969
1969
  }),
1970
- X.looseObject({
1971
- type: X.literal("tool-approval-response"),
1972
- approvalId: X.string(),
1973
- approved: X.boolean(),
1974
- reason: X.string().optional(),
1975
- providerExecuted: X.boolean().optional(),
1976
- providerMetadata: Z.optional()
1970
+ q.looseObject({
1971
+ type: q.literal("tool-approval-response"),
1972
+ approvalId: q.string(),
1973
+ approved: q.boolean(),
1974
+ reason: q.string().optional(),
1975
+ providerExecuted: q.boolean().optional(),
1976
+ providerMetadata: Y.optional()
1977
1977
  }),
1978
- X.looseObject({
1979
- type: X.literal("tool-output-available"),
1980
- toolCallId: X.string(),
1981
- output: X.unknown(),
1982
- providerExecuted: X.boolean().optional(),
1983
- providerMetadata: Z.optional(),
1978
+ q.looseObject({
1979
+ type: q.literal("tool-output-available"),
1980
+ toolCallId: q.string(),
1981
+ output: q.unknown(),
1982
+ providerExecuted: q.boolean().optional(),
1983
+ providerMetadata: Y.optional(),
1984
1984
  toolMetadata: Qn.optional(),
1985
- dynamic: X.boolean().optional(),
1986
- preliminary: X.boolean().optional()
1985
+ dynamic: q.boolean().optional(),
1986
+ preliminary: q.boolean().optional()
1987
1987
  }),
1988
- X.looseObject({
1989
- type: X.literal("tool-output-error"),
1990
- toolCallId: X.string(),
1991
- errorText: X.string(),
1992
- providerExecuted: X.boolean().optional(),
1993
- providerMetadata: Z.optional(),
1988
+ q.looseObject({
1989
+ type: q.literal("tool-output-error"),
1990
+ toolCallId: q.string(),
1991
+ errorText: q.string(),
1992
+ providerExecuted: q.boolean().optional(),
1993
+ providerMetadata: Y.optional(),
1994
1994
  toolMetadata: Qn.optional(),
1995
- dynamic: X.boolean().optional()
1995
+ dynamic: q.boolean().optional()
1996
1996
  }),
1997
- X.looseObject({
1998
- type: X.literal("tool-output-denied"),
1999
- toolCallId: X.string()
1997
+ q.looseObject({
1998
+ type: q.literal("tool-output-denied"),
1999
+ toolCallId: q.string()
2000
2000
  }),
2001
- X.looseObject({
2002
- type: X.literal("reasoning-start"),
2003
- id: X.string(),
2004
- providerMetadata: Z.optional()
2001
+ q.looseObject({
2002
+ type: q.literal("reasoning-start"),
2003
+ id: q.string(),
2004
+ providerMetadata: Y.optional()
2005
2005
  }),
2006
- X.looseObject({
2007
- type: X.literal("reasoning-delta"),
2008
- id: X.string(),
2009
- delta: X.string(),
2010
- providerMetadata: Z.optional()
2006
+ q.looseObject({
2007
+ type: q.literal("reasoning-delta"),
2008
+ id: q.string(),
2009
+ delta: q.string(),
2010
+ providerMetadata: Y.optional()
2011
2011
  }),
2012
- X.looseObject({
2013
- type: X.literal("reasoning-end"),
2014
- id: X.string(),
2015
- providerMetadata: Z.optional()
2012
+ q.looseObject({
2013
+ type: q.literal("reasoning-end"),
2014
+ id: q.string(),
2015
+ providerMetadata: Y.optional()
2016
2016
  }),
2017
- X.looseObject({
2018
- type: X.literal("custom"),
2019
- kind: X.string().transform((e) => e),
2020
- providerMetadata: Z.optional()
2017
+ q.looseObject({
2018
+ type: q.literal("custom"),
2019
+ kind: q.string().transform((e) => e),
2020
+ providerMetadata: Y.optional()
2021
2021
  }),
2022
- X.looseObject({
2023
- type: X.literal("source-url"),
2024
- sourceId: X.string(),
2025
- url: X.string(),
2026
- title: X.string().optional(),
2027
- providerMetadata: Z.optional()
2022
+ q.looseObject({
2023
+ type: q.literal("source-url"),
2024
+ sourceId: q.string(),
2025
+ url: q.string(),
2026
+ title: q.string().optional(),
2027
+ providerMetadata: Y.optional()
2028
2028
  }),
2029
- X.looseObject({
2030
- type: X.literal("source-document"),
2031
- sourceId: X.string(),
2032
- mediaType: X.string(),
2033
- title: X.string(),
2034
- filename: X.string().optional(),
2035
- providerMetadata: Z.optional()
2029
+ q.looseObject({
2030
+ type: q.literal("source-document"),
2031
+ sourceId: q.string(),
2032
+ mediaType: q.string(),
2033
+ title: q.string(),
2034
+ filename: q.string().optional(),
2035
+ providerMetadata: Y.optional()
2036
2036
  }),
2037
- X.looseObject({
2038
- type: X.literal("file"),
2039
- url: X.string(),
2040
- mediaType: X.string(),
2041
- providerMetadata: Z.optional()
2037
+ q.looseObject({
2038
+ type: q.literal("file"),
2039
+ url: q.string(),
2040
+ mediaType: q.string(),
2041
+ providerMetadata: Y.optional()
2042
2042
  }),
2043
- X.looseObject({
2044
- type: X.literal("reasoning-file"),
2045
- url: X.string(),
2046
- mediaType: X.string(),
2047
- providerMetadata: Z.optional()
2043
+ q.looseObject({
2044
+ type: q.literal("reasoning-file"),
2045
+ url: q.string(),
2046
+ mediaType: q.string(),
2047
+ providerMetadata: Y.optional()
2048
2048
  }),
2049
- X.looseObject({
2050
- type: X.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2051
- id: X.string().optional(),
2052
- data: X.unknown(),
2053
- transient: X.boolean().optional()
2049
+ q.looseObject({
2050
+ type: q.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2051
+ id: q.string().optional(),
2052
+ data: q.unknown(),
2053
+ transient: q.boolean().optional()
2054
2054
  }),
2055
- X.looseObject({ type: X.literal("start-step") }),
2056
- X.looseObject({ type: X.literal("finish-step") }),
2057
- X.looseObject({ type: X.literal("reset-step") }),
2058
- X.looseObject({
2059
- type: X.literal("start"),
2060
- messageId: X.string().optional(),
2061
- messageMetadata: X.unknown().optional()
2055
+ q.looseObject({ type: q.literal("start-step") }),
2056
+ q.looseObject({ type: q.literal("finish-step") }),
2057
+ q.looseObject({ type: q.literal("reset-step") }),
2058
+ q.looseObject({
2059
+ type: q.literal("start"),
2060
+ messageId: q.string().optional(),
2061
+ messageMetadata: q.unknown().optional()
2062
2062
  }),
2063
- X.looseObject({
2064
- type: X.literal("finish"),
2065
- finishReason: X.enum([
2063
+ q.looseObject({
2064
+ type: q.literal("finish"),
2065
+ finishReason: q.enum([
2066
2066
  "stop",
2067
2067
  "length",
2068
2068
  "content-filter",
@@ -2071,15 +2071,15 @@ var Zn = X.object({
2071
2071
  "interrupted",
2072
2072
  "other"
2073
2073
  ]).optional(),
2074
- messageMetadata: X.unknown().optional()
2074
+ messageMetadata: q.unknown().optional()
2075
2075
  }),
2076
- X.looseObject({
2077
- type: X.literal("abort"),
2078
- reason: X.string().optional()
2076
+ q.looseObject({
2077
+ type: q.literal("abort"),
2078
+ reason: q.string().optional()
2079
2079
  }),
2080
- X.looseObject({
2081
- type: X.literal("message-metadata"),
2082
- messageMetadata: X.unknown()
2080
+ q.looseObject({
2081
+ type: q.literal("message-metadata"),
2082
+ messageMetadata: q.unknown()
2083
2083
  })
2084
2084
  ])));
2085
2085
  function er(e) {
@@ -2151,7 +2151,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2151
2151
  }
2152
2152
  }
2153
2153
  }
2154
- if (t == null) throw new Y({
2154
+ if (t == null) throw new An({
2155
2155
  chunkType: "tool-invocation",
2156
2156
  chunkId: e,
2157
2157
  message: `No tool invocation found for tool call ID "${e}".`
@@ -2160,7 +2160,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2160
2160
  }
2161
2161
  function h(e) {
2162
2162
  let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
2163
- if (t == null) throw new Y({
2163
+ if (t == null) throw new An({
2164
2164
  chunkType: "tool-approval-response",
2165
2165
  chunkId: e,
2166
2166
  message: `No tool invocation found for approval ID "${e}".`
@@ -2225,8 +2225,8 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2225
2225
  }
2226
2226
  async function v(e) {
2227
2227
  if (e != null) {
2228
- let n = r.message.metadata == null ? e : On(r.message.metadata, e);
2229
- t != null && await gn({
2228
+ let n = r.message.metadata == null ? e : jn(r.message.metadata, e);
2229
+ t != null && await vn({
2230
2230
  value: n,
2231
2231
  schema: t,
2232
2232
  context: {
@@ -2249,7 +2249,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2249
2249
  }
2250
2250
  case "text-delta": {
2251
2251
  let t = r.activeTextParts[e.id];
2252
- if (t == null) throw new Y({
2252
+ if (t == null) throw new An({
2253
2253
  chunkType: "text-delta",
2254
2254
  chunkId: e.id,
2255
2255
  message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
@@ -2259,7 +2259,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2259
2259
  }
2260
2260
  case "text-end": {
2261
2261
  let t = r.activeTextParts[e.id];
2262
- if (t == null) throw new Y({
2262
+ if (t == null) throw new An({
2263
2263
  chunkType: "text-end",
2264
2264
  chunkId: e.id,
2265
2265
  message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
@@ -2289,7 +2289,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2289
2289
  }
2290
2290
  case "reasoning-delta": {
2291
2291
  let t = r.activeReasoningParts[e.id];
2292
- if (t == null) throw new Y({
2292
+ if (t == null) throw new An({
2293
2293
  chunkType: "reasoning-delta",
2294
2294
  chunkId: e.id,
2295
2295
  message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
@@ -2299,7 +2299,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2299
2299
  }
2300
2300
  case "reasoning-end": {
2301
2301
  let t = r.activeReasoningParts[e.id];
2302
- if (t == null) throw new Y({
2302
+ if (t == null) throw new An({
2303
2303
  chunkType: "reasoning-end",
2304
2304
  chunkId: e.id,
2305
2305
  message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
@@ -2370,7 +2370,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2370
2370
  }
2371
2371
  case "tool-input-delta": {
2372
2372
  let t = r.partialToolCalls[e.toolCallId];
2373
- if (t == null) throw new Y({
2373
+ if (t == null) throw new An({
2374
2374
  chunkType: "tool-input-delta",
2375
2375
  chunkId: e.toolCallId,
2376
2376
  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.`
@@ -2551,7 +2551,7 @@ function or({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2551
2551
  default: if (er(e)) {
2552
2552
  if (n?.[e.type] != null) {
2553
2553
  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;
2554
- await gn({
2554
+ await vn({
2555
2555
  value: e.data,
2556
2556
  schema: n[e.type],
2557
2557
  context: {
@@ -2612,7 +2612,7 @@ j({
2612
2612
  }), j({
2613
2613
  prefix: "call",
2614
2614
  size: 24
2615
- }), X.record(X.string(), kn.optional()), X.record(X.string(), X.string()), j({
2615
+ }), q.record(q.string(), J.optional()), q.record(q.string(), q.string()), j({
2616
2616
  prefix: "call",
2617
2617
  size: 24
2618
2618
  }), j({
@@ -2663,9 +2663,9 @@ j({
2663
2663
  }), j({
2664
2664
  prefix: "call",
2665
2665
  size: 24
2666
- }), X.object({
2667
- token: X.string().refine((e) => e.trim().length > 0),
2668
- url: X.string().refine((e) => {
2666
+ }), q.object({
2667
+ token: q.string().refine((e) => e.trim().length > 0),
2668
+ url: q.string().refine((e) => {
2669
2669
  try {
2670
2670
  let t = new URL(e);
2671
2671
  return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
@@ -2673,12 +2673,12 @@ j({
2673
2673
  return !1;
2674
2674
  }
2675
2675
  }),
2676
- expiresAt: X.number().positive().max(2 ** 53 - 1).optional(),
2677
- tools: X.array(X.object({
2678
- type: X.literal("function"),
2679
- name: X.string().min(1),
2680
- description: X.string().optional(),
2681
- parameters: X.record(X.string(), X.unknown())
2676
+ expiresAt: q.number().positive().max(2 ** 53 - 1).optional(),
2677
+ tools: q.array(q.object({
2678
+ type: q.literal("function"),
2679
+ name: q.string().min(1),
2680
+ description: q.string().optional(),
2681
+ parameters: q.record(q.string(), q.unknown())
2682
2682
  })).optional()
2683
2683
  }), j({
2684
2684
  prefix: "call",
@@ -2702,7 +2702,7 @@ async function dr({ response: e, url: t, fallbackMessage: n }) {
2702
2702
  }
2703
2703
  async function fr(e) {
2704
2704
  if (e == null) return [];
2705
- if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new nt({
2705
+ if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new tt({
2706
2706
  functionality: "FileList",
2707
2707
  message: "FileList is not supported in the current environment"
2708
2708
  });
@@ -2730,7 +2730,7 @@ var mr = class {
2730
2730
  this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
2731
2731
  }
2732
2732
  async sendMessages({ abortSignal: e, ...t }) {
2733
- let n = await bn(this.body), r = await bn(this.headers), i = await bn(this.credentials), a = {
2733
+ let n = await Sn(this.body), r = await Sn(this.headers), i = await Sn(this.credentials), a = {
2734
2734
  ...dt(r),
2735
2735
  ...dt(t.headers)
2736
2736
  }, o = await this.prepareSendMessagesRequest?.({
@@ -2768,11 +2768,11 @@ var mr = class {
2768
2768
  url: s,
2769
2769
  fallbackMessage: "Failed to fetch the chat response."
2770
2770
  });
2771
- if (!d.body) throw new Ve({ message: "The response body is empty." });
2771
+ if (!d.body) throw new He({ message: "The response body is empty." });
2772
2772
  return this.processResponseStream(d.body);
2773
2773
  }
2774
2774
  async reconnectToStream(e) {
2775
- let t = await bn(this.body), n = await bn(this.headers), r = await bn(this.credentials), i = {
2775
+ let t = await Sn(this.body), n = await Sn(this.headers), r = await Sn(this.credentials), i = {
2776
2776
  ...dt(n),
2777
2777
  ...dt(e.headers)
2778
2778
  }, a = await this.prepareReconnectToStreamRequest?.({
@@ -2787,7 +2787,7 @@ var mr = class {
2787
2787
  requestMetadata: e.metadata
2788
2788
  }), o = a?.api;
2789
2789
  if (o == null) {
2790
- if (e.chatId === "." || e.chatId === "..") throw new wn({
2790
+ if (e.chatId === "." || e.chatId === "..") throw new En({
2791
2791
  parameter: "chatId",
2792
2792
  value: e.chatId,
2793
2793
  message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
@@ -2806,7 +2806,7 @@ var mr = class {
2806
2806
  url: o,
2807
2807
  fallbackMessage: "Failed to fetch the chat response."
2808
2808
  });
2809
- if (!l.body) throw new Ve({ message: "The response body is empty." });
2809
+ if (!l.body) throw new He({ message: "The response body is empty." });
2810
2810
  return this.processResponseStream(l.body);
2811
2811
  }
2812
2812
  }, hr = class extends mr {
@@ -2814,7 +2814,7 @@ var mr = class {
2814
2814
  super(t), this.resumeStreamIsReplay = e;
2815
2815
  }
2816
2816
  processResponseStream(e) {
2817
- return yn({
2817
+ return xn({
2818
2818
  stream: e,
2819
2819
  schema: $n
2820
2820
  }).pipeThrough(new TransformStream({ async transform(e, t) {
@@ -2866,12 +2866,12 @@ var mr = class {
2866
2866
  } else n = e;
2867
2867
  if (e.messageId != null) {
2868
2868
  let t = this.state.messages.findIndex((t) => t.id === e.messageId);
2869
- if (t === -1) throw new wn({
2869
+ if (t === -1) throw new En({
2870
2870
  parameter: "message.messageId",
2871
2871
  value: e.messageId,
2872
2872
  message: `message with id ${e.messageId} not found`
2873
2873
  });
2874
- if (this.state.messages[t].role !== "user") throw new wn({
2874
+ if (this.state.messages[t].role !== "user") throw new En({
2875
2875
  parameter: "message.messageId",
2876
2876
  value: e.messageId,
2877
2877
  message: `message with id ${e.messageId} is not a user message`
@@ -2895,7 +2895,7 @@ var mr = class {
2895
2895
  });
2896
2896
  }, this.regenerate = async ({ messageId: e, ...t } = {}) => {
2897
2897
  let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
2898
- if (n === -1) throw new wn({
2898
+ if (n === -1) throw new En({
2899
2899
  parameter: "messageId",
2900
2900
  value: e,
2901
2901
  message: `message ${e} not found`
@@ -3083,7 +3083,7 @@ var mr = class {
3083
3083
  status: "submitted",
3084
3084
  error: void 0
3085
3085
  });
3086
- let d = this.lastMessage, f = e === "submit-message" && i != null ? this.state.messages.findIndex((e) => e.id === i) : this.state.messages.length - 1, p = f === -1 ? d : this.state.messages[f], m = p?.id, h = e === "resume-stream" && p?.role === "assistant" && p.parts.some((e) => Q(e) && (e.state === "input-streaming" || e.state === "input-available" && e.providerExecuted || e.state === "approval-responded")) ? this.state.snapshot(p) : void 0, g = f !== -1 && f < this.state.messages.length - 1 && p?.role === "assistant", _ = !1, v = !1, y = !1, b;
3086
+ let d = this.lastMessage, f = e === "submit-message" && i != null ? this.state.messages.findIndex((e) => e.id === i) : this.state.messages.length - 1, p = f === -1 ? d : this.state.messages[f], m = p?.id, h = e === "resume-stream" && p?.role === "assistant" && p.parts.some((e) => Q(e) && (e.state === "input-streaming" || e.state === "input-available" && e.providerExecuted || e.state === "approval-responded")) ? this.state.snapshot(p) : void 0, g = f !== -1 && f < this.state.messages.length - 1 && p?.role === "assistant", _ = !1, v = !1, ee = !1, y;
3087
3087
  try {
3088
3088
  let s = {
3089
3089
  state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : ar({
@@ -3093,7 +3093,7 @@ var mr = class {
3093
3093
  abortController: o,
3094
3094
  completionPromise: a
3095
3095
  };
3096
- b = s, s.abortController.signal.addEventListener("abort", () => {
3096
+ y = s, s.abortController.signal.addEventListener("abort", () => {
3097
3097
  _ = !0;
3098
3098
  }), this.activeResponse = s;
3099
3099
  let l;
@@ -3139,34 +3139,34 @@ var mr = class {
3139
3139
  }), _) return c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === s.state && (this.resumableStreamState = void 0)), null;
3140
3140
  c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === s.state && (this.resumableStreamState = void 0));
3141
3141
  } catch (e) {
3142
- if (_ || e.name === "AbortError") return _ = !0, c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === b?.state && (this.resumableStreamState = void 0)), null;
3142
+ if (_ || e.name === "AbortError") return _ = !0, c() && (this.setStatus({ status: "ready" }), this.resumableStreamState === y?.state && (this.resumableStreamState = void 0)), null;
3143
3143
  if (!c()) return null;
3144
- if (y = !0, e instanceof TypeError) {
3144
+ if (ee = !0, e instanceof TypeError) {
3145
3145
  let t = e.message.toLowerCase();
3146
3146
  v = t.includes("fetch") || t.includes("network") || t === "load failed";
3147
3147
  }
3148
- v ? this.resumableStreamState = b?.state : this.resumableStreamState === b?.state && (this.resumableStreamState = void 0), this.onError && e instanceof Error && this.onError(e), this.setStatus({
3148
+ v ? this.resumableStreamState = y?.state : this.resumableStreamState === y?.state && (this.resumableStreamState = void 0), this.onError && e instanceof Error && this.onError(e), this.setStatus({
3149
3149
  status: "error",
3150
3150
  error: e
3151
3151
  });
3152
3152
  } finally {
3153
3153
  try {
3154
- if (b) {
3155
- let { message: e, finishReason: t } = b.state;
3156
- t === "interrupted" ? this.interruptedMessageIds.add(e.id) : !_ && !y && this.interruptedMessageIds.delete(e.id), this.onFinish?.({
3157
- message: b.state.message,
3154
+ if (y) {
3155
+ let { message: e, finishReason: t } = y.state;
3156
+ t === "interrupted" ? this.interruptedMessageIds.add(e.id) : !_ && !ee && this.interruptedMessageIds.delete(e.id), this.onFinish?.({
3157
+ message: y.state.message,
3158
3158
  messages: this.state.messages,
3159
3159
  isAbort: _,
3160
3160
  isDisconnect: v,
3161
- isError: y,
3162
- finishReason: b.state.finishReason
3161
+ isError: ee,
3162
+ finishReason: y.state.finishReason
3163
3163
  });
3164
3164
  }
3165
3165
  } finally {
3166
- this.activeResponse === b && (this.activeResponse = void 0), l();
3166
+ this.activeResponse === y && (this.activeResponse = void 0), l();
3167
3167
  }
3168
3168
  }
3169
- !_ && !y && b?.state.finishReason !== "interrupted" && await this.runAutomaticRequest(() => this.makeRequest({
3169
+ !_ && !ee && y?.state.finishReason !== "interrupted" && await this.runAutomaticRequest(() => this.makeRequest({
3170
3170
  trigger: "submit-message",
3171
3171
  messageId: this.lastMessage?.id,
3172
3172
  metadata: t,
@@ -3437,13 +3437,13 @@ var Lr = function(e, t, n, r) {
3437
3437
  function Rr() {
3438
3438
  for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
3439
3439
  var r, i, a = $({}, Nr), o = !1, s = !1;
3440
- if (!pe()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
3440
+ if (!me()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
3441
3441
  var c = typeof window > "u" || typeof document > "u";
3442
3442
  t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
3443
- var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : S(r);
3443
+ var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : x(r);
3444
3444
  i === void 0 && (i = a.fetcher);
3445
3445
  var d = null;
3446
- d ||= _e({
3446
+ d ||= ve({
3447
3447
  data: void 0,
3448
3448
  error: void 0,
3449
3449
  isValidating: !0,
@@ -3513,7 +3513,7 @@ function Rr() {
3513
3513
  };
3514
3514
  a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
3515
3515
  }
3516
- ge(function() {
3516
+ _e(function() {
3517
3517
  o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
3518
3518
  var e = jr.get(u.value);
3519
3519
  e && (e.data = e.data.filter(function(e) {
@@ -3522,7 +3522,7 @@ function Rr() {
3522
3522
  });
3523
3523
  try {
3524
3524
  C(u, function(e) {
3525
- me(u) || (u.value = e), d.key = e, d.isValidating = !!e, Pr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3525
+ he(u) || (u.value = e), d.key = e, d.isValidating = !!e, Pr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3526
3526
  }, { immediate: !0 });
3527
3527
  } catch {}
3528
3528
  return $($({}, ye(d)), { mutate: function(e, t) {
@@ -3613,7 +3613,7 @@ var Ur = class {
3613
3613
  }
3614
3614
  };
3615
3615
  function Gr(e) {
3616
- let t = ve([]), n = ve("ready"), r = ve(), i = ve(), a;
3616
+ let t = S([]), n = S("ready"), r = S(), i = S(), a;
3617
3617
  return C(t, (e) => {
3618
3618
  a != null && !a.isPublishing && a.setMessagesFromConsumer(e);
3619
3619
  }, { flush: "sync" }), C(() => be(e), (e) => {
@@ -3629,10 +3629,10 @@ function Gr(e) {
3629
3629
  ...s,
3630
3630
  state: c
3631
3631
  });
3632
- }, { immediate: !0 }), pe() != null && ge(() => {
3632
+ }, { immediate: !0 }), me() != null && _e(() => {
3633
3633
  a?.dispose();
3634
3634
  }), {
3635
- id: x(() => i.value.id),
3635
+ id: b(() => i.value.id),
3636
3636
  status: n,
3637
3637
  messages: t,
3638
3638
  error: r,
@@ -3659,39 +3659,43 @@ var Kr = "voice-", qr = 300, Jr = (e) => e?.role === "assistant" && e.parts.some
3659
3659
  }, $r = 12e4, ei = 1e3, ti = 5e3, ni = 100, ri = 3e4, ii = 5e3, ai = 250, oi = 1e3, si = "\n\n", ci = (e) => {
3660
3660
  let t = e.type ?? "";
3661
3661
  return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
3662
- }, li = (e) => e?.role === "assistant" && e.parts.some((e) => b(ci(e)) && !e.providerExecuted && !oe.has(e.state ?? "")), ui = ({ messages: e }) => {
3662
+ }, li = (e) => e?.role === "assistant" && e.parts.some((e) => y(ci(e)) && !e.providerExecuted && !se.has(e.state ?? "")), ui = ({ messages: e }) => {
3663
3663
  let t = e[e.length - 1];
3664
3664
  if (!t || t.role !== "assistant") return !1;
3665
- 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 && (b(ci(e)) || ie(e)));
3666
- return r.length > 0 && r.every((e) => oe.has(e.state ?? ""));
3665
+ 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(ci(e)) || ae(e)));
3666
+ return r.length > 0 && r.every((e) => se.has(e.state ?? ""));
3667
3667
  };
3668
3668
  function di(e) {
3669
3669
  return Te(`chatbot-${e}`, () => {
3670
- let { t, te: n, locale: r } = Se({ 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(), oe = S(), pe = ve(), me = S(0), ye = S(0), be = S(), Te = ve(), ke = ve(), Ne = S(), Pe = S({}), w = S(!1), Fe = S(0), Ie = S(), Le = S(!1), Re = we(), ze = x(() => {
3670
+ let { t, te: n, locale: r } = Se({ useScope: "global" }), i = x(""), a = x(), o = x(e), s = x(), c = x(), l = x(), u = x(), d = x(), f = x(), p = x(), m = x(), h = x(), g = x(), _ = x(), v = x(), ee = x(), y = x(), ne = x(), se = x(), me = S(), he = x(0), ye = x(0), be = x(), Te = S(), ke = S(), Ne = x(), Pe = x(), w = S(), Fe = x(!1), Ie = x({}), Le = x(!1), Re = x(0), ze = x(), Be = x(!1), Ve = we(), He = b(() => {
3671
3671
  let e = u.value?.theme;
3672
- return e && e !== "auto" || (e = Ie.value), e ? e === "dark" : Re.value;
3673
- }), T = x(() => c.value === "reasoning"), Be = x(() => T.value ? g.value?.filter((e) => ![
3672
+ return e && e !== "auto" || (e = ze.value), e ? e === "dark" : Ve.value;
3673
+ }), T = b(() => c.value === "reasoning"), Ue = b(() => T.value ? g.value?.filter((e) => ![
3674
3674
  "upvote",
3675
3675
  "downvote",
3676
3676
  "feedback"
3677
- ].includes(e)) : g.value), Ve = fe(x(() => `${o.value}-chatId`), null);
3677
+ ].includes(e)) : g.value), We = pe(b(() => `${o.value}-chatId`), null);
3678
3678
  xe(() => {
3679
- Ve.value ||= ft();
3679
+ We.value ||= ft();
3680
3680
  });
3681
- let E = x({
3682
- get: () => Ve.value,
3681
+ let E = b({
3682
+ get: () => We.value,
3683
3683
  set: (e) => {
3684
- Ve.value = e;
3684
+ We.value = e;
3685
3685
  }
3686
- }), He = de(x(() => `${o.value}-pageAccessOff`), !1), Ue = x(() => He.value ? [] : Te.value ?? []), We = () => He.value ? [] : ke.value?.() ?? [], Ge = x(() => !!(be.value && Te.value?.length)), Ke = fe(x(() => `${o.value}-pageNotice`), null), qe = x(() => {
3686
+ }), Ge = fe(b(() => `${o.value}-pageAccessOff`), !1), D = b(() => Ge.value ? [] : Te.value ?? []), Ke = () => Ge.value ? [] : ke.value?.() ?? [], qe = b(() => !!(be.value && Te.value?.length)), Je = b(() => !!w.value && be.value?.pointer === !0 && D.value.length > 0);
3687
+ C(Je, (e) => {
3688
+ e || (Pe.value = void 0);
3689
+ });
3690
+ let Ye = pe(b(() => `${o.value}-pageNotice`), null), Xe = b(() => {
3687
3691
  let e = be.value?.level;
3688
- return e && e !== ee.Off && Ue.value.length && !re(Ke.value ?? void 0, e) ? e : void 0;
3692
+ return e && e !== te.Off && D.value.length && !ie(Ye.value ?? void 0, e) ? e : void 0;
3689
3693
  });
3690
- function Je() {
3691
- Ke.value = be.value?.level ?? null;
3694
+ function Ze() {
3695
+ Ye.value = be.value?.level ?? null;
3692
3696
  }
3693
- let Ye = S(), Xe = S(!1), Ze = x(() => Ye.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3694
- function Qe(e) {
3697
+ let O = x(), Qe = x(!1), $e = b(() => O.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3698
+ function et(e) {
3695
3699
  try {
3696
3700
  let t = JSON.parse(e.message);
3697
3701
  return t.status === 404 || t.type?.includes("entity-not-found");
@@ -3699,88 +3703,88 @@ function di(e) {
3699
3703
  return !1;
3700
3704
  }
3701
3705
  }
3702
- function $e(e) {
3703
- if (Qe(e)) {
3704
- let e = L.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? ue(t) : void 0;
3705
- E.value = ft(), Ye.value = void 0, he(() => {
3706
- L.value.clearError(), n && L.value.sendMessage({ text: n });
3706
+ function tt(e) {
3707
+ if (et(e)) {
3708
+ let e = I.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? de(t) : void 0;
3709
+ E.value = ft(), O.value = void 0, ge(() => {
3710
+ I.value.clearError(), n && I.value.sendMessage({ text: n });
3707
3711
  });
3708
- } else ce.error(e), Ye.value = e, Ze.value && (Xe.value = !0);
3712
+ } else le.error(e), O.value = e, $e.value && (Qe.value = !0);
3709
3713
  }
3710
- let D = x(() => se({
3714
+ let k = b(() => ce({
3711
3715
  baseUrl: i.value,
3712
3716
  basePath: a.value,
3713
3717
  headers: () => p.value
3714
- })), et = S(null), tt = () => ({
3718
+ })), nt = x(null), rt = () => ({
3715
3719
  ...Ee(),
3716
- ...et.value ?? {}
3717
- }), nt = () => {
3718
- let e = Fe.value;
3720
+ ...nt.value ?? {}
3721
+ }), it = () => {
3722
+ let e = Re.value;
3719
3723
  return new Promise((t) => {
3720
3724
  let n = setTimeout(() => {
3721
3725
  r(), t(!1);
3722
- }, 3e4), r = C(() => [Fe.value, L.value.status], ([i, a]) => {
3726
+ }, 3e4), r = C(() => [Re.value, I.value.status], ([i, a]) => {
3723
3727
  i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
3724
3728
  });
3725
3729
  });
3726
- }, O = ve(), rt = (e, t) => new Promise((n) => {
3727
- O.value?.answer(!1), O.value = {
3730
+ }, A = S(), at = (e, t) => new Promise((n) => {
3731
+ A.value?.answer(!1), A.value = {
3728
3732
  toolCallId: e.toolCallId,
3729
3733
  question: t?.question,
3730
3734
  details: t?.details,
3731
3735
  answer: (e) => {
3732
- O.value = void 0, n(e);
3736
+ A.value = void 0, n(e);
3733
3737
  }
3734
3738
  };
3735
3739
  });
3736
- function it(e) {
3737
- O.value?.answer(e);
3740
+ function ot(e) {
3741
+ A.value?.answer(e);
3738
3742
  }
3739
- let k = ({ forms: e }) => be.value && Ue.value.length ? {
3743
+ let st = ({ forms: e }) => be.value && D.value.length ? {
3740
3744
  version: 1,
3741
- features: [...ne],
3742
- forms: e ? We().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
3745
+ features: [...re],
3746
+ forms: e ? Ke().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
3743
3747
  name: e,
3744
3748
  description: t,
3745
3749
  inputSchema: n,
3746
3750
  annotations: r
3747
3751
  })) : []
3748
- } : void 0, at = (e) => {
3752
+ } : void 0, ct = (e) => {
3749
3753
  if (e?.provider !== "page") {
3750
3754
  Ne.value = void 0;
3751
3755
  return;
3752
3756
  }
3753
- let t = [...Ue.value, ...We()].find((t) => t.name === e.toolName), n;
3757
+ let t = [...D.value, ...Ke()].find((t) => t.name === e.toolName), n;
3754
3758
  try {
3755
3759
  n = t?.describe?.(e.input);
3756
3760
  } catch {
3757
3761
  n = void 0;
3758
3762
  }
3759
- n && (Pe.value = {
3760
- ...Pe.value,
3763
+ n && (Ie.value = {
3764
+ ...Ie.value,
3761
3765
  [e.toolCallId]: n
3762
- }), e.readOnly ? Ne.value = void 0 : (Ne.value = { title: n ?? t?.annotations?.title ?? e.toolName }, w.value = !0);
3763
- }, ot = Me({
3766
+ }), e.readOnly ? Ne.value = void 0 : (Ne.value = { title: n ?? t?.annotations?.title ?? e.toolName }, Le.value = !0);
3767
+ }, lt = Me({
3764
3768
  registry: () => [
3765
- ...(pe.value ?? []).filter((e) => !ae(e.name)),
3766
- ...Ue.value,
3767
- ...We()
3769
+ ...(me.value ?? []).filter((e) => !oe(e.name)),
3770
+ ...D.value,
3771
+ ...Ke()
3768
3772
  ],
3769
- capability: () => oe.value,
3770
- addToolOutput: (e) => void L.value.addToolOutput(e),
3771
- confirm: rt,
3772
- waitForResume: nt,
3773
+ capability: () => se.value,
3774
+ addToolOutput: (e) => void I.value.addToolOutput(e),
3775
+ confirm: at,
3776
+ waitForResume: it,
3773
3777
  onPendingChange: (e) => {
3774
- me.value = e;
3778
+ he.value = e;
3775
3779
  },
3776
- onActivity: at
3777
- }), A = /* @__PURE__ */ new Map(), st = 0, ct = (e, t) => {
3778
- let n = A.get(e);
3779
- A.delete(e), n?.(JSON.stringify(t));
3780
- }, lt = Me({
3781
- registry: () => Ue.value,
3782
- capability: () => oe.value,
3783
- addToolOutput: (e) => ct(e.toolCallId, "output" in e ? e.output : {
3780
+ onActivity: ct
3781
+ }), ut = /* @__PURE__ */ new Map(), dt = 0, j = (e, t) => {
3782
+ let n = ut.get(e);
3783
+ ut.delete(e), n?.(JSON.stringify(t));
3784
+ }, pt = Me({
3785
+ registry: () => D.value,
3786
+ capability: () => se.value,
3787
+ addToolOutput: (e) => j(e.toolCallId, "output" in e ? e.output : {
3784
3788
  content: [{
3785
3789
  type: "text",
3786
3790
  text: e.errorText
@@ -3788,40 +3792,40 @@ function di(e) {
3788
3792
  isError: !0
3789
3793
  }),
3790
3794
  confirm: async (e, t) => {
3791
- for (; O.value;) await new Promise((e) => {
3792
- let t = C(O, (n) => {
3795
+ for (; A.value;) await new Promise((e) => {
3796
+ let t = C(A, (n) => {
3793
3797
  n || (t(), e());
3794
3798
  });
3795
3799
  });
3796
- return A.has(e.toolCallId) ? rt(e, t) : !1;
3800
+ return ut.has(e.toolCallId) ? at(e, t) : !1;
3797
3801
  },
3798
3802
  waitForResume: () => new Promise((e) => setTimeout(() => e(!0), qr)),
3799
3803
  onPendingChange: (e) => {
3800
3804
  ye.value = e;
3801
3805
  },
3802
- onActivity: at
3806
+ onActivity: ct
3803
3807
  });
3804
- function ut() {
3805
- let e = k({ forms: !1 });
3808
+ function mt() {
3809
+ let e = st({ forms: !1 });
3806
3810
  if (e) return {
3807
3811
  declaration: e,
3808
- clientTools: Object.fromEntries(Ue.value.map((e) => [e.name, (t) => new Promise((n) => {
3809
- st += 1;
3810
- let r = `page-call-${st}`;
3811
- A.set(r, n), lt.enqueue({
3812
+ clientTools: Object.fromEntries(D.value.map((e) => [e.name, (t) => new Promise((n) => {
3813
+ dt += 1;
3814
+ let r = `page-call-${dt}`;
3815
+ ut.set(r, n), pt.enqueue({
3812
3816
  toolCallId: r,
3813
3817
  toolName: e.name,
3814
3818
  input: t ?? {},
3815
- messageId: wt()?.id ?? "",
3819
+ messageId: kt()?.id ?? "",
3816
3820
  readOnly: e.annotations?.readOnlyHint === !0,
3817
3821
  provider: "page"
3818
3822
  });
3819
3823
  })]))
3820
3824
  };
3821
3825
  }
3822
- function dt() {
3823
- lt.cancelAll(), O.value && A.has(O.value.toolCallId) && O.value.answer(!1);
3824
- for (let e of [...A.keys()]) ct(e, {
3826
+ function ht() {
3827
+ pt.cancelAll(), A.value && ut.has(A.value.toolCallId) && A.value.answer(!1);
3828
+ for (let e of [...ut.keys()]) j(e, {
3825
3829
  content: [{
3826
3830
  type: "text",
3827
3831
  text: "Stopped by the user."
@@ -3829,34 +3833,34 @@ function di(e) {
3829
3833
  isError: !0
3830
3834
  });
3831
3835
  }
3832
- async function j() {
3833
- pt(), dt(), Ne.value = void 0, w.value = !1, K.value = "", await L.value.stop();
3836
+ async function gt() {
3837
+ _t(), ht(), Ne.value = void 0, Le.value = !1, W.value = "", await I.value.stop();
3834
3838
  }
3835
- function pt() {
3836
- ot.cancelAll(), O.value && !A.has(O.value.toolCallId) && O.value.answer(!1);
3839
+ function _t() {
3840
+ lt.cancelAll(), A.value && !ut.has(A.value.toolCallId) && A.value.answer(!1);
3837
3841
  }
3838
- async function mt(e) {
3839
- He.value = e, e && await j();
3842
+ async function vt(e) {
3843
+ Ge.value = e, e && await gt();
3840
3844
  }
3841
- C(E, () => pt(), { flush: "sync" });
3842
- let ht = !1, M, gt = S(), _t, vt = S([]), N = S([]), P = S([]), F = S({}), yt = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Set();
3843
- function bt(e, t, n) {
3844
- N.value.includes(e) || (N.value = [...N.value, e]), yt.set(e, Date.now()), n ? I.add(e) : I.delete(e), t && (F.value = {
3845
+ C(E, () => _t(), { flush: "sync" });
3846
+ let yt = !1, M, bt = x(), xt, St = x([]), N = x([]), P = x([]), F = x({}), Ct = /* @__PURE__ */ new Map(), wt = /* @__PURE__ */ new Set();
3847
+ function Tt(e, t, n) {
3848
+ N.value.includes(e) || (N.value = [...N.value, e]), Ct.set(e, Date.now()), n ? wt.add(e) : wt.delete(e), t && (F.value = {
3845
3849
  ...F.value,
3846
3850
  [e]: t
3847
- }), X || An();
3851
+ }), Z || Fn();
3848
3852
  }
3849
- function xt(e) {
3853
+ function Et(e) {
3850
3854
  F.value = Object.fromEntries(Object.entries(F.value).filter(([t]) => t !== e));
3851
3855
  }
3852
- function St(e) {
3853
- yt.delete(e), N.value = N.value.filter((t) => t !== e), P.value = P.value.filter((t) => t !== e), xt(e);
3856
+ function Dt(e) {
3857
+ Ct.delete(e), N.value = N.value.filter((t) => t !== e), P.value = P.value.filter((t) => t !== e), Et(e);
3854
3858
  }
3855
- let Ct = Gr(() => ({
3859
+ let Ot = Gr(() => ({
3856
3860
  id: E.value,
3857
3861
  transport: new hr({
3858
- api: D.value.getChatEndpoint(o.value, T.value ? "reasoning" : "chat"),
3859
- prepareReconnectToStreamRequest: ({ id: e }) => ({ api: D.value.getChatStreamEndpoint(o.value, e) }),
3862
+ api: k.value.getChatEndpoint(o.value, T.value ? "reasoning" : "chat"),
3863
+ prepareReconnectToStreamRequest: ({ id: e }) => ({ api: k.value.getChatStreamEndpoint(o.value, e) }),
3860
3864
  prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
3861
3865
  id: t,
3862
3866
  messages: [e[e.length - 1]],
@@ -3871,59 +3875,59 @@ function di(e) {
3871
3875
  reasoning: d.value?.reasoning,
3872
3876
  webSearch: f.value?.webSearch,
3873
3877
  smoothStream: u.value?.smoothStream,
3874
- deviceContext: tt(),
3875
- externalContext: te.value,
3878
+ deviceContext: rt(),
3879
+ externalContext: ne.value,
3876
3880
  disabledTools: f.value?.disabled,
3877
- fallbackModels: y.value,
3878
- gatewayOptions: b.value,
3879
- hostTools: je(pe.value, oe.value),
3880
- pageTools: k({ forms: !0 })
3881
+ fallbackModels: ee.value,
3882
+ gatewayOptions: y.value,
3883
+ hostTools: je(me.value, se.value),
3884
+ pageTools: st({ forms: !0 })
3881
3885
  } }),
3882
3886
  credentials: "include",
3883
3887
  headers: () => p.value ?? {}
3884
3888
  }),
3885
3889
  sendAutomaticallyWhen: (e) => ui(e) || _r(e),
3886
3890
  onError: (e) => {
3887
- ht ? ce.warn(e) : $e(e);
3891
+ yt ? le.warn(e) : tt(e);
3888
3892
  },
3889
3893
  onToolCall: ({ toolCall: e }) => {
3890
- if (!Ae(e) || ht) return;
3894
+ if (!Ae(e) || yt) return;
3891
3895
  let t = e;
3892
- ot.enqueue({
3896
+ lt.enqueue({
3893
3897
  toolCallId: t.toolCallId,
3894
3898
  toolName: t.toolName,
3895
3899
  input: t.input,
3896
- messageId: wt()?.id ?? "",
3900
+ messageId: kt()?.id ?? "",
3897
3901
  readOnly: t.toolMetadata?.readOnly === !0,
3898
3902
  provider: t.toolMetadata?.provider === "page" ? "page" : "app"
3899
3903
  });
3900
3904
  },
3901
3905
  onData: (e) => {
3902
- e.type === "data-turnStream" ? _t = e.data.streamId : e.type === "data-audioTranscripts" && (L.value.messages = le(L.value.messages, e.data));
3906
+ e.type === "data-turnStream" ? xt = e.data.streamId : e.type === "data-audioTranscripts" && (I.value.messages = ue(I.value.messages, e.data));
3903
3907
  },
3904
3908
  onFinish: () => {
3905
3909
  let e = E.value;
3906
- !T.value && !R.value.some((t) => t.id === e) && Zt(o.value);
3910
+ !T.value && !R.value.some((t) => t.id === e) && rn(o.value);
3907
3911
  }
3908
- })), L = x(() => _e(Ct)), wt = () => L.value.messages[L.value.messages.length - 1];
3912
+ })), I = b(() => ve(Ot)), kt = () => I.value.messages[I.value.messages.length - 1];
3909
3913
  C(E, (e, t) => {
3910
- if (t && !T.value && (J() || M?.chatId === t)) {
3911
- let e = L.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
3912
- bt(t, n ? ue(n) ?? "" : "", L.value.status === "streaming" || M?.chatId === t);
3914
+ if (t && !T.value && (K() || M?.chatId === t)) {
3915
+ let e = I.value.messages.filter((e) => e.role === "user"), n = e[e.length - 1];
3916
+ Tt(t, n ? de(n) ?? "" : "", I.value.status === "streaming" || M?.chatId === t);
3913
3917
  }
3914
- St(e), _t = void 0, clearTimeout(En), Tn.value = !1, L.value.stop();
3918
+ Dt(e), xt = void 0, clearTimeout(J), q.value = !1, I.value.stop();
3915
3919
  }, { flush: "sync" });
3916
- let Tt = x(() => {
3920
+ let At = b(() => {
3917
3921
  let e = u.value?.initialMessage;
3918
3922
  return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
3919
- }), Et = ft(), Dt = x(() => ({
3920
- id: Et,
3923
+ }), jt = ft(), Mt = b(() => ({
3924
+ id: jt,
3921
3925
  role: "assistant",
3922
3926
  parts: [{
3923
3927
  type: "text",
3924
- text: Tt.value
3928
+ text: At.value
3925
3929
  }]
3926
- })), Ot = x(() => {
3930
+ })), Nt = b(() => {
3927
3931
  let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
3928
3932
  ...e,
3929
3933
  parts: e.parts.map((e) => {
@@ -3933,47 +3937,47 @@ function di(e) {
3933
3937
  let e = t.url.slice(13);
3934
3938
  return {
3935
3939
  ...t,
3936
- url: D.value.getMediaUrl(o.value, E.value, e)
3940
+ url: k.value.getMediaUrl(o.value, E.value, e)
3937
3941
  };
3938
3942
  }
3939
3943
  return t.url.startsWith("blob:") ? t : {
3940
3944
  ...t,
3941
- url: D.value.appendAuthToken(t.url)
3945
+ url: k.value.appendAuthToken(t.url)
3942
3946
  };
3943
3947
  })
3944
- }), t = L.value.id === E.value ? L.value.messages : [];
3945
- return T.value ? e(t) : !Le.value && t[0]?.role !== "assistant" ? [Dt.value, ...e(t)] : e(t);
3946
- }), kt = x(() => {
3948
+ }), t = I.value.id === E.value ? I.value.messages : [];
3949
+ return T.value ? e(t) : !Be.value && t[0]?.role !== "assistant" ? [Mt.value, ...e(t)] : e(t);
3950
+ }), L = b(() => {
3947
3951
  let e = u.value?.messagePlaceholder;
3948
3952
  return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
3949
- }), R = S([]), At = S(!1), z = S(1), B = S(!1), jt = S(!1), Mt, V = S([]), Nt = S(!1), H = S("chat"), U = S(0), Pt = S([]), Ft = S(), It = S(!1), Lt = S(!1), Rt = S(), zt = S(!1), Bt = S(!1), Vt = S(), W = S(""), G = S([]), K = S(""), Ht = S(0), Ut = de(x(() => `${o.value}-queue`), {}), Wt = x(() => Ut.value[E.value] ?? []), Gt = x(() => !T.value);
3950
- function Kt(e, t) {
3951
- let n = Object.fromEntries(Object.entries(Ut.value).filter(([t]) => t !== e));
3952
- Ut.value = t.length > 0 ? {
3953
+ }), R = x([]), Pt = x(!1), Ft = x(1), It = x(!1), z = x(!1), B, V = x([]), Lt = x(!1), Rt = x("chat"), zt = x(0), Bt = x([]), Vt = x(), Ht = x(!1), Ut = x(!1), Wt = x(), Gt = x(!1), Kt = x(!1), qt = x(), H = x(""), U = x([]), W = x(""), Jt = S(), Yt = x(0), Xt = fe(b(() => `${o.value}-queue`), {}), Zt = b(() => Xt.value[E.value] ?? []), Qt = b(() => !T.value);
3954
+ function $t(e, t) {
3955
+ let n = Object.fromEntries(Object.entries(Xt.value).filter(([t]) => t !== e));
3956
+ Xt.value = t.length > 0 ? {
3953
3957
  ...n,
3954
3958
  [e]: t
3955
3959
  } : n;
3956
3960
  }
3957
- function qt(e) {
3958
- let t = (Ut.value[e] ?? []).join(si);
3959
- return Kt(e, []), t;
3961
+ function en(e) {
3962
+ let t = (Xt.value[e] ?? []).join(si);
3963
+ return $t(e, []), t;
3960
3964
  }
3961
- function Jt(e) {
3962
- e && (W.value = W.value ? `${W.value}${si}${e}` : e);
3965
+ function tn(e) {
3966
+ e && (H.value = H.value ? `${H.value}${si}${e}` : e);
3963
3967
  }
3964
- function Yt(e) {
3965
- Kt(E.value, Wt.value.filter((t, n) => n !== e));
3968
+ function nn(e) {
3969
+ $t(E.value, Zt.value.filter((t, n) => n !== e));
3966
3970
  }
3967
- function Xt(e) {
3968
- let t = Wt.value[e];
3969
- Yt(e), Jt(t ?? "");
3971
+ function G(e) {
3972
+ let t = Zt.value[e];
3973
+ nn(e), tn(t ?? "");
3970
3974
  }
3971
- async function Zt(e) {
3975
+ async function rn(e) {
3972
3976
  if (T.value) R.value = [];
3973
3977
  else {
3974
- At.value = !0;
3978
+ Pt.value = !0;
3975
3979
  try {
3976
- let t = await D.value.getConversations(e, l.value), n = new Set(t.map((e) => e.id)), r = N.value.filter((e) => !n.has(e) && F.value[e]).map((t) => ({
3980
+ let t = await k.value.getConversations(e, l.value), n = new Set(t.map((e) => e.id)), r = N.value.filter((e) => !n.has(e) && F.value[e]).map((t) => ({
3977
3981
  id: t,
3978
3982
  agentId: e,
3979
3983
  title: F.value[t],
@@ -3981,112 +3985,112 @@ function di(e) {
3981
3985
  messages: [],
3982
3986
  lastMessageAt: /* @__PURE__ */ new Date()
3983
3987
  })), i = `${e}:${l.value ?? ""}`;
3984
- i !== Mt && (z.value = 1);
3985
- let a = new Set(r.map((e) => e.id)), o = z.value > 1 ? R.value.filter((e) => !n.has(e.id) && !a.has(e.id)) : [];
3988
+ i !== B && (Ft.value = 1);
3989
+ let a = new Set(r.map((e) => e.id)), o = Ft.value > 1 ? R.value.filter((e) => !n.has(e.id) && !a.has(e.id)) : [];
3986
3990
  R.value = [
3987
3991
  ...r,
3988
3992
  ...t,
3989
3993
  ...o
3990
- ], Mt = i, z.value === 1 && (B.value = t.length >= 100);
3994
+ ], B = i, Ft.value === 1 && (It.value = t.length >= 100);
3991
3995
  } catch {
3992
- R.value = [], z.value = 1, Mt = void 0, B.value = !1;
3996
+ R.value = [], Ft.value = 1, B = void 0, It.value = !1;
3993
3997
  return;
3994
3998
  } finally {
3995
- At.value = !1;
3999
+ Pt.value = !1;
3996
4000
  }
3997
- jn([.../* @__PURE__ */ new Set([...Y(), ...R.value.map((e) => e.id)])]);
4001
+ In([.../* @__PURE__ */ new Set([...X(), ...R.value.map((e) => e.id)])]);
3998
4002
  }
3999
4003
  }
4000
- async function Qt() {
4001
- if (!B.value || jt.value || T.value) return;
4002
- jt.value = !0;
4003
- let e = Mt;
4004
+ async function an() {
4005
+ if (!It.value || z.value || T.value) return;
4006
+ z.value = !0;
4007
+ let e = B;
4004
4008
  try {
4005
- let t = z.value + 1, n = await D.value.getConversations(o.value, l.value, { page: t });
4006
- if (e !== Mt) return;
4009
+ let t = Ft.value + 1, n = await k.value.getConversations(o.value, l.value, { page: t });
4010
+ if (e !== B) return;
4007
4011
  let r = new Set(R.value.map((e) => e.id));
4008
- R.value = [...R.value, ...n.filter((e) => !r.has(e.id))], z.value = t, B.value = n.length >= 100;
4012
+ R.value = [...R.value, ...n.filter((e) => !r.has(e.id))], Ft.value = t, It.value = n.length >= 100;
4009
4013
  } catch {} finally {
4010
- jt.value = !1;
4014
+ z.value = !1;
4011
4015
  }
4012
4016
  }
4013
- async function $t(e) {
4014
- return T.value ? [] : D.value.getConversations(o.value, l.value, { search: e });
4017
+ async function on(e) {
4018
+ return T.value ? [] : k.value.getConversations(o.value, l.value, { search: e });
4015
4019
  }
4016
- async function en() {
4020
+ async function sn() {
4017
4021
  let e = E.value;
4018
4022
  if (!e) V.value = [];
4019
4023
  else {
4020
- Nt.value = !0;
4024
+ Lt.value = !0;
4021
4025
  try {
4022
- V.value = await D.value.getChatFiles(e);
4026
+ V.value = await k.value.getChatFiles(e);
4023
4027
  } catch {
4024
4028
  V.value = [];
4025
4029
  } finally {
4026
- Nt.value = !1;
4030
+ Lt.value = !1;
4027
4031
  }
4028
4032
  }
4029
4033
  }
4030
- function q(e, t = !1) {
4031
- return D.value.getChatFileDownloadUrl(e, t);
4034
+ function cn(e, t = !1) {
4035
+ return k.value.getChatFileDownloadUrl(e, t);
4032
4036
  }
4033
- function tn(e) {
4034
- return D.value.getChatFilePreviewUrl(e);
4037
+ function ln(e) {
4038
+ return k.value.getChatFilePreviewUrl(e);
4035
4039
  }
4036
- async function nn(e) {
4037
- await D.value.deleteChatFile(e);
4040
+ async function un(e) {
4041
+ await k.value.deleteChatFile(e);
4038
4042
  let t = V.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
4039
4043
  V.value = V.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
4040
4044
  }
4041
- async function rn(e, t) {
4045
+ async function dn(e, t) {
4042
4046
  if (!T.value) try {
4043
- let n = await D.value.getChat(e, t);
4044
- if (t !== E.value || L.value.status !== "ready" || L.value.messages.length > 0) return;
4045
- n && (L.value.messages = n.messages, Xe.value = n.blocked ?? !1, an(e, t, n.turnInProgress === !0));
4047
+ let n = await k.value.getChat(e, t);
4048
+ if (t !== E.value || I.value.status !== "ready" || I.value.messages.length > 0) return;
4049
+ n && (I.value.messages = n.messages, Qe.value = n.blocked ?? !1, fn(e, t, n.turnInProgress === !0));
4046
4050
  } catch {}
4047
4051
  }
4048
- async function an(e, t, n) {
4049
- n && (await on(t), t !== E.value || J()) || (await sn(e, t), t === E.value && await dn());
4052
+ async function fn(e, t, n) {
4053
+ n && (await pn(t), t !== E.value || K()) || (await mn(e, t), t === E.value && await vn());
4050
4054
  }
4051
- async function on(e) {
4055
+ async function pn(e) {
4052
4056
  let t = { chatId: e };
4053
- M = t, gt.value = e;
4057
+ M = t, bt.value = e;
4054
4058
  let n = () => M === t && e === E.value, r = Date.now() + $r;
4055
4059
  try {
4056
- for (; n() && !J() && Date.now() < r;) {
4057
- ht = !0;
4060
+ for (; n() && !K() && Date.now() < r;) {
4061
+ yt = !0;
4058
4062
  try {
4059
- await L.value.resumeStream();
4063
+ await I.value.resumeStream();
4060
4064
  } finally {
4061
- ht = !1;
4065
+ yt = !1;
4062
4066
  }
4063
4067
  if (!n()) return;
4064
- L.value.clearError();
4065
- let t = await D.value.getChat(o.value, e).catch(() => null);
4066
- if (!t || !n() || J()) return;
4068
+ I.value.clearError();
4069
+ let t = await k.value.getChat(o.value, e).catch(() => null);
4070
+ if (!t || !n() || K()) return;
4067
4071
  if (!t.turnInProgress) {
4068
- L.value.messages = t.messages;
4072
+ I.value.messages = t.messages;
4069
4073
  return;
4070
4074
  }
4071
4075
  await new Promise((e) => setTimeout(e, ei));
4072
4076
  }
4073
4077
  } finally {
4074
- M === t && (M = void 0, gt.value = void 0);
4078
+ M === t && (M = void 0, bt.value = void 0);
4075
4079
  }
4076
4080
  }
4077
- async function sn(e, t) {
4081
+ async function mn(e, t) {
4078
4082
  let n;
4079
4083
  try {
4080
4084
  n = Number(sessionStorage.getItem(Oe)), sessionStorage.removeItem(Oe);
4081
4085
  } catch {
4082
4086
  return;
4083
4087
  }
4084
- if (!(!n || Date.now() - n > 6e4 || He.value)) for (let n = 0; n < 12; n++) {
4085
- let n = L.value.messages[L.value.messages.length - 1];
4088
+ if (!(!n || Date.now() - n > 6e4 || Ge.value)) for (let n = 0; n < 12; n++) {
4089
+ let n = I.value.messages[I.value.messages.length - 1];
4086
4090
  if (n?.role === "assistant") {
4087
- let e = n.parts.filter((e) => ie(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
4091
+ let e = n.parts.filter((e) => ae(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
4088
4092
  if (e.length > 0) {
4089
- if (t.length === e.length && !He.value) for (let e of t) ot.enqueue({
4093
+ if (t.length === e.length && !Ge.value) for (let e of t) lt.enqueue({
4090
4094
  toolCallId: e.toolCallId,
4091
4095
  toolName: e.toolName,
4092
4096
  input: e.input,
@@ -4098,252 +4102,253 @@ function di(e) {
4098
4102
  }
4099
4103
  if (n.parts[n.parts.length - 1]?.type === "text") return;
4100
4104
  }
4101
- if (await new Promise((e) => setTimeout(e, 1500)), t !== E.value || L.value.status !== "ready") return;
4105
+ if (await new Promise((e) => setTimeout(e, 1500)), t !== E.value || I.value.status !== "ready") return;
4102
4106
  try {
4103
- let n = await D.value.getChat(e, t);
4104
- n && t === E.value && (L.value.messages = n.messages);
4107
+ let n = await k.value.getChat(e, t);
4108
+ n && t === E.value && (I.value.messages = n.messages);
4105
4109
  } catch {
4106
4110
  return;
4107
4111
  }
4108
4112
  }
4109
4113
  }
4110
- let J = () => {
4111
- let e = L.value.status;
4114
+ let K = () => {
4115
+ let e = I.value.status;
4112
4116
  return e === "submitted" || e === "streaming";
4113
- }, cn = () => J() || M?.chatId === E.value || me.value > 0, ln = () => {
4114
- let e = wt();
4115
- return O.value !== void 0 || Jr(e) || li(e);
4116
- }, un = /* @__PURE__ */ new Set();
4117
- async function dn() {
4117
+ }, hn = () => K() || M?.chatId === E.value || he.value > 0, gn = () => {
4118
+ let e = kt();
4119
+ return A.value !== void 0 || Jr(e) || li(e);
4120
+ }, _n = /* @__PURE__ */ new Set();
4121
+ async function vn() {
4118
4122
  let e = E.value;
4119
- if (!(un.has(e) || Wt.value.length === 0 || cn() || Ye.value)) {
4120
- if (ln()) Jt(qt(e));
4123
+ if (!(_n.has(e) || Zt.value.length === 0 || hn() || O.value)) {
4124
+ if (gn()) tn(en(e));
4121
4125
  else {
4122
- un.add(e);
4126
+ _n.add(e);
4123
4127
  try {
4124
4128
  let t = Date.now() + ii;
4125
- for (; Date.now() < t && (await Promise.race([D.value.getRunningTurns(o.value, [e]).catch(() => []), new Promise((t) => setTimeout(() => t([e]), oi))])).includes(e);) await new Promise((e) => setTimeout(e, ai));
4126
- if (e !== E.value || cn()) return;
4127
- let n = qt(e);
4128
- n && xn(n);
4129
+ for (; Date.now() < t && (await Promise.race([k.value.getRunningTurns(o.value, [e]).catch(() => []), new Promise((t) => setTimeout(() => t([e]), oi))])).includes(e);) await new Promise((e) => setTimeout(e, ai));
4130
+ if (e !== E.value || hn()) return;
4131
+ let n = en(e);
4132
+ n && On(n);
4129
4133
  } finally {
4130
- un.delete(e);
4134
+ _n.delete(e);
4131
4135
  }
4132
4136
  }
4133
4137
  }
4134
4138
  }
4135
- let fn = 0, pn = 0;
4136
- async function mn() {
4137
- if (T.value || J()) return "indeterminate";
4138
- let e = E.value, t = fn += 1;
4139
+ let yn = 0, bn = 0;
4140
+ async function xn() {
4141
+ if (T.value || K()) return "indeterminate";
4142
+ let e = E.value, t = yn += 1;
4139
4143
  try {
4140
- let n = await D.value.getChat(o.value, e);
4141
- if (!n || e !== E.value || J() || t <= pn) return "indeterminate";
4142
- pn = t;
4143
- let r = n.messages, i = Qr(r, L.value.messages);
4144
- return L.value.messages = [...r, ...i], Xe.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
4144
+ let n = await k.value.getChat(o.value, e);
4145
+ if (!n || e !== E.value || K() || t <= bn) return "indeterminate";
4146
+ bn = t;
4147
+ let r = n.messages, i = Qr(r, I.value.messages);
4148
+ return I.value.messages = [...r, ...i], Qe.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
4145
4149
  } catch {}
4146
4150
  return "indeterminate";
4147
4151
  }
4148
- function hn(e) {
4149
- L.value.messages = [...L.value.messages, e];
4152
+ function Sn(e) {
4153
+ I.value.messages = [...I.value.messages, e];
4150
4154
  }
4151
- async function gn(e) {
4155
+ async function Cn(e) {
4152
4156
  try {
4153
- Pt.value = await D.value.getMessageFeedbacks(e);
4157
+ Bt.value = await k.value.getMessageFeedbacks(e);
4154
4158
  } catch {
4155
- Pt.value = [];
4159
+ Bt.value = [];
4156
4160
  }
4157
4161
  }
4158
- function _n(e) {
4159
- let t = Pt.value.findIndex((t) => t.messageId === e.messageId);
4160
- t >= 0 ? Pt.value[t] = e : Pt.value.push(e);
4162
+ function wn(e) {
4163
+ let t = Bt.value.findIndex((t) => t.messageId === e.messageId);
4164
+ t >= 0 ? Bt.value[t] = e : Bt.value.push(e);
4161
4165
  }
4162
- function vn(e) {
4163
- let t = Ot.value, n = t.findIndex((t) => t.id === e.id), r = ue(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
4166
+ function Tn(e) {
4167
+ let t = Nt.value, n = t.findIndex((t) => t.id === e.id), r = de(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
4164
4168
  return {
4165
- userQuestion: ue(i ?? e) ?? "",
4169
+ userQuestion: de(i ?? e) ?? "",
4166
4170
  assistantMessage: r
4167
4171
  };
4168
4172
  }
4169
- async function yn(e, t) {
4173
+ async function En(e, t) {
4170
4174
  await Promise.all([
4171
- rn(e, t),
4172
- Zt(e),
4173
- gn(t)
4174
- ]), et.value || De((e, t) => D.value.reverseGeocode(e, t, r.value)).then((e) => {
4175
- e && (et.value = e);
4175
+ dn(e, t),
4176
+ rn(e),
4177
+ Cn(t)
4178
+ ]), nt.value || De((e, t) => k.value.reverseGeocode(e, t, r.value)).then((e) => {
4179
+ e && (nt.value = e);
4176
4180
  });
4177
4181
  }
4178
- async function bn() {
4179
- let e = W.value.trim(), t = G.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
4182
+ async function Dn() {
4183
+ let e = H.value.trim(), t = U.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
4180
4184
  type: "file",
4181
4185
  mediaType: e.mediaSource.mimeType,
4182
4186
  url: e.localUrl,
4183
4187
  filename: e.mediaSource.name,
4184
4188
  providerMetadata: { "8bot": { media: e.mediaSource } }
4185
- }));
4186
- !T.value && cn() ? e && t.length === 0 && (Kt(E.value, [...Wt.value, e]), W.value = "") : (T.value && Ot.value.length > 0 && await In(), xn(e, t), W.value = "", Fn());
4189
+ })), n = Je.value ? Pe.value : void 0;
4190
+ !T.value && hn() ? e && t.length === 0 && !n && ($t(E.value, [...Zt.value, e]), H.value = "") : (T.value && Nt.value.length > 0 && await Vn(), On(e, t, n), H.value = "", Pe.value = void 0, Bn());
4187
4191
  }
4188
- function xn(e, t = []) {
4189
- pt(), K.value = e, Ht.value = L.value.messages.length;
4190
- let n = L.value.sendMessage;
4191
- n({
4192
+ function On(e, t = [], n) {
4193
+ _t(), W.value = e, Jt.value = n, Yt.value = I.value.messages.length;
4194
+ let r = I.value.sendMessage;
4195
+ r({
4192
4196
  text: e,
4193
- files: t.length > 0 ? t : void 0
4197
+ files: t.length > 0 ? t : void 0,
4198
+ ...n && { metadata: { pagePointer: n } }
4194
4199
  });
4195
4200
  }
4196
- function Sn(e) {
4201
+ function kn(e) {
4197
4202
  let t = e.trim();
4198
4203
  if (!t) return;
4199
- if (L.value.status !== "ready") {
4200
- ce.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
4204
+ if (I.value.status !== "ready") {
4205
+ le.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
4201
4206
  return;
4202
4207
  }
4203
- let n = L.value.sendMessage;
4204
- pt(), n({ text: t });
4208
+ let n = I.value.sendMessage;
4209
+ _t(), n({ text: t });
4205
4210
  }
4206
- async function Cn() {
4207
- let e = L.value.messages.slice(Ht.value).some((e) => e.parts.some(ie)), t = K.value, n = t.length > 0 && !e, r = E.value, i = Ht.value, a = M?.chatId === r, s = _t, c = qt(r), l = (e = "") => {
4208
- W.value = [
4211
+ async function An() {
4212
+ let e = I.value.messages.slice(Yt.value).some((e) => e.parts.some(ae)), t = W.value, n = Jt.value, r = t.length > 0 && !e, i = E.value, a = Yt.value, s = M?.chatId === i, c = xt, l = en(i), u = (e = "") => {
4213
+ H.value = [
4209
4214
  e,
4210
- c,
4211
- W.value
4215
+ l,
4216
+ H.value
4212
4217
  ].filter(Boolean).join(si);
4213
- }, u = () => r === E.value && !J() && Ht.value === i ? !1 : (c && Kt(r, [c, ...Ut.value[r] ?? []]), !0);
4214
- M = void 0, gt.value = void 0, pt(), await L.value.stop();
4215
- let d = T.value || e && !a || await D.value.stopChatTurn(o.value, r, s).catch(() => !0);
4216
- if (!u()) {
4217
- if (a || !d) {
4218
- if (await mn(), u()) return;
4219
- if (a || L.value.messages.length > Ht.value) {
4220
- K.value = "", l();
4218
+ }, d = () => i === E.value && !K() && Yt.value === a ? !1 : (l && $t(i, [l, ...Xt.value[i] ?? []]), !0);
4219
+ M = void 0, bt.value = void 0, _t(), await I.value.stop();
4220
+ let f = T.value || e && !s || await k.value.stopChatTurn(o.value, i, c).catch(() => !0);
4221
+ if (!d()) {
4222
+ if (s || !f) {
4223
+ if (await xn(), d()) return;
4224
+ if (s || I.value.messages.length > Yt.value) {
4225
+ W.value = "", u();
4221
4226
  return;
4222
4227
  }
4223
4228
  }
4224
- n ? (l(t), L.value.messages = L.value.messages.slice(0, Ht.value), K.value = "") : l();
4229
+ r ? (u(t), Pe.value ??= n, I.value.messages = I.value.messages.slice(0, Yt.value), W.value = "") : u();
4225
4230
  }
4226
4231
  }
4227
- C(() => L.value.messages, (e) => {
4228
- let t = O.value?.toolCallId;
4229
- t && !A.has(t) && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && pt();
4230
- }), C(() => L.value.status, (e) => {
4231
- e === "submitted" && (Fe.value++, _t = void 0);
4232
+ C(() => I.value.messages, (e) => {
4233
+ let t = A.value?.toolCallId;
4234
+ t && !ut.has(t) && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && _t();
4235
+ }), C(() => I.value.status, (e) => {
4236
+ e === "submitted" && (Re.value++, xt = void 0);
4232
4237
  });
4233
- let wn;
4238
+ let jn;
4234
4239
  C(() => [
4235
- L.value.status,
4236
- me.value,
4240
+ I.value.status,
4241
+ he.value,
4237
4242
  ye.value
4238
4243
  ], ([e, t, n]) => {
4239
- clearTimeout(wn), e === "ready" && t === 0 && n === 0 && (wn = setTimeout(() => {
4240
- w.value = !1;
4244
+ clearTimeout(jn), e === "ready" && t === 0 && n === 0 && (jn = setTimeout(() => {
4245
+ Le.value = !1;
4241
4246
  }, 1500));
4242
4247
  });
4243
- let Tn = S(!1), En;
4244
- C(() => !O.value && !Jr(wt()) && (J() || me.value > 0), (e) => {
4245
- clearTimeout(En), e ? Tn.value = !0 : En = setTimeout(() => {
4246
- Tn.value = !1;
4248
+ let q = x(!1), J;
4249
+ C(() => !A.value && !Jr(kt()) && (K() || he.value > 0), (e) => {
4250
+ clearTimeout(J), e ? q.value = !0 : J = setTimeout(() => {
4251
+ q.value = !1;
4247
4252
  }, 400);
4248
4253
  }, { immediate: !0 });
4249
- let Dn = x(() => {
4250
- let e = vt.value.filter((e) => e !== E.value);
4251
- return Tn.value || gt.value === E.value ? [...e, E.value] : e;
4252
- }), Y = () => [.../* @__PURE__ */ new Set([...vt.value, ...N.value])], On = Ce(), X, kn = 0, Z = 0;
4253
- function An() {
4254
- clearTimeout(X), X = void 0, Y().length !== 0 && On.value === "visible" && (X = setTimeout(() => {
4255
- X = void 0, jn(Y());
4254
+ let Y = b(() => {
4255
+ let e = St.value.filter((e) => e !== E.value);
4256
+ return q.value || bt.value === E.value ? [...e, E.value] : e;
4257
+ }), X = () => [.../* @__PURE__ */ new Set([...St.value, ...N.value])], Mn = Ce(), Z, Nn = 0, Pn = 0;
4258
+ function Fn() {
4259
+ clearTimeout(Z), Z = void 0, X().length !== 0 && Mn.value === "visible" && (Z = setTimeout(() => {
4260
+ Z = void 0, In(X());
4256
4261
  }, ti));
4257
4262
  }
4258
- async function jn(e) {
4263
+ async function In(e) {
4259
4264
  let t = e.slice(0, ni);
4260
4265
  if (T.value || t.length === 0) {
4261
- An();
4266
+ Fn();
4262
4267
  return;
4263
4268
  }
4264
- let n = kn += 1, r;
4269
+ let n = Nn += 1, r;
4265
4270
  try {
4266
- r = await D.value.getRunningTurns(o.value, t);
4271
+ r = await k.value.getRunningTurns(o.value, t);
4267
4272
  } catch {
4268
- An();
4273
+ Fn();
4269
4274
  return;
4270
4275
  }
4271
- if (n <= Z) return;
4272
- Z = n;
4273
- for (let e of r) I.add(e);
4274
- let i = new Set(t), a = Y().filter((e) => i.has(e) && !r.includes(e)), s = (e) => N.value.includes(e) && !I.has(e), c = a.filter((e) => s(e) && Date.now() - (yt.get(e) ?? 0) > ri), l = a.filter((e) => !s(e));
4275
- vt.value = [...vt.value.filter((e) => !i.has(e)), ...r];
4276
+ if (n <= Pn) return;
4277
+ Pn = n;
4278
+ for (let e of r) wt.add(e);
4279
+ let i = new Set(t), a = X().filter((e) => i.has(e) && !r.includes(e)), s = (e) => N.value.includes(e) && !wt.has(e), c = a.filter((e) => s(e) && Date.now() - (Ct.get(e) ?? 0) > ri), l = a.filter((e) => !s(e));
4280
+ St.value = [...St.value.filter((e) => !i.has(e)), ...r];
4276
4281
  let u = l.filter((e) => N.value.includes(e));
4277
- (u.length > 0 || c.length > 0) && (N.value = N.value.filter((e) => !u.includes(e) && !c.includes(e)), P.value = [...P.value, ...u.filter((e) => e !== E.value && !P.value.includes(e))]), l.length > 0 && Zt(o.value), An();
4282
+ (u.length > 0 || c.length > 0) && (N.value = N.value.filter((e) => !u.includes(e) && !c.includes(e)), P.value = [...P.value, ...u.filter((e) => e !== E.value && !P.value.includes(e))]), l.length > 0 && rn(o.value), Fn();
4278
4283
  }
4279
- C(On, (e) => {
4280
- e === "visible" ? jn(Y()) : (clearTimeout(X), X = void 0);
4281
- }), ge(() => clearTimeout(X));
4282
- let Mn = x(() => P.value.map((e) => ({
4284
+ C(Mn, (e) => {
4285
+ e === "visible" ? In(X()) : (clearTimeout(Z), Z = void 0);
4286
+ }), _e(() => clearTimeout(Z));
4287
+ let Ln = b(() => P.value.map((e) => ({
4283
4288
  chatId: e,
4284
4289
  title: R.value.find((t) => t.id === e)?.title || F.value[e] || void 0
4285
4290
  })));
4286
- function Nn(e) {
4287
- St(e), E.value = e, nr("chat");
4291
+ function Rn(e) {
4292
+ Dt(e), E.value = e, or("chat");
4288
4293
  }
4289
- function Pn(e) {
4290
- P.value = P.value.filter((t) => t !== e), xt(e);
4294
+ function zn(e) {
4295
+ P.value = P.value.filter((t) => t !== e), Et(e);
4291
4296
  }
4292
- C(() => [L.value.status, L.value.id], ([e, t], [n, r]) => {
4297
+ C(() => [I.value.status, I.value.id], ([e, t], [n, r]) => {
4293
4298
  if (t === r) {
4294
- if (e === "error") M?.chatId !== E.value && Jt(qt(E.value));
4299
+ if (e === "error") M?.chatId !== E.value && tn(en(E.value));
4295
4300
  else if (e === "ready" && (n === "streaming" || n === "submitted")) {
4296
- if (ln()) {
4297
- Jt(qt(E.value));
4301
+ if (gn()) {
4302
+ tn(en(E.value));
4298
4303
  return;
4299
4304
  }
4300
- dn();
4305
+ vn();
4301
4306
  }
4302
4307
  }
4303
- }), C(me, (e) => {
4304
- e === 0 && L.value.status === "ready" && dn();
4305
- }), C(() => L.value.status, (e) => {
4306
- e === "ready" && K.value.length > 0 && (K.value = "");
4308
+ }), C(he, (e) => {
4309
+ e === 0 && I.value.status === "ready" && vn();
4310
+ }), C(() => I.value.status, (e) => {
4311
+ e === "ready" && W.value.length > 0 && (W.value = "");
4307
4312
  });
4308
- function Fn(e = !1) {
4309
- for (let t of G.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4310
- G.value = [], Gn.value = null;
4313
+ function Bn(e = !1) {
4314
+ for (let t of U.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4315
+ U.value = [], Xn.value = null;
4311
4316
  }
4312
- async function In() {
4313
- return K.value = "", Pe.value = {}, E.value = ft(), await he(), L.value.clearError(), Ye.value = void 0, Xe.value = !1, Fn(!0), nr("chat"), E.value;
4317
+ async function Vn() {
4318
+ return W.value = "", Ie.value = {}, E.value = ft(), await ge(), I.value.clearError(), O.value = void 0, Qe.value = !1, Bn(!0), or("chat"), E.value;
4314
4319
  }
4315
- async function Ln(e) {
4316
- L.value.status !== "ready" && (K.value = "", await Cn()), pt(), await L.value.regenerate(e);
4320
+ async function Hn(e) {
4321
+ I.value.status !== "ready" && (W.value = "", await An()), _t(), await I.value.regenerate(e);
4317
4322
  }
4318
- function Rn(e) {
4323
+ function Un(e) {
4319
4324
  if (e.tool === "requestGeolocation") {
4320
4325
  let t = e.output;
4321
- "latitude" in t && (et.value = {
4326
+ "latitude" in t && (nt.value = {
4322
4327
  geolocationLatitude: t.latitude,
4323
4328
  geolocationLongitude: t.longitude,
4324
4329
  geolocationAccuracy: t.accuracy,
4325
4330
  geolocationCity: t.city
4326
4331
  });
4327
4332
  }
4328
- L.value.addToolOutput(e);
4333
+ I.value.addToolOutput(e);
4329
4334
  }
4330
- function zn(e) {
4331
- L.value.addToolApprovalResponse(e);
4335
+ function Wn(e) {
4336
+ I.value.addToolApprovalResponse(e);
4332
4337
  }
4333
- let Bn = x(() => L.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Vn = x(() => _.value?.maxFilesPerMessage ?? 5), Hn = x(() => _.value?.maxFilesPerChat ?? 20), Un = x(() => Math.max(0, Math.min(Vn.value - G.value.length, Hn.value - Bn.value - G.value.length))), Wn = x(() => Un.value <= 0), Gn = S(null), Kn = () => {
4334
- Gn.value = null;
4338
+ let Gn = b(() => I.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Kn = b(() => _.value?.maxFilesPerMessage ?? 5), qn = b(() => _.value?.maxFilesPerChat ?? 20), Jn = b(() => Math.max(0, Math.min(Kn.value - U.value.length, qn.value - Gn.value - U.value.length))), Yn = b(() => Jn.value <= 0), Xn = x(null), Zn = () => {
4339
+ Xn.value = null;
4335
4340
  };
4336
- C(Wn, (e) => {
4337
- e || (Gn.value = null);
4341
+ C(Yn, (e) => {
4342
+ e || (Xn.value = null);
4338
4343
  });
4339
- async function qn(e) {
4340
- if (Wn.value) {
4341
- Gn.value = Hn.value - Bn.value - G.value.length <= Vn.value - G.value.length ? {
4344
+ async function Qn(e) {
4345
+ if (Yn.value) {
4346
+ Xn.value = qn.value - Gn.value - U.value.length <= Kn.value - U.value.length ? {
4342
4347
  reason: "per-chat",
4343
- max: Hn.value
4348
+ max: qn.value
4344
4349
  } : {
4345
4350
  reason: "per-message",
4346
- max: Vn.value
4351
+ max: Kn.value
4347
4352
  };
4348
4353
  return;
4349
4354
  }
@@ -4353,26 +4358,26 @@ function di(e) {
4353
4358
  localUrl: URL.createObjectURL(e),
4354
4359
  state: "uploading"
4355
4360
  };
4356
- G.value = [...G.value, n];
4361
+ U.value = [...U.value, n];
4357
4362
  try {
4358
- let n = await D.value.uploadMedia(o.value, E.value, e);
4359
- G.value = G.value.map((e) => e.id === t ? {
4363
+ let n = await k.value.uploadMedia(o.value, E.value, e);
4364
+ U.value = U.value.map((e) => e.id === t ? {
4360
4365
  ...e,
4361
4366
  state: "done",
4362
4367
  mediaSource: n
4363
4368
  } : e);
4364
4369
  } catch (e) {
4365
4370
  let n = e instanceof Error ? e.message : "Upload failed";
4366
- G.value = G.value.map((e) => e.id === t ? {
4371
+ U.value = U.value.map((e) => e.id === t ? {
4367
4372
  ...e,
4368
4373
  state: "error",
4369
4374
  error: n
4370
4375
  } : e);
4371
4376
  }
4372
4377
  }
4373
- async function Jn(e, t) {
4374
- let { userQuestion: n, assistantMessage: r } = vn(e);
4375
- _n(await D.value.submitMessageFeedback({
4378
+ async function $n(e, t) {
4379
+ let { userQuestion: n, assistantMessage: r } = Tn(e);
4380
+ wn(await k.value.submitMessageFeedback({
4376
4381
  messageId: e.id,
4377
4382
  chatId: E.value,
4378
4383
  agentId: o.value,
@@ -4381,75 +4386,75 @@ function di(e) {
4381
4386
  assistantMessage: r
4382
4387
  }));
4383
4388
  }
4384
- async function Yn(e) {
4385
- await Jn(e, "upvote");
4389
+ async function er(e) {
4390
+ await $n(e, "upvote");
4386
4391
  }
4387
- async function Xn(e) {
4388
- await Jn(e, "downvote");
4392
+ async function tr(e) {
4393
+ await $n(e, "downvote");
4389
4394
  }
4390
- function Zn(e) {
4391
- Lt.value = !1, Rt.value = void 0, Ft.value = e;
4395
+ function nr(e) {
4396
+ Ut.value = !1, Wt.value = void 0, Vt.value = e;
4392
4397
  }
4393
- async function Qn(e) {
4394
- if (Ft.value) try {
4395
- It.value = !0, Lt.value = !1, Rt.value = void 0;
4396
- let { userQuestion: t, assistantMessage: n } = vn(Ft.value);
4397
- _n(await D.value.submitMessageFeedback({
4398
- messageId: Ft.value.id,
4398
+ async function rr(e) {
4399
+ if (Vt.value) try {
4400
+ Ht.value = !0, Ut.value = !1, Wt.value = void 0;
4401
+ let { userQuestion: t, assistantMessage: n } = Tn(Vt.value);
4402
+ wn(await k.value.submitMessageFeedback({
4403
+ messageId: Vt.value.id,
4399
4404
  chatId: E.value,
4400
4405
  agentId: o.value,
4401
4406
  userQuestion: t,
4402
4407
  assistantMessage: n,
4403
4408
  comment: e
4404
- })), Lt.value = !0, await gn(E.value);
4409
+ })), Ut.value = !0, await Cn(E.value);
4405
4410
  } catch {
4406
- Rt.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4411
+ Wt.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4407
4412
  } finally {
4408
- It.value = !1;
4413
+ Ht.value = !1;
4409
4414
  }
4410
4415
  }
4411
- async function $n(e) {
4416
+ async function Q(e) {
4412
4417
  try {
4413
- Bt.value = !0, zt.value = !1, Vt.value = void 0, await D.value.submitLead({
4418
+ Kt.value = !0, Gt.value = !1, qt.value = void 0, await k.value.submitLead({
4414
4419
  agentId: o.value,
4415
4420
  chatId: E.value,
4416
4421
  ...e
4417
- }), zt.value = !0;
4422
+ }), Gt.value = !0;
4418
4423
  } catch {
4419
- Vt.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4424
+ qt.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4420
4425
  } finally {
4421
- Bt.value = !1;
4426
+ Kt.value = !1;
4422
4427
  }
4423
4428
  }
4424
- async function er(e, t) {
4425
- let n = await D.value.updateChatTitle(o.value, e, t);
4429
+ async function ir(e, t) {
4430
+ let n = await k.value.updateChatTitle(o.value, e, t);
4426
4431
  R.value = R.value.map((t) => t.id === e ? {
4427
4432
  ...t,
4428
4433
  title: n.title
4429
4434
  } : t);
4430
4435
  }
4431
- async function tr(e) {
4432
- await D.value.deleteChat(o.value, e), R.value = R.value.filter((t) => t.id !== e), E.value === e && await In();
4436
+ async function ar(e) {
4437
+ await k.value.deleteChat(o.value, e), R.value = R.value.filter((t) => t.id !== e), E.value === e && await Vn();
4433
4438
  }
4434
- function nr(e) {
4435
- H.value = e;
4439
+ function or(e) {
4440
+ Rt.value = e;
4436
4441
  }
4437
- function rr() {
4438
- nr("chat"), U.value++;
4442
+ function sr() {
4443
+ or("chat"), zt.value++;
4439
4444
  }
4440
- let Q;
4441
- function ir(e) {
4442
- let t = () => D.value.getChat(o.value, e).then((e) => e !== null);
4445
+ let cr;
4446
+ function lr(e) {
4447
+ let t = () => k.value.getChat(o.value, e).then((e) => e !== null);
4443
4448
  return t().catch(() => t().catch(() => !1));
4444
4449
  }
4445
4450
  return C(l, async (e) => {
4446
- if (!e || e === Q) return;
4447
- let t = Q;
4448
- if (Q = e, t === void 0) return;
4449
- let n = E.value, r = !T.value && await ir(n);
4450
- l.value === e && E.value === n && (r ? Zt(o.value) : (R.value = [], Pt.value = [], V.value = [], vt.value = [], N.value = [], P.value = [], F.value = {}, await In(), W.value = ""));
4451
+ if (!e || e === cr) return;
4452
+ let t = cr;
4453
+ if (cr = e, t === void 0) return;
4454
+ let n = E.value, r = !T.value && await lr(n);
4455
+ l.value === e && E.value === n && (r ? rn(o.value) : (R.value = [], Bt.value = [], V.value = [], St.value = [], N.value = [], P.value = [], F.value = {}, await Vn(), H.value = ""));
4451
4456
  }), {
4452
- apiClient: D,
4457
+ apiClient: k,
4453
4458
  baseUrl: i,
4454
4459
  basePath: a,
4455
4460
  agentId: o,
@@ -4463,102 +4468,106 @@ function di(e) {
4463
4468
  revisedAnswers: m,
4464
4469
  model: h,
4465
4470
  actionsInput: g,
4466
- actions: Be,
4471
+ actions: Ue,
4467
4472
  agentFileUpload: _,
4468
4473
  agentVoice: v,
4469
- fallbackModels: y,
4470
- gatewayOptions: b,
4471
- externalContext: te,
4472
- agentHostTools: oe,
4473
- hostToolRegistry: pe,
4474
- hostToolsPending: me,
4474
+ fallbackModels: ee,
4475
+ gatewayOptions: y,
4476
+ externalContext: ne,
4477
+ agentHostTools: se,
4478
+ hostToolRegistry: me,
4479
+ hostToolsPending: he,
4475
4480
  agentPageAccess: be,
4476
4481
  pageToolRegistry: Te,
4477
4482
  pageFormsProvider: ke,
4478
4483
  pageAction: Ne,
4479
- hostStepTitles: Pe,
4480
- pageControlActive: w,
4481
- isWorking: Tn,
4482
- stopHostActions: j,
4483
- voicePageTools: ut,
4484
- cancelVoicePageCalls: dt,
4485
- pageNoticeLevel: qe,
4486
- closePageNotice: Je,
4487
- hostConfirmation: O,
4488
- respondHostConfirmation: it,
4489
- pageAccessAvailable: Ge,
4490
- pageAccessOff: He,
4491
- setPageAccessOff: mt,
4492
- systemTheme: Ie,
4493
- hideWelcomeMessage: Le,
4494
- isDark: ze,
4495
- chat: L,
4496
- messages: Ot,
4484
+ hostStepTitles: Ie,
4485
+ pageControlActive: Le,
4486
+ isWorking: q,
4487
+ stopHostActions: gt,
4488
+ voicePageTools: mt,
4489
+ cancelVoicePageCalls: ht,
4490
+ pageNoticeLevel: Xe,
4491
+ closePageNotice: Ze,
4492
+ hostConfirmation: A,
4493
+ respondHostConfirmation: ot,
4494
+ pageAccessAvailable: qe,
4495
+ pageAccessOff: Ge,
4496
+ setPageAccessOff: vt,
4497
+ pagePointer: Pe,
4498
+ pagePointerStart: w,
4499
+ pagePointing: Fe,
4500
+ pagePointerAvailable: Je,
4501
+ systemTheme: ze,
4502
+ hideWelcomeMessage: Be,
4503
+ isDark: He,
4504
+ chat: I,
4505
+ messages: Nt,
4497
4506
  conversations: R,
4498
- isLoadingConversations: At,
4499
- hasMoreConversations: B,
4500
- isLoadingMoreConversations: jt,
4507
+ isLoadingConversations: Pt,
4508
+ hasMoreConversations: It,
4509
+ isLoadingMoreConversations: z,
4501
4510
  chatFiles: V,
4502
- isLoadingChatFiles: Nt,
4503
- input: W,
4504
- pendingAttachments: G,
4505
- isAttachmentLimitReached: Wn,
4506
- fileLimitError: Gn,
4511
+ isLoadingChatFiles: Lt,
4512
+ input: H,
4513
+ pendingAttachments: U,
4514
+ isAttachmentLimitReached: Yn,
4515
+ fileLimitError: Xn,
4507
4516
  localChatId: E,
4508
- isConversationBlocked: Xe,
4509
- inputMessagePlaceholder: kt,
4510
- chatError: Ye,
4511
- runningChatIds: Dn,
4512
- backgroundAnswers: Mn,
4513
- openBackgroundAnswer: Nn,
4514
- dismissBackgroundAnswer: Pn,
4515
- canQueue: Gt,
4516
- queuedMessages: Wt,
4517
- removeQueuedMessage: Yt,
4518
- editQueuedMessage: Xt,
4519
- activeView: H,
4520
- inputFocusRequest: U,
4521
- messageFeedbacks: Pt,
4522
- feedbackDialogMessage: Ft,
4523
- isFeedbackSubmitting: It,
4524
- isFeedbackSubmitted: Lt,
4525
- feedbackSubmitError: Rt,
4526
- isLeadSubmitted: zt,
4527
- isLoadingSubmitLead: Bt,
4528
- submitLeadError: Vt,
4529
- buildDeviceContext: tt,
4530
- initialize: yn,
4531
- loadConversations: Zt,
4532
- loadMoreConversations: Qt,
4533
- searchConversations: $t,
4534
- loadChatFiles: en,
4535
- refreshMessages: mn,
4536
- appendMessage: hn,
4537
- getChatFileUrl: q,
4538
- getChatFilePreviewUrl: tn,
4539
- deleteChatFile: nn,
4540
- handleSubmit: bn,
4541
- sendMessage: Sn,
4542
- stopGeneration: Cn,
4543
- startNewChat: In,
4544
- regenerate: Ln,
4545
- addToolOutput: Rn,
4546
- addToolApprovalResponse: zn,
4547
- handleFileSelect: qn,
4548
- clearFileLimitError: Kn,
4549
- clearPendingAttachments: Fn,
4550
- onUpvote: Yn,
4551
- onDownvote: Xn,
4552
- onFeedback: Zn,
4553
- onFeedbackSubmit: Qn,
4554
- onLeadSubmit: $n,
4555
- navigate: nr,
4556
- focusInput: rr,
4557
- renameChatTitle: er,
4558
- deleteChat: tr
4517
+ isConversationBlocked: Qe,
4518
+ inputMessagePlaceholder: L,
4519
+ chatError: O,
4520
+ runningChatIds: Y,
4521
+ backgroundAnswers: Ln,
4522
+ openBackgroundAnswer: Rn,
4523
+ dismissBackgroundAnswer: zn,
4524
+ canQueue: Qt,
4525
+ queuedMessages: Zt,
4526
+ removeQueuedMessage: nn,
4527
+ editQueuedMessage: G,
4528
+ activeView: Rt,
4529
+ inputFocusRequest: zt,
4530
+ messageFeedbacks: Bt,
4531
+ feedbackDialogMessage: Vt,
4532
+ isFeedbackSubmitting: Ht,
4533
+ isFeedbackSubmitted: Ut,
4534
+ feedbackSubmitError: Wt,
4535
+ isLeadSubmitted: Gt,
4536
+ isLoadingSubmitLead: Kt,
4537
+ submitLeadError: qt,
4538
+ buildDeviceContext: rt,
4539
+ initialize: En,
4540
+ loadConversations: rn,
4541
+ loadMoreConversations: an,
4542
+ searchConversations: on,
4543
+ loadChatFiles: sn,
4544
+ refreshMessages: xn,
4545
+ appendMessage: Sn,
4546
+ getChatFileUrl: cn,
4547
+ getChatFilePreviewUrl: ln,
4548
+ deleteChatFile: un,
4549
+ handleSubmit: Dn,
4550
+ sendMessage: kn,
4551
+ stopGeneration: An,
4552
+ startNewChat: Vn,
4553
+ regenerate: Hn,
4554
+ addToolOutput: Un,
4555
+ addToolApprovalResponse: Wn,
4556
+ handleFileSelect: Qn,
4557
+ clearFileLimitError: Zn,
4558
+ clearPendingAttachments: Bn,
4559
+ onUpvote: er,
4560
+ onDownvote: tr,
4561
+ onFeedback: nr,
4562
+ onFeedbackSubmit: rr,
4563
+ onLeadSubmit: Q,
4564
+ navigate: or,
4565
+ focusInput: sr,
4566
+ renameChatTitle: ir,
4567
+ deleteChat: ar
4559
4568
  };
4560
4569
  })();
4561
4570
  }
4562
4571
  export { ft as a, hr as i, di as n, Gr as r, Kr as t };
4563
4572
 
4564
- //# sourceMappingURL=useChatbotStore-D7ZMA7Tr.js.map
4573
+ //# sourceMappingURL=useChatbotStore-C1lW6qXE.js.map