@8wave/ai-elements 0.112.0-beta.5 → 0.112.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{Agent-tE7ZJPxG.js → Agent-DTLrWpzX.js} +138 -135
- package/dist/_chunks/Agent-DTLrWpzX.js.map +1 -0
- package/dist/_chunks/Media-Cft7Pwrh.js.map +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-CNI8aV8t.js → PkStreamingMarkdown-CRlRDGYl.js} +3 -3
- package/dist/_chunks/PkStreamingMarkdown-CRlRDGYl.js.map +1 -0
- package/dist/_chunks/{PkToolRequestGeolocation-65jeiJs8.js → PkToolRequestGeolocation-BbxYKt-9.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-65jeiJs8.js.map → PkToolRequestGeolocation-BbxYKt-9.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-bHpDAtzu.js → PkToolRequestOAuthConnection-CTp2w60F.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-bHpDAtzu.js.map → PkToolRequestOAuthConnection-CTp2w60F.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-6f-Kx9AS.js → PkToolShowArtifact-CNnt82aH.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-6f-Kx9AS.js.map → PkToolShowArtifact-CNnt82aH.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-BewhenPx.js → PkToolShowContactForm-D77gyjQG.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-BewhenPx.js.map → PkToolShowContactForm-D77gyjQG.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-KuTsIy5P.js → PkToolShowForm-DP4LLAk3.js} +3 -3
- package/dist/_chunks/{PkToolShowForm-KuTsIy5P.js.map → PkToolShowForm-DP4LLAk3.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-CY_q7ANb.js → PkToolShowSources-Bwy0Ptmi.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-CY_q7ANb.js.map → PkToolShowSources-Bwy0Ptmi.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-D98Atidw.js → PkToolShowSuggestedReply-CFO8wV1b.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-D98Atidw.js.map → PkToolShowSuggestedReply-CFO8wV1b.js.map} +1 -1
- package/dist/_chunks/markdown-BRD-hDrH.js.map +1 -1
- package/dist/ai-elements.es.js +1023 -949
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotError.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{Agent-De2gFNjR.js → Agent-BNlmK-uJ.js} +96 -87
- package/dist-vue/_chunks/Agent-BNlmK-uJ.js.map +1 -0
- package/dist-vue/_chunks/{Document-9SUVPzht.js → Document-B6RpxFr9.js} +70 -70
- package/dist-vue/_chunks/Document-B6RpxFr9.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbot-BBR2t9R9.js → PkChatbot-CI9ucJ2M.js} +8 -8
- package/dist-vue/_chunks/{PkChatbot-BBR2t9R9.js.map → PkChatbot-CI9ucJ2M.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-BtzBYOHJ.js → PkChatbotEmptyState-CacY4o02.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-BtzBYOHJ.js.map → PkChatbotEmptyState-CacY4o02.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotError-CuX9C_b9.js +89 -0
- package/dist-vue/_chunks/PkChatbotError-CuX9C_b9.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotInput-MSpF6SB6.js → PkChatbotInput-Dkz3SNAk.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-MSpF6SB6.js.map → PkChatbotInput-Dkz3SNAk.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-9NluDSgJ.js → PkChatbotMessages-BsT48S-h.js} +181 -181
- package/dist-vue/_chunks/{PkChatbotMessages-9NluDSgJ.js.map → PkChatbotMessages-BsT48S-h.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-XW4gT9AZ.js → PkChatbotStepPayload-DU0W-eUp.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-XW4gT9AZ.js.map → PkChatbotStepPayload-DU0W-eUp.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-C4-K6Glw.js → PkChatbotStepToolDetail-etlBryOg.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-C4-K6Glw.js.map → PkChatbotStepToolDetail-etlBryOg.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-CrqjWpv0.js → PkChatbotSteps-jW07Q-4x.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-CrqjWpv0.js.map → PkChatbotSteps-jW07Q-4x.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-C0fxsO-G.js → PkChatbotViewChat-jEBBPmSo.js} +7 -7
- package/dist-vue/_chunks/{PkChatbotViewChat-C0fxsO-G.js.map → PkChatbotViewChat-jEBBPmSo.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-DRKaeLbv.js → PkChatbotViewConversations-CWSrP36z.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-DRKaeLbv.js.map → PkChatbotViewConversations-CWSrP36z.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-DPpZHHvK.js → PkChatbotViewFiles-DzLp1WfU.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-DPpZHHvK.js.map → PkChatbotViewFiles-DzLp1WfU.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-D2XZ8Czi.js → PkChatbotViewProfile-CHbn3W6F.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-D2XZ8Czi.js.map → PkChatbotViewProfile-CHbn3W6F.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-D0IOaETI.js → PkStreamingMarkdown-BoEpwaYQ.js} +2 -2
- package/dist-vue/_chunks/{PkStreamingMarkdown-D0IOaETI.js.map → PkStreamingMarkdown-BoEpwaYQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-Q3N3jlO8.js → PkToolRequestGeolocation-9vfYNaQo.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestGeolocation-Q3N3jlO8.js.map → PkToolRequestGeolocation-9vfYNaQo.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-lYoTJIF_.js → PkToolRequestOAuthConnection-BorR5NmZ.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-lYoTJIF_.js.map → PkToolRequestOAuthConnection-BorR5NmZ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-DHdJuzDi.js → PkToolShowArtifact-BnwU7CV2.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-DHdJuzDi.js.map → PkToolShowArtifact-BnwU7CV2.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-CotIwNhi.js → PkToolShowContactForm-_x_dbiHn.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-CotIwNhi.js.map → PkToolShowContactForm-_x_dbiHn.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-CVHYhfwH.js → PkToolShowDiagram-CjJcLvWs.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-CVHYhfwH.js.map → PkToolShowDiagram-CjJcLvWs.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowEmail-DF__nKpR.js → PkToolShowEmail-CRQjoJr1.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowEmail-DF__nKpR.js.map → PkToolShowEmail-CRQjoJr1.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-Dx10jOXm.js → PkToolShowForm-IPAkJIXh.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowForm-Dx10jOXm.js.map → PkToolShowForm-IPAkJIXh.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowMessage-Ck6VP-gw.js → PkToolShowMessage-joTzAg9N.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowMessage-Ck6VP-gw.js.map → PkToolShowMessage-joTzAg9N.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-zfM8cx-l.js → PkToolShowProductList-tOYjd2bq.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-zfM8cx-l.js.map → PkToolShowProductList-tOYjd2bq.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-Qq3c8_ZQ.js → PkToolShowSources-Cc26LzRd.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowSources-Qq3c8_ZQ.js.map → PkToolShowSources-Cc26LzRd.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DWLkUh2L.js → PkToolShowSuggestedReply-DA4NEjHB.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DWLkUh2L.js.map → PkToolShowSuggestedReply-DA4NEjHB.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-CosBYLrE.js → PkToolShowWebPages-D3Xy4iUs.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-CosBYLrE.js.map → PkToolShowWebPages-D3Xy4iUs.js.map} +1 -1
- package/dist-vue/_chunks/{PkUrl-B5CNTQj9.js → PkUrl-BgMBemSz.js} +2 -2
- package/dist-vue/_chunks/{PkUrl-B5CNTQj9.js.map → PkUrl-BgMBemSz.js.map} +1 -1
- package/dist-vue/_chunks/StreamError-D1AtGgS3.js +22 -0
- package/dist-vue/_chunks/StreamError-D1AtGgS3.js.map +1 -0
- package/dist-vue/_chunks/{createChatbotApiClient-MkaPbGWB.js → createChatbotApiClient-CaVLm5W9.js} +162 -126
- package/dist-vue/_chunks/createChatbotApiClient-CaVLm5W9.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-BowmAdfD.js → useChatbotStore-CMS2zFht.js} +861 -889
- package/dist-vue/_chunks/useChatbotStore-CMS2zFht.js.map +1 -0
- package/dist-vue/_chunks/{utils-C1666_6C.js → utils-h4C7rRcu.js} +3 -3
- package/dist-vue/_chunks/{utils-C1666_6C.js.map → utils-h4C7rRcu.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +3 -3
- package/dist-vue/index.js +3546 -3426
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +42 -0
- package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +6 -3
- package/dist-vue/packages/components/src/chat/PkMessageParts.d.ts +6 -6
- package/dist-vue/packages/components/src/chat/PkToolSelection.d.ts +8 -0
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +139 -1
- package/dist-vue/packages/models/src/schema/Agent.d.ts +38 -0
- package/dist-vue/packages/models/src/schema/Chat.d.ts +120 -0
- package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +7 -1
- package/dist-vue/packages/models/src/schema/StreamError.d.ts +13 -0
- package/dist-vue/packages/models/src/schema/SubAgent.d.ts +7 -1
- package/dist-vue/packages/models/src/schema/constants.d.ts +10 -1
- package/dist-vue/packages/models/src/utils.d.ts +17 -0
- package/dist-vue/style.css +1 -1
- package/package.json +2 -2
- package/dist/_chunks/Agent-tE7ZJPxG.js.map +0 -1
- package/dist/_chunks/PkStreamingMarkdown-CNI8aV8t.js.map +0 -1
- package/dist-vue/_chunks/Agent-De2gFNjR.js.map +0 -1
- package/dist-vue/_chunks/Document-9SUVPzht.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotError-gvDpRcEz.js +0 -106
- package/dist-vue/_chunks/PkChatbotError-gvDpRcEz.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-MkaPbGWB.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-BowmAdfD.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { E as e, S as t, T as n, _ as r, a as i, b as a, c as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, x as _, y as v } from "./schemas-DxbHVg3r.js";
|
|
2
|
-
import {
|
|
3
|
-
import { r as
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as
|
|
6
|
-
import { t as
|
|
7
|
-
import { computed as
|
|
8
|
-
import { useI18n as
|
|
9
|
-
import { usePreferredDark as
|
|
10
|
-
import { defineStore as
|
|
2
|
+
import { O as ee } from "./Agent-BNlmK-uJ.js";
|
|
3
|
+
import { r as te, t as ne } from "./createChatbotApiClient-CaVLm5W9.js";
|
|
4
|
+
import { t as re } from "./src-DT8FLE4_.js";
|
|
5
|
+
import { n as ie } from "./message-RohfrdWS.js";
|
|
6
|
+
import { t as ae } from "./useSafeLocalStorage-Ce3S1Ayn.js";
|
|
7
|
+
import { computed as y, getCurrentScope as oe, isReadonly as se, onScopeDispose as ce, reactive as le, ref as b, toRefs as ue, watch as de, watchEffect as fe } from "vue";
|
|
8
|
+
import { useI18n as pe } from "vue-i18n";
|
|
9
|
+
import { usePreferredDark as me } from "@vueuse/core";
|
|
10
|
+
import { defineStore as x } from "pinia";
|
|
11
11
|
//#region ../../packages/utils/src/device-context.ts
|
|
12
|
-
function
|
|
12
|
+
function he() {
|
|
13
13
|
let e = navigator.connection, t = navigator.userAgentData;
|
|
14
14
|
return {
|
|
15
15
|
dateTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -39,7 +39,7 @@ function me() {
|
|
|
39
39
|
historyLength: window.history.length
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
async function
|
|
42
|
+
async function ge(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;
|
|
@@ -57,67 +57,67 @@ async function he(e) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
|
60
|
-
//#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.
|
|
61
|
-
var
|
|
60
|
+
//#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.19/node_modules/@ai-sdk/provider/dist/index.js
|
|
61
|
+
var _e = "vercel.ai.error", ve = Symbol.for(_e), S, C, w = class e extends (C = Error, S = ve, C) {
|
|
62
62
|
constructor({ name: e, message: t, cause: n }) {
|
|
63
|
-
super(t), this[
|
|
63
|
+
super(t), this[S] = !0, this.name = e, this.cause = n;
|
|
64
64
|
}
|
|
65
65
|
static isInstance(t) {
|
|
66
|
-
return e.hasMarker(t,
|
|
66
|
+
return e.hasMarker(t, _e);
|
|
67
67
|
}
|
|
68
68
|
static hasMarker(e, t) {
|
|
69
69
|
let n = Symbol.for(t);
|
|
70
70
|
return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
|
|
71
71
|
}
|
|
72
|
-
},
|
|
72
|
+
}, ye = "AI_APICallError", be = `vercel.ai.error.${ye}`, xe = Symbol.for(be), T, Se, Ce = class extends (Se = w, T = xe, Se) {
|
|
73
73
|
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 }) {
|
|
74
74
|
super({
|
|
75
|
-
name:
|
|
75
|
+
name: ye,
|
|
76
76
|
message: e,
|
|
77
77
|
cause: o
|
|
78
|
-
}), this[
|
|
78
|
+
}), this[T] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
|
|
79
79
|
}
|
|
80
80
|
static isInstance(e) {
|
|
81
|
-
return
|
|
81
|
+
return w.hasMarker(e, be);
|
|
82
82
|
}
|
|
83
|
-
},
|
|
83
|
+
}, E = "AI_EmptyResponseBodyError", we = `vercel.ai.error.${E}`, Te = Symbol.for(we), Ee, De, Oe = class extends (De = w, Ee = Te, De) {
|
|
84
84
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
85
85
|
super({
|
|
86
|
-
name:
|
|
86
|
+
name: E,
|
|
87
87
|
message: e
|
|
88
|
-
}), this[
|
|
88
|
+
}), this[Ee] = !0;
|
|
89
89
|
}
|
|
90
90
|
static isInstance(e) {
|
|
91
|
-
return
|
|
91
|
+
return w.hasMarker(e, we);
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
|
-
function
|
|
94
|
+
function D(e) {
|
|
95
95
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
96
96
|
}
|
|
97
|
-
var
|
|
97
|
+
var ke = "AI_InvalidArgumentError", O = `vercel.ai.error.${ke}`, Ae = Symbol.for(O), je, k, Me = class extends (k = w, je = Ae, k) {
|
|
98
98
|
constructor({ message: e, cause: t, argument: n }) {
|
|
99
99
|
super({
|
|
100
|
-
name:
|
|
100
|
+
name: ke,
|
|
101
101
|
message: e,
|
|
102
102
|
cause: t
|
|
103
|
-
}), this[
|
|
103
|
+
}), this[je] = !0, this.argument = n;
|
|
104
104
|
}
|
|
105
105
|
static isInstance(e) {
|
|
106
|
-
return
|
|
106
|
+
return w.hasMarker(e, O);
|
|
107
107
|
}
|
|
108
|
-
},
|
|
108
|
+
}, Ne = "AI_JSONParseError", Pe = `vercel.ai.error.${Ne}`, Fe = Symbol.for(Pe), Ie, Le, Re = class extends (Le = w, Ie = Fe, Le) {
|
|
109
109
|
constructor({ text: e, cause: t }) {
|
|
110
110
|
super({
|
|
111
|
-
name:
|
|
111
|
+
name: Ne,
|
|
112
112
|
message: `JSON parsing failed: Text: ${e}.
|
|
113
|
-
Error message: ${
|
|
113
|
+
Error message: ${D(t)}`,
|
|
114
114
|
cause: t
|
|
115
|
-
}), this[
|
|
115
|
+
}), this[Ie] = !0, this.text = e;
|
|
116
116
|
}
|
|
117
117
|
static isInstance(e) {
|
|
118
|
-
return
|
|
118
|
+
return w.hasMarker(e, Pe);
|
|
119
119
|
}
|
|
120
|
-
},
|
|
120
|
+
}, A = "AI_TypeValidationError", j = `vercel.ai.error.${A}`, M = Symbol.for(j), ze, Be, N = class e extends (Be = w, ze = M, Be) {
|
|
121
121
|
constructor({ value: e, cause: t, context: n }) {
|
|
122
122
|
let r = "Type validation failed";
|
|
123
123
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -126,14 +126,14 @@ Error message: ${O(t)}`,
|
|
|
126
126
|
n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
|
|
127
127
|
}
|
|
128
128
|
super({
|
|
129
|
-
name:
|
|
129
|
+
name: A,
|
|
130
130
|
message: `${r}: Value: ${JSON.stringify(e)}.
|
|
131
|
-
Error message: ${
|
|
131
|
+
Error message: ${D(t)}`,
|
|
132
132
|
cause: t
|
|
133
|
-
}), this[
|
|
133
|
+
}), this[ze] = !0, this.value = e, this.context = n;
|
|
134
134
|
}
|
|
135
135
|
static isInstance(e) {
|
|
136
|
-
return
|
|
136
|
+
return w.hasMarker(e, j);
|
|
137
137
|
}
|
|
138
138
|
static wrap({ value: t, cause: n, context: r }) {
|
|
139
139
|
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({
|
|
@@ -142,25 +142,25 @@ Error message: ${O(t)}`,
|
|
|
142
142
|
context: r
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
-
},
|
|
145
|
+
}, Ve = "AI_UnsupportedFunctionalityError", He = `vercel.ai.error.${Ve}`, Ue = Symbol.for(He), We, Ge, Ke = class extends (Ge = w, We = Ue, Ge) {
|
|
146
146
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
147
147
|
super({
|
|
148
|
-
name:
|
|
148
|
+
name: Ve,
|
|
149
149
|
message: t
|
|
150
|
-
}), this[
|
|
150
|
+
}), this[We] = !0, this.functionality = e;
|
|
151
151
|
}
|
|
152
152
|
static isInstance(e) {
|
|
153
|
-
return
|
|
153
|
+
return w.hasMarker(e, He);
|
|
154
154
|
}
|
|
155
|
-
},
|
|
155
|
+
}, qe = class extends Error {
|
|
156
156
|
constructor(e, t) {
|
|
157
157
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
158
158
|
}
|
|
159
|
-
},
|
|
160
|
-
function
|
|
161
|
-
function
|
|
159
|
+
}, Je = 10, Ye = 13, P = 32;
|
|
160
|
+
function Xe(e) {}
|
|
161
|
+
function Ze(e) {
|
|
162
162
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
163
|
-
let { onEvent: t =
|
|
163
|
+
let { onEvent: t = Xe, onError: n = Xe, onRetry: r = Xe, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
|
|
164
164
|
function m(e) {
|
|
165
165
|
if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
166
166
|
if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
|
|
@@ -179,7 +179,7 @@ function Xe(e) {
|
|
|
179
179
|
n !== "" && (o.push(n), s = n.length), h();
|
|
180
180
|
}
|
|
181
181
|
function h() {
|
|
182
|
-
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
|
|
182
|
+
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" }))));
|
|
183
183
|
}
|
|
184
184
|
function g(e) {
|
|
185
185
|
let n = 0;
|
|
@@ -195,9 +195,9 @@ function Xe(e) {
|
|
|
195
195
|
continue;
|
|
196
196
|
}
|
|
197
197
|
let i = e.charCodeAt(n);
|
|
198
|
-
if (
|
|
199
|
-
let i = e.charCodeAt(n + 5) ===
|
|
200
|
-
if (d === 0 && e.charCodeAt(r + 1) ===
|
|
198
|
+
if (Qe(e, n, i)) {
|
|
199
|
+
let i = e.charCodeAt(n + 5) === P ? n + 6 : n + 5, a = e.slice(i, r);
|
|
200
|
+
if (d === 0 && e.charCodeAt(r + 1) === Je) {
|
|
201
201
|
t({
|
|
202
202
|
id: l,
|
|
203
203
|
event: f,
|
|
@@ -207,7 +207,7 @@ function Xe(e) {
|
|
|
207
207
|
}
|
|
208
208
|
u = d === 0 ? a : `${u}
|
|
209
209
|
${a}`, d++;
|
|
210
|
-
} else
|
|
210
|
+
} else $e(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === P ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
|
|
211
211
|
n = r + 1, r = e.indexOf("\n", n);
|
|
212
212
|
}
|
|
213
213
|
return e.slice(n);
|
|
@@ -215,35 +215,35 @@ ${a}`, d++;
|
|
|
215
215
|
for (; n < e.length;) {
|
|
216
216
|
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
217
217
|
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;
|
|
218
|
-
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) ===
|
|
218
|
+
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) === Ye && e.charCodeAt(n) === Je && n++;
|
|
219
219
|
}
|
|
220
220
|
return e.slice(n);
|
|
221
221
|
}
|
|
222
222
|
function _(e, t, n) {
|
|
223
223
|
if (t === n) {
|
|
224
|
-
|
|
224
|
+
ee();
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
227
|
let r = e.charCodeAt(t);
|
|
228
|
-
if (
|
|
229
|
-
let r = e.charCodeAt(t + 5) ===
|
|
228
|
+
if (Qe(e, t, r)) {
|
|
229
|
+
let r = e.charCodeAt(t + 5) === P ? t + 6 : t + 5, i = e.slice(r, n);
|
|
230
230
|
u = d === 0 ? i : `${u}
|
|
231
231
|
${i}`, d++;
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
|
-
if (
|
|
235
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
234
|
+
if ($e(e, t, r)) {
|
|
235
|
+
f = e.slice(e.charCodeAt(t + 6) === P ? t + 7 : t + 6, n) || void 0;
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
238
|
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
239
|
-
let r = e.slice(e.charCodeAt(t + 3) ===
|
|
239
|
+
let r = e.slice(e.charCodeAt(t + 3) === P ? t + 4 : t + 3, n);
|
|
240
240
|
l = r.includes("\0") ? void 0 : r;
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
243
|
if (r === 58) {
|
|
244
244
|
if (i) {
|
|
245
245
|
let r = e.slice(t, n);
|
|
246
|
-
i(r.slice(e.charCodeAt(t + 1) ===
|
|
246
|
+
i(r.slice(e.charCodeAt(t + 1) === P ? 2 : 1));
|
|
247
247
|
}
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
@@ -252,7 +252,7 @@ ${i}`, d++;
|
|
|
252
252
|
v(a, "", a);
|
|
253
253
|
return;
|
|
254
254
|
}
|
|
255
|
-
let s = a.slice(0, o), c = a.charCodeAt(o + 1) ===
|
|
255
|
+
let s = a.slice(0, o), c = a.charCodeAt(o + 1) === P ? 2 : 1;
|
|
256
256
|
v(s, a.slice(o + c), a);
|
|
257
257
|
}
|
|
258
258
|
function v(e, t, i) {
|
|
@@ -268,13 +268,13 @@ ${t}`, d++;
|
|
|
268
268
|
l = t.includes("\0") ? void 0 : t;
|
|
269
269
|
break;
|
|
270
270
|
case "retry":
|
|
271
|
-
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new
|
|
271
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new qe(`Invalid \`retry\` value: "${t}"`, {
|
|
272
272
|
type: "invalid-retry",
|
|
273
273
|
value: t,
|
|
274
274
|
line: i
|
|
275
275
|
}));
|
|
276
276
|
break;
|
|
277
|
-
default: n(new
|
|
277
|
+
default: n(new qe(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
|
|
278
278
|
type: "unknown-field",
|
|
279
279
|
field: e,
|
|
280
280
|
value: t,
|
|
@@ -282,14 +282,14 @@ ${t}`, d++;
|
|
|
282
282
|
}));
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function ee() {
|
|
286
286
|
d > 0 && t({
|
|
287
287
|
id: l,
|
|
288
288
|
event: f,
|
|
289
289
|
data: u
|
|
290
290
|
}), l = void 0, u = "", d = 0, f = void 0;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function te(e = {}) {
|
|
293
293
|
if (e.consume && o.length > 0) {
|
|
294
294
|
let e = o.join("");
|
|
295
295
|
_(e, 0, e.length);
|
|
@@ -298,23 +298,23 @@ ${t}`, d++;
|
|
|
298
298
|
}
|
|
299
299
|
return {
|
|
300
300
|
feed: m,
|
|
301
|
-
reset:
|
|
301
|
+
reset: te
|
|
302
302
|
};
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function Qe(e, t, n) {
|
|
305
305
|
return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function $e(e, t, n) {
|
|
308
308
|
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;
|
|
309
309
|
}
|
|
310
310
|
//#endregion
|
|
311
311
|
//#region ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
|
|
312
|
-
var
|
|
312
|
+
var et = class extends TransformStream {
|
|
313
313
|
constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
|
|
314
314
|
let i;
|
|
315
315
|
super({
|
|
316
316
|
start(a) {
|
|
317
|
-
i =
|
|
317
|
+
i = Ze({
|
|
318
318
|
onEvent: (e) => {
|
|
319
319
|
a.enqueue(e);
|
|
320
320
|
},
|
|
@@ -333,8 +333,8 @@ var $e = class extends TransformStream {
|
|
|
333
333
|
}
|
|
334
334
|
};
|
|
335
335
|
new TextDecoder();
|
|
336
|
-
var { btoa:
|
|
337
|
-
function
|
|
336
|
+
var { btoa: tt, atob: nt } = globalThis;
|
|
337
|
+
function F(e) {
|
|
338
338
|
if (e == null) return {};
|
|
339
339
|
let t = {};
|
|
340
340
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -346,28 +346,28 @@ function I(e) {
|
|
|
346
346
|
}
|
|
347
347
|
return t;
|
|
348
348
|
}
|
|
349
|
-
var
|
|
349
|
+
var I = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
|
|
350
350
|
let i = () => {
|
|
351
351
|
let e = n.length, r = Array(t);
|
|
352
352
|
for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
|
|
353
353
|
return r.join("");
|
|
354
354
|
};
|
|
355
355
|
if (e == null) return i;
|
|
356
|
-
if (n.includes(r)) throw new
|
|
356
|
+
if (n.includes(r)) throw new Me({
|
|
357
357
|
argument: "separator",
|
|
358
358
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
359
359
|
});
|
|
360
360
|
return () => `${e}${r}${i()}`;
|
|
361
|
-
},
|
|
362
|
-
function
|
|
361
|
+
}, L = I();
|
|
362
|
+
function rt(e) {
|
|
363
363
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
364
364
|
}
|
|
365
|
-
var
|
|
366
|
-
function
|
|
365
|
+
var it = /"(?:_|\\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*:/;
|
|
366
|
+
function ot(e) {
|
|
367
367
|
let t = JSON.parse(e);
|
|
368
|
-
return typeof t != "object" || !t ||
|
|
368
|
+
return typeof t != "object" || !t || it.test(e) === !1 && at.test(e) === !1 ? t : st(t);
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function st(e) {
|
|
371
371
|
let t = [e];
|
|
372
372
|
for (; t.length;) {
|
|
373
373
|
let e = t;
|
|
@@ -382,35 +382,35 @@ function ot(e) {
|
|
|
382
382
|
}
|
|
383
383
|
return e;
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function ct(e) {
|
|
386
386
|
let { stackTraceLimit: t } = Error;
|
|
387
387
|
try {
|
|
388
388
|
Error.stackTraceLimit = 0;
|
|
389
389
|
} catch {
|
|
390
|
-
return
|
|
390
|
+
return ot(e);
|
|
391
391
|
}
|
|
392
392
|
try {
|
|
393
|
-
return
|
|
393
|
+
return ot(e);
|
|
394
394
|
} finally {
|
|
395
395
|
Error.stackTraceLimit = t;
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function lt(e) {
|
|
399
399
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
400
400
|
let { additionalProperties: t } = e;
|
|
401
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
401
|
+
e.additionalProperties = t != null && typeof t != "boolean" && R(t);
|
|
402
402
|
let { properties: n } = e;
|
|
403
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
403
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = R(n[e]);
|
|
404
404
|
}
|
|
405
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
405
|
+
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(R) : R(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(R)), e.allOf != null && (e.allOf = e.allOf.map(R)), e.oneOf != null && (e.oneOf = e.oneOf.map(R));
|
|
406
406
|
let { definitions: t } = e;
|
|
407
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
407
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = R(t[e]);
|
|
408
408
|
return e;
|
|
409
409
|
}
|
|
410
|
-
function
|
|
411
|
-
return typeof e == "boolean" ? e :
|
|
410
|
+
function R(e) {
|
|
411
|
+
return typeof e == "boolean" ? e : lt(e);
|
|
412
412
|
}
|
|
413
|
-
var
|
|
413
|
+
var ut = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use"), dt = {
|
|
414
414
|
name: void 0,
|
|
415
415
|
$refStrategy: "root",
|
|
416
416
|
basePath: ["#"],
|
|
@@ -430,24 +430,24 @@ var lt = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to u
|
|
|
430
430
|
emailStrategy: "format:email",
|
|
431
431
|
base64Strategy: "contentEncoding:base64",
|
|
432
432
|
nameStrategy: "ref"
|
|
433
|
-
},
|
|
434
|
-
...
|
|
433
|
+
}, ft = (e) => typeof e == "string" ? {
|
|
434
|
+
...dt,
|
|
435
435
|
name: e
|
|
436
436
|
} : {
|
|
437
|
-
...
|
|
437
|
+
...dt,
|
|
438
438
|
...e
|
|
439
439
|
};
|
|
440
|
-
function
|
|
440
|
+
function z() {
|
|
441
441
|
return {};
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function pt(e, t) {
|
|
444
444
|
let n = { type: "array" };
|
|
445
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
445
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = U(e.type._def, {
|
|
446
446
|
...t,
|
|
447
447
|
currentPath: [...t.currentPath, "items"]
|
|
448
448
|
})), 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;
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function mt(e) {
|
|
451
451
|
let t = {
|
|
452
452
|
type: "integer",
|
|
453
453
|
format: "int64"
|
|
@@ -464,16 +464,16 @@ function pt(e) {
|
|
|
464
464
|
}
|
|
465
465
|
return t;
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function ht() {
|
|
468
468
|
return { type: "boolean" };
|
|
469
469
|
}
|
|
470
|
-
function
|
|
471
|
-
return
|
|
470
|
+
function gt(e, t) {
|
|
471
|
+
return U(e.type._def, t);
|
|
472
472
|
}
|
|
473
|
-
var
|
|
474
|
-
function
|
|
473
|
+
var _t = (e, t) => U(e.innerType._def, t);
|
|
474
|
+
function vt(e, t, n) {
|
|
475
475
|
let r = n ?? t.dateStrategy;
|
|
476
|
-
if (Array.isArray(r)) return { anyOf: r.map((n) =>
|
|
476
|
+
if (Array.isArray(r)) return { anyOf: r.map((n) => vt(e, t, n)) };
|
|
477
477
|
switch (r) {
|
|
478
478
|
case "string":
|
|
479
479
|
case "format:date-time": return {
|
|
@@ -484,10 +484,10 @@ function _t(e, t, n) {
|
|
|
484
484
|
type: "string",
|
|
485
485
|
format: "date"
|
|
486
486
|
};
|
|
487
|
-
case "integer": return
|
|
487
|
+
case "integer": return yt(e);
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
|
-
var
|
|
490
|
+
var yt = (e) => {
|
|
491
491
|
let t = {
|
|
492
492
|
type: "integer",
|
|
493
493
|
format: "unix-time"
|
|
@@ -500,31 +500,31 @@ var vt = (e) => {
|
|
|
500
500
|
}
|
|
501
501
|
return t;
|
|
502
502
|
};
|
|
503
|
-
function
|
|
503
|
+
function bt(e, t) {
|
|
504
504
|
return {
|
|
505
|
-
...
|
|
505
|
+
...U(e.innerType._def, t),
|
|
506
506
|
default: e.defaultValue()
|
|
507
507
|
};
|
|
508
508
|
}
|
|
509
|
-
function
|
|
510
|
-
return t.effectStrategy === "input" ?
|
|
509
|
+
function xt(e, t) {
|
|
510
|
+
return t.effectStrategy === "input" ? U(e.schema._def, t) : z();
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function St(e) {
|
|
513
513
|
return {
|
|
514
514
|
type: "string",
|
|
515
515
|
enum: Array.from(e.values)
|
|
516
516
|
};
|
|
517
517
|
}
|
|
518
|
-
var
|
|
519
|
-
function
|
|
520
|
-
let n = [
|
|
518
|
+
var Ct = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
519
|
+
function wt(e, t) {
|
|
520
|
+
let n = [U(e.left._def, {
|
|
521
521
|
...t,
|
|
522
522
|
currentPath: [
|
|
523
523
|
...t.currentPath,
|
|
524
524
|
"allOf",
|
|
525
525
|
"0"
|
|
526
526
|
]
|
|
527
|
-
}),
|
|
527
|
+
}), U(e.right._def, {
|
|
528
528
|
...t,
|
|
529
529
|
currentPath: [
|
|
530
530
|
...t.currentPath,
|
|
@@ -533,7 +533,7 @@ function Ct(e, t) {
|
|
|
533
533
|
]
|
|
534
534
|
})].filter((e) => !!e), r = [];
|
|
535
535
|
return n.forEach((e) => {
|
|
536
|
-
if (
|
|
536
|
+
if (Ct(e)) r.push(...e.allOf);
|
|
537
537
|
else {
|
|
538
538
|
let t = e;
|
|
539
539
|
if ("additionalProperties" in e && e.additionalProperties === !1) {
|
|
@@ -544,19 +544,19 @@ function Ct(e, t) {
|
|
|
544
544
|
}
|
|
545
545
|
}), r.length ? { allOf: r } : void 0;
|
|
546
546
|
}
|
|
547
|
-
function
|
|
547
|
+
function Tt(e) {
|
|
548
548
|
let t = typeof e.value;
|
|
549
549
|
return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
|
|
550
550
|
type: t === "bigint" ? "integer" : t,
|
|
551
551
|
const: e.value
|
|
552
552
|
};
|
|
553
553
|
}
|
|
554
|
-
var
|
|
554
|
+
var Et = void 0, B = {
|
|
555
555
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
556
556
|
cuid2: /^[0-9a-z]+$/,
|
|
557
557
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
558
558
|
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
|
|
559
|
-
emoji: () => (
|
|
559
|
+
emoji: () => (Et === void 0 && (Et = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), Et),
|
|
560
560
|
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}$/,
|
|
561
561
|
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])$/,
|
|
562
562
|
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])$/,
|
|
@@ -567,7 +567,7 @@ var Tt = void 0, V = {
|
|
|
567
567
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
568
568
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
569
569
|
};
|
|
570
|
-
function
|
|
570
|
+
function Dt(e, t) {
|
|
571
571
|
let n = { type: "string" };
|
|
572
572
|
if (e.checks) for (let r of e.checks) switch (r.kind) {
|
|
573
573
|
case "min":
|
|
@@ -579,108 +579,108 @@ function Et(e, t) {
|
|
|
579
579
|
case "email":
|
|
580
580
|
switch (t.emailStrategy) {
|
|
581
581
|
case "format:email":
|
|
582
|
-
|
|
582
|
+
V(n, "email", r.message, t);
|
|
583
583
|
break;
|
|
584
584
|
case "format:idn-email":
|
|
585
|
-
|
|
585
|
+
V(n, "idn-email", r.message, t);
|
|
586
586
|
break;
|
|
587
|
-
case "pattern:zod":
|
|
587
|
+
case "pattern:zod": H(n, B.email, r.message, t);
|
|
588
588
|
}
|
|
589
589
|
break;
|
|
590
590
|
case "url":
|
|
591
|
-
|
|
591
|
+
V(n, "uri", r.message, t);
|
|
592
592
|
break;
|
|
593
593
|
case "uuid":
|
|
594
|
-
|
|
594
|
+
V(n, "uuid", r.message, t);
|
|
595
595
|
break;
|
|
596
596
|
case "regex":
|
|
597
|
-
|
|
597
|
+
H(n, r.regex, r.message, t);
|
|
598
598
|
break;
|
|
599
599
|
case "cuid":
|
|
600
|
-
|
|
600
|
+
H(n, B.cuid, r.message, t);
|
|
601
601
|
break;
|
|
602
602
|
case "cuid2":
|
|
603
|
-
|
|
603
|
+
H(n, B.cuid2, r.message, t);
|
|
604
604
|
break;
|
|
605
605
|
case "startsWith":
|
|
606
|
-
|
|
606
|
+
H(n, RegExp(`^${Ot(r.value, t)}`), r.message, t);
|
|
607
607
|
break;
|
|
608
608
|
case "endsWith":
|
|
609
|
-
|
|
609
|
+
H(n, RegExp(`${Ot(r.value, t)}$`), r.message, t);
|
|
610
610
|
break;
|
|
611
611
|
case "datetime":
|
|
612
|
-
|
|
612
|
+
V(n, "date-time", r.message, t);
|
|
613
613
|
break;
|
|
614
614
|
case "date":
|
|
615
|
-
|
|
615
|
+
V(n, "date", r.message, t);
|
|
616
616
|
break;
|
|
617
617
|
case "time":
|
|
618
|
-
|
|
618
|
+
V(n, "time", r.message, t);
|
|
619
619
|
break;
|
|
620
620
|
case "duration":
|
|
621
|
-
|
|
621
|
+
V(n, "duration", r.message, t);
|
|
622
622
|
break;
|
|
623
623
|
case "length":
|
|
624
624
|
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;
|
|
625
625
|
break;
|
|
626
626
|
case "includes":
|
|
627
|
-
|
|
627
|
+
H(n, RegExp(Ot(r.value, t)), r.message, t);
|
|
628
628
|
break;
|
|
629
629
|
case "ip":
|
|
630
|
-
r.version !== "v6" &&
|
|
630
|
+
r.version !== "v6" && V(n, "ipv4", r.message, t), r.version !== "v4" && V(n, "ipv6", r.message, t);
|
|
631
631
|
break;
|
|
632
632
|
case "base64url":
|
|
633
|
-
|
|
633
|
+
H(n, B.base64url, r.message, t);
|
|
634
634
|
break;
|
|
635
635
|
case "jwt":
|
|
636
|
-
|
|
636
|
+
H(n, B.jwt, r.message, t);
|
|
637
637
|
break;
|
|
638
638
|
case "cidr":
|
|
639
|
-
r.version !== "v6" &&
|
|
639
|
+
r.version !== "v6" && H(n, B.ipv4Cidr, r.message, t), r.version !== "v4" && H(n, B.ipv6Cidr, r.message, t);
|
|
640
640
|
break;
|
|
641
641
|
case "emoji":
|
|
642
|
-
|
|
642
|
+
H(n, B.emoji(), r.message, t);
|
|
643
643
|
break;
|
|
644
644
|
case "ulid":
|
|
645
|
-
|
|
645
|
+
H(n, B.ulid, r.message, t);
|
|
646
646
|
break;
|
|
647
647
|
case "base64":
|
|
648
648
|
switch (t.base64Strategy) {
|
|
649
649
|
case "format:binary":
|
|
650
|
-
|
|
650
|
+
V(n, "binary", r.message, t);
|
|
651
651
|
break;
|
|
652
652
|
case "contentEncoding:base64":
|
|
653
653
|
n.contentEncoding = "base64";
|
|
654
654
|
break;
|
|
655
|
-
case "pattern:zod":
|
|
655
|
+
case "pattern:zod": H(n, B.base64, r.message, t);
|
|
656
656
|
}
|
|
657
657
|
break;
|
|
658
|
-
case "nanoid":
|
|
658
|
+
case "nanoid": H(n, B.nanoid, r.message, t);
|
|
659
659
|
}
|
|
660
660
|
return n;
|
|
661
661
|
}
|
|
662
|
-
function
|
|
663
|
-
return t.patternStrategy === "escape" ?
|
|
662
|
+
function Ot(e, t) {
|
|
663
|
+
return t.patternStrategy === "escape" ? At(e) : e;
|
|
664
664
|
}
|
|
665
|
-
var
|
|
666
|
-
function
|
|
665
|
+
var kt = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
666
|
+
function At(e) {
|
|
667
667
|
let t = "";
|
|
668
|
-
for (let n = 0; n < e.length; n++)
|
|
668
|
+
for (let n = 0; n < e.length; n++) kt.has(e[n]) || (t += "\\"), t += e[n];
|
|
669
669
|
return t;
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function V(e, t, n, r) {
|
|
672
672
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
673
673
|
format: t,
|
|
674
674
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
675
675
|
})) : e.format = t;
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function H(e, t, n, r) {
|
|
678
678
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
679
|
-
pattern:
|
|
679
|
+
pattern: jt(t, r),
|
|
680
680
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
681
|
-
})) : e.pattern =
|
|
681
|
+
})) : e.pattern = jt(t, r);
|
|
682
682
|
}
|
|
683
|
-
function
|
|
683
|
+
function jt(e, t) {
|
|
684
684
|
if (!t.applyRegexFlags || !e.flags) return e.source;
|
|
685
685
|
let n = {
|
|
686
686
|
i: e.flags.includes("i"),
|
|
@@ -728,16 +728,16 @@ function At(e, t) {
|
|
|
728
728
|
}
|
|
729
729
|
return i;
|
|
730
730
|
}
|
|
731
|
-
function
|
|
731
|
+
function Mt(e, t) {
|
|
732
732
|
let n = {
|
|
733
733
|
type: "object",
|
|
734
|
-
additionalProperties:
|
|
734
|
+
additionalProperties: U(e.valueType._def, {
|
|
735
735
|
...t,
|
|
736
736
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
737
737
|
}) ?? t.allowedAdditionalProperties
|
|
738
738
|
};
|
|
739
739
|
if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
|
|
740
|
-
let { type: r, ...i } =
|
|
740
|
+
let { type: r, ...i } = Dt(e.keyType._def, t);
|
|
741
741
|
return {
|
|
742
742
|
...n,
|
|
743
743
|
propertyNames: i
|
|
@@ -748,7 +748,7 @@ function jt(e, t) {
|
|
|
748
748
|
propertyNames: { enum: e.keyType._def.values }
|
|
749
749
|
};
|
|
750
750
|
if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
|
|
751
|
-
let { type: r, ...i } =
|
|
751
|
+
let { type: r, ...i } = gt(e.keyType._def, t);
|
|
752
752
|
return {
|
|
753
753
|
...n,
|
|
754
754
|
propertyNames: i
|
|
@@ -756,13 +756,13 @@ function jt(e, t) {
|
|
|
756
756
|
}
|
|
757
757
|
return n;
|
|
758
758
|
}
|
|
759
|
-
function
|
|
760
|
-
return t.mapStrategy === "record" ?
|
|
759
|
+
function Nt(e, t) {
|
|
760
|
+
return t.mapStrategy === "record" ? Mt(e, t) : {
|
|
761
761
|
type: "array",
|
|
762
762
|
maxItems: 125,
|
|
763
763
|
items: {
|
|
764
764
|
type: "array",
|
|
765
|
-
items: [
|
|
765
|
+
items: [U(e.keyType._def, {
|
|
766
766
|
...t,
|
|
767
767
|
currentPath: [
|
|
768
768
|
...t.currentPath,
|
|
@@ -770,7 +770,7 @@ function Mt(e, t) {
|
|
|
770
770
|
"items",
|
|
771
771
|
"0"
|
|
772
772
|
]
|
|
773
|
-
}) ||
|
|
773
|
+
}) || z(), U(e.valueType._def, {
|
|
774
774
|
...t,
|
|
775
775
|
currentPath: [
|
|
776
776
|
...t.currentPath,
|
|
@@ -778,37 +778,37 @@ function Mt(e, t) {
|
|
|
778
778
|
"items",
|
|
779
779
|
"1"
|
|
780
780
|
]
|
|
781
|
-
}) ||
|
|
781
|
+
}) || z()],
|
|
782
782
|
minItems: 2,
|
|
783
783
|
maxItems: 2
|
|
784
784
|
}
|
|
785
785
|
};
|
|
786
786
|
}
|
|
787
|
-
function
|
|
787
|
+
function Pt(e) {
|
|
788
788
|
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)));
|
|
789
789
|
return {
|
|
790
790
|
type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
791
791
|
enum: n
|
|
792
792
|
};
|
|
793
793
|
}
|
|
794
|
-
function Pt() {
|
|
795
|
-
return { not: B() };
|
|
796
|
-
}
|
|
797
794
|
function Ft() {
|
|
795
|
+
return { not: z() };
|
|
796
|
+
}
|
|
797
|
+
function It() {
|
|
798
798
|
return { type: "null" };
|
|
799
799
|
}
|
|
800
|
-
var
|
|
800
|
+
var Lt = {
|
|
801
801
|
ZodString: "string",
|
|
802
802
|
ZodNumber: "number",
|
|
803
803
|
ZodBigInt: "integer",
|
|
804
804
|
ZodBoolean: "boolean",
|
|
805
805
|
ZodNull: "null"
|
|
806
806
|
};
|
|
807
|
-
function
|
|
807
|
+
function Rt(e, t) {
|
|
808
808
|
let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
809
|
-
if (n.every((e) => e._def.typeName in
|
|
809
|
+
if (n.every((e) => e._def.typeName in Lt && (!e._def.checks || !e._def.checks.length))) {
|
|
810
810
|
let e = n.reduce((e, t) => {
|
|
811
|
-
let n =
|
|
811
|
+
let n = Lt[t._def.typeName];
|
|
812
812
|
return n && !e.includes(n) ? [...e, n] : e;
|
|
813
813
|
}, []);
|
|
814
814
|
return { type: e.length > 1 ? e : e[0] };
|
|
@@ -836,10 +836,10 @@ function Lt(e, t) {
|
|
|
836
836
|
type: "string",
|
|
837
837
|
enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
|
|
838
838
|
};
|
|
839
|
-
return
|
|
839
|
+
return zt(e, t);
|
|
840
840
|
}
|
|
841
|
-
var
|
|
842
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
841
|
+
var zt = (e, t) => {
|
|
842
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => U(e._def, {
|
|
843
843
|
...t,
|
|
844
844
|
currentPath: [
|
|
845
845
|
...t.currentPath,
|
|
@@ -849,15 +849,15 @@ var Rt = (e, t) => {
|
|
|
849
849
|
})).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
|
|
850
850
|
return n.length ? { anyOf: n } : void 0;
|
|
851
851
|
};
|
|
852
|
-
function
|
|
852
|
+
function Bt(e, t) {
|
|
853
853
|
if ([
|
|
854
854
|
"ZodString",
|
|
855
855
|
"ZodNumber",
|
|
856
856
|
"ZodBigInt",
|
|
857
857
|
"ZodBoolean",
|
|
858
858
|
"ZodNull"
|
|
859
|
-
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [
|
|
860
|
-
let n =
|
|
859
|
+
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Lt[e.innerType._def.typeName], "null"] };
|
|
860
|
+
let n = U(e.innerType._def, {
|
|
861
861
|
...t,
|
|
862
862
|
currentPath: [
|
|
863
863
|
...t.currentPath,
|
|
@@ -867,7 +867,7 @@ function zt(e, t) {
|
|
|
867
867
|
});
|
|
868
868
|
return n && { anyOf: [n, { type: "null" }] };
|
|
869
869
|
}
|
|
870
|
-
function
|
|
870
|
+
function Vt(e) {
|
|
871
871
|
let t = { type: "number" };
|
|
872
872
|
if (!e.checks) return t;
|
|
873
873
|
for (let n of e.checks) switch (n.kind) {
|
|
@@ -884,7 +884,7 @@ function Bt(e) {
|
|
|
884
884
|
}
|
|
885
885
|
return t;
|
|
886
886
|
}
|
|
887
|
-
function
|
|
887
|
+
function Ht(e, t) {
|
|
888
888
|
let n = {
|
|
889
889
|
type: "object",
|
|
890
890
|
properties: {}
|
|
@@ -892,7 +892,7 @@ function Vt(e, t) {
|
|
|
892
892
|
for (let e in i) {
|
|
893
893
|
let a = i[e];
|
|
894
894
|
if (a === void 0 || a._def === void 0) continue;
|
|
895
|
-
let o =
|
|
895
|
+
let o = Wt(a), s = U(a._def, {
|
|
896
896
|
...t,
|
|
897
897
|
currentPath: [
|
|
898
898
|
...t.currentPath,
|
|
@@ -908,11 +908,11 @@ function Vt(e, t) {
|
|
|
908
908
|
s !== void 0 && (n.properties[e] = s, o || r.push(e));
|
|
909
909
|
}
|
|
910
910
|
r.length && (n.required = r);
|
|
911
|
-
let a =
|
|
911
|
+
let a = Ut(e, t);
|
|
912
912
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
913
913
|
}
|
|
914
|
-
function
|
|
915
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
914
|
+
function Ut(e, t) {
|
|
915
|
+
if (e.catchall._def.typeName !== "ZodNever") return U(e.catchall._def, {
|
|
916
916
|
...t,
|
|
917
917
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
918
918
|
});
|
|
@@ -922,16 +922,16 @@ function Ht(e, t) {
|
|
|
922
922
|
case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
|
-
function
|
|
925
|
+
function Wt(e) {
|
|
926
926
|
try {
|
|
927
927
|
return e.isOptional();
|
|
928
928
|
} catch {
|
|
929
929
|
return !0;
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
|
-
var
|
|
933
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
934
|
-
let n =
|
|
932
|
+
var Gt = (e, t) => {
|
|
933
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return U(e.innerType._def, t);
|
|
934
|
+
let n = U(e.innerType._def, {
|
|
935
935
|
...t,
|
|
936
936
|
currentPath: [
|
|
937
937
|
...t.currentPath,
|
|
@@ -939,11 +939,11 @@ var Wt = (e, t) => {
|
|
|
939
939
|
"1"
|
|
940
940
|
]
|
|
941
941
|
});
|
|
942
|
-
return n ? { anyOf: [{ not:
|
|
943
|
-
},
|
|
944
|
-
if (t.pipeStrategy === "input") return
|
|
945
|
-
if (t.pipeStrategy === "output") return
|
|
946
|
-
let n =
|
|
942
|
+
return n ? { anyOf: [{ not: z() }, n] } : z();
|
|
943
|
+
}, Kt = (e, t) => {
|
|
944
|
+
if (t.pipeStrategy === "input") return U(e.in._def, t);
|
|
945
|
+
if (t.pipeStrategy === "output") return U(e.out._def, t);
|
|
946
|
+
let n = U(e.in._def, {
|
|
947
947
|
...t,
|
|
948
948
|
currentPath: [
|
|
949
949
|
...t.currentPath,
|
|
@@ -951,7 +951,7 @@ var Wt = (e, t) => {
|
|
|
951
951
|
"0"
|
|
952
952
|
]
|
|
953
953
|
});
|
|
954
|
-
return { allOf: [n,
|
|
954
|
+
return { allOf: [n, U(e.out._def, {
|
|
955
955
|
...t,
|
|
956
956
|
currentPath: [
|
|
957
957
|
...t.currentPath,
|
|
@@ -960,25 +960,25 @@ var Wt = (e, t) => {
|
|
|
960
960
|
]
|
|
961
961
|
})].filter((e) => e !== void 0) };
|
|
962
962
|
};
|
|
963
|
-
function Kt(e, t) {
|
|
964
|
-
return W(e.type._def, t);
|
|
965
|
-
}
|
|
966
963
|
function qt(e, t) {
|
|
964
|
+
return U(e.type._def, t);
|
|
965
|
+
}
|
|
966
|
+
function Jt(e, t) {
|
|
967
967
|
let n = {
|
|
968
968
|
type: "array",
|
|
969
969
|
uniqueItems: !0,
|
|
970
|
-
items:
|
|
970
|
+
items: U(e.valueType._def, {
|
|
971
971
|
...t,
|
|
972
972
|
currentPath: [...t.currentPath, "items"]
|
|
973
973
|
})
|
|
974
974
|
};
|
|
975
975
|
return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
|
|
976
976
|
}
|
|
977
|
-
function
|
|
977
|
+
function Yt(e, t) {
|
|
978
978
|
return e.rest ? {
|
|
979
979
|
type: "array",
|
|
980
980
|
minItems: e.items.length,
|
|
981
|
-
items: e.items.map((e, n) =>
|
|
981
|
+
items: e.items.map((e, n) => U(e._def, {
|
|
982
982
|
...t,
|
|
983
983
|
currentPath: [
|
|
984
984
|
...t.currentPath,
|
|
@@ -986,7 +986,7 @@ function Jt(e, t) {
|
|
|
986
986
|
`${n}`
|
|
987
987
|
]
|
|
988
988
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
989
|
-
additionalItems:
|
|
989
|
+
additionalItems: U(e.rest._def, {
|
|
990
990
|
...t,
|
|
991
991
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
992
992
|
})
|
|
@@ -994,7 +994,7 @@ function Jt(e, t) {
|
|
|
994
994
|
type: "array",
|
|
995
995
|
minItems: e.items.length,
|
|
996
996
|
maxItems: e.items.length,
|
|
997
|
-
items: e.items.map((e, n) =>
|
|
997
|
+
items: e.items.map((e, n) => U(e._def, {
|
|
998
998
|
...t,
|
|
999
999
|
currentPath: [
|
|
1000
1000
|
...t.currentPath,
|
|
@@ -1004,65 +1004,65 @@ function Jt(e, t) {
|
|
|
1004
1004
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], [])
|
|
1005
1005
|
};
|
|
1006
1006
|
}
|
|
1007
|
-
function Yt() {
|
|
1008
|
-
return { not: B() };
|
|
1009
|
-
}
|
|
1010
1007
|
function Xt() {
|
|
1011
|
-
return
|
|
1008
|
+
return { not: z() };
|
|
1012
1009
|
}
|
|
1013
|
-
|
|
1010
|
+
function Zt() {
|
|
1011
|
+
return z();
|
|
1012
|
+
}
|
|
1013
|
+
var Qt = (e, t) => U(e.innerType._def, t), $t = (e, t, n) => {
|
|
1014
1014
|
switch (t) {
|
|
1015
|
-
case "ZodString": return
|
|
1016
|
-
case "ZodNumber": return
|
|
1017
|
-
case "ZodObject": return
|
|
1018
|
-
case "ZodBigInt": return
|
|
1019
|
-
case "ZodBoolean": return
|
|
1020
|
-
case "ZodDate": return
|
|
1021
|
-
case "ZodUndefined": return
|
|
1022
|
-
case "ZodNull": return
|
|
1023
|
-
case "ZodArray": return
|
|
1015
|
+
case "ZodString": return Dt(e, n);
|
|
1016
|
+
case "ZodNumber": return Vt(e);
|
|
1017
|
+
case "ZodObject": return Ht(e, n);
|
|
1018
|
+
case "ZodBigInt": return mt(e);
|
|
1019
|
+
case "ZodBoolean": return ht();
|
|
1020
|
+
case "ZodDate": return vt(e, n);
|
|
1021
|
+
case "ZodUndefined": return Xt();
|
|
1022
|
+
case "ZodNull": return It();
|
|
1023
|
+
case "ZodArray": return pt(e, n);
|
|
1024
1024
|
case "ZodUnion":
|
|
1025
|
-
case "ZodDiscriminatedUnion": return
|
|
1026
|
-
case "ZodIntersection": return
|
|
1027
|
-
case "ZodTuple": return
|
|
1028
|
-
case "ZodRecord": return
|
|
1029
|
-
case "ZodLiteral": return
|
|
1030
|
-
case "ZodEnum": return
|
|
1031
|
-
case "ZodNativeEnum": return
|
|
1032
|
-
case "ZodNullable": return
|
|
1033
|
-
case "ZodOptional": return
|
|
1034
|
-
case "ZodMap": return
|
|
1035
|
-
case "ZodSet": return
|
|
1025
|
+
case "ZodDiscriminatedUnion": return Rt(e, n);
|
|
1026
|
+
case "ZodIntersection": return wt(e, n);
|
|
1027
|
+
case "ZodTuple": return Yt(e, n);
|
|
1028
|
+
case "ZodRecord": return Mt(e, n);
|
|
1029
|
+
case "ZodLiteral": return Tt(e);
|
|
1030
|
+
case "ZodEnum": return St(e);
|
|
1031
|
+
case "ZodNativeEnum": return Pt(e);
|
|
1032
|
+
case "ZodNullable": return Bt(e, n);
|
|
1033
|
+
case "ZodOptional": return Gt(e, n);
|
|
1034
|
+
case "ZodMap": return Nt(e, n);
|
|
1035
|
+
case "ZodSet": return Jt(e, n);
|
|
1036
1036
|
case "ZodLazy": return () => e.getter()._def;
|
|
1037
|
-
case "ZodPromise": return
|
|
1037
|
+
case "ZodPromise": return qt(e, n);
|
|
1038
1038
|
case "ZodNaN":
|
|
1039
|
-
case "ZodNever": return
|
|
1040
|
-
case "ZodEffects": return
|
|
1041
|
-
case "ZodAny": return
|
|
1042
|
-
case "ZodUnknown": return
|
|
1043
|
-
case "ZodDefault": return
|
|
1044
|
-
case "ZodBranded": return
|
|
1045
|
-
case "ZodReadonly": return
|
|
1046
|
-
case "ZodCatch": return
|
|
1047
|
-
case "ZodPipeline": return
|
|
1039
|
+
case "ZodNever": return Ft();
|
|
1040
|
+
case "ZodEffects": return xt(e, n);
|
|
1041
|
+
case "ZodAny": return z();
|
|
1042
|
+
case "ZodUnknown": return Zt();
|
|
1043
|
+
case "ZodDefault": return bt(e, n);
|
|
1044
|
+
case "ZodBranded": return gt(e, n);
|
|
1045
|
+
case "ZodReadonly": return Qt(e, n);
|
|
1046
|
+
case "ZodCatch": return _t(e, n);
|
|
1047
|
+
case "ZodPipeline": return Kt(e, n);
|
|
1048
1048
|
case "ZodFunction":
|
|
1049
1049
|
case "ZodVoid":
|
|
1050
1050
|
case "ZodSymbol": return;
|
|
1051
1051
|
default: return /* @__PURE__ */ ((e) => void 0)(t);
|
|
1052
1052
|
}
|
|
1053
|
-
},
|
|
1053
|
+
}, en = (e, t) => {
|
|
1054
1054
|
let n = 0;
|
|
1055
1055
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1056
1056
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1057
1057
|
};
|
|
1058
|
-
function
|
|
1058
|
+
function U(e, t, n = !1) {
|
|
1059
1059
|
let r = t.seen.get(e);
|
|
1060
1060
|
if (t.override) {
|
|
1061
|
-
let i = t.override?.
|
|
1062
|
-
if (i !==
|
|
1061
|
+
let i = t.override?.(e, t, r, n);
|
|
1062
|
+
if (i !== ut) return i;
|
|
1063
1063
|
}
|
|
1064
1064
|
if (r && !n) {
|
|
1065
|
-
let e =
|
|
1065
|
+
let e = tn(r, t);
|
|
1066
1066
|
if (e !== void 0) return e;
|
|
1067
1067
|
}
|
|
1068
1068
|
let i = {
|
|
@@ -1071,22 +1071,22 @@ function W(e, t, n = !1) {
|
|
|
1071
1071
|
jsonSchema: void 0
|
|
1072
1072
|
};
|
|
1073
1073
|
t.seen.set(e, i);
|
|
1074
|
-
let a =
|
|
1075
|
-
if (o &&
|
|
1074
|
+
let a = $t(e, e.typeName, t), o = typeof a == "function" ? U(a(), t) : a;
|
|
1075
|
+
if (o && nn(e, t, o), t.postProcess) {
|
|
1076
1076
|
let n = t.postProcess(o, e, t);
|
|
1077
1077
|
return i.jsonSchema = o, n;
|
|
1078
1078
|
}
|
|
1079
1079
|
return i.jsonSchema = o, o;
|
|
1080
1080
|
}
|
|
1081
|
-
var
|
|
1081
|
+
var tn = (e, t) => {
|
|
1082
1082
|
switch (t.$refStrategy) {
|
|
1083
1083
|
case "root": return { $ref: e.path.join("/") };
|
|
1084
|
-
case "relative": return { $ref:
|
|
1084
|
+
case "relative": return { $ref: en(t.currentPath, e.path) };
|
|
1085
1085
|
case "none":
|
|
1086
|
-
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`),
|
|
1086
|
+
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`), z()) : t.$refStrategy === "seen" ? z() : void 0;
|
|
1087
1087
|
}
|
|
1088
|
-
},
|
|
1089
|
-
let t =
|
|
1088
|
+
}, nn = (e, t, n) => (e.description && (n.description = e.description), n), rn = (e) => {
|
|
1089
|
+
let t = ft(e), n = t.name === void 0 ? t.basePath : [
|
|
1090
1090
|
...t.basePath,
|
|
1091
1091
|
t.definitionPath,
|
|
1092
1092
|
t.name
|
|
@@ -1105,25 +1105,25 @@ var en = (e, t) => {
|
|
|
1105
1105
|
jsonSchema: void 0
|
|
1106
1106
|
}]))
|
|
1107
1107
|
};
|
|
1108
|
-
},
|
|
1109
|
-
let n =
|
|
1108
|
+
}, an = (e, t) => {
|
|
1109
|
+
let n = rn(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1110
1110
|
...e,
|
|
1111
|
-
[t]:
|
|
1111
|
+
[t]: U(r._def, {
|
|
1112
1112
|
...n,
|
|
1113
1113
|
currentPath: [
|
|
1114
1114
|
...n.basePath,
|
|
1115
1115
|
n.definitionPath,
|
|
1116
1116
|
t
|
|
1117
1117
|
]
|
|
1118
|
-
}, !0) ??
|
|
1119
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1118
|
+
}, !0) ?? z()
|
|
1119
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = U(e._def, i === void 0 ? n : {
|
|
1120
1120
|
...n,
|
|
1121
1121
|
currentPath: [
|
|
1122
1122
|
...n.basePath,
|
|
1123
1123
|
n.definitionPath,
|
|
1124
1124
|
i
|
|
1125
1125
|
]
|
|
1126
|
-
}, !1) ??
|
|
1126
|
+
}, !1) ?? z(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1127
1127
|
o !== void 0 && (a.title = o);
|
|
1128
1128
|
let s = i === void 0 ? r ? {
|
|
1129
1129
|
...a,
|
|
@@ -1140,14 +1140,14 @@ var en = (e, t) => {
|
|
|
1140
1140
|
}
|
|
1141
1141
|
};
|
|
1142
1142
|
return s.$schema = "http://json-schema.org/draft-07/schema#", s;
|
|
1143
|
-
},
|
|
1144
|
-
function
|
|
1143
|
+
}, on = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
|
|
1144
|
+
function sn(e) {
|
|
1145
1145
|
let t;
|
|
1146
1146
|
return () => (t ??= e(), t);
|
|
1147
1147
|
}
|
|
1148
|
-
function
|
|
1148
|
+
function cn(e, { validate: t } = {}) {
|
|
1149
1149
|
return {
|
|
1150
|
-
[
|
|
1150
|
+
[on]: !0,
|
|
1151
1151
|
_type: void 0,
|
|
1152
1152
|
get jsonSchema() {
|
|
1153
1153
|
return typeof e == "function" && (e = e()), e;
|
|
@@ -1155,20 +1155,20 @@ function sn(e, { validate: t } = {}) {
|
|
|
1155
1155
|
validate: t
|
|
1156
1156
|
};
|
|
1157
1157
|
}
|
|
1158
|
-
function cn(e) {
|
|
1159
|
-
return typeof e == "object" && !!e && an in e && e[an] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1160
|
-
}
|
|
1161
1158
|
function ln(e) {
|
|
1162
|
-
return e ==
|
|
1159
|
+
return typeof e == "object" && !!e && on in e && e[on] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1160
|
+
}
|
|
1161
|
+
function un(e) {
|
|
1162
|
+
return e == null ? cn({
|
|
1163
1163
|
type: "object",
|
|
1164
1164
|
properties: {},
|
|
1165
1165
|
additionalProperties: !1
|
|
1166
|
-
}) :
|
|
1166
|
+
}) : ln(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? gn(e) : dn(e) : e();
|
|
1167
1167
|
}
|
|
1168
|
-
function
|
|
1169
|
-
return
|
|
1170
|
-
if (!
|
|
1171
|
-
return
|
|
1168
|
+
function dn(e) {
|
|
1169
|
+
return cn(() => {
|
|
1170
|
+
if (!fn(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1171
|
+
return lt(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1172
1172
|
}, { validate: async (t) => {
|
|
1173
1173
|
let n = await e["~standard"].validate(t);
|
|
1174
1174
|
return "value" in n ? {
|
|
@@ -1176,19 +1176,19 @@ function un(e) {
|
|
|
1176
1176
|
value: n.value
|
|
1177
1177
|
} : {
|
|
1178
1178
|
success: !1,
|
|
1179
|
-
error: new
|
|
1179
|
+
error: new N({
|
|
1180
1180
|
value: t,
|
|
1181
1181
|
cause: n.issues
|
|
1182
1182
|
})
|
|
1183
1183
|
};
|
|
1184
1184
|
} });
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1186
|
+
function fn(e) {
|
|
1187
1187
|
return e["~standard"].jsonSchema != null;
|
|
1188
1188
|
}
|
|
1189
|
-
function
|
|
1189
|
+
function pn(e, t) {
|
|
1190
1190
|
let n = t?.useReferences ?? !1;
|
|
1191
|
-
return
|
|
1191
|
+
return cn(() => an(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
|
|
1192
1192
|
let n = await e.safeParseAsync(t);
|
|
1193
1193
|
return n.success ? {
|
|
1194
1194
|
success: !0,
|
|
@@ -1199,9 +1199,9 @@ function fn(e, t) {
|
|
|
1199
1199
|
};
|
|
1200
1200
|
} });
|
|
1201
1201
|
}
|
|
1202
|
-
function
|
|
1202
|
+
function mn(t, r) {
|
|
1203
1203
|
let i = r?.useReferences ?? !1;
|
|
1204
|
-
return
|
|
1204
|
+
return cn(() => lt(e(t, {
|
|
1205
1205
|
target: "draft-7",
|
|
1206
1206
|
io: "input",
|
|
1207
1207
|
reused: i ? "ref" : "inline"
|
|
@@ -1216,27 +1216,27 @@ function pn(t, r) {
|
|
|
1216
1216
|
};
|
|
1217
1217
|
} });
|
|
1218
1218
|
}
|
|
1219
|
-
function
|
|
1219
|
+
function hn(e) {
|
|
1220
1220
|
return "_zod" in e;
|
|
1221
1221
|
}
|
|
1222
|
-
function
|
|
1223
|
-
return
|
|
1222
|
+
function gn(e, t) {
|
|
1223
|
+
return hn(e) ? mn(e, t) : pn(e, t);
|
|
1224
1224
|
}
|
|
1225
|
-
async function
|
|
1226
|
-
let r = await
|
|
1225
|
+
async function _n({ value: e, schema: t, context: n }) {
|
|
1226
|
+
let r = await vn({
|
|
1227
1227
|
value: e,
|
|
1228
1228
|
schema: t,
|
|
1229
1229
|
context: n
|
|
1230
1230
|
});
|
|
1231
|
-
if (!r.success) throw
|
|
1231
|
+
if (!r.success) throw N.wrap({
|
|
1232
1232
|
value: e,
|
|
1233
1233
|
cause: r.error,
|
|
1234
1234
|
context: n
|
|
1235
1235
|
});
|
|
1236
1236
|
return r.value;
|
|
1237
1237
|
}
|
|
1238
|
-
async function
|
|
1239
|
-
let r =
|
|
1238
|
+
async function vn({ value: e, schema: t, context: n }) {
|
|
1239
|
+
let r = un(t);
|
|
1240
1240
|
try {
|
|
1241
1241
|
if (r.validate == null) return {
|
|
1242
1242
|
success: !0,
|
|
@@ -1250,7 +1250,7 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1250
1250
|
rawValue: e
|
|
1251
1251
|
} : {
|
|
1252
1252
|
success: !1,
|
|
1253
|
-
error:
|
|
1253
|
+
error: N.wrap({
|
|
1254
1254
|
value: e,
|
|
1255
1255
|
cause: t.error,
|
|
1256
1256
|
context: n
|
|
@@ -1260,7 +1260,7 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1260
1260
|
} catch (t) {
|
|
1261
1261
|
return {
|
|
1262
1262
|
success: !1,
|
|
1263
|
-
error:
|
|
1263
|
+
error: N.wrap({
|
|
1264
1264
|
value: e,
|
|
1265
1265
|
cause: t,
|
|
1266
1266
|
context: n
|
|
@@ -1269,21 +1269,21 @@ async function _n({ value: e, schema: t, context: n }) {
|
|
|
1269
1269
|
};
|
|
1270
1270
|
}
|
|
1271
1271
|
}
|
|
1272
|
-
async function
|
|
1272
|
+
async function W({ text: e, schema: t }) {
|
|
1273
1273
|
try {
|
|
1274
|
-
let n =
|
|
1274
|
+
let n = ct(e);
|
|
1275
1275
|
return t == null ? {
|
|
1276
1276
|
success: !0,
|
|
1277
1277
|
value: n,
|
|
1278
1278
|
rawValue: n
|
|
1279
|
-
} : await
|
|
1279
|
+
} : await vn({
|
|
1280
1280
|
value: n,
|
|
1281
1281
|
schema: t
|
|
1282
1282
|
});
|
|
1283
1283
|
} catch (t) {
|
|
1284
1284
|
return {
|
|
1285
1285
|
success: !1,
|
|
1286
|
-
error:
|
|
1286
|
+
error: Re.isInstance(t) ? t : new Re({
|
|
1287
1287
|
text: e,
|
|
1288
1288
|
cause: t
|
|
1289
1289
|
}),
|
|
@@ -1291,34 +1291,34 @@ async function G({ text: e, schema: t }) {
|
|
|
1291
1291
|
};
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
|
-
function
|
|
1295
|
-
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new
|
|
1296
|
-
e !== "[DONE]" && n.enqueue(await
|
|
1294
|
+
function yn({ stream: e, schema: t }) {
|
|
1295
|
+
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new et()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1296
|
+
e !== "[DONE]" && n.enqueue(await W({
|
|
1297
1297
|
text: e,
|
|
1298
1298
|
schema: t
|
|
1299
1299
|
}));
|
|
1300
1300
|
} }));
|
|
1301
1301
|
}
|
|
1302
|
-
async function
|
|
1302
|
+
async function G(e) {
|
|
1303
1303
|
return typeof e == "function" && (e = e()), e;
|
|
1304
1304
|
}
|
|
1305
1305
|
new TextDecoder();
|
|
1306
|
-
var
|
|
1307
|
-
for (var n in t)
|
|
1306
|
+
var bn = Object.defineProperty, xn = (e, t) => {
|
|
1307
|
+
for (var n in t) bn(e, n, {
|
|
1308
1308
|
get: t[n],
|
|
1309
1309
|
enumerable: !0
|
|
1310
1310
|
});
|
|
1311
|
-
},
|
|
1311
|
+
}, Sn = "AI_InvalidArgumentError", Cn = `vercel.ai.error.${Sn}`, wn = Symbol.for(Cn), Tn, En, K = class extends (En = w, Tn = wn, En) {
|
|
1312
1312
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1313
1313
|
super({
|
|
1314
|
-
name:
|
|
1314
|
+
name: Sn,
|
|
1315
1315
|
message: `Invalid argument for parameter ${e}: ${n}`
|
|
1316
|
-
}), this[
|
|
1316
|
+
}), this[Tn] = !0, this.parameter = e, this.value = t;
|
|
1317
1317
|
}
|
|
1318
1318
|
static isInstance(e) {
|
|
1319
|
-
return
|
|
1319
|
+
return w.hasMarker(e, Cn);
|
|
1320
1320
|
}
|
|
1321
|
-
}, Dn = "AI_NoObjectGeneratedError", On = `vercel.ai.error.${Dn}`, kn = Symbol.for(On), An, jn, q = class extends (jn =
|
|
1321
|
+
}, Dn = "AI_NoObjectGeneratedError", On = `vercel.ai.error.${Dn}`, kn = Symbol.for(On), An, jn, q = class extends (jn = w, An = kn, jn) {
|
|
1322
1322
|
constructor({ message: e = "No object generated.", cause: t, text: n, response: r, usage: i, finishReason: a }) {
|
|
1323
1323
|
super({
|
|
1324
1324
|
name: Dn,
|
|
@@ -1327,9 +1327,9 @@ var yn = Object.defineProperty, bn = (e, t) => {
|
|
|
1327
1327
|
}), this[An] = !0, this.text = n, this.response = r, this.usage = i, this.finishReason = a;
|
|
1328
1328
|
}
|
|
1329
1329
|
static isInstance(e) {
|
|
1330
|
-
return
|
|
1330
|
+
return w.hasMarker(e, On);
|
|
1331
1331
|
}
|
|
1332
|
-
}, Mn = "AI_UIMessageStreamError", Nn = `vercel.ai.error.${Mn}`, Pn = Symbol.for(Nn), Fn, In, J = class extends (In =
|
|
1332
|
+
}, Mn = "AI_UIMessageStreamError", Nn = `vercel.ai.error.${Mn}`, Pn = Symbol.for(Nn), Fn, In, J = class extends (In = w, Fn = Pn, In) {
|
|
1333
1333
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1334
1334
|
super({
|
|
1335
1335
|
name: Mn,
|
|
@@ -1337,52 +1337,10 @@ var yn = Object.defineProperty, bn = (e, t) => {
|
|
|
1337
1337
|
}), this[Fn] = !0, this.chunkType = e, this.chunkId = t;
|
|
1338
1338
|
}
|
|
1339
1339
|
static isInstance(e) {
|
|
1340
|
-
return
|
|
1341
|
-
}
|
|
1342
|
-
};
|
|
1343
|
-
function Ln({ warning: e, provider: t, model: n }) {
|
|
1344
|
-
let r = `AI SDK Warning${t != null && n != null ? ` (${t} / ${n})` : ""}:`;
|
|
1345
|
-
switch (e.type) {
|
|
1346
|
-
case "unsupported": {
|
|
1347
|
-
let t = `${r} The feature "${e.feature}" is not supported.`;
|
|
1348
|
-
return e.details && (t += ` ${e.details}`), t;
|
|
1349
|
-
}
|
|
1350
|
-
case "compatibility": {
|
|
1351
|
-
let t = `${r} The feature "${e.feature}" is used in a compatibility mode.`;
|
|
1352
|
-
return e.details && (t += ` ${e.details}`), t;
|
|
1353
|
-
}
|
|
1354
|
-
case "deprecated": return `${r} Deprecated: "${e.setting}". ${e.message}`;
|
|
1355
|
-
case "other": return `${r} ${e.message}`;
|
|
1356
|
-
default: return `${r} ${JSON.stringify(e, null, 2)}`;
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
var Rn = "AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.", zn = !1;
|
|
1360
|
-
function Bn({ message: e, type: t }) {
|
|
1361
|
-
typeof process < "u" && typeof process.emitWarning == "function" ? process.emitWarning(e, { type: t }) : console.warn(e);
|
|
1362
|
-
}
|
|
1363
|
-
var Vn = (e) => {
|
|
1364
|
-
if (e.warnings.length === 0) return;
|
|
1365
|
-
let t = globalThis.AI_SDK_LOG_WARNINGS;
|
|
1366
|
-
if (t !== !1) {
|
|
1367
|
-
if (typeof t == "function") {
|
|
1368
|
-
t(e);
|
|
1369
|
-
return;
|
|
1370
|
-
}
|
|
1371
|
-
zn || (zn = !0, Bn({
|
|
1372
|
-
message: Rn,
|
|
1373
|
-
type: "Warning"
|
|
1374
|
-
}));
|
|
1375
|
-
for (let t of e.warnings) Bn({
|
|
1376
|
-
message: Ln({
|
|
1377
|
-
warning: t,
|
|
1378
|
-
provider: e.provider,
|
|
1379
|
-
model: e.model
|
|
1380
|
-
}),
|
|
1381
|
-
type: t.type === "deprecated" ? "DeprecationWarning" : "Warning"
|
|
1382
|
-
});
|
|
1340
|
+
return w.hasMarker(e, Nn);
|
|
1383
1341
|
}
|
|
1384
1342
|
};
|
|
1385
|
-
function
|
|
1343
|
+
function Ln(e, t) {
|
|
1386
1344
|
if (e === void 0 && t === void 0) return;
|
|
1387
1345
|
if (e === void 0) return t;
|
|
1388
1346
|
if (t === void 0) return e;
|
|
@@ -1391,7 +1349,7 @@ function Hn(e, t) {
|
|
|
1391
1349
|
let i = t[r];
|
|
1392
1350
|
if (i === void 0) continue;
|
|
1393
1351
|
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);
|
|
1394
|
-
n[r] = o && s ?
|
|
1352
|
+
n[r] = o && s ? Ln(a, i) : i;
|
|
1395
1353
|
}
|
|
1396
1354
|
return n;
|
|
1397
1355
|
}
|
|
@@ -1420,28 +1378,28 @@ var Y = {
|
|
|
1420
1378
|
Y.boolean(),
|
|
1421
1379
|
Y.record(Y.string(), X.optional()),
|
|
1422
1380
|
Y.array(X)
|
|
1423
|
-
])), Z = Y.record(Y.string(), Y.record(Y.string(), X.optional())),
|
|
1381
|
+
])), Z = Y.record(Y.string(), Y.record(Y.string(), X.optional())), Rn = Y.union([
|
|
1424
1382
|
Y.string(),
|
|
1425
1383
|
Y.instanceof(Uint8Array),
|
|
1426
1384
|
Y.instanceof(ArrayBuffer),
|
|
1427
|
-
Y.custom(
|
|
1428
|
-
]),
|
|
1385
|
+
Y.custom(rt, { message: "Must be a Buffer" })
|
|
1386
|
+
]), zn = Y.record(Y.string(), Y.string()), Bn = Y.object({
|
|
1429
1387
|
type: Y.literal("text"),
|
|
1430
1388
|
text: Y.string(),
|
|
1431
1389
|
providerOptions: Z.optional()
|
|
1432
|
-
}),
|
|
1390
|
+
}), Vn = Y.object({
|
|
1433
1391
|
type: Y.literal("image"),
|
|
1434
1392
|
image: Y.union([
|
|
1435
|
-
|
|
1393
|
+
Rn,
|
|
1436
1394
|
Y.instanceof(URL),
|
|
1437
|
-
|
|
1395
|
+
zn
|
|
1438
1396
|
]),
|
|
1439
1397
|
mediaType: Y.string().optional(),
|
|
1440
1398
|
providerOptions: Z.optional()
|
|
1441
|
-
}),
|
|
1399
|
+
}), Hn = Y.discriminatedUnion("type", [
|
|
1442
1400
|
Y.object({
|
|
1443
1401
|
type: Y.literal("data"),
|
|
1444
|
-
data:
|
|
1402
|
+
data: Rn
|
|
1445
1403
|
}),
|
|
1446
1404
|
Y.object({
|
|
1447
1405
|
type: Y.literal("url"),
|
|
@@ -1449,54 +1407,54 @@ var Y = {
|
|
|
1449
1407
|
}),
|
|
1450
1408
|
Y.object({
|
|
1451
1409
|
type: Y.literal("reference"),
|
|
1452
|
-
reference:
|
|
1410
|
+
reference: zn
|
|
1453
1411
|
}),
|
|
1454
1412
|
Y.object({
|
|
1455
1413
|
type: Y.literal("text"),
|
|
1456
1414
|
text: Y.string()
|
|
1457
1415
|
})
|
|
1458
|
-
]),
|
|
1416
|
+
]), Un = Y.discriminatedUnion("type", [Y.object({
|
|
1459
1417
|
type: Y.literal("data"),
|
|
1460
|
-
data:
|
|
1418
|
+
data: Rn
|
|
1461
1419
|
}), Y.object({
|
|
1462
1420
|
type: Y.literal("url"),
|
|
1463
1421
|
url: Y.instanceof(URL)
|
|
1464
|
-
})]),
|
|
1422
|
+
})]), Wn = Y.object({
|
|
1465
1423
|
type: Y.literal("file"),
|
|
1466
1424
|
data: Y.union([
|
|
1467
|
-
|
|
1468
|
-
|
|
1425
|
+
Hn,
|
|
1426
|
+
Rn,
|
|
1469
1427
|
Y.instanceof(URL),
|
|
1470
|
-
|
|
1428
|
+
zn
|
|
1471
1429
|
]),
|
|
1472
1430
|
filename: Y.string().optional(),
|
|
1473
1431
|
mediaType: Y.string(),
|
|
1474
1432
|
providerOptions: Z.optional()
|
|
1475
|
-
}),
|
|
1433
|
+
}), Gn = Y.object({
|
|
1476
1434
|
type: Y.literal("reasoning"),
|
|
1477
1435
|
text: Y.string(),
|
|
1478
1436
|
providerOptions: Z.optional()
|
|
1479
|
-
}),
|
|
1437
|
+
}), Kn = Y.object({
|
|
1480
1438
|
type: Y.literal("custom"),
|
|
1481
1439
|
kind: Y.string().transform((e) => e),
|
|
1482
1440
|
providerOptions: Z.optional()
|
|
1483
|
-
}),
|
|
1441
|
+
}), qn = Y.object({
|
|
1484
1442
|
type: Y.literal("reasoning-file"),
|
|
1485
1443
|
data: Y.union([
|
|
1486
|
-
Jn,
|
|
1487
1444
|
Un,
|
|
1445
|
+
Rn,
|
|
1488
1446
|
Y.instanceof(URL)
|
|
1489
1447
|
]),
|
|
1490
1448
|
mediaType: Y.string(),
|
|
1491
1449
|
providerOptions: Z.optional()
|
|
1492
|
-
}),
|
|
1450
|
+
}), Jn = Y.object({
|
|
1493
1451
|
type: Y.literal("tool-call"),
|
|
1494
1452
|
toolCallId: Y.string(),
|
|
1495
1453
|
toolName: Y.string(),
|
|
1496
1454
|
input: Y.unknown(),
|
|
1497
1455
|
providerOptions: Z.optional(),
|
|
1498
1456
|
providerExecuted: Y.boolean().optional()
|
|
1499
|
-
}),
|
|
1457
|
+
}), Yn = Y.discriminatedUnion("type", [
|
|
1500
1458
|
Y.object({
|
|
1501
1459
|
type: Y.literal("text"),
|
|
1502
1460
|
value: Y.string(),
|
|
@@ -1532,7 +1490,7 @@ var Y = {
|
|
|
1532
1490
|
}),
|
|
1533
1491
|
Y.object({
|
|
1534
1492
|
type: Y.literal("file"),
|
|
1535
|
-
data:
|
|
1493
|
+
data: Hn,
|
|
1536
1494
|
mediaType: Y.string(),
|
|
1537
1495
|
filename: Y.string().optional(),
|
|
1538
1496
|
providerOptions: Z.optional()
|
|
@@ -1587,13 +1545,13 @@ var Y = {
|
|
|
1587
1545
|
})
|
|
1588
1546
|
]))
|
|
1589
1547
|
})
|
|
1590
|
-
]),
|
|
1548
|
+
]), Xn = Y.object({
|
|
1591
1549
|
type: Y.literal("tool-result"),
|
|
1592
1550
|
toolCallId: Y.string(),
|
|
1593
1551
|
toolName: Y.string(),
|
|
1594
|
-
output:
|
|
1552
|
+
output: Yn,
|
|
1595
1553
|
providerOptions: Z.optional()
|
|
1596
|
-
}),
|
|
1554
|
+
}), Zn = Y.object({
|
|
1597
1555
|
type: Y.literal("tool-approval-request"),
|
|
1598
1556
|
approvalId: Y.string(),
|
|
1599
1557
|
toolCallId: Y.string(),
|
|
@@ -1601,54 +1559,54 @@ var Y = {
|
|
|
1601
1559
|
isAutomatic: Y.boolean().optional(),
|
|
1602
1560
|
signature: Y.string().optional(),
|
|
1603
1561
|
inputSchemaInput: Y.unknown().optional()
|
|
1604
|
-
}),
|
|
1562
|
+
}), Qn = Y.object({
|
|
1605
1563
|
type: Y.literal("tool-approval-response"),
|
|
1606
1564
|
approvalId: Y.string(),
|
|
1607
1565
|
approved: Y.boolean(),
|
|
1608
1566
|
reason: Y.string().optional()
|
|
1609
|
-
}),
|
|
1567
|
+
}), $n = Y.object({
|
|
1610
1568
|
role: Y.literal("system"),
|
|
1611
1569
|
content: Y.string(),
|
|
1612
1570
|
providerOptions: Z.optional()
|
|
1613
|
-
}),
|
|
1571
|
+
}), er = Y.object({
|
|
1614
1572
|
role: Y.literal("user"),
|
|
1615
1573
|
content: Y.union([Y.string(), Y.array(Y.union([
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1574
|
+
Bn,
|
|
1575
|
+
Vn,
|
|
1576
|
+
Wn
|
|
1619
1577
|
]))]),
|
|
1620
1578
|
providerOptions: Z.optional()
|
|
1621
|
-
}),
|
|
1579
|
+
}), tr = Y.object({
|
|
1622
1580
|
role: Y.literal("assistant"),
|
|
1623
1581
|
content: Y.union([Y.string(), Y.array(Y.union([
|
|
1582
|
+
Bn,
|
|
1583
|
+
Kn,
|
|
1584
|
+
Wn,
|
|
1624
1585
|
Gn,
|
|
1625
|
-
|
|
1626
|
-
|
|
1586
|
+
qn,
|
|
1587
|
+
Jn,
|
|
1627
1588
|
Xn,
|
|
1628
|
-
|
|
1629
|
-
$n,
|
|
1630
|
-
tr,
|
|
1631
|
-
nr
|
|
1589
|
+
Zn
|
|
1632
1590
|
]))]),
|
|
1633
1591
|
providerOptions: Z.optional()
|
|
1634
|
-
}),
|
|
1592
|
+
}), nr = Y.object({
|
|
1635
1593
|
role: Y.literal("tool"),
|
|
1636
|
-
content: Y.array(Y.union([
|
|
1594
|
+
content: Y.array(Y.union([Xn, Qn])),
|
|
1637
1595
|
providerOptions: Z.optional()
|
|
1638
1596
|
});
|
|
1639
1597
|
Y.union([
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
]),
|
|
1645
|
-
array: () =>
|
|
1646
|
-
choice: () =>
|
|
1647
|
-
json: () =>
|
|
1648
|
-
object: () =>
|
|
1649
|
-
text: () =>
|
|
1598
|
+
$n,
|
|
1599
|
+
er,
|
|
1600
|
+
tr,
|
|
1601
|
+
nr
|
|
1602
|
+
]), xn({}, {
|
|
1603
|
+
array: () => sr,
|
|
1604
|
+
choice: () => ur,
|
|
1605
|
+
json: () => dr,
|
|
1606
|
+
object: () => or,
|
|
1607
|
+
text: () => ar
|
|
1650
1608
|
});
|
|
1651
|
-
function
|
|
1609
|
+
function rr(e) {
|
|
1652
1610
|
let t = ["ROOT"], n = -1, r = null, i = 0;
|
|
1653
1611
|
function a(e) {
|
|
1654
1612
|
return e >= "0" && e <= "9" || e >= "A" && e <= "F" || e >= "a" && e <= "f";
|
|
@@ -1830,16 +1788,16 @@ function cr(e) {
|
|
|
1830
1788
|
}
|
|
1831
1789
|
return l;
|
|
1832
1790
|
}
|
|
1833
|
-
async function
|
|
1791
|
+
async function ir(e) {
|
|
1834
1792
|
if (e === void 0) return {
|
|
1835
1793
|
value: void 0,
|
|
1836
1794
|
state: "undefined-input"
|
|
1837
1795
|
};
|
|
1838
|
-
let t = await
|
|
1796
|
+
let t = await W({ text: e });
|
|
1839
1797
|
return t.success ? {
|
|
1840
1798
|
value: t.value,
|
|
1841
1799
|
state: "successful-parse"
|
|
1842
|
-
} : (t = await
|
|
1800
|
+
} : (t = await W({ text: rr(e) }), t.success ? {
|
|
1843
1801
|
value: t.value,
|
|
1844
1802
|
state: "repaired-parse"
|
|
1845
1803
|
} : {
|
|
@@ -1847,7 +1805,7 @@ async function lr(e) {
|
|
|
1847
1805
|
state: "failed-parse"
|
|
1848
1806
|
});
|
|
1849
1807
|
}
|
|
1850
|
-
var
|
|
1808
|
+
var ar = () => ({
|
|
1851
1809
|
name: "text",
|
|
1852
1810
|
responseFormat: Promise.resolve({ type: "text" }),
|
|
1853
1811
|
async parseCompleteOutput({ text: e }) {
|
|
@@ -1857,18 +1815,18 @@ var ur = () => ({
|
|
|
1857
1815
|
return { partial: e };
|
|
1858
1816
|
},
|
|
1859
1817
|
createElementStreamTransform() {}
|
|
1860
|
-
}),
|
|
1861
|
-
let r =
|
|
1818
|
+
}), or = ({ schema: e, name: t, description: n }) => {
|
|
1819
|
+
let r = un(e);
|
|
1862
1820
|
return {
|
|
1863
1821
|
name: "object",
|
|
1864
|
-
responseFormat:
|
|
1822
|
+
responseFormat: G(r.jsonSchema).then((e) => ({
|
|
1865
1823
|
type: "json",
|
|
1866
1824
|
schema: e,
|
|
1867
1825
|
...t != null && { name: t },
|
|
1868
1826
|
...n != null && { description: n }
|
|
1869
1827
|
})),
|
|
1870
1828
|
async parseCompleteOutput({ text: e }, t) {
|
|
1871
|
-
let n = await
|
|
1829
|
+
let n = await W({ text: e });
|
|
1872
1830
|
if (!n.success) throw new q({
|
|
1873
1831
|
message: "No object generated: could not parse the response.",
|
|
1874
1832
|
cause: n.error,
|
|
@@ -1877,7 +1835,7 @@ var ur = () => ({
|
|
|
1877
1835
|
usage: t.usage,
|
|
1878
1836
|
finishReason: t.finishReason
|
|
1879
1837
|
});
|
|
1880
|
-
let i = await
|
|
1838
|
+
let i = await vn({
|
|
1881
1839
|
value: n.value,
|
|
1882
1840
|
schema: r
|
|
1883
1841
|
});
|
|
@@ -1892,7 +1850,7 @@ var ur = () => ({
|
|
|
1892
1850
|
return i.value;
|
|
1893
1851
|
},
|
|
1894
1852
|
async parsePartialOutput({ text: e }) {
|
|
1895
|
-
let t = await
|
|
1853
|
+
let t = await ir(e);
|
|
1896
1854
|
switch (t.state) {
|
|
1897
1855
|
case "failed-parse":
|
|
1898
1856
|
case "undefined-input": return;
|
|
@@ -1902,22 +1860,22 @@ var ur = () => ({
|
|
|
1902
1860
|
},
|
|
1903
1861
|
createElementStreamTransform() {}
|
|
1904
1862
|
};
|
|
1905
|
-
},
|
|
1906
|
-
if (
|
|
1863
|
+
}, sr = ({ element: e, minItems: t, maxItems: n, name: r, description: i }) => {
|
|
1864
|
+
if (cr({
|
|
1907
1865
|
name: "minItems",
|
|
1908
1866
|
value: t
|
|
1909
|
-
}),
|
|
1867
|
+
}), cr({
|
|
1910
1868
|
name: "maxItems",
|
|
1911
1869
|
value: n
|
|
1912
|
-
}), t != null && n != null && t > n) throw new
|
|
1870
|
+
}), t != null && n != null && t > n) throw new K({
|
|
1913
1871
|
parameter: "minItems",
|
|
1914
1872
|
value: t,
|
|
1915
1873
|
message: "minItems must be less than or equal to maxItems"
|
|
1916
1874
|
});
|
|
1917
|
-
let a =
|
|
1875
|
+
let a = un(e);
|
|
1918
1876
|
return {
|
|
1919
1877
|
name: "array",
|
|
1920
|
-
responseFormat:
|
|
1878
|
+
responseFormat: G(a.jsonSchema).then((e) => {
|
|
1921
1879
|
let { $schema: a, definitions: o, $defs: s, ...c } = e;
|
|
1922
1880
|
return {
|
|
1923
1881
|
type: "json",
|
|
@@ -1940,7 +1898,7 @@ var ur = () => ({
|
|
|
1940
1898
|
};
|
|
1941
1899
|
}),
|
|
1942
1900
|
async parseCompleteOutput({ text: e }, r) {
|
|
1943
|
-
let i = await
|
|
1901
|
+
let i = await W({ text: e });
|
|
1944
1902
|
if (!i.success) throw new q({
|
|
1945
1903
|
message: "No object generated: could not parse the response.",
|
|
1946
1904
|
cause: i.error,
|
|
@@ -1952,7 +1910,7 @@ var ur = () => ({
|
|
|
1952
1910
|
let o = i.value;
|
|
1953
1911
|
if (typeof o != "object" || !o || !("elements" in o) || !Array.isArray(o.elements)) throw new q({
|
|
1954
1912
|
message: "No object generated: response did not match schema.",
|
|
1955
|
-
cause: new
|
|
1913
|
+
cause: new N({
|
|
1956
1914
|
value: o,
|
|
1957
1915
|
cause: "response must be an object with an elements array"
|
|
1958
1916
|
}),
|
|
@@ -1961,7 +1919,7 @@ var ur = () => ({
|
|
|
1961
1919
|
usage: r.usage,
|
|
1962
1920
|
finishReason: r.finishReason
|
|
1963
1921
|
});
|
|
1964
|
-
let s =
|
|
1922
|
+
let s = lr({
|
|
1965
1923
|
value: o.elements,
|
|
1966
1924
|
minItems: t,
|
|
1967
1925
|
maxItems: n
|
|
@@ -1976,7 +1934,7 @@ var ur = () => ({
|
|
|
1976
1934
|
});
|
|
1977
1935
|
let c = [];
|
|
1978
1936
|
for (let t of o.elements) {
|
|
1979
|
-
let n = await
|
|
1937
|
+
let n = await vn({
|
|
1980
1938
|
value: t,
|
|
1981
1939
|
schema: a
|
|
1982
1940
|
});
|
|
@@ -1993,7 +1951,7 @@ var ur = () => ({
|
|
|
1993
1951
|
return c;
|
|
1994
1952
|
},
|
|
1995
1953
|
async parsePartialOutput({ text: e }) {
|
|
1996
|
-
let t = await
|
|
1954
|
+
let t = await ir(e);
|
|
1997
1955
|
switch (t.state) {
|
|
1998
1956
|
case "failed-parse":
|
|
1999
1957
|
case "undefined-input": return;
|
|
@@ -2003,7 +1961,7 @@ var ur = () => ({
|
|
|
2003
1961
|
if (typeof e != "object" || !e || !("elements" in e) || !Array.isArray(e.elements)) return;
|
|
2004
1962
|
let n = t.state === "repaired-parse" && e.elements.length > 0 ? e.elements.slice(0, -1) : e.elements, r = [];
|
|
2005
1963
|
for (let e of n) {
|
|
2006
|
-
let t = await
|
|
1964
|
+
let t = await vn({
|
|
2007
1965
|
value: e,
|
|
2008
1966
|
schema: a
|
|
2009
1967
|
});
|
|
@@ -2018,7 +1976,7 @@ var ur = () => ({
|
|
|
2018
1976
|
return new TransformStream({ transform({ partialOutput: t }, r) {
|
|
2019
1977
|
if (t != null) for (; e < t.length; e++) {
|
|
2020
1978
|
if (n != null && e >= n) {
|
|
2021
|
-
r.error(
|
|
1979
|
+
r.error(lr({
|
|
2022
1980
|
value: t,
|
|
2023
1981
|
maxItems: n
|
|
2024
1982
|
}));
|
|
@@ -2030,31 +1988,31 @@ var ur = () => ({
|
|
|
2030
1988
|
}
|
|
2031
1989
|
};
|
|
2032
1990
|
};
|
|
2033
|
-
function
|
|
1991
|
+
function cr({ name: e, value: t }) {
|
|
2034
1992
|
if (t != null) {
|
|
2035
|
-
if (!Number.isInteger(t)) throw new
|
|
1993
|
+
if (!Number.isInteger(t)) throw new K({
|
|
2036
1994
|
parameter: e,
|
|
2037
1995
|
value: t,
|
|
2038
1996
|
message: `${e} must be an integer`
|
|
2039
1997
|
});
|
|
2040
|
-
if (t < 0) throw new
|
|
1998
|
+
if (t < 0) throw new K({
|
|
2041
1999
|
parameter: e,
|
|
2042
2000
|
value: t,
|
|
2043
2001
|
message: `${e} must be greater than or equal to 0`
|
|
2044
2002
|
});
|
|
2045
2003
|
}
|
|
2046
2004
|
}
|
|
2047
|
-
function
|
|
2048
|
-
if (t != null && e.length < t) return new
|
|
2005
|
+
function lr({ value: e, minItems: t, maxItems: n }) {
|
|
2006
|
+
if (t != null && e.length < t) return new N({
|
|
2049
2007
|
value: e,
|
|
2050
2008
|
cause: `elements array must contain at least ${t} items`
|
|
2051
2009
|
});
|
|
2052
|
-
if (n != null && e.length > n) return new
|
|
2010
|
+
if (n != null && e.length > n) return new N({
|
|
2053
2011
|
value: e,
|
|
2054
2012
|
cause: `elements array must contain at most ${n} items`
|
|
2055
2013
|
});
|
|
2056
2014
|
}
|
|
2057
|
-
var
|
|
2015
|
+
var ur = ({ options: e, name: t, description: n }) => ({
|
|
2058
2016
|
name: "choice",
|
|
2059
2017
|
responseFormat: Promise.resolve({
|
|
2060
2018
|
type: "json",
|
|
@@ -2072,7 +2030,7 @@ var hr = ({ options: e, name: t, description: n }) => ({
|
|
|
2072
2030
|
...n != null && { description: n }
|
|
2073
2031
|
}),
|
|
2074
2032
|
async parseCompleteOutput({ text: t }, n) {
|
|
2075
|
-
let r = await
|
|
2033
|
+
let r = await W({ text: t });
|
|
2076
2034
|
if (!r.success) throw new q({
|
|
2077
2035
|
message: "No object generated: could not parse the response.",
|
|
2078
2036
|
cause: r.error,
|
|
@@ -2084,7 +2042,7 @@ var hr = ({ options: e, name: t, description: n }) => ({
|
|
|
2084
2042
|
let i = r.value;
|
|
2085
2043
|
if (typeof i != "object" || !i || !("result" in i) || typeof i.result != "string" || !e.includes(i.result)) throw new q({
|
|
2086
2044
|
message: "No object generated: response did not match schema.",
|
|
2087
|
-
cause: new
|
|
2045
|
+
cause: new N({
|
|
2088
2046
|
value: i,
|
|
2089
2047
|
cause: "response must be an object that contains a choice value."
|
|
2090
2048
|
}),
|
|
@@ -2096,7 +2054,7 @@ var hr = ({ options: e, name: t, description: n }) => ({
|
|
|
2096
2054
|
return i.result;
|
|
2097
2055
|
},
|
|
2098
2056
|
async parsePartialOutput({ text: t }) {
|
|
2099
|
-
let n = await
|
|
2057
|
+
let n = await ir(t);
|
|
2100
2058
|
switch (n.state) {
|
|
2101
2059
|
case "failed-parse":
|
|
2102
2060
|
case "undefined-input": return;
|
|
@@ -2110,7 +2068,7 @@ var hr = ({ options: e, name: t, description: n }) => ({
|
|
|
2110
2068
|
}
|
|
2111
2069
|
},
|
|
2112
2070
|
createElementStreamTransform() {}
|
|
2113
|
-
}),
|
|
2071
|
+
}), dr = ({ name: e, description: t } = {}) => ({
|
|
2114
2072
|
name: "json",
|
|
2115
2073
|
responseFormat: Promise.resolve({
|
|
2116
2074
|
type: "json",
|
|
@@ -2118,7 +2076,7 @@ var hr = ({ options: e, name: t, description: n }) => ({
|
|
|
2118
2076
|
...t != null && { description: t }
|
|
2119
2077
|
}),
|
|
2120
2078
|
async parseCompleteOutput({ text: e }, t) {
|
|
2121
|
-
let n = await
|
|
2079
|
+
let n = await W({ text: e });
|
|
2122
2080
|
if (!n.success) throw new q({
|
|
2123
2081
|
message: "No object generated: could not parse the response.",
|
|
2124
2082
|
cause: n.error,
|
|
@@ -2130,7 +2088,7 @@ var hr = ({ options: e, name: t, description: n }) => ({
|
|
|
2130
2088
|
return n.value;
|
|
2131
2089
|
},
|
|
2132
2090
|
async parsePartialOutput({ text: e }) {
|
|
2133
|
-
let t = await
|
|
2091
|
+
let t = await ir(e);
|
|
2134
2092
|
switch (t.state) {
|
|
2135
2093
|
case "failed-parse":
|
|
2136
2094
|
case "undefined-input": return;
|
|
@@ -2140,14 +2098,14 @@ var hr = ({ options: e, name: t, description: n }) => ({
|
|
|
2140
2098
|
},
|
|
2141
2099
|
createElementStreamTransform() {}
|
|
2142
2100
|
});
|
|
2143
|
-
new TextEncoder(), new TextEncoder(),
|
|
2101
|
+
new TextEncoder(), new TextEncoder(), I({
|
|
2144
2102
|
prefix: "aitxt",
|
|
2145
2103
|
size: 24
|
|
2146
|
-
}),
|
|
2104
|
+
}), I({
|
|
2147
2105
|
prefix: "call",
|
|
2148
2106
|
size: 24
|
|
2149
2107
|
}), TransformStream;
|
|
2150
|
-
var
|
|
2108
|
+
var fr = Y.record(Y.string(), X.optional()), pr = sn(() => gn(Y.union([
|
|
2151
2109
|
Y.looseObject({
|
|
2152
2110
|
type: Y.literal("text-start"),
|
|
2153
2111
|
id: Y.string(),
|
|
@@ -2174,7 +2132,7 @@ var _r = Y.record(Y.string(), X.optional()), vr = on(() => hn(Y.union([
|
|
|
2174
2132
|
toolName: Y.string(),
|
|
2175
2133
|
providerExecuted: Y.boolean().optional(),
|
|
2176
2134
|
providerMetadata: Z.optional(),
|
|
2177
|
-
toolMetadata:
|
|
2135
|
+
toolMetadata: fr.optional(),
|
|
2178
2136
|
dynamic: Y.boolean().optional(),
|
|
2179
2137
|
title: Y.string().optional()
|
|
2180
2138
|
}),
|
|
@@ -2190,7 +2148,7 @@ var _r = Y.record(Y.string(), X.optional()), vr = on(() => hn(Y.union([
|
|
|
2190
2148
|
input: Y.unknown(),
|
|
2191
2149
|
providerExecuted: Y.boolean().optional(),
|
|
2192
2150
|
providerMetadata: Z.optional(),
|
|
2193
|
-
toolMetadata:
|
|
2151
|
+
toolMetadata: fr.optional(),
|
|
2194
2152
|
dynamic: Y.boolean().optional(),
|
|
2195
2153
|
title: Y.string().optional()
|
|
2196
2154
|
}),
|
|
@@ -2201,7 +2159,7 @@ var _r = Y.record(Y.string(), X.optional()), vr = on(() => hn(Y.union([
|
|
|
2201
2159
|
input: Y.unknown(),
|
|
2202
2160
|
providerExecuted: Y.boolean().optional(),
|
|
2203
2161
|
providerMetadata: Z.optional(),
|
|
2204
|
-
toolMetadata:
|
|
2162
|
+
toolMetadata: fr.optional(),
|
|
2205
2163
|
dynamic: Y.boolean().optional(),
|
|
2206
2164
|
errorText: Y.string(),
|
|
2207
2165
|
title: Y.string().optional()
|
|
@@ -2230,7 +2188,7 @@ var _r = Y.record(Y.string(), X.optional()), vr = on(() => hn(Y.union([
|
|
|
2230
2188
|
output: Y.unknown(),
|
|
2231
2189
|
providerExecuted: Y.boolean().optional(),
|
|
2232
2190
|
providerMetadata: Z.optional(),
|
|
2233
|
-
toolMetadata:
|
|
2191
|
+
toolMetadata: fr.optional(),
|
|
2234
2192
|
dynamic: Y.boolean().optional(),
|
|
2235
2193
|
preliminary: Y.boolean().optional()
|
|
2236
2194
|
}),
|
|
@@ -2240,7 +2198,7 @@ var _r = Y.record(Y.string(), X.optional()), vr = on(() => hn(Y.union([
|
|
|
2240
2198
|
errorText: Y.string(),
|
|
2241
2199
|
providerExecuted: Y.boolean().optional(),
|
|
2242
2200
|
providerMetadata: Z.optional(),
|
|
2243
|
-
toolMetadata:
|
|
2201
|
+
toolMetadata: fr.optional(),
|
|
2244
2202
|
dynamic: Y.boolean().optional()
|
|
2245
2203
|
}),
|
|
2246
2204
|
Y.looseObject({
|
|
@@ -2330,46 +2288,51 @@ var _r = Y.record(Y.string(), X.optional()), vr = on(() => hn(Y.union([
|
|
|
2330
2288
|
messageMetadata: Y.unknown()
|
|
2331
2289
|
})
|
|
2332
2290
|
])));
|
|
2333
|
-
function
|
|
2291
|
+
function mr(e) {
|
|
2334
2292
|
return e.type.startsWith("data-");
|
|
2335
2293
|
}
|
|
2336
|
-
function
|
|
2294
|
+
function hr() {
|
|
2337
2295
|
return /* @__PURE__ */ Object.create(null);
|
|
2338
2296
|
}
|
|
2339
|
-
function
|
|
2297
|
+
function gr(e) {
|
|
2340
2298
|
return e.type.startsWith("tool-");
|
|
2341
2299
|
}
|
|
2342
|
-
function
|
|
2300
|
+
function _r(e) {
|
|
2343
2301
|
return e.type === "dynamic-tool";
|
|
2344
2302
|
}
|
|
2345
2303
|
function Q(e) {
|
|
2346
|
-
return
|
|
2304
|
+
return gr(e) || _r(e);
|
|
2347
2305
|
}
|
|
2348
|
-
function
|
|
2306
|
+
function vr(e) {
|
|
2349
2307
|
return e.type.split("-").slice(1).join("-");
|
|
2350
2308
|
}
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2309
|
+
function yr({ lastMessage: e, messageId: t }) {
|
|
2310
|
+
let n = e?.role === "assistant" ? e : {
|
|
2311
|
+
id: t,
|
|
2312
|
+
metadata: void 0,
|
|
2313
|
+
role: "assistant",
|
|
2314
|
+
parts: []
|
|
2315
|
+
}, r = hr(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
|
|
2316
|
+
for (let e of n.parts.slice(i + 1)) {
|
|
2317
|
+
if (!Q(e)) continue;
|
|
2318
|
+
let t = a;
|
|
2319
|
+
gr(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
|
|
2320
|
+
text: e.rawInput ?? "",
|
|
2321
|
+
index: t,
|
|
2322
|
+
toolName: e.type === "dynamic-tool" ? e.toolName : vr(e),
|
|
2323
|
+
dynamic: e.type === "dynamic-tool",
|
|
2324
|
+
title: e.title,
|
|
2325
|
+
toolMetadata: e.toolMetadata
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2360
2328
|
return {
|
|
2361
|
-
message:
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
parts: []
|
|
2366
|
-
},
|
|
2367
|
-
activeTextParts: br(),
|
|
2368
|
-
activeReasoningParts: br(),
|
|
2369
|
-
partialToolCalls: br()
|
|
2329
|
+
message: n,
|
|
2330
|
+
activeTextParts: hr(),
|
|
2331
|
+
activeReasoningParts: hr(),
|
|
2332
|
+
partialToolCalls: r
|
|
2370
2333
|
};
|
|
2371
2334
|
}
|
|
2372
|
-
function
|
|
2335
|
+
function br({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o }) {
|
|
2373
2336
|
return e.pipeThrough(new TransformStream({ async transform(e, s) {
|
|
2374
2337
|
await r(async ({ state: r, write: c }) => {
|
|
2375
2338
|
function l() {
|
|
@@ -2409,7 +2372,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2409
2372
|
return t;
|
|
2410
2373
|
}
|
|
2411
2374
|
function p(e, t) {
|
|
2412
|
-
let n = t ?? l().find((t) =>
|
|
2375
|
+
let n = t ?? l().find((t) => gr(t) && t.toolCallId === e.toolCallId), i = e, a = n;
|
|
2413
2376
|
if (n != null) {
|
|
2414
2377
|
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;
|
|
2415
2378
|
let t = i.providerMetadata;
|
|
@@ -2438,7 +2401,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2438
2401
|
function m(e, t) {
|
|
2439
2402
|
let n = t ?? l().find((t) => t.type === "dynamic-tool" && t.toolCallId === e.toolCallId), i = e, a = n;
|
|
2440
2403
|
if (n != null) {
|
|
2441
|
-
n.state = e.state, a.toolName = e.toolName, a.input = i.input, a.output = i.output, a.errorText = i.errorText, a.rawInput = i.rawInput
|
|
2404
|
+
n.state = e.state, a.toolName = e.toolName, 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;
|
|
2442
2405
|
let t = i.providerMetadata;
|
|
2443
2406
|
if (t != null) {
|
|
2444
2407
|
if (e.state === "output-available" || e.state === "output-error") {
|
|
@@ -2464,8 +2427,8 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2464
2427
|
}
|
|
2465
2428
|
async function h(e) {
|
|
2466
2429
|
if (e != null) {
|
|
2467
|
-
let n = r.message.metadata == null ? e :
|
|
2468
|
-
t != null && await
|
|
2430
|
+
let n = r.message.metadata == null ? e : Ln(r.message.metadata, e);
|
|
2431
|
+
t != null && await _n({
|
|
2469
2432
|
value: n,
|
|
2470
2433
|
schema: t,
|
|
2471
2434
|
context: {
|
|
@@ -2575,7 +2538,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2575
2538
|
}), c();
|
|
2576
2539
|
break;
|
|
2577
2540
|
case "tool-input-start": {
|
|
2578
|
-
let t = l().filter(
|
|
2541
|
+
let t = l().filter(gr);
|
|
2579
2542
|
r.partialToolCalls[e.toolCallId] = {
|
|
2580
2543
|
text: "",
|
|
2581
2544
|
toolName: e.toolName,
|
|
@@ -2612,12 +2575,13 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2612
2575
|
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.`
|
|
2613
2576
|
});
|
|
2614
2577
|
t.text += e.inputTextDelta;
|
|
2615
|
-
let { value: n } = await
|
|
2578
|
+
let { value: n } = await ir(t.text);
|
|
2616
2579
|
t.dynamic ? m({
|
|
2617
2580
|
toolCallId: e.toolCallId,
|
|
2618
2581
|
toolName: t.toolName,
|
|
2619
2582
|
state: "input-streaming",
|
|
2620
2583
|
input: n,
|
|
2584
|
+
rawInput: t.text,
|
|
2621
2585
|
title: t.title,
|
|
2622
2586
|
toolMetadata: t.toolMetadata
|
|
2623
2587
|
}) : p({
|
|
@@ -2625,6 +2589,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2625
2589
|
toolName: t.toolName,
|
|
2626
2590
|
state: "input-streaming",
|
|
2627
2591
|
input: n,
|
|
2592
|
+
rawInput: t.text,
|
|
2628
2593
|
title: t.title,
|
|
2629
2594
|
toolMetadata: t.toolMetadata
|
|
2630
2595
|
}), c();
|
|
@@ -2662,17 +2627,16 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2662
2627
|
providerExecuted: e.providerExecuted,
|
|
2663
2628
|
providerMetadata: e.providerMetadata,
|
|
2664
2629
|
toolMetadata: e.toolMetadata
|
|
2665
|
-
}) :
|
|
2630
|
+
}) : p({
|
|
2666
2631
|
toolCallId: e.toolCallId,
|
|
2667
2632
|
toolName: e.toolName,
|
|
2668
2633
|
state: "output-error",
|
|
2669
|
-
input:
|
|
2670
|
-
rawInput: e.input,
|
|
2634
|
+
input: e.input,
|
|
2671
2635
|
errorText: e.errorText,
|
|
2672
2636
|
providerExecuted: e.providerExecuted,
|
|
2673
2637
|
providerMetadata: e.providerMetadata,
|
|
2674
2638
|
toolMetadata: e.toolMetadata
|
|
2675
|
-
}),
|
|
2639
|
+
}), c();
|
|
2676
2640
|
break;
|
|
2677
2641
|
}
|
|
2678
2642
|
case "tool-approval-request": {
|
|
@@ -2714,10 +2678,10 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2714
2678
|
providerExecuted: e.providerExecuted,
|
|
2715
2679
|
providerMetadata: e.providerMetadata,
|
|
2716
2680
|
title: t.title,
|
|
2717
|
-
toolMetadata: t.toolMetadata
|
|
2681
|
+
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2718
2682
|
}, t) : p({
|
|
2719
2683
|
toolCallId: e.toolCallId,
|
|
2720
|
-
toolName:
|
|
2684
|
+
toolName: vr(t),
|
|
2721
2685
|
state: "output-available",
|
|
2722
2686
|
input: t.input,
|
|
2723
2687
|
output: e.output,
|
|
@@ -2725,7 +2689,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2725
2689
|
preliminary: e.preliminary,
|
|
2726
2690
|
providerMetadata: e.providerMetadata,
|
|
2727
2691
|
title: t.title,
|
|
2728
|
-
toolMetadata: t.toolMetadata
|
|
2692
|
+
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2729
2693
|
}, t), c();
|
|
2730
2694
|
break;
|
|
2731
2695
|
}
|
|
@@ -2740,10 +2704,10 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2740
2704
|
providerExecuted: e.providerExecuted,
|
|
2741
2705
|
providerMetadata: e.providerMetadata,
|
|
2742
2706
|
title: t.title,
|
|
2743
|
-
toolMetadata: t.toolMetadata
|
|
2707
|
+
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2744
2708
|
}, t) : p({
|
|
2745
2709
|
toolCallId: e.toolCallId,
|
|
2746
|
-
toolName:
|
|
2710
|
+
toolName: vr(t),
|
|
2747
2711
|
state: "output-error",
|
|
2748
2712
|
input: t.input,
|
|
2749
2713
|
rawInput: t.rawInput,
|
|
@@ -2751,7 +2715,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2751
2715
|
providerExecuted: e.providerExecuted,
|
|
2752
2716
|
providerMetadata: e.providerMetadata,
|
|
2753
2717
|
title: t.title,
|
|
2754
|
-
toolMetadata: t.toolMetadata
|
|
2718
|
+
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2755
2719
|
}, t), c();
|
|
2756
2720
|
break;
|
|
2757
2721
|
}
|
|
@@ -2761,7 +2725,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2761
2725
|
case "finish-step": break;
|
|
2762
2726
|
case "reset-step": {
|
|
2763
2727
|
let e = l();
|
|
2764
|
-
r.activeTextParts =
|
|
2728
|
+
r.activeTextParts = hr(), r.activeReasoningParts = hr(), r.partialToolCalls = hr(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), c());
|
|
2765
2729
|
break;
|
|
2766
2730
|
}
|
|
2767
2731
|
case "start":
|
|
@@ -2776,10 +2740,10 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2776
2740
|
case "error":
|
|
2777
2741
|
i?.(Error(e.errorText));
|
|
2778
2742
|
break;
|
|
2779
|
-
default: if (
|
|
2743
|
+
default: if (mr(e)) {
|
|
2780
2744
|
if (n?.[e.type] != null) {
|
|
2781
2745
|
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;
|
|
2782
|
-
await
|
|
2746
|
+
await _n({
|
|
2783
2747
|
value: e.data,
|
|
2784
2748
|
schema: n[e.type],
|
|
2785
2749
|
context: {
|
|
@@ -2802,7 +2766,7 @@ function Dr({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2802
2766
|
});
|
|
2803
2767
|
} }));
|
|
2804
2768
|
}
|
|
2805
|
-
async function
|
|
2769
|
+
async function xr({ stream: e, onError: t, abortSignal: n }) {
|
|
2806
2770
|
let r = e.getReader(), i = () => {
|
|
2807
2771
|
r.cancel().catch(() => {});
|
|
2808
2772
|
};
|
|
@@ -2818,32 +2782,32 @@ async function Or({ stream: e, onError: t, abortSignal: n }) {
|
|
|
2818
2782
|
n?.removeEventListener("abort", i), r.releaseLock();
|
|
2819
2783
|
}
|
|
2820
2784
|
}
|
|
2821
|
-
|
|
2785
|
+
I({
|
|
2822
2786
|
prefix: "aitxt",
|
|
2823
2787
|
size: 24
|
|
2824
|
-
}),
|
|
2788
|
+
}), I({
|
|
2825
2789
|
prefix: "call",
|
|
2826
2790
|
size: 24
|
|
2827
|
-
}),
|
|
2791
|
+
}), I({
|
|
2828
2792
|
prefix: "aitxt",
|
|
2829
2793
|
size: 24
|
|
2830
|
-
}),
|
|
2794
|
+
}), I({
|
|
2831
2795
|
prefix: "call",
|
|
2832
2796
|
size: 24
|
|
2833
|
-
}), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()),
|
|
2797
|
+
}), Y.record(Y.string(), X.optional()), Y.record(Y.string(), Y.string()), I({
|
|
2834
2798
|
prefix: "call",
|
|
2835
2799
|
size: 24
|
|
2836
|
-
}),
|
|
2800
|
+
}), I({
|
|
2837
2801
|
prefix: "call",
|
|
2838
2802
|
size: 24
|
|
2839
|
-
}), new TextEncoder(),
|
|
2803
|
+
}), new TextEncoder(), I({
|
|
2840
2804
|
prefix: "call",
|
|
2841
2805
|
size: 24
|
|
2842
|
-
}),
|
|
2806
|
+
}), I({
|
|
2843
2807
|
prefix: "aiobj",
|
|
2844
2808
|
size: 24
|
|
2845
2809
|
});
|
|
2846
|
-
var { atob:
|
|
2810
|
+
var { atob: Sr } = globalThis, Cr = class {
|
|
2847
2811
|
constructor() {
|
|
2848
2812
|
this.queue = [], this.isProcessing = !1;
|
|
2849
2813
|
}
|
|
@@ -2865,7 +2829,7 @@ var { atob: kr } = globalThis, Ar = class {
|
|
|
2865
2829
|
});
|
|
2866
2830
|
}
|
|
2867
2831
|
};
|
|
2868
|
-
|
|
2832
|
+
I({
|
|
2869
2833
|
prefix: "aiobj",
|
|
2870
2834
|
size: 24
|
|
2871
2835
|
}), Y.object({
|
|
@@ -2885,13 +2849,13 @@ L({
|
|
|
2885
2849
|
description: Y.string().optional(),
|
|
2886
2850
|
parameters: Y.record(Y.string(), Y.unknown())
|
|
2887
2851
|
})).optional()
|
|
2888
|
-
}),
|
|
2852
|
+
}), I({
|
|
2889
2853
|
prefix: "call",
|
|
2890
2854
|
size: 24
|
|
2891
2855
|
});
|
|
2892
|
-
async function
|
|
2856
|
+
async function wr({ response: e, url: t, fallbackMessage: n }) {
|
|
2893
2857
|
let r = await e.text();
|
|
2894
|
-
return new
|
|
2858
|
+
return new Ce({
|
|
2895
2859
|
message: r || n,
|
|
2896
2860
|
url: t,
|
|
2897
2861
|
requestBodyValues: void 0,
|
|
@@ -2899,9 +2863,9 @@ async function jr({ response: e, url: t, fallbackMessage: n }) {
|
|
|
2899
2863
|
responseBody: r
|
|
2900
2864
|
});
|
|
2901
2865
|
}
|
|
2902
|
-
async function
|
|
2866
|
+
async function Tr(e) {
|
|
2903
2867
|
if (e == null) return [];
|
|
2904
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
2868
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Ke({
|
|
2905
2869
|
functionality: "FileList",
|
|
2906
2870
|
message: "FileList is not supported in the current environment"
|
|
2907
2871
|
});
|
|
@@ -2920,19 +2884,19 @@ async function Mr(e) {
|
|
|
2920
2884
|
};
|
|
2921
2885
|
}));
|
|
2922
2886
|
}
|
|
2923
|
-
function
|
|
2887
|
+
function Er(e, t) {
|
|
2924
2888
|
let n = e.search(/[?#]/);
|
|
2925
2889
|
return n === -1 ? `${e}${t}` : `${e.slice(0, n)}${t}${e.slice(n)}`;
|
|
2926
2890
|
}
|
|
2927
|
-
var
|
|
2891
|
+
var Dr = class {
|
|
2928
2892
|
constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
|
|
2929
2893
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
2930
2894
|
}
|
|
2931
2895
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
2932
|
-
let n = await
|
|
2933
|
-
...
|
|
2934
|
-
...
|
|
2935
|
-
}, o = await this.prepareSendMessagesRequest?.
|
|
2896
|
+
let n = await G(this.body), r = await G(this.headers), i = await G(this.credentials), a = {
|
|
2897
|
+
...F(r),
|
|
2898
|
+
...F(t.headers)
|
|
2899
|
+
}, o = await this.prepareSendMessagesRequest?.({
|
|
2936
2900
|
api: this.api,
|
|
2937
2901
|
id: t.chatId,
|
|
2938
2902
|
messages: t.messages,
|
|
@@ -2945,7 +2909,7 @@ var Pr = class {
|
|
|
2945
2909
|
requestMetadata: t.metadata,
|
|
2946
2910
|
trigger: t.trigger,
|
|
2947
2911
|
messageId: t.messageId
|
|
2948
|
-
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a :
|
|
2912
|
+
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : F(o.headers), l = o?.body === void 0 ? {
|
|
2949
2913
|
...n,
|
|
2950
2914
|
...t.body,
|
|
2951
2915
|
id: t.chatId,
|
|
@@ -2962,19 +2926,19 @@ var Pr = class {
|
|
|
2962
2926
|
credentials: u,
|
|
2963
2927
|
signal: e
|
|
2964
2928
|
});
|
|
2965
|
-
if (!d.ok) throw await
|
|
2929
|
+
if (!d.ok) throw await wr({
|
|
2966
2930
|
response: d,
|
|
2967
2931
|
url: s,
|
|
2968
2932
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2969
2933
|
});
|
|
2970
|
-
if (!d.body) throw new
|
|
2934
|
+
if (!d.body) throw new Oe({ message: "The response body is empty." });
|
|
2971
2935
|
return this.processResponseStream(d.body);
|
|
2972
2936
|
}
|
|
2973
2937
|
async reconnectToStream(e) {
|
|
2974
|
-
let t = await
|
|
2975
|
-
...
|
|
2976
|
-
...
|
|
2977
|
-
}, a = await this.prepareReconnectToStreamRequest?.
|
|
2938
|
+
let t = await G(this.body), n = await G(this.headers), r = await G(this.credentials), i = {
|
|
2939
|
+
...F(n),
|
|
2940
|
+
...F(e.headers)
|
|
2941
|
+
}, a = await this.prepareReconnectToStreamRequest?.({
|
|
2978
2942
|
api: this.api,
|
|
2979
2943
|
id: e.chatId,
|
|
2980
2944
|
body: {
|
|
@@ -2984,37 +2948,46 @@ var Pr = class {
|
|
|
2984
2948
|
headers: i,
|
|
2985
2949
|
credentials: r,
|
|
2986
2950
|
requestMetadata: e.metadata
|
|
2987
|
-
}), o = a?.api
|
|
2951
|
+
}), o = a?.api;
|
|
2952
|
+
if (o == null) {
|
|
2953
|
+
if (e.chatId === "." || e.chatId === "..") throw new K({
|
|
2954
|
+
parameter: "chatId",
|
|
2955
|
+
value: e.chatId,
|
|
2956
|
+
message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
|
|
2957
|
+
});
|
|
2958
|
+
o = Er(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
|
|
2959
|
+
}
|
|
2960
|
+
let s = a?.headers === void 0 ? i : F(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
2988
2961
|
method: "GET",
|
|
2989
2962
|
headers: s,
|
|
2990
2963
|
credentials: c,
|
|
2991
2964
|
signal: e.abortSignal
|
|
2992
2965
|
});
|
|
2993
2966
|
if (l.status === 204) return null;
|
|
2994
|
-
if (!l.ok) throw await
|
|
2967
|
+
if (!l.ok) throw await wr({
|
|
2995
2968
|
response: l,
|
|
2996
2969
|
url: o,
|
|
2997
2970
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2998
2971
|
});
|
|
2999
|
-
if (!l.body) throw new
|
|
2972
|
+
if (!l.body) throw new Oe({ message: "The response body is empty." });
|
|
3000
2973
|
return this.processResponseStream(l.body);
|
|
3001
2974
|
}
|
|
3002
|
-
},
|
|
2975
|
+
}, Or = class extends Dr {
|
|
3003
2976
|
constructor(e = {}) {
|
|
3004
2977
|
super(e);
|
|
3005
2978
|
}
|
|
3006
2979
|
processResponseStream(e) {
|
|
3007
|
-
return
|
|
2980
|
+
return yn({
|
|
3008
2981
|
stream: e,
|
|
3009
|
-
schema:
|
|
2982
|
+
schema: pr
|
|
3010
2983
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
3011
2984
|
if (!e.success) throw e.error;
|
|
3012
2985
|
t.enqueue(e.value);
|
|
3013
2986
|
} }));
|
|
3014
2987
|
}
|
|
3015
|
-
},
|
|
3016
|
-
constructor({ generateId: e =
|
|
3017
|
-
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.jobExecutor = new
|
|
2988
|
+
}, kr = class {
|
|
2989
|
+
constructor({ generateId: e = L, id: t = e(), transport: n = new Or(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
|
|
2990
|
+
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new Cr(), this.sendMessage = async (e, t) => {
|
|
3018
2991
|
if (e == null) {
|
|
3019
2992
|
let e = this.pendingApprovalMessageId;
|
|
3020
2993
|
if (e == null) {
|
|
@@ -3041,7 +3014,7 @@ var Pr = class {
|
|
|
3041
3014
|
this.pendingMessagePreparations.add(t);
|
|
3042
3015
|
let r;
|
|
3043
3016
|
try {
|
|
3044
|
-
r = Array.isArray(e.files) ? e.files : await
|
|
3017
|
+
r = Array.isArray(e.files) ? e.files : await Tr(e.files);
|
|
3045
3018
|
} finally {
|
|
3046
3019
|
this.pendingMessagePreparations.delete(t);
|
|
3047
3020
|
}
|
|
@@ -3053,12 +3026,12 @@ var Pr = class {
|
|
|
3053
3026
|
} else n = e;
|
|
3054
3027
|
if (e.messageId != null) {
|
|
3055
3028
|
let t = this.state.messages.findIndex((t) => t.id === e.messageId);
|
|
3056
|
-
if (t === -1) throw new
|
|
3029
|
+
if (t === -1) throw new K({
|
|
3057
3030
|
parameter: "message.messageId",
|
|
3058
3031
|
value: e.messageId,
|
|
3059
3032
|
message: `message with id ${e.messageId} not found`
|
|
3060
3033
|
});
|
|
3061
|
-
if (this.state.messages[t].role !== "user") throw new
|
|
3034
|
+
if (this.state.messages[t].role !== "user") throw new K({
|
|
3062
3035
|
parameter: "message.messageId",
|
|
3063
3036
|
value: e.messageId,
|
|
3064
3037
|
message: `message with id ${e.messageId} is not a user message`
|
|
@@ -3082,7 +3055,7 @@ var Pr = class {
|
|
|
3082
3055
|
});
|
|
3083
3056
|
}, this.regenerate = async ({ messageId: e, ...t } = {}) => {
|
|
3084
3057
|
let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
|
|
3085
|
-
if (n === -1) throw new
|
|
3058
|
+
if (n === -1) throw new K({
|
|
3086
3059
|
parameter: "messageId",
|
|
3087
3060
|
value: e,
|
|
3088
3061
|
message: `message ${e} not found`
|
|
@@ -3145,9 +3118,8 @@ var Pr = class {
|
|
|
3145
3118
|
});
|
|
3146
3119
|
});
|
|
3147
3120
|
}), this.addToolResult = this.addToolOutput, this.stop = async () => {
|
|
3148
|
-
var e, t;
|
|
3149
3121
|
for (let e of this.pendingMessagePreparations) e.abort();
|
|
3150
|
-
|
|
3122
|
+
this.activeResumeRequest?.abortController.abort(), this.activeResponse?.abortController.abort();
|
|
3151
3123
|
}, this.id = t, this.transport = n, this.generateId = e, this.messageMetadataSchema = r, this.dataPartSchemas = i, this.state = a, this.onError = o, this.onToolCall = s, this.onFinish = c, this.onData = l, this.sendAutomaticallyWhen = u;
|
|
3152
3124
|
}
|
|
3153
3125
|
get status() {
|
|
@@ -3182,112 +3154,112 @@ var Pr = class {
|
|
|
3182
3154
|
}), r && this.status === "error" && this.pendingApprovalMessageId == null && (this.pendingApprovalMessageId = this.state.messages[t]?.id ?? e);
|
|
3183
3155
|
}
|
|
3184
3156
|
async makeRequest({ trigger: e, metadata: t, headers: n, body: r, messageId: i }) {
|
|
3185
|
-
|
|
3186
|
-
let
|
|
3187
|
-
|
|
3188
|
-
let
|
|
3189
|
-
this.activeResumeRequest ===
|
|
3190
|
-
},
|
|
3157
|
+
e !== "resume-stream" && (this.resumableStreamState = void 0);
|
|
3158
|
+
let a = new AbortController(), o = e === "resume-stream" ? { abortController: a } : void 0;
|
|
3159
|
+
o && (this.activeResumeRequest?.abortController.abort(), this.activeResumeRequest = o);
|
|
3160
|
+
let s = () => o == null || this.activeResumeRequest === o, c = () => {
|
|
3161
|
+
this.activeResumeRequest === o && (this.activeResumeRequest = void 0);
|
|
3162
|
+
}, l;
|
|
3191
3163
|
if (e === "resume-stream") try {
|
|
3192
3164
|
let e = await this.transport.reconnectToStream({
|
|
3193
3165
|
chatId: this.id,
|
|
3194
|
-
abortSignal:
|
|
3166
|
+
abortSignal: a.signal,
|
|
3195
3167
|
metadata: t,
|
|
3196
3168
|
headers: n,
|
|
3197
3169
|
body: r
|
|
3198
3170
|
});
|
|
3199
|
-
if (
|
|
3200
|
-
await e?.cancel().catch(() => {}),
|
|
3171
|
+
if (a.signal.aborted || !s()) {
|
|
3172
|
+
await e?.cancel().catch(() => {}), s() && (this.setStatus({ status: "ready" }), this.resumableStreamState = void 0), c();
|
|
3201
3173
|
return;
|
|
3202
3174
|
}
|
|
3203
3175
|
if (e == null) {
|
|
3204
|
-
this.setStatus({ status: "ready" }),
|
|
3176
|
+
this.setStatus({ status: "ready" }), this.resumableStreamState = void 0, c();
|
|
3205
3177
|
return;
|
|
3206
3178
|
}
|
|
3207
|
-
|
|
3179
|
+
l = e;
|
|
3208
3180
|
} catch (e) {
|
|
3209
|
-
if (
|
|
3210
|
-
|
|
3181
|
+
if (a.signal.aborted || e.name === "AbortError") {
|
|
3182
|
+
s() && (this.setStatus({ status: "ready" }), this.resumableStreamState = void 0), c();
|
|
3211
3183
|
return;
|
|
3212
3184
|
}
|
|
3213
|
-
if (!
|
|
3185
|
+
if (!s()) return;
|
|
3214
3186
|
this.onError && e instanceof Error && this.onError(e), this.setStatus({
|
|
3215
3187
|
status: "error",
|
|
3216
3188
|
error: e
|
|
3217
|
-
}),
|
|
3189
|
+
}), c();
|
|
3218
3190
|
return;
|
|
3219
3191
|
}
|
|
3220
3192
|
this.setStatus({
|
|
3221
3193
|
status: "submitted",
|
|
3222
3194
|
error: void 0
|
|
3223
3195
|
});
|
|
3224
|
-
let
|
|
3196
|
+
let u = this.lastMessage, d = e === "submit-message" && i != null ? this.state.messages.findIndex((e) => e.id === i) : this.state.messages.length - 1, f = d === -1 ? u : this.state.messages[d], p = e === "resume-stream" && f?.role === "assistant" && f.parts.some((e) => Q(e) && e.state === "input-streaming") ? this.state.snapshot(f) : void 0, m = d !== -1 && d < this.state.messages.length - 1 && f?.role === "assistant", h = !1, g = !1, _ = !1, v;
|
|
3225
3197
|
try {
|
|
3226
|
-
let
|
|
3227
|
-
state:
|
|
3228
|
-
lastMessage: e === "resume-stream"
|
|
3198
|
+
let o = {
|
|
3199
|
+
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : yr({
|
|
3200
|
+
lastMessage: e === "resume-stream" ? p : e === "regenerate-message" ? void 0 : this.state.snapshot(f),
|
|
3229
3201
|
messageId: this.generateId()
|
|
3230
3202
|
}),
|
|
3231
|
-
abortController:
|
|
3203
|
+
abortController: a
|
|
3232
3204
|
};
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
}), this.activeResponse =
|
|
3236
|
-
let
|
|
3237
|
-
if (
|
|
3205
|
+
v = o, o.abortController.signal.addEventListener("abort", () => {
|
|
3206
|
+
h = !0;
|
|
3207
|
+
}), this.activeResponse = o;
|
|
3208
|
+
let c;
|
|
3209
|
+
if (c = e === "resume-stream" ? l : await this.transport.sendMessages({
|
|
3238
3210
|
chatId: this.id,
|
|
3239
3211
|
messages: this.state.messages,
|
|
3240
|
-
abortSignal:
|
|
3212
|
+
abortSignal: o.abortController.signal,
|
|
3241
3213
|
metadata: t,
|
|
3242
3214
|
headers: n,
|
|
3243
3215
|
body: r,
|
|
3244
3216
|
trigger: e,
|
|
3245
3217
|
messageId: i
|
|
3246
|
-
}), await
|
|
3247
|
-
stream:
|
|
3248
|
-
stream:
|
|
3218
|
+
}), await xr({
|
|
3219
|
+
stream: br({
|
|
3220
|
+
stream: c,
|
|
3249
3221
|
onToolCall: this.onToolCall,
|
|
3250
3222
|
onData: this.onData,
|
|
3251
3223
|
messageMetadataSchema: this.messageMetadataSchema,
|
|
3252
3224
|
dataPartSchemas: this.dataPartSchemas,
|
|
3253
|
-
runUpdateMessageJob: (e) => this.jobExecutor.run(() =>
|
|
3254
|
-
state:
|
|
3225
|
+
runUpdateMessageJob: (e) => this.jobExecutor.run(() => o.abortController.signal.aborted ? Promise.resolve() : e({
|
|
3226
|
+
state: o.state,
|
|
3255
3227
|
write: ({ updateStatus: e = !0 } = {}) => {
|
|
3256
|
-
|
|
3228
|
+
o.abortController.signal.aborted || (e && this.setStatus({ status: "streaming" }), m ? this.state.replaceMessage(d, o.state.message) : o.state.message.id === this.lastMessage?.id ? this.state.replaceMessage(this.state.messages.length - 1, o.state.message) : this.state.pushMessage(o.state.message));
|
|
3257
3229
|
}
|
|
3258
3230
|
})),
|
|
3259
3231
|
onError: (e) => {
|
|
3260
3232
|
throw e;
|
|
3261
3233
|
}
|
|
3262
3234
|
}),
|
|
3263
|
-
abortSignal:
|
|
3235
|
+
abortSignal: o.abortController.signal,
|
|
3264
3236
|
onError: (e) => {
|
|
3265
3237
|
throw e;
|
|
3266
3238
|
}
|
|
3267
|
-
}),
|
|
3268
|
-
|
|
3239
|
+
}), h) return s() && (this.setStatus({ status: "ready" }), this.resumableStreamState === o.state && (this.resumableStreamState = void 0)), null;
|
|
3240
|
+
s() && (this.setStatus({ status: "ready" }), this.resumableStreamState === o.state && (this.resumableStreamState = void 0));
|
|
3269
3241
|
} catch (e) {
|
|
3270
|
-
if (
|
|
3271
|
-
if (!
|
|
3272
|
-
|
|
3242
|
+
if (h || e.name === "AbortError") return h = !0, s() && (this.setStatus({ status: "ready" }), this.resumableStreamState === v?.state && (this.resumableStreamState = void 0)), null;
|
|
3243
|
+
if (!s()) return null;
|
|
3244
|
+
_ = !0, e instanceof TypeError && (e.message.toLowerCase().includes("fetch") || e.message.toLowerCase().includes("network")) && (g = !0), g ? this.resumableStreamState = v?.state : this.resumableStreamState === v?.state && (this.resumableStreamState = void 0), this.onError && e instanceof Error && this.onError(e), this.setStatus({
|
|
3273
3245
|
status: "error",
|
|
3274
3246
|
error: e
|
|
3275
3247
|
});
|
|
3276
3248
|
} finally {
|
|
3277
3249
|
try {
|
|
3278
|
-
|
|
3279
|
-
message:
|
|
3250
|
+
v && this.onFinish?.({
|
|
3251
|
+
message: v.state.message,
|
|
3280
3252
|
messages: this.state.messages,
|
|
3281
|
-
isAbort:
|
|
3282
|
-
isDisconnect:
|
|
3283
|
-
isError:
|
|
3284
|
-
finishReason:
|
|
3285
|
-
})
|
|
3253
|
+
isAbort: h,
|
|
3254
|
+
isDisconnect: g,
|
|
3255
|
+
isError: _,
|
|
3256
|
+
finishReason: v.state.finishReason
|
|
3257
|
+
});
|
|
3286
3258
|
} finally {
|
|
3287
|
-
this.activeResponse ===
|
|
3259
|
+
this.activeResponse === v && (this.activeResponse = void 0), c();
|
|
3288
3260
|
}
|
|
3289
3261
|
}
|
|
3290
|
-
!
|
|
3262
|
+
!_ && await this.shouldSendAutomatically() && await this.makeRequest({
|
|
3291
3263
|
trigger: "submit-message",
|
|
3292
3264
|
messageId: this.lastMessage?.id,
|
|
3293
3265
|
metadata: t,
|
|
@@ -3296,7 +3268,7 @@ var Pr = class {
|
|
|
3296
3268
|
});
|
|
3297
3269
|
}
|
|
3298
3270
|
};
|
|
3299
|
-
function
|
|
3271
|
+
function Ar({ messages: e }) {
|
|
3300
3272
|
let t = e[e.length - 1];
|
|
3301
3273
|
if (!t || t.role !== "assistant") return !1;
|
|
3302
3274
|
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Q);
|
|
@@ -3304,31 +3276,31 @@ function Lr({ messages: e }) {
|
|
|
3304
3276
|
}
|
|
3305
3277
|
//#endregion
|
|
3306
3278
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.43_typescript@6.0.3_/node_modules/swrv/esm/lib/hash.js
|
|
3307
|
-
var
|
|
3308
|
-
function
|
|
3279
|
+
var jr = /* @__PURE__ */ new WeakMap(), Mr = 0;
|
|
3280
|
+
function Nr(e) {
|
|
3309
3281
|
if (!e.length) return "";
|
|
3310
3282
|
for (var t = "arg", n = 0; n < e.length; ++n) {
|
|
3311
3283
|
var r = void 0;
|
|
3312
|
-
e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) :
|
|
3284
|
+
e[n] === null || typeof e[n] != "object" && typeof e[n] != "function" ? r = typeof e[n] == "string" ? "\"" + e[n] + "\"" : String(e[n]) : jr.has(e[n]) ? r = jr.get(e[n]) : (r = Mr, jr.set(e[n], Mr++)), t += "@" + r;
|
|
3313
3285
|
}
|
|
3314
3286
|
return t;
|
|
3315
3287
|
}
|
|
3316
3288
|
//#endregion
|
|
3317
3289
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.43_typescript@6.0.3_/node_modules/swrv/esm/cache/index.js
|
|
3318
|
-
function
|
|
3290
|
+
function Pr(e) {
|
|
3319
3291
|
if (typeof e == "function") try {
|
|
3320
3292
|
e = e();
|
|
3321
3293
|
} catch {
|
|
3322
3294
|
e = "";
|
|
3323
3295
|
}
|
|
3324
|
-
return e = Array.isArray(e) ?
|
|
3296
|
+
return e = Array.isArray(e) ? Nr(e) : String(e || ""), e;
|
|
3325
3297
|
}
|
|
3326
|
-
var
|
|
3298
|
+
var Fr = function() {
|
|
3327
3299
|
function e(e) {
|
|
3328
3300
|
e === void 0 && (e = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = e;
|
|
3329
3301
|
}
|
|
3330
3302
|
return e.prototype.serializeKey = function(e) {
|
|
3331
|
-
return
|
|
3303
|
+
return Pr(e);
|
|
3332
3304
|
}, e.prototype.get = function(e) {
|
|
3333
3305
|
var t = this.serializeKey(e);
|
|
3334
3306
|
return this.items.get(t);
|
|
@@ -3350,15 +3322,15 @@ var Hr = function() {
|
|
|
3350
3322
|
}();
|
|
3351
3323
|
//#endregion
|
|
3352
3324
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.43_typescript@6.0.3_/node_modules/swrv/esm/lib/web-preset.js
|
|
3353
|
-
function
|
|
3325
|
+
function Ir() {
|
|
3354
3326
|
return navigator.onLine === void 0 || navigator.onLine;
|
|
3355
3327
|
}
|
|
3356
|
-
function
|
|
3328
|
+
function Lr() {
|
|
3357
3329
|
return typeof document < "u" && document.visibilityState !== void 0 ? document.visibilityState !== "hidden" : !0;
|
|
3358
3330
|
}
|
|
3359
|
-
var
|
|
3360
|
-
isOnline:
|
|
3361
|
-
isDocumentVisible:
|
|
3331
|
+
var Rr = {
|
|
3332
|
+
isOnline: Ir,
|
|
3333
|
+
isDocumentVisible: Lr,
|
|
3362
3334
|
fetcher: function(e) {
|
|
3363
3335
|
return fetch(e).then(function(e) {
|
|
3364
3336
|
return e.json();
|
|
@@ -3369,7 +3341,7 @@ var Gr = {
|
|
|
3369
3341
|
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]);
|
|
3370
3342
|
return e;
|
|
3371
3343
|
}, $.apply(this, arguments);
|
|
3372
|
-
},
|
|
3344
|
+
}, zr = function(e, t, n, r) {
|
|
3373
3345
|
function i(e) {
|
|
3374
3346
|
return e instanceof n ? e : new n(function(t) {
|
|
3375
3347
|
t(e);
|
|
@@ -3395,7 +3367,7 @@ var Gr = {
|
|
|
3395
3367
|
}
|
|
3396
3368
|
c((r = r.apply(e, t || [])).next());
|
|
3397
3369
|
});
|
|
3398
|
-
},
|
|
3370
|
+
}, Br = function(e, t) {
|
|
3399
3371
|
var n = {
|
|
3400
3372
|
label: 0,
|
|
3401
3373
|
sent: function() {
|
|
@@ -3468,7 +3440,7 @@ var Gr = {
|
|
|
3468
3440
|
done: !0
|
|
3469
3441
|
};
|
|
3470
3442
|
}
|
|
3471
|
-
},
|
|
3443
|
+
}, Vr = function(e, t) {
|
|
3472
3444
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
3473
3445
|
if (!n) return e;
|
|
3474
3446
|
var r = n.call(e), i, a = [], o;
|
|
@@ -3484,11 +3456,11 @@ var Gr = {
|
|
|
3484
3456
|
}
|
|
3485
3457
|
}
|
|
3486
3458
|
return a;
|
|
3487
|
-
},
|
|
3459
|
+
}, Hr = function(e, t, n) {
|
|
3488
3460
|
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]);
|
|
3489
3461
|
return e.concat(a || Array.prototype.slice.call(t));
|
|
3490
|
-
},
|
|
3491
|
-
cache:
|
|
3462
|
+
}, Ur = new Fr(), Wr = new Fr(), Gr = new Fr(), Kr = {
|
|
3463
|
+
cache: Ur,
|
|
3492
3464
|
refreshInterval: 0,
|
|
3493
3465
|
ttl: 0,
|
|
3494
3466
|
serverTTL: 1e3,
|
|
@@ -3498,15 +3470,15 @@ var Gr = {
|
|
|
3498
3470
|
shouldRetryOnError: !0,
|
|
3499
3471
|
errorRetryInterval: 5e3,
|
|
3500
3472
|
errorRetryCount: 5,
|
|
3501
|
-
fetcher:
|
|
3502
|
-
isOnline:
|
|
3503
|
-
isDocumentVisible:
|
|
3473
|
+
fetcher: Rr.fetcher,
|
|
3474
|
+
isOnline: Rr.isOnline,
|
|
3475
|
+
isDocumentVisible: Rr.isDocumentVisible
|
|
3504
3476
|
};
|
|
3505
|
-
function
|
|
3506
|
-
var r =
|
|
3507
|
-
r ? r.data.push(t) :
|
|
3477
|
+
function qr(e, t, n) {
|
|
3478
|
+
var r = Wr.get(e);
|
|
3479
|
+
r ? r.data.push(t) : Wr.set(e, [t], n > 0 ? n + 5e3 : n);
|
|
3508
3480
|
}
|
|
3509
|
-
function
|
|
3481
|
+
function Jr(e, t, n) {
|
|
3510
3482
|
if (n.isDocumentVisible() && !(n.errorRetryCount !== void 0 && t > n.errorRetryCount)) {
|
|
3511
3483
|
var r = Math.min(t || 0, n.errorRetryCount), i = r * n.errorRetryInterval;
|
|
3512
3484
|
setTimeout(function() {
|
|
@@ -3517,17 +3489,17 @@ function ti(e, t, n) {
|
|
|
3517
3489
|
}, i);
|
|
3518
3490
|
}
|
|
3519
3491
|
}
|
|
3520
|
-
function
|
|
3492
|
+
function Yr(e) {
|
|
3521
3493
|
var t = e.shouldRetry, n = t === void 0 ? void 0 : t, r = e.error;
|
|
3522
|
-
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n :
|
|
3494
|
+
return typeof n == "function" ? n(r) : typeof n == "boolean" ? n : Kr.shouldRetryOnError;
|
|
3523
3495
|
}
|
|
3524
|
-
var
|
|
3525
|
-
return n === void 0 && (n =
|
|
3496
|
+
var Xr = function(e, t, n, r) {
|
|
3497
|
+
return n === void 0 && (n = Ur), r === void 0 && (r = Kr.ttl), zr(void 0, void 0, void 0, function() {
|
|
3526
3498
|
var i, a, o, s, c, l, u;
|
|
3527
|
-
return
|
|
3499
|
+
return Br(this, function(d) {
|
|
3528
3500
|
switch (d.label) {
|
|
3529
3501
|
case 0:
|
|
3530
|
-
if (!
|
|
3502
|
+
if (!Qr(t)) return [3, 5];
|
|
3531
3503
|
d.label = 1;
|
|
3532
3504
|
case 1: return d.trys.push([
|
|
3533
3505
|
1,
|
|
@@ -3549,7 +3521,7 @@ var ri = function(e, t, n, r) {
|
|
|
3549
3521
|
} catch (e) {
|
|
3550
3522
|
console.error("swrv(mutate): failed to set cache", e);
|
|
3551
3523
|
}
|
|
3552
|
-
return l =
|
|
3524
|
+
return l = Wr.get(e), l && l.data.length && (u = l.data.filter(function(t) {
|
|
3553
3525
|
return t.key === e;
|
|
3554
3526
|
}), u.forEach(function(e, t) {
|
|
3555
3527
|
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];
|
|
@@ -3558,16 +3530,16 @@ var ri = function(e, t, n, r) {
|
|
|
3558
3530
|
});
|
|
3559
3531
|
});
|
|
3560
3532
|
};
|
|
3561
|
-
function
|
|
3533
|
+
function Zr() {
|
|
3562
3534
|
for (var e = this, t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
|
|
3563
|
-
var r, i, a = $({},
|
|
3564
|
-
if (!
|
|
3535
|
+
var r, i, a = $({}, Kr), o = !1, s = !1;
|
|
3536
|
+
if (!oe()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
|
|
3565
3537
|
var c = typeof window > "u" || typeof document > "u";
|
|
3566
3538
|
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
|
|
3567
|
-
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r :
|
|
3539
|
+
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : b(r);
|
|
3568
3540
|
i === void 0 && (i = a.fetcher);
|
|
3569
3541
|
var d = null;
|
|
3570
|
-
d ||=
|
|
3542
|
+
d ||= le({
|
|
3571
3543
|
data: void 0,
|
|
3572
3544
|
error: void 0,
|
|
3573
3545
|
isValidating: !0,
|
|
@@ -3575,32 +3547,32 @@ function ii() {
|
|
|
3575
3547
|
key: null
|
|
3576
3548
|
});
|
|
3577
3549
|
var f = function(t, n) {
|
|
3578
|
-
return
|
|
3550
|
+
return zr(e, void 0, void 0, function() {
|
|
3579
3551
|
var e, r, s, c, p, m, h, g = this;
|
|
3580
|
-
return
|
|
3552
|
+
return Br(this, function(_) {
|
|
3581
3553
|
switch (_.label) {
|
|
3582
3554
|
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() {
|
|
3583
|
-
return
|
|
3555
|
+
return zr(g, void 0, void 0, function() {
|
|
3584
3556
|
var e, t, i, s, c, u;
|
|
3585
|
-
return
|
|
3557
|
+
return Br(this, function(m) {
|
|
3586
3558
|
switch (m.label) {
|
|
3587
|
-
case 0: return e =
|
|
3559
|
+
case 0: return e = Gr.get(r), e ? [3, 2] : (t = Array.isArray(r) ? r : [r], i = p.apply(void 0, Hr([], Vr(t), !1)), Gr.set(r, i, a.dedupingInterval), [4, Xr(r, i, a.cache, l)]);
|
|
3588
3560
|
case 1: return m.sent(), [3, 4];
|
|
3589
|
-
case 2: return [4,
|
|
3561
|
+
case 2: return [4, Xr(r, e.data, a.cache, l)];
|
|
3590
3562
|
case 3: m.sent(), m.label = 4;
|
|
3591
|
-
case 4: return d.isValidating = !1, d.isLoading = !1,
|
|
3563
|
+
case 4: return d.isValidating = !1, d.isLoading = !1, Gr.delete(r), d.error !== void 0 && (s = Yr({
|
|
3592
3564
|
shouldRetry: a.shouldRetryOnError,
|
|
3593
3565
|
error: d.error
|
|
3594
|
-
}), c =
|
|
3566
|
+
}), c = Yr({
|
|
3595
3567
|
shouldRetry: !n || n.shouldRetryOnError,
|
|
3596
3568
|
error: d.error
|
|
3597
|
-
}), u = !o && s && c, u &&
|
|
3569
|
+
}), u = !o && s && c, u && Jr(f, n ? n.errorRetryCount : 1, a)), [2];
|
|
3598
3570
|
}
|
|
3599
3571
|
});
|
|
3600
3572
|
});
|
|
3601
3573
|
}, c && a.revalidateDebounce ? (setTimeout(function() {
|
|
3602
|
-
return
|
|
3603
|
-
return
|
|
3574
|
+
return zr(g, void 0, void 0, function() {
|
|
3575
|
+
return Br(this, function(e) {
|
|
3604
3576
|
switch (e.label) {
|
|
3605
3577
|
case 0: return o ? [3, 2] : [4, h()];
|
|
3606
3578
|
case 1: e.sent(), e.label = 2;
|
|
@@ -3616,16 +3588,16 @@ function ii() {
|
|
|
3616
3588
|
});
|
|
3617
3589
|
});
|
|
3618
3590
|
}, p = function() {
|
|
3619
|
-
return
|
|
3620
|
-
return
|
|
3591
|
+
return zr(e, void 0, void 0, function() {
|
|
3592
|
+
return Br(this, function(e) {
|
|
3621
3593
|
return [2, f(null, { shouldRetryOnError: !1 })];
|
|
3622
3594
|
});
|
|
3623
3595
|
});
|
|
3624
3596
|
}, m = null;
|
|
3625
3597
|
if (!c) {
|
|
3626
3598
|
var h = function() {
|
|
3627
|
-
return
|
|
3628
|
-
return
|
|
3599
|
+
return zr(e, void 0, void 0, function() {
|
|
3600
|
+
return Br(this, function(e) {
|
|
3629
3601
|
switch (e.label) {
|
|
3630
3602
|
case 0: return d.error || !a.isOnline() ? [3, 2] : [4, f()];
|
|
3631
3603
|
case 1: return e.sent(), [3, 3];
|
|
@@ -3637,38 +3609,38 @@ function ii() {
|
|
|
3637
3609
|
};
|
|
3638
3610
|
a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
|
|
3639
3611
|
}
|
|
3640
|
-
|
|
3612
|
+
ce(function() {
|
|
3641
3613
|
o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
|
|
3642
|
-
var e =
|
|
3614
|
+
var e = Wr.get(u.value);
|
|
3643
3615
|
e && (e.data = e.data.filter(function(e) {
|
|
3644
3616
|
return e !== d;
|
|
3645
3617
|
}));
|
|
3646
3618
|
});
|
|
3647
3619
|
try {
|
|
3648
|
-
|
|
3649
|
-
|
|
3620
|
+
de(u, function(e) {
|
|
3621
|
+
se(u) || (u.value = e), d.key = e, d.isValidating = !!e, qr(u.value, d, l), !c && !s && u.value && f(), s = !1;
|
|
3650
3622
|
}, { immediate: !0 });
|
|
3651
3623
|
} catch {}
|
|
3652
|
-
return $($({},
|
|
3624
|
+
return $($({}, ue(d)), { mutate: function(e, t) {
|
|
3653
3625
|
return f(e, $($({}, t), { forceRevalidate: !0 }));
|
|
3654
3626
|
} });
|
|
3655
3627
|
}
|
|
3656
|
-
function
|
|
3628
|
+
function Qr(e) {
|
|
3657
3629
|
return typeof e == "object" && !!e && typeof e.then == "function";
|
|
3658
3630
|
}
|
|
3659
3631
|
//#endregion
|
|
3660
3632
|
//#region ../../node_modules/.pnpm/swrv@1.2.0_vue@3.5.43_typescript@6.0.3_/node_modules/swrv/esm/index.js
|
|
3661
|
-
var
|
|
3662
|
-
|
|
3663
|
-
var
|
|
3633
|
+
var $r = Zr;
|
|
3634
|
+
$r.default, $r.default;
|
|
3635
|
+
var ei = class {
|
|
3664
3636
|
constructor(e) {
|
|
3665
|
-
this.statusRef =
|
|
3637
|
+
this.statusRef = b("ready"), this.errorRef = b(void 0), this.pushMessage = (e) => {
|
|
3666
3638
|
this.messagesRef.value = [...this.messagesRef.value, e];
|
|
3667
3639
|
}, this.popMessage = () => {
|
|
3668
3640
|
this.messagesRef.value = this.messagesRef.value.slice(0, -1);
|
|
3669
3641
|
}, this.replaceMessage = (e, t) => {
|
|
3670
3642
|
this.messagesRef.value[e] = { ...t };
|
|
3671
|
-
}, this.snapshot = (e) => e, this.messagesRef =
|
|
3643
|
+
}, this.snapshot = (e) => e, this.messagesRef = b(e ?? []);
|
|
3672
3644
|
}
|
|
3673
3645
|
get messages() {
|
|
3674
3646
|
return this.messagesRef.value;
|
|
@@ -3688,52 +3660,52 @@ var si = class {
|
|
|
3688
3660
|
set error(e) {
|
|
3689
3661
|
this.errorRef.value = e;
|
|
3690
3662
|
}
|
|
3691
|
-
},
|
|
3663
|
+
}, ti = class extends kr {
|
|
3692
3664
|
constructor({ messages: e, ...t }) {
|
|
3693
3665
|
super({
|
|
3694
3666
|
...t,
|
|
3695
|
-
state: new
|
|
3667
|
+
state: new ei(e)
|
|
3696
3668
|
});
|
|
3697
3669
|
}
|
|
3698
|
-
},
|
|
3670
|
+
}, ni = "voice-", ri = (e) => e.replace(/\s+/g, " ").trim().toLowerCase(), ii = (e) => ri(e.parts.filter((e) => e.type === "text").map((e) => "text" in e ? e.text : "").join(" ")), ai = 8, oi = (e, t) => {
|
|
3699
3671
|
let n = e.filter((e) => e.role === "user").map((e) => ({
|
|
3700
|
-
text:
|
|
3672
|
+
text: ii(e),
|
|
3701
3673
|
taken: !1
|
|
3702
3674
|
}));
|
|
3703
3675
|
return t.filter((e) => {
|
|
3704
3676
|
if (!e.id.startsWith("voice-") || e.role !== "user") return !1;
|
|
3705
|
-
let t =
|
|
3677
|
+
let t = ii(e), r = n.find((e) => !e.taken && e.text.length > 0 && (e.text === t || e.text.length >= ai && t.endsWith(e.text)));
|
|
3706
3678
|
return !r || (r.taken = !0, !1);
|
|
3707
3679
|
});
|
|
3708
|
-
},
|
|
3680
|
+
}, si = (e) => {
|
|
3709
3681
|
let t = e.type ?? "";
|
|
3710
3682
|
return t === "dynamic-tool" ? e.toolName ?? "" : t.startsWith("tool-") ? t.slice(5) : "";
|
|
3711
|
-
},
|
|
3683
|
+
}, ci = ({ messages: e }) => {
|
|
3712
3684
|
let t = e[e.length - 1];
|
|
3713
3685
|
if (!t || t.role !== "assistant") return !1;
|
|
3714
|
-
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 &&
|
|
3715
|
-
return r.length > 0 && r.every((e) =>
|
|
3686
|
+
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 && ee(si(e)));
|
|
3687
|
+
return r.length > 0 && r.every((e) => te.has(e.state ?? ""));
|
|
3716
3688
|
};
|
|
3717
|
-
function
|
|
3718
|
-
return
|
|
3719
|
-
let { t, te: n, locale: r } =
|
|
3689
|
+
function li(e) {
|
|
3690
|
+
return x(`chatbot-${e}`, () => {
|
|
3691
|
+
let { t, te: n, locale: r } = pe({ useScope: "global" }), i = b(""), a = b(), o = b(e), s = b(), c = b(), l = b(), u = b(), d = b(), f = b(), p = b(), m = b(), h = b(), g = b(), _ = b(), v = b(), ee = b(), te = b(), oe = b(), se = b(), ce = b(!1), le = me(), ue = y(() => {
|
|
3720
3692
|
let e = u.value?.theme;
|
|
3721
|
-
return (!e || e === "auto") && (e =
|
|
3722
|
-
}),
|
|
3693
|
+
return (!e || e === "auto") && (e = se.value), e ? e === "dark" : le.value;
|
|
3694
|
+
}), x = y(() => c.value === "reasoning"), _e = y(() => x.value ? g.value?.filter((e) => ![
|
|
3723
3695
|
"upvote",
|
|
3724
3696
|
"downvote",
|
|
3725
3697
|
"feedback"
|
|
3726
|
-
].includes(e)) : g.value),
|
|
3727
|
-
|
|
3728
|
-
|
|
3698
|
+
].includes(e)) : g.value), ve = ae(y(() => `${o.value}-chatId`), null);
|
|
3699
|
+
fe(() => {
|
|
3700
|
+
ve.value ||= L();
|
|
3729
3701
|
});
|
|
3730
|
-
let
|
|
3731
|
-
get: () =>
|
|
3702
|
+
let S = y({
|
|
3703
|
+
get: () => ve.value,
|
|
3732
3704
|
set: (e) => {
|
|
3733
|
-
|
|
3705
|
+
ve.value = e;
|
|
3734
3706
|
}
|
|
3735
|
-
}),
|
|
3736
|
-
function
|
|
3707
|
+
}), C = b(), w = b(!1), ye = y(() => C.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
|
|
3708
|
+
function be(e) {
|
|
3737
3709
|
try {
|
|
3738
3710
|
let t = JSON.parse(e.message);
|
|
3739
3711
|
return t.status === 404 || t.type?.includes("entity-not-found");
|
|
@@ -3741,25 +3713,25 @@ function gi(e) {
|
|
|
3741
3713
|
return !1;
|
|
3742
3714
|
}
|
|
3743
3715
|
}
|
|
3744
|
-
function
|
|
3745
|
-
if (
|
|
3746
|
-
let e =
|
|
3747
|
-
|
|
3716
|
+
function xe(e) {
|
|
3717
|
+
if (be(e)) {
|
|
3718
|
+
let e = E.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? ie(t) : void 0;
|
|
3719
|
+
S.value = L(), E.value.clearError(), C.value = void 0, n && E.value.sendMessage({ text: n });
|
|
3748
3720
|
return;
|
|
3749
3721
|
}
|
|
3750
|
-
|
|
3722
|
+
re.error(e), C.value = e, ye.value && (w.value = !0);
|
|
3751
3723
|
}
|
|
3752
|
-
let
|
|
3724
|
+
let T = y(() => ne({
|
|
3753
3725
|
baseUrl: i.value,
|
|
3754
3726
|
basePath: a.value,
|
|
3755
3727
|
headers: () => p.value
|
|
3756
|
-
})),
|
|
3757
|
-
...
|
|
3758
|
-
...
|
|
3759
|
-
}),
|
|
3760
|
-
id:
|
|
3761
|
-
transport: new
|
|
3762
|
-
api:
|
|
3728
|
+
})), Se = b(null), Ce = () => ({
|
|
3729
|
+
...he(),
|
|
3730
|
+
...Se.value ?? {}
|
|
3731
|
+
}), E = y(() => new ti({
|
|
3732
|
+
id: S.value,
|
|
3733
|
+
transport: new Or({
|
|
3734
|
+
api: T.value.getChatEndpoint(o.value, x.value ? "reasoning" : "chat"),
|
|
3763
3735
|
prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
|
|
3764
3736
|
id: t,
|
|
3765
3737
|
messages: [e[e.length - 1]],
|
|
@@ -3774,32 +3746,32 @@ function gi(e) {
|
|
|
3774
3746
|
reasoning: d.value?.reasoning,
|
|
3775
3747
|
webSearch: f.value?.webSearch,
|
|
3776
3748
|
smoothStream: u.value?.smoothStream,
|
|
3777
|
-
deviceContext:
|
|
3778
|
-
externalContext:
|
|
3749
|
+
deviceContext: Ce(),
|
|
3750
|
+
externalContext: oe.value,
|
|
3779
3751
|
disabledTools: f.value?.disabled,
|
|
3780
|
-
fallbackModels:
|
|
3781
|
-
gatewayOptions:
|
|
3752
|
+
fallbackModels: ee.value,
|
|
3753
|
+
gatewayOptions: te.value
|
|
3782
3754
|
} }),
|
|
3783
3755
|
credentials: "include",
|
|
3784
3756
|
headers: () => p.value ?? {}
|
|
3785
3757
|
}),
|
|
3786
|
-
sendAutomaticallyWhen: (e) =>
|
|
3787
|
-
onError:
|
|
3758
|
+
sendAutomaticallyWhen: (e) => ci(e) || Ar(e),
|
|
3759
|
+
onError: xe,
|
|
3788
3760
|
onFinish: () => {
|
|
3789
|
-
let e =
|
|
3790
|
-
!
|
|
3761
|
+
let e = S.value;
|
|
3762
|
+
!x.value && !D.value.some((t) => t.id === e) && Be(o.value);
|
|
3791
3763
|
}
|
|
3792
|
-
})),
|
|
3764
|
+
})), we = y(() => {
|
|
3793
3765
|
let e = u.value?.initialMessage;
|
|
3794
3766
|
return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
|
|
3795
|
-
}),
|
|
3796
|
-
id:
|
|
3767
|
+
}), Te = L(), Ee = y(() => ({
|
|
3768
|
+
id: Te,
|
|
3797
3769
|
role: "assistant",
|
|
3798
3770
|
parts: [{
|
|
3799
3771
|
type: "text",
|
|
3800
|
-
text:
|
|
3772
|
+
text: we.value
|
|
3801
3773
|
}]
|
|
3802
|
-
})),
|
|
3774
|
+
})), De = y(() => {
|
|
3803
3775
|
let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
|
|
3804
3776
|
...e,
|
|
3805
3777
|
parts: e.parts.map((e) => {
|
|
@@ -3809,291 +3781,291 @@ function gi(e) {
|
|
|
3809
3781
|
let e = t.url.slice(13);
|
|
3810
3782
|
return {
|
|
3811
3783
|
...t,
|
|
3812
|
-
url:
|
|
3784
|
+
url: T.value.getMediaUrl(o.value, S.value, e)
|
|
3813
3785
|
};
|
|
3814
3786
|
}
|
|
3815
3787
|
return t.url.startsWith("blob:") ? t : {
|
|
3816
3788
|
...t,
|
|
3817
|
-
url:
|
|
3789
|
+
url: T.value.appendAuthToken(t.url)
|
|
3818
3790
|
};
|
|
3819
3791
|
})
|
|
3820
3792
|
});
|
|
3821
|
-
return
|
|
3822
|
-
}),
|
|
3793
|
+
return x.value ? e(E.value.messages) : !ce.value && E.value.messages?.[0]?.role !== "assistant" ? [Ee.value, ...e(E.value.messages)] : e(E.value.messages);
|
|
3794
|
+
}), Oe = y(() => {
|
|
3823
3795
|
let e = u.value?.messagePlaceholder;
|
|
3824
3796
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
3825
|
-
}),
|
|
3826
|
-
async function
|
|
3827
|
-
if (
|
|
3828
|
-
|
|
3797
|
+
}), D = b([]), ke = b(!1), O = b([]), Ae = b(!1), je = b("chat"), k = b([]), Me = b(), Ne = b(!1), Pe = b(!1), Fe = b(), Ie = b(!1), Le = b(!1), Re = b(), A = b(""), j = b([]), M = b(""), ze = b(0);
|
|
3798
|
+
async function Be(e) {
|
|
3799
|
+
if (x.value) {
|
|
3800
|
+
D.value = [];
|
|
3829
3801
|
return;
|
|
3830
3802
|
}
|
|
3831
|
-
|
|
3803
|
+
ke.value = !0;
|
|
3832
3804
|
try {
|
|
3833
|
-
|
|
3805
|
+
D.value = await T.value.getConversations(e, l.value);
|
|
3834
3806
|
} catch {
|
|
3835
|
-
|
|
3807
|
+
D.value = [];
|
|
3836
3808
|
} finally {
|
|
3837
|
-
|
|
3809
|
+
ke.value = !1;
|
|
3838
3810
|
}
|
|
3839
3811
|
}
|
|
3840
|
-
async function
|
|
3841
|
-
let e =
|
|
3812
|
+
async function N() {
|
|
3813
|
+
let e = S.value;
|
|
3842
3814
|
if (!e) {
|
|
3843
|
-
|
|
3815
|
+
O.value = [];
|
|
3844
3816
|
return;
|
|
3845
3817
|
}
|
|
3846
|
-
|
|
3818
|
+
Ae.value = !0;
|
|
3847
3819
|
try {
|
|
3848
|
-
|
|
3820
|
+
O.value = await T.value.getChatFiles(e);
|
|
3849
3821
|
} catch {
|
|
3850
|
-
|
|
3822
|
+
O.value = [];
|
|
3851
3823
|
} finally {
|
|
3852
|
-
|
|
3824
|
+
Ae.value = !1;
|
|
3853
3825
|
}
|
|
3854
3826
|
}
|
|
3855
|
-
function
|
|
3856
|
-
return
|
|
3827
|
+
function Ve(e, t = !1) {
|
|
3828
|
+
return T.value.getChatFileDownloadUrl(e, t);
|
|
3857
3829
|
}
|
|
3858
|
-
function
|
|
3859
|
-
return
|
|
3830
|
+
function He(e) {
|
|
3831
|
+
return T.value.getChatFilePreviewUrl(e);
|
|
3860
3832
|
}
|
|
3861
|
-
async function
|
|
3862
|
-
await
|
|
3833
|
+
async function Ue(e) {
|
|
3834
|
+
await T.value.deleteChatFile(e), O.value = O.value.filter((t) => t.documentId !== e);
|
|
3863
3835
|
}
|
|
3864
|
-
async function
|
|
3865
|
-
if (!
|
|
3866
|
-
let n = await
|
|
3867
|
-
if (t !==
|
|
3868
|
-
n && (
|
|
3836
|
+
async function We(e, t) {
|
|
3837
|
+
if (!x.value) try {
|
|
3838
|
+
let n = await T.value.getChat(e, t);
|
|
3839
|
+
if (t !== S.value || E.value.status !== "ready" || E.value.messages.length > 0) return;
|
|
3840
|
+
n && (E.value.messages = n.messages, w.value = n.blocked ?? !1);
|
|
3869
3841
|
} catch {}
|
|
3870
3842
|
}
|
|
3871
|
-
let
|
|
3872
|
-
let e =
|
|
3843
|
+
let Ge = () => {
|
|
3844
|
+
let e = E.value.status;
|
|
3873
3845
|
return e === "submitted" || e === "streaming";
|
|
3874
|
-
},
|
|
3875
|
-
async function
|
|
3876
|
-
if (
|
|
3877
|
-
let e =
|
|
3846
|
+
}, Ke = 0, qe = 0;
|
|
3847
|
+
async function Je() {
|
|
3848
|
+
if (x.value || Ge()) return "indeterminate";
|
|
3849
|
+
let e = S.value, t = Ke += 1;
|
|
3878
3850
|
try {
|
|
3879
|
-
let n = await
|
|
3880
|
-
if (!n || e !==
|
|
3881
|
-
|
|
3882
|
-
let r = n.messages, i =
|
|
3883
|
-
return
|
|
3851
|
+
let n = await T.value.getChat(o.value, e);
|
|
3852
|
+
if (!n || e !== S.value || Ge() || t <= qe) return "indeterminate";
|
|
3853
|
+
qe = t;
|
|
3854
|
+
let r = n.messages, i = oi(r, E.value.messages);
|
|
3855
|
+
return E.value.messages = [...r, ...i], w.value = n.blocked ?? !1, i.length > 0 ? "pending" : "caught-up";
|
|
3884
3856
|
} catch {}
|
|
3885
3857
|
return "indeterminate";
|
|
3886
3858
|
}
|
|
3887
|
-
function
|
|
3888
|
-
|
|
3859
|
+
function Ye(e) {
|
|
3860
|
+
E.value.messages = [...E.value.messages, e];
|
|
3889
3861
|
}
|
|
3890
|
-
async function
|
|
3862
|
+
async function P(e) {
|
|
3891
3863
|
try {
|
|
3892
|
-
|
|
3864
|
+
k.value = await T.value.getMessageFeedbacks(e);
|
|
3893
3865
|
} catch {
|
|
3894
|
-
|
|
3866
|
+
k.value = [];
|
|
3895
3867
|
}
|
|
3896
3868
|
}
|
|
3897
|
-
function Ye(e) {
|
|
3898
|
-
let t = A.value.findIndex((t) => t.messageId === e.messageId);
|
|
3899
|
-
t >= 0 ? A.value[t] = e : A.value.push(e);
|
|
3900
|
-
}
|
|
3901
3869
|
function Xe(e) {
|
|
3902
|
-
let t =
|
|
3870
|
+
let t = k.value.findIndex((t) => t.messageId === e.messageId);
|
|
3871
|
+
t >= 0 ? k.value[t] = e : k.value.push(e);
|
|
3872
|
+
}
|
|
3873
|
+
function Ze(e) {
|
|
3874
|
+
let t = De.value, n = t.findIndex((t) => t.id === e.id), r = ie(e) ?? "", i = t.slice(0, n).reverse().find((e) => e.role === "user");
|
|
3903
3875
|
return {
|
|
3904
|
-
userQuestion:
|
|
3876
|
+
userQuestion: ie(i ?? e) ?? "",
|
|
3905
3877
|
assistantMessage: r
|
|
3906
3878
|
};
|
|
3907
3879
|
}
|
|
3908
|
-
async function
|
|
3880
|
+
async function Qe(e, t) {
|
|
3909
3881
|
await Promise.all([
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
]),
|
|
3914
|
-
e && (
|
|
3882
|
+
We(e, t),
|
|
3883
|
+
Be(e),
|
|
3884
|
+
P(t)
|
|
3885
|
+
]), Se.value || ge((e, t) => T.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
3886
|
+
e && (Se.value = e);
|
|
3915
3887
|
});
|
|
3916
3888
|
}
|
|
3917
|
-
async function
|
|
3918
|
-
let e =
|
|
3889
|
+
async function $e() {
|
|
3890
|
+
let e = A.value.trim(), t = j.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
3919
3891
|
type: "file",
|
|
3920
3892
|
mediaType: e.mediaSource.mimeType,
|
|
3921
3893
|
url: e.localUrl,
|
|
3922
3894
|
filename: e.mediaSource.name,
|
|
3923
3895
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
3924
3896
|
}));
|
|
3925
|
-
|
|
3926
|
-
let n =
|
|
3897
|
+
x.value && De.value.length > 0 && await F(), M.value = e, ze.value = E.value.messages.length;
|
|
3898
|
+
let n = E.value.sendMessage;
|
|
3927
3899
|
n({
|
|
3928
3900
|
text: e,
|
|
3929
3901
|
files: t.length > 0 ? t : void 0
|
|
3930
|
-
}),
|
|
3902
|
+
}), A.value = "", nt();
|
|
3931
3903
|
}
|
|
3932
|
-
function
|
|
3904
|
+
function et(e) {
|
|
3933
3905
|
let t = e.trim();
|
|
3934
3906
|
if (!t) return;
|
|
3935
|
-
if (
|
|
3936
|
-
|
|
3907
|
+
if (E.value.status !== "ready") {
|
|
3908
|
+
re.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
|
|
3937
3909
|
return;
|
|
3938
3910
|
}
|
|
3939
|
-
let n =
|
|
3911
|
+
let n = E.value.sendMessage;
|
|
3940
3912
|
n({ text: t });
|
|
3941
3913
|
}
|
|
3942
|
-
async function
|
|
3943
|
-
let e =
|
|
3944
|
-
await
|
|
3914
|
+
async function tt() {
|
|
3915
|
+
let e = M.value.length > 0;
|
|
3916
|
+
await E.value.stop(), e && (A.value = M.value, E.value.messages = E.value.messages.slice(0, ze.value), M.value = "");
|
|
3945
3917
|
}
|
|
3946
|
-
|
|
3947
|
-
e === "ready" &&
|
|
3918
|
+
de(() => E.value.status, (e) => {
|
|
3919
|
+
e === "ready" && M.value.length > 0 && (M.value = "");
|
|
3948
3920
|
});
|
|
3949
|
-
function
|
|
3950
|
-
for (let t of
|
|
3951
|
-
|
|
3921
|
+
function nt(e = !1) {
|
|
3922
|
+
for (let t of j.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
3923
|
+
j.value = [], R.value = null;
|
|
3952
3924
|
}
|
|
3953
|
-
async function
|
|
3954
|
-
return
|
|
3925
|
+
async function F() {
|
|
3926
|
+
return M.value = "", await tt(), S.value = L(), E.value.clearError(), C.value = void 0, w.value = !1, nt(!0), yt("chat"), S.value;
|
|
3955
3927
|
}
|
|
3956
|
-
async function
|
|
3957
|
-
|
|
3928
|
+
async function I(e) {
|
|
3929
|
+
E.value.status !== "ready" && (M.value = "", await tt()), await E.value.regenerate(e);
|
|
3958
3930
|
}
|
|
3959
|
-
function
|
|
3931
|
+
function rt(e) {
|
|
3960
3932
|
if (e.tool === "requestGeolocation") {
|
|
3961
3933
|
let t = e.output;
|
|
3962
|
-
"latitude" in t && (
|
|
3934
|
+
"latitude" in t && (Se.value = {
|
|
3963
3935
|
geolocationLatitude: t.latitude,
|
|
3964
3936
|
geolocationLongitude: t.longitude,
|
|
3965
3937
|
geolocationAccuracy: t.accuracy,
|
|
3966
3938
|
geolocationCity: t.city
|
|
3967
3939
|
});
|
|
3968
3940
|
}
|
|
3969
|
-
|
|
3941
|
+
E.value.addToolOutput(e);
|
|
3970
3942
|
}
|
|
3971
|
-
function
|
|
3972
|
-
|
|
3943
|
+
function it(e) {
|
|
3944
|
+
E.value.addToolApprovalResponse(e);
|
|
3973
3945
|
}
|
|
3974
|
-
let
|
|
3975
|
-
|
|
3946
|
+
let at = y(() => E.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), ot = y(() => _.value?.maxFilesPerMessage ?? 5), st = y(() => _.value?.maxFilesPerChat ?? 20), ct = y(() => Math.max(0, Math.min(ot.value - j.value.length, st.value - at.value - j.value.length))), lt = y(() => ct.value <= 0), R = b(null), ut = () => {
|
|
3947
|
+
R.value = null;
|
|
3976
3948
|
};
|
|
3977
|
-
|
|
3978
|
-
e || (
|
|
3949
|
+
de(lt, (e) => {
|
|
3950
|
+
e || (R.value = null);
|
|
3979
3951
|
});
|
|
3980
|
-
async function
|
|
3981
|
-
if (
|
|
3982
|
-
|
|
3952
|
+
async function dt(e) {
|
|
3953
|
+
if (lt.value) {
|
|
3954
|
+
R.value = st.value - at.value - j.value.length <= ot.value - j.value.length ? {
|
|
3983
3955
|
reason: "per-chat",
|
|
3984
|
-
max:
|
|
3956
|
+
max: st.value
|
|
3985
3957
|
} : {
|
|
3986
3958
|
reason: "per-message",
|
|
3987
|
-
max:
|
|
3959
|
+
max: ot.value
|
|
3988
3960
|
};
|
|
3989
3961
|
return;
|
|
3990
3962
|
}
|
|
3991
|
-
let t =
|
|
3963
|
+
let t = L(), n = {
|
|
3992
3964
|
id: t,
|
|
3993
3965
|
file: e,
|
|
3994
3966
|
localUrl: URL.createObjectURL(e),
|
|
3995
3967
|
state: "uploading"
|
|
3996
3968
|
};
|
|
3997
|
-
|
|
3969
|
+
j.value = [...j.value, n];
|
|
3998
3970
|
try {
|
|
3999
|
-
let n = await
|
|
4000
|
-
|
|
3971
|
+
let n = await T.value.uploadMedia(o.value, S.value, e);
|
|
3972
|
+
j.value = j.value.map((e) => e.id === t ? {
|
|
4001
3973
|
...e,
|
|
4002
3974
|
state: "done",
|
|
4003
3975
|
mediaSource: n
|
|
4004
3976
|
} : e);
|
|
4005
3977
|
} catch (e) {
|
|
4006
3978
|
let n = e instanceof Error ? e.message : "Upload failed";
|
|
4007
|
-
|
|
3979
|
+
j.value = j.value.map((e) => e.id === t ? {
|
|
4008
3980
|
...e,
|
|
4009
3981
|
state: "error",
|
|
4010
3982
|
error: n
|
|
4011
3983
|
} : e);
|
|
4012
3984
|
}
|
|
4013
3985
|
}
|
|
4014
|
-
async function
|
|
4015
|
-
let { userQuestion: n, assistantMessage: r } =
|
|
4016
|
-
|
|
3986
|
+
async function ft(e, t) {
|
|
3987
|
+
let { userQuestion: n, assistantMessage: r } = Ze(e);
|
|
3988
|
+
Xe(await T.value.submitMessageFeedback({
|
|
4017
3989
|
messageId: e.id,
|
|
4018
|
-
chatId:
|
|
3990
|
+
chatId: S.value,
|
|
4019
3991
|
agentId: o.value,
|
|
4020
3992
|
vote: t,
|
|
4021
3993
|
userQuestion: n,
|
|
4022
3994
|
assistantMessage: r
|
|
4023
3995
|
}));
|
|
4024
3996
|
}
|
|
4025
|
-
async function
|
|
4026
|
-
await
|
|
3997
|
+
async function z(e) {
|
|
3998
|
+
await ft(e, "upvote");
|
|
4027
3999
|
}
|
|
4028
|
-
async function
|
|
4029
|
-
await
|
|
4000
|
+
async function pt(e) {
|
|
4001
|
+
await ft(e, "downvote");
|
|
4030
4002
|
}
|
|
4031
|
-
function
|
|
4032
|
-
|
|
4003
|
+
function mt(e) {
|
|
4004
|
+
Pe.value = !1, Fe.value = void 0, Me.value = e;
|
|
4033
4005
|
}
|
|
4034
|
-
async function
|
|
4035
|
-
if (
|
|
4036
|
-
|
|
4037
|
-
let { userQuestion: t, assistantMessage: n } =
|
|
4038
|
-
|
|
4039
|
-
messageId:
|
|
4040
|
-
chatId:
|
|
4006
|
+
async function ht(e) {
|
|
4007
|
+
if (Me.value) try {
|
|
4008
|
+
Ne.value = !0, Pe.value = !1, Fe.value = void 0;
|
|
4009
|
+
let { userQuestion: t, assistantMessage: n } = Ze(Me.value);
|
|
4010
|
+
Xe(await T.value.submitMessageFeedback({
|
|
4011
|
+
messageId: Me.value.id,
|
|
4012
|
+
chatId: S.value,
|
|
4041
4013
|
agentId: o.value,
|
|
4042
4014
|
userQuestion: t,
|
|
4043
4015
|
assistantMessage: n,
|
|
4044
4016
|
comment: e
|
|
4045
|
-
})),
|
|
4017
|
+
})), Pe.value = !0, await P(S.value);
|
|
4046
4018
|
} catch {
|
|
4047
|
-
|
|
4019
|
+
Fe.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
4048
4020
|
} finally {
|
|
4049
|
-
|
|
4021
|
+
Ne.value = !1;
|
|
4050
4022
|
}
|
|
4051
4023
|
}
|
|
4052
|
-
async function
|
|
4024
|
+
async function gt(e) {
|
|
4053
4025
|
try {
|
|
4054
|
-
|
|
4026
|
+
Le.value = !0, Ie.value = !1, Re.value = void 0, await T.value.submitLead({
|
|
4055
4027
|
agentId: o.value,
|
|
4056
|
-
chatId:
|
|
4028
|
+
chatId: S.value,
|
|
4057
4029
|
...e
|
|
4058
|
-
}),
|
|
4030
|
+
}), Ie.value = !0;
|
|
4059
4031
|
} catch {
|
|
4060
|
-
|
|
4032
|
+
Re.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
4061
4033
|
} finally {
|
|
4062
|
-
|
|
4034
|
+
Le.value = !1;
|
|
4063
4035
|
}
|
|
4064
4036
|
}
|
|
4065
|
-
async function
|
|
4066
|
-
let n = await
|
|
4067
|
-
|
|
4037
|
+
async function _t(e, t) {
|
|
4038
|
+
let n = await T.value.updateChatTitle(o.value, e, t);
|
|
4039
|
+
D.value = D.value.map((t) => t.id === e ? {
|
|
4068
4040
|
...t,
|
|
4069
4041
|
title: n.title
|
|
4070
4042
|
} : t);
|
|
4071
4043
|
}
|
|
4072
|
-
async function
|
|
4073
|
-
await
|
|
4044
|
+
async function vt(e) {
|
|
4045
|
+
await T.value.deleteChat(o.value, e), D.value = D.value.filter((t) => t.id !== e), S.value === e && await F();
|
|
4074
4046
|
}
|
|
4075
|
-
function
|
|
4076
|
-
|
|
4047
|
+
function yt(e) {
|
|
4048
|
+
je.value = e;
|
|
4077
4049
|
}
|
|
4078
|
-
let
|
|
4079
|
-
function
|
|
4080
|
-
let t = () =>
|
|
4050
|
+
let bt;
|
|
4051
|
+
function xt(e) {
|
|
4052
|
+
let t = () => T.value.getChat(o.value, e).then((e) => e !== null);
|
|
4081
4053
|
return t().catch(() => t().catch(() => !1));
|
|
4082
4054
|
}
|
|
4083
|
-
return
|
|
4084
|
-
if (!e || e ===
|
|
4085
|
-
let t =
|
|
4086
|
-
if (
|
|
4087
|
-
let n =
|
|
4088
|
-
if (l.value === e &&
|
|
4055
|
+
return de(l, async (e) => {
|
|
4056
|
+
if (!e || e === bt) return;
|
|
4057
|
+
let t = bt;
|
|
4058
|
+
if (bt = e, t === void 0) return;
|
|
4059
|
+
let n = S.value, r = !x.value && await xt(n);
|
|
4060
|
+
if (l.value === e && S.value === n) {
|
|
4089
4061
|
if (r) {
|
|
4090
|
-
|
|
4062
|
+
Be(o.value);
|
|
4091
4063
|
return;
|
|
4092
4064
|
}
|
|
4093
|
-
|
|
4065
|
+
D.value = [], k.value = [], O.value = [], await F(), A.value = "";
|
|
4094
4066
|
}
|
|
4095
4067
|
}), {
|
|
4096
|
-
apiClient:
|
|
4068
|
+
apiClient: T,
|
|
4097
4069
|
baseUrl: i,
|
|
4098
4070
|
basePath: a,
|
|
4099
4071
|
agentId: o,
|
|
@@ -4107,69 +4079,69 @@ function gi(e) {
|
|
|
4107
4079
|
revisedAnswers: m,
|
|
4108
4080
|
model: h,
|
|
4109
4081
|
actionsInput: g,
|
|
4110
|
-
actions:
|
|
4082
|
+
actions: _e,
|
|
4111
4083
|
agentFileUpload: _,
|
|
4112
4084
|
agentVoice: v,
|
|
4113
|
-
fallbackModels:
|
|
4114
|
-
gatewayOptions:
|
|
4115
|
-
externalContext:
|
|
4116
|
-
systemTheme:
|
|
4117
|
-
hideWelcomeMessage:
|
|
4118
|
-
isDark:
|
|
4119
|
-
chat:
|
|
4120
|
-
messages:
|
|
4121
|
-
conversations:
|
|
4122
|
-
isLoadingConversations:
|
|
4123
|
-
chatFiles:
|
|
4124
|
-
isLoadingChatFiles:
|
|
4125
|
-
input:
|
|
4126
|
-
pendingAttachments:
|
|
4127
|
-
isAttachmentLimitReached:
|
|
4128
|
-
fileLimitError:
|
|
4129
|
-
localChatId:
|
|
4130
|
-
isConversationBlocked:
|
|
4131
|
-
inputMessagePlaceholder:
|
|
4132
|
-
chatError:
|
|
4133
|
-
activeView:
|
|
4134
|
-
messageFeedbacks:
|
|
4135
|
-
feedbackDialogMessage:
|
|
4136
|
-
isFeedbackSubmitting:
|
|
4137
|
-
isFeedbackSubmitted:
|
|
4138
|
-
feedbackSubmitError:
|
|
4139
|
-
isLeadSubmitted:
|
|
4140
|
-
isLoadingSubmitLead:
|
|
4141
|
-
submitLeadError:
|
|
4142
|
-
buildDeviceContext:
|
|
4143
|
-
initialize:
|
|
4144
|
-
loadConversations:
|
|
4145
|
-
loadChatFiles:
|
|
4146
|
-
refreshMessages:
|
|
4147
|
-
appendMessage:
|
|
4148
|
-
getChatFileUrl:
|
|
4149
|
-
getChatFilePreviewUrl:
|
|
4150
|
-
deleteChatFile:
|
|
4151
|
-
handleSubmit:
|
|
4152
|
-
sendMessage:
|
|
4153
|
-
stopGeneration:
|
|
4154
|
-
startNewChat:
|
|
4155
|
-
regenerate:
|
|
4156
|
-
addToolOutput:
|
|
4157
|
-
addToolApprovalResponse:
|
|
4158
|
-
handleFileSelect:
|
|
4159
|
-
clearFileLimitError:
|
|
4160
|
-
clearPendingAttachments:
|
|
4161
|
-
onUpvote:
|
|
4162
|
-
onDownvote:
|
|
4163
|
-
onFeedback:
|
|
4164
|
-
onFeedbackSubmit:
|
|
4165
|
-
onLeadSubmit:
|
|
4166
|
-
navigate:
|
|
4167
|
-
renameChatTitle:
|
|
4168
|
-
deleteChat:
|
|
4085
|
+
fallbackModels: ee,
|
|
4086
|
+
gatewayOptions: te,
|
|
4087
|
+
externalContext: oe,
|
|
4088
|
+
systemTheme: se,
|
|
4089
|
+
hideWelcomeMessage: ce,
|
|
4090
|
+
isDark: ue,
|
|
4091
|
+
chat: E,
|
|
4092
|
+
messages: De,
|
|
4093
|
+
conversations: D,
|
|
4094
|
+
isLoadingConversations: ke,
|
|
4095
|
+
chatFiles: O,
|
|
4096
|
+
isLoadingChatFiles: Ae,
|
|
4097
|
+
input: A,
|
|
4098
|
+
pendingAttachments: j,
|
|
4099
|
+
isAttachmentLimitReached: lt,
|
|
4100
|
+
fileLimitError: R,
|
|
4101
|
+
localChatId: S,
|
|
4102
|
+
isConversationBlocked: w,
|
|
4103
|
+
inputMessagePlaceholder: Oe,
|
|
4104
|
+
chatError: C,
|
|
4105
|
+
activeView: je,
|
|
4106
|
+
messageFeedbacks: k,
|
|
4107
|
+
feedbackDialogMessage: Me,
|
|
4108
|
+
isFeedbackSubmitting: Ne,
|
|
4109
|
+
isFeedbackSubmitted: Pe,
|
|
4110
|
+
feedbackSubmitError: Fe,
|
|
4111
|
+
isLeadSubmitted: Ie,
|
|
4112
|
+
isLoadingSubmitLead: Le,
|
|
4113
|
+
submitLeadError: Re,
|
|
4114
|
+
buildDeviceContext: Ce,
|
|
4115
|
+
initialize: Qe,
|
|
4116
|
+
loadConversations: Be,
|
|
4117
|
+
loadChatFiles: N,
|
|
4118
|
+
refreshMessages: Je,
|
|
4119
|
+
appendMessage: Ye,
|
|
4120
|
+
getChatFileUrl: Ve,
|
|
4121
|
+
getChatFilePreviewUrl: He,
|
|
4122
|
+
deleteChatFile: Ue,
|
|
4123
|
+
handleSubmit: $e,
|
|
4124
|
+
sendMessage: et,
|
|
4125
|
+
stopGeneration: tt,
|
|
4126
|
+
startNewChat: F,
|
|
4127
|
+
regenerate: I,
|
|
4128
|
+
addToolOutput: rt,
|
|
4129
|
+
addToolApprovalResponse: it,
|
|
4130
|
+
handleFileSelect: dt,
|
|
4131
|
+
clearFileLimitError: ut,
|
|
4132
|
+
clearPendingAttachments: nt,
|
|
4133
|
+
onUpvote: z,
|
|
4134
|
+
onDownvote: pt,
|
|
4135
|
+
onFeedback: mt,
|
|
4136
|
+
onFeedbackSubmit: ht,
|
|
4137
|
+
onLeadSubmit: gt,
|
|
4138
|
+
navigate: yt,
|
|
4139
|
+
renameChatTitle: _t,
|
|
4140
|
+
deleteChat: vt
|
|
4169
4141
|
};
|
|
4170
4142
|
})();
|
|
4171
4143
|
}
|
|
4172
4144
|
//#endregion
|
|
4173
|
-
export {
|
|
4145
|
+
export { L as a, Or as i, li as n, ti as r, ni as t };
|
|
4174
4146
|
|
|
4175
|
-
//# sourceMappingURL=useChatbotStore-
|
|
4147
|
+
//# sourceMappingURL=useChatbotStore-CMS2zFht.js.map
|