@8wave/ai-elements 0.121.0-beta.23 → 0.121.0-beta.24

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 (25) hide show
  1. package/dist/ai-elements.es.js +1301 -1225
  2. package/dist/ai-elements.es.js.map +1 -1
  3. package/dist-vue/PkChatbot.js +1 -1
  4. package/dist-vue/PkChatbotViewChat.js +1 -1
  5. package/dist-vue/PkChatbotViewConversations.js +1 -1
  6. package/dist-vue/PkChatbotViewFiles.js +1 -1
  7. package/dist-vue/PkChatbotViewProfile.js +1 -1
  8. package/dist-vue/_chunks/{PkChatbot-BFjoa5Wf.js → PkChatbot-BF4OzQEE.js} +6 -6
  9. package/dist-vue/_chunks/{PkChatbot-BFjoa5Wf.js.map → PkChatbot-BF4OzQEE.js.map} +1 -1
  10. package/dist-vue/_chunks/{PkChatbotViewChat-BgQ5OhkA.js → PkChatbotViewChat-CZBRaIn-.js} +2 -2
  11. package/dist-vue/_chunks/{PkChatbotViewChat-BgQ5OhkA.js.map → PkChatbotViewChat-CZBRaIn-.js.map} +1 -1
  12. package/dist-vue/_chunks/{PkChatbotViewConversations-dKZScKD9.js → PkChatbotViewConversations-DSSWFPod.js} +2 -2
  13. package/dist-vue/_chunks/{PkChatbotViewConversations-dKZScKD9.js.map → PkChatbotViewConversations-DSSWFPod.js.map} +1 -1
  14. package/dist-vue/_chunks/{PkChatbotViewFiles-CQC3rInD.js → PkChatbotViewFiles-CnAKz2X8.js} +2 -2
  15. package/dist-vue/_chunks/{PkChatbotViewFiles-CQC3rInD.js.map → PkChatbotViewFiles-CnAKz2X8.js.map} +1 -1
  16. package/dist-vue/_chunks/{PkChatbotViewProfile-CkZyWh4V.js → PkChatbotViewProfile-42pXpWbn.js} +2 -2
  17. package/dist-vue/_chunks/{PkChatbotViewProfile-CkZyWh4V.js.map → PkChatbotViewProfile-42pXpWbn.js.map} +1 -1
  18. package/dist-vue/_chunks/{useChatbotStore-CBjfSN69.js → useChatbotStore-CnCoo6j3.js} +1164 -1085
  19. package/dist-vue/_chunks/useChatbotStore-CnCoo6j3.js.map +1 -0
  20. package/dist-vue/composables.js +1 -1
  21. package/dist-vue/index.js +36 -36
  22. package/dist-vue/index.js.map +1 -1
  23. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +102 -7
  24. package/package.json +1 -1
  25. package/dist-vue/_chunks/useChatbotStore-CBjfSN69.js.map +0 -1
@@ -4,12 +4,12 @@ import { r as oe, t as se } from "./createChatbotApiClient-qHjpFqPL.js";
4
4
  import { n as ce } from "./src-BZRiAJsH.js";
5
5
  import { d as le, r as ue } from "./message-DZvfzt9j.js";
6
6
  import { n as de, t as fe } from "./useSafeLocalStorage-C1BlCeKw.js";
7
- import { computed as x, getCurrentScope as pe, isReadonly as S, onScopeDispose as me, reactive as he, ref as C, shallowRef as ge, toRefs as _e, watch as w, watchEffect as ve } from "vue";
8
- import { useI18n as ye } from "vue-i18n";
9
- import { usePreferredDark as be } from "@vueuse/core";
10
- import { defineStore as xe } from "pinia";
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 C, toRefs as ve, toValue as ye, watch as w, watchEffect as be } from "vue";
8
+ import { useI18n as xe } from "vue-i18n";
9
+ import { usePreferredDark as Se } from "@vueuse/core";
10
+ import { defineStore as Ce } from "pinia";
11
11
  //#region ../../packages/utils/src/device-context.ts
12
- function Se() {
12
+ function we() {
13
13
  let e = navigator.connection, t = navigator.userAgentData;
14
14
  return {
15
15
  dateTime: (/* @__PURE__ */ new Date()).toISOString(),
@@ -39,7 +39,7 @@ function Se() {
39
39
  historyLength: window.history.length
40
40
  };
41
41
  }
42
- async function Ce(e) {
42
+ async function Te(e) {
43
43
  if (!navigator.geolocation || !navigator.permissions) return null;
44
44
  try {
45
45
  if ((await navigator.permissions.query({ name: "geolocation" })).state !== "granted") return null;
@@ -58,12 +58,12 @@ async function Ce(e) {
58
58
  }
59
59
  //#endregion
60
60
  //#region ../../packages/composable/src/chatbot/hostTools.ts
61
- var we = "agentstudio:page-navigation", Te = (e) => typeof e?.afterOutput == "function", Ee = (e) => e.toolMetadata?.source === te, De = (e, t) => {
61
+ var Ee = "agentstudio:page-navigation", De = (e) => typeof e?.afterOutput == "function", Oe = (e) => e.toolMetadata?.source === te, ke = (e, t) => {
62
62
  if (!t || !e?.length) return;
63
63
  let n = new Set(t.allowed), r = e.filter((e) => n.has(e.name) && !re(e.name)).map(({ execute: e, confirmation: t, policy: n, ...r }) => r);
64
64
  return r.length > 0 ? r : void 0;
65
65
  };
66
- function Oe(e) {
66
+ function Ae(e) {
67
67
  let t = 0, n = 0, r = (t) => {
68
68
  n = t, e.onPendingChange?.(n);
69
69
  }, i = Promise.resolve(), a = /* @__PURE__ */ new Map(), o = (e, t) => t.requireConfirmation.includes(e.name) || t.confirmDestructive && e.annotations?.destructiveHint === !0, s = (t, n) => e.addToolOutput({
@@ -110,7 +110,7 @@ function Oe(e) {
110
110
  messageId: n.messageId
111
111
  }), t]);
112
112
  if (!i()) return;
113
- Te(r) ? (s(n, r.result ?? null), e.waitForResume().then((e) => {
113
+ De(r) ? (s(n, r.result ?? null), e.waitForResume().then((e) => {
114
114
  e && i() && r.afterOutput();
115
115
  })) : s(n, r ?? null);
116
116
  } catch (e) {
@@ -137,65 +137,65 @@ function Oe(e) {
137
137
  }
138
138
  //#endregion
139
139
  //#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.27/node_modules/@ai-sdk/provider/dist/index.js
140
- var ke = "vercel.ai.error", Ae = Symbol.for(ke), T = class e extends Error {
140
+ var je = "vercel.ai.error", Me = Symbol.for(je), T = class e extends Error {
141
141
  constructor({ name: e, message: t, cause: n }) {
142
- super(t), this[Ae] = !0, this.name = e, this.cause = n;
142
+ super(t), this[Me] = !0, this.name = e, this.cause = n;
143
143
  }
144
144
  static isInstance(t) {
145
- return e.hasMarker(t, ke);
145
+ return e.hasMarker(t, je);
146
146
  }
147
147
  static hasMarker(e, t) {
148
148
  let n = Symbol.for(t);
149
149
  return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
150
150
  }
151
- }, je = "AI_APICallError", E = `vercel.ai.error.${je}`, Me = Symbol.for(E), Ne = class extends T {
151
+ }, Ne = "AI_APICallError", E = `vercel.ai.error.${Ne}`, Pe = Symbol.for(E), Fe = class extends T {
152
152
  constructor({ message: e, url: t, requestBodyValues: n, statusCode: r, responseHeaders: i, responseBody: a, cause: o, isRetryable: s = r != null && (r === 408 || r === 409 || r === 429 || r >= 500), data: c }) {
153
153
  super({
154
- name: je,
154
+ name: Ne,
155
155
  message: e,
156
156
  cause: o
157
- }), this[Me] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
157
+ }), this[Pe] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
158
158
  }
159
159
  static isInstance(e) {
160
160
  return T.hasMarker(e, E);
161
161
  }
162
- }, D = "AI_EmptyResponseBodyError", O = `vercel.ai.error.${D}`, Pe = Symbol.for(O), Fe = class extends T {
162
+ }, D = "AI_EmptyResponseBodyError", O = `vercel.ai.error.${D}`, Ie = Symbol.for(O), Le = class extends T {
163
163
  constructor({ message: e = "Empty response body" } = {}) {
164
164
  super({
165
165
  name: D,
166
166
  message: e
167
- }), this[Pe] = !0;
167
+ }), this[Ie] = !0;
168
168
  }
169
169
  static isInstance(e) {
170
170
  return T.hasMarker(e, O);
171
171
  }
172
172
  };
173
- function Ie(e) {
173
+ function Re(e) {
174
174
  return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
175
175
  }
176
- var Le = "AI_InvalidArgumentError", Re = `vercel.ai.error.${Le}`, ze = Symbol.for(Re), Be = class extends T {
176
+ var ze = "AI_InvalidArgumentError", Be = `vercel.ai.error.${ze}`, Ve = Symbol.for(Be), He = class extends T {
177
177
  constructor({ message: e, cause: t, argument: n }) {
178
178
  super({
179
- name: Le,
179
+ name: ze,
180
180
  message: e,
181
181
  cause: t
182
- }), this[ze] = !0, this.argument = n;
182
+ }), this[Ve] = !0, this.argument = n;
183
183
  }
184
184
  static isInstance(e) {
185
- return T.hasMarker(e, Re);
185
+ return T.hasMarker(e, Be);
186
186
  }
187
- }, k = "AI_JSONParseError", Ve = `vercel.ai.error.${k}`, He = Symbol.for(Ve), Ue = class extends T {
187
+ }, k = "AI_JSONParseError", Ue = `vercel.ai.error.${k}`, We = Symbol.for(Ue), Ge = class extends T {
188
188
  constructor({ text: e, cause: t }) {
189
189
  super({
190
190
  name: k,
191
- message: `JSON parsing failed: Text: ${e}.\nError message: ${Ie(t)}`,
191
+ message: `JSON parsing failed: Text: ${e}.\nError message: ${Re(t)}`,
192
192
  cause: t
193
- }), this[He] = !0, this.text = e;
193
+ }), this[We] = !0, this.text = e;
194
194
  }
195
195
  static isInstance(e) {
196
- return T.hasMarker(e, Ve);
196
+ return T.hasMarker(e, Ue);
197
197
  }
198
- }, A = "AI_TypeValidationError", We = `vercel.ai.error.${A}`, Ge = Symbol.for(We), Ke = class e extends T {
198
+ }, A = "AI_TypeValidationError", Ke = `vercel.ai.error.${A}`, qe = Symbol.for(Ke), Je = class e extends T {
199
199
  constructor({ value: e, cause: t, context: n }) {
200
200
  let r = "Type validation failed";
201
201
  if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
@@ -205,12 +205,12 @@ var Le = "AI_InvalidArgumentError", Re = `vercel.ai.error.${Le}`, ze = Symbol.fo
205
205
  }
206
206
  super({
207
207
  name: A,
208
- message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${Ie(t)}`,
208
+ message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${Re(t)}`,
209
209
  cause: t
210
- }), this[Ge] = !0, this.value = e, this.context = n;
210
+ }), this[qe] = !0, this.value = e, this.context = n;
211
211
  }
212
212
  static isInstance(e) {
213
- return T.hasMarker(e, We);
213
+ return T.hasMarker(e, Ke);
214
214
  }
215
215
  static wrap({ value: t, cause: n, context: r }) {
216
216
  return e.isInstance(n) && n.value === t && n.context?.field === r?.field && n.context?.entityName === r?.entityName && n.context?.entityId === r?.entityId ? n : new e({
@@ -219,25 +219,25 @@ var Le = "AI_InvalidArgumentError", Re = `vercel.ai.error.${Le}`, ze = Symbol.fo
219
219
  context: r
220
220
  });
221
221
  }
222
- }, j = "AI_UnsupportedFunctionalityError", qe = `vercel.ai.error.${j}`, Je = Symbol.for(qe), Ye = class extends T {
222
+ }, j = "AI_UnsupportedFunctionalityError", Ye = `vercel.ai.error.${j}`, Xe = Symbol.for(Ye), Ze = class extends T {
223
223
  constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
224
224
  super({
225
225
  name: j,
226
226
  message: t
227
- }), this[Je] = !0, this.functionality = e;
227
+ }), this[Xe] = !0, this.functionality = e;
228
228
  }
229
229
  static isInstance(e) {
230
- return T.hasMarker(e, qe);
230
+ return T.hasMarker(e, Ye);
231
231
  }
232
- }, Xe = class extends Error {
232
+ }, Qe = class extends Error {
233
233
  constructor(e, t) {
234
234
  super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
235
235
  }
236
- }, M = 10, Ze = 13, N = 32;
237
- function Qe(e) {}
238
- function $e(e) {
236
+ }, M = 10, $e = 13, N = 32;
237
+ function P(e) {}
238
+ function et(e) {
239
239
  if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
240
- let { onEvent: t = Qe, onError: n = Qe, onRetry: r = Qe, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
240
+ let { onEvent: t = P, onError: n = P, onRetry: r = P, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
241
241
  function m(e) {
242
242
  if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
243
243
  if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
@@ -256,7 +256,7 @@ function $e(e) {
256
256
  n !== "" && (o.push(n), s = n.length), h();
257
257
  }
258
258
  function h() {
259
- a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new Xe(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
259
+ a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new Qe(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
260
260
  }
261
261
  function g(e) {
262
262
  let n = 0;
@@ -272,7 +272,7 @@ function $e(e) {
272
272
  continue;
273
273
  }
274
274
  let i = e.charCodeAt(n);
275
- if (et(e, n, i)) {
275
+ if (tt(e, n, i)) {
276
276
  let i = e.charCodeAt(n + 5) === N ? n + 6 : n + 5, a = e.slice(i, r);
277
277
  if (d === 0 && e.charCodeAt(r + 1) === M) {
278
278
  t({
@@ -284,7 +284,7 @@ function $e(e) {
284
284
  }
285
285
  u = d === 0 ? a : `${u}
286
286
  ${a}`, d++;
287
- } else tt(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === N ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
287
+ } else nt(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === N ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
288
288
  n = r + 1, r = e.indexOf("\n", n);
289
289
  }
290
290
  return e.slice(n);
@@ -292,7 +292,7 @@ ${a}`, d++;
292
292
  for (; n < e.length;) {
293
293
  let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
294
294
  if (t !== -1 && r !== -1 ? i = t < r ? t : r : t === -1 ? r !== -1 && (i = r) : i = t === e.length - 1 ? -1 : t, i === -1) break;
295
- _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === Ze && e.charCodeAt(n) === M && n++;
295
+ _(e, n, i), n = i + 1, e.charCodeAt(n - 1) === $e && e.charCodeAt(n) === M && n++;
296
296
  }
297
297
  return e.slice(n);
298
298
  }
@@ -302,13 +302,13 @@ ${a}`, d++;
302
302
  return;
303
303
  }
304
304
  let r = e.charCodeAt(t);
305
- if (et(e, t, r)) {
305
+ if (tt(e, t, r)) {
306
306
  let r = e.charCodeAt(t + 5) === N ? t + 6 : t + 5, i = e.slice(r, n);
307
307
  u = d === 0 ? i : `${u}
308
308
  ${i}`, d++;
309
309
  return;
310
310
  }
311
- if (tt(e, t, r)) {
311
+ if (nt(e, t, r)) {
312
312
  f = e.slice(e.charCodeAt(t + 6) === N ? t + 7 : t + 6, n) || void 0;
313
313
  return;
314
314
  }
@@ -345,13 +345,13 @@ ${t}`, d++;
345
345
  l = t.includes("\0") ? void 0 : t;
346
346
  break;
347
347
  case "retry":
348
- /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new Xe(`Invalid \`retry\` value: "${t}"`, {
348
+ /^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new Qe(`Invalid \`retry\` value: "${t}"`, {
349
349
  type: "invalid-retry",
350
350
  value: t,
351
351
  line: i
352
352
  }));
353
353
  break;
354
- default: n(new Xe(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
354
+ default: n(new Qe(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
355
355
  type: "unknown-field",
356
356
  field: e,
357
357
  value: t,
@@ -378,20 +378,20 @@ ${t}`, d++;
378
378
  reset: b
379
379
  };
380
380
  }
381
- function et(e, t, n) {
381
+ function tt(e, t, n) {
382
382
  return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
383
383
  }
384
- function tt(e, t, n) {
384
+ function nt(e, t, n) {
385
385
  return n === 101 && e.charCodeAt(t + 1) === 118 && e.charCodeAt(t + 2) === 101 && e.charCodeAt(t + 3) === 110 && e.charCodeAt(t + 4) === 116 && e.charCodeAt(t + 5) === 58;
386
386
  }
387
387
  //#endregion
388
388
  //#region ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
389
- var nt = class extends TransformStream {
389
+ var rt = class extends TransformStream {
390
390
  constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
391
391
  let i;
392
392
  super({
393
393
  start(a) {
394
- i = $e({
394
+ i = et({
395
395
  onEvent: (e) => {
396
396
  a.enqueue(e);
397
397
  },
@@ -410,7 +410,7 @@ var nt = class extends TransformStream {
410
410
  }
411
411
  };
412
412
  new TextDecoder();
413
- var { btoa: P, atob: rt } = globalThis;
413
+ var { btoa: it, atob: at } = globalThis;
414
414
  function F(e) {
415
415
  if (e == null) return {};
416
416
  let t = {};
@@ -430,21 +430,21 @@ var I = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRS
430
430
  return r.join("");
431
431
  };
432
432
  if (e == null) return i;
433
- if (n.includes(r)) throw new Be({
433
+ if (n.includes(r)) throw new He({
434
434
  argument: "separator",
435
435
  message: `The separator "${r}" must not be part of the alphabet "${n}".`
436
436
  });
437
437
  return () => `${e}${r}${i()}`;
438
438
  }, L = I();
439
- function it(e) {
439
+ function R(e) {
440
440
  return globalThis.Buffer?.isBuffer(e) ?? !1;
441
441
  }
442
- var R = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, at = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
443
- function ot(e) {
442
+ var ot = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, st = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
443
+ function z(e) {
444
444
  let t = JSON.parse(e);
445
- return typeof t != "object" || !t || R.test(e) === !1 && at.test(e) === !1 ? t : st(t);
445
+ return typeof t != "object" || !t || ot.test(e) === !1 && st.test(e) === !1 ? t : ct(t);
446
446
  }
447
- function st(e) {
447
+ function ct(e) {
448
448
  let t = [e];
449
449
  for (; t.length;) {
450
450
  let e = t;
@@ -459,35 +459,35 @@ function st(e) {
459
459
  }
460
460
  return e;
461
461
  }
462
- function ct(e) {
462
+ function lt(e) {
463
463
  let { stackTraceLimit: t } = Error;
464
464
  try {
465
465
  Error.stackTraceLimit = 0;
466
466
  } catch {
467
- return ot(e);
467
+ return z(e);
468
468
  }
469
469
  try {
470
- return ot(e);
470
+ return z(e);
471
471
  } finally {
472
472
  Error.stackTraceLimit = t;
473
473
  }
474
474
  }
475
- function lt(e) {
475
+ function ut(e) {
476
476
  if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
477
477
  let { additionalProperties: t } = e;
478
- e.additionalProperties = t != null && typeof t != "boolean" && z(t);
478
+ e.additionalProperties = t != null && typeof t != "boolean" && B(t);
479
479
  let { properties: n } = e;
480
- if (n != null) for (let e of Object.keys(n)) n[e] = z(n[e]);
480
+ if (n != null) for (let e of Object.keys(n)) n[e] = B(n[e]);
481
481
  }
482
- e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(z) : z(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(z)), e.allOf != null && (e.allOf = e.allOf.map(z)), e.oneOf != null && (e.oneOf = e.oneOf.map(z));
482
+ e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(B) : B(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(B)), e.allOf != null && (e.allOf = e.allOf.map(B)), e.oneOf != null && (e.oneOf = e.oneOf.map(B));
483
483
  let { definitions: t } = e;
484
- if (t != null) for (let e of Object.keys(t)) t[e] = z(t[e]);
484
+ if (t != null) for (let e of Object.keys(t)) t[e] = B(t[e]);
485
485
  return e;
486
486
  }
487
- function z(e) {
488
- return typeof e == "boolean" ? e : lt(e);
487
+ function B(e) {
488
+ return typeof e == "boolean" ? e : ut(e);
489
489
  }
490
- var ut = Symbol("Let zodToJsonSchema decide on which parser to use"), B = {
490
+ var dt = Symbol("Let zodToJsonSchema decide on which parser to use"), ft = {
491
491
  name: void 0,
492
492
  $refStrategy: "root",
493
493
  basePath: ["#"],
@@ -507,24 +507,24 @@ var ut = Symbol("Let zodToJsonSchema decide on which parser to use"), B = {
507
507
  emailStrategy: "format:email",
508
508
  base64Strategy: "contentEncoding:base64",
509
509
  nameStrategy: "ref"
510
- }, V = (e) => typeof e == "string" ? {
511
- ...B,
510
+ }, pt = (e) => typeof e == "string" ? {
511
+ ...ft,
512
512
  name: e
513
513
  } : {
514
- ...B,
514
+ ...ft,
515
515
  ...e
516
516
  };
517
- function H() {
517
+ function V() {
518
518
  return {};
519
519
  }
520
- function dt(e, t) {
520
+ function H(e, t) {
521
521
  let n = { type: "array" };
522
- return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = K(e.type._def, {
522
+ return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = q(e.type._def, {
523
523
  ...t,
524
524
  currentPath: [...t.currentPath, "items"]
525
525
  })), e.minLength && (n.minItems = e.minLength.value), e.maxLength && (n.maxItems = e.maxLength.value), e.exactLength && (n.minItems = e.exactLength.value, n.maxItems = e.exactLength.value), n;
526
526
  }
527
- function ft(e) {
527
+ function U(e) {
528
528
  let t = {
529
529
  type: "integer",
530
530
  format: "int64"
@@ -541,16 +541,16 @@ function ft(e) {
541
541
  }
542
542
  return t;
543
543
  }
544
- function pt() {
544
+ function mt() {
545
545
  return { type: "boolean" };
546
546
  }
547
- function mt(e, t) {
548
- return K(e.type._def, t);
547
+ function ht(e, t) {
548
+ return q(e.type._def, t);
549
549
  }
550
- var ht = (e, t) => K(e.innerType._def, t);
551
- function gt(e, t, n) {
550
+ var gt = (e, t) => q(e.innerType._def, t);
551
+ function _t(e, t, n) {
552
552
  let r = n ?? t.dateStrategy;
553
- if (Array.isArray(r)) return { anyOf: r.map((n) => gt(e, t, n)) };
553
+ if (Array.isArray(r)) return { anyOf: r.map((n) => _t(e, t, n)) };
554
554
  switch (r) {
555
555
  case "string":
556
556
  case "format:date-time": return {
@@ -561,10 +561,10 @@ function gt(e, t, n) {
561
561
  type: "string",
562
562
  format: "date"
563
563
  };
564
- case "integer": return _t(e);
564
+ case "integer": return vt(e);
565
565
  }
566
566
  }
567
- var _t = (e) => {
567
+ var vt = (e) => {
568
568
  let t = {
569
569
  type: "integer",
570
570
  format: "unix-time"
@@ -577,31 +577,31 @@ var _t = (e) => {
577
577
  }
578
578
  return t;
579
579
  };
580
- function vt(e, t) {
580
+ function yt(e, t) {
581
581
  return {
582
- ...K(e.innerType._def, t),
582
+ ...q(e.innerType._def, t),
583
583
  default: e.defaultValue()
584
584
  };
585
585
  }
586
- function yt(e, t) {
587
- return t.effectStrategy === "input" ? K(e.schema._def, t) : H();
586
+ function bt(e, t) {
587
+ return t.effectStrategy === "input" ? q(e.schema._def, t) : V();
588
588
  }
589
- function bt(e) {
589
+ function xt(e) {
590
590
  return {
591
591
  type: "string",
592
592
  enum: Array.from(e.values)
593
593
  };
594
594
  }
595
- var xt = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
596
- function St(e, t) {
597
- let n = [K(e.left._def, {
595
+ var St = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
596
+ function Ct(e, t) {
597
+ let n = [q(e.left._def, {
598
598
  ...t,
599
599
  currentPath: [
600
600
  ...t.currentPath,
601
601
  "allOf",
602
602
  "0"
603
603
  ]
604
- }), K(e.right._def, {
604
+ }), q(e.right._def, {
605
605
  ...t,
606
606
  currentPath: [
607
607
  ...t.currentPath,
@@ -610,7 +610,7 @@ function St(e, t) {
610
610
  ]
611
611
  })].filter((e) => !!e), r = [];
612
612
  return n.forEach((e) => {
613
- if (xt(e)) r.push(...e.allOf);
613
+ if (St(e)) r.push(...e.allOf);
614
614
  else {
615
615
  let t = e;
616
616
  if ("additionalProperties" in e && e.additionalProperties === !1) {
@@ -621,19 +621,19 @@ function St(e, t) {
621
621
  }
622
622
  }), r.length ? { allOf: r } : void 0;
623
623
  }
624
- function Ct(e) {
624
+ function wt(e) {
625
625
  let t = typeof e.value;
626
626
  return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
627
627
  type: t === "bigint" ? "integer" : t,
628
628
  const: e.value
629
629
  };
630
630
  }
631
- var wt = void 0, U = {
631
+ var Tt = void 0, W = {
632
632
  cuid: /^[cC][^\s-]{8,}$/,
633
633
  cuid2: /^[0-9a-z]+$/,
634
634
  ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
635
635
  email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
636
- emoji: () => (wt === void 0 && (wt = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), wt),
636
+ emoji: () => (Tt === void 0 && (Tt = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), Tt),
637
637
  uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
638
638
  ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
639
639
  ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
@@ -644,7 +644,7 @@ var wt = void 0, U = {
644
644
  nanoid: /^[a-zA-Z0-9_-]{21}$/,
645
645
  jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
646
646
  };
647
- function Tt(e, t) {
647
+ function Et(e, t) {
648
648
  let n = { type: "string" };
649
649
  if (e.checks) for (let r of e.checks) switch (r.kind) {
650
650
  case "min":
@@ -656,108 +656,108 @@ function Tt(e, t) {
656
656
  case "email":
657
657
  switch (t.emailStrategy) {
658
658
  case "format:email":
659
- W(n, "email", r.message, t);
659
+ G(n, "email", r.message, t);
660
660
  break;
661
661
  case "format:idn-email":
662
- W(n, "idn-email", r.message, t);
662
+ G(n, "idn-email", r.message, t);
663
663
  break;
664
- case "pattern:zod": G(n, U.email, r.message, t);
664
+ case "pattern:zod": K(n, W.email, r.message, t);
665
665
  }
666
666
  break;
667
667
  case "url":
668
- W(n, "uri", r.message, t);
668
+ G(n, "uri", r.message, t);
669
669
  break;
670
670
  case "uuid":
671
- W(n, "uuid", r.message, t);
671
+ G(n, "uuid", r.message, t);
672
672
  break;
673
673
  case "regex":
674
- G(n, r.regex, r.message, t);
674
+ K(n, r.regex, r.message, t);
675
675
  break;
676
676
  case "cuid":
677
- G(n, U.cuid, r.message, t);
677
+ K(n, W.cuid, r.message, t);
678
678
  break;
679
679
  case "cuid2":
680
- G(n, U.cuid2, r.message, t);
680
+ K(n, W.cuid2, r.message, t);
681
681
  break;
682
682
  case "startsWith":
683
- G(n, RegExp(`^${Et(r.value, t)}`), r.message, t);
683
+ K(n, RegExp(`^${Dt(r.value, t)}`), r.message, t);
684
684
  break;
685
685
  case "endsWith":
686
- G(n, RegExp(`${Et(r.value, t)}$`), r.message, t);
686
+ K(n, RegExp(`${Dt(r.value, t)}$`), r.message, t);
687
687
  break;
688
688
  case "datetime":
689
- W(n, "date-time", r.message, t);
689
+ G(n, "date-time", r.message, t);
690
690
  break;
691
691
  case "date":
692
- W(n, "date", r.message, t);
692
+ G(n, "date", r.message, t);
693
693
  break;
694
694
  case "time":
695
- W(n, "time", r.message, t);
695
+ G(n, "time", r.message, t);
696
696
  break;
697
697
  case "duration":
698
- W(n, "duration", r.message, t);
698
+ G(n, "duration", r.message, t);
699
699
  break;
700
700
  case "length":
701
701
  n.minLength = typeof n.minLength == "number" ? Math.max(n.minLength, r.value) : r.value, n.maxLength = typeof n.maxLength == "number" ? Math.min(n.maxLength, r.value) : r.value;
702
702
  break;
703
703
  case "includes":
704
- G(n, RegExp(Et(r.value, t)), r.message, t);
704
+ K(n, RegExp(Dt(r.value, t)), r.message, t);
705
705
  break;
706
706
  case "ip":
707
- r.version !== "v6" && W(n, "ipv4", r.message, t), r.version !== "v4" && W(n, "ipv6", r.message, t);
707
+ r.version !== "v6" && G(n, "ipv4", r.message, t), r.version !== "v4" && G(n, "ipv6", r.message, t);
708
708
  break;
709
709
  case "base64url":
710
- G(n, U.base64url, r.message, t);
710
+ K(n, W.base64url, r.message, t);
711
711
  break;
712
712
  case "jwt":
713
- G(n, U.jwt, r.message, t);
713
+ K(n, W.jwt, r.message, t);
714
714
  break;
715
715
  case "cidr":
716
- r.version !== "v6" && G(n, U.ipv4Cidr, r.message, t), r.version !== "v4" && G(n, U.ipv6Cidr, r.message, t);
716
+ r.version !== "v6" && K(n, W.ipv4Cidr, r.message, t), r.version !== "v4" && K(n, W.ipv6Cidr, r.message, t);
717
717
  break;
718
718
  case "emoji":
719
- G(n, U.emoji(), r.message, t);
719
+ K(n, W.emoji(), r.message, t);
720
720
  break;
721
721
  case "ulid":
722
- G(n, U.ulid, r.message, t);
722
+ K(n, W.ulid, r.message, t);
723
723
  break;
724
724
  case "base64":
725
725
  switch (t.base64Strategy) {
726
726
  case "format:binary":
727
- W(n, "binary", r.message, t);
727
+ G(n, "binary", r.message, t);
728
728
  break;
729
729
  case "contentEncoding:base64":
730
730
  n.contentEncoding = "base64";
731
731
  break;
732
- case "pattern:zod": G(n, U.base64, r.message, t);
732
+ case "pattern:zod": K(n, W.base64, r.message, t);
733
733
  }
734
734
  break;
735
- case "nanoid": G(n, U.nanoid, r.message, t);
735
+ case "nanoid": K(n, W.nanoid, r.message, t);
736
736
  }
737
737
  return n;
738
738
  }
739
- function Et(e, t) {
740
- return t.patternStrategy === "escape" ? Ot(e) : e;
739
+ function Dt(e, t) {
740
+ return t.patternStrategy === "escape" ? kt(e) : e;
741
741
  }
742
- var Dt = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
743
- function Ot(e) {
742
+ var Ot = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
743
+ function kt(e) {
744
744
  let t = "";
745
- for (let n = 0; n < e.length; n++) Dt.has(e[n]) || (t += "\\"), t += e[n];
745
+ for (let n = 0; n < e.length; n++) Ot.has(e[n]) || (t += "\\"), t += e[n];
746
746
  return t;
747
747
  }
748
- function W(e, t, n, r) {
748
+ function G(e, t, n, r) {
749
749
  e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
750
750
  format: t,
751
751
  ...n && r.errorMessages && { errorMessage: { format: n } }
752
752
  })) : e.format = t;
753
753
  }
754
- function G(e, t, n, r) {
754
+ function K(e, t, n, r) {
755
755
  e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
756
- pattern: kt(t, r),
756
+ pattern: At(t, r),
757
757
  ...n && r.errorMessages && { errorMessage: { pattern: n } }
758
- })) : e.pattern = kt(t, r);
758
+ })) : e.pattern = At(t, r);
759
759
  }
760
- function kt(e, t) {
760
+ function At(e, t) {
761
761
  if (!t.applyRegexFlags || !e.flags) return e.source;
762
762
  let n = {
763
763
  i: e.flags.includes("i"),
@@ -796,16 +796,16 @@ function kt(e, t) {
796
796
  }
797
797
  return i;
798
798
  }
799
- function At(e, t) {
799
+ function jt(e, t) {
800
800
  let n = {
801
801
  type: "object",
802
- additionalProperties: K(e.valueType._def, {
802
+ additionalProperties: q(e.valueType._def, {
803
803
  ...t,
804
804
  currentPath: [...t.currentPath, "additionalProperties"]
805
805
  }) ?? t.allowedAdditionalProperties
806
806
  };
807
807
  if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
808
- let { type: r, ...i } = Tt(e.keyType._def, t);
808
+ let { type: r, ...i } = Et(e.keyType._def, t);
809
809
  return {
810
810
  ...n,
811
811
  propertyNames: i
@@ -816,7 +816,7 @@ function At(e, t) {
816
816
  propertyNames: { enum: e.keyType._def.values }
817
817
  };
818
818
  if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
819
- let { type: r, ...i } = mt(e.keyType._def, t);
819
+ let { type: r, ...i } = ht(e.keyType._def, t);
820
820
  return {
821
821
  ...n,
822
822
  propertyNames: i
@@ -824,13 +824,13 @@ function At(e, t) {
824
824
  }
825
825
  return n;
826
826
  }
827
- function jt(e, t) {
828
- return t.mapStrategy === "record" ? At(e, t) : {
827
+ function Mt(e, t) {
828
+ return t.mapStrategy === "record" ? jt(e, t) : {
829
829
  type: "array",
830
830
  maxItems: 125,
831
831
  items: {
832
832
  type: "array",
833
- items: [K(e.keyType._def, {
833
+ items: [q(e.keyType._def, {
834
834
  ...t,
835
835
  currentPath: [
836
836
  ...t.currentPath,
@@ -838,7 +838,7 @@ function jt(e, t) {
838
838
  "items",
839
839
  "0"
840
840
  ]
841
- }) || H(), K(e.valueType._def, {
841
+ }) || V(), q(e.valueType._def, {
842
842
  ...t,
843
843
  currentPath: [
844
844
  ...t.currentPath,
@@ -846,37 +846,37 @@ function jt(e, t) {
846
846
  "items",
847
847
  "1"
848
848
  ]
849
- }) || H()],
849
+ }) || V()],
850
850
  minItems: 2,
851
851
  maxItems: 2
852
852
  }
853
853
  };
854
854
  }
855
- function Mt(e) {
855
+ function Nt(e) {
856
856
  let t = e.values, n = Object.keys(e.values).filter((e) => typeof t[t[e]] != "number").map((e) => t[e]), r = Array.from(new Set(n.map((e) => typeof e)));
857
857
  return {
858
858
  type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
859
859
  enum: n
860
860
  };
861
861
  }
862
- function Nt() {
863
- return { not: H() };
864
- }
865
862
  function Pt() {
863
+ return { not: V() };
864
+ }
865
+ function Ft() {
866
866
  return { type: "null" };
867
867
  }
868
- var Ft = {
868
+ var It = {
869
869
  ZodString: "string",
870
870
  ZodNumber: "number",
871
871
  ZodBigInt: "integer",
872
872
  ZodBoolean: "boolean",
873
873
  ZodNull: "null"
874
874
  };
875
- function It(e, t) {
875
+ function Lt(e, t) {
876
876
  let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
877
- if (n.every((e) => e._def.typeName in Ft && (!e._def.checks || !e._def.checks.length))) {
877
+ if (n.every((e) => e._def.typeName in It && (!e._def.checks || !e._def.checks.length))) {
878
878
  let e = n.reduce((e, t) => {
879
- let n = Ft[t._def.typeName];
879
+ let n = It[t._def.typeName];
880
880
  return n && !e.includes(n) ? [...e, n] : e;
881
881
  }, []);
882
882
  return { type: e.length > 1 ? e : e[0] };
@@ -904,10 +904,10 @@ function It(e, t) {
904
904
  type: "string",
905
905
  enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
906
906
  };
907
- return Lt(e, t);
907
+ return Rt(e, t);
908
908
  }
909
- var Lt = (e, t) => {
910
- let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => K(e._def, {
909
+ var Rt = (e, t) => {
910
+ let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => q(e._def, {
911
911
  ...t,
912
912
  currentPath: [
913
913
  ...t.currentPath,
@@ -917,15 +917,15 @@ var Lt = (e, t) => {
917
917
  })).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
918
918
  return n.length ? { anyOf: n } : void 0;
919
919
  };
920
- function Rt(e, t) {
920
+ function zt(e, t) {
921
921
  if ([
922
922
  "ZodString",
923
923
  "ZodNumber",
924
924
  "ZodBigInt",
925
925
  "ZodBoolean",
926
926
  "ZodNull"
927
- ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Ft[e.innerType._def.typeName], "null"] };
928
- let n = K(e.innerType._def, {
927
+ ].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [It[e.innerType._def.typeName], "null"] };
928
+ let n = q(e.innerType._def, {
929
929
  ...t,
930
930
  currentPath: [
931
931
  ...t.currentPath,
@@ -935,7 +935,7 @@ function Rt(e, t) {
935
935
  });
936
936
  return n && { anyOf: [n, { type: "null" }] };
937
937
  }
938
- function zt(e) {
938
+ function Bt(e) {
939
939
  let t = { type: "number" };
940
940
  if (!e.checks) return t;
941
941
  for (let n of e.checks) switch (n.kind) {
@@ -952,7 +952,7 @@ function zt(e) {
952
952
  }
953
953
  return t;
954
954
  }
955
- function Bt(e, t) {
955
+ function Vt(e, t) {
956
956
  let n = {
957
957
  type: "object",
958
958
  properties: {}
@@ -960,7 +960,7 @@ function Bt(e, t) {
960
960
  for (let e in i) {
961
961
  let a = i[e];
962
962
  if (a === void 0 || a._def === void 0) continue;
963
- let o = Ht(a), s = K(a._def, {
963
+ let o = Ut(a), s = q(a._def, {
964
964
  ...t,
965
965
  currentPath: [
966
966
  ...t.currentPath,
@@ -976,11 +976,11 @@ function Bt(e, t) {
976
976
  s !== void 0 && (n.properties[e] = s, o || r.push(e));
977
977
  }
978
978
  r.length && (n.required = r);
979
- let a = Vt(e, t);
979
+ let a = Ht(e, t);
980
980
  return a !== void 0 && (n.additionalProperties = a), n;
981
981
  }
982
- function Vt(e, t) {
983
- if (e.catchall._def.typeName !== "ZodNever") return K(e.catchall._def, {
982
+ function Ht(e, t) {
983
+ if (e.catchall._def.typeName !== "ZodNever") return q(e.catchall._def, {
984
984
  ...t,
985
985
  currentPath: [...t.currentPath, "additionalProperties"]
986
986
  });
@@ -990,16 +990,16 @@ function Vt(e, t) {
990
990
  case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
991
991
  }
992
992
  }
993
- function Ht(e) {
993
+ function Ut(e) {
994
994
  try {
995
995
  return e.isOptional();
996
996
  } catch {
997
997
  return !0;
998
998
  }
999
999
  }
1000
- var Ut = (e, t) => {
1001
- if (t.currentPath.toString() === t.propertyPath?.toString()) return K(e.innerType._def, t);
1002
- let n = K(e.innerType._def, {
1000
+ var Wt = (e, t) => {
1001
+ if (t.currentPath.toString() === t.propertyPath?.toString()) return q(e.innerType._def, t);
1002
+ let n = q(e.innerType._def, {
1003
1003
  ...t,
1004
1004
  currentPath: [
1005
1005
  ...t.currentPath,
@@ -1007,11 +1007,11 @@ var Ut = (e, t) => {
1007
1007
  "1"
1008
1008
  ]
1009
1009
  });
1010
- return n ? { anyOf: [{ not: H() }, n] } : H();
1011
- }, Wt = (e, t) => {
1012
- if (t.pipeStrategy === "input") return K(e.in._def, t);
1013
- if (t.pipeStrategy === "output") return K(e.out._def, t);
1014
- let n = K(e.in._def, {
1010
+ return n ? { anyOf: [{ not: V() }, n] } : V();
1011
+ }, Gt = (e, t) => {
1012
+ if (t.pipeStrategy === "input") return q(e.in._def, t);
1013
+ if (t.pipeStrategy === "output") return q(e.out._def, t);
1014
+ let n = q(e.in._def, {
1015
1015
  ...t,
1016
1016
  currentPath: [
1017
1017
  ...t.currentPath,
@@ -1019,7 +1019,7 @@ var Ut = (e, t) => {
1019
1019
  "0"
1020
1020
  ]
1021
1021
  });
1022
- return { allOf: [n, K(e.out._def, {
1022
+ return { allOf: [n, q(e.out._def, {
1023
1023
  ...t,
1024
1024
  currentPath: [
1025
1025
  ...t.currentPath,
@@ -1028,25 +1028,25 @@ var Ut = (e, t) => {
1028
1028
  ]
1029
1029
  })].filter((e) => e !== void 0) };
1030
1030
  };
1031
- function Gt(e, t) {
1032
- return K(e.type._def, t);
1033
- }
1034
1031
  function Kt(e, t) {
1032
+ return q(e.type._def, t);
1033
+ }
1034
+ function qt(e, t) {
1035
1035
  let n = {
1036
1036
  type: "array",
1037
1037
  uniqueItems: !0,
1038
- items: K(e.valueType._def, {
1038
+ items: q(e.valueType._def, {
1039
1039
  ...t,
1040
1040
  currentPath: [...t.currentPath, "items"]
1041
1041
  })
1042
1042
  };
1043
1043
  return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
1044
1044
  }
1045
- function qt(e, t) {
1045
+ function Jt(e, t) {
1046
1046
  return e.rest ? {
1047
1047
  type: "array",
1048
1048
  minItems: e.items.length,
1049
- items: e.items.map((e, n) => K(e._def, {
1049
+ items: e.items.map((e, n) => q(e._def, {
1050
1050
  ...t,
1051
1051
  currentPath: [
1052
1052
  ...t.currentPath,
@@ -1054,7 +1054,7 @@ function qt(e, t) {
1054
1054
  `${n}`
1055
1055
  ]
1056
1056
  })).reduce((e, t) => t === void 0 ? e : [...e, t], []),
1057
- additionalItems: K(e.rest._def, {
1057
+ additionalItems: q(e.rest._def, {
1058
1058
  ...t,
1059
1059
  currentPath: [...t.currentPath, "additionalItems"]
1060
1060
  })
@@ -1062,7 +1062,7 @@ function qt(e, t) {
1062
1062
  type: "array",
1063
1063
  minItems: e.items.length,
1064
1064
  maxItems: e.items.length,
1065
- items: e.items.map((e, n) => K(e._def, {
1065
+ items: e.items.map((e, n) => q(e._def, {
1066
1066
  ...t,
1067
1067
  currentPath: [
1068
1068
  ...t.currentPath,
@@ -1072,47 +1072,47 @@ function qt(e, t) {
1072
1072
  })).reduce((e, t) => t === void 0 ? e : [...e, t], [])
1073
1073
  };
1074
1074
  }
1075
- function Jt() {
1076
- return { not: H() };
1077
- }
1078
1075
  function Yt() {
1079
- return H();
1076
+ return { not: V() };
1077
+ }
1078
+ function Xt() {
1079
+ return V();
1080
1080
  }
1081
- var Xt = (e, t) => K(e.innerType._def, t), Zt = (e, t, n) => {
1081
+ var Zt = (e, t) => q(e.innerType._def, t), Qt = (e, t, n) => {
1082
1082
  switch (t) {
1083
- case "ZodString": return Tt(e, n);
1084
- case "ZodNumber": return zt(e);
1085
- case "ZodObject": return Bt(e, n);
1086
- case "ZodBigInt": return ft(e);
1087
- case "ZodBoolean": return pt();
1088
- case "ZodDate": return gt(e, n);
1089
- case "ZodUndefined": return Jt();
1090
- case "ZodNull": return Pt();
1091
- case "ZodArray": return dt(e, n);
1083
+ case "ZodString": return Et(e, n);
1084
+ case "ZodNumber": return Bt(e);
1085
+ case "ZodObject": return Vt(e, n);
1086
+ case "ZodBigInt": return U(e);
1087
+ case "ZodBoolean": return mt();
1088
+ case "ZodDate": return _t(e, n);
1089
+ case "ZodUndefined": return Yt();
1090
+ case "ZodNull": return Ft();
1091
+ case "ZodArray": return H(e, n);
1092
1092
  case "ZodUnion":
1093
- case "ZodDiscriminatedUnion": return It(e, n);
1094
- case "ZodIntersection": return St(e, n);
1095
- case "ZodTuple": return qt(e, n);
1096
- case "ZodRecord": return At(e, n);
1097
- case "ZodLiteral": return Ct(e);
1098
- case "ZodEnum": return bt(e);
1099
- case "ZodNativeEnum": return Mt(e);
1100
- case "ZodNullable": return Rt(e, n);
1101
- case "ZodOptional": return Ut(e, n);
1102
- case "ZodMap": return jt(e, n);
1103
- case "ZodSet": return Kt(e, n);
1093
+ case "ZodDiscriminatedUnion": return Lt(e, n);
1094
+ case "ZodIntersection": return Ct(e, n);
1095
+ case "ZodTuple": return Jt(e, n);
1096
+ case "ZodRecord": return jt(e, n);
1097
+ case "ZodLiteral": return wt(e);
1098
+ case "ZodEnum": return xt(e);
1099
+ case "ZodNativeEnum": return Nt(e);
1100
+ case "ZodNullable": return zt(e, n);
1101
+ case "ZodOptional": return Wt(e, n);
1102
+ case "ZodMap": return Mt(e, n);
1103
+ case "ZodSet": return qt(e, n);
1104
1104
  case "ZodLazy": return () => e.getter()._def;
1105
- case "ZodPromise": return Gt(e, n);
1105
+ case "ZodPromise": return Kt(e, n);
1106
1106
  case "ZodNaN":
1107
- case "ZodNever": return Nt();
1108
- case "ZodEffects": return yt(e, n);
1109
- case "ZodAny": return H();
1110
- case "ZodUnknown": return Yt();
1111
- case "ZodDefault": return vt(e, n);
1112
- case "ZodBranded": return mt(e, n);
1113
- case "ZodReadonly": return Xt(e, n);
1114
- case "ZodCatch": return ht(e, n);
1115
- case "ZodPipeline": return Wt(e, n);
1107
+ case "ZodNever": return Pt();
1108
+ case "ZodEffects": return bt(e, n);
1109
+ case "ZodAny": return V();
1110
+ case "ZodUnknown": return Xt();
1111
+ case "ZodDefault": return yt(e, n);
1112
+ case "ZodBranded": return ht(e, n);
1113
+ case "ZodReadonly": return Zt(e, n);
1114
+ case "ZodCatch": return gt(e, n);
1115
+ case "ZodPipeline": return Gt(e, n);
1116
1116
  case "ZodFunction":
1117
1117
  case "ZodVoid":
1118
1118
  case "ZodSymbol": return;
@@ -1120,19 +1120,19 @@ var Xt = (e, t) => K(e.innerType._def, t), Zt = (e, t, n) => {
1120
1120
  /* c8 ignore next */
1121
1121
  return ((e) => void 0)(t);
1122
1122
  }
1123
- }, Qt = (e, t) => {
1123
+ }, $t = (e, t) => {
1124
1124
  let n = 0;
1125
1125
  for (; n < e.length && n < t.length && e[n] === t[n]; n++);
1126
1126
  return [(e.length - n).toString(), ...t.slice(n)].join("/");
1127
1127
  };
1128
- function K(e, t, n = !1) {
1128
+ function q(e, t, n = !1) {
1129
1129
  let r = t.seen.get(e);
1130
1130
  if (t.override) {
1131
1131
  let i = t.override?.(e, t, r, n);
1132
- if (i !== ut) return i;
1132
+ if (i !== dt) return i;
1133
1133
  }
1134
1134
  if (r && !n) {
1135
- let e = $t(r, t);
1135
+ let e = en(r, t);
1136
1136
  if (e !== void 0) return e;
1137
1137
  }
1138
1138
  let i = {
@@ -1141,22 +1141,22 @@ function K(e, t, n = !1) {
1141
1141
  jsonSchema: void 0
1142
1142
  };
1143
1143
  t.seen.set(e, i);
1144
- let a = Zt(e, e.typeName, t), o = typeof a == "function" ? K(a(), t) : a;
1145
- if (o && en(e, t, o), t.postProcess) {
1144
+ let a = Qt(e, e.typeName, t), o = typeof a == "function" ? q(a(), t) : a;
1145
+ if (o && tn(e, t, o), t.postProcess) {
1146
1146
  let n = t.postProcess(o, e, t);
1147
1147
  return i.jsonSchema = o, n;
1148
1148
  }
1149
1149
  return i.jsonSchema = o, o;
1150
1150
  }
1151
- var $t = (e, t) => {
1151
+ var en = (e, t) => {
1152
1152
  switch (t.$refStrategy) {
1153
1153
  case "root": return { $ref: e.path.join("/") };
1154
- case "relative": return { $ref: Qt(t.currentPath, e.path) };
1154
+ case "relative": return { $ref: $t(t.currentPath, e.path) };
1155
1155
  case "none":
1156
- case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), H()) : t.$refStrategy === "seen" ? H() : void 0;
1156
+ case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), V()) : t.$refStrategy === "seen" ? V() : void 0;
1157
1157
  }
1158
- }, en = (e, t, n) => (e.description && (n.description = e.description), n), tn = (e) => {
1159
- let t = V(e), n = t.name === void 0 ? t.basePath : [
1158
+ }, tn = (e, t, n) => (e.description && (n.description = e.description), n), nn = (e) => {
1159
+ let t = pt(e), n = t.name === void 0 ? t.basePath : [
1160
1160
  ...t.basePath,
1161
1161
  t.definitionPath,
1162
1162
  t.name
@@ -1175,25 +1175,25 @@ var $t = (e, t) => {
1175
1175
  jsonSchema: void 0
1176
1176
  }]))
1177
1177
  };
1178
- }, nn = (e, t) => {
1179
- let n = tn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1178
+ }, rn = (e, t) => {
1179
+ let n = nn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
1180
1180
  ...e,
1181
- [t]: K(r._def, {
1181
+ [t]: q(r._def, {
1182
1182
  ...n,
1183
1183
  currentPath: [
1184
1184
  ...n.basePath,
1185
1185
  n.definitionPath,
1186
1186
  t
1187
1187
  ]
1188
- }, !0) ?? H()
1189
- }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = K(e._def, i === void 0 ? n : {
1188
+ }, !0) ?? V()
1189
+ }), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = q(e._def, i === void 0 ? n : {
1190
1190
  ...n,
1191
1191
  currentPath: [
1192
1192
  ...n.basePath,
1193
1193
  n.definitionPath,
1194
1194
  i
1195
1195
  ]
1196
- }, !1) ?? H(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1196
+ }, !1) ?? V(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
1197
1197
  o !== void 0 && (a.title = o);
1198
1198
  let s = i === void 0 ? r ? {
1199
1199
  ...a,
@@ -1210,14 +1210,14 @@ var $t = (e, t) => {
1210
1210
  }
1211
1211
  };
1212
1212
  return s.$schema = "http://json-schema.org/draft-07/schema#", s;
1213
- }, rn = Symbol.for("vercel.ai.schema");
1214
- function an(e) {
1213
+ }, an = Symbol.for("vercel.ai.schema");
1214
+ function on(e) {
1215
1215
  let t;
1216
1216
  return () => (t ??= e(), t);
1217
1217
  }
1218
- function on(e, { validate: t } = {}) {
1218
+ function sn(e, { validate: t } = {}) {
1219
1219
  return {
1220
- [rn]: !0,
1220
+ [an]: !0,
1221
1221
  _type: void 0,
1222
1222
  get jsonSchema() {
1223
1223
  return typeof e == "function" && (e = e()), e;
@@ -1225,20 +1225,20 @@ function on(e, { validate: t } = {}) {
1225
1225
  validate: t
1226
1226
  };
1227
1227
  }
1228
- function sn(e) {
1229
- return typeof e == "object" && !!e && rn in e && e[rn] === !0 && "jsonSchema" in e && "validate" in e;
1230
- }
1231
1228
  function cn(e) {
1232
- return e == null ? on({
1229
+ return typeof e == "object" && !!e && an in e && e[an] === !0 && "jsonSchema" in e && "validate" in e;
1230
+ }
1231
+ function ln(e) {
1232
+ return e == null ? sn({
1233
1233
  type: "object",
1234
1234
  properties: {},
1235
1235
  additionalProperties: !1
1236
- }) : sn(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? mn(e) : ln(e) : e();
1236
+ }) : cn(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? hn(e) : un(e) : e();
1237
1237
  }
1238
- function ln(e) {
1239
- return on(() => {
1240
- if (!un(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1241
- return lt(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1238
+ function un(e) {
1239
+ return sn(() => {
1240
+ if (!dn(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1241
+ return ut(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1242
1242
  }, { validate: async (t) => {
1243
1243
  let n = await e["~standard"].validate(t);
1244
1244
  return "value" in n ? {
@@ -1246,19 +1246,19 @@ function ln(e) {
1246
1246
  value: n.value
1247
1247
  } : {
1248
1248
  success: !1,
1249
- error: new Ke({
1249
+ error: new Je({
1250
1250
  value: t,
1251
1251
  cause: n.issues
1252
1252
  })
1253
1253
  };
1254
1254
  } });
1255
1255
  }
1256
- function un(e) {
1256
+ function dn(e) {
1257
1257
  return e["~standard"].jsonSchema != null;
1258
1258
  }
1259
- function dn(e, t) {
1259
+ function fn(e, t) {
1260
1260
  let n = t?.useReferences ?? !1;
1261
- return on(() => nn(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
1261
+ return sn(() => rn(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
1262
1262
  let n = await e.safeParseAsync(t);
1263
1263
  return n.success ? {
1264
1264
  success: !0,
@@ -1269,9 +1269,9 @@ function dn(e, t) {
1269
1269
  };
1270
1270
  } });
1271
1271
  }
1272
- function fn(e, r) {
1272
+ function pn(e, r) {
1273
1273
  let i = r?.useReferences ?? !1;
1274
- return on(() => lt(n(e, {
1274
+ return sn(() => ut(n(e, {
1275
1275
  target: "draft-7",
1276
1276
  io: "input",
1277
1277
  reused: i ? "ref" : "inline"
@@ -1286,27 +1286,27 @@ function fn(e, r) {
1286
1286
  };
1287
1287
  } });
1288
1288
  }
1289
- function pn(e) {
1289
+ function mn(e) {
1290
1290
  return "_zod" in e;
1291
1291
  }
1292
- function mn(e, t) {
1293
- return pn(e) ? fn(e, t) : dn(e, t);
1292
+ function hn(e, t) {
1293
+ return mn(e) ? pn(e, t) : fn(e, t);
1294
1294
  }
1295
- async function hn({ value: e, schema: t, context: n }) {
1296
- let r = await gn({
1295
+ async function gn({ value: e, schema: t, context: n }) {
1296
+ let r = await _n({
1297
1297
  value: e,
1298
1298
  schema: t,
1299
1299
  context: n
1300
1300
  });
1301
- if (!r.success) throw Ke.wrap({
1301
+ if (!r.success) throw Je.wrap({
1302
1302
  value: e,
1303
1303
  cause: r.error,
1304
1304
  context: n
1305
1305
  });
1306
1306
  return r.value;
1307
1307
  }
1308
- async function gn({ value: e, schema: t, context: n }) {
1309
- let r = cn(t);
1308
+ async function _n({ value: e, schema: t, context: n }) {
1309
+ let r = ln(t);
1310
1310
  try {
1311
1311
  if (r.validate == null) return {
1312
1312
  success: !0,
@@ -1320,7 +1320,7 @@ async function gn({ value: e, schema: t, context: n }) {
1320
1320
  rawValue: e
1321
1321
  } : {
1322
1322
  success: !1,
1323
- error: Ke.wrap({
1323
+ error: Je.wrap({
1324
1324
  value: e,
1325
1325
  cause: t.error,
1326
1326
  context: n
@@ -1330,7 +1330,7 @@ async function gn({ value: e, schema: t, context: n }) {
1330
1330
  } catch (t) {
1331
1331
  return {
1332
1332
  success: !1,
1333
- error: Ke.wrap({
1333
+ error: Je.wrap({
1334
1334
  value: e,
1335
1335
  cause: t,
1336
1336
  context: n
@@ -1339,21 +1339,21 @@ async function gn({ value: e, schema: t, context: n }) {
1339
1339
  };
1340
1340
  }
1341
1341
  }
1342
- async function _n({ text: e, schema: t }) {
1342
+ async function vn({ text: e, schema: t }) {
1343
1343
  try {
1344
- let n = ct(e);
1344
+ let n = lt(e);
1345
1345
  return t == null ? {
1346
1346
  success: !0,
1347
1347
  value: n,
1348
1348
  rawValue: n
1349
- } : await gn({
1349
+ } : await _n({
1350
1350
  value: n,
1351
1351
  schema: t
1352
1352
  });
1353
1353
  } catch (t) {
1354
1354
  return {
1355
1355
  success: !1,
1356
- error: Ue.isInstance(t) ? t : new Ue({
1356
+ error: Ge.isInstance(t) ? t : new Ge({
1357
1357
  text: e,
1358
1358
  cause: t
1359
1359
  }),
@@ -1361,42 +1361,42 @@ async function _n({ text: e, schema: t }) {
1361
1361
  };
1362
1362
  }
1363
1363
  }
1364
- function vn({ stream: e, schema: t }) {
1365
- return e.pipeThrough(new TextDecoderStream()).pipeThrough(new nt()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1366
- e !== "[DONE]" && n.enqueue(await _n({
1364
+ function yn({ stream: e, schema: t }) {
1365
+ return e.pipeThrough(new TextDecoderStream()).pipeThrough(new rt()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
1366
+ e !== "[DONE]" && n.enqueue(await vn({
1367
1367
  text: e,
1368
1368
  schema: t
1369
1369
  }));
1370
1370
  } }));
1371
1371
  }
1372
- async function yn(e) {
1372
+ async function bn(e) {
1373
1373
  return typeof e == "function" && (e = e()), e;
1374
1374
  }
1375
1375
  new TextDecoder();
1376
1376
  //#endregion
1377
1377
  //#region ../../node_modules/.pnpm/ai@7.0.140_zod@4.6.7/node_modules/ai/dist/index.js
1378
- var bn = "AI_InvalidArgumentError", xn = `vercel.ai.error.${bn}`, Sn = Symbol.for(xn), Cn = class extends T {
1378
+ var xn = "AI_InvalidArgumentError", Sn = `vercel.ai.error.${xn}`, Cn = Symbol.for(Sn), wn = class extends T {
1379
1379
  constructor({ parameter: e, value: t, message: n }) {
1380
1380
  super({
1381
- name: bn,
1381
+ name: xn,
1382
1382
  message: `Invalid argument for parameter ${e}: ${n}`
1383
- }), this[Sn] = !0, this.parameter = e, this.value = t;
1383
+ }), this[Cn] = !0, this.parameter = e, this.value = t;
1384
1384
  }
1385
1385
  static isInstance(e) {
1386
- return T.hasMarker(e, xn);
1386
+ return T.hasMarker(e, Sn);
1387
1387
  }
1388
- }, wn = "AI_UIMessageStreamError", Tn = `vercel.ai.error.${wn}`, En = Symbol.for(Tn), q = class extends T {
1388
+ }, Tn = "AI_UIMessageStreamError", En = `vercel.ai.error.${Tn}`, Dn = Symbol.for(En), J = class extends T {
1389
1389
  constructor({ chunkType: e, chunkId: t, message: n }) {
1390
1390
  super({
1391
- name: wn,
1391
+ name: Tn,
1392
1392
  message: n
1393
- }), this[En] = !0, this.chunkType = e, this.chunkId = t;
1393
+ }), this[Dn] = !0, this.chunkType = e, this.chunkId = t;
1394
1394
  }
1395
1395
  static isInstance(e) {
1396
- return T.hasMarker(e, Tn);
1396
+ return T.hasMarker(e, En);
1397
1397
  }
1398
1398
  };
1399
- function Dn(e, t) {
1399
+ function On(e, t) {
1400
1400
  if (e === void 0 && t === void 0) return;
1401
1401
  if (e === void 0) return t;
1402
1402
  if (t === void 0) return e;
@@ -1405,11 +1405,11 @@ function Dn(e, t) {
1405
1405
  let i = t[r];
1406
1406
  if (i === void 0) continue;
1407
1407
  let a = r in e ? e[r] : void 0, o = typeof i == "object" && !!i && !Array.isArray(i) && !(i instanceof Date) && !(i instanceof RegExp), s = typeof a == "object" && !!a && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof RegExp);
1408
- n[r] = o && s ? Dn(a, i) : i;
1408
+ n[r] = o && s ? On(a, i) : i;
1409
1409
  }
1410
1410
  return n;
1411
1411
  }
1412
- var J = {
1412
+ var Y = {
1413
1413
  array: d,
1414
1414
  boolean: m,
1415
1415
  custom: l,
@@ -1427,236 +1427,236 @@ var J = {
1427
1427
  string: r,
1428
1428
  union: e,
1429
1429
  unknown: _
1430
- }, Y = J.lazy(() => J.union([
1431
- J.null(),
1432
- J.string(),
1433
- J.number(),
1434
- J.boolean(),
1435
- J.record(J.string(), Y.optional()),
1436
- J.array(Y)
1437
- ])), X = J.record(J.string(), J.record(J.string(), Y.optional())), On = J.union([
1438
- J.string(),
1439
- J.instanceof(Uint8Array),
1440
- J.instanceof(ArrayBuffer),
1441
- J.custom(it, { message: "Must be a Buffer" })
1442
- ]), kn = J.record(J.string(), J.string()), An = J.object({
1443
- type: J.literal("text"),
1444
- text: J.string(),
1445
- providerOptions: X.optional()
1446
- }), jn = J.object({
1447
- type: J.literal("image"),
1448
- image: J.union([
1449
- On,
1450
- J.instanceof(URL),
1451
- kn
1430
+ }, X = Y.lazy(() => Y.union([
1431
+ Y.null(),
1432
+ Y.string(),
1433
+ Y.number(),
1434
+ Y.boolean(),
1435
+ Y.record(Y.string(), X.optional()),
1436
+ Y.array(X)
1437
+ ])), Z = Y.record(Y.string(), Y.record(Y.string(), X.optional())), kn = Y.union([
1438
+ Y.string(),
1439
+ Y.instanceof(Uint8Array),
1440
+ Y.instanceof(ArrayBuffer),
1441
+ Y.custom(R, { message: "Must be a Buffer" })
1442
+ ]), An = Y.record(Y.string(), Y.string()), jn = Y.object({
1443
+ type: Y.literal("text"),
1444
+ text: Y.string(),
1445
+ providerOptions: Z.optional()
1446
+ }), Mn = Y.object({
1447
+ type: Y.literal("image"),
1448
+ image: Y.union([
1449
+ kn,
1450
+ Y.instanceof(URL),
1451
+ An
1452
1452
  ]),
1453
- mediaType: J.string().optional(),
1454
- providerOptions: X.optional()
1455
- }), Mn = J.discriminatedUnion("type", [
1456
- J.object({
1457
- type: J.literal("data"),
1458
- data: On
1453
+ mediaType: Y.string().optional(),
1454
+ providerOptions: Z.optional()
1455
+ }), Nn = Y.discriminatedUnion("type", [
1456
+ Y.object({
1457
+ type: Y.literal("data"),
1458
+ data: kn
1459
1459
  }),
1460
- J.object({
1461
- type: J.literal("url"),
1462
- url: J.instanceof(URL)
1460
+ Y.object({
1461
+ type: Y.literal("url"),
1462
+ url: Y.instanceof(URL)
1463
1463
  }),
1464
- J.object({
1465
- type: J.literal("reference"),
1466
- reference: kn
1464
+ Y.object({
1465
+ type: Y.literal("reference"),
1466
+ reference: An
1467
1467
  }),
1468
- J.object({
1469
- type: J.literal("text"),
1470
- text: J.string()
1468
+ Y.object({
1469
+ type: Y.literal("text"),
1470
+ text: Y.string()
1471
1471
  })
1472
- ]), Nn = J.discriminatedUnion("type", [J.object({
1473
- type: J.literal("data"),
1474
- data: On
1475
- }), J.object({
1476
- type: J.literal("url"),
1477
- url: J.instanceof(URL)
1478
- })]), Pn = J.object({
1479
- type: J.literal("file"),
1480
- data: J.union([
1481
- Mn,
1482
- On,
1483
- J.instanceof(URL),
1484
- kn
1485
- ]),
1486
- filename: J.string().optional(),
1487
- mediaType: J.string(),
1488
- providerOptions: X.optional()
1489
- }), Fn = J.object({
1490
- type: J.literal("reasoning"),
1491
- text: J.string(),
1492
- providerOptions: X.optional()
1493
- }), In = J.object({
1494
- type: J.literal("custom"),
1495
- kind: J.string().transform((e) => e),
1496
- providerOptions: X.optional()
1497
- }), Ln = J.object({
1498
- type: J.literal("reasoning-file"),
1499
- data: J.union([
1472
+ ]), Pn = Y.discriminatedUnion("type", [Y.object({
1473
+ type: Y.literal("data"),
1474
+ data: kn
1475
+ }), Y.object({
1476
+ type: Y.literal("url"),
1477
+ url: Y.instanceof(URL)
1478
+ })]), Fn = Y.object({
1479
+ type: Y.literal("file"),
1480
+ data: Y.union([
1500
1481
  Nn,
1501
- On,
1502
- J.instanceof(URL)
1482
+ kn,
1483
+ Y.instanceof(URL),
1484
+ An
1485
+ ]),
1486
+ filename: Y.string().optional(),
1487
+ mediaType: Y.string(),
1488
+ providerOptions: Z.optional()
1489
+ }), In = Y.object({
1490
+ type: Y.literal("reasoning"),
1491
+ text: Y.string(),
1492
+ providerOptions: Z.optional()
1493
+ }), Ln = Y.object({
1494
+ type: Y.literal("custom"),
1495
+ kind: Y.string().transform((e) => e),
1496
+ providerOptions: Z.optional()
1497
+ }), Rn = Y.object({
1498
+ type: Y.literal("reasoning-file"),
1499
+ data: Y.union([
1500
+ Pn,
1501
+ kn,
1502
+ Y.instanceof(URL)
1503
1503
  ]),
1504
- mediaType: J.string(),
1505
- providerOptions: X.optional()
1506
- }), Rn = J.object({
1507
- type: J.literal("tool-call"),
1508
- toolCallId: J.string(),
1509
- toolName: J.string(),
1510
- input: J.unknown(),
1511
- providerOptions: X.optional(),
1512
- providerExecuted: J.boolean().optional()
1513
- }), zn = J.discriminatedUnion("type", [
1514
- J.object({
1515
- type: J.literal("text"),
1516
- value: J.string(),
1517
- providerOptions: X.optional()
1504
+ mediaType: Y.string(),
1505
+ providerOptions: Z.optional()
1506
+ }), zn = Y.object({
1507
+ type: Y.literal("tool-call"),
1508
+ toolCallId: Y.string(),
1509
+ toolName: Y.string(),
1510
+ input: Y.unknown(),
1511
+ providerOptions: Z.optional(),
1512
+ providerExecuted: Y.boolean().optional()
1513
+ }), Bn = Y.discriminatedUnion("type", [
1514
+ Y.object({
1515
+ type: Y.literal("text"),
1516
+ value: Y.string(),
1517
+ providerOptions: Z.optional()
1518
1518
  }),
1519
- J.object({
1520
- type: J.literal("json"),
1521
- value: Y,
1522
- providerOptions: X.optional()
1519
+ Y.object({
1520
+ type: Y.literal("json"),
1521
+ value: X,
1522
+ providerOptions: Z.optional()
1523
1523
  }),
1524
- J.object({
1525
- type: J.literal("execution-denied"),
1526
- reason: J.string().optional(),
1527
- providerOptions: X.optional()
1524
+ Y.object({
1525
+ type: Y.literal("execution-denied"),
1526
+ reason: Y.string().optional(),
1527
+ providerOptions: Z.optional()
1528
1528
  }),
1529
- J.object({
1530
- type: J.literal("error-text"),
1531
- value: J.string(),
1532
- providerOptions: X.optional()
1529
+ Y.object({
1530
+ type: Y.literal("error-text"),
1531
+ value: Y.string(),
1532
+ providerOptions: Z.optional()
1533
1533
  }),
1534
- J.object({
1535
- type: J.literal("error-json"),
1536
- value: Y,
1537
- providerOptions: X.optional()
1534
+ Y.object({
1535
+ type: Y.literal("error-json"),
1536
+ value: X,
1537
+ providerOptions: Z.optional()
1538
1538
  }),
1539
- J.object({
1540
- type: J.literal("content"),
1541
- value: J.array(J.union([
1542
- J.object({
1543
- type: J.literal("text"),
1544
- text: J.string(),
1545
- providerOptions: X.optional()
1539
+ Y.object({
1540
+ type: Y.literal("content"),
1541
+ value: Y.array(Y.union([
1542
+ Y.object({
1543
+ type: Y.literal("text"),
1544
+ text: Y.string(),
1545
+ providerOptions: Z.optional()
1546
1546
  }),
1547
- J.object({
1548
- type: J.literal("file"),
1549
- data: Mn,
1550
- mediaType: J.string(),
1551
- filename: J.string().optional(),
1552
- providerOptions: X.optional()
1547
+ Y.object({
1548
+ type: Y.literal("file"),
1549
+ data: Nn,
1550
+ mediaType: Y.string(),
1551
+ filename: Y.string().optional(),
1552
+ providerOptions: Z.optional()
1553
1553
  }),
1554
- J.object({
1555
- type: J.literal("file-data"),
1556
- data: J.string(),
1557
- mediaType: J.string(),
1558
- filename: J.string().optional(),
1559
- providerOptions: X.optional()
1554
+ Y.object({
1555
+ type: Y.literal("file-data"),
1556
+ data: Y.string(),
1557
+ mediaType: Y.string(),
1558
+ filename: Y.string().optional(),
1559
+ providerOptions: Z.optional()
1560
1560
  }),
1561
- J.object({
1562
- type: J.literal("file-url"),
1563
- url: J.string(),
1564
- mediaType: J.string().optional(),
1565
- providerOptions: X.optional()
1561
+ Y.object({
1562
+ type: Y.literal("file-url"),
1563
+ url: Y.string(),
1564
+ mediaType: Y.string().optional(),
1565
+ providerOptions: Z.optional()
1566
1566
  }),
1567
- J.object({
1568
- type: J.literal("file-id"),
1569
- fileId: J.union([J.string(), J.record(J.string(), J.string())]),
1570
- providerOptions: X.optional()
1567
+ Y.object({
1568
+ type: Y.literal("file-id"),
1569
+ fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1570
+ providerOptions: Z.optional()
1571
1571
  }),
1572
- J.object({
1573
- type: J.literal("file-reference"),
1574
- providerReference: J.record(J.string(), J.string()),
1575
- providerOptions: X.optional()
1572
+ Y.object({
1573
+ type: Y.literal("file-reference"),
1574
+ providerReference: Y.record(Y.string(), Y.string()),
1575
+ providerOptions: Z.optional()
1576
1576
  }),
1577
- J.object({
1578
- type: J.literal("image-data"),
1579
- data: J.string(),
1580
- mediaType: J.string(),
1581
- providerOptions: X.optional()
1577
+ Y.object({
1578
+ type: Y.literal("image-data"),
1579
+ data: Y.string(),
1580
+ mediaType: Y.string(),
1581
+ providerOptions: Z.optional()
1582
1582
  }),
1583
- J.object({
1584
- type: J.literal("image-url"),
1585
- url: J.string(),
1586
- providerOptions: X.optional()
1583
+ Y.object({
1584
+ type: Y.literal("image-url"),
1585
+ url: Y.string(),
1586
+ providerOptions: Z.optional()
1587
1587
  }),
1588
- J.object({
1589
- type: J.literal("image-file-id"),
1590
- fileId: J.union([J.string(), J.record(J.string(), J.string())]),
1591
- providerOptions: X.optional()
1588
+ Y.object({
1589
+ type: Y.literal("image-file-id"),
1590
+ fileId: Y.union([Y.string(), Y.record(Y.string(), Y.string())]),
1591
+ providerOptions: Z.optional()
1592
1592
  }),
1593
- J.object({
1594
- type: J.literal("image-file-reference"),
1595
- providerReference: J.record(J.string(), J.string()),
1596
- providerOptions: X.optional()
1593
+ Y.object({
1594
+ type: Y.literal("image-file-reference"),
1595
+ providerReference: Y.record(Y.string(), Y.string()),
1596
+ providerOptions: Z.optional()
1597
1597
  }),
1598
- J.object({
1599
- type: J.literal("custom"),
1600
- providerOptions: X.optional()
1598
+ Y.object({
1599
+ type: Y.literal("custom"),
1600
+ providerOptions: Z.optional()
1601
1601
  })
1602
1602
  ]))
1603
1603
  })
1604
- ]), Bn = J.object({
1605
- type: J.literal("tool-result"),
1606
- toolCallId: J.string(),
1607
- toolName: J.string(),
1608
- output: zn,
1609
- providerOptions: X.optional()
1610
- }), Vn = J.object({
1611
- type: J.literal("tool-approval-request"),
1612
- approvalId: J.string(),
1613
- toolCallId: J.string(),
1614
- reason: J.string().optional(),
1615
- isAutomatic: J.boolean().optional(),
1616
- signature: J.string().optional(),
1617
- inputSchemaInput: J.unknown().optional()
1618
- }), Hn = J.object({
1619
- type: J.literal("tool-approval-response"),
1620
- approvalId: J.string(),
1621
- approved: J.boolean(),
1622
- reason: J.string().optional()
1623
- }), Un = J.object({
1624
- role: J.literal("system"),
1625
- content: J.string(),
1626
- providerOptions: X.optional()
1627
- }), Wn = J.object({
1628
- role: J.literal("user"),
1629
- content: J.union([J.string(), J.array(J.union([
1630
- An,
1604
+ ]), Vn = Y.object({
1605
+ type: Y.literal("tool-result"),
1606
+ toolCallId: Y.string(),
1607
+ toolName: Y.string(),
1608
+ output: Bn,
1609
+ providerOptions: Z.optional()
1610
+ }), Hn = Y.object({
1611
+ type: Y.literal("tool-approval-request"),
1612
+ approvalId: Y.string(),
1613
+ toolCallId: Y.string(),
1614
+ reason: Y.string().optional(),
1615
+ isAutomatic: Y.boolean().optional(),
1616
+ signature: Y.string().optional(),
1617
+ inputSchemaInput: Y.unknown().optional()
1618
+ }), Un = Y.object({
1619
+ type: Y.literal("tool-approval-response"),
1620
+ approvalId: Y.string(),
1621
+ approved: Y.boolean(),
1622
+ reason: Y.string().optional()
1623
+ }), Wn = Y.object({
1624
+ role: Y.literal("system"),
1625
+ content: Y.string(),
1626
+ providerOptions: Z.optional()
1627
+ }), Gn = Y.object({
1628
+ role: Y.literal("user"),
1629
+ content: Y.union([Y.string(), Y.array(Y.union([
1631
1630
  jn,
1632
- Pn
1631
+ Mn,
1632
+ Fn
1633
1633
  ]))]),
1634
- providerOptions: X.optional()
1635
- }), Gn = J.object({
1636
- role: J.literal("assistant"),
1637
- content: J.union([J.string(), J.array(J.union([
1638
- An,
1639
- In,
1640
- Pn,
1641
- Fn,
1634
+ providerOptions: Z.optional()
1635
+ }), Kn = Y.object({
1636
+ role: Y.literal("assistant"),
1637
+ content: Y.union([Y.string(), Y.array(Y.union([
1638
+ jn,
1642
1639
  Ln,
1640
+ Fn,
1641
+ In,
1643
1642
  Rn,
1644
- Bn,
1645
- Vn
1643
+ zn,
1644
+ Vn,
1645
+ Hn
1646
1646
  ]))]),
1647
- providerOptions: X.optional()
1648
- }), Kn = J.object({
1649
- role: J.literal("tool"),
1650
- content: J.array(J.union([Bn, Hn])),
1651
- providerOptions: X.optional()
1647
+ providerOptions: Z.optional()
1648
+ }), qn = Y.object({
1649
+ role: Y.literal("tool"),
1650
+ content: Y.array(Y.union([Vn, Un])),
1651
+ providerOptions: Z.optional()
1652
1652
  });
1653
- J.union([
1654
- Un,
1653
+ Y.union([
1655
1654
  Wn,
1656
1655
  Gn,
1657
- Kn
1656
+ Kn,
1657
+ qn
1658
1658
  ]);
1659
- function qn(e) {
1659
+ function Jn(e) {
1660
1660
  let t = ["ROOT"], n = -1, r = null, i = 0;
1661
1661
  function a(e) {
1662
1662
  return e >= "0" && e <= "9" || e >= "A" && e <= "F" || e >= "a" && e <= "f";
@@ -1838,16 +1838,16 @@ function qn(e) {
1838
1838
  }
1839
1839
  return l;
1840
1840
  }
1841
- async function Jn(e) {
1841
+ async function Yn(e) {
1842
1842
  if (e === void 0) return {
1843
1843
  value: void 0,
1844
1844
  state: "undefined-input"
1845
1845
  };
1846
- let t = await _n({ text: e });
1846
+ let t = await vn({ text: e });
1847
1847
  return t.success ? {
1848
1848
  value: t.value,
1849
1849
  state: "successful-parse"
1850
- } : (t = await _n({ text: qn(e) }), t.success ? {
1850
+ } : (t = await vn({ text: Jn(e) }), t.success ? {
1851
1851
  value: t.value,
1852
1852
  state: "repaired-parse"
1853
1853
  } : {
@@ -1862,192 +1862,192 @@ new TextEncoder(), new TextEncoder(), I({
1862
1862
  prefix: "call",
1863
1863
  size: 24
1864
1864
  }), TransformStream;
1865
- var Yn = J.object({
1866
- source: J.discriminatedUnion("sourceType", [J.object({
1867
- type: J.literal("source"),
1868
- sourceType: J.literal("url"),
1869
- id: J.string(),
1870
- url: J.string(),
1871
- title: J.string().optional(),
1872
- providerMetadata: X.optional()
1873
- }), J.object({
1874
- type: J.literal("source"),
1875
- sourceType: J.literal("document"),
1876
- id: J.string(),
1877
- mediaType: J.string(),
1878
- title: J.string(),
1879
- filename: J.string().optional(),
1880
- providerMetadata: X.optional()
1865
+ var Xn = Y.object({
1866
+ source: Y.discriminatedUnion("sourceType", [Y.object({
1867
+ type: Y.literal("source"),
1868
+ sourceType: Y.literal("url"),
1869
+ id: Y.string(),
1870
+ url: Y.string(),
1871
+ title: Y.string().optional(),
1872
+ providerMetadata: Z.optional()
1873
+ }), Y.object({
1874
+ type: Y.literal("source"),
1875
+ sourceType: Y.literal("document"),
1876
+ id: Y.string(),
1877
+ mediaType: Y.string(),
1878
+ title: Y.string(),
1879
+ filename: Y.string().optional(),
1880
+ providerMetadata: Z.optional()
1881
1881
  })]),
1882
- startIndex: J.number().int().nonnegative().optional(),
1883
- endIndex: J.number().int().nonnegative().optional(),
1884
- citedText: J.string().optional()
1885
- }), Xn = J.record(J.string(), Y.optional()), Zn = an(() => mn(J.union([
1886
- J.looseObject({
1887
- type: J.literal("text-start"),
1888
- id: J.string(),
1889
- providerMetadata: X.optional()
1882
+ startIndex: Y.number().int().nonnegative().optional(),
1883
+ endIndex: Y.number().int().nonnegative().optional(),
1884
+ citedText: Y.string().optional()
1885
+ }), Zn = Y.record(Y.string(), X.optional()), Qn = on(() => hn(Y.union([
1886
+ Y.looseObject({
1887
+ type: Y.literal("text-start"),
1888
+ id: Y.string(),
1889
+ providerMetadata: Z.optional()
1890
1890
  }),
1891
- J.looseObject({
1892
- type: J.literal("text-delta"),
1893
- id: J.string(),
1894
- delta: J.string(),
1895
- providerMetadata: X.optional()
1891
+ Y.looseObject({
1892
+ type: Y.literal("text-delta"),
1893
+ id: Y.string(),
1894
+ delta: Y.string(),
1895
+ providerMetadata: Z.optional()
1896
1896
  }),
1897
- J.looseObject({
1898
- type: J.literal("text-end"),
1899
- id: J.string(),
1900
- citations: J.array(Yn).optional(),
1901
- providerMetadata: X.optional()
1897
+ Y.looseObject({
1898
+ type: Y.literal("text-end"),
1899
+ id: Y.string(),
1900
+ citations: Y.array(Xn).optional(),
1901
+ providerMetadata: Z.optional()
1902
1902
  }),
1903
- J.looseObject({
1904
- type: J.literal("error"),
1905
- errorText: J.string()
1903
+ Y.looseObject({
1904
+ type: Y.literal("error"),
1905
+ errorText: Y.string()
1906
1906
  }),
1907
- J.looseObject({
1908
- type: J.literal("tool-input-start"),
1909
- toolCallId: J.string(),
1910
- toolName: J.string(),
1911
- providerExecuted: J.boolean().optional(),
1912
- providerMetadata: X.optional(),
1913
- toolMetadata: Xn.optional(),
1914
- dynamic: J.boolean().optional(),
1915
- title: J.string().optional()
1907
+ Y.looseObject({
1908
+ type: Y.literal("tool-input-start"),
1909
+ toolCallId: Y.string(),
1910
+ toolName: Y.string(),
1911
+ providerExecuted: Y.boolean().optional(),
1912
+ providerMetadata: Z.optional(),
1913
+ toolMetadata: Zn.optional(),
1914
+ dynamic: Y.boolean().optional(),
1915
+ title: Y.string().optional()
1916
1916
  }),
1917
- J.looseObject({
1918
- type: J.literal("tool-input-delta"),
1919
- toolCallId: J.string(),
1920
- inputTextDelta: J.string()
1917
+ Y.looseObject({
1918
+ type: Y.literal("tool-input-delta"),
1919
+ toolCallId: Y.string(),
1920
+ inputTextDelta: Y.string()
1921
1921
  }),
1922
- J.looseObject({
1923
- type: J.literal("tool-input-available"),
1924
- toolCallId: J.string(),
1925
- toolName: J.string(),
1926
- input: J.unknown(),
1927
- providerExecuted: J.boolean().optional(),
1928
- providerMetadata: X.optional(),
1929
- toolMetadata: Xn.optional(),
1930
- dynamic: J.boolean().optional(),
1931
- title: J.string().optional()
1922
+ Y.looseObject({
1923
+ type: Y.literal("tool-input-available"),
1924
+ toolCallId: Y.string(),
1925
+ toolName: Y.string(),
1926
+ input: Y.unknown(),
1927
+ providerExecuted: Y.boolean().optional(),
1928
+ providerMetadata: Z.optional(),
1929
+ toolMetadata: Zn.optional(),
1930
+ dynamic: Y.boolean().optional(),
1931
+ title: Y.string().optional()
1932
1932
  }),
1933
- J.looseObject({
1934
- type: J.literal("tool-input-error"),
1935
- toolCallId: J.string(),
1936
- toolName: J.string(),
1937
- input: J.unknown(),
1938
- providerExecuted: J.boolean().optional(),
1939
- providerMetadata: X.optional(),
1940
- toolMetadata: Xn.optional(),
1941
- dynamic: J.boolean().optional(),
1942
- errorText: J.string(),
1943
- title: J.string().optional()
1933
+ Y.looseObject({
1934
+ type: Y.literal("tool-input-error"),
1935
+ toolCallId: Y.string(),
1936
+ toolName: Y.string(),
1937
+ input: Y.unknown(),
1938
+ providerExecuted: Y.boolean().optional(),
1939
+ providerMetadata: Z.optional(),
1940
+ toolMetadata: Zn.optional(),
1941
+ dynamic: Y.boolean().optional(),
1942
+ errorText: Y.string(),
1943
+ title: Y.string().optional()
1944
1944
  }),
1945
- J.looseObject({
1946
- type: J.literal("tool-approval-request"),
1947
- approvalId: J.string(),
1948
- toolCallId: J.string(),
1949
- approvalDescriptor: J.unknown().optional(),
1950
- inputSchemaInput: J.unknown().optional(),
1951
- reason: J.string().optional(),
1952
- isAutomatic: J.boolean().optional(),
1953
- signature: J.string().optional()
1945
+ Y.looseObject({
1946
+ type: Y.literal("tool-approval-request"),
1947
+ approvalId: Y.string(),
1948
+ toolCallId: Y.string(),
1949
+ approvalDescriptor: Y.unknown().optional(),
1950
+ inputSchemaInput: Y.unknown().optional(),
1951
+ reason: Y.string().optional(),
1952
+ isAutomatic: Y.boolean().optional(),
1953
+ signature: Y.string().optional()
1954
1954
  }),
1955
- J.looseObject({
1956
- type: J.literal("tool-approval-response"),
1957
- approvalId: J.string(),
1958
- approved: J.boolean(),
1959
- reason: J.string().optional(),
1960
- providerExecuted: J.boolean().optional(),
1961
- providerMetadata: X.optional()
1955
+ Y.looseObject({
1956
+ type: Y.literal("tool-approval-response"),
1957
+ approvalId: Y.string(),
1958
+ approved: Y.boolean(),
1959
+ reason: Y.string().optional(),
1960
+ providerExecuted: Y.boolean().optional(),
1961
+ providerMetadata: Z.optional()
1962
1962
  }),
1963
- J.looseObject({
1964
- type: J.literal("tool-output-available"),
1965
- toolCallId: J.string(),
1966
- output: J.unknown(),
1967
- providerExecuted: J.boolean().optional(),
1968
- providerMetadata: X.optional(),
1969
- toolMetadata: Xn.optional(),
1970
- dynamic: J.boolean().optional(),
1971
- preliminary: J.boolean().optional()
1963
+ Y.looseObject({
1964
+ type: Y.literal("tool-output-available"),
1965
+ toolCallId: Y.string(),
1966
+ output: Y.unknown(),
1967
+ providerExecuted: Y.boolean().optional(),
1968
+ providerMetadata: Z.optional(),
1969
+ toolMetadata: Zn.optional(),
1970
+ dynamic: Y.boolean().optional(),
1971
+ preliminary: Y.boolean().optional()
1972
1972
  }),
1973
- J.looseObject({
1974
- type: J.literal("tool-output-error"),
1975
- toolCallId: J.string(),
1976
- errorText: J.string(),
1977
- providerExecuted: J.boolean().optional(),
1978
- providerMetadata: X.optional(),
1979
- toolMetadata: Xn.optional(),
1980
- dynamic: J.boolean().optional()
1973
+ Y.looseObject({
1974
+ type: Y.literal("tool-output-error"),
1975
+ toolCallId: Y.string(),
1976
+ errorText: Y.string(),
1977
+ providerExecuted: Y.boolean().optional(),
1978
+ providerMetadata: Z.optional(),
1979
+ toolMetadata: Zn.optional(),
1980
+ dynamic: Y.boolean().optional()
1981
1981
  }),
1982
- J.looseObject({
1983
- type: J.literal("tool-output-denied"),
1984
- toolCallId: J.string()
1982
+ Y.looseObject({
1983
+ type: Y.literal("tool-output-denied"),
1984
+ toolCallId: Y.string()
1985
1985
  }),
1986
- J.looseObject({
1987
- type: J.literal("reasoning-start"),
1988
- id: J.string(),
1989
- providerMetadata: X.optional()
1986
+ Y.looseObject({
1987
+ type: Y.literal("reasoning-start"),
1988
+ id: Y.string(),
1989
+ providerMetadata: Z.optional()
1990
1990
  }),
1991
- J.looseObject({
1992
- type: J.literal("reasoning-delta"),
1993
- id: J.string(),
1994
- delta: J.string(),
1995
- providerMetadata: X.optional()
1991
+ Y.looseObject({
1992
+ type: Y.literal("reasoning-delta"),
1993
+ id: Y.string(),
1994
+ delta: Y.string(),
1995
+ providerMetadata: Z.optional()
1996
1996
  }),
1997
- J.looseObject({
1998
- type: J.literal("reasoning-end"),
1999
- id: J.string(),
2000
- providerMetadata: X.optional()
1997
+ Y.looseObject({
1998
+ type: Y.literal("reasoning-end"),
1999
+ id: Y.string(),
2000
+ providerMetadata: Z.optional()
2001
2001
  }),
2002
- J.looseObject({
2003
- type: J.literal("custom"),
2004
- kind: J.string().transform((e) => e),
2005
- providerMetadata: X.optional()
2002
+ Y.looseObject({
2003
+ type: Y.literal("custom"),
2004
+ kind: Y.string().transform((e) => e),
2005
+ providerMetadata: Z.optional()
2006
2006
  }),
2007
- J.looseObject({
2008
- type: J.literal("source-url"),
2009
- sourceId: J.string(),
2010
- url: J.string(),
2011
- title: J.string().optional(),
2012
- providerMetadata: X.optional()
2007
+ Y.looseObject({
2008
+ type: Y.literal("source-url"),
2009
+ sourceId: Y.string(),
2010
+ url: Y.string(),
2011
+ title: Y.string().optional(),
2012
+ providerMetadata: Z.optional()
2013
2013
  }),
2014
- J.looseObject({
2015
- type: J.literal("source-document"),
2016
- sourceId: J.string(),
2017
- mediaType: J.string(),
2018
- title: J.string(),
2019
- filename: J.string().optional(),
2020
- providerMetadata: X.optional()
2014
+ Y.looseObject({
2015
+ type: Y.literal("source-document"),
2016
+ sourceId: Y.string(),
2017
+ mediaType: Y.string(),
2018
+ title: Y.string(),
2019
+ filename: Y.string().optional(),
2020
+ providerMetadata: Z.optional()
2021
2021
  }),
2022
- J.looseObject({
2023
- type: J.literal("file"),
2024
- url: J.string(),
2025
- mediaType: J.string(),
2026
- providerMetadata: X.optional()
2022
+ Y.looseObject({
2023
+ type: Y.literal("file"),
2024
+ url: Y.string(),
2025
+ mediaType: Y.string(),
2026
+ providerMetadata: Z.optional()
2027
2027
  }),
2028
- J.looseObject({
2029
- type: J.literal("reasoning-file"),
2030
- url: J.string(),
2031
- mediaType: J.string(),
2032
- providerMetadata: X.optional()
2028
+ Y.looseObject({
2029
+ type: Y.literal("reasoning-file"),
2030
+ url: Y.string(),
2031
+ mediaType: Y.string(),
2032
+ providerMetadata: Z.optional()
2033
2033
  }),
2034
- J.looseObject({
2035
- type: J.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2036
- id: J.string().optional(),
2037
- data: J.unknown(),
2038
- transient: J.boolean().optional()
2034
+ Y.looseObject({
2035
+ type: Y.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
2036
+ id: Y.string().optional(),
2037
+ data: Y.unknown(),
2038
+ transient: Y.boolean().optional()
2039
2039
  }),
2040
- J.looseObject({ type: J.literal("start-step") }),
2041
- J.looseObject({ type: J.literal("finish-step") }),
2042
- J.looseObject({ type: J.literal("reset-step") }),
2043
- J.looseObject({
2044
- type: J.literal("start"),
2045
- messageId: J.string().optional(),
2046
- messageMetadata: J.unknown().optional()
2040
+ Y.looseObject({ type: Y.literal("start-step") }),
2041
+ Y.looseObject({ type: Y.literal("finish-step") }),
2042
+ Y.looseObject({ type: Y.literal("reset-step") }),
2043
+ Y.looseObject({
2044
+ type: Y.literal("start"),
2045
+ messageId: Y.string().optional(),
2046
+ messageMetadata: Y.unknown().optional()
2047
2047
  }),
2048
- J.looseObject({
2049
- type: J.literal("finish"),
2050
- finishReason: J.enum([
2048
+ Y.looseObject({
2049
+ type: Y.literal("finish"),
2050
+ finishReason: Y.enum([
2051
2051
  "stop",
2052
2052
  "length",
2053
2053
  "content-filter",
@@ -2055,49 +2055,49 @@ var Yn = J.object({
2055
2055
  "error",
2056
2056
  "other"
2057
2057
  ]).optional(),
2058
- messageMetadata: J.unknown().optional()
2058
+ messageMetadata: Y.unknown().optional()
2059
2059
  }),
2060
- J.looseObject({
2061
- type: J.literal("abort"),
2062
- reason: J.string().optional()
2060
+ Y.looseObject({
2061
+ type: Y.literal("abort"),
2062
+ reason: Y.string().optional()
2063
2063
  }),
2064
- J.looseObject({
2065
- type: J.literal("message-metadata"),
2066
- messageMetadata: J.unknown()
2064
+ Y.looseObject({
2065
+ type: Y.literal("message-metadata"),
2066
+ messageMetadata: Y.unknown()
2067
2067
  })
2068
2068
  ])));
2069
- function Qn(e) {
2069
+ function $n(e) {
2070
2070
  return e.type.startsWith("data-");
2071
2071
  }
2072
- function $n() {
2072
+ function er() {
2073
2073
  return Object.create(null);
2074
2074
  }
2075
- function er(e) {
2075
+ function tr(e) {
2076
2076
  return e.type.startsWith("tool-");
2077
2077
  }
2078
- function tr(e) {
2078
+ function nr(e) {
2079
2079
  return e.type === "dynamic-tool";
2080
2080
  }
2081
- function Z(e) {
2082
- return er(e) || tr(e);
2081
+ function Q(e) {
2082
+ return tr(e) || nr(e);
2083
2083
  }
2084
- function nr(e) {
2084
+ function rr(e) {
2085
2085
  return e.type.split("-").slice(1).join("-");
2086
2086
  }
2087
- function rr({ lastMessage: e, messageId: t }) {
2087
+ function ir({ lastMessage: e, messageId: t }) {
2088
2088
  let n = e?.role === "assistant" ? e : {
2089
2089
  id: t,
2090
2090
  metadata: void 0,
2091
2091
  role: "assistant",
2092
2092
  parts: []
2093
- }, r = $n(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
2093
+ }, r = er(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
2094
2094
  for (let e of n.parts.slice(i + 1)) {
2095
- if (!Z(e)) continue;
2095
+ if (!Q(e)) continue;
2096
2096
  let t = a;
2097
- er(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
2097
+ tr(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
2098
2098
  text: e.rawInput ?? "",
2099
2099
  index: t,
2100
- toolName: e.type === "dynamic-tool" ? e.toolName : nr(e),
2100
+ toolName: e.type === "dynamic-tool" ? e.toolName : rr(e),
2101
2101
  dynamic: e.type === "dynamic-tool",
2102
2102
  title: e.title,
2103
2103
  toolMetadata: e.toolMetadata
@@ -2105,12 +2105,12 @@ function rr({ lastMessage: e, messageId: t }) {
2105
2105
  }
2106
2106
  return {
2107
2107
  message: n,
2108
- activeTextParts: $n(),
2109
- activeReasoningParts: $n(),
2108
+ activeTextParts: er(),
2109
+ activeReasoningParts: er(),
2110
2110
  partialToolCalls: r
2111
2111
  };
2112
2112
  }
2113
- function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o, resetStateOnMessageIdChange: s = !1, resetStateOnFirstMessageStart: c = !1 }) {
2113
+ function ar({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o, resetStateOnMessageIdChange: s = !1, resetStateOnFirstMessageStart: c = !1 }) {
2114
2114
  let l = !0;
2115
2115
  return e.pipeThrough(new TransformStream({ async transform(e, u) {
2116
2116
  await r(async ({ state: r, write: d }) => {
@@ -2120,7 +2120,7 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2120
2120
  return e.slice(t + 1);
2121
2121
  }
2122
2122
  function p() {
2123
- return f().filter(Z);
2123
+ return f().filter(Q);
2124
2124
  }
2125
2125
  function m(e) {
2126
2126
  let t = p().find((t) => t.toolCallId === e);
@@ -2128,13 +2128,13 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2128
2128
  let n = r.message.parts;
2129
2129
  for (let r = n.length - 1; r >= 0; r--) {
2130
2130
  let i = n[r];
2131
- if (Z(i) && i.toolCallId === e) {
2131
+ if (Q(i) && i.toolCallId === e) {
2132
2132
  t = i;
2133
2133
  break;
2134
2134
  }
2135
2135
  }
2136
2136
  }
2137
- if (t == null) throw new q({
2137
+ if (t == null) throw new J({
2138
2138
  chunkType: "tool-invocation",
2139
2139
  chunkId: e,
2140
2140
  message: `No tool invocation found for tool call ID "${e}".`
@@ -2142,8 +2142,8 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2142
2142
  return t;
2143
2143
  }
2144
2144
  function h(e) {
2145
- let t = r.message.parts.filter(Z).find((t) => t.approval?.id === e);
2146
- if (t == null) throw new q({
2145
+ let t = r.message.parts.filter(Q).find((t) => t.approval?.id === e);
2146
+ if (t == null) throw new J({
2147
2147
  chunkType: "tool-approval-response",
2148
2148
  chunkId: e,
2149
2149
  message: `No tool invocation found for approval ID "${e}".`
@@ -2151,7 +2151,7 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2151
2151
  return t;
2152
2152
  }
2153
2153
  function g(e, t) {
2154
- let n = t ?? f().find((t) => er(t) && t.toolCallId === e.toolCallId), i = e, a = n;
2154
+ let n = t ?? f().find((t) => tr(t) && t.toolCallId === e.toolCallId), i = e, a = n;
2155
2155
  if (n != null) {
2156
2156
  n.state = e.state, a.input = i.input, a.output = i.output, a.errorText = i.errorText, a.rawInput = i.rawInput, a.preliminary = i.preliminary, e.title !== void 0 && (a.title = e.title), e.toolMetadata !== void 0 && (a.toolMetadata = e.toolMetadata), a.providerExecuted = i.providerExecuted ?? n.providerExecuted;
2157
2157
  let t = i.providerMetadata;
@@ -2206,8 +2206,8 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2206
2206
  }
2207
2207
  async function v(e) {
2208
2208
  if (e != null) {
2209
- let n = r.message.metadata == null ? e : Dn(r.message.metadata, e);
2210
- t != null && await hn({
2209
+ let n = r.message.metadata == null ? e : On(r.message.metadata, e);
2210
+ t != null && await gn({
2211
2211
  value: n,
2212
2212
  schema: t,
2213
2213
  context: {
@@ -2230,7 +2230,7 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2230
2230
  }
2231
2231
  case "text-delta": {
2232
2232
  let t = r.activeTextParts[e.id];
2233
- if (t == null) throw new q({
2233
+ if (t == null) throw new J({
2234
2234
  chunkType: "text-delta",
2235
2235
  chunkId: e.id,
2236
2236
  message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
@@ -2240,7 +2240,7 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2240
2240
  }
2241
2241
  case "text-end": {
2242
2242
  let t = r.activeTextParts[e.id];
2243
- if (t == null) throw new q({
2243
+ if (t == null) throw new J({
2244
2244
  chunkType: "text-end",
2245
2245
  chunkId: e.id,
2246
2246
  message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
@@ -2270,7 +2270,7 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2270
2270
  }
2271
2271
  case "reasoning-delta": {
2272
2272
  let t = r.activeReasoningParts[e.id];
2273
- if (t == null) throw new q({
2273
+ if (t == null) throw new J({
2274
2274
  chunkType: "reasoning-delta",
2275
2275
  chunkId: e.id,
2276
2276
  message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
@@ -2280,7 +2280,7 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2280
2280
  }
2281
2281
  case "reasoning-end": {
2282
2282
  let t = r.activeReasoningParts[e.id];
2283
- if (t == null) throw new q({
2283
+ if (t == null) throw new J({
2284
2284
  chunkType: "reasoning-end",
2285
2285
  chunkId: e.id,
2286
2286
  message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
@@ -2317,7 +2317,7 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2317
2317
  }), d();
2318
2318
  break;
2319
2319
  case "tool-input-start": {
2320
- let t = f().filter(er);
2320
+ let t = f().filter(tr);
2321
2321
  r.partialToolCalls[e.toolCallId] = {
2322
2322
  text: "",
2323
2323
  toolName: e.toolName,
@@ -2348,13 +2348,13 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2348
2348
  }
2349
2349
  case "tool-input-delta": {
2350
2350
  let t = r.partialToolCalls[e.toolCallId];
2351
- if (t == null) throw new q({
2351
+ if (t == null) throw new J({
2352
2352
  chunkType: "tool-input-delta",
2353
2353
  chunkId: e.toolCallId,
2354
2354
  message: `Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
2355
2355
  });
2356
2356
  t.text += e.inputTextDelta;
2357
- let { value: n } = await Jn(t.text);
2357
+ let { value: n } = await Yn(t.text);
2358
2358
  t.dynamic ? _({
2359
2359
  toolCallId: e.toolCallId,
2360
2360
  toolName: t.toolName,
@@ -2396,7 +2396,7 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2396
2396
  }), d(), a && !e.providerExecuted && await a({ toolCall: e });
2397
2397
  break;
2398
2398
  case "tool-input-error": {
2399
- let t = f().filter(Z).find((t) => t.toolCallId === e.toolCallId);
2399
+ let t = f().filter(Q).find((t) => t.toolCallId === e.toolCallId);
2400
2400
  (t == null ? e.dynamic : t.type === "dynamic-tool") ? _({
2401
2401
  toolCallId: e.toolCallId,
2402
2402
  toolName: e.toolName,
@@ -2460,7 +2460,7 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2460
2460
  toolMetadata: e.toolMetadata ?? t.toolMetadata
2461
2461
  }, t) : g({
2462
2462
  toolCallId: e.toolCallId,
2463
- toolName: nr(t),
2463
+ toolName: rr(t),
2464
2464
  state: "output-available",
2465
2465
  input: t.input,
2466
2466
  output: e.output,
@@ -2486,7 +2486,7 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2486
2486
  toolMetadata: e.toolMetadata ?? t.toolMetadata
2487
2487
  }, t) : g({
2488
2488
  toolCallId: e.toolCallId,
2489
- toolName: nr(t),
2489
+ toolName: rr(t),
2490
2490
  state: "output-error",
2491
2491
  input: t.input,
2492
2492
  rawInput: t.rawInput,
@@ -2504,12 +2504,12 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2504
2504
  case "finish-step": break;
2505
2505
  case "reset-step": {
2506
2506
  let e = f();
2507
- r.activeTextParts = $n(), r.activeReasoningParts = $n(), r.partialToolCalls = $n(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), d());
2507
+ r.activeTextParts = er(), r.activeReasoningParts = er(), r.partialToolCalls = er(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), d());
2508
2508
  break;
2509
2509
  }
2510
2510
  case "start": {
2511
2511
  let t = c && l || s && e.messageId != null && e.messageId !== r.message.id;
2512
- l = !1, t && Object.assign(r, rr({
2512
+ l = !1, t && Object.assign(r, ir({
2513
2513
  lastMessage: void 0,
2514
2514
  messageId: e.messageId ?? r.message.id
2515
2515
  }), { finishReason: void 0 }), e.messageId != null && (r.message.id = e.messageId), await v(e.messageMetadata), (t || e.messageId != null || e.messageMetadata != null) && d({ updateStatus: !1 });
@@ -2524,10 +2524,10 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2524
2524
  case "error":
2525
2525
  i?.(Error(e.errorText));
2526
2526
  break;
2527
- default: if (Qn(e)) {
2527
+ default: if ($n(e)) {
2528
2528
  if (n?.[e.type] != null) {
2529
2529
  let t = r.message.parts.findIndex((t) => "id" in t && "data" in t && t.id === e.id && t.type === e.type), i = t >= 0 ? t : r.message.parts.length;
2530
- await hn({
2530
+ await gn({
2531
2531
  value: e.data,
2532
2532
  schema: n[e.type],
2533
2533
  context: {
@@ -2550,7 +2550,7 @@ function ir({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
2550
2550
  });
2551
2551
  } }));
2552
2552
  }
2553
- async function ar({ stream: e, onError: t, abortSignal: n }) {
2553
+ async function or({ stream: e, onError: t, abortSignal: n }) {
2554
2554
  let r = e.getReader(), i = () => {
2555
2555
  r.cancel().catch(() => {});
2556
2556
  };
@@ -2566,7 +2566,7 @@ async function ar({ stream: e, onError: t, abortSignal: n }) {
2566
2566
  n?.removeEventListener("abort", i), r.releaseLock();
2567
2567
  }
2568
2568
  }
2569
- function or() {
2569
+ function sr() {
2570
2570
  let e, t;
2571
2571
  return {
2572
2572
  promise: new Promise((n, r) => {
@@ -2588,7 +2588,7 @@ I({
2588
2588
  }), I({
2589
2589
  prefix: "call",
2590
2590
  size: 24
2591
- }), J.record(J.string(), Y.optional()), J.record(J.string(), J.string()), I({
2591
+ }), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()), I({
2592
2592
  prefix: "call",
2593
2593
  size: 24
2594
2594
  }), I({
@@ -2601,7 +2601,7 @@ I({
2601
2601
  prefix: "aiobj",
2602
2602
  size: 24
2603
2603
  });
2604
- var { atob: sr } = globalThis, cr = class {
2604
+ var { atob: cr } = globalThis, lr = class {
2605
2605
  constructor() {
2606
2606
  this.queue = [], this.isProcessing = !1, this.idleWaiters = [];
2607
2607
  }
@@ -2639,9 +2639,9 @@ I({
2639
2639
  }), I({
2640
2640
  prefix: "call",
2641
2641
  size: 24
2642
- }), J.object({
2643
- token: J.string().refine((e) => e.trim().length > 0),
2644
- url: J.string().refine((e) => {
2642
+ }), Y.object({
2643
+ token: Y.string().refine((e) => e.trim().length > 0),
2644
+ url: Y.string().refine((e) => {
2645
2645
  try {
2646
2646
  let t = new URL(e);
2647
2647
  return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
@@ -2649,12 +2649,12 @@ I({
2649
2649
  return !1;
2650
2650
  }
2651
2651
  }),
2652
- expiresAt: J.number().positive().max(2 ** 53 - 1).optional(),
2653
- tools: J.array(J.object({
2654
- type: J.literal("function"),
2655
- name: J.string().min(1),
2656
- description: J.string().optional(),
2657
- parameters: J.record(J.string(), J.unknown())
2652
+ expiresAt: Y.number().positive().max(2 ** 53 - 1).optional(),
2653
+ tools: Y.array(Y.object({
2654
+ type: Y.literal("function"),
2655
+ name: Y.string().min(1),
2656
+ description: Y.string().optional(),
2657
+ parameters: Y.record(Y.string(), Y.unknown())
2658
2658
  })).optional()
2659
2659
  }), I({
2660
2660
  prefix: "call",
@@ -2666,9 +2666,9 @@ I({
2666
2666
  prefix: "call",
2667
2667
  size: 24
2668
2668
  });
2669
- async function lr({ response: e, url: t, fallbackMessage: n }) {
2669
+ async function ur({ response: e, url: t, fallbackMessage: n }) {
2670
2670
  let r = await e.text();
2671
- return new Ne({
2671
+ return new Fe({
2672
2672
  message: r || n,
2673
2673
  url: t,
2674
2674
  requestBodyValues: void 0,
@@ -2676,9 +2676,9 @@ async function lr({ response: e, url: t, fallbackMessage: n }) {
2676
2676
  responseBody: r
2677
2677
  });
2678
2678
  }
2679
- async function ur(e) {
2679
+ async function dr(e) {
2680
2680
  if (e == null) return [];
2681
- if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Ye({
2681
+ if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Ze({
2682
2682
  functionality: "FileList",
2683
2683
  message: "FileList is not supported in the current environment"
2684
2684
  });
@@ -2697,16 +2697,16 @@ async function ur(e) {
2697
2697
  };
2698
2698
  }));
2699
2699
  }
2700
- function dr(e, t) {
2700
+ function fr(e, t) {
2701
2701
  let n = e.search(/[?#]/), r = n === -1 ? e : e.slice(0, n), i = n === -1 ? "" : e.slice(n);
2702
2702
  return `${r.endsWith("/") && t.startsWith("/") ? r.slice(0, -1) : r}${t}${i}`;
2703
2703
  }
2704
- var fr = class {
2704
+ var pr = class {
2705
2705
  constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
2706
2706
  this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
2707
2707
  }
2708
2708
  async sendMessages({ abortSignal: e, ...t }) {
2709
- let n = await yn(this.body), r = await yn(this.headers), i = await yn(this.credentials), a = {
2709
+ let n = await bn(this.body), r = await bn(this.headers), i = await bn(this.credentials), a = {
2710
2710
  ...F(r),
2711
2711
  ...F(t.headers)
2712
2712
  }, o = await this.prepareSendMessagesRequest?.({
@@ -2739,16 +2739,16 @@ var fr = class {
2739
2739
  credentials: u,
2740
2740
  signal: e
2741
2741
  });
2742
- if (!d.ok) throw await lr({
2742
+ if (!d.ok) throw await ur({
2743
2743
  response: d,
2744
2744
  url: s,
2745
2745
  fallbackMessage: "Failed to fetch the chat response."
2746
2746
  });
2747
- if (!d.body) throw new Fe({ message: "The response body is empty." });
2747
+ if (!d.body) throw new Le({ message: "The response body is empty." });
2748
2748
  return this.processResponseStream(d.body);
2749
2749
  }
2750
2750
  async reconnectToStream(e) {
2751
- let t = await yn(this.body), n = await yn(this.headers), r = await yn(this.credentials), i = {
2751
+ let t = await bn(this.body), n = await bn(this.headers), r = await bn(this.credentials), i = {
2752
2752
  ...F(n),
2753
2753
  ...F(e.headers)
2754
2754
  }, a = await this.prepareReconnectToStreamRequest?.({
@@ -2763,12 +2763,12 @@ var fr = class {
2763
2763
  requestMetadata: e.metadata
2764
2764
  }), o = a?.api;
2765
2765
  if (o == null) {
2766
- if (e.chatId === "." || e.chatId === "..") throw new Cn({
2766
+ if (e.chatId === "." || e.chatId === "..") throw new wn({
2767
2767
  parameter: "chatId",
2768
2768
  value: e.chatId,
2769
2769
  message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
2770
2770
  });
2771
- o = dr(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
2771
+ o = fr(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
2772
2772
  }
2773
2773
  let s = a?.headers === void 0 ? i : F(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
2774
2774
  method: "GET",
@@ -2777,37 +2777,37 @@ var fr = class {
2777
2777
  signal: e.abortSignal
2778
2778
  });
2779
2779
  if (l.status === 204) return null;
2780
- if (!l.ok) throw await lr({
2780
+ if (!l.ok) throw await ur({
2781
2781
  response: l,
2782
2782
  url: o,
2783
2783
  fallbackMessage: "Failed to fetch the chat response."
2784
2784
  });
2785
- if (!l.body) throw new Fe({ message: "The response body is empty." });
2785
+ if (!l.body) throw new Le({ message: "The response body is empty." });
2786
2786
  return this.processResponseStream(l.body);
2787
2787
  }
2788
- }, pr = class extends fr {
2788
+ }, mr = class extends pr {
2789
2789
  constructor({ resumeStreamIsReplay: e = !0, ...t } = {}) {
2790
2790
  super(t), this.resumeStreamIsReplay = e;
2791
2791
  }
2792
2792
  processResponseStream(e) {
2793
- return vn({
2793
+ return yn({
2794
2794
  stream: e,
2795
- schema: Zn
2795
+ schema: Qn
2796
2796
  }).pipeThrough(new TransformStream({ async transform(e, t) {
2797
2797
  if (!e.success) throw e.error;
2798
2798
  t.enqueue(e.value);
2799
2799
  } }));
2800
2800
  }
2801
- }, mr = class {
2802
- constructor({ generateId: e = L, id: t = e(), transport: n = new pr(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
2803
- this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new cr(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (e, t) => {
2801
+ }, hr = class {
2802
+ constructor({ generateId: e = L, id: t = e(), transport: n = new mr(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
2803
+ this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new lr(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (e, t) => {
2804
2804
  if (e == null) {
2805
2805
  let e = this.pendingApprovalMessageId;
2806
2806
  if (e == null) {
2807
2807
  e = this.lastMessage?.id;
2808
2808
  for (let t = this.state.messages.length - 1; t >= 0; t--) {
2809
2809
  let n = this.state.messages[t];
2810
- if (n.role === "assistant" && n.parts.some((e) => Z(e) && e.state === "approval-responded")) {
2810
+ if (n.role === "assistant" && n.parts.some((e) => Q(e) && e.state === "approval-responded")) {
2811
2811
  e = n.id;
2812
2812
  break;
2813
2813
  }
@@ -2827,7 +2827,7 @@ var fr = class {
2827
2827
  this.pendingMessagePreparations.add(t);
2828
2828
  let r;
2829
2829
  try {
2830
- r = Array.isArray(e.files) ? e.files : await ur(e.files);
2830
+ r = Array.isArray(e.files) ? e.files : await dr(e.files);
2831
2831
  } finally {
2832
2832
  this.pendingMessagePreparations.delete(t);
2833
2833
  }
@@ -2839,12 +2839,12 @@ var fr = class {
2839
2839
  } else n = e;
2840
2840
  if (e.messageId != null) {
2841
2841
  let t = this.state.messages.findIndex((t) => t.id === e.messageId);
2842
- if (t === -1) throw new Cn({
2842
+ if (t === -1) throw new wn({
2843
2843
  parameter: "message.messageId",
2844
2844
  value: e.messageId,
2845
2845
  message: `message with id ${e.messageId} not found`
2846
2846
  });
2847
- if (this.state.messages[t].role !== "user") throw new Cn({
2847
+ if (this.state.messages[t].role !== "user") throw new wn({
2848
2848
  parameter: "message.messageId",
2849
2849
  value: e.messageId,
2850
2850
  message: `message with id ${e.messageId} is not a user message`
@@ -2868,7 +2868,7 @@ var fr = class {
2868
2868
  });
2869
2869
  }, this.regenerate = async ({ messageId: e, ...t } = {}) => {
2870
2870
  let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
2871
- if (n === -1) throw new Cn({
2871
+ if (n === -1) throw new wn({
2872
2872
  parameter: "messageId",
2873
2873
  value: e,
2874
2874
  message: `message ${e} not found`
@@ -2889,7 +2889,7 @@ var fr = class {
2889
2889
  }, this.clearError = () => {
2890
2890
  this.status === "error" && (this.state.error = void 0, this.setStatus({ status: "ready" }));
2891
2891
  }, this.addToolApprovalResponse = async ({ id: e, approved: t, reason: n, options: r }) => this.jobExecutor.run(async () => {
2892
- let i = this.state.messages, a = (r) => Z(r) && r.state === "approval-requested" && r.approval.id === e ? {
2892
+ let i = this.state.messages, a = (r) => Q(r) && r.state === "approval-requested" && r.approval.id === e ? {
2893
2893
  ...r,
2894
2894
  state: "approval-responded",
2895
2895
  approval: {
@@ -2898,7 +2898,7 @@ var fr = class {
2898
2898
  approved: t,
2899
2899
  reason: n
2900
2900
  }
2901
- } : r, o = i.findIndex((t) => t.parts.some((t) => Z(t) && t.state === "approval-requested" && t.approval.id === e));
2901
+ } : r, o = i.findIndex((t) => t.parts.some((t) => Q(t) && t.state === "approval-requested" && t.approval.id === e));
2902
2902
  if (o !== -1) {
2903
2903
  let e = i[o];
2904
2904
  this.state.replaceMessage(o, {
@@ -2919,7 +2919,7 @@ var fr = class {
2919
2919
  }
2920
2920
  }), this.addToolOutput = async ({ state: e, toolCallId: t, output: n, errorText: r, options: i }) => this.jobExecutor.run(async () => {
2921
2921
  let a = this.state.messages, o = (i) => {
2922
- if (!Z(i) || i.toolCallId !== t) return i;
2922
+ if (!Q(i) || i.toolCallId !== t) return i;
2923
2923
  let { approval: a, ...o } = i, s = a?.approved === !0 ? { approval: {
2924
2924
  ...a,
2925
2925
  approved: a.approved
@@ -2939,7 +2939,7 @@ var fr = class {
2939
2939
  output: n,
2940
2940
  errorText: void 0
2941
2941
  };
2942
- }, s = a.findIndex((e) => e.parts.some((e) => Z(e) && e.toolCallId === t));
2942
+ }, s = a.findIndex((e) => e.parts.some((e) => Q(e) && e.toolCallId === t));
2943
2943
  if (s !== -1) {
2944
2944
  let e = a[s];
2945
2945
  this.state.replaceMessage(s, {
@@ -3004,7 +3004,7 @@ var fr = class {
3004
3004
  }), r && this.status === "error" && this.pendingApprovalMessageId == null && (this.pendingApprovalMessageId = this.state.messages[t]?.id ?? e);
3005
3005
  }
3006
3006
  async makeRequest(e) {
3007
- let t = or();
3007
+ let t = sr();
3008
3008
  try {
3009
3009
  await this.makeRequestImpl({
3010
3010
  ...e,
@@ -3057,10 +3057,10 @@ var fr = class {
3057
3057
  status: "submitted",
3058
3058
  error: void 0
3059
3059
  });
3060
- 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) => Z(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;
3060
+ 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;
3061
3061
  try {
3062
3062
  let s = {
3063
- state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : rr({
3063
+ state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : ir({
3064
3064
  lastMessage: e === "resume-stream" ? h : e === "regenerate-message" ? void 0 : this.state.snapshot(p),
3065
3065
  messageId: this.generateId()
3066
3066
  }),
@@ -3080,8 +3080,8 @@ var fr = class {
3080
3080
  body: r,
3081
3081
  trigger: e,
3082
3082
  messageId: i
3083
- }), await ar({
3084
- stream: ir({
3083
+ }), await or({
3084
+ stream: ar({
3085
3085
  stream: l,
3086
3086
  resetStateOnMessageIdChange: e === "resume-stream",
3087
3087
  resetStateOnFirstMessageStart: e === "resume-stream" && this.transport.resumeStreamIsReplay,
@@ -3146,39 +3146,39 @@ var fr = class {
3146
3146
  }));
3147
3147
  }
3148
3148
  };
3149
- function hr({ messages: e }) {
3149
+ function gr({ messages: e }) {
3150
3150
  let t = e[e.length - 1];
3151
3151
  if (!t || t.role !== "assistant") return !1;
3152
- let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Z);
3152
+ let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Q);
3153
3153
  return r.filter((e) => e.state === "approval-responded").length > 0 && r.every((e) => e.state === "output-available" && e.preliminary !== !0 || e.state === "output-error" || e.state === "output-denied" || e.state === "approval-responded");
3154
3154
  }
3155
3155
  //#endregion
3156
3156
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
3157
- var gr = /* @__PURE__ */ new WeakMap(), _r = 0;
3158
- function vr(e) {
3157
+ var _r = /* @__PURE__ */ new WeakMap(), vr = 0;
3158
+ function yr(e) {
3159
3159
  if (!e.length) return "";
3160
3160
  for (var t = "arg", n = 0; n < e.length; ++n) {
3161
3161
  var r = void 0;
3162
- e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : gr.has(e[n]) ? r = gr.get(e[n]) : (r = _r, gr.set(e[n], _r++)), t += "@" + r;
3162
+ e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : _r.has(e[n]) ? r = _r.get(e[n]) : (r = vr, _r.set(e[n], vr++)), t += "@" + r;
3163
3163
  }
3164
3164
  return t;
3165
3165
  }
3166
3166
  //#endregion
3167
3167
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/cache/index.js
3168
- function yr(e) {
3168
+ function br(e) {
3169
3169
  if (typeof e == "function") try {
3170
3170
  e = e();
3171
3171
  } catch {
3172
3172
  e = "";
3173
3173
  }
3174
- return e = Array.isArray(e) ? vr(e) : String(e || ""), e;
3174
+ return e = Array.isArray(e) ? yr(e) : String(e || ""), e;
3175
3175
  }
3176
- var br = function() {
3176
+ var xr = function() {
3177
3177
  function e(e) {
3178
3178
  e === void 0 && (e = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = e;
3179
3179
  }
3180
3180
  return e.prototype.serializeKey = function(e) {
3181
- return yr(e);
3181
+ return br(e);
3182
3182
  }, e.prototype.get = function(e) {
3183
3183
  var t = this.serializeKey(e);
3184
3184
  return this.items.get(t);
@@ -3200,26 +3200,26 @@ var br = function() {
3200
3200
  }();
3201
3201
  //#endregion
3202
3202
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/lib/web-preset.js
3203
- function xr() {
3203
+ function Sr() {
3204
3204
  return navigator.onLine === void 0 || navigator.onLine;
3205
3205
  }
3206
- function Sr() {
3206
+ function Cr() {
3207
3207
  return typeof document < "u" && document.visibilityState !== void 0 ? document.visibilityState !== "hidden" : !0;
3208
3208
  }
3209
- var Cr = {
3210
- isOnline: xr,
3211
- isDocumentVisible: Sr,
3209
+ var wr = {
3210
+ isOnline: Sr,
3211
+ isDocumentVisible: Cr,
3212
3212
  fetcher: function(e) {
3213
3213
  return fetch(e).then(function(e) {
3214
3214
  return e.json();
3215
3215
  });
3216
3216
  }
3217
- }, Q = function() {
3218
- return Q = Object.assign || function(e) {
3217
+ }, $ = function() {
3218
+ return $ = Object.assign || function(e) {
3219
3219
  for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
3220
3220
  return e;
3221
- }, Q.apply(this, arguments);
3222
- }, wr = function(e, t, n, r) {
3221
+ }, $.apply(this, arguments);
3222
+ }, Tr = function(e, t, n, r) {
3223
3223
  function i(e) {
3224
3224
  return e instanceof n ? e : new n(function(t) {
3225
3225
  t(e);
@@ -3245,7 +3245,7 @@ var Cr = {
3245
3245
  }
3246
3246
  c((r = r.apply(e, t || [])).next());
3247
3247
  });
3248
- }, $ = function(e, t) {
3248
+ }, Er = function(e, t) {
3249
3249
  var n = {
3250
3250
  label: 0,
3251
3251
  sent: function() {
@@ -3318,7 +3318,7 @@ var Cr = {
3318
3318
  done: !0
3319
3319
  };
3320
3320
  }
3321
- }, Tr = function(e, t) {
3321
+ }, Dr = function(e, t) {
3322
3322
  var n = typeof Symbol == "function" && e[Symbol.iterator];
3323
3323
  if (!n) return e;
3324
3324
  var r = n.call(e), i, a = [], o;
@@ -3334,11 +3334,11 @@ var Cr = {
3334
3334
  }
3335
3335
  }
3336
3336
  return a;
3337
- }, Er = function(e, t, n) {
3337
+ }, Or = function(e, t, n) {
3338
3338
  if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]);
3339
3339
  return e.concat(a || Array.prototype.slice.call(t));
3340
- }, Dr = new br(), Or = new br(), kr = new br(), Ar = {
3341
- cache: Dr,
3340
+ }, kr = new xr(), Ar = new xr(), jr = new xr(), Mr = {
3341
+ cache: kr,
3342
3342
  refreshInterval: 0,
3343
3343
  ttl: 0,
3344
3344
  serverTTL: 1e3,
@@ -3348,15 +3348,15 @@ var Cr = {
3348
3348
  shouldRetryOnError: !0,
3349
3349
  errorRetryInterval: 5e3,
3350
3350
  errorRetryCount: 5,
3351
- fetcher: Cr.fetcher,
3352
- isOnline: Cr.isOnline,
3353
- isDocumentVisible: Cr.isDocumentVisible
3351
+ fetcher: wr.fetcher,
3352
+ isOnline: wr.isOnline,
3353
+ isDocumentVisible: wr.isDocumentVisible
3354
3354
  };
3355
- function jr(e, t, n) {
3356
- var r = Or.get(e);
3357
- r ? r.data.push(t) : Or.set(e, [t], n > 0 ? n + 5e3 : n);
3355
+ function Nr(e, t, n) {
3356
+ var r = Ar.get(e);
3357
+ r ? r.data.push(t) : Ar.set(e, [t], n > 0 ? n + 5e3 : n);
3358
3358
  }
3359
- function Mr(e, t, n) {
3359
+ function Pr(e, t, n) {
3360
3360
  if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
3361
3361
  var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
3362
3362
  setTimeout(function() {
@@ -3367,17 +3367,17 @@ function Mr(e, t, n) {
3367
3367
  }, i);
3368
3368
  }
3369
3369
  }
3370
- function Nr(e) {
3370
+ function Fr(e) {
3371
3371
  var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
3372
- return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : Ar.shouldRetryOnError;
3372
+ return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : Mr.shouldRetryOnError;
3373
3373
  }
3374
- var Pr = function(e, t, n, r) {
3375
- return n === void 0 && (n = Dr), r === void 0 && (r = Ar.ttl), wr(void 0, void 0, void 0, function() {
3374
+ var Ir = function(e, t, n, r) {
3375
+ return n === void 0 && (n = kr), r === void 0 && (r = Mr.ttl), Tr(void 0, void 0, void 0, function() {
3376
3376
  var i, a, o, s, c, l, u;
3377
- return $(this, function(d) {
3377
+ return Er(this, function(d) {
3378
3378
  switch (d.label) {
3379
3379
  case 0:
3380
- if (!Ir(t)) return [3, 5];
3380
+ if (!Rr(t)) return [3, 5];
3381
3381
  d.label = 1;
3382
3382
  case 1: return d.trys.push([
3383
3383
  1,
@@ -3399,7 +3399,7 @@ var Pr = function(e, t, n, r) {
3399
3399
  } catch (e) {
3400
3400
  console.error("swrv(mutate): failed to set cache", e);
3401
3401
  }
3402
- return l = Or.get(e), l && l.data.length && (u = l.data.filter(function(t) {
3402
+ return l = Ar.get(e), l && l.data.length && (u = l.data.filter(function(t) {
3403
3403
  return t.key === e;
3404
3404
  }), u.forEach(function(e, t) {
3405
3405
  c.data !== void 0 && (e.data = c.data), e.error = c.error, e.isValidating = c.isValidating, e.isLoading = c.isValidating, t !== u.length - 1 && delete u[t];
@@ -3408,16 +3408,16 @@ var Pr = function(e, t, n, r) {
3408
3408
  });
3409
3409
  });
3410
3410
  };
3411
- function Fr() {
3411
+ function Lr() {
3412
3412
  for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
3413
- var r, i, a = Q({}, Ar), o = !1, s = !1;
3413
+ var r, i, a = $({}, Mr), o = !1, s = !1;
3414
3414
  if (!pe()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
3415
3415
  var c = typeof window > "u" || typeof document > "u";
3416
- t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = Q(Q({}, a), t[2]));
3417
- var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : C(r);
3416
+ t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
3417
+ var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : S(r);
3418
3418
  i === void 0 && (i = a.fetcher);
3419
3419
  var d = null;
3420
- d ||= he({
3420
+ d ||= _e({
3421
3421
  data: void 0,
3422
3422
  error: void 0,
3423
3423
  isValidating: !0,
@@ -3425,32 +3425,32 @@ function Fr() {
3425
3425
  key: null
3426
3426
  });
3427
3427
  var f = function(t, n) {
3428
- return wr(e, void 0, void 0, function() {
3428
+ return Tr(e, void 0, void 0, function() {
3429
3429
  var e, r, s, c, p, m, h, g = this;
3430
- return $(this, function(_) {
3430
+ return Er(this, function(_) {
3431
3431
  switch (_.label) {
3432
3432
  case 0: return e = d.data === void 0, r = u.value, r ? (s = a.cache.get(r), c = s && s.data, d.isValidating = !0, d.isLoading = !c, c && (d.data = c.data, d.error = c.error), p = t || i, !p || !a.isDocumentVisible() && !e || n?.forceRevalidate !== void 0 && !n?.forceRevalidate || s && (m = !!(Date.now() - s.createdAt >= a.dedupingInterval || n?.forceRevalidate), !m) ? (d.isValidating = !1, d.isLoading = !1, [2]) : (h = function() {
3433
- return wr(g, void 0, void 0, function() {
3433
+ return Tr(g, void 0, void 0, function() {
3434
3434
  var e, t, i, s, c, u;
3435
- return $(this, function(m) {
3435
+ return Er(this, function(m) {
3436
3436
  switch (m.label) {
3437
- case 0: return e = kr.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, Er([], Tr(t), !1)), kr.set(r, i, a.dedupingInterval), [4, Pr(r, i, a.cache, l)]);
3437
+ case 0: return e = jr.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, Or([], Dr(t), !1)), jr.set(r, i, a.dedupingInterval), [4, Ir(r, i, a.cache, l)]);
3438
3438
  case 1: return m.sent(), [3, 4];
3439
- case 2: return [4, Pr(r, e.data, a.cache, l)];
3439
+ case 2: return [4, Ir(r, e.data, a.cache, l)];
3440
3440
  case 3: m.sent(), m.label = 4;
3441
- case 4: return d.isValidating = !1, d.isLoading = !1, kr.delete(r), d.error !== void 0 && (s = Nr({
3441
+ case 4: return d.isValidating = !1, d.isLoading = !1, jr.delete(r), d.error !== void 0 && (s = Fr({
3442
3442
  shouldRetry: a.shouldRetryOnError,
3443
3443
  error: d.error
3444
- }), c = Nr({
3444
+ }), c = Fr({
3445
3445
  shouldRetry: !n || n.shouldRetryOnError,
3446
3446
  error: d.error
3447
- }), u = !o && s && c, u && Mr(f, n ? n.errorRetryCount : 1, a)), [2];
3447
+ }), u = !o && s && c, u && Pr(f, n ? n.errorRetryCount : 1, a)), [2];
3448
3448
  }
3449
3449
  });
3450
3450
  });
3451
3451
  }, c && a.revalidateDebounce ? (setTimeout(function() {
3452
- return wr(g, void 0, void 0, function() {
3453
- return $(this, function(e) {
3452
+ return Tr(g, void 0, void 0, function() {
3453
+ return Er(this, function(e) {
3454
3454
  switch (e.label) {
3455
3455
  case 0: return o ? [3, 2] : [4, h()];
3456
3456
  case 1: e.sent(), e.label = 2;
@@ -3466,16 +3466,16 @@ function Fr() {
3466
3466
  });
3467
3467
  });
3468
3468
  }, p = function() {
3469
- return wr(e, void 0, void 0, function() {
3470
- return $(this, function(e) {
3469
+ return Tr(e, void 0, void 0, function() {
3470
+ return Er(this, function(e) {
3471
3471
  return [2, f(null, { shouldRetryOnError: !1 })];
3472
3472
  });
3473
3473
  });
3474
3474
  }, m = null;
3475
3475
  if (!c) {
3476
3476
  var h = function() {
3477
- return wr(e, void 0, void 0, function() {
3478
- return $(this, function(e) {
3477
+ return Tr(e, void 0, void 0, function() {
3478
+ return Er(this, function(e) {
3479
3479
  switch (e.label) {
3480
3480
  case 0: return d.error || !a.isOnline() ? [3, 2] : [4, f()];
3481
3481
  case 1: return e.sent(), [3, 3];
@@ -3487,110 +3487,187 @@ function Fr() {
3487
3487
  };
3488
3488
  a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
3489
3489
  }
3490
- me(function() {
3490
+ ge(function() {
3491
3491
  o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
3492
- var e = Or.get(u.value);
3492
+ var e = Ar.get(u.value);
3493
3493
  e && (e.data = e.data.filter(function(e) {
3494
3494
  return e !== d;
3495
3495
  }));
3496
3496
  });
3497
3497
  try {
3498
3498
  w(u, function(e) {
3499
- S(u) || (u.value = e), d.key = e, d.isValidating = !!e, jr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3499
+ me(u) || (u.value = e), d.key = e, d.isValidating = !!e, Nr(u.value, d, l), !c && !s && u.value && f(), s = !1;
3500
3500
  }, { immediate: !0 });
3501
3501
  } catch {}
3502
- return Q(Q({}, _e(d)), { mutate: function(e, t) {
3503
- return f(e, Q(Q({}, t), { forceRevalidate: !0 }));
3502
+ return $($({}, ve(d)), { mutate: function(e, t) {
3503
+ return f(e, $($({}, t), { forceRevalidate: !0 }));
3504
3504
  } });
3505
3505
  }
3506
- function Ir(e) {
3506
+ function Rr(e) {
3507
3507
  return typeof e == "object" && !!e && typeof e.then == "function";
3508
3508
  }
3509
3509
  //#endregion
3510
3510
  //#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.44_typescript@6.0.3_/node_modules/swrv/esm/index.js
3511
- var Lr = Fr;
3512
- Lr.default, Lr.default;
3513
- var Rr = class {
3514
- constructor(e) {
3515
- this.statusRef = C("ready"), this.errorRef = C(void 0), this.pushMessage = (e) => {
3516
- this.messagesRef.value = [...this.messagesRef.value, e];
3511
+ var zr = Lr;
3512
+ zr.default, zr.default;
3513
+ function Br(e) {
3514
+ return Array.isArray(e) ? [...e] : typeof e == "object" && e && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null) ? { ...e } : e;
3515
+ }
3516
+ function Vr(e) {
3517
+ if (typeof e != "object" || !e || !("parts" in e) || !Array.isArray(e.parts)) return e;
3518
+ let t = e, n = {
3519
+ ...t,
3520
+ parts: t.parts.map((e) => ({ ...e }))
3521
+ };
3522
+ return "metadata" in t && (n.metadata = Br(t.metadata)), n;
3523
+ }
3524
+ var Hr = class {
3525
+ constructor({ initialMessages: e, messagesRef: t, statusRef: n, errorRef: r, throttleWaitMs: i }) {
3526
+ this.publishedMessages = [], this.publishedMessageSources = [], this.dirtyMessageIndices = /* @__PURE__ */ new Set(), this.statusValue = "ready", this.hasPendingPublication = !1, this.isActive = !0, this.isPublishing = !1, this.pushMessage = (e) => {
3527
+ this.messagesValue.push(e), this.dirtyMessageIndices.add(this.messagesValue.length - 1), this.schedulePublication();
3517
3528
  }, this.popMessage = () => {
3518
- this.messagesRef.value = this.messagesRef.value.slice(0, -1);
3529
+ this.messagesValue.pop(), this.schedulePublication();
3519
3530
  }, this.replaceMessage = (e, t) => {
3520
- this.messagesRef.value[e] = { ...t };
3521
- }, this.snapshot = (e) => e, this.messagesRef = C(e ?? []);
3531
+ this.messagesValue[e] = t, this.dirtyMessageIndices.add(e), this.schedulePublication();
3532
+ }, this.snapshot = Vr, this.handleIntervalEnd = () => {
3533
+ this.timeout = void 0, this.isActive && this.hasPendingPublication && (this.hasPendingPublication = !1, this.publishMessages(), this.timeout = setTimeout(this.handleIntervalEnd, this.throttleWaitMs));
3534
+ }, this.messagesValue = e, this.messagesRef = t, this.statusRef = n, this.errorRef = r, this.throttleWaitMs = i != null && Number.isFinite(i) && i > 0 ? i : void 0;
3522
3535
  }
3523
3536
  get messages() {
3524
- return this.messagesRef.value;
3537
+ return this.messagesValue;
3525
3538
  }
3526
3539
  set messages(e) {
3527
- this.messagesRef.value = e;
3540
+ let t = this.messagesValue;
3541
+ this.messagesValue = e;
3542
+ for (let n = 0; n < e.length; n++) e[n] !== t[n] && this.dirtyMessageIndices.add(n);
3543
+ this.schedulePublication();
3528
3544
  }
3529
3545
  get status() {
3530
- return this.statusRef.value;
3546
+ return this.statusValue;
3531
3547
  }
3532
3548
  set status(e) {
3533
- this.statusRef.value = e;
3549
+ this.statusValue = e, this.isActive && ((e === "ready" || e === "error") && this.flushPublication(), this.statusRef.value = e);
3534
3550
  }
3535
3551
  get error() {
3536
- return this.errorRef.value;
3552
+ return this.errorValue;
3537
3553
  }
3538
3554
  set error(e) {
3539
- this.errorRef.value = e;
3555
+ this.errorValue = e, this.isActive && (this.errorRef.value = e);
3556
+ }
3557
+ publishInitialState() {
3558
+ this.publishMessages(), this.statusRef.value = this.statusValue, this.errorRef.value = this.errorValue;
3559
+ }
3560
+ setMessagesFromConsumer(e) {
3561
+ this.messagesValue = e, this.publishedMessages = e, this.publishedMessageSources = e, this.dirtyMessageIndices.clear();
3562
+ }
3563
+ dispose() {
3564
+ this.isActive = !1, this.hasPendingPublication = !1, this.dirtyMessageIndices.clear(), this.publishedMessages = [], this.publishedMessageSources = [], this.timeout != null && (clearTimeout(this.timeout), this.timeout = void 0);
3565
+ }
3566
+ schedulePublication() {
3567
+ this.isActive && (this.throttleWaitMs == null ? this.publishMessages() : this.timeout == null ? (this.publishMessages(), this.timeout = setTimeout(this.handleIntervalEnd, this.throttleWaitMs)) : this.hasPendingPublication = !0);
3540
3568
  }
3541
- }, zr = class extends mr {
3542
- constructor({ messages: e, ...t }) {
3569
+ flushPublication() {
3570
+ this.timeout != null && (clearTimeout(this.timeout), this.timeout = void 0), this.hasPendingPublication = !1, this.publishMessages();
3571
+ }
3572
+ publishMessages() {
3573
+ if (!this.isActive) return;
3574
+ let e = this.messagesValue.map((e, t) => this.dirtyMessageIndices.has(t) || this.publishedMessageSources[t] !== e ? Vr(e) : this.publishedMessages[t]);
3575
+ this.publishedMessages = e, this.publishedMessageSources = [...this.messagesValue], this.dirtyMessageIndices.clear(), this.isPublishing = !0;
3576
+ try {
3577
+ this.messagesRef.value = e;
3578
+ } finally {
3579
+ this.isPublishing = !1;
3580
+ }
3581
+ }
3582
+ }, Ur = class extends hr {
3583
+ constructor({ state: e, ...t }) {
3543
3584
  super({
3544
3585
  ...t,
3545
- state: new Rr(e)
3586
+ state: e
3546
3587
  });
3547
3588
  }
3548
- }, Br = "voice-", Vr = (e) => e?.role === "assistant" && e.parts.some((e) => e.state === "approval-requested"), Hr = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), Ur = (e) => Hr(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Wr = 8, Gr = (e, t) => {
3589
+ };
3590
+ function Wr(e) {
3591
+ let t = C([]), n = C("ready"), r = C(), i = C(), a;
3592
+ return w(t, (e) => {
3593
+ a != null && !a.isPublishing && a.setMessagesFromConsumer(e);
3594
+ }, { flush: "sync" }), w(() => ye(e), (e) => {
3595
+ a?.dispose();
3596
+ let { throttle: o, ...s } = e ?? {}, c = new Hr({
3597
+ initialMessages: s.messages ?? [],
3598
+ messagesRef: t,
3599
+ statusRef: n,
3600
+ errorRef: r,
3601
+ throttleWaitMs: o
3602
+ });
3603
+ a = c, c.publishInitialState(), i.value = new Ur({
3604
+ ...s,
3605
+ state: c
3606
+ });
3607
+ }, { immediate: !0 }), pe() != null && ge(() => {
3608
+ a?.dispose();
3609
+ }), {
3610
+ id: x(() => i.value.id),
3611
+ status: n,
3612
+ messages: t,
3613
+ error: r,
3614
+ addToolApprovalResponse: (e) => i.value.addToolApprovalResponse(e),
3615
+ addToolOutput: (e) => i.value.addToolOutput(e),
3616
+ clearError: () => i.value.clearError(),
3617
+ regenerate: (e) => i.value.regenerate(e),
3618
+ sendMessage: (...e) => i.value.sendMessage(...e),
3619
+ stop: () => i.value.stop(),
3620
+ resumeStream: (e) => i.value.resumeStream(e)
3621
+ };
3622
+ }
3623
+ //#endregion
3624
+ //#region ../../packages/composable/src/chatbot/useChatbotStore.ts
3625
+ var Gr = "voice-", Kr = (e) => e?.role === "assistant" && e.parts.some((e) => e.state === "approval-requested"), qr = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), Jr = (e) => qr(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), Yr = 8, Xr = (e, t) => {
3549
3626
  let n = e.filter((e) => e.role === "user").map((e) => ({
3550
- text: Ur(e),
3627
+ text: Jr(e),
3551
3628
  taken: !1
3552
3629
  }));
3553
3630
  return t.filter((e) => {
3554
3631
  if (!e.id.startsWith("voice-") || e.role !== "user") return !1;
3555
- let t = Ur(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Wr && t.endsWith(e.text)));
3632
+ let t = Jr(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= Yr && t.endsWith(e.text)));
3556
3633
  return !r || (r.taken = !0, !1);
3557
3634
  });
3558
- }, Kr = (e) => {
3635
+ }, Zr = (e) => {
3559
3636
  let t = e.type ?? "";
3560
3637
  return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
3561
- }, qr = ({ messages: e }) => {
3638
+ }, Qr = ({ messages: e }) => {
3562
3639
  let t = e[e.length - 1];
3563
3640
  if (!t || t.role !== "assistant") return !1;
3564
- 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(Kr(e)) || ee(e)));
3641
+ let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter((e) => !e.providerExecuted && (y(Zr(e)) || ee(e)));
3565
3642
  return r.length > 0 && r.every((e) => oe.has(e.state ?? ""));
3566
3643
  };
3567
- function Jr(e) {
3568
- return xe(`chatbot-${e}`, () => {
3569
- let { t, te: n, locale: r } = ye({ useScope: "global" }), i = C(""), a = C(), o = C(e), s = C(), c = C(), l = C(), u = C(), d = C(), f = C(), p = C(), m = C(), h = C(), g = C(), _ = C(), v = C(), y = C(), b = C(), te = C(), ie = C(), oe = ge(), pe = C(0), S = C(), me = ge(), he = ge(), _e = C(), xe = C(!1), Te = C(0), ke = C(), Ae = C(!1), T = be(), je = x(() => {
3644
+ function $r(e) {
3645
+ return Ce(`chatbot-${e}`, () => {
3646
+ let { t, te: n, locale: r } = xe({ useScope: "global" }), i = S(""), a = S(), o = S(e), s = S(), c = S(), l = S(), u = S(), d = S(), f = S(), p = S(), m = S(), h = S(), g = S(), _ = S(), v = S(), y = S(), b = S(), te = S(), ie = S(), oe = C(), pe = S(0), me = S(), ge = C(), ve = C(), ye = S(), Ce = S(!1), De = S(0), je = S(), Me = S(!1), T = Se(), Ne = x(() => {
3570
3647
  let e = u.value?.theme;
3571
- return (!e || e === "auto") && (e = ke.value), e ? e === "dark" : T.value;
3572
- }), E = x(() => c.value === "reasoning"), Me = x(() => E.value ? g.value?.filter((e) => ![
3648
+ return (!e || e === "auto") && (e = je.value), e ? e === "dark" : T.value;
3649
+ }), E = x(() => c.value === "reasoning"), Pe = x(() => E.value ? g.value?.filter((e) => ![
3573
3650
  "upvote",
3574
3651
  "downvote",
3575
3652
  "feedback"
3576
- ].includes(e)) : g.value), Ne = fe(x(() => `${o.value}-chatId`), null);
3577
- ve(() => {
3578
- Ne.value ||= L();
3653
+ ].includes(e)) : g.value), Fe = fe(x(() => `${o.value}-chatId`), null);
3654
+ be(() => {
3655
+ Fe.value ||= L();
3579
3656
  });
3580
3657
  let D = x({
3581
- get: () => Ne.value,
3658
+ get: () => Fe.value,
3582
3659
  set: (e) => {
3583
- Ne.value = e;
3660
+ Fe.value = e;
3584
3661
  }
3585
- }), O = de(x(() => `${o.value}-pageAccessOff`), !1), Pe = x(() => O.value ? [] : me.value ?? []), Fe = () => O.value ? [] : he.value?.() ?? [], Ie = x(() => !!(S.value && me.value?.length)), Le = fe(x(() => `${o.value}-pageNotice`), null), Re = x(() => {
3586
- let e = S.value?.level;
3587
- return e && e !== ae.Off && Pe.value.length && !ne(Le.value ?? void 0, e) ? e : void 0;
3662
+ }), O = de(x(() => `${o.value}-pageAccessOff`), !1), Ie = x(() => O.value ? [] : ge.value ?? []), Le = () => O.value ? [] : ve.value?.() ?? [], Re = x(() => !!(me.value && ge.value?.length)), ze = fe(x(() => `${o.value}-pageNotice`), null), Be = x(() => {
3663
+ let e = me.value?.level;
3664
+ return e && e !== ae.Off && Ie.value.length && !ne(ze.value ?? void 0, e) ? e : void 0;
3588
3665
  });
3589
- function ze() {
3590
- Le.value = S.value?.level ?? null;
3666
+ function Ve() {
3667
+ ze.value = me.value?.level ?? null;
3591
3668
  }
3592
- let Be = C(), k = C(!1), Ve = x(() => Be.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3593
- function He(e) {
3669
+ let He = S(), k = S(!1), Ue = x(() => He.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
3670
+ function We(e) {
3594
3671
  try {
3595
3672
  let t = JSON.parse(e.message);
3596
3673
  return t.status === 404 || t.type?.includes("entity-not-found");
@@ -3598,29 +3675,31 @@ function Jr(e) {
3598
3675
  return !1;
3599
3676
  }
3600
3677
  }
3601
- function Ue(e) {
3602
- if (He(e)) {
3603
- let e = N.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? ue(t) : void 0;
3604
- D.value = L(), N.value.clearError(), Be.value = void 0, n && N.value.sendMessage({ text: n });
3605
- } else ce.error(e), Be.value = e, Ve.value && (k.value = !0);
3678
+ function Ge(e) {
3679
+ if (We(e)) {
3680
+ let e = P.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? ue(t) : void 0;
3681
+ D.value = L(), He.value = void 0, he(() => {
3682
+ P.value.clearError(), n && P.value.sendMessage({ text: n });
3683
+ });
3684
+ } else ce.error(e), He.value = e, Ue.value && (k.value = !0);
3606
3685
  }
3607
3686
  let A = x(() => se({
3608
3687
  baseUrl: i.value,
3609
3688
  basePath: a.value,
3610
3689
  headers: () => p.value
3611
- })), We = C(null), Ge = () => ({
3612
- ...Se(),
3613
- ...We.value ?? {}
3614
- }), Ke = () => {
3615
- let e = Te.value;
3690
+ })), Ke = S(null), qe = () => ({
3691
+ ...we(),
3692
+ ...Ke.value ?? {}
3693
+ }), Je = () => {
3694
+ let e = De.value;
3616
3695
  return new Promise((t) => {
3617
3696
  let n = setTimeout(() => {
3618
3697
  r(), t(!1);
3619
- }, 3e4), r = w(() => [Te.value, N.value.status], ([i, a]) => {
3698
+ }, 3e4), r = w(() => [De.value, P.value.status], ([i, a]) => {
3620
3699
  i > e && a === "streaming" && (clearTimeout(n), r(), t(!0));
3621
3700
  });
3622
3701
  });
3623
- }, j = ge(), qe = (e, t) => new Promise((n) => {
3702
+ }, j = C(), Ye = (e, t) => new Promise((n) => {
3624
3703
  j.value?.answer(!1), j.value = {
3625
3704
  toolCallId: e.toolCallId,
3626
3705
  question: t,
@@ -3629,44 +3708,44 @@ function Jr(e) {
3629
3708
  }
3630
3709
  };
3631
3710
  });
3632
- function Je(e) {
3711
+ function Xe(e) {
3633
3712
  j.value?.answer(e);
3634
3713
  }
3635
- let Ye = Oe({
3714
+ let Ze = Ae({
3636
3715
  registry: () => [
3637
3716
  ...(oe.value ?? []).filter((e) => !re(e.name)),
3638
- ...Pe.value,
3639
- ...Fe()
3717
+ ...Ie.value,
3718
+ ...Le()
3640
3719
  ],
3641
3720
  capability: () => ie.value,
3642
- addToolOutput: (e) => void N.value.addToolOutput(e),
3643
- confirm: qe,
3644
- waitForResume: Ke,
3721
+ addToolOutput: (e) => void P.value.addToolOutput(e),
3722
+ confirm: Ye,
3723
+ waitForResume: Je,
3645
3724
  onPendingChange: (e) => {
3646
3725
  pe.value = e;
3647
3726
  },
3648
3727
  onActivity: (e) => {
3649
3728
  if (e?.provider !== "page" || e.readOnly) {
3650
- _e.value = void 0;
3729
+ ye.value = void 0;
3651
3730
  return;
3652
3731
  }
3653
- let t = [...Pe.value, ...Fe()].find((t) => t.name === e.toolName);
3654
- _e.value = { title: t?.annotations?.title ?? e.toolName }, xe.value = !0;
3732
+ let t = [...Ie.value, ...Le()].find((t) => t.name === e.toolName);
3733
+ ye.value = { title: t?.annotations?.title ?? e.toolName }, Ce.value = !0;
3655
3734
  }
3656
3735
  });
3657
- async function Xe() {
3658
- M(), _e.value = void 0, xe.value = !1, H.value = "", await N.value.stop();
3736
+ async function Qe() {
3737
+ M(), ye.value = void 0, Ce.value = !1, U.value = "", await P.value.stop();
3659
3738
  }
3660
3739
  function M() {
3661
- Ye.cancelAll(), j.value?.answer(!1);
3740
+ Ze.cancelAll(), j.value?.answer(!1);
3662
3741
  }
3663
- async function Ze(e) {
3664
- O.value = e, e && await Xe();
3742
+ async function $e(e) {
3743
+ O.value = e, e && await Qe();
3665
3744
  }
3666
3745
  w(D, () => M());
3667
- let N = x(() => new zr({
3746
+ let N = Wr(() => ({
3668
3747
  id: D.value,
3669
- transport: new pr({
3748
+ transport: new mr({
3670
3749
  api: A.value.getChatEndpoint(o.value, E.value ? "reasoning" : "chat"),
3671
3750
  prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
3672
3751
  id: t,
@@ -3682,15 +3761,15 @@ function Jr(e) {
3682
3761
  reasoning: d.value?.reasoning,
3683
3762
  webSearch: f.value?.webSearch,
3684
3763
  smoothStream: u.value?.smoothStream,
3685
- deviceContext: Ge(),
3764
+ deviceContext: qe(),
3686
3765
  externalContext: te.value,
3687
3766
  disabledTools: f.value?.disabled,
3688
3767
  fallbackModels: y.value,
3689
3768
  gatewayOptions: b.value,
3690
- hostTools: De(oe.value, ie.value),
3691
- pageTools: S.value && Pe.value.length ? {
3769
+ hostTools: ke(oe.value, ie.value),
3770
+ pageTools: me.value && Ie.value.length ? {
3692
3771
  version: 1,
3693
- forms: Fe().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
3772
+ forms: Le().map(({ name: e, description: t, inputSchema: n, annotations: r }) => ({
3694
3773
  name: e,
3695
3774
  description: t,
3696
3775
  inputSchema: n,
@@ -3701,38 +3780,38 @@ function Jr(e) {
3701
3780
  credentials: "include",
3702
3781
  headers: () => p.value ?? {}
3703
3782
  }),
3704
- sendAutomaticallyWhen: (e) => qr(e) || hr(e),
3705
- onError: Ue,
3783
+ sendAutomaticallyWhen: (e) => Qr(e) || gr(e),
3784
+ onError: Ge,
3706
3785
  onToolCall: ({ toolCall: e }) => {
3707
- if (!Ee(e)) return;
3786
+ if (!Oe(e)) return;
3708
3787
  let t = e;
3709
- Ye.enqueue({
3788
+ Ze.enqueue({
3710
3789
  toolCallId: t.toolCallId,
3711
3790
  toolName: t.toolName,
3712
3791
  input: t.input,
3713
- messageId: N.value.lastMessage?.id ?? "",
3792
+ messageId: et()?.id ?? "",
3714
3793
  readOnly: t.toolMetadata?.readOnly === !0,
3715
3794
  provider: t.toolMetadata?.provider === "page" ? "page" : "app"
3716
3795
  });
3717
3796
  },
3718
3797
  onData: (e) => {
3719
- e.type === "data-audioTranscripts" && (N.value.messages = le(N.value.messages, e.data));
3798
+ e.type === "data-audioTranscripts" && (P.value.messages = le(P.value.messages, e.data));
3720
3799
  },
3721
3800
  onFinish: () => {
3722
3801
  let e = D.value;
3723
- !E.value && !P.value.some((t) => t.id === e) && ft(o.value);
3802
+ !E.value && !F.value.some((t) => t.id === e) && ht(o.value);
3724
3803
  }
3725
- })), Qe = x(() => {
3804
+ })), P = x(() => _e(N)), et = () => P.value.messages[P.value.messages.length - 1], tt = x(() => {
3726
3805
  let e = u.value?.initialMessage;
3727
3806
  return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
3728
- }), $e = L(), et = x(() => ({
3729
- id: $e,
3807
+ }), nt = L(), rt = x(() => ({
3808
+ id: nt,
3730
3809
  role: "assistant",
3731
3810
  parts: [{
3732
3811
  type: "text",
3733
- text: Qe.value
3812
+ text: tt.value
3734
3813
  }]
3735
- })), tt = x(() => {
3814
+ })), it = x(() => {
3736
3815
  let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
3737
3816
  ...e,
3738
3817
  parts: e.parts.map((e) => {
@@ -3750,70 +3829,70 @@ function Jr(e) {
3750
3829
  url: A.value.appendAuthToken(t.url)
3751
3830
  };
3752
3831
  })
3753
- });
3754
- return E.value ? e(N.value.messages) : !Ae.value && N.value.messages?.[0]?.role !== "assistant" ? [et.value, ...e(N.value.messages)] : e(N.value.messages);
3755
- }), nt = x(() => {
3832
+ }), t = P.value.id === D.value ? P.value.messages : [];
3833
+ return E.value ? e(t) : !Me.value && t[0]?.role !== "assistant" ? [rt.value, ...e(t)] : e(t);
3834
+ }), at = x(() => {
3756
3835
  let e = u.value?.messagePlaceholder;
3757
3836
  return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
3758
- }), P = C([]), rt = C(!1), F = C([]), I = C(!1), it = C("chat"), R = C([]), at = C(), ot = C(!1), st = C(!1), ct = C(), lt = C(!1), z = C(!1), ut = C(), B = C(""), V = C([]), H = C(""), dt = C(0);
3759
- async function ft(e) {
3760
- if (E.value) P.value = [];
3837
+ }), F = S([]), I = S(!1), R = S([]), ot = S(!1), st = S("chat"), z = S([]), ct = S(), lt = S(!1), ut = S(!1), B = S(), dt = S(!1), ft = S(!1), pt = S(), V = S(""), H = S([]), U = S(""), mt = S(0);
3838
+ async function ht(e) {
3839
+ if (E.value) F.value = [];
3761
3840
  else {
3762
- rt.value = !0;
3841
+ I.value = !0;
3763
3842
  try {
3764
- P.value = await A.value.getConversations(e, l.value);
3843
+ F.value = await A.value.getConversations(e, l.value);
3765
3844
  } catch {
3766
- P.value = [];
3845
+ F.value = [];
3767
3846
  } finally {
3768
- rt.value = !1;
3847
+ I.value = !1;
3769
3848
  }
3770
3849
  }
3771
3850
  }
3772
- async function pt() {
3851
+ async function gt() {
3773
3852
  let e = D.value;
3774
- if (!e) F.value = [];
3853
+ if (!e) R.value = [];
3775
3854
  else {
3776
- I.value = !0;
3855
+ ot.value = !0;
3777
3856
  try {
3778
- F.value = await A.value.getChatFiles(e);
3857
+ R.value = await A.value.getChatFiles(e);
3779
3858
  } catch {
3780
- F.value = [];
3859
+ R.value = [];
3781
3860
  } finally {
3782
- I.value = !1;
3861
+ ot.value = !1;
3783
3862
  }
3784
3863
  }
3785
3864
  }
3786
- function mt(e, t = !1) {
3865
+ function _t(e, t = !1) {
3787
3866
  return A.value.getChatFileDownloadUrl(e, t);
3788
3867
  }
3789
- function ht(e) {
3868
+ function vt(e) {
3790
3869
  return A.value.getChatFilePreviewUrl(e);
3791
3870
  }
3792
- async function gt(e) {
3871
+ async function yt(e) {
3793
3872
  await A.value.deleteChatFile(e);
3794
- let t = F.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
3795
- F.value = F.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
3873
+ let t = R.value.find((t) => t.documentId === e), n = t?.kind === "spreadsheet" ? t.sourceAttachmentId ?? t.documentId : void 0;
3874
+ R.value = R.value.filter((t) => t.documentId !== e && (!n || t.documentId !== n && t.sourceAttachmentId !== n));
3796
3875
  }
3797
- async function _t(e, t) {
3876
+ async function bt(e, t) {
3798
3877
  if (!E.value) try {
3799
3878
  let n = await A.value.getChat(e, t);
3800
- if (t !== D.value || N.value.status !== "ready" || N.value.messages.length > 0) return;
3801
- n && (N.value.messages = n.messages, k.value = n.blocked ?? !1, vt(e, t));
3879
+ if (t !== D.value || P.value.status !== "ready" || P.value.messages.length > 0) return;
3880
+ n && (P.value.messages = n.messages, k.value = n.blocked ?? !1, xt(e, t));
3802
3881
  } catch {}
3803
3882
  }
3804
- async function vt(e, t) {
3883
+ async function xt(e, t) {
3805
3884
  let n;
3806
3885
  try {
3807
- n = Number(sessionStorage.getItem(we)), sessionStorage.removeItem(we);
3886
+ n = Number(sessionStorage.getItem(Ee)), sessionStorage.removeItem(Ee);
3808
3887
  } catch {
3809
3888
  return;
3810
3889
  }
3811
3890
  if (!(!n || Date.now() - n > 6e4 || O.value)) for (let n = 0; n < 12; n++) {
3812
- let n = N.value.messages[N.value.messages.length - 1];
3891
+ let n = P.value.messages[P.value.messages.length - 1];
3813
3892
  if (n?.role === "assistant") {
3814
3893
  let e = n.parts.filter((e) => ee(e) && e.state === "input-available"), t = e.filter((e) => e.toolMetadata?.provider === "page" && e.toolMetadata.readOnly === !0);
3815
3894
  if (e.length > 0) {
3816
- if (t.length === e.length && !O.value) for (let e of t) Ye.enqueue({
3895
+ if (t.length === e.length && !O.value) for (let e of t) Ze.enqueue({
3817
3896
  toolCallId: e.toolCallId,
3818
3897
  toolName: e.toolName,
3819
3898
  input: e.input,
@@ -3825,149 +3904,149 @@ function Jr(e) {
3825
3904
  }
3826
3905
  if (n.parts[n.parts.length - 1]?.type === "text") return;
3827
3906
  }
3828
- if (await new Promise((e) => setTimeout(e, 1500)), t !== D.value || N.value.status !== "ready") return;
3907
+ if (await new Promise((e) => setTimeout(e, 1500)), t !== D.value || P.value.status !== "ready") return;
3829
3908
  try {
3830
3909
  let n = await A.value.getChat(e, t);
3831
- n && t === D.value && (N.value.messages = n.messages);
3910
+ n && t === D.value && (P.value.messages = n.messages);
3832
3911
  } catch {
3833
3912
  return;
3834
3913
  }
3835
3914
  }
3836
3915
  }
3837
- let yt = () => {
3838
- let e = N.value.status;
3916
+ let St = () => {
3917
+ let e = P.value.status;
3839
3918
  return e === "submitted" || e === "streaming";
3840
- }, bt = 0, xt = 0;
3841
- async function St() {
3842
- if (E.value || yt()) return "indeterminate";
3843
- let e = D.value, t = bt += 1;
3919
+ }, Ct = 0, wt = 0;
3920
+ async function Tt() {
3921
+ if (E.value || St()) return "indeterminate";
3922
+ let e = D.value, t = Ct += 1;
3844
3923
  try {
3845
3924
  let n = await A.value.getChat(o.value, e);
3846
- if (!n || e !== D.value || yt() || t <= xt) return "indeterminate";
3847
- xt = t;
3848
- let r = n.messages, i = Gr(r, N.value.messages);
3849
- return N.value.messages = [...r, ...i], k.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
3925
+ if (!n || e !== D.value || St() || t <= wt) return "indeterminate";
3926
+ wt = t;
3927
+ let r = n.messages, i = Xr(r, P.value.messages);
3928
+ return P.value.messages = [...r, ...i], k.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
3850
3929
  } catch {}
3851
3930
  return "indeterminate";
3852
3931
  }
3853
- function Ct(e) {
3854
- N.value.messages = [...N.value.messages, e];
3932
+ function W(e) {
3933
+ P.value.messages = [...P.value.messages, e];
3855
3934
  }
3856
- async function wt(e) {
3935
+ async function Et(e) {
3857
3936
  try {
3858
- R.value = await A.value.getMessageFeedbacks(e);
3937
+ z.value = await A.value.getMessageFeedbacks(e);
3859
3938
  } catch {
3860
- R.value = [];
3939
+ z.value = [];
3861
3940
  }
3862
3941
  }
3863
- function U(e) {
3864
- let t = R.value.findIndex((t) => t.messageId === e.messageId);
3865
- t >= 0 ? R.value[t] = e : R.value.push(e);
3942
+ function Dt(e) {
3943
+ let t = z.value.findIndex((t) => t.messageId === e.messageId);
3944
+ t >= 0 ? z.value[t] = e : z.value.push(e);
3866
3945
  }
3867
- function Tt(e) {
3868
- let t = tt.value, n = t.findIndex((t) => t.id === e.id), r = ue(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
3946
+ function Ot(e) {
3947
+ let t = it.value, n = t.findIndex((t) => t.id === e.id), r = ue(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
3869
3948
  return {
3870
3949
  userQuestion: ue(i ?? e) ?? "",
3871
3950
  assistantMessage: r
3872
3951
  };
3873
3952
  }
3874
- async function Et(e, t) {
3953
+ async function kt(e, t) {
3875
3954
  await Promise.all([
3876
- _t(e, t),
3877
- ft(e),
3878
- wt(t)
3879
- ]), We.value || Ce((e, t) => A.value.reverseGeocode(e, t, r.value)).then((e) => {
3880
- e && (We.value = e);
3955
+ bt(e, t),
3956
+ ht(e),
3957
+ Et(t)
3958
+ ]), Ke.value || Te((e, t) => A.value.reverseGeocode(e, t, r.value)).then((e) => {
3959
+ e && (Ke.value = e);
3881
3960
  });
3882
3961
  }
3883
- async function Dt() {
3884
- let e = B.value.trim(), t = V.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
3962
+ async function G() {
3963
+ let e = V.value.trim(), t = H.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
3885
3964
  type: "file",
3886
3965
  mediaType: e.mediaSource.mimeType,
3887
3966
  url: e.localUrl,
3888
3967
  filename: e.mediaSource.name,
3889
3968
  providerMetadata: { "8bot": { media: e.mediaSource } }
3890
3969
  }));
3891
- E.value && tt.value.length > 0 && await Mt(), M(), H.value = e, dt.value = N.value.messages.length;
3892
- let n = N.value.sendMessage;
3970
+ E.value && it.value.length > 0 && await Ft(), M(), U.value = e, mt.value = P.value.messages.length;
3971
+ let n = P.value.sendMessage;
3893
3972
  n({
3894
3973
  text: e,
3895
3974
  files: t.length > 0 ? t : void 0
3896
- }), B.value = "", jt();
3975
+ }), V.value = "", Pt();
3897
3976
  }
3898
- function Ot(e) {
3977
+ function K(e) {
3899
3978
  let t = e.trim();
3900
3979
  if (!t) return;
3901
- if (N.value.status !== "ready") {
3980
+ if (P.value.status !== "ready") {
3902
3981
  ce.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
3903
3982
  return;
3904
3983
  }
3905
- let n = N.value.sendMessage;
3984
+ let n = P.value.sendMessage;
3906
3985
  M(), n({ text: t });
3907
3986
  }
3908
- async function W() {
3909
- let e = N.value.messages.slice(dt.value).some((e) => e.parts.some(ee)), t = H.value, n = t.length > 0 && !e;
3910
- M(), await N.value.stop(), n && (B.value = t, N.value.messages = N.value.messages.slice(0, dt.value), H.value = "");
3987
+ async function At() {
3988
+ let e = P.value.messages.slice(mt.value).some((e) => e.parts.some(ee)), t = U.value, n = t.length > 0 && !e;
3989
+ M(), await P.value.stop(), n && (V.value = t, P.value.messages = P.value.messages.slice(0, mt.value), U.value = "");
3911
3990
  }
3912
- w(() => N.value.messages, (e) => {
3991
+ w(() => P.value.messages, (e) => {
3913
3992
  let t = j.value?.toolCallId;
3914
3993
  t && !e.some((e) => e.parts.some((e) => e.toolCallId === t)) && M();
3915
- }), w(() => N.value.status, (e) => {
3916
- e === "submitted" && Te.value++;
3994
+ }), w(() => P.value.status, (e) => {
3995
+ e === "submitted" && De.value++;
3917
3996
  });
3918
- let G;
3919
- w(() => [N.value.status, pe.value], ([e, t]) => {
3920
- clearTimeout(G), e === "ready" && t === 0 && (G = setTimeout(() => {
3921
- xe.value = !1;
3997
+ let jt;
3998
+ w(() => [P.value.status, pe.value], ([e, t]) => {
3999
+ clearTimeout(jt), e === "ready" && t === 0 && (jt = setTimeout(() => {
4000
+ Ce.value = !1;
3922
4001
  }, 1500));
3923
4002
  });
3924
- let kt = C(!1), At;
3925
- w(() => !j.value && !Vr(N.value.lastMessage) && (yt() || pe.value > 0), (e) => {
3926
- clearTimeout(At), e ? kt.value = !0 : At = setTimeout(() => {
3927
- kt.value = !1;
4003
+ let Mt = S(!1), Nt;
4004
+ w(() => !j.value && !Kr(et()) && (St() || pe.value > 0), (e) => {
4005
+ clearTimeout(Nt), e ? Mt.value = !0 : Nt = setTimeout(() => {
4006
+ Mt.value = !1;
3928
4007
  }, 400);
3929
- }, { immediate: !0 }), w(() => N.value.status, (e) => {
3930
- e === "ready" && H.value.length > 0 && (H.value = "");
4008
+ }, { immediate: !0 }), w(() => P.value.status, (e) => {
4009
+ e === "ready" && U.value.length > 0 && (U.value = "");
3931
4010
  });
3932
- function jt(e = !1) {
3933
- for (let t of V.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
3934
- V.value = [], Vt.value = null;
4011
+ function Pt(e = !1) {
4012
+ for (let t of H.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
4013
+ H.value = [], Wt.value = null;
3935
4014
  }
3936
- async function Mt() {
3937
- return H.value = "", await W(), D.value = L(), N.value.clearError(), Be.value = void 0, k.value = !1, jt(!0), Qt("chat"), D.value;
4015
+ async function Ft() {
4016
+ return U.value = "", await At(), D.value = L(), await he(), P.value.clearError(), He.value = void 0, k.value = !1, Pt(!0), en("chat"), D.value;
3938
4017
  }
3939
- async function Nt(e) {
3940
- N.value.status !== "ready" && (H.value = "", await W()), M(), await N.value.regenerate(e);
4018
+ async function It(e) {
4019
+ P.value.status !== "ready" && (U.value = "", await At()), M(), await P.value.regenerate(e);
3941
4020
  }
3942
- function Pt(e) {
4021
+ function Lt(e) {
3943
4022
  if (e.tool === "requestGeolocation") {
3944
4023
  let t = e.output;
3945
- "latitude" in t && (We.value = {
4024
+ "latitude" in t && (Ke.value = {
3946
4025
  geolocationLatitude: t.latitude,
3947
4026
  geolocationLongitude: t.longitude,
3948
4027
  geolocationAccuracy: t.accuracy,
3949
4028
  geolocationCity: t.city
3950
4029
  });
3951
4030
  }
3952
- N.value.addToolOutput(e);
4031
+ P.value.addToolOutput(e);
3953
4032
  }
3954
- function Ft(e) {
3955
- N.value.addToolApprovalResponse(e);
4033
+ function Rt(e) {
4034
+ P.value.addToolApprovalResponse(e);
3956
4035
  }
3957
- let It = x(() => N.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Lt = x(() => _.value?.maxFilesPerMessage ?? 5), Rt = x(() => _.value?.maxFilesPerChat ?? 20), zt = x(() => Math.max(0, Math.min(Lt.value - V.value.length, Rt.value - It.value - V.value.length))), Bt = x(() => zt.value <= 0), Vt = C(null), Ht = () => {
3958
- Vt.value = null;
4036
+ let zt = x(() => P.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), Bt = x(() => _.value?.maxFilesPerMessage ?? 5), Vt = x(() => _.value?.maxFilesPerChat ?? 20), Ht = x(() => Math.max(0, Math.min(Bt.value - H.value.length, Vt.value - zt.value - H.value.length))), Ut = x(() => Ht.value <= 0), Wt = S(null), Gt = () => {
4037
+ Wt.value = null;
3959
4038
  };
3960
- w(Bt, (e) => {
3961
- e || (Vt.value = null);
4039
+ w(Ut, (e) => {
4040
+ e || (Wt.value = null);
3962
4041
  });
3963
- async function Ut(e) {
3964
- if (Bt.value) {
3965
- Vt.value = Rt.value - It.value - V.value.length <= Lt.value - V.value.length ? {
4042
+ async function Kt(e) {
4043
+ if (Ut.value) {
4044
+ Wt.value = Vt.value - zt.value - H.value.length <= Bt.value - H.value.length ? {
3966
4045
  reason: "per-chat",
3967
- max: Rt.value
4046
+ max: Vt.value
3968
4047
  } : {
3969
4048
  reason: "per-message",
3970
- max: Lt.value
4049
+ max: Bt.value
3971
4050
  };
3972
4051
  return;
3973
4052
  }
@@ -3977,26 +4056,26 @@ function Jr(e) {
3977
4056
  localUrl: URL.createObjectURL(e),
3978
4057
  state: "uploading"
3979
4058
  };
3980
- V.value = [...V.value, n];
4059
+ H.value = [...H.value, n];
3981
4060
  try {
3982
4061
  let n = await A.value.uploadMedia(o.value, D.value, e);
3983
- V.value = V.value.map((e) => e.id === t ? {
4062
+ H.value = H.value.map((e) => e.id === t ? {
3984
4063
  ...e,
3985
4064
  state: "done",
3986
4065
  mediaSource: n
3987
4066
  } : e);
3988
4067
  } catch (e) {
3989
4068
  let n = e instanceof Error ? e.message : "Upload failed";
3990
- V.value = V.value.map((e) => e.id === t ? {
4069
+ H.value = H.value.map((e) => e.id === t ? {
3991
4070
  ...e,
3992
4071
  state: "error",
3993
4072
  error: n
3994
4073
  } : e);
3995
4074
  }
3996
4075
  }
3997
- async function Wt(e, t) {
3998
- let { userQuestion: n, assistantMessage: r } = Tt(e);
3999
- U(await A.value.submitMessageFeedback({
4076
+ async function qt(e, t) {
4077
+ let { userQuestion: n, assistantMessage: r } = Ot(e);
4078
+ Dt(await A.value.submitMessageFeedback({
4000
4079
  messageId: e.id,
4001
4080
  chatId: D.value,
4002
4081
  agentId: o.value,
@@ -4005,70 +4084,70 @@ function Jr(e) {
4005
4084
  assistantMessage: r
4006
4085
  }));
4007
4086
  }
4008
- async function Gt(e) {
4009
- await Wt(e, "upvote");
4087
+ async function Jt(e) {
4088
+ await qt(e, "upvote");
4010
4089
  }
4011
- async function Kt(e) {
4012
- await Wt(e, "downvote");
4090
+ async function Yt(e) {
4091
+ await qt(e, "downvote");
4013
4092
  }
4014
- function qt(e) {
4015
- st.value = !1, ct.value = void 0, at.value = e;
4093
+ function Xt(e) {
4094
+ ut.value = !1, B.value = void 0, ct.value = e;
4016
4095
  }
4017
- async function Jt(e) {
4018
- if (at.value) try {
4019
- ot.value = !0, st.value = !1, ct.value = void 0;
4020
- let { userQuestion: t, assistantMessage: n } = Tt(at.value);
4021
- U(await A.value.submitMessageFeedback({
4022
- messageId: at.value.id,
4096
+ async function Zt(e) {
4097
+ if (ct.value) try {
4098
+ lt.value = !0, ut.value = !1, B.value = void 0;
4099
+ let { userQuestion: t, assistantMessage: n } = Ot(ct.value);
4100
+ Dt(await A.value.submitMessageFeedback({
4101
+ messageId: ct.value.id,
4023
4102
  chatId: D.value,
4024
4103
  agentId: o.value,
4025
4104
  userQuestion: t,
4026
4105
  assistantMessage: n,
4027
4106
  comment: e
4028
- })), st.value = !0, await wt(D.value);
4107
+ })), ut.value = !0, await Et(D.value);
4029
4108
  } catch {
4030
- ct.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4109
+ B.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
4031
4110
  } finally {
4032
- ot.value = !1;
4111
+ lt.value = !1;
4033
4112
  }
4034
4113
  }
4035
- async function Yt(e) {
4114
+ async function Qt(e) {
4036
4115
  try {
4037
- z.value = !0, lt.value = !1, ut.value = void 0, await A.value.submitLead({
4116
+ ft.value = !0, dt.value = !1, pt.value = void 0, await A.value.submitLead({
4038
4117
  agentId: o.value,
4039
4118
  chatId: D.value,
4040
4119
  ...e
4041
- }), lt.value = !0;
4120
+ }), dt.value = !0;
4042
4121
  } catch {
4043
- ut.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4122
+ pt.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
4044
4123
  } finally {
4045
- z.value = !1;
4124
+ ft.value = !1;
4046
4125
  }
4047
4126
  }
4048
- async function Xt(e, t) {
4127
+ async function $t(e, t) {
4049
4128
  let n = await A.value.updateChatTitle(o.value, e, t);
4050
- P.value = P.value.map((t) => t.id === e ? {
4129
+ F.value = F.value.map((t) => t.id === e ? {
4051
4130
  ...t,
4052
4131
  title: n.title
4053
4132
  } : t);
4054
4133
  }
4055
- async function Zt(e) {
4056
- await A.value.deleteChat(o.value, e), P.value = P.value.filter((t) => t.id !== e), D.value === e && await Mt();
4134
+ async function q(e) {
4135
+ await A.value.deleteChat(o.value, e), F.value = F.value.filter((t) => t.id !== e), D.value === e && await Ft();
4057
4136
  }
4058
- function Qt(e) {
4059
- it.value = e;
4137
+ function en(e) {
4138
+ st.value = e;
4060
4139
  }
4061
- let K;
4062
- function $t(e) {
4140
+ let tn;
4141
+ function nn(e) {
4063
4142
  let t = () => A.value.getChat(o.value, e).then((e) => e !== null);
4064
4143
  return t().catch(() => t().catch(() => !1));
4065
4144
  }
4066
4145
  return w(l, async (e) => {
4067
- if (!e || e === K) return;
4068
- let t = K;
4069
- if (K = e, t === void 0) return;
4070
- let n = D.value, r = !E.value && await $t(n);
4071
- l.value === e && D.value === n && (r ? ft(o.value) : (P.value = [], R.value = [], F.value = [], await Mt(), B.value = ""));
4146
+ if (!e || e === tn) return;
4147
+ let t = tn;
4148
+ if (tn = e, t === void 0) return;
4149
+ let n = D.value, r = !E.value && await nn(n);
4150
+ l.value === e && D.value === n && (r ? ht(o.value) : (F.value = [], z.value = [], R.value = [], await Ft(), V.value = ""));
4072
4151
  }), {
4073
4152
  apiClient: A,
4074
4153
  baseUrl: i,
@@ -4084,7 +4163,7 @@ function Jr(e) {
4084
4163
  revisedAnswers: m,
4085
4164
  model: h,
4086
4165
  actionsInput: g,
4087
- actions: Me,
4166
+ actions: Pe,
4088
4167
  agentFileUpload: _,
4089
4168
  agentVoice: v,
4090
4169
  fallbackModels: y,
@@ -4093,77 +4172,77 @@ function Jr(e) {
4093
4172
  agentHostTools: ie,
4094
4173
  hostToolRegistry: oe,
4095
4174
  hostToolsPending: pe,
4096
- agentPageAccess: S,
4097
- pageToolRegistry: me,
4098
- pageFormsProvider: he,
4099
- pageAction: _e,
4100
- pageControlActive: xe,
4101
- isWorking: kt,
4102
- stopHostActions: Xe,
4103
- pageNoticeLevel: Re,
4104
- closePageNotice: ze,
4175
+ agentPageAccess: me,
4176
+ pageToolRegistry: ge,
4177
+ pageFormsProvider: ve,
4178
+ pageAction: ye,
4179
+ pageControlActive: Ce,
4180
+ isWorking: Mt,
4181
+ stopHostActions: Qe,
4182
+ pageNoticeLevel: Be,
4183
+ closePageNotice: Ve,
4105
4184
  hostConfirmation: j,
4106
- respondHostConfirmation: Je,
4107
- pageAccessAvailable: Ie,
4185
+ respondHostConfirmation: Xe,
4186
+ pageAccessAvailable: Re,
4108
4187
  pageAccessOff: O,
4109
- setPageAccessOff: Ze,
4110
- systemTheme: ke,
4111
- hideWelcomeMessage: Ae,
4112
- isDark: je,
4113
- chat: N,
4114
- messages: tt,
4115
- conversations: P,
4116
- isLoadingConversations: rt,
4117
- chatFiles: F,
4118
- isLoadingChatFiles: I,
4119
- input: B,
4120
- pendingAttachments: V,
4121
- isAttachmentLimitReached: Bt,
4122
- fileLimitError: Vt,
4188
+ setPageAccessOff: $e,
4189
+ systemTheme: je,
4190
+ hideWelcomeMessage: Me,
4191
+ isDark: Ne,
4192
+ chat: P,
4193
+ messages: it,
4194
+ conversations: F,
4195
+ isLoadingConversations: I,
4196
+ chatFiles: R,
4197
+ isLoadingChatFiles: ot,
4198
+ input: V,
4199
+ pendingAttachments: H,
4200
+ isAttachmentLimitReached: Ut,
4201
+ fileLimitError: Wt,
4123
4202
  localChatId: D,
4124
4203
  isConversationBlocked: k,
4125
- inputMessagePlaceholder: nt,
4126
- chatError: Be,
4127
- activeView: it,
4128
- messageFeedbacks: R,
4129
- feedbackDialogMessage: at,
4130
- isFeedbackSubmitting: ot,
4131
- isFeedbackSubmitted: st,
4132
- feedbackSubmitError: ct,
4133
- isLeadSubmitted: lt,
4134
- isLoadingSubmitLead: z,
4135
- submitLeadError: ut,
4136
- buildDeviceContext: Ge,
4137
- initialize: Et,
4138
- loadConversations: ft,
4139
- loadChatFiles: pt,
4140
- refreshMessages: St,
4141
- appendMessage: Ct,
4142
- getChatFileUrl: mt,
4143
- getChatFilePreviewUrl: ht,
4144
- deleteChatFile: gt,
4145
- handleSubmit: Dt,
4146
- sendMessage: Ot,
4147
- stopGeneration: W,
4148
- startNewChat: Mt,
4149
- regenerate: Nt,
4150
- addToolOutput: Pt,
4151
- addToolApprovalResponse: Ft,
4152
- handleFileSelect: Ut,
4153
- clearFileLimitError: Ht,
4154
- clearPendingAttachments: jt,
4155
- onUpvote: Gt,
4156
- onDownvote: Kt,
4157
- onFeedback: qt,
4158
- onFeedbackSubmit: Jt,
4159
- onLeadSubmit: Yt,
4160
- navigate: Qt,
4161
- renameChatTitle: Xt,
4162
- deleteChat: Zt
4204
+ inputMessagePlaceholder: at,
4205
+ chatError: He,
4206
+ activeView: st,
4207
+ messageFeedbacks: z,
4208
+ feedbackDialogMessage: ct,
4209
+ isFeedbackSubmitting: lt,
4210
+ isFeedbackSubmitted: ut,
4211
+ feedbackSubmitError: B,
4212
+ isLeadSubmitted: dt,
4213
+ isLoadingSubmitLead: ft,
4214
+ submitLeadError: pt,
4215
+ buildDeviceContext: qe,
4216
+ initialize: kt,
4217
+ loadConversations: ht,
4218
+ loadChatFiles: gt,
4219
+ refreshMessages: Tt,
4220
+ appendMessage: W,
4221
+ getChatFileUrl: _t,
4222
+ getChatFilePreviewUrl: vt,
4223
+ deleteChatFile: yt,
4224
+ handleSubmit: G,
4225
+ sendMessage: K,
4226
+ stopGeneration: At,
4227
+ startNewChat: Ft,
4228
+ regenerate: It,
4229
+ addToolOutput: Lt,
4230
+ addToolApprovalResponse: Rt,
4231
+ handleFileSelect: Kt,
4232
+ clearFileLimitError: Gt,
4233
+ clearPendingAttachments: Pt,
4234
+ onUpvote: Jt,
4235
+ onDownvote: Yt,
4236
+ onFeedback: Xt,
4237
+ onFeedbackSubmit: Zt,
4238
+ onLeadSubmit: Qt,
4239
+ navigate: en,
4240
+ renameChatTitle: $t,
4241
+ deleteChat: q
4163
4242
  };
4164
4243
  })();
4165
4244
  }
4166
4245
  //#endregion
4167
- export { L as a, pr as i, Jr as n, zr as r, Br as t };
4246
+ export { L as a, mr as i, $r as n, Wr as r, Gr as t };
4168
4247
 
4169
- //# sourceMappingURL=useChatbotStore-CBjfSN69.js.map
4248
+ //# sourceMappingURL=useChatbotStore-CnCoo6j3.js.map