@8wave/ai-elements 0.98.0-beta.1 → 0.98.0-beta.3
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/README.md +20 -19
- package/dist/_chunks/{Document-njJL_3oo.js → Document-CjCQXPDF.js} +54 -54
- package/dist/_chunks/{Document-njJL_3oo.js.map → Document-CjCQXPDF.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-Bns7j3b7.js → PkStreamingMarkdown-Djw604Ny.js} +43 -43
- package/dist/_chunks/PkStreamingMarkdown-Djw604Ny.js.map +1 -0
- package/dist/_chunks/{PkToolShowArtifact-BHGuiacA.js → PkToolShowArtifact-BaGEr7O9.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-BHGuiacA.js.map → PkToolShowArtifact-BaGEr7O9.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-Cp6fDIOT.js → PkToolShowContactForm-DEQBTzf4.js} +4 -4
- package/dist/_chunks/{PkToolShowContactForm-Cp6fDIOT.js.map → PkToolShowContactForm-DEQBTzf4.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-BqUkMxMK.js → PkToolShowForm-AZwrmmM9.js} +2 -2
- package/dist/_chunks/{PkToolShowForm-BqUkMxMK.js.map → PkToolShowForm-AZwrmmM9.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-Bg0QAcmF.js → PkToolShowSources-FnMkkdm6.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-Bg0QAcmF.js.map → PkToolShowSources-FnMkkdm6.js.map} +1 -1
- package/dist/_chunks/{VvCheckbox.es-If2fZZst.js → VvCheckbox.es-D5d8k9yP.js} +2 -2
- package/dist/_chunks/{VvCheckbox.es-If2fZZst.js.map → VvCheckbox.es-D5d8k9yP.js.map} +1 -1
- package/dist/_chunks/{VvCheckboxGroup.es-A-IjEdQh.js → VvCheckboxGroup.es-DVnsOjX0.js} +2 -2
- package/dist/_chunks/{VvCheckboxGroup.es-A-IjEdQh.js.map → VvCheckboxGroup.es-DVnsOjX0.js.map} +1 -1
- package/dist/_chunks/{VvCombobox.es-DLRkNj0w.js → VvCombobox.es-CFA-K-cQ.js} +2 -2
- package/dist/_chunks/{VvCombobox.es-DLRkNj0w.js.map → VvCombobox.es-CFA-K-cQ.js.map} +1 -1
- package/dist/_chunks/{VvInputText.es-DV6kHrYx.js → VvInputText.es-csEQ-bSG.js} +2 -2
- package/dist/_chunks/{VvInputText.es-DV6kHrYx.js.map → VvInputText.es-csEQ-bSG.js.map} +1 -1
- package/dist/_chunks/{VvRadio.es-C_L52PYW.js → VvRadio.es-BpymhC73.js} +2 -2
- package/dist/_chunks/{VvRadio.es-C_L52PYW.js.map → VvRadio.es-BpymhC73.js.map} +1 -1
- package/dist/_chunks/{VvRadioGroup.es-B64sR46T.js → VvRadioGroup.es-CSNzOJKx.js} +2 -2
- package/dist/_chunks/{VvRadioGroup.es-B64sR46T.js.map → VvRadioGroup.es-CSNzOJKx.js.map} +1 -1
- package/dist/_chunks/{VvSelect.es-D_WR7HcC.js → VvSelect.es-CjKMd0nH.js} +2 -2
- package/dist/_chunks/{VvSelect.es-D_WR7HcC.js.map → VvSelect.es-CjKMd0nH.js.map} +1 -1
- package/dist/_chunks/{VvTextarea.es-DpF-slnp.js → VvTextarea.es-eEyRRpuT.js} +2 -2
- package/dist/_chunks/{VvTextarea.es-DpF-slnp.js.map → VvTextarea.es-eEyRRpuT.js.map} +1 -1
- package/dist/_chunks/index.es-BYny0uhz.js.map +1 -1
- package/dist/_chunks/{index.es-DN8D4nRq.js → index.es-eLFDkB2Y.js} +11 -11
- package/dist/_chunks/{index.es-DN8D4nRq.js.map → index.es-eLFDkB2Y.js.map} +1 -1
- package/dist/_chunks/{schemas-BsOP_5an.js → schemas-DnUKIqgi.js} +503 -503
- package/dist/_chunks/{schemas-BsOP_5an.js.map → schemas-DnUKIqgi.js.map} +1 -1
- package/dist/ai-elements.es.js +3867 -3744
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotAuth.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotFeedbackForm.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.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/{Document-q67u4D3u.js → Document-B8gv0e2O.js} +15 -15
- package/dist-vue/_chunks/{Document-q67u4D3u.js.map → Document-B8gv0e2O.js.map} +1 -1
- package/dist-vue/_chunks/{Media-BmW9F_3T.js → Media-B_7Yj-ml.js} +26 -26
- package/dist-vue/_chunks/{Media-BmW9F_3T.js.map → Media-B_7Yj-ml.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-A1jKttsQ.js → PkChatbot-CxpAotKB.js} +7 -7
- package/dist-vue/_chunks/{PkChatbot-A1jKttsQ.js.map → PkChatbot-CxpAotKB.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotAuth-C0ATmt-9.js → PkChatbotAuth-C_L2xWuD.js} +4 -4
- package/dist-vue/_chunks/{PkChatbotAuth-C0ATmt-9.js.map → PkChatbotAuth-C_L2xWuD.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-BGTSWFSS.js → PkChatbotEmptyState-BGOC6vxr.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-BGTSWFSS.js.map → PkChatbotEmptyState-BGOC6vxr.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotFeedbackForm-Dhsa1c06.js → PkChatbotFeedbackForm-BSe40qlc.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotFeedbackForm-Dhsa1c06.js.map → PkChatbotFeedbackForm-BSe40qlc.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-Be3J_Fgz.js → PkChatbotInput-DTazYlPd.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-Be3J_Fgz.js.map → PkChatbotInput-DTazYlPd.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-Cbn8okze.js → PkChatbotMessages-DEzcxcqc.js} +9 -9
- package/dist-vue/_chunks/{PkChatbotMessages-Cbn8okze.js.map → PkChatbotMessages-DEzcxcqc.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-BhqYCNWy.js → PkChatbotSteps-BpqdFhsG.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotSteps-BhqYCNWy.js.map → PkChatbotSteps-BpqdFhsG.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-Cc8bZfAr.js → PkChatbotViewChat-QzWSymIg.js} +6 -6
- package/dist-vue/_chunks/{PkChatbotViewChat-Cc8bZfAr.js.map → PkChatbotViewChat-QzWSymIg.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-BsfA4A7O.js → PkChatbotViewConversations-O-wm_nu1.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-BsfA4A7O.js.map → PkChatbotViewConversations-O-wm_nu1.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-C6aouWQh.js → PkChatbotViewFiles-RHMwvWUS.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-C6aouWQh.js.map → PkChatbotViewFiles-RHMwvWUS.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-B_ZAXIrC.js → PkChatbotViewProfile-Bka6CUAa.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-B_ZAXIrC.js.map → PkChatbotViewProfile-Bka6CUAa.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-CNLdk20r.js → PkStreamingMarkdown-DEhbK-3c.js} +43 -43
- package/dist-vue/_chunks/PkStreamingMarkdown-DEhbK-3c.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowArtifact-B2ilUNT0.js → PkToolShowArtifact-CTBwt4DN.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-B2ilUNT0.js.map → PkToolShowArtifact-CTBwt4DN.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-C3CXe6sh.js → PkToolShowContactForm-B6-MsExL.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowContactForm-C3CXe6sh.js.map → PkToolShowContactForm-B6-MsExL.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-DnzUxm2o.js → PkToolShowForm-C-mWyeka.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowForm-DnzUxm2o.js.map → PkToolShowForm-C-mWyeka.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-BF2-VGSg.js → PkToolShowSources-rGZz65c2.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowSources-BF2-VGSg.js.map → PkToolShowSources-rGZz65c2.js.map} +1 -1
- package/dist-vue/_chunks/{constants-DtnBK4PW.js → constants-BSe0uxSf.js} +4 -4
- package/dist-vue/_chunks/{constants-DtnBK4PW.js.map → constants-BSe0uxSf.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-BHfNaVk8.js → createChatbotApiClient-Bf5DbqVH.js} +125 -113
- package/dist-vue/_chunks/createChatbotApiClient-Bf5DbqVH.js.map +1 -0
- package/dist-vue/_chunks/{index.es-BODtrBxv.js → index.es-XfWQ82pb.js} +3 -3
- package/dist-vue/_chunks/{index.es-BODtrBxv.js.map → index.es-XfWQ82pb.js.map} +1 -1
- package/dist-vue/_chunks/{schemas-BsOP_5an.js → schemas-DnUKIqgi.js} +503 -503
- package/dist-vue/_chunks/{schemas-BsOP_5an.js.map → schemas-DnUKIqgi.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-bbenzuMe.js → useChatbotStore-DeHwEN8W.js} +845 -811
- package/dist-vue/_chunks/useChatbotStore-DeHwEN8W.js.map +1 -0
- package/dist-vue/api.js +1 -1
- package/dist-vue/apps/web-component/src/components/EmbeddedChatWidget.ce.d.ts +6 -0
- package/dist-vue/apps/web-component/src/composables/useChatbotAgent.d.ts +6 -0
- package/dist-vue/apps/web-component/src/lib.d.ts +1 -0
- package/dist-vue/composables.js +5 -3
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +23 -23
- package/dist-vue/packages/components/src/chat/PkChatbotMessages.d.ts +134 -3
- package/dist-vue/packages/components/src/chat/PkMessageParts.d.ts +134 -3
- package/dist-vue/packages/composable/src/chatbot/api/index.d.ts +1 -0
- package/dist-vue/packages/composable/src/chatbot/api/resolveShortUrls.d.ts +16 -0
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +24 -24
- package/package.json +3 -3
- package/dist/_chunks/PkStreamingMarkdown-Bns7j3b7.js.map +0 -1
- package/dist-vue/_chunks/PkStreamingMarkdown-CNLdk20r.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-BHfNaVk8.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-bbenzuMe.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { C as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u,
|
|
2
|
-
import { t as te } from "./createChatbotApiClient-
|
|
1
|
+
import { C as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, n as d, o as f, p, r as m, v as h, w as ee, y as g } from "./schemas-DnUKIqgi.js";
|
|
2
|
+
import { t as te } from "./createChatbotApiClient-Bf5DbqVH.js";
|
|
3
3
|
import { t as ne } from "./src-8QXYVWIx.js";
|
|
4
4
|
import { n as re } from "./message-RohfrdWS.js";
|
|
5
5
|
import { a as _, i as v, n as y, r as b, t as x } from "./ZodError-BoB_0oSl.js";
|
|
6
6
|
import { t as ie } from "./useSafeLocalStorage-BGbMO01p.js";
|
|
7
|
-
import { computed as S, getCurrentScope as ae, isReadonly as oe, onScopeDispose as
|
|
8
|
-
import { useI18n as
|
|
9
|
-
import { usePreferredDark as
|
|
10
|
-
import { defineStore as
|
|
7
|
+
import { computed as S, getCurrentScope as ae, isReadonly as oe, onScopeDispose as C, reactive as se, ref as w, toRefs as ce, watch as le, watchEffect as ue } from "vue";
|
|
8
|
+
import { useI18n as de } from "vue-i18n";
|
|
9
|
+
import { usePreferredDark as fe } from "@vueuse/core";
|
|
10
|
+
import { defineStore as T } from "pinia";
|
|
11
11
|
//#region ../../packages/utils/src/device-context.ts
|
|
12
|
-
function
|
|
12
|
+
function pe() {
|
|
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 me(e) {
|
|
43
43
|
if (!navigator.geolocation || !navigator.permissions) return null;
|
|
44
44
|
try {
|
|
45
45
|
if ((await navigator.permissions.query({ name: "geolocation" })).state !== "granted") return null;
|
|
@@ -58,45 +58,45 @@ async function he(e) {
|
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region ../../node_modules/.pnpm/@ai-sdk+provider@4.0.3/node_modules/@ai-sdk/provider/dist/index.js
|
|
61
|
-
var
|
|
61
|
+
var he = "vercel.ai.error", ge = Symbol.for(he), _e, ve, E = class e extends (ve = Error, _e = ge, ve) {
|
|
62
62
|
constructor({ name: e, message: t, cause: n }) {
|
|
63
|
-
super(t), this[
|
|
63
|
+
super(t), this[_e] = !0, this.name = e, this.cause = n;
|
|
64
64
|
}
|
|
65
65
|
static isInstance(t) {
|
|
66
|
-
return e.hasMarker(t,
|
|
66
|
+
return e.hasMarker(t, he);
|
|
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
|
};
|
|
73
|
-
function
|
|
73
|
+
function D(e) {
|
|
74
74
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
75
75
|
}
|
|
76
|
-
var
|
|
76
|
+
var ye = "AI_InvalidArgumentError", O = `vercel.ai.error.${ye}`, be = Symbol.for(O), xe, Se, Ce = class extends (Se = E, xe = be, Se) {
|
|
77
77
|
constructor({ message: e, cause: t, argument: n }) {
|
|
78
78
|
super({
|
|
79
|
-
name:
|
|
79
|
+
name: ye,
|
|
80
80
|
message: e,
|
|
81
81
|
cause: t
|
|
82
|
-
}), this[
|
|
82
|
+
}), this[xe] = !0, this.argument = n;
|
|
83
83
|
}
|
|
84
84
|
static isInstance(e) {
|
|
85
|
-
return
|
|
85
|
+
return E.hasMarker(e, O);
|
|
86
86
|
}
|
|
87
|
-
},
|
|
87
|
+
}, we = "AI_JSONParseError", k = `vercel.ai.error.${we}`, Te = Symbol.for(k), A, Ee, De = class extends (Ee = E, A = Te, Ee) {
|
|
88
88
|
constructor({ text: e, cause: t }) {
|
|
89
89
|
super({
|
|
90
|
-
name:
|
|
90
|
+
name: we,
|
|
91
91
|
message: `JSON parsing failed: Text: ${e}.
|
|
92
|
-
Error message: ${
|
|
92
|
+
Error message: ${D(t)}`,
|
|
93
93
|
cause: t
|
|
94
|
-
}), this[
|
|
94
|
+
}), this[A] = !0, this.text = e;
|
|
95
95
|
}
|
|
96
96
|
static isInstance(e) {
|
|
97
|
-
return
|
|
97
|
+
return E.hasMarker(e, k);
|
|
98
98
|
}
|
|
99
|
-
},
|
|
99
|
+
}, j = "AI_TypeValidationError", Oe = `vercel.ai.error.${j}`, ke = Symbol.for(Oe), Ae, je, M = class e extends (je = E, Ae = ke, je) {
|
|
100
100
|
constructor({ value: e, cause: t, context: n }) {
|
|
101
101
|
let r = "Type validation failed";
|
|
102
102
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -105,14 +105,14 @@ Error message: ${E(t)}`,
|
|
|
105
105
|
n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
|
|
106
106
|
}
|
|
107
107
|
super({
|
|
108
|
-
name:
|
|
108
|
+
name: j,
|
|
109
109
|
message: `${r}: Value: ${JSON.stringify(e)}.
|
|
110
|
-
Error message: ${
|
|
110
|
+
Error message: ${D(t)}`,
|
|
111
111
|
cause: t
|
|
112
|
-
}), this[
|
|
112
|
+
}), this[Ae] = !0, this.value = e, this.context = n;
|
|
113
113
|
}
|
|
114
114
|
static isInstance(e) {
|
|
115
|
-
return
|
|
115
|
+
return E.hasMarker(e, Oe);
|
|
116
116
|
}
|
|
117
117
|
static wrap({ value: t, cause: n, context: r }) {
|
|
118
118
|
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({
|
|
@@ -121,7 +121,7 @@ Error message: ${E(t)}`,
|
|
|
121
121
|
context: r
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
},
|
|
124
|
+
}, Me = (e, t) => {
|
|
125
125
|
let n;
|
|
126
126
|
switch (e.code) {
|
|
127
127
|
case y.invalid_type:
|
|
@@ -175,13 +175,13 @@ Error message: ${E(t)}`,
|
|
|
175
175
|
default: n = t.defaultError, _.assertNever(e);
|
|
176
176
|
}
|
|
177
177
|
return { message: n };
|
|
178
|
-
},
|
|
179
|
-
function
|
|
180
|
-
return
|
|
178
|
+
}, Ne = Me;
|
|
179
|
+
function Pe() {
|
|
180
|
+
return Ne;
|
|
181
181
|
}
|
|
182
182
|
//#endregion
|
|
183
183
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/helpers/parseUtil.js
|
|
184
|
-
var
|
|
184
|
+
var N = (e) => {
|
|
185
185
|
let { data: t, path: n, errorMaps: r, issueData: i } = e, a = [...n, ...i.path || []], o = {
|
|
186
186
|
...i,
|
|
187
187
|
path: a
|
|
@@ -202,8 +202,8 @@ var j = (e) => {
|
|
|
202
202
|
message: s
|
|
203
203
|
};
|
|
204
204
|
};
|
|
205
|
-
function
|
|
206
|
-
let n =
|
|
205
|
+
function P(e, t) {
|
|
206
|
+
let n = Pe(), r = N({
|
|
207
207
|
issueData: t,
|
|
208
208
|
data: e.data,
|
|
209
209
|
path: e.path,
|
|
@@ -211,12 +211,12 @@ function M(e, t) {
|
|
|
211
211
|
e.common.contextualErrorMap,
|
|
212
212
|
e.schemaErrorMap,
|
|
213
213
|
n,
|
|
214
|
-
n ===
|
|
214
|
+
n === Me ? void 0 : Me
|
|
215
215
|
].filter((e) => !!e)
|
|
216
216
|
});
|
|
217
217
|
e.common.issues.push(r);
|
|
218
218
|
}
|
|
219
|
-
var
|
|
219
|
+
var F = class e {
|
|
220
220
|
constructor() {
|
|
221
221
|
this.value = "valid";
|
|
222
222
|
}
|
|
@@ -229,7 +229,7 @@ var N = class e {
|
|
|
229
229
|
static mergeArray(e, t) {
|
|
230
230
|
let n = [];
|
|
231
231
|
for (let r of t) {
|
|
232
|
-
if (r.status === "aborted") return
|
|
232
|
+
if (r.status === "aborted") return I;
|
|
233
233
|
r.status === "dirty" && e.dirty(), n.push(r.value);
|
|
234
234
|
}
|
|
235
235
|
return {
|
|
@@ -252,7 +252,7 @@ var N = class e {
|
|
|
252
252
|
let n = {};
|
|
253
253
|
for (let r of t) {
|
|
254
254
|
let { key: t, value: i } = r;
|
|
255
|
-
if (t.status === "aborted" || i.status === "aborted") return
|
|
255
|
+
if (t.status === "aborted" || i.status === "aborted") return I;
|
|
256
256
|
t.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), t.value !== "__proto__" && (i.value !== void 0 || r.alwaysSet) && (n[t.value] = i.value);
|
|
257
257
|
}
|
|
258
258
|
return {
|
|
@@ -260,27 +260,27 @@ var N = class e {
|
|
|
260
260
|
value: n
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
|
-
},
|
|
263
|
+
}, I = Object.freeze({ status: "aborted" }), Fe = (e) => ({
|
|
264
264
|
status: "dirty",
|
|
265
265
|
value: e
|
|
266
|
-
}),
|
|
266
|
+
}), L = (e) => ({
|
|
267
267
|
status: "valid",
|
|
268
268
|
value: e
|
|
269
|
-
}),
|
|
269
|
+
}), Ie = (e) => e.status === "aborted", Le = (e) => e.status === "dirty", Re = (e) => e.status === "valid", ze = (e) => typeof Promise < "u" && e instanceof Promise, R;
|
|
270
270
|
(function(e) {
|
|
271
271
|
e.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, e.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
272
|
-
})(
|
|
272
|
+
})(R ||= {});
|
|
273
273
|
//#endregion
|
|
274
274
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/types.js
|
|
275
|
-
var
|
|
275
|
+
var z = class {
|
|
276
276
|
constructor(e, t, n, r) {
|
|
277
277
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = r;
|
|
278
278
|
}
|
|
279
279
|
get path() {
|
|
280
280
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
281
281
|
}
|
|
282
|
-
},
|
|
283
|
-
if (
|
|
282
|
+
}, Be = (e, t) => {
|
|
283
|
+
if (Re(t)) return {
|
|
284
284
|
success: !0,
|
|
285
285
|
data: t.value
|
|
286
286
|
};
|
|
@@ -294,7 +294,7 @@ var L = class {
|
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
296
|
};
|
|
297
|
-
function
|
|
297
|
+
function B(e) {
|
|
298
298
|
if (!e) return {};
|
|
299
299
|
let { errorMap: t, invalid_type_error: n, required_error: r, description: i } = e;
|
|
300
300
|
if (t && (n || r)) throw Error("Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.");
|
|
@@ -309,7 +309,7 @@ function R(e) {
|
|
|
309
309
|
description: i
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
|
-
var
|
|
312
|
+
var V = class {
|
|
313
313
|
get description() {
|
|
314
314
|
return this._def.description;
|
|
315
315
|
}
|
|
@@ -328,7 +328,7 @@ var z = class {
|
|
|
328
328
|
}
|
|
329
329
|
_processInputParams(e) {
|
|
330
330
|
return {
|
|
331
|
-
status: new
|
|
331
|
+
status: new F(),
|
|
332
332
|
ctx: {
|
|
333
333
|
common: e.parent.common,
|
|
334
334
|
data: e.data,
|
|
@@ -341,7 +341,7 @@ var z = class {
|
|
|
341
341
|
}
|
|
342
342
|
_parseSync(e) {
|
|
343
343
|
let t = this._parse(e);
|
|
344
|
-
if (
|
|
344
|
+
if (ze(t)) throw Error("Synchronous parse encountered promise.");
|
|
345
345
|
return t;
|
|
346
346
|
}
|
|
347
347
|
_parseAsync(e) {
|
|
@@ -366,7 +366,7 @@ var z = class {
|
|
|
366
366
|
data: e,
|
|
367
367
|
parsedType: v(e)
|
|
368
368
|
};
|
|
369
|
-
return
|
|
369
|
+
return Be(n, this._parseSync({
|
|
370
370
|
data: e,
|
|
371
371
|
path: n.path,
|
|
372
372
|
parent: n
|
|
@@ -390,7 +390,7 @@ var z = class {
|
|
|
390
390
|
path: [],
|
|
391
391
|
parent: t
|
|
392
392
|
});
|
|
393
|
-
return
|
|
393
|
+
return Re(n) ? { value: n.value } : { issues: t.common.issues };
|
|
394
394
|
} catch (e) {
|
|
395
395
|
e?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), t.common = {
|
|
396
396
|
issues: [],
|
|
@@ -401,7 +401,7 @@ var z = class {
|
|
|
401
401
|
data: e,
|
|
402
402
|
path: [],
|
|
403
403
|
parent: t
|
|
404
|
-
}).then((e) =>
|
|
404
|
+
}).then((e) => Re(e) ? { value: e.value } : { issues: t.common.issues });
|
|
405
405
|
}
|
|
406
406
|
async parseAsync(e, t) {
|
|
407
407
|
let n = await this.safeParseAsync(e, t);
|
|
@@ -425,7 +425,7 @@ var z = class {
|
|
|
425
425
|
path: n.path,
|
|
426
426
|
parent: n
|
|
427
427
|
});
|
|
428
|
-
return
|
|
428
|
+
return Be(n, await (ze(r) ? r : Promise.resolve(r)));
|
|
429
429
|
}
|
|
430
430
|
refine(e, t) {
|
|
431
431
|
let n = (e) => typeof t == "string" || t === void 0 ? { message: t } : typeof t == "function" ? t(e) : t;
|
|
@@ -470,20 +470,20 @@ var z = class {
|
|
|
470
470
|
return this.nullable().optional();
|
|
471
471
|
}
|
|
472
472
|
array() {
|
|
473
|
-
return
|
|
473
|
+
return wt.create(this);
|
|
474
474
|
}
|
|
475
475
|
promise() {
|
|
476
476
|
return Vt.create(this, this._def);
|
|
477
477
|
}
|
|
478
478
|
or(e) {
|
|
479
|
-
return
|
|
479
|
+
return Et.create([this, e], this._def);
|
|
480
480
|
}
|
|
481
481
|
and(e) {
|
|
482
482
|
return At.create(this, e, this._def);
|
|
483
483
|
}
|
|
484
484
|
transform(e) {
|
|
485
485
|
return new U({
|
|
486
|
-
...
|
|
486
|
+
...B(this._def),
|
|
487
487
|
schema: this,
|
|
488
488
|
typeName: G.ZodEffects,
|
|
489
489
|
effect: {
|
|
@@ -495,7 +495,7 @@ var z = class {
|
|
|
495
495
|
default(e) {
|
|
496
496
|
let t = typeof e == "function" ? e : () => e;
|
|
497
497
|
return new Ut({
|
|
498
|
-
...
|
|
498
|
+
...B(this._def),
|
|
499
499
|
innerType: this,
|
|
500
500
|
defaultValue: t,
|
|
501
501
|
typeName: G.ZodDefault
|
|
@@ -505,13 +505,13 @@ var z = class {
|
|
|
505
505
|
return new Kt({
|
|
506
506
|
typeName: G.ZodBranded,
|
|
507
507
|
type: this,
|
|
508
|
-
...
|
|
508
|
+
...B(this._def)
|
|
509
509
|
});
|
|
510
510
|
}
|
|
511
511
|
catch(e) {
|
|
512
512
|
let t = typeof e == "function" ? e : () => e;
|
|
513
513
|
return new Wt({
|
|
514
|
-
...
|
|
514
|
+
...B(this._def),
|
|
515
515
|
innerType: this,
|
|
516
516
|
catchValue: t,
|
|
517
517
|
typeName: G.ZodCatch
|
|
@@ -536,25 +536,25 @@ var z = class {
|
|
|
536
536
|
isNullable() {
|
|
537
537
|
return this.safeParse(null).success;
|
|
538
538
|
}
|
|
539
|
-
},
|
|
540
|
-
function
|
|
539
|
+
}, Ve = /^c[^\s-]{8,}$/i, He = /^[0-9a-z]+$/, Ue = /^[0-9A-HJKMNP-TV-Z]{26}$/i, We = /^[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}$/i, Ge = /^[a-z0-9_-]{21}$/i, Ke = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, qe = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Je = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ye = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", Xe, Ze = /^(?:(?: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])$/, Qe = /^(?:(?: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])$/, $e = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, et = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, tt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, nt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, rt = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", it = RegExp(`^${rt}$`);
|
|
540
|
+
function at(e) {
|
|
541
541
|
let t = "[0-5]\\d";
|
|
542
542
|
e.precision ? t = `${t}\\.\\d{${e.precision}}` : e.precision ?? (t = `${t}(\\.\\d+)?`);
|
|
543
543
|
let n = e.precision ? "+" : "?";
|
|
544
544
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
547
|
-
return RegExp(`^${
|
|
546
|
+
function ot(e) {
|
|
547
|
+
return RegExp(`^${at(e)}$`);
|
|
548
548
|
}
|
|
549
|
-
function
|
|
550
|
-
let t = `${
|
|
549
|
+
function st(e) {
|
|
550
|
+
let t = `${rt}T${at(e)}`, n = [];
|
|
551
551
|
return n.push(e.local ? "Z?" : "Z"), e.offset && n.push("([+-]\\d{2}:?\\d{2})"), t = `${t}(${n.join("|")})`, RegExp(`^${t}$`);
|
|
552
552
|
}
|
|
553
|
-
function
|
|
554
|
-
return !!((t === "v4" || !t) &&
|
|
553
|
+
function ct(e, t) {
|
|
554
|
+
return !!((t === "v4" || !t) && Ze.test(e) || (t === "v6" || !t) && $e.test(e));
|
|
555
555
|
}
|
|
556
|
-
function
|
|
557
|
-
if (!
|
|
556
|
+
function lt(e, t) {
|
|
557
|
+
if (!Ke.test(e)) return !1;
|
|
558
558
|
try {
|
|
559
559
|
let [n] = e.split(".");
|
|
560
560
|
if (!n) return !1;
|
|
@@ -564,21 +564,21 @@ function dt(e, t) {
|
|
|
564
564
|
return !1;
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
function
|
|
568
|
-
return !!((t === "v4" || !t) &&
|
|
567
|
+
function ut(e, t) {
|
|
568
|
+
return !!((t === "v4" || !t) && Qe.test(e) || (t === "v6" || !t) && et.test(e));
|
|
569
569
|
}
|
|
570
|
-
var
|
|
570
|
+
var dt = class e extends V {
|
|
571
571
|
_parse(e) {
|
|
572
572
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== b.string) {
|
|
573
573
|
let t = this._getOrReturnCtx(e);
|
|
574
|
-
return
|
|
574
|
+
return P(t, {
|
|
575
575
|
code: y.invalid_type,
|
|
576
576
|
expected: b.string,
|
|
577
577
|
received: t.parsedType
|
|
578
|
-
}),
|
|
578
|
+
}), I;
|
|
579
579
|
}
|
|
580
|
-
let t = new
|
|
581
|
-
for (let r of this._def.checks) if (r.kind === "min") e.data.length < r.value && (n = this._getOrReturnCtx(e, n),
|
|
580
|
+
let t = new F(), n;
|
|
581
|
+
for (let r of this._def.checks) if (r.kind === "min") e.data.length < r.value && (n = this._getOrReturnCtx(e, n), P(n, {
|
|
582
582
|
code: y.too_small,
|
|
583
583
|
minimum: r.value,
|
|
584
584
|
type: "string",
|
|
@@ -586,7 +586,7 @@ var pt = class e extends z {
|
|
|
586
586
|
exact: !1,
|
|
587
587
|
message: r.message
|
|
588
588
|
}), t.dirty());
|
|
589
|
-
else if (r.kind === "max") e.data.length > r.value && (n = this._getOrReturnCtx(e, n),
|
|
589
|
+
else if (r.kind === "max") e.data.length > r.value && (n = this._getOrReturnCtx(e, n), P(n, {
|
|
590
590
|
code: y.too_big,
|
|
591
591
|
maximum: r.value,
|
|
592
592
|
type: "string",
|
|
@@ -596,14 +596,14 @@ var pt = class e extends z {
|
|
|
596
596
|
}), t.dirty());
|
|
597
597
|
else if (r.kind === "length") {
|
|
598
598
|
let i = e.data.length > r.value, a = e.data.length < r.value;
|
|
599
|
-
(i || a) && (n = this._getOrReturnCtx(e, n), i ?
|
|
599
|
+
(i || a) && (n = this._getOrReturnCtx(e, n), i ? P(n, {
|
|
600
600
|
code: y.too_big,
|
|
601
601
|
maximum: r.value,
|
|
602
602
|
type: "string",
|
|
603
603
|
inclusive: !0,
|
|
604
604
|
exact: !0,
|
|
605
605
|
message: r.message
|
|
606
|
-
}) : a &&
|
|
606
|
+
}) : a && P(n, {
|
|
607
607
|
code: y.too_small,
|
|
608
608
|
minimum: r.value,
|
|
609
609
|
type: "string",
|
|
@@ -611,37 +611,37 @@ var pt = class e extends z {
|
|
|
611
611
|
exact: !0,
|
|
612
612
|
message: r.message
|
|
613
613
|
}), t.dirty());
|
|
614
|
-
} else if (r.kind === "email")
|
|
614
|
+
} else if (r.kind === "email") Je.test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
615
615
|
validation: "email",
|
|
616
616
|
code: y.invalid_string,
|
|
617
617
|
message: r.message
|
|
618
618
|
}), t.dirty());
|
|
619
|
-
else if (r.kind === "emoji")
|
|
619
|
+
else if (r.kind === "emoji") Xe ||= new RegExp(Ye, "u"), Xe.test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
620
620
|
validation: "emoji",
|
|
621
621
|
code: y.invalid_string,
|
|
622
622
|
message: r.message
|
|
623
623
|
}), t.dirty());
|
|
624
|
-
else if (r.kind === "uuid")
|
|
624
|
+
else if (r.kind === "uuid") We.test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
625
625
|
validation: "uuid",
|
|
626
626
|
code: y.invalid_string,
|
|
627
627
|
message: r.message
|
|
628
628
|
}), t.dirty());
|
|
629
|
-
else if (r.kind === "nanoid")
|
|
629
|
+
else if (r.kind === "nanoid") Ge.test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
630
630
|
validation: "nanoid",
|
|
631
631
|
code: y.invalid_string,
|
|
632
632
|
message: r.message
|
|
633
633
|
}), t.dirty());
|
|
634
|
-
else if (r.kind === "cuid")
|
|
634
|
+
else if (r.kind === "cuid") Ve.test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
635
635
|
validation: "cuid",
|
|
636
636
|
code: y.invalid_string,
|
|
637
637
|
message: r.message
|
|
638
638
|
}), t.dirty());
|
|
639
|
-
else if (r.kind === "cuid2")
|
|
639
|
+
else if (r.kind === "cuid2") He.test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
640
640
|
validation: "cuid2",
|
|
641
641
|
code: y.invalid_string,
|
|
642
642
|
message: r.message
|
|
643
643
|
}), t.dirty());
|
|
644
|
-
else if (r.kind === "ulid")
|
|
644
|
+
else if (r.kind === "ulid") Ue.test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
645
645
|
validation: "ulid",
|
|
646
646
|
code: y.invalid_string,
|
|
647
647
|
message: r.message
|
|
@@ -649,64 +649,64 @@ var pt = class e extends z {
|
|
|
649
649
|
else if (r.kind === "url") try {
|
|
650
650
|
new URL(e.data);
|
|
651
651
|
} catch {
|
|
652
|
-
n = this._getOrReturnCtx(e, n),
|
|
652
|
+
n = this._getOrReturnCtx(e, n), P(n, {
|
|
653
653
|
validation: "url",
|
|
654
654
|
code: y.invalid_string,
|
|
655
655
|
message: r.message
|
|
656
656
|
}), t.dirty();
|
|
657
657
|
}
|
|
658
|
-
else r.kind === "regex" ? (r.regex.lastIndex = 0, r.regex.test(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
658
|
+
else r.kind === "regex" ? (r.regex.lastIndex = 0, r.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
659
659
|
validation: "regex",
|
|
660
660
|
code: y.invalid_string,
|
|
661
661
|
message: r.message
|
|
662
|
-
}), t.dirty())) : r.kind === "trim" ? e.data = e.data.trim() : r.kind === "includes" ? e.data.includes(r.value, r.position) || (n = this._getOrReturnCtx(e, n),
|
|
662
|
+
}), t.dirty())) : r.kind === "trim" ? e.data = e.data.trim() : r.kind === "includes" ? e.data.includes(r.value, r.position) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
663
663
|
code: y.invalid_string,
|
|
664
664
|
validation: {
|
|
665
665
|
includes: r.value,
|
|
666
666
|
position: r.position
|
|
667
667
|
},
|
|
668
668
|
message: r.message
|
|
669
|
-
}), t.dirty()) : r.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : r.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : r.kind === "startsWith" ? e.data.startsWith(r.value) || (n = this._getOrReturnCtx(e, n),
|
|
669
|
+
}), t.dirty()) : r.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : r.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : r.kind === "startsWith" ? e.data.startsWith(r.value) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
670
670
|
code: y.invalid_string,
|
|
671
671
|
validation: { startsWith: r.value },
|
|
672
672
|
message: r.message
|
|
673
|
-
}), t.dirty()) : r.kind === "endsWith" ? e.data.endsWith(r.value) || (n = this._getOrReturnCtx(e, n),
|
|
673
|
+
}), t.dirty()) : r.kind === "endsWith" ? e.data.endsWith(r.value) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
674
674
|
code: y.invalid_string,
|
|
675
675
|
validation: { endsWith: r.value },
|
|
676
676
|
message: r.message
|
|
677
|
-
}), t.dirty()) : r.kind === "datetime" ?
|
|
677
|
+
}), t.dirty()) : r.kind === "datetime" ? st(r).test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
678
678
|
code: y.invalid_string,
|
|
679
679
|
validation: "datetime",
|
|
680
680
|
message: r.message
|
|
681
|
-
}), t.dirty()) : r.kind === "date" ?
|
|
681
|
+
}), t.dirty()) : r.kind === "date" ? it.test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
682
682
|
code: y.invalid_string,
|
|
683
683
|
validation: "date",
|
|
684
684
|
message: r.message
|
|
685
|
-
}), t.dirty()) : r.kind === "time" ?
|
|
685
|
+
}), t.dirty()) : r.kind === "time" ? ot(r).test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
686
686
|
code: y.invalid_string,
|
|
687
687
|
validation: "time",
|
|
688
688
|
message: r.message
|
|
689
|
-
}), t.dirty()) : r.kind === "duration" ?
|
|
689
|
+
}), t.dirty()) : r.kind === "duration" ? qe.test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
690
690
|
validation: "duration",
|
|
691
691
|
code: y.invalid_string,
|
|
692
692
|
message: r.message
|
|
693
|
-
}), t.dirty()) : r.kind === "ip" ?
|
|
693
|
+
}), t.dirty()) : r.kind === "ip" ? ct(e.data, r.version) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
694
694
|
validation: "ip",
|
|
695
695
|
code: y.invalid_string,
|
|
696
696
|
message: r.message
|
|
697
|
-
}), t.dirty()) : r.kind === "jwt" ?
|
|
697
|
+
}), t.dirty()) : r.kind === "jwt" ? lt(e.data, r.alg) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
698
698
|
validation: "jwt",
|
|
699
699
|
code: y.invalid_string,
|
|
700
700
|
message: r.message
|
|
701
|
-
}), t.dirty()) : r.kind === "cidr" ?
|
|
701
|
+
}), t.dirty()) : r.kind === "cidr" ? ut(e.data, r.version) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
702
702
|
validation: "cidr",
|
|
703
703
|
code: y.invalid_string,
|
|
704
704
|
message: r.message
|
|
705
|
-
}), t.dirty()) : r.kind === "base64" ?
|
|
705
|
+
}), t.dirty()) : r.kind === "base64" ? tt.test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
706
706
|
validation: "base64",
|
|
707
707
|
code: y.invalid_string,
|
|
708
708
|
message: r.message
|
|
709
|
-
}), t.dirty()) : r.kind === "base64url" ?
|
|
709
|
+
}), t.dirty()) : r.kind === "base64url" ? nt.test(e.data) || (n = this._getOrReturnCtx(e, n), P(n, {
|
|
710
710
|
validation: "base64url",
|
|
711
711
|
code: y.invalid_string,
|
|
712
712
|
message: r.message
|
|
@@ -720,7 +720,7 @@ var pt = class e extends z {
|
|
|
720
720
|
return this.refinement((t) => e.test(t), {
|
|
721
721
|
validation: t,
|
|
722
722
|
code: y.invalid_string,
|
|
723
|
-
...
|
|
723
|
+
...R.errToObj(n)
|
|
724
724
|
});
|
|
725
725
|
}
|
|
726
726
|
_addCheck(t) {
|
|
@@ -732,79 +732,79 @@ var pt = class e extends z {
|
|
|
732
732
|
email(e) {
|
|
733
733
|
return this._addCheck({
|
|
734
734
|
kind: "email",
|
|
735
|
-
...
|
|
735
|
+
...R.errToObj(e)
|
|
736
736
|
});
|
|
737
737
|
}
|
|
738
738
|
url(e) {
|
|
739
739
|
return this._addCheck({
|
|
740
740
|
kind: "url",
|
|
741
|
-
...
|
|
741
|
+
...R.errToObj(e)
|
|
742
742
|
});
|
|
743
743
|
}
|
|
744
744
|
emoji(e) {
|
|
745
745
|
return this._addCheck({
|
|
746
746
|
kind: "emoji",
|
|
747
|
-
...
|
|
747
|
+
...R.errToObj(e)
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
uuid(e) {
|
|
751
751
|
return this._addCheck({
|
|
752
752
|
kind: "uuid",
|
|
753
|
-
...
|
|
753
|
+
...R.errToObj(e)
|
|
754
754
|
});
|
|
755
755
|
}
|
|
756
756
|
nanoid(e) {
|
|
757
757
|
return this._addCheck({
|
|
758
758
|
kind: "nanoid",
|
|
759
|
-
...
|
|
759
|
+
...R.errToObj(e)
|
|
760
760
|
});
|
|
761
761
|
}
|
|
762
762
|
cuid(e) {
|
|
763
763
|
return this._addCheck({
|
|
764
764
|
kind: "cuid",
|
|
765
|
-
...
|
|
765
|
+
...R.errToObj(e)
|
|
766
766
|
});
|
|
767
767
|
}
|
|
768
768
|
cuid2(e) {
|
|
769
769
|
return this._addCheck({
|
|
770
770
|
kind: "cuid2",
|
|
771
|
-
...
|
|
771
|
+
...R.errToObj(e)
|
|
772
772
|
});
|
|
773
773
|
}
|
|
774
774
|
ulid(e) {
|
|
775
775
|
return this._addCheck({
|
|
776
776
|
kind: "ulid",
|
|
777
|
-
...
|
|
777
|
+
...R.errToObj(e)
|
|
778
778
|
});
|
|
779
779
|
}
|
|
780
780
|
base64(e) {
|
|
781
781
|
return this._addCheck({
|
|
782
782
|
kind: "base64",
|
|
783
|
-
...
|
|
783
|
+
...R.errToObj(e)
|
|
784
784
|
});
|
|
785
785
|
}
|
|
786
786
|
base64url(e) {
|
|
787
787
|
return this._addCheck({
|
|
788
788
|
kind: "base64url",
|
|
789
|
-
...
|
|
789
|
+
...R.errToObj(e)
|
|
790
790
|
});
|
|
791
791
|
}
|
|
792
792
|
jwt(e) {
|
|
793
793
|
return this._addCheck({
|
|
794
794
|
kind: "jwt",
|
|
795
|
-
...
|
|
795
|
+
...R.errToObj(e)
|
|
796
796
|
});
|
|
797
797
|
}
|
|
798
798
|
ip(e) {
|
|
799
799
|
return this._addCheck({
|
|
800
800
|
kind: "ip",
|
|
801
|
-
...
|
|
801
|
+
...R.errToObj(e)
|
|
802
802
|
});
|
|
803
803
|
}
|
|
804
804
|
cidr(e) {
|
|
805
805
|
return this._addCheck({
|
|
806
806
|
kind: "cidr",
|
|
807
|
-
...
|
|
807
|
+
...R.errToObj(e)
|
|
808
808
|
});
|
|
809
809
|
}
|
|
810
810
|
datetime(e) {
|
|
@@ -819,7 +819,7 @@ var pt = class e extends z {
|
|
|
819
819
|
precision: e?.precision === void 0 ? null : e?.precision,
|
|
820
820
|
offset: e?.offset ?? !1,
|
|
821
821
|
local: e?.local ?? !1,
|
|
822
|
-
...
|
|
822
|
+
...R.errToObj(e?.message)
|
|
823
823
|
});
|
|
824
824
|
}
|
|
825
825
|
date(e) {
|
|
@@ -836,20 +836,20 @@ var pt = class e extends z {
|
|
|
836
836
|
}) : this._addCheck({
|
|
837
837
|
kind: "time",
|
|
838
838
|
precision: e?.precision === void 0 ? null : e?.precision,
|
|
839
|
-
...
|
|
839
|
+
...R.errToObj(e?.message)
|
|
840
840
|
});
|
|
841
841
|
}
|
|
842
842
|
duration(e) {
|
|
843
843
|
return this._addCheck({
|
|
844
844
|
kind: "duration",
|
|
845
|
-
...
|
|
845
|
+
...R.errToObj(e)
|
|
846
846
|
});
|
|
847
847
|
}
|
|
848
848
|
regex(e, t) {
|
|
849
849
|
return this._addCheck({
|
|
850
850
|
kind: "regex",
|
|
851
851
|
regex: e,
|
|
852
|
-
...
|
|
852
|
+
...R.errToObj(t)
|
|
853
853
|
});
|
|
854
854
|
}
|
|
855
855
|
includes(e, t) {
|
|
@@ -857,46 +857,46 @@ var pt = class e extends z {
|
|
|
857
857
|
kind: "includes",
|
|
858
858
|
value: e,
|
|
859
859
|
position: t?.position,
|
|
860
|
-
...
|
|
860
|
+
...R.errToObj(t?.message)
|
|
861
861
|
});
|
|
862
862
|
}
|
|
863
863
|
startsWith(e, t) {
|
|
864
864
|
return this._addCheck({
|
|
865
865
|
kind: "startsWith",
|
|
866
866
|
value: e,
|
|
867
|
-
...
|
|
867
|
+
...R.errToObj(t)
|
|
868
868
|
});
|
|
869
869
|
}
|
|
870
870
|
endsWith(e, t) {
|
|
871
871
|
return this._addCheck({
|
|
872
872
|
kind: "endsWith",
|
|
873
873
|
value: e,
|
|
874
|
-
...
|
|
874
|
+
...R.errToObj(t)
|
|
875
875
|
});
|
|
876
876
|
}
|
|
877
877
|
min(e, t) {
|
|
878
878
|
return this._addCheck({
|
|
879
879
|
kind: "min",
|
|
880
880
|
value: e,
|
|
881
|
-
...
|
|
881
|
+
...R.errToObj(t)
|
|
882
882
|
});
|
|
883
883
|
}
|
|
884
884
|
max(e, t) {
|
|
885
885
|
return this._addCheck({
|
|
886
886
|
kind: "max",
|
|
887
887
|
value: e,
|
|
888
|
-
...
|
|
888
|
+
...R.errToObj(t)
|
|
889
889
|
});
|
|
890
890
|
}
|
|
891
891
|
length(e, t) {
|
|
892
892
|
return this._addCheck({
|
|
893
893
|
kind: "length",
|
|
894
894
|
value: e,
|
|
895
|
-
...
|
|
895
|
+
...R.errToObj(t)
|
|
896
896
|
});
|
|
897
897
|
}
|
|
898
898
|
nonempty(e) {
|
|
899
|
-
return this.min(1,
|
|
899
|
+
return this.min(1, R.errToObj(e));
|
|
900
900
|
}
|
|
901
901
|
trim() {
|
|
902
902
|
return new e({
|
|
@@ -975,54 +975,54 @@ var pt = class e extends z {
|
|
|
975
975
|
return e;
|
|
976
976
|
}
|
|
977
977
|
};
|
|
978
|
-
|
|
978
|
+
dt.create = (e) => new dt({
|
|
979
979
|
checks: [],
|
|
980
980
|
typeName: G.ZodString,
|
|
981
981
|
coerce: e?.coerce ?? !1,
|
|
982
|
-
...
|
|
982
|
+
...B(e)
|
|
983
983
|
});
|
|
984
|
-
function
|
|
984
|
+
function ft(e, t) {
|
|
985
985
|
let n = (e.toString().split(".")[1] || "").length, r = (t.toString().split(".")[1] || "").length, i = n > r ? n : r;
|
|
986
986
|
return Number.parseInt(e.toFixed(i).replace(".", "")) % Number.parseInt(t.toFixed(i).replace(".", "")) / 10 ** i;
|
|
987
987
|
}
|
|
988
|
-
var
|
|
988
|
+
var pt = class e extends V {
|
|
989
989
|
constructor() {
|
|
990
990
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
991
991
|
}
|
|
992
992
|
_parse(e) {
|
|
993
993
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== b.number) {
|
|
994
994
|
let t = this._getOrReturnCtx(e);
|
|
995
|
-
return
|
|
995
|
+
return P(t, {
|
|
996
996
|
code: y.invalid_type,
|
|
997
997
|
expected: b.number,
|
|
998
998
|
received: t.parsedType
|
|
999
|
-
}),
|
|
999
|
+
}), I;
|
|
1000
1000
|
}
|
|
1001
|
-
let t, n = new
|
|
1002
|
-
for (let r of this._def.checks) r.kind === "int" ? _.isInteger(e.data) || (t = this._getOrReturnCtx(e, t),
|
|
1001
|
+
let t, n = new F();
|
|
1002
|
+
for (let r of this._def.checks) r.kind === "int" ? _.isInteger(e.data) || (t = this._getOrReturnCtx(e, t), P(t, {
|
|
1003
1003
|
code: y.invalid_type,
|
|
1004
1004
|
expected: "integer",
|
|
1005
1005
|
received: "float",
|
|
1006
1006
|
message: r.message
|
|
1007
|
-
}), n.dirty()) : r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (t = this._getOrReturnCtx(e, t),
|
|
1007
|
+
}), n.dirty()) : r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (t = this._getOrReturnCtx(e, t), P(t, {
|
|
1008
1008
|
code: y.too_small,
|
|
1009
1009
|
minimum: r.value,
|
|
1010
1010
|
type: "number",
|
|
1011
1011
|
inclusive: r.inclusive,
|
|
1012
1012
|
exact: !1,
|
|
1013
1013
|
message: r.message
|
|
1014
|
-
}), n.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (t = this._getOrReturnCtx(e, t),
|
|
1014
|
+
}), n.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (t = this._getOrReturnCtx(e, t), P(t, {
|
|
1015
1015
|
code: y.too_big,
|
|
1016
1016
|
maximum: r.value,
|
|
1017
1017
|
type: "number",
|
|
1018
1018
|
inclusive: r.inclusive,
|
|
1019
1019
|
exact: !1,
|
|
1020
1020
|
message: r.message
|
|
1021
|
-
}), n.dirty()) : r.kind === "multipleOf" ?
|
|
1021
|
+
}), n.dirty()) : r.kind === "multipleOf" ? ft(e.data, r.value) !== 0 && (t = this._getOrReturnCtx(e, t), P(t, {
|
|
1022
1022
|
code: y.not_multiple_of,
|
|
1023
1023
|
multipleOf: r.value,
|
|
1024
1024
|
message: r.message
|
|
1025
|
-
}), n.dirty()) : r.kind === "finite" ? Number.isFinite(e.data) || (t = this._getOrReturnCtx(e, t),
|
|
1025
|
+
}), n.dirty()) : r.kind === "finite" ? Number.isFinite(e.data) || (t = this._getOrReturnCtx(e, t), P(t, {
|
|
1026
1026
|
code: y.not_finite,
|
|
1027
1027
|
message: r.message
|
|
1028
1028
|
}), n.dirty()) : _.assertNever(r);
|
|
@@ -1032,16 +1032,16 @@ var ht = class e extends z {
|
|
|
1032
1032
|
};
|
|
1033
1033
|
}
|
|
1034
1034
|
gte(e, t) {
|
|
1035
|
-
return this.setLimit("min", e, !0,
|
|
1035
|
+
return this.setLimit("min", e, !0, R.toString(t));
|
|
1036
1036
|
}
|
|
1037
1037
|
gt(e, t) {
|
|
1038
|
-
return this.setLimit("min", e, !1,
|
|
1038
|
+
return this.setLimit("min", e, !1, R.toString(t));
|
|
1039
1039
|
}
|
|
1040
1040
|
lte(e, t) {
|
|
1041
|
-
return this.setLimit("max", e, !0,
|
|
1041
|
+
return this.setLimit("max", e, !0, R.toString(t));
|
|
1042
1042
|
}
|
|
1043
1043
|
lt(e, t) {
|
|
1044
|
-
return this.setLimit("max", e, !1,
|
|
1044
|
+
return this.setLimit("max", e, !1, R.toString(t));
|
|
1045
1045
|
}
|
|
1046
1046
|
setLimit(t, n, r, i) {
|
|
1047
1047
|
return new e({
|
|
@@ -1050,7 +1050,7 @@ var ht = class e extends z {
|
|
|
1050
1050
|
kind: t,
|
|
1051
1051
|
value: n,
|
|
1052
1052
|
inclusive: r,
|
|
1053
|
-
message:
|
|
1053
|
+
message: R.toString(i)
|
|
1054
1054
|
}]
|
|
1055
1055
|
});
|
|
1056
1056
|
}
|
|
@@ -1063,7 +1063,7 @@ var ht = class e extends z {
|
|
|
1063
1063
|
int(e) {
|
|
1064
1064
|
return this._addCheck({
|
|
1065
1065
|
kind: "int",
|
|
1066
|
-
message:
|
|
1066
|
+
message: R.toString(e)
|
|
1067
1067
|
});
|
|
1068
1068
|
}
|
|
1069
1069
|
positive(e) {
|
|
@@ -1071,7 +1071,7 @@ var ht = class e extends z {
|
|
|
1071
1071
|
kind: "min",
|
|
1072
1072
|
value: 0,
|
|
1073
1073
|
inclusive: !1,
|
|
1074
|
-
message:
|
|
1074
|
+
message: R.toString(e)
|
|
1075
1075
|
});
|
|
1076
1076
|
}
|
|
1077
1077
|
negative(e) {
|
|
@@ -1079,7 +1079,7 @@ var ht = class e extends z {
|
|
|
1079
1079
|
kind: "max",
|
|
1080
1080
|
value: 0,
|
|
1081
1081
|
inclusive: !1,
|
|
1082
|
-
message:
|
|
1082
|
+
message: R.toString(e)
|
|
1083
1083
|
});
|
|
1084
1084
|
}
|
|
1085
1085
|
nonpositive(e) {
|
|
@@ -1087,7 +1087,7 @@ var ht = class e extends z {
|
|
|
1087
1087
|
kind: "max",
|
|
1088
1088
|
value: 0,
|
|
1089
1089
|
inclusive: !0,
|
|
1090
|
-
message:
|
|
1090
|
+
message: R.toString(e)
|
|
1091
1091
|
});
|
|
1092
1092
|
}
|
|
1093
1093
|
nonnegative(e) {
|
|
@@ -1095,20 +1095,20 @@ var ht = class e extends z {
|
|
|
1095
1095
|
kind: "min",
|
|
1096
1096
|
value: 0,
|
|
1097
1097
|
inclusive: !0,
|
|
1098
|
-
message:
|
|
1098
|
+
message: R.toString(e)
|
|
1099
1099
|
});
|
|
1100
1100
|
}
|
|
1101
1101
|
multipleOf(e, t) {
|
|
1102
1102
|
return this._addCheck({
|
|
1103
1103
|
kind: "multipleOf",
|
|
1104
1104
|
value: e,
|
|
1105
|
-
message:
|
|
1105
|
+
message: R.toString(t)
|
|
1106
1106
|
});
|
|
1107
1107
|
}
|
|
1108
1108
|
finite(e) {
|
|
1109
1109
|
return this._addCheck({
|
|
1110
1110
|
kind: "finite",
|
|
1111
|
-
message:
|
|
1111
|
+
message: R.toString(e)
|
|
1112
1112
|
});
|
|
1113
1113
|
}
|
|
1114
1114
|
safe(e) {
|
|
@@ -1116,12 +1116,12 @@ var ht = class e extends z {
|
|
|
1116
1116
|
kind: "min",
|
|
1117
1117
|
inclusive: !0,
|
|
1118
1118
|
value: -(2 ** 53 - 1),
|
|
1119
|
-
message:
|
|
1119
|
+
message: R.toString(e)
|
|
1120
1120
|
})._addCheck({
|
|
1121
1121
|
kind: "max",
|
|
1122
1122
|
inclusive: !0,
|
|
1123
1123
|
value: 2 ** 53 - 1,
|
|
1124
|
-
message:
|
|
1124
|
+
message: R.toString(e)
|
|
1125
1125
|
});
|
|
1126
1126
|
}
|
|
1127
1127
|
get minValue() {
|
|
@@ -1144,13 +1144,13 @@ var ht = class e extends z {
|
|
|
1144
1144
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1145
1145
|
}
|
|
1146
1146
|
};
|
|
1147
|
-
|
|
1147
|
+
pt.create = (e) => new pt({
|
|
1148
1148
|
checks: [],
|
|
1149
1149
|
typeName: G.ZodNumber,
|
|
1150
1150
|
coerce: e?.coerce || !1,
|
|
1151
|
-
...
|
|
1151
|
+
...B(e)
|
|
1152
1152
|
});
|
|
1153
|
-
var
|
|
1153
|
+
var mt = class e extends V {
|
|
1154
1154
|
constructor() {
|
|
1155
1155
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1156
1156
|
}
|
|
@@ -1161,20 +1161,20 @@ var gt = class e extends z {
|
|
|
1161
1161
|
return this._getInvalidInput(e);
|
|
1162
1162
|
}
|
|
1163
1163
|
if (this._getType(e) !== b.bigint) return this._getInvalidInput(e);
|
|
1164
|
-
let t, n = new
|
|
1165
|
-
for (let r of this._def.checks) r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (t = this._getOrReturnCtx(e, t),
|
|
1164
|
+
let t, n = new F();
|
|
1165
|
+
for (let r of this._def.checks) r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (t = this._getOrReturnCtx(e, t), P(t, {
|
|
1166
1166
|
code: y.too_small,
|
|
1167
1167
|
type: "bigint",
|
|
1168
1168
|
minimum: r.value,
|
|
1169
1169
|
inclusive: r.inclusive,
|
|
1170
1170
|
message: r.message
|
|
1171
|
-
}), n.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (t = this._getOrReturnCtx(e, t),
|
|
1171
|
+
}), n.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (t = this._getOrReturnCtx(e, t), P(t, {
|
|
1172
1172
|
code: y.too_big,
|
|
1173
1173
|
type: "bigint",
|
|
1174
1174
|
maximum: r.value,
|
|
1175
1175
|
inclusive: r.inclusive,
|
|
1176
1176
|
message: r.message
|
|
1177
|
-
}), n.dirty()) : r.kind === "multipleOf" ? e.data % r.value !== BigInt(0) && (t = this._getOrReturnCtx(e, t),
|
|
1177
|
+
}), n.dirty()) : r.kind === "multipleOf" ? e.data % r.value !== BigInt(0) && (t = this._getOrReturnCtx(e, t), P(t, {
|
|
1178
1178
|
code: y.not_multiple_of,
|
|
1179
1179
|
multipleOf: r.value,
|
|
1180
1180
|
message: r.message
|
|
@@ -1186,23 +1186,23 @@ var gt = class e extends z {
|
|
|
1186
1186
|
}
|
|
1187
1187
|
_getInvalidInput(e) {
|
|
1188
1188
|
let t = this._getOrReturnCtx(e);
|
|
1189
|
-
return
|
|
1189
|
+
return P(t, {
|
|
1190
1190
|
code: y.invalid_type,
|
|
1191
1191
|
expected: b.bigint,
|
|
1192
1192
|
received: t.parsedType
|
|
1193
|
-
}),
|
|
1193
|
+
}), I;
|
|
1194
1194
|
}
|
|
1195
1195
|
gte(e, t) {
|
|
1196
|
-
return this.setLimit("min", e, !0,
|
|
1196
|
+
return this.setLimit("min", e, !0, R.toString(t));
|
|
1197
1197
|
}
|
|
1198
1198
|
gt(e, t) {
|
|
1199
|
-
return this.setLimit("min", e, !1,
|
|
1199
|
+
return this.setLimit("min", e, !1, R.toString(t));
|
|
1200
1200
|
}
|
|
1201
1201
|
lte(e, t) {
|
|
1202
|
-
return this.setLimit("max", e, !0,
|
|
1202
|
+
return this.setLimit("max", e, !0, R.toString(t));
|
|
1203
1203
|
}
|
|
1204
1204
|
lt(e, t) {
|
|
1205
|
-
return this.setLimit("max", e, !1,
|
|
1205
|
+
return this.setLimit("max", e, !1, R.toString(t));
|
|
1206
1206
|
}
|
|
1207
1207
|
setLimit(t, n, r, i) {
|
|
1208
1208
|
return new e({
|
|
@@ -1211,7 +1211,7 @@ var gt = class e extends z {
|
|
|
1211
1211
|
kind: t,
|
|
1212
1212
|
value: n,
|
|
1213
1213
|
inclusive: r,
|
|
1214
|
-
message:
|
|
1214
|
+
message: R.toString(i)
|
|
1215
1215
|
}]
|
|
1216
1216
|
});
|
|
1217
1217
|
}
|
|
@@ -1226,7 +1226,7 @@ var gt = class e extends z {
|
|
|
1226
1226
|
kind: "min",
|
|
1227
1227
|
value: BigInt(0),
|
|
1228
1228
|
inclusive: !1,
|
|
1229
|
-
message:
|
|
1229
|
+
message: R.toString(e)
|
|
1230
1230
|
});
|
|
1231
1231
|
}
|
|
1232
1232
|
negative(e) {
|
|
@@ -1234,7 +1234,7 @@ var gt = class e extends z {
|
|
|
1234
1234
|
kind: "max",
|
|
1235
1235
|
value: BigInt(0),
|
|
1236
1236
|
inclusive: !1,
|
|
1237
|
-
message:
|
|
1237
|
+
message: R.toString(e)
|
|
1238
1238
|
});
|
|
1239
1239
|
}
|
|
1240
1240
|
nonpositive(e) {
|
|
@@ -1242,7 +1242,7 @@ var gt = class e extends z {
|
|
|
1242
1242
|
kind: "max",
|
|
1243
1243
|
value: BigInt(0),
|
|
1244
1244
|
inclusive: !0,
|
|
1245
|
-
message:
|
|
1245
|
+
message: R.toString(e)
|
|
1246
1246
|
});
|
|
1247
1247
|
}
|
|
1248
1248
|
nonnegative(e) {
|
|
@@ -1250,14 +1250,14 @@ var gt = class e extends z {
|
|
|
1250
1250
|
kind: "min",
|
|
1251
1251
|
value: BigInt(0),
|
|
1252
1252
|
inclusive: !0,
|
|
1253
|
-
message:
|
|
1253
|
+
message: R.toString(e)
|
|
1254
1254
|
});
|
|
1255
1255
|
}
|
|
1256
1256
|
multipleOf(e, t) {
|
|
1257
1257
|
return this._addCheck({
|
|
1258
1258
|
kind: "multipleOf",
|
|
1259
1259
|
value: e,
|
|
1260
|
-
message:
|
|
1260
|
+
message: R.toString(t)
|
|
1261
1261
|
});
|
|
1262
1262
|
}
|
|
1263
1263
|
get minValue() {
|
|
@@ -1271,50 +1271,50 @@ var gt = class e extends z {
|
|
|
1271
1271
|
return e;
|
|
1272
1272
|
}
|
|
1273
1273
|
};
|
|
1274
|
-
|
|
1274
|
+
mt.create = (e) => new mt({
|
|
1275
1275
|
checks: [],
|
|
1276
1276
|
typeName: G.ZodBigInt,
|
|
1277
1277
|
coerce: e?.coerce ?? !1,
|
|
1278
|
-
...
|
|
1278
|
+
...B(e)
|
|
1279
1279
|
});
|
|
1280
|
-
var
|
|
1280
|
+
var ht = class extends V {
|
|
1281
1281
|
_parse(e) {
|
|
1282
1282
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== b.boolean) {
|
|
1283
1283
|
let t = this._getOrReturnCtx(e);
|
|
1284
|
-
return
|
|
1284
|
+
return P(t, {
|
|
1285
1285
|
code: y.invalid_type,
|
|
1286
1286
|
expected: b.boolean,
|
|
1287
1287
|
received: t.parsedType
|
|
1288
|
-
}),
|
|
1288
|
+
}), I;
|
|
1289
1289
|
}
|
|
1290
|
-
return
|
|
1290
|
+
return L(e.data);
|
|
1291
1291
|
}
|
|
1292
1292
|
};
|
|
1293
|
-
|
|
1293
|
+
ht.create = (e) => new ht({
|
|
1294
1294
|
typeName: G.ZodBoolean,
|
|
1295
1295
|
coerce: e?.coerce || !1,
|
|
1296
|
-
...
|
|
1296
|
+
...B(e)
|
|
1297
1297
|
});
|
|
1298
|
-
var
|
|
1298
|
+
var gt = class e extends V {
|
|
1299
1299
|
_parse(e) {
|
|
1300
1300
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== b.date) {
|
|
1301
1301
|
let t = this._getOrReturnCtx(e);
|
|
1302
|
-
return
|
|
1302
|
+
return P(t, {
|
|
1303
1303
|
code: y.invalid_type,
|
|
1304
1304
|
expected: b.date,
|
|
1305
1305
|
received: t.parsedType
|
|
1306
|
-
}),
|
|
1306
|
+
}), I;
|
|
1307
1307
|
}
|
|
1308
|
-
if (Number.isNaN(e.data.getTime())) return
|
|
1309
|
-
let t = new
|
|
1310
|
-
for (let r of this._def.checks) r.kind === "min" ? e.data.getTime() < r.value && (n = this._getOrReturnCtx(e, n),
|
|
1308
|
+
if (Number.isNaN(e.data.getTime())) return P(this._getOrReturnCtx(e), { code: y.invalid_date }), I;
|
|
1309
|
+
let t = new F(), n;
|
|
1310
|
+
for (let r of this._def.checks) r.kind === "min" ? e.data.getTime() < r.value && (n = this._getOrReturnCtx(e, n), P(n, {
|
|
1311
1311
|
code: y.too_small,
|
|
1312
1312
|
message: r.message,
|
|
1313
1313
|
inclusive: !0,
|
|
1314
1314
|
exact: !1,
|
|
1315
1315
|
minimum: r.value,
|
|
1316
1316
|
type: "date"
|
|
1317
|
-
}), t.dirty()) : r.kind === "max" ? e.data.getTime() > r.value && (n = this._getOrReturnCtx(e, n),
|
|
1317
|
+
}), t.dirty()) : r.kind === "max" ? e.data.getTime() > r.value && (n = this._getOrReturnCtx(e, n), P(n, {
|
|
1318
1318
|
code: y.too_big,
|
|
1319
1319
|
message: r.message,
|
|
1320
1320
|
inclusive: !0,
|
|
@@ -1337,14 +1337,14 @@ var vt = class e extends z {
|
|
|
1337
1337
|
return this._addCheck({
|
|
1338
1338
|
kind: "min",
|
|
1339
1339
|
value: e.getTime(),
|
|
1340
|
-
message:
|
|
1340
|
+
message: R.toString(t)
|
|
1341
1341
|
});
|
|
1342
1342
|
}
|
|
1343
1343
|
max(e, t) {
|
|
1344
1344
|
return this._addCheck({
|
|
1345
1345
|
kind: "max",
|
|
1346
1346
|
value: e.getTime(),
|
|
1347
|
-
message:
|
|
1347
|
+
message: R.toString(t)
|
|
1348
1348
|
});
|
|
1349
1349
|
}
|
|
1350
1350
|
get minDate() {
|
|
@@ -1358,129 +1358,129 @@ var vt = class e extends z {
|
|
|
1358
1358
|
return e == null ? null : new Date(e);
|
|
1359
1359
|
}
|
|
1360
1360
|
};
|
|
1361
|
-
|
|
1361
|
+
gt.create = (e) => new gt({
|
|
1362
1362
|
checks: [],
|
|
1363
1363
|
coerce: e?.coerce || !1,
|
|
1364
1364
|
typeName: G.ZodDate,
|
|
1365
|
-
...
|
|
1365
|
+
...B(e)
|
|
1366
1366
|
});
|
|
1367
|
-
var
|
|
1367
|
+
var _t = class extends V {
|
|
1368
1368
|
_parse(e) {
|
|
1369
1369
|
if (this._getType(e) !== b.symbol) {
|
|
1370
1370
|
let t = this._getOrReturnCtx(e);
|
|
1371
|
-
return
|
|
1371
|
+
return P(t, {
|
|
1372
1372
|
code: y.invalid_type,
|
|
1373
1373
|
expected: b.symbol,
|
|
1374
1374
|
received: t.parsedType
|
|
1375
|
-
}),
|
|
1375
|
+
}), I;
|
|
1376
1376
|
}
|
|
1377
|
-
return
|
|
1377
|
+
return L(e.data);
|
|
1378
1378
|
}
|
|
1379
1379
|
};
|
|
1380
|
-
|
|
1380
|
+
_t.create = (e) => new _t({
|
|
1381
1381
|
typeName: G.ZodSymbol,
|
|
1382
|
-
...
|
|
1382
|
+
...B(e)
|
|
1383
1383
|
});
|
|
1384
|
-
var
|
|
1384
|
+
var vt = class extends V {
|
|
1385
1385
|
_parse(e) {
|
|
1386
1386
|
if (this._getType(e) !== b.undefined) {
|
|
1387
1387
|
let t = this._getOrReturnCtx(e);
|
|
1388
|
-
return
|
|
1388
|
+
return P(t, {
|
|
1389
1389
|
code: y.invalid_type,
|
|
1390
1390
|
expected: b.undefined,
|
|
1391
1391
|
received: t.parsedType
|
|
1392
|
-
}),
|
|
1392
|
+
}), I;
|
|
1393
1393
|
}
|
|
1394
|
-
return
|
|
1394
|
+
return L(e.data);
|
|
1395
1395
|
}
|
|
1396
1396
|
};
|
|
1397
|
-
|
|
1397
|
+
vt.create = (e) => new vt({
|
|
1398
1398
|
typeName: G.ZodUndefined,
|
|
1399
|
-
...
|
|
1399
|
+
...B(e)
|
|
1400
1400
|
});
|
|
1401
|
-
var
|
|
1401
|
+
var yt = class extends V {
|
|
1402
1402
|
_parse(e) {
|
|
1403
1403
|
if (this._getType(e) !== b.null) {
|
|
1404
1404
|
let t = this._getOrReturnCtx(e);
|
|
1405
|
-
return
|
|
1405
|
+
return P(t, {
|
|
1406
1406
|
code: y.invalid_type,
|
|
1407
1407
|
expected: b.null,
|
|
1408
1408
|
received: t.parsedType
|
|
1409
|
-
}),
|
|
1409
|
+
}), I;
|
|
1410
1410
|
}
|
|
1411
|
-
return
|
|
1411
|
+
return L(e.data);
|
|
1412
1412
|
}
|
|
1413
1413
|
};
|
|
1414
|
-
|
|
1414
|
+
yt.create = (e) => new yt({
|
|
1415
1415
|
typeName: G.ZodNull,
|
|
1416
|
-
...
|
|
1416
|
+
...B(e)
|
|
1417
1417
|
});
|
|
1418
|
-
var
|
|
1418
|
+
var bt = class extends V {
|
|
1419
1419
|
constructor() {
|
|
1420
1420
|
super(...arguments), this._any = !0;
|
|
1421
1421
|
}
|
|
1422
1422
|
_parse(e) {
|
|
1423
|
-
return
|
|
1423
|
+
return L(e.data);
|
|
1424
1424
|
}
|
|
1425
1425
|
};
|
|
1426
|
-
|
|
1426
|
+
bt.create = (e) => new bt({
|
|
1427
1427
|
typeName: G.ZodAny,
|
|
1428
|
-
...
|
|
1428
|
+
...B(e)
|
|
1429
1429
|
});
|
|
1430
|
-
var
|
|
1430
|
+
var xt = class extends V {
|
|
1431
1431
|
constructor() {
|
|
1432
1432
|
super(...arguments), this._unknown = !0;
|
|
1433
1433
|
}
|
|
1434
1434
|
_parse(e) {
|
|
1435
|
-
return
|
|
1435
|
+
return L(e.data);
|
|
1436
1436
|
}
|
|
1437
1437
|
};
|
|
1438
|
-
|
|
1438
|
+
xt.create = (e) => new xt({
|
|
1439
1439
|
typeName: G.ZodUnknown,
|
|
1440
|
-
...
|
|
1440
|
+
...B(e)
|
|
1441
1441
|
});
|
|
1442
|
-
var
|
|
1442
|
+
var St = class extends V {
|
|
1443
1443
|
_parse(e) {
|
|
1444
1444
|
let t = this._getOrReturnCtx(e);
|
|
1445
|
-
return
|
|
1445
|
+
return P(t, {
|
|
1446
1446
|
code: y.invalid_type,
|
|
1447
1447
|
expected: b.never,
|
|
1448
1448
|
received: t.parsedType
|
|
1449
|
-
}),
|
|
1449
|
+
}), I;
|
|
1450
1450
|
}
|
|
1451
1451
|
};
|
|
1452
|
-
|
|
1452
|
+
St.create = (e) => new St({
|
|
1453
1453
|
typeName: G.ZodNever,
|
|
1454
|
-
...
|
|
1454
|
+
...B(e)
|
|
1455
1455
|
});
|
|
1456
|
-
var
|
|
1456
|
+
var Ct = class extends V {
|
|
1457
1457
|
_parse(e) {
|
|
1458
1458
|
if (this._getType(e) !== b.undefined) {
|
|
1459
1459
|
let t = this._getOrReturnCtx(e);
|
|
1460
|
-
return
|
|
1460
|
+
return P(t, {
|
|
1461
1461
|
code: y.invalid_type,
|
|
1462
1462
|
expected: b.void,
|
|
1463
1463
|
received: t.parsedType
|
|
1464
|
-
}),
|
|
1464
|
+
}), I;
|
|
1465
1465
|
}
|
|
1466
|
-
return
|
|
1466
|
+
return L(e.data);
|
|
1467
1467
|
}
|
|
1468
1468
|
};
|
|
1469
|
-
|
|
1469
|
+
Ct.create = (e) => new Ct({
|
|
1470
1470
|
typeName: G.ZodVoid,
|
|
1471
|
-
...
|
|
1471
|
+
...B(e)
|
|
1472
1472
|
});
|
|
1473
|
-
var
|
|
1473
|
+
var wt = class e extends V {
|
|
1474
1474
|
_parse(e) {
|
|
1475
1475
|
let { ctx: t, status: n } = this._processInputParams(e), r = this._def;
|
|
1476
|
-
if (t.parsedType !== b.array) return
|
|
1476
|
+
if (t.parsedType !== b.array) return P(t, {
|
|
1477
1477
|
code: y.invalid_type,
|
|
1478
1478
|
expected: b.array,
|
|
1479
1479
|
received: t.parsedType
|
|
1480
|
-
}),
|
|
1480
|
+
}), I;
|
|
1481
1481
|
if (r.exactLength !== null) {
|
|
1482
1482
|
let e = t.data.length > r.exactLength.value, i = t.data.length < r.exactLength.value;
|
|
1483
|
-
(e || i) && (
|
|
1483
|
+
(e || i) && (P(t, {
|
|
1484
1484
|
code: e ? y.too_big : y.too_small,
|
|
1485
1485
|
minimum: i ? r.exactLength.value : void 0,
|
|
1486
1486
|
maximum: e ? r.exactLength.value : void 0,
|
|
@@ -1490,23 +1490,23 @@ var Tt = class e extends z {
|
|
|
1490
1490
|
message: r.exactLength.message
|
|
1491
1491
|
}), n.dirty());
|
|
1492
1492
|
}
|
|
1493
|
-
if (r.minLength !== null && t.data.length < r.minLength.value && (
|
|
1493
|
+
if (r.minLength !== null && t.data.length < r.minLength.value && (P(t, {
|
|
1494
1494
|
code: y.too_small,
|
|
1495
1495
|
minimum: r.minLength.value,
|
|
1496
1496
|
type: "array",
|
|
1497
1497
|
inclusive: !0,
|
|
1498
1498
|
exact: !1,
|
|
1499
1499
|
message: r.minLength.message
|
|
1500
|
-
}), n.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (
|
|
1500
|
+
}), n.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (P(t, {
|
|
1501
1501
|
code: y.too_big,
|
|
1502
1502
|
maximum: r.maxLength.value,
|
|
1503
1503
|
type: "array",
|
|
1504
1504
|
inclusive: !0,
|
|
1505
1505
|
exact: !1,
|
|
1506
1506
|
message: r.maxLength.message
|
|
1507
|
-
}), n.dirty()), t.common.async) return Promise.all([...t.data].map((e, n) => r.type._parseAsync(new
|
|
1508
|
-
let i = [...t.data].map((e, n) => r.type._parseSync(new
|
|
1509
|
-
return
|
|
1507
|
+
}), n.dirty()), t.common.async) return Promise.all([...t.data].map((e, n) => r.type._parseAsync(new z(t, e, t.path, n)))).then((e) => F.mergeArray(n, e));
|
|
1508
|
+
let i = [...t.data].map((e, n) => r.type._parseSync(new z(t, e, t.path, n)));
|
|
1509
|
+
return F.mergeArray(n, i);
|
|
1510
1510
|
}
|
|
1511
1511
|
get element() {
|
|
1512
1512
|
return this._def.type;
|
|
@@ -1516,7 +1516,7 @@ var Tt = class e extends z {
|
|
|
1516
1516
|
...this._def,
|
|
1517
1517
|
minLength: {
|
|
1518
1518
|
value: t,
|
|
1519
|
-
message:
|
|
1519
|
+
message: R.toString(n)
|
|
1520
1520
|
}
|
|
1521
1521
|
});
|
|
1522
1522
|
}
|
|
@@ -1525,7 +1525,7 @@ var Tt = class e extends z {
|
|
|
1525
1525
|
...this._def,
|
|
1526
1526
|
maxLength: {
|
|
1527
1527
|
value: t,
|
|
1528
|
-
message:
|
|
1528
|
+
message: R.toString(n)
|
|
1529
1529
|
}
|
|
1530
1530
|
});
|
|
1531
1531
|
}
|
|
@@ -1534,7 +1534,7 @@ var Tt = class e extends z {
|
|
|
1534
1534
|
...this._def,
|
|
1535
1535
|
exactLength: {
|
|
1536
1536
|
value: t,
|
|
1537
|
-
message:
|
|
1537
|
+
message: R.toString(n)
|
|
1538
1538
|
}
|
|
1539
1539
|
});
|
|
1540
1540
|
}
|
|
@@ -1542,35 +1542,35 @@ var Tt = class e extends z {
|
|
|
1542
1542
|
return this.min(1, e);
|
|
1543
1543
|
}
|
|
1544
1544
|
};
|
|
1545
|
-
|
|
1545
|
+
wt.create = (e, t) => new wt({
|
|
1546
1546
|
type: e,
|
|
1547
1547
|
minLength: null,
|
|
1548
1548
|
maxLength: null,
|
|
1549
1549
|
exactLength: null,
|
|
1550
1550
|
typeName: G.ZodArray,
|
|
1551
|
-
...
|
|
1551
|
+
...B(t)
|
|
1552
1552
|
});
|
|
1553
|
-
function
|
|
1554
|
-
if (e instanceof
|
|
1553
|
+
function Tt(e) {
|
|
1554
|
+
if (e instanceof H) {
|
|
1555
1555
|
let t = {};
|
|
1556
1556
|
for (let n in e.shape) {
|
|
1557
1557
|
let r = e.shape[n];
|
|
1558
|
-
t[n] = W.create(
|
|
1558
|
+
t[n] = W.create(Tt(r));
|
|
1559
1559
|
}
|
|
1560
|
-
return new
|
|
1560
|
+
return new H({
|
|
1561
1561
|
...e._def,
|
|
1562
1562
|
shape: () => t
|
|
1563
1563
|
});
|
|
1564
|
-
} else if (e instanceof
|
|
1564
|
+
} else if (e instanceof wt) return new wt({
|
|
1565
1565
|
...e._def,
|
|
1566
|
-
type:
|
|
1566
|
+
type: Tt(e.element)
|
|
1567
1567
|
});
|
|
1568
|
-
else if (e instanceof W) return W.create(
|
|
1569
|
-
else if (e instanceof Ht) return Ht.create(
|
|
1570
|
-
else if (e instanceof jt) return jt.create(e.items.map((e) =>
|
|
1568
|
+
else if (e instanceof W) return W.create(Tt(e.unwrap()));
|
|
1569
|
+
else if (e instanceof Ht) return Ht.create(Tt(e.unwrap()));
|
|
1570
|
+
else if (e instanceof jt) return jt.create(e.items.map((e) => Tt(e)));
|
|
1571
1571
|
else return e;
|
|
1572
1572
|
}
|
|
1573
|
-
var
|
|
1573
|
+
var H = class e extends V {
|
|
1574
1574
|
constructor() {
|
|
1575
1575
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1576
1576
|
}
|
|
@@ -1585,14 +1585,14 @@ var V = class e extends z {
|
|
|
1585
1585
|
_parse(e) {
|
|
1586
1586
|
if (this._getType(e) !== b.object) {
|
|
1587
1587
|
let t = this._getOrReturnCtx(e);
|
|
1588
|
-
return
|
|
1588
|
+
return P(t, {
|
|
1589
1589
|
code: y.invalid_type,
|
|
1590
1590
|
expected: b.object,
|
|
1591
1591
|
received: t.parsedType
|
|
1592
|
-
}),
|
|
1592
|
+
}), I;
|
|
1593
1593
|
}
|
|
1594
1594
|
let { status: t, ctx: n } = this._processInputParams(e), { shape: r, keys: i } = this._getCached(), a = [];
|
|
1595
|
-
if (!(this._def.catchall instanceof
|
|
1595
|
+
if (!(this._def.catchall instanceof St && this._def.unknownKeys === "strip")) for (let e in n.data) i.includes(e) || a.push(e);
|
|
1596
1596
|
let o = [];
|
|
1597
1597
|
for (let e of i) {
|
|
1598
1598
|
let t = r[e], i = n.data[e];
|
|
@@ -1601,11 +1601,11 @@ var V = class e extends z {
|
|
|
1601
1601
|
status: "valid",
|
|
1602
1602
|
value: e
|
|
1603
1603
|
},
|
|
1604
|
-
value: t._parse(new
|
|
1604
|
+
value: t._parse(new z(n, i, n.path, e)),
|
|
1605
1605
|
alwaysSet: e in n.data
|
|
1606
1606
|
});
|
|
1607
1607
|
}
|
|
1608
|
-
if (this._def.catchall instanceof
|
|
1608
|
+
if (this._def.catchall instanceof St) {
|
|
1609
1609
|
let e = this._def.unknownKeys;
|
|
1610
1610
|
if (e === "passthrough") for (let e of a) o.push({
|
|
1611
1611
|
key: {
|
|
@@ -1617,7 +1617,7 @@ var V = class e extends z {
|
|
|
1617
1617
|
value: n.data[e]
|
|
1618
1618
|
}
|
|
1619
1619
|
});
|
|
1620
|
-
else if (e === "strict") a.length > 0 && (
|
|
1620
|
+
else if (e === "strict") a.length > 0 && (P(n, {
|
|
1621
1621
|
code: y.unrecognized_keys,
|
|
1622
1622
|
keys: a
|
|
1623
1623
|
}), t.dirty());
|
|
@@ -1631,7 +1631,7 @@ var V = class e extends z {
|
|
|
1631
1631
|
status: "valid",
|
|
1632
1632
|
value: t
|
|
1633
1633
|
},
|
|
1634
|
-
value: e._parse(new
|
|
1634
|
+
value: e._parse(new z(n, r, n.path, t)),
|
|
1635
1635
|
alwaysSet: t in n.data
|
|
1636
1636
|
});
|
|
1637
1637
|
}
|
|
@@ -1647,18 +1647,18 @@ var V = class e extends z {
|
|
|
1647
1647
|
});
|
|
1648
1648
|
}
|
|
1649
1649
|
return e;
|
|
1650
|
-
}).then((e) =>
|
|
1650
|
+
}).then((e) => F.mergeObjectSync(t, e)) : F.mergeObjectSync(t, o);
|
|
1651
1651
|
}
|
|
1652
1652
|
get shape() {
|
|
1653
1653
|
return this._def.shape();
|
|
1654
1654
|
}
|
|
1655
1655
|
strict(t) {
|
|
1656
|
-
return
|
|
1656
|
+
return R.errToObj, new e({
|
|
1657
1657
|
...this._def,
|
|
1658
1658
|
unknownKeys: "strict",
|
|
1659
1659
|
...t === void 0 ? {} : { errorMap: (e, n) => {
|
|
1660
1660
|
let r = this._def.errorMap?.(e, n).message ?? n.defaultError;
|
|
1661
|
-
return e.code === "unrecognized_keys" ? { message:
|
|
1661
|
+
return e.code === "unrecognized_keys" ? { message: R.errToObj(t).message ?? r } : { message: r };
|
|
1662
1662
|
} }
|
|
1663
1663
|
});
|
|
1664
1664
|
}
|
|
@@ -1720,7 +1720,7 @@ var V = class e extends z {
|
|
|
1720
1720
|
});
|
|
1721
1721
|
}
|
|
1722
1722
|
deepPartial() {
|
|
1723
|
-
return
|
|
1723
|
+
return Tt(this);
|
|
1724
1724
|
}
|
|
1725
1725
|
partial(t) {
|
|
1726
1726
|
let n = {};
|
|
@@ -1750,36 +1750,36 @@ var V = class e extends z {
|
|
|
1750
1750
|
return Rt(_.objectKeys(this.shape));
|
|
1751
1751
|
}
|
|
1752
1752
|
};
|
|
1753
|
-
|
|
1753
|
+
H.create = (e, t) => new H({
|
|
1754
1754
|
shape: () => e,
|
|
1755
1755
|
unknownKeys: "strip",
|
|
1756
|
-
catchall:
|
|
1756
|
+
catchall: St.create(),
|
|
1757
1757
|
typeName: G.ZodObject,
|
|
1758
|
-
...
|
|
1759
|
-
}),
|
|
1758
|
+
...B(t)
|
|
1759
|
+
}), H.strictCreate = (e, t) => new H({
|
|
1760
1760
|
shape: () => e,
|
|
1761
1761
|
unknownKeys: "strict",
|
|
1762
|
-
catchall:
|
|
1762
|
+
catchall: St.create(),
|
|
1763
1763
|
typeName: G.ZodObject,
|
|
1764
|
-
...
|
|
1765
|
-
}),
|
|
1764
|
+
...B(t)
|
|
1765
|
+
}), H.lazycreate = (e, t) => new H({
|
|
1766
1766
|
shape: e,
|
|
1767
1767
|
unknownKeys: "strip",
|
|
1768
|
-
catchall:
|
|
1768
|
+
catchall: St.create(),
|
|
1769
1769
|
typeName: G.ZodObject,
|
|
1770
|
-
...
|
|
1770
|
+
...B(t)
|
|
1771
1771
|
});
|
|
1772
|
-
var
|
|
1772
|
+
var Et = class extends V {
|
|
1773
1773
|
_parse(e) {
|
|
1774
1774
|
let { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
1775
1775
|
function r(e) {
|
|
1776
1776
|
for (let t of e) if (t.result.status === "valid") return t.result;
|
|
1777
1777
|
for (let n of e) if (n.result.status === "dirty") return t.common.issues.push(...n.ctx.common.issues), n.result;
|
|
1778
1778
|
let n = e.map((e) => new x(e.ctx.common.issues));
|
|
1779
|
-
return
|
|
1779
|
+
return P(t, {
|
|
1780
1780
|
code: y.invalid_union,
|
|
1781
1781
|
unionErrors: n
|
|
1782
|
-
}),
|
|
1782
|
+
}), I;
|
|
1783
1783
|
}
|
|
1784
1784
|
if (t.common.async) return Promise.all(n.map(async (e) => {
|
|
1785
1785
|
let n = {
|
|
@@ -1822,29 +1822,29 @@ var Dt = class extends z {
|
|
|
1822
1822
|
}
|
|
1823
1823
|
if (e) return t.common.issues.push(...e.ctx.common.issues), e.result;
|
|
1824
1824
|
let i = r.map((e) => new x(e));
|
|
1825
|
-
return
|
|
1825
|
+
return P(t, {
|
|
1826
1826
|
code: y.invalid_union,
|
|
1827
1827
|
unionErrors: i
|
|
1828
|
-
}),
|
|
1828
|
+
}), I;
|
|
1829
1829
|
}
|
|
1830
1830
|
}
|
|
1831
1831
|
get options() {
|
|
1832
1832
|
return this._def.options;
|
|
1833
1833
|
}
|
|
1834
1834
|
};
|
|
1835
|
-
|
|
1835
|
+
Et.create = (e, t) => new Et({
|
|
1836
1836
|
options: e,
|
|
1837
1837
|
typeName: G.ZodUnion,
|
|
1838
|
-
...
|
|
1838
|
+
...B(t)
|
|
1839
1839
|
});
|
|
1840
|
-
var
|
|
1840
|
+
var Dt = (e) => e instanceof It ? Dt(e.schema) : e instanceof U ? Dt(e.innerType()) : e instanceof Lt ? [e.value] : e instanceof zt ? e.options : e instanceof Bt ? _.objectValues(e.enum) : e instanceof Ut ? Dt(e._def.innerType) : e instanceof vt ? [void 0] : e instanceof yt ? [null] : e instanceof W ? [void 0, ...Dt(e.unwrap())] : e instanceof Ht ? [null, ...Dt(e.unwrap())] : e instanceof Kt || e instanceof Jt ? Dt(e.unwrap()) : e instanceof Wt ? Dt(e._def.innerType) : [], Ot = class e extends V {
|
|
1841
1841
|
_parse(e) {
|
|
1842
1842
|
let { ctx: t } = this._processInputParams(e);
|
|
1843
|
-
if (t.parsedType !== b.object) return
|
|
1843
|
+
if (t.parsedType !== b.object) return P(t, {
|
|
1844
1844
|
code: y.invalid_type,
|
|
1845
1845
|
expected: b.object,
|
|
1846
1846
|
received: t.parsedType
|
|
1847
|
-
}),
|
|
1847
|
+
}), I;
|
|
1848
1848
|
let n = this.discriminator, r = t.data[n], i = this.optionsMap.get(r);
|
|
1849
1849
|
return i ? t.common.async ? i._parseAsync({
|
|
1850
1850
|
data: t.data,
|
|
@@ -1854,11 +1854,11 @@ var H = (e) => e instanceof It ? H(e.schema) : e instanceof U ? H(e.innerType())
|
|
|
1854
1854
|
data: t.data,
|
|
1855
1855
|
path: t.path,
|
|
1856
1856
|
parent: t
|
|
1857
|
-
}) : (
|
|
1857
|
+
}) : (P(t, {
|
|
1858
1858
|
code: y.invalid_union_discriminator,
|
|
1859
1859
|
options: Array.from(this.optionsMap.keys()),
|
|
1860
1860
|
path: [n]
|
|
1861
|
-
}),
|
|
1861
|
+
}), I);
|
|
1862
1862
|
}
|
|
1863
1863
|
get discriminator() {
|
|
1864
1864
|
return this._def.discriminator;
|
|
@@ -1872,7 +1872,7 @@ var H = (e) => e instanceof It ? H(e.schema) : e instanceof U ? H(e.innerType())
|
|
|
1872
1872
|
static create(t, n, r) {
|
|
1873
1873
|
let i = /* @__PURE__ */ new Map();
|
|
1874
1874
|
for (let e of n) {
|
|
1875
|
-
let n =
|
|
1875
|
+
let n = Dt(e.shape[t]);
|
|
1876
1876
|
if (!n.length) throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);
|
|
1877
1877
|
for (let r of n) {
|
|
1878
1878
|
if (i.has(r)) throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);
|
|
@@ -1884,7 +1884,7 @@ var H = (e) => e instanceof It ? H(e.schema) : e instanceof U ? H(e.innerType())
|
|
|
1884
1884
|
discriminator: t,
|
|
1885
1885
|
options: n,
|
|
1886
1886
|
optionsMap: i,
|
|
1887
|
-
...
|
|
1887
|
+
...B(r)
|
|
1888
1888
|
});
|
|
1889
1889
|
}
|
|
1890
1890
|
};
|
|
@@ -1926,15 +1926,15 @@ function kt(e, t) {
|
|
|
1926
1926
|
};
|
|
1927
1927
|
else return { valid: !1 };
|
|
1928
1928
|
}
|
|
1929
|
-
var At = class extends
|
|
1929
|
+
var At = class extends V {
|
|
1930
1930
|
_parse(e) {
|
|
1931
1931
|
let { status: t, ctx: n } = this._processInputParams(e), r = (e, r) => {
|
|
1932
|
-
if (
|
|
1932
|
+
if (Ie(e) || Ie(r)) return I;
|
|
1933
1933
|
let i = kt(e.value, r.value);
|
|
1934
|
-
return i.valid ? ((
|
|
1934
|
+
return i.valid ? ((Le(e) || Le(r)) && t.dirty(), {
|
|
1935
1935
|
status: t.value,
|
|
1936
1936
|
value: i.data
|
|
1937
|
-
}) : (
|
|
1937
|
+
}) : (P(n, { code: y.invalid_intersection_types }), I);
|
|
1938
1938
|
};
|
|
1939
1939
|
return n.common.async ? Promise.all([this._def.left._parseAsync({
|
|
1940
1940
|
data: n.data,
|
|
@@ -1959,24 +1959,24 @@ At.create = (e, t, n) => new At({
|
|
|
1959
1959
|
left: e,
|
|
1960
1960
|
right: t,
|
|
1961
1961
|
typeName: G.ZodIntersection,
|
|
1962
|
-
...
|
|
1962
|
+
...B(n)
|
|
1963
1963
|
});
|
|
1964
|
-
var jt = class e extends
|
|
1964
|
+
var jt = class e extends V {
|
|
1965
1965
|
_parse(e) {
|
|
1966
1966
|
let { status: t, ctx: n } = this._processInputParams(e);
|
|
1967
|
-
if (n.parsedType !== b.array) return
|
|
1967
|
+
if (n.parsedType !== b.array) return P(n, {
|
|
1968
1968
|
code: y.invalid_type,
|
|
1969
1969
|
expected: b.array,
|
|
1970
1970
|
received: n.parsedType
|
|
1971
|
-
}),
|
|
1972
|
-
if (n.data.length < this._def.items.length) return
|
|
1971
|
+
}), I;
|
|
1972
|
+
if (n.data.length < this._def.items.length) return P(n, {
|
|
1973
1973
|
code: y.too_small,
|
|
1974
1974
|
minimum: this._def.items.length,
|
|
1975
1975
|
inclusive: !0,
|
|
1976
1976
|
exact: !1,
|
|
1977
1977
|
type: "array"
|
|
1978
|
-
}),
|
|
1979
|
-
!this._def.rest && n.data.length > this._def.items.length && (
|
|
1978
|
+
}), I;
|
|
1979
|
+
!this._def.rest && n.data.length > this._def.items.length && (P(n, {
|
|
1980
1980
|
code: y.too_big,
|
|
1981
1981
|
maximum: this._def.items.length,
|
|
1982
1982
|
inclusive: !0,
|
|
@@ -1985,9 +1985,9 @@ var jt = class e extends z {
|
|
|
1985
1985
|
}), t.dirty());
|
|
1986
1986
|
let r = [...n.data].map((e, t) => {
|
|
1987
1987
|
let r = this._def.items[t] || this._def.rest;
|
|
1988
|
-
return r ? r._parse(new
|
|
1988
|
+
return r ? r._parse(new z(n, e, n.path, t)) : null;
|
|
1989
1989
|
}).filter((e) => !!e);
|
|
1990
|
-
return n.common.async ? Promise.all(r).then((e) =>
|
|
1990
|
+
return n.common.async ? Promise.all(r).then((e) => F.mergeArray(t, e)) : F.mergeArray(t, r);
|
|
1991
1991
|
}
|
|
1992
1992
|
get items() {
|
|
1993
1993
|
return this._def.items;
|
|
@@ -2005,10 +2005,10 @@ jt.create = (e, t) => {
|
|
|
2005
2005
|
items: e,
|
|
2006
2006
|
typeName: G.ZodTuple,
|
|
2007
2007
|
rest: null,
|
|
2008
|
-
...
|
|
2008
|
+
...B(t)
|
|
2009
2009
|
});
|
|
2010
2010
|
};
|
|
2011
|
-
var Mt = class e extends
|
|
2011
|
+
var Mt = class e extends V {
|
|
2012
2012
|
get keySchema() {
|
|
2013
2013
|
return this._def.keyType;
|
|
2014
2014
|
}
|
|
@@ -2017,36 +2017,36 @@ var Mt = class e extends z {
|
|
|
2017
2017
|
}
|
|
2018
2018
|
_parse(e) {
|
|
2019
2019
|
let { status: t, ctx: n } = this._processInputParams(e);
|
|
2020
|
-
if (n.parsedType !== b.object) return
|
|
2020
|
+
if (n.parsedType !== b.object) return P(n, {
|
|
2021
2021
|
code: y.invalid_type,
|
|
2022
2022
|
expected: b.object,
|
|
2023
2023
|
received: n.parsedType
|
|
2024
|
-
}),
|
|
2024
|
+
}), I;
|
|
2025
2025
|
let r = [], i = this._def.keyType, a = this._def.valueType;
|
|
2026
2026
|
for (let e in n.data) r.push({
|
|
2027
|
-
key: i._parse(new
|
|
2028
|
-
value: a._parse(new
|
|
2027
|
+
key: i._parse(new z(n, e, n.path, e)),
|
|
2028
|
+
value: a._parse(new z(n, n.data[e], n.path, e)),
|
|
2029
2029
|
alwaysSet: e in n.data
|
|
2030
2030
|
});
|
|
2031
|
-
return n.common.async ?
|
|
2031
|
+
return n.common.async ? F.mergeObjectAsync(t, r) : F.mergeObjectSync(t, r);
|
|
2032
2032
|
}
|
|
2033
2033
|
get element() {
|
|
2034
2034
|
return this._def.valueType;
|
|
2035
2035
|
}
|
|
2036
2036
|
static create(t, n, r) {
|
|
2037
|
-
return n instanceof
|
|
2037
|
+
return n instanceof V ? new e({
|
|
2038
2038
|
keyType: t,
|
|
2039
2039
|
valueType: n,
|
|
2040
2040
|
typeName: G.ZodRecord,
|
|
2041
|
-
...
|
|
2041
|
+
...B(r)
|
|
2042
2042
|
}) : new e({
|
|
2043
|
-
keyType:
|
|
2043
|
+
keyType: dt.create(),
|
|
2044
2044
|
valueType: t,
|
|
2045
2045
|
typeName: G.ZodRecord,
|
|
2046
|
-
...
|
|
2046
|
+
...B(n)
|
|
2047
2047
|
});
|
|
2048
2048
|
}
|
|
2049
|
-
}, Nt = class extends
|
|
2049
|
+
}, Nt = class extends V {
|
|
2050
2050
|
get keySchema() {
|
|
2051
2051
|
return this._def.keyType;
|
|
2052
2052
|
}
|
|
@@ -2055,21 +2055,21 @@ var Mt = class e extends z {
|
|
|
2055
2055
|
}
|
|
2056
2056
|
_parse(e) {
|
|
2057
2057
|
let { status: t, ctx: n } = this._processInputParams(e);
|
|
2058
|
-
if (n.parsedType !== b.map) return
|
|
2058
|
+
if (n.parsedType !== b.map) return P(n, {
|
|
2059
2059
|
code: y.invalid_type,
|
|
2060
2060
|
expected: b.map,
|
|
2061
2061
|
received: n.parsedType
|
|
2062
|
-
}),
|
|
2062
|
+
}), I;
|
|
2063
2063
|
let r = this._def.keyType, i = this._def.valueType, a = [...n.data.entries()].map(([e, t], a) => ({
|
|
2064
|
-
key: r._parse(new
|
|
2065
|
-
value: i._parse(new
|
|
2064
|
+
key: r._parse(new z(n, e, n.path, [a, "key"])),
|
|
2065
|
+
value: i._parse(new z(n, t, n.path, [a, "value"]))
|
|
2066
2066
|
}));
|
|
2067
2067
|
if (n.common.async) {
|
|
2068
2068
|
let e = /* @__PURE__ */ new Map();
|
|
2069
2069
|
return Promise.resolve().then(async () => {
|
|
2070
2070
|
for (let n of a) {
|
|
2071
2071
|
let r = await n.key, i = await n.value;
|
|
2072
|
-
if (r.status === "aborted" || i.status === "aborted") return
|
|
2072
|
+
if (r.status === "aborted" || i.status === "aborted") return I;
|
|
2073
2073
|
(r.status === "dirty" || i.status === "dirty") && t.dirty(), e.set(r.value, i.value);
|
|
2074
2074
|
}
|
|
2075
2075
|
return {
|
|
@@ -2081,7 +2081,7 @@ var Mt = class e extends z {
|
|
|
2081
2081
|
let e = /* @__PURE__ */ new Map();
|
|
2082
2082
|
for (let n of a) {
|
|
2083
2083
|
let r = n.key, i = n.value;
|
|
2084
|
-
if (r.status === "aborted" || i.status === "aborted") return
|
|
2084
|
+
if (r.status === "aborted" || i.status === "aborted") return I;
|
|
2085
2085
|
(r.status === "dirty" || i.status === "dirty") && t.dirty(), e.set(r.value, i.value);
|
|
2086
2086
|
}
|
|
2087
2087
|
return {
|
|
@@ -2095,25 +2095,25 @@ Nt.create = (e, t, n) => new Nt({
|
|
|
2095
2095
|
valueType: t,
|
|
2096
2096
|
keyType: e,
|
|
2097
2097
|
typeName: G.ZodMap,
|
|
2098
|
-
...
|
|
2098
|
+
...B(n)
|
|
2099
2099
|
});
|
|
2100
|
-
var Pt = class e extends
|
|
2100
|
+
var Pt = class e extends V {
|
|
2101
2101
|
_parse(e) {
|
|
2102
2102
|
let { status: t, ctx: n } = this._processInputParams(e);
|
|
2103
|
-
if (n.parsedType !== b.set) return
|
|
2103
|
+
if (n.parsedType !== b.set) return P(n, {
|
|
2104
2104
|
code: y.invalid_type,
|
|
2105
2105
|
expected: b.set,
|
|
2106
2106
|
received: n.parsedType
|
|
2107
|
-
}),
|
|
2107
|
+
}), I;
|
|
2108
2108
|
let r = this._def;
|
|
2109
|
-
r.minSize !== null && n.data.size < r.minSize.value && (
|
|
2109
|
+
r.minSize !== null && n.data.size < r.minSize.value && (P(n, {
|
|
2110
2110
|
code: y.too_small,
|
|
2111
2111
|
minimum: r.minSize.value,
|
|
2112
2112
|
type: "set",
|
|
2113
2113
|
inclusive: !0,
|
|
2114
2114
|
exact: !1,
|
|
2115
2115
|
message: r.minSize.message
|
|
2116
|
-
}), t.dirty()), r.maxSize !== null && n.data.size > r.maxSize.value && (
|
|
2116
|
+
}), t.dirty()), r.maxSize !== null && n.data.size > r.maxSize.value && (P(n, {
|
|
2117
2117
|
code: y.too_big,
|
|
2118
2118
|
maximum: r.maxSize.value,
|
|
2119
2119
|
type: "set",
|
|
@@ -2125,7 +2125,7 @@ var Pt = class e extends z {
|
|
|
2125
2125
|
function a(e) {
|
|
2126
2126
|
let n = /* @__PURE__ */ new Set();
|
|
2127
2127
|
for (let r of e) {
|
|
2128
|
-
if (r.status === "aborted") return
|
|
2128
|
+
if (r.status === "aborted") return I;
|
|
2129
2129
|
r.status === "dirty" && t.dirty(), n.add(r.value);
|
|
2130
2130
|
}
|
|
2131
2131
|
return {
|
|
@@ -2133,7 +2133,7 @@ var Pt = class e extends z {
|
|
|
2133
2133
|
value: n
|
|
2134
2134
|
};
|
|
2135
2135
|
}
|
|
2136
|
-
let o = [...n.data.values()].map((e, t) => i._parse(new
|
|
2136
|
+
let o = [...n.data.values()].map((e, t) => i._parse(new z(n, e, n.path, t)));
|
|
2137
2137
|
return n.common.async ? Promise.all(o).then((e) => a(e)) : a(o);
|
|
2138
2138
|
}
|
|
2139
2139
|
min(t, n) {
|
|
@@ -2141,7 +2141,7 @@ var Pt = class e extends z {
|
|
|
2141
2141
|
...this._def,
|
|
2142
2142
|
minSize: {
|
|
2143
2143
|
value: t,
|
|
2144
|
-
message:
|
|
2144
|
+
message: R.toString(n)
|
|
2145
2145
|
}
|
|
2146
2146
|
});
|
|
2147
2147
|
}
|
|
@@ -2150,7 +2150,7 @@ var Pt = class e extends z {
|
|
|
2150
2150
|
...this._def,
|
|
2151
2151
|
maxSize: {
|
|
2152
2152
|
value: t,
|
|
2153
|
-
message:
|
|
2153
|
+
message: R.toString(n)
|
|
2154
2154
|
}
|
|
2155
2155
|
});
|
|
2156
2156
|
}
|
|
@@ -2166,28 +2166,28 @@ Pt.create = (e, t) => new Pt({
|
|
|
2166
2166
|
minSize: null,
|
|
2167
2167
|
maxSize: null,
|
|
2168
2168
|
typeName: G.ZodSet,
|
|
2169
|
-
...
|
|
2169
|
+
...B(t)
|
|
2170
2170
|
});
|
|
2171
|
-
var Ft = class e extends
|
|
2171
|
+
var Ft = class e extends V {
|
|
2172
2172
|
constructor() {
|
|
2173
2173
|
super(...arguments), this.validate = this.implement;
|
|
2174
2174
|
}
|
|
2175
2175
|
_parse(e) {
|
|
2176
2176
|
let { ctx: t } = this._processInputParams(e);
|
|
2177
|
-
if (t.parsedType !== b.function) return
|
|
2177
|
+
if (t.parsedType !== b.function) return P(t, {
|
|
2178
2178
|
code: y.invalid_type,
|
|
2179
2179
|
expected: b.function,
|
|
2180
2180
|
received: t.parsedType
|
|
2181
|
-
}),
|
|
2181
|
+
}), I;
|
|
2182
2182
|
function n(e, n) {
|
|
2183
|
-
return
|
|
2183
|
+
return N({
|
|
2184
2184
|
data: e,
|
|
2185
2185
|
path: t.path,
|
|
2186
2186
|
errorMaps: [
|
|
2187
2187
|
t.common.contextualErrorMap,
|
|
2188
2188
|
t.schemaErrorMap,
|
|
2189
|
-
|
|
2190
|
-
|
|
2189
|
+
Pe(),
|
|
2190
|
+
Me
|
|
2191
2191
|
].filter((e) => !!e),
|
|
2192
2192
|
issueData: {
|
|
2193
2193
|
code: y.invalid_arguments,
|
|
@@ -2196,14 +2196,14 @@ var Ft = class e extends z {
|
|
|
2196
2196
|
});
|
|
2197
2197
|
}
|
|
2198
2198
|
function r(e, n) {
|
|
2199
|
-
return
|
|
2199
|
+
return N({
|
|
2200
2200
|
data: e,
|
|
2201
2201
|
path: t.path,
|
|
2202
2202
|
errorMaps: [
|
|
2203
2203
|
t.common.contextualErrorMap,
|
|
2204
2204
|
t.schemaErrorMap,
|
|
2205
|
-
|
|
2206
|
-
|
|
2205
|
+
Pe(),
|
|
2206
|
+
Me
|
|
2207
2207
|
].filter((e) => !!e),
|
|
2208
2208
|
issueData: {
|
|
2209
2209
|
code: y.invalid_return_type,
|
|
@@ -2214,7 +2214,7 @@ var Ft = class e extends z {
|
|
|
2214
2214
|
let i = { errorMap: t.common.contextualErrorMap }, a = t.data;
|
|
2215
2215
|
if (this._def.returns instanceof Vt) {
|
|
2216
2216
|
let e = this;
|
|
2217
|
-
return
|
|
2217
|
+
return L(async function(...t) {
|
|
2218
2218
|
let o = new x([]), s = await e._def.args.parseAsync(t, i).catch((e) => {
|
|
2219
2219
|
throw o.addIssue(n(t, e)), o;
|
|
2220
2220
|
}), c = await Reflect.apply(a, this, s);
|
|
@@ -2224,7 +2224,7 @@ var Ft = class e extends z {
|
|
|
2224
2224
|
});
|
|
2225
2225
|
} else {
|
|
2226
2226
|
let e = this;
|
|
2227
|
-
return
|
|
2227
|
+
return L(function(...t) {
|
|
2228
2228
|
let o = e._def.args.safeParse(t, i);
|
|
2229
2229
|
if (!o.success) throw new x([n(t, o.error)]);
|
|
2230
2230
|
let s = Reflect.apply(a, this, o.data), c = e._def.returns.safeParse(s, i);
|
|
@@ -2242,7 +2242,7 @@ var Ft = class e extends z {
|
|
|
2242
2242
|
args(...t) {
|
|
2243
2243
|
return new e({
|
|
2244
2244
|
...this._def,
|
|
2245
|
-
args: jt.create(t).rest(
|
|
2245
|
+
args: jt.create(t).rest(xt.create())
|
|
2246
2246
|
});
|
|
2247
2247
|
}
|
|
2248
2248
|
returns(t) {
|
|
@@ -2259,13 +2259,13 @@ var Ft = class e extends z {
|
|
|
2259
2259
|
}
|
|
2260
2260
|
static create(t, n, r) {
|
|
2261
2261
|
return new e({
|
|
2262
|
-
args: t || jt.create([]).rest(
|
|
2263
|
-
returns: n ||
|
|
2262
|
+
args: t || jt.create([]).rest(xt.create()),
|
|
2263
|
+
returns: n || xt.create(),
|
|
2264
2264
|
typeName: G.ZodFunction,
|
|
2265
|
-
...
|
|
2265
|
+
...B(r)
|
|
2266
2266
|
});
|
|
2267
2267
|
}
|
|
2268
|
-
}, It = class extends
|
|
2268
|
+
}, It = class extends V {
|
|
2269
2269
|
get schema() {
|
|
2270
2270
|
return this._def.getter();
|
|
2271
2271
|
}
|
|
@@ -2281,17 +2281,17 @@ var Ft = class e extends z {
|
|
|
2281
2281
|
It.create = (e, t) => new It({
|
|
2282
2282
|
getter: e,
|
|
2283
2283
|
typeName: G.ZodLazy,
|
|
2284
|
-
...
|
|
2284
|
+
...B(t)
|
|
2285
2285
|
});
|
|
2286
|
-
var Lt = class extends
|
|
2286
|
+
var Lt = class extends V {
|
|
2287
2287
|
_parse(e) {
|
|
2288
2288
|
if (e.data !== this._def.value) {
|
|
2289
2289
|
let t = this._getOrReturnCtx(e);
|
|
2290
|
-
return
|
|
2290
|
+
return P(t, {
|
|
2291
2291
|
received: t.data,
|
|
2292
2292
|
code: y.invalid_literal,
|
|
2293
2293
|
expected: this._def.value
|
|
2294
|
-
}),
|
|
2294
|
+
}), I;
|
|
2295
2295
|
}
|
|
2296
2296
|
return {
|
|
2297
2297
|
status: "valid",
|
|
@@ -2305,34 +2305,34 @@ var Lt = class extends z {
|
|
|
2305
2305
|
Lt.create = (e, t) => new Lt({
|
|
2306
2306
|
value: e,
|
|
2307
2307
|
typeName: G.ZodLiteral,
|
|
2308
|
-
...
|
|
2308
|
+
...B(t)
|
|
2309
2309
|
});
|
|
2310
2310
|
function Rt(e, t) {
|
|
2311
2311
|
return new zt({
|
|
2312
2312
|
values: e,
|
|
2313
2313
|
typeName: G.ZodEnum,
|
|
2314
|
-
...
|
|
2314
|
+
...B(t)
|
|
2315
2315
|
});
|
|
2316
2316
|
}
|
|
2317
|
-
var zt = class e extends
|
|
2317
|
+
var zt = class e extends V {
|
|
2318
2318
|
_parse(e) {
|
|
2319
2319
|
if (typeof e.data != "string") {
|
|
2320
2320
|
let t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2321
|
-
return
|
|
2321
|
+
return P(t, {
|
|
2322
2322
|
expected: _.joinValues(n),
|
|
2323
2323
|
received: t.parsedType,
|
|
2324
2324
|
code: y.invalid_type
|
|
2325
|
-
}),
|
|
2325
|
+
}), I;
|
|
2326
2326
|
}
|
|
2327
2327
|
if (this._cache ||= new Set(this._def.values), !this._cache.has(e.data)) {
|
|
2328
2328
|
let t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2329
|
-
return
|
|
2329
|
+
return P(t, {
|
|
2330
2330
|
received: t.data,
|
|
2331
2331
|
code: y.invalid_enum_value,
|
|
2332
2332
|
options: n
|
|
2333
|
-
}),
|
|
2333
|
+
}), I;
|
|
2334
2334
|
}
|
|
2335
|
-
return
|
|
2335
|
+
return L(e.data);
|
|
2336
2336
|
}
|
|
2337
2337
|
get options() {
|
|
2338
2338
|
return this._def.values;
|
|
@@ -2366,26 +2366,26 @@ var zt = class e extends z {
|
|
|
2366
2366
|
}
|
|
2367
2367
|
};
|
|
2368
2368
|
zt.create = Rt;
|
|
2369
|
-
var Bt = class extends
|
|
2369
|
+
var Bt = class extends V {
|
|
2370
2370
|
_parse(e) {
|
|
2371
2371
|
let t = _.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2372
2372
|
if (n.parsedType !== b.string && n.parsedType !== b.number) {
|
|
2373
2373
|
let e = _.objectValues(t);
|
|
2374
|
-
return
|
|
2374
|
+
return P(n, {
|
|
2375
2375
|
expected: _.joinValues(e),
|
|
2376
2376
|
received: n.parsedType,
|
|
2377
2377
|
code: y.invalid_type
|
|
2378
|
-
}),
|
|
2378
|
+
}), I;
|
|
2379
2379
|
}
|
|
2380
2380
|
if (this._cache ||= new Set(_.getValidEnumValues(this._def.values)), !this._cache.has(e.data)) {
|
|
2381
2381
|
let e = _.objectValues(t);
|
|
2382
|
-
return
|
|
2382
|
+
return P(n, {
|
|
2383
2383
|
received: n.data,
|
|
2384
2384
|
code: y.invalid_enum_value,
|
|
2385
2385
|
options: e
|
|
2386
|
-
}),
|
|
2386
|
+
}), I;
|
|
2387
2387
|
}
|
|
2388
|
-
return
|
|
2388
|
+
return L(e.data);
|
|
2389
2389
|
}
|
|
2390
2390
|
get enum() {
|
|
2391
2391
|
return this._def.values;
|
|
@@ -2394,19 +2394,19 @@ var Bt = class extends z {
|
|
|
2394
2394
|
Bt.create = (e, t) => new Bt({
|
|
2395
2395
|
values: e,
|
|
2396
2396
|
typeName: G.ZodNativeEnum,
|
|
2397
|
-
...
|
|
2397
|
+
...B(t)
|
|
2398
2398
|
});
|
|
2399
|
-
var Vt = class extends
|
|
2399
|
+
var Vt = class extends V {
|
|
2400
2400
|
unwrap() {
|
|
2401
2401
|
return this._def.type;
|
|
2402
2402
|
}
|
|
2403
2403
|
_parse(e) {
|
|
2404
2404
|
let { ctx: t } = this._processInputParams(e);
|
|
2405
|
-
return t.parsedType !== b.promise && t.common.async === !1 ? (
|
|
2405
|
+
return t.parsedType !== b.promise && t.common.async === !1 ? (P(t, {
|
|
2406
2406
|
code: y.invalid_type,
|
|
2407
2407
|
expected: b.promise,
|
|
2408
2408
|
received: t.parsedType
|
|
2409
|
-
}),
|
|
2409
|
+
}), I) : L((t.parsedType === b.promise ? t.data : Promise.resolve(t.data)).then((e) => this._def.type.parseAsync(e, {
|
|
2410
2410
|
path: t.path,
|
|
2411
2411
|
errorMap: t.common.contextualErrorMap
|
|
2412
2412
|
})));
|
|
@@ -2415,9 +2415,9 @@ var Vt = class extends z {
|
|
|
2415
2415
|
Vt.create = (e, t) => new Vt({
|
|
2416
2416
|
type: e,
|
|
2417
2417
|
typeName: G.ZodPromise,
|
|
2418
|
-
...
|
|
2418
|
+
...B(t)
|
|
2419
2419
|
});
|
|
2420
|
-
var U = class extends
|
|
2420
|
+
var U = class extends V {
|
|
2421
2421
|
innerType() {
|
|
2422
2422
|
return this._def.schema;
|
|
2423
2423
|
}
|
|
@@ -2427,7 +2427,7 @@ var U = class extends z {
|
|
|
2427
2427
|
_parse(e) {
|
|
2428
2428
|
let { status: t, ctx: n } = this._processInputParams(e), r = this._def.effect || null, i = {
|
|
2429
2429
|
addIssue: (e) => {
|
|
2430
|
-
|
|
2430
|
+
P(n, e), e.fatal ? t.abort() : t.dirty();
|
|
2431
2431
|
},
|
|
2432
2432
|
get path() {
|
|
2433
2433
|
return n.path;
|
|
@@ -2436,22 +2436,22 @@ var U = class extends z {
|
|
|
2436
2436
|
if (i.addIssue = i.addIssue.bind(i), r.type === "preprocess") {
|
|
2437
2437
|
let e = r.transform(n.data, i);
|
|
2438
2438
|
if (n.common.async) return Promise.resolve(e).then(async (e) => {
|
|
2439
|
-
if (t.value === "aborted") return
|
|
2439
|
+
if (t.value === "aborted") return I;
|
|
2440
2440
|
let r = await this._def.schema._parseAsync({
|
|
2441
2441
|
data: e,
|
|
2442
2442
|
path: n.path,
|
|
2443
2443
|
parent: n
|
|
2444
2444
|
});
|
|
2445
|
-
return r.status === "aborted" ?
|
|
2445
|
+
return r.status === "aborted" ? I : r.status === "dirty" || t.value === "dirty" ? Fe(r.value) : r;
|
|
2446
2446
|
});
|
|
2447
2447
|
{
|
|
2448
|
-
if (t.value === "aborted") return
|
|
2448
|
+
if (t.value === "aborted") return I;
|
|
2449
2449
|
let r = this._def.schema._parseSync({
|
|
2450
2450
|
data: e,
|
|
2451
2451
|
path: n.path,
|
|
2452
2452
|
parent: n
|
|
2453
2453
|
});
|
|
2454
|
-
return r.status === "aborted" ?
|
|
2454
|
+
return r.status === "aborted" ? I : r.status === "dirty" || t.value === "dirty" ? Fe(r.value) : r;
|
|
2455
2455
|
}
|
|
2456
2456
|
}
|
|
2457
2457
|
if (r.type === "refinement") {
|
|
@@ -2467,7 +2467,7 @@ var U = class extends z {
|
|
|
2467
2467
|
path: n.path,
|
|
2468
2468
|
parent: n
|
|
2469
2469
|
});
|
|
2470
|
-
return r.status === "aborted" ?
|
|
2470
|
+
return r.status === "aborted" ? I : (r.status === "dirty" && t.dirty(), e(r.value), {
|
|
2471
2471
|
status: t.value,
|
|
2472
2472
|
value: r.value
|
|
2473
2473
|
});
|
|
@@ -2475,7 +2475,7 @@ var U = class extends z {
|
|
|
2475
2475
|
data: n.data,
|
|
2476
2476
|
path: n.path,
|
|
2477
2477
|
parent: n
|
|
2478
|
-
}).then((n) => n.status === "aborted" ?
|
|
2478
|
+
}).then((n) => n.status === "aborted" ? I : (n.status === "dirty" && t.dirty(), e(n.value).then(() => ({
|
|
2479
2479
|
status: t.value,
|
|
2480
2480
|
value: n.value
|
|
2481
2481
|
}))));
|
|
@@ -2486,7 +2486,7 @@ var U = class extends z {
|
|
|
2486
2486
|
path: n.path,
|
|
2487
2487
|
parent: n
|
|
2488
2488
|
});
|
|
2489
|
-
if (!
|
|
2489
|
+
if (!Re(e)) return I;
|
|
2490
2490
|
let a = r.transform(e.value, i);
|
|
2491
2491
|
if (a instanceof Promise) throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2492
2492
|
return {
|
|
@@ -2497,10 +2497,10 @@ var U = class extends z {
|
|
|
2497
2497
|
data: n.data,
|
|
2498
2498
|
path: n.path,
|
|
2499
2499
|
parent: n
|
|
2500
|
-
}).then((e) =>
|
|
2500
|
+
}).then((e) => Re(e) ? Promise.resolve(r.transform(e.value, i)).then((e) => ({
|
|
2501
2501
|
status: t.value,
|
|
2502
2502
|
value: e
|
|
2503
|
-
})) :
|
|
2503
|
+
})) : I);
|
|
2504
2504
|
_.assertNever(r);
|
|
2505
2505
|
}
|
|
2506
2506
|
};
|
|
@@ -2508,7 +2508,7 @@ U.create = (e, t, n) => new U({
|
|
|
2508
2508
|
schema: e,
|
|
2509
2509
|
typeName: G.ZodEffects,
|
|
2510
2510
|
effect: t,
|
|
2511
|
-
...
|
|
2511
|
+
...B(n)
|
|
2512
2512
|
}), U.createWithPreprocess = (e, t, n) => new U({
|
|
2513
2513
|
schema: t,
|
|
2514
2514
|
effect: {
|
|
@@ -2516,11 +2516,11 @@ U.create = (e, t, n) => new U({
|
|
|
2516
2516
|
transform: e
|
|
2517
2517
|
},
|
|
2518
2518
|
typeName: G.ZodEffects,
|
|
2519
|
-
...
|
|
2519
|
+
...B(n)
|
|
2520
2520
|
});
|
|
2521
|
-
var W = class extends
|
|
2521
|
+
var W = class extends V {
|
|
2522
2522
|
_parse(e) {
|
|
2523
|
-
return this._getType(e) === b.undefined ?
|
|
2523
|
+
return this._getType(e) === b.undefined ? L(void 0) : this._def.innerType._parse(e);
|
|
2524
2524
|
}
|
|
2525
2525
|
unwrap() {
|
|
2526
2526
|
return this._def.innerType;
|
|
@@ -2529,11 +2529,11 @@ var W = class extends z {
|
|
|
2529
2529
|
W.create = (e, t) => new W({
|
|
2530
2530
|
innerType: e,
|
|
2531
2531
|
typeName: G.ZodOptional,
|
|
2532
|
-
...
|
|
2532
|
+
...B(t)
|
|
2533
2533
|
});
|
|
2534
|
-
var Ht = class extends
|
|
2534
|
+
var Ht = class extends V {
|
|
2535
2535
|
_parse(e) {
|
|
2536
|
-
return this._getType(e) === b.null ?
|
|
2536
|
+
return this._getType(e) === b.null ? L(null) : this._def.innerType._parse(e);
|
|
2537
2537
|
}
|
|
2538
2538
|
unwrap() {
|
|
2539
2539
|
return this._def.innerType;
|
|
@@ -2542,9 +2542,9 @@ var Ht = class extends z {
|
|
|
2542
2542
|
Ht.create = (e, t) => new Ht({
|
|
2543
2543
|
innerType: e,
|
|
2544
2544
|
typeName: G.ZodNullable,
|
|
2545
|
-
...
|
|
2545
|
+
...B(t)
|
|
2546
2546
|
});
|
|
2547
|
-
var Ut = class extends
|
|
2547
|
+
var Ut = class extends V {
|
|
2548
2548
|
_parse(e) {
|
|
2549
2549
|
let { ctx: t } = this._processInputParams(e), n = t.data;
|
|
2550
2550
|
return t.parsedType === b.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
|
|
@@ -2561,9 +2561,9 @@ Ut.create = (e, t) => new Ut({
|
|
|
2561
2561
|
innerType: e,
|
|
2562
2562
|
typeName: G.ZodDefault,
|
|
2563
2563
|
defaultValue: typeof t.default == "function" ? t.default : () => t.default,
|
|
2564
|
-
...
|
|
2564
|
+
...B(t)
|
|
2565
2565
|
});
|
|
2566
|
-
var Wt = class extends
|
|
2566
|
+
var Wt = class extends V {
|
|
2567
2567
|
_parse(e) {
|
|
2568
2568
|
let { ctx: t } = this._processInputParams(e), n = {
|
|
2569
2569
|
...t,
|
|
@@ -2576,7 +2576,7 @@ var Wt = class extends z {
|
|
|
2576
2576
|
path: n.path,
|
|
2577
2577
|
parent: { ...n }
|
|
2578
2578
|
});
|
|
2579
|
-
return
|
|
2579
|
+
return ze(r) ? r.then((e) => ({
|
|
2580
2580
|
status: "valid",
|
|
2581
2581
|
value: e.status === "valid" ? e.value : this._def.catchValue({
|
|
2582
2582
|
get error() {
|
|
@@ -2602,17 +2602,17 @@ Wt.create = (e, t) => new Wt({
|
|
|
2602
2602
|
innerType: e,
|
|
2603
2603
|
typeName: G.ZodCatch,
|
|
2604
2604
|
catchValue: typeof t.catch == "function" ? t.catch : () => t.catch,
|
|
2605
|
-
...
|
|
2605
|
+
...B(t)
|
|
2606
2606
|
});
|
|
2607
|
-
var Gt = class extends
|
|
2607
|
+
var Gt = class extends V {
|
|
2608
2608
|
_parse(e) {
|
|
2609
2609
|
if (this._getType(e) !== b.nan) {
|
|
2610
2610
|
let t = this._getOrReturnCtx(e);
|
|
2611
|
-
return
|
|
2611
|
+
return P(t, {
|
|
2612
2612
|
code: y.invalid_type,
|
|
2613
2613
|
expected: b.nan,
|
|
2614
2614
|
received: t.parsedType
|
|
2615
|
-
}),
|
|
2615
|
+
}), I;
|
|
2616
2616
|
}
|
|
2617
2617
|
return {
|
|
2618
2618
|
status: "valid",
|
|
@@ -2622,9 +2622,9 @@ var Gt = class extends z {
|
|
|
2622
2622
|
};
|
|
2623
2623
|
Gt.create = (e) => new Gt({
|
|
2624
2624
|
typeName: G.ZodNaN,
|
|
2625
|
-
...
|
|
2625
|
+
...B(e)
|
|
2626
2626
|
});
|
|
2627
|
-
var Kt = class extends
|
|
2627
|
+
var Kt = class extends V {
|
|
2628
2628
|
_parse(e) {
|
|
2629
2629
|
let { ctx: t } = this._processInputParams(e), n = t.data;
|
|
2630
2630
|
return this._def.type._parse({
|
|
@@ -2636,7 +2636,7 @@ var Kt = class extends z {
|
|
|
2636
2636
|
unwrap() {
|
|
2637
2637
|
return this._def.type;
|
|
2638
2638
|
}
|
|
2639
|
-
}, qt = class e extends
|
|
2639
|
+
}, qt = class e extends V {
|
|
2640
2640
|
_parse(e) {
|
|
2641
2641
|
let { status: t, ctx: n } = this._processInputParams(e);
|
|
2642
2642
|
if (n.common.async) return (async () => {
|
|
@@ -2645,7 +2645,7 @@ var Kt = class extends z {
|
|
|
2645
2645
|
path: n.path,
|
|
2646
2646
|
parent: n
|
|
2647
2647
|
});
|
|
2648
|
-
return e.status === "aborted" ?
|
|
2648
|
+
return e.status === "aborted" ? I : e.status === "dirty" ? (t.dirty(), Fe(e.value)) : this._def.out._parseAsync({
|
|
2649
2649
|
data: e.value,
|
|
2650
2650
|
path: n.path,
|
|
2651
2651
|
parent: n
|
|
@@ -2657,7 +2657,7 @@ var Kt = class extends z {
|
|
|
2657
2657
|
path: n.path,
|
|
2658
2658
|
parent: n
|
|
2659
2659
|
});
|
|
2660
|
-
return e.status === "aborted" ?
|
|
2660
|
+
return e.status === "aborted" ? I : e.status === "dirty" ? (t.dirty(), {
|
|
2661
2661
|
status: "dirty",
|
|
2662
2662
|
value: e.value
|
|
2663
2663
|
}) : this._def.out._parseSync({
|
|
@@ -2674,10 +2674,10 @@ var Kt = class extends z {
|
|
|
2674
2674
|
typeName: G.ZodPipeline
|
|
2675
2675
|
});
|
|
2676
2676
|
}
|
|
2677
|
-
}, Jt = class extends
|
|
2677
|
+
}, Jt = class extends V {
|
|
2678
2678
|
_parse(e) {
|
|
2679
|
-
let t = this._def.innerType._parse(e), n = (e) => (
|
|
2680
|
-
return
|
|
2679
|
+
let t = this._def.innerType._parse(e), n = (e) => (Re(e) && (e.value = Object.freeze(e.value)), e);
|
|
2680
|
+
return ze(t) ? t.then((e) => n(e)) : n(t);
|
|
2681
2681
|
}
|
|
2682
2682
|
unwrap() {
|
|
2683
2683
|
return this._def.innerType;
|
|
@@ -2686,12 +2686,12 @@ var Kt = class extends z {
|
|
|
2686
2686
|
Jt.create = (e, t) => new Jt({
|
|
2687
2687
|
innerType: e,
|
|
2688
2688
|
typeName: G.ZodReadonly,
|
|
2689
|
-
...
|
|
2690
|
-
}),
|
|
2689
|
+
...B(t)
|
|
2690
|
+
}), H.lazycreate;
|
|
2691
2691
|
var G;
|
|
2692
2692
|
(function(e) {
|
|
2693
2693
|
e.ZodString = "ZodString", e.ZodNumber = "ZodNumber", e.ZodNaN = "ZodNaN", e.ZodBigInt = "ZodBigInt", e.ZodBoolean = "ZodBoolean", e.ZodDate = "ZodDate", e.ZodSymbol = "ZodSymbol", e.ZodUndefined = "ZodUndefined", e.ZodNull = "ZodNull", e.ZodAny = "ZodAny", e.ZodUnknown = "ZodUnknown", e.ZodNever = "ZodNever", e.ZodVoid = "ZodVoid", e.ZodArray = "ZodArray", e.ZodObject = "ZodObject", e.ZodUnion = "ZodUnion", e.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", e.ZodIntersection = "ZodIntersection", e.ZodTuple = "ZodTuple", e.ZodRecord = "ZodRecord", e.ZodMap = "ZodMap", e.ZodSet = "ZodSet", e.ZodFunction = "ZodFunction", e.ZodLazy = "ZodLazy", e.ZodLiteral = "ZodLiteral", e.ZodEnum = "ZodEnum", e.ZodEffects = "ZodEffects", e.ZodNativeEnum = "ZodNativeEnum", e.ZodOptional = "ZodOptional", e.ZodNullable = "ZodNullable", e.ZodDefault = "ZodDefault", e.ZodCatch = "ZodCatch", e.ZodPromise = "ZodPromise", e.ZodBranded = "ZodBranded", e.ZodPipeline = "ZodPipeline", e.ZodReadonly = "ZodReadonly";
|
|
2694
|
-
})(G ||= {}),
|
|
2694
|
+
})(G ||= {}), dt.create, pt.create, Gt.create, mt.create, ht.create, gt.create, _t.create, vt.create, yt.create, bt.create, xt.create, St.create, Ct.create, wt.create, H.create, H.strictCreate, Et.create, Ot.create, At.create, jt.create, Mt.create, Nt.create, Pt.create, Ft.create, It.create, Lt.create, zt.create, Bt.create, Vt.create, U.create, W.create, Ht.create, U.createWithPreprocess, qt.create;
|
|
2695
2695
|
//#endregion
|
|
2696
2696
|
//#region ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/index.js
|
|
2697
2697
|
var Yt = class extends Error {
|
|
@@ -2884,7 +2884,7 @@ var { btoa: an, atob: on } = globalThis, K = ({ prefix: e, size: t = 16, alphabe
|
|
|
2884
2884
|
return r.join("");
|
|
2885
2885
|
};
|
|
2886
2886
|
if (e == null) return i;
|
|
2887
|
-
if (n.includes(r)) throw new
|
|
2887
|
+
if (n.includes(r)) throw new Ce({
|
|
2888
2888
|
argument: "separator",
|
|
2889
2889
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
2890
2890
|
});
|
|
@@ -3729,7 +3729,7 @@ function _r(e) {
|
|
|
3729
3729
|
value: n.value
|
|
3730
3730
|
} : {
|
|
3731
3731
|
success: !1,
|
|
3732
|
-
error: new
|
|
3732
|
+
error: new M({
|
|
3733
3733
|
value: t,
|
|
3734
3734
|
cause: n.issues
|
|
3735
3735
|
})
|
|
@@ -3781,7 +3781,7 @@ async function Cr({ value: e, schema: t, context: n }) {
|
|
|
3781
3781
|
schema: t,
|
|
3782
3782
|
context: n
|
|
3783
3783
|
});
|
|
3784
|
-
if (!r.success) throw
|
|
3784
|
+
if (!r.success) throw M.wrap({
|
|
3785
3785
|
value: e,
|
|
3786
3786
|
cause: r.error,
|
|
3787
3787
|
context: n
|
|
@@ -3803,7 +3803,7 @@ async function wr({ value: e, schema: t, context: n }) {
|
|
|
3803
3803
|
rawValue: e
|
|
3804
3804
|
} : {
|
|
3805
3805
|
success: !1,
|
|
3806
|
-
error:
|
|
3806
|
+
error: M.wrap({
|
|
3807
3807
|
value: e,
|
|
3808
3808
|
cause: t.error,
|
|
3809
3809
|
context: n
|
|
@@ -3813,7 +3813,7 @@ async function wr({ value: e, schema: t, context: n }) {
|
|
|
3813
3813
|
} catch (t) {
|
|
3814
3814
|
return {
|
|
3815
3815
|
success: !1,
|
|
3816
|
-
error:
|
|
3816
|
+
error: M.wrap({
|
|
3817
3817
|
value: e,
|
|
3818
3818
|
cause: t,
|
|
3819
3819
|
context: n
|
|
@@ -3836,7 +3836,7 @@ async function Tr({ text: e, schema: t }) {
|
|
|
3836
3836
|
} catch (t) {
|
|
3837
3837
|
return {
|
|
3838
3838
|
success: !1,
|
|
3839
|
-
error:
|
|
3839
|
+
error: De.isInstance(t) ? t : new De({
|
|
3840
3840
|
text: e,
|
|
3841
3841
|
cause: t
|
|
3842
3842
|
}),
|
|
@@ -3857,13 +3857,13 @@ async function Dr(e) {
|
|
|
3857
3857
|
}
|
|
3858
3858
|
new TextDecoder();
|
|
3859
3859
|
//#endregion
|
|
3860
|
-
//#region ../../node_modules/.pnpm/ai@7.0.
|
|
3860
|
+
//#region ../../node_modules/.pnpm/ai@7.0.35_zod@4.4.3/node_modules/ai/dist/index.js
|
|
3861
3861
|
var Or = Object.defineProperty, kr = (e, t) => {
|
|
3862
3862
|
for (var n in t) Or(e, n, {
|
|
3863
3863
|
get: t[n],
|
|
3864
3864
|
enumerable: !0
|
|
3865
3865
|
});
|
|
3866
|
-
}, Ar = "AI_NoObjectGeneratedError", jr = `vercel.ai.error.${Ar}`, Mr = Symbol.for(jr), Nr, Pr = class extends
|
|
3866
|
+
}, Ar = "AI_NoObjectGeneratedError", jr = `vercel.ai.error.${Ar}`, Mr = Symbol.for(jr), Nr, Pr = class extends E {
|
|
3867
3867
|
constructor({ message: e = "No object generated.", cause: t, text: n, response: r, usage: i, finishReason: a }) {
|
|
3868
3868
|
super({
|
|
3869
3869
|
name: Ar,
|
|
@@ -3872,11 +3872,11 @@ var Or = Object.defineProperty, kr = (e, t) => {
|
|
|
3872
3872
|
}), this[Nr] = !0, this.text = n, this.response = r, this.usage = i, this.finishReason = a;
|
|
3873
3873
|
}
|
|
3874
3874
|
static isInstance(e) {
|
|
3875
|
-
return
|
|
3875
|
+
return E.hasMarker(e, jr);
|
|
3876
3876
|
}
|
|
3877
3877
|
};
|
|
3878
3878
|
Nr = Mr;
|
|
3879
|
-
var Fr = "AI_UIMessageStreamError", Ir = `vercel.ai.error.${Fr}`, Lr = Symbol.for(Ir), Rr, zr = class extends
|
|
3879
|
+
var Fr = "AI_UIMessageStreamError", Ir = `vercel.ai.error.${Fr}`, Lr = Symbol.for(Ir), Rr, zr = class extends E {
|
|
3880
3880
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
3881
3881
|
super({
|
|
3882
3882
|
name: Fr,
|
|
@@ -3884,249 +3884,248 @@ var Fr = "AI_UIMessageStreamError", Ir = `vercel.ai.error.${Fr}`, Lr = Symbol.fo
|
|
|
3884
3884
|
}), this[Rr] = !0, this.chunkType = e, this.chunkId = t;
|
|
3885
3885
|
}
|
|
3886
3886
|
static isInstance(e) {
|
|
3887
|
-
return
|
|
3887
|
+
return E.hasMarker(e, Ir);
|
|
3888
3888
|
}
|
|
3889
3889
|
};
|
|
3890
3890
|
Rr = Lr;
|
|
3891
|
-
|
|
3891
|
+
function Br(e, t) {
|
|
3892
|
+
if (e === void 0 && t === void 0) return;
|
|
3893
|
+
if (e === void 0) return t;
|
|
3894
|
+
if (t === void 0) return e;
|
|
3895
|
+
let n = { ...e };
|
|
3896
|
+
for (let r in t) if (!(r === "__proto__" || r === "constructor" || r === "prototype") && Object.prototype.hasOwnProperty.call(t, r)) {
|
|
3897
|
+
let i = t[r];
|
|
3898
|
+
if (i === void 0) continue;
|
|
3899
|
+
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);
|
|
3900
|
+
o && s ? n[r] = Br(a, i) : n[r] = i;
|
|
3901
|
+
}
|
|
3902
|
+
return n;
|
|
3903
|
+
}
|
|
3904
|
+
var Vr = a(() => g([
|
|
3892
3905
|
l(),
|
|
3893
3906
|
h(),
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
n(
|
|
3898
|
-
])), Q =
|
|
3907
|
+
c(),
|
|
3908
|
+
f(),
|
|
3909
|
+
t(h(), Vr.optional()),
|
|
3910
|
+
n(Vr)
|
|
3911
|
+
])), Q = t(h(), t(h(), Vr.optional())), Hr = g([
|
|
3899
3912
|
h(),
|
|
3900
3913
|
m(Uint8Array),
|
|
3901
3914
|
m(ArrayBuffer),
|
|
3902
3915
|
i(ln, { message: "Must be a Buffer" })
|
|
3903
|
-
]),
|
|
3916
|
+
]), Ur = t(h(), h()), Wr = s({
|
|
3904
3917
|
type: o("text"),
|
|
3905
3918
|
text: h(),
|
|
3906
3919
|
providerOptions: Q.optional()
|
|
3907
|
-
}),
|
|
3920
|
+
}), Gr = s({
|
|
3908
3921
|
type: o("image"),
|
|
3909
3922
|
image: g([
|
|
3910
|
-
|
|
3923
|
+
Hr,
|
|
3911
3924
|
m(URL),
|
|
3912
|
-
|
|
3925
|
+
Ur
|
|
3913
3926
|
]),
|
|
3914
3927
|
mediaType: h().optional(),
|
|
3915
3928
|
providerOptions: Q.optional()
|
|
3916
|
-
}),
|
|
3917
|
-
|
|
3929
|
+
}), Kr = u("type", [
|
|
3930
|
+
s({
|
|
3918
3931
|
type: o("data"),
|
|
3919
|
-
data:
|
|
3932
|
+
data: Hr
|
|
3920
3933
|
}),
|
|
3921
|
-
|
|
3934
|
+
s({
|
|
3922
3935
|
type: o("url"),
|
|
3923
3936
|
url: m(URL)
|
|
3924
3937
|
}),
|
|
3925
|
-
|
|
3938
|
+
s({
|
|
3926
3939
|
type: o("reference"),
|
|
3927
|
-
reference:
|
|
3940
|
+
reference: Ur
|
|
3928
3941
|
}),
|
|
3929
|
-
|
|
3942
|
+
s({
|
|
3930
3943
|
type: o("text"),
|
|
3931
3944
|
text: h()
|
|
3932
3945
|
})
|
|
3933
|
-
]),
|
|
3946
|
+
]), qr = u("type", [s({
|
|
3934
3947
|
type: o("data"),
|
|
3935
|
-
data:
|
|
3936
|
-
}),
|
|
3948
|
+
data: Hr
|
|
3949
|
+
}), s({
|
|
3937
3950
|
type: o("url"),
|
|
3938
3951
|
url: m(URL)
|
|
3939
|
-
})]),
|
|
3952
|
+
})]), Jr = s({
|
|
3940
3953
|
type: o("file"),
|
|
3941
3954
|
data: g([
|
|
3942
|
-
|
|
3943
|
-
|
|
3955
|
+
Kr,
|
|
3956
|
+
Hr,
|
|
3944
3957
|
m(URL),
|
|
3945
|
-
|
|
3958
|
+
Ur
|
|
3946
3959
|
]),
|
|
3947
3960
|
filename: h().optional(),
|
|
3948
3961
|
mediaType: h(),
|
|
3949
3962
|
providerOptions: Q.optional()
|
|
3950
|
-
}),
|
|
3963
|
+
}), Yr = s({
|
|
3951
3964
|
type: o("reasoning"),
|
|
3952
3965
|
text: h(),
|
|
3953
3966
|
providerOptions: Q.optional()
|
|
3954
|
-
}),
|
|
3967
|
+
}), Xr = s({
|
|
3955
3968
|
type: o("custom"),
|
|
3956
3969
|
kind: h().transform((e) => e),
|
|
3957
3970
|
providerOptions: Q.optional()
|
|
3958
|
-
}),
|
|
3971
|
+
}), Zr = s({
|
|
3959
3972
|
type: o("reasoning-file"),
|
|
3960
3973
|
data: g([
|
|
3961
|
-
|
|
3962
|
-
|
|
3974
|
+
qr,
|
|
3975
|
+
Hr,
|
|
3963
3976
|
m(URL)
|
|
3964
3977
|
]),
|
|
3965
3978
|
mediaType: h(),
|
|
3966
3979
|
providerOptions: Q.optional()
|
|
3967
|
-
}),
|
|
3980
|
+
}), Qr = s({
|
|
3968
3981
|
type: o("tool-call"),
|
|
3969
3982
|
toolCallId: h(),
|
|
3970
3983
|
toolName: h(),
|
|
3971
3984
|
input: r(),
|
|
3972
3985
|
providerOptions: Q.optional(),
|
|
3973
|
-
providerExecuted:
|
|
3974
|
-
}),
|
|
3975
|
-
|
|
3986
|
+
providerExecuted: f().optional()
|
|
3987
|
+
}), $r = u("type", [
|
|
3988
|
+
s({
|
|
3976
3989
|
type: o("text"),
|
|
3977
3990
|
value: h(),
|
|
3978
3991
|
providerOptions: Q.optional()
|
|
3979
3992
|
}),
|
|
3980
|
-
|
|
3993
|
+
s({
|
|
3981
3994
|
type: o("json"),
|
|
3982
|
-
value:
|
|
3995
|
+
value: Vr,
|
|
3983
3996
|
providerOptions: Q.optional()
|
|
3984
3997
|
}),
|
|
3985
|
-
|
|
3998
|
+
s({
|
|
3986
3999
|
type: o("execution-denied"),
|
|
3987
4000
|
reason: h().optional(),
|
|
3988
4001
|
providerOptions: Q.optional()
|
|
3989
4002
|
}),
|
|
3990
|
-
|
|
4003
|
+
s({
|
|
3991
4004
|
type: o("error-text"),
|
|
3992
4005
|
value: h(),
|
|
3993
4006
|
providerOptions: Q.optional()
|
|
3994
4007
|
}),
|
|
3995
|
-
|
|
4008
|
+
s({
|
|
3996
4009
|
type: o("error-json"),
|
|
3997
|
-
value:
|
|
4010
|
+
value: Vr,
|
|
3998
4011
|
providerOptions: Q.optional()
|
|
3999
4012
|
}),
|
|
4000
|
-
|
|
4013
|
+
s({
|
|
4001
4014
|
type: o("content"),
|
|
4002
4015
|
value: n(g([
|
|
4003
|
-
|
|
4016
|
+
s({
|
|
4004
4017
|
type: o("text"),
|
|
4005
4018
|
text: h(),
|
|
4006
4019
|
providerOptions: Q.optional()
|
|
4007
4020
|
}),
|
|
4008
|
-
|
|
4021
|
+
s({
|
|
4009
4022
|
type: o("file"),
|
|
4010
|
-
data:
|
|
4023
|
+
data: Kr,
|
|
4011
4024
|
mediaType: h(),
|
|
4012
4025
|
filename: h().optional(),
|
|
4013
4026
|
providerOptions: Q.optional()
|
|
4014
4027
|
}),
|
|
4015
|
-
|
|
4028
|
+
s({
|
|
4016
4029
|
type: o("file-data"),
|
|
4017
4030
|
data: h(),
|
|
4018
4031
|
mediaType: h(),
|
|
4019
4032
|
filename: h().optional(),
|
|
4020
4033
|
providerOptions: Q.optional()
|
|
4021
4034
|
}),
|
|
4022
|
-
|
|
4035
|
+
s({
|
|
4023
4036
|
type: o("file-url"),
|
|
4024
4037
|
url: h(),
|
|
4025
4038
|
mediaType: h().optional(),
|
|
4026
4039
|
providerOptions: Q.optional()
|
|
4027
4040
|
}),
|
|
4028
|
-
|
|
4041
|
+
s({
|
|
4029
4042
|
type: o("file-id"),
|
|
4030
|
-
fileId: g([h(),
|
|
4043
|
+
fileId: g([h(), t(h(), h())]),
|
|
4031
4044
|
providerOptions: Q.optional()
|
|
4032
4045
|
}),
|
|
4033
|
-
|
|
4046
|
+
s({
|
|
4034
4047
|
type: o("file-reference"),
|
|
4035
|
-
providerReference:
|
|
4048
|
+
providerReference: t(h(), h()),
|
|
4036
4049
|
providerOptions: Q.optional()
|
|
4037
4050
|
}),
|
|
4038
|
-
|
|
4051
|
+
s({
|
|
4039
4052
|
type: o("image-data"),
|
|
4040
4053
|
data: h(),
|
|
4041
4054
|
mediaType: h(),
|
|
4042
4055
|
providerOptions: Q.optional()
|
|
4043
4056
|
}),
|
|
4044
|
-
|
|
4057
|
+
s({
|
|
4045
4058
|
type: o("image-url"),
|
|
4046
4059
|
url: h(),
|
|
4047
4060
|
providerOptions: Q.optional()
|
|
4048
4061
|
}),
|
|
4049
|
-
|
|
4062
|
+
s({
|
|
4050
4063
|
type: o("image-file-id"),
|
|
4051
|
-
fileId: g([h(),
|
|
4064
|
+
fileId: g([h(), t(h(), h())]),
|
|
4052
4065
|
providerOptions: Q.optional()
|
|
4053
4066
|
}),
|
|
4054
|
-
|
|
4067
|
+
s({
|
|
4055
4068
|
type: o("image-file-reference"),
|
|
4056
|
-
providerReference:
|
|
4069
|
+
providerReference: t(h(), h()),
|
|
4057
4070
|
providerOptions: Q.optional()
|
|
4058
4071
|
}),
|
|
4059
|
-
|
|
4072
|
+
s({
|
|
4060
4073
|
type: o("custom"),
|
|
4061
4074
|
providerOptions: Q.optional()
|
|
4062
4075
|
})
|
|
4063
4076
|
]))
|
|
4064
4077
|
})
|
|
4065
|
-
]),
|
|
4078
|
+
]), ei = s({
|
|
4066
4079
|
type: o("tool-result"),
|
|
4067
4080
|
toolCallId: h(),
|
|
4068
4081
|
toolName: h(),
|
|
4069
|
-
output:
|
|
4082
|
+
output: $r,
|
|
4070
4083
|
providerOptions: Q.optional()
|
|
4071
|
-
}),
|
|
4084
|
+
}), ti = s({
|
|
4072
4085
|
type: o("tool-approval-request"),
|
|
4073
4086
|
approvalId: h(),
|
|
4074
4087
|
toolCallId: h()
|
|
4075
|
-
}),
|
|
4088
|
+
}), ni = s({
|
|
4076
4089
|
type: o("tool-approval-response"),
|
|
4077
4090
|
approvalId: h(),
|
|
4078
|
-
approved:
|
|
4091
|
+
approved: f(),
|
|
4079
4092
|
reason: h().optional()
|
|
4080
4093
|
});
|
|
4081
4094
|
g([
|
|
4082
|
-
|
|
4095
|
+
s({
|
|
4083
4096
|
role: o("system"),
|
|
4084
4097
|
content: h(),
|
|
4085
4098
|
providerOptions: Q.optional()
|
|
4086
4099
|
}),
|
|
4087
|
-
|
|
4100
|
+
s({
|
|
4088
4101
|
role: o("user"),
|
|
4089
4102
|
content: g([h(), n(g([
|
|
4090
|
-
Ur,
|
|
4091
4103
|
Wr,
|
|
4092
|
-
|
|
4104
|
+
Gr,
|
|
4105
|
+
Jr
|
|
4093
4106
|
]))]),
|
|
4094
4107
|
providerOptions: Q.optional()
|
|
4095
4108
|
}),
|
|
4096
|
-
|
|
4109
|
+
s({
|
|
4097
4110
|
role: o("assistant"),
|
|
4098
4111
|
content: g([h(), n(g([
|
|
4099
|
-
|
|
4100
|
-
Yr,
|
|
4101
|
-
qr,
|
|
4102
|
-
Jr,
|
|
4112
|
+
Wr,
|
|
4103
4113
|
Xr,
|
|
4114
|
+
Jr,
|
|
4115
|
+
Yr,
|
|
4104
4116
|
Zr,
|
|
4105
|
-
|
|
4106
|
-
ei
|
|
4117
|
+
Qr,
|
|
4118
|
+
ei,
|
|
4119
|
+
ti
|
|
4107
4120
|
]))]),
|
|
4108
4121
|
providerOptions: Q.optional()
|
|
4109
4122
|
}),
|
|
4110
|
-
|
|
4123
|
+
s({
|
|
4111
4124
|
role: o("tool"),
|
|
4112
|
-
content: n(g([
|
|
4125
|
+
content: n(g([ei, ni])),
|
|
4113
4126
|
providerOptions: Q.optional()
|
|
4114
4127
|
})
|
|
4115
|
-
])
|
|
4116
|
-
function ni(e, t) {
|
|
4117
|
-
if (e === void 0 && t === void 0) return;
|
|
4118
|
-
if (e === void 0) return t;
|
|
4119
|
-
if (t === void 0) return e;
|
|
4120
|
-
let n = { ...e };
|
|
4121
|
-
for (let r in t) if (!(r === "__proto__" || r === "constructor" || r === "prototype") && Object.prototype.hasOwnProperty.call(t, r)) {
|
|
4122
|
-
let i = t[r];
|
|
4123
|
-
if (i === void 0) continue;
|
|
4124
|
-
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);
|
|
4125
|
-
o && s ? n[r] = ni(a, i) : n[r] = i;
|
|
4126
|
-
}
|
|
4127
|
-
return n;
|
|
4128
|
-
}
|
|
4129
|
-
kr({}, {
|
|
4128
|
+
]), kr({}, {
|
|
4130
4129
|
array: () => si,
|
|
4131
4130
|
choice: () => ci,
|
|
4132
4131
|
json: () => li,
|
|
@@ -4448,7 +4447,7 @@ var ai = () => ({
|
|
|
4448
4447
|
let i = n.value;
|
|
4449
4448
|
if (typeof i != "object" || !i || !("elements" in i) || !Array.isArray(i.elements)) throw new Pr({
|
|
4450
4449
|
message: "No object generated: response did not match schema.",
|
|
4451
|
-
cause: new
|
|
4450
|
+
cause: new M({
|
|
4452
4451
|
value: i,
|
|
4453
4452
|
cause: "response must be an object with an elements array"
|
|
4454
4453
|
}),
|
|
@@ -4533,7 +4532,7 @@ var ai = () => ({
|
|
|
4533
4532
|
let i = r.value;
|
|
4534
4533
|
if (typeof i != "object" || !i || !("result" in i) || typeof i.result != "string" || !e.includes(i.result)) throw new Pr({
|
|
4535
4534
|
message: "No object generated: response did not match schema.",
|
|
4536
|
-
cause: new
|
|
4535
|
+
cause: new M({
|
|
4537
4536
|
value: i,
|
|
4538
4537
|
cause: "response must be an object that contains a choice value."
|
|
4539
4538
|
}),
|
|
@@ -4596,132 +4595,132 @@ new TextEncoder(), new TextEncoder(), K({
|
|
|
4596
4595
|
prefix: "call",
|
|
4597
4596
|
size: 24
|
|
4598
4597
|
}), TransformStream;
|
|
4599
|
-
var ui =
|
|
4600
|
-
|
|
4598
|
+
var ui = t(h(), Vr.optional()), di = pr(() => Sr(g([
|
|
4599
|
+
p({
|
|
4601
4600
|
type: o("text-start"),
|
|
4602
4601
|
id: h(),
|
|
4603
4602
|
providerMetadata: Q.optional()
|
|
4604
4603
|
}),
|
|
4605
|
-
|
|
4604
|
+
p({
|
|
4606
4605
|
type: o("text-delta"),
|
|
4607
4606
|
id: h(),
|
|
4608
4607
|
delta: h(),
|
|
4609
4608
|
providerMetadata: Q.optional()
|
|
4610
4609
|
}),
|
|
4611
|
-
|
|
4610
|
+
p({
|
|
4612
4611
|
type: o("text-end"),
|
|
4613
4612
|
id: h(),
|
|
4614
4613
|
providerMetadata: Q.optional()
|
|
4615
4614
|
}),
|
|
4616
|
-
|
|
4615
|
+
p({
|
|
4617
4616
|
type: o("error"),
|
|
4618
4617
|
errorText: h()
|
|
4619
4618
|
}),
|
|
4620
|
-
|
|
4619
|
+
p({
|
|
4621
4620
|
type: o("tool-input-start"),
|
|
4622
4621
|
toolCallId: h(),
|
|
4623
4622
|
toolName: h(),
|
|
4624
|
-
providerExecuted:
|
|
4623
|
+
providerExecuted: f().optional(),
|
|
4625
4624
|
providerMetadata: Q.optional(),
|
|
4626
4625
|
toolMetadata: ui.optional(),
|
|
4627
|
-
dynamic:
|
|
4626
|
+
dynamic: f().optional(),
|
|
4628
4627
|
title: h().optional()
|
|
4629
4628
|
}),
|
|
4630
|
-
|
|
4629
|
+
p({
|
|
4631
4630
|
type: o("tool-input-delta"),
|
|
4632
4631
|
toolCallId: h(),
|
|
4633
4632
|
inputTextDelta: h()
|
|
4634
4633
|
}),
|
|
4635
|
-
|
|
4634
|
+
p({
|
|
4636
4635
|
type: o("tool-input-available"),
|
|
4637
4636
|
toolCallId: h(),
|
|
4638
4637
|
toolName: h(),
|
|
4639
4638
|
input: r(),
|
|
4640
|
-
providerExecuted:
|
|
4639
|
+
providerExecuted: f().optional(),
|
|
4641
4640
|
providerMetadata: Q.optional(),
|
|
4642
4641
|
toolMetadata: ui.optional(),
|
|
4643
|
-
dynamic:
|
|
4642
|
+
dynamic: f().optional(),
|
|
4644
4643
|
title: h().optional()
|
|
4645
4644
|
}),
|
|
4646
|
-
|
|
4645
|
+
p({
|
|
4647
4646
|
type: o("tool-input-error"),
|
|
4648
4647
|
toolCallId: h(),
|
|
4649
4648
|
toolName: h(),
|
|
4650
4649
|
input: r(),
|
|
4651
|
-
providerExecuted:
|
|
4650
|
+
providerExecuted: f().optional(),
|
|
4652
4651
|
providerMetadata: Q.optional(),
|
|
4653
4652
|
toolMetadata: ui.optional(),
|
|
4654
|
-
dynamic:
|
|
4653
|
+
dynamic: f().optional(),
|
|
4655
4654
|
errorText: h(),
|
|
4656
4655
|
title: h().optional()
|
|
4657
4656
|
}),
|
|
4658
|
-
|
|
4657
|
+
p({
|
|
4659
4658
|
type: o("tool-approval-request"),
|
|
4660
4659
|
approvalId: h(),
|
|
4661
4660
|
toolCallId: h(),
|
|
4662
|
-
isAutomatic:
|
|
4661
|
+
isAutomatic: f().optional(),
|
|
4663
4662
|
signature: h().optional()
|
|
4664
4663
|
}),
|
|
4665
|
-
|
|
4664
|
+
p({
|
|
4666
4665
|
type: o("tool-approval-response"),
|
|
4667
4666
|
approvalId: h(),
|
|
4668
|
-
approved:
|
|
4667
|
+
approved: f(),
|
|
4669
4668
|
reason: h().optional(),
|
|
4670
|
-
providerExecuted:
|
|
4669
|
+
providerExecuted: f().optional(),
|
|
4671
4670
|
providerMetadata: Q.optional()
|
|
4672
4671
|
}),
|
|
4673
|
-
|
|
4672
|
+
p({
|
|
4674
4673
|
type: o("tool-output-available"),
|
|
4675
4674
|
toolCallId: h(),
|
|
4676
4675
|
output: r(),
|
|
4677
|
-
providerExecuted:
|
|
4676
|
+
providerExecuted: f().optional(),
|
|
4678
4677
|
providerMetadata: Q.optional(),
|
|
4679
4678
|
toolMetadata: ui.optional(),
|
|
4680
|
-
dynamic:
|
|
4681
|
-
preliminary:
|
|
4679
|
+
dynamic: f().optional(),
|
|
4680
|
+
preliminary: f().optional()
|
|
4682
4681
|
}),
|
|
4683
|
-
|
|
4682
|
+
p({
|
|
4684
4683
|
type: o("tool-output-error"),
|
|
4685
4684
|
toolCallId: h(),
|
|
4686
4685
|
errorText: h(),
|
|
4687
|
-
providerExecuted:
|
|
4686
|
+
providerExecuted: f().optional(),
|
|
4688
4687
|
providerMetadata: Q.optional(),
|
|
4689
4688
|
toolMetadata: ui.optional(),
|
|
4690
|
-
dynamic:
|
|
4689
|
+
dynamic: f().optional()
|
|
4691
4690
|
}),
|
|
4692
|
-
|
|
4691
|
+
p({
|
|
4693
4692
|
type: o("tool-output-denied"),
|
|
4694
4693
|
toolCallId: h()
|
|
4695
4694
|
}),
|
|
4696
|
-
|
|
4695
|
+
p({
|
|
4697
4696
|
type: o("reasoning-start"),
|
|
4698
4697
|
id: h(),
|
|
4699
4698
|
providerMetadata: Q.optional()
|
|
4700
4699
|
}),
|
|
4701
|
-
|
|
4700
|
+
p({
|
|
4702
4701
|
type: o("reasoning-delta"),
|
|
4703
4702
|
id: h(),
|
|
4704
4703
|
delta: h(),
|
|
4705
4704
|
providerMetadata: Q.optional()
|
|
4706
4705
|
}),
|
|
4707
|
-
|
|
4706
|
+
p({
|
|
4708
4707
|
type: o("reasoning-end"),
|
|
4709
4708
|
id: h(),
|
|
4710
4709
|
providerMetadata: Q.optional()
|
|
4711
4710
|
}),
|
|
4712
|
-
|
|
4711
|
+
p({
|
|
4713
4712
|
type: o("custom"),
|
|
4714
4713
|
kind: h().transform((e) => e),
|
|
4715
4714
|
providerMetadata: Q.optional()
|
|
4716
4715
|
}),
|
|
4717
|
-
|
|
4716
|
+
p({
|
|
4718
4717
|
type: o("source-url"),
|
|
4719
4718
|
sourceId: h(),
|
|
4720
4719
|
url: h(),
|
|
4721
4720
|
title: h().optional(),
|
|
4722
4721
|
providerMetadata: Q.optional()
|
|
4723
4722
|
}),
|
|
4724
|
-
|
|
4723
|
+
p({
|
|
4725
4724
|
type: o("source-document"),
|
|
4726
4725
|
sourceId: h(),
|
|
4727
4726
|
mediaType: h(),
|
|
@@ -4729,34 +4728,34 @@ var ui = s(h(), Br.optional()), di = pr(() => Sr(g([
|
|
|
4729
4728
|
filename: h().optional(),
|
|
4730
4729
|
providerMetadata: Q.optional()
|
|
4731
4730
|
}),
|
|
4732
|
-
|
|
4731
|
+
p({
|
|
4733
4732
|
type: o("file"),
|
|
4734
4733
|
url: h(),
|
|
4735
4734
|
mediaType: h(),
|
|
4736
4735
|
providerMetadata: Q.optional()
|
|
4737
4736
|
}),
|
|
4738
|
-
|
|
4737
|
+
p({
|
|
4739
4738
|
type: o("reasoning-file"),
|
|
4740
4739
|
url: h(),
|
|
4741
4740
|
mediaType: h(),
|
|
4742
4741
|
providerMetadata: Q.optional()
|
|
4743
4742
|
}),
|
|
4744
|
-
|
|
4743
|
+
p({
|
|
4745
4744
|
type: i((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
|
|
4746
4745
|
id: h().optional(),
|
|
4747
4746
|
data: r(),
|
|
4748
|
-
transient:
|
|
4747
|
+
transient: f().optional()
|
|
4749
4748
|
}),
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4749
|
+
p({ type: o("start-step") }),
|
|
4750
|
+
p({ type: o("finish-step") }),
|
|
4751
|
+
p({
|
|
4753
4752
|
type: o("start"),
|
|
4754
4753
|
messageId: h().optional(),
|
|
4755
4754
|
messageMetadata: r().optional()
|
|
4756
4755
|
}),
|
|
4757
|
-
|
|
4756
|
+
p({
|
|
4758
4757
|
type: o("finish"),
|
|
4759
|
-
finishReason:
|
|
4758
|
+
finishReason: d([
|
|
4760
4759
|
"stop",
|
|
4761
4760
|
"length",
|
|
4762
4761
|
"content-filter",
|
|
@@ -4766,11 +4765,11 @@ var ui = s(h(), Br.optional()), di = pr(() => Sr(g([
|
|
|
4766
4765
|
]).optional(),
|
|
4767
4766
|
messageMetadata: r().optional()
|
|
4768
4767
|
}),
|
|
4769
|
-
|
|
4768
|
+
p({
|
|
4770
4769
|
type: o("abort"),
|
|
4771
4770
|
reason: h().optional()
|
|
4772
4771
|
}),
|
|
4773
|
-
|
|
4772
|
+
p({
|
|
4774
4773
|
type: o("message-metadata"),
|
|
4775
4774
|
messageMetadata: r()
|
|
4776
4775
|
})
|
|
@@ -4809,8 +4808,26 @@ function vi({ lastMessage: e, messageId: t }) {
|
|
|
4809
4808
|
function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o }) {
|
|
4810
4809
|
return e.pipeThrough(new TransformStream({ async transform(e, s) {
|
|
4811
4810
|
await r(async ({ state: r, write: c }) => {
|
|
4812
|
-
function l(
|
|
4813
|
-
let
|
|
4811
|
+
function l() {
|
|
4812
|
+
let e = r.message.parts, t = e.length - 1;
|
|
4813
|
+
for (; t >= 0 && e[t].type !== "step-start";) t--;
|
|
4814
|
+
return e.slice(t + 1);
|
|
4815
|
+
}
|
|
4816
|
+
function u() {
|
|
4817
|
+
return l().filter(gi);
|
|
4818
|
+
}
|
|
4819
|
+
function d(e) {
|
|
4820
|
+
let t = u().find((t) => t.toolCallId === e);
|
|
4821
|
+
if (t == null) {
|
|
4822
|
+
let n = r.message.parts;
|
|
4823
|
+
for (let r = n.length - 1; r >= 0; r--) {
|
|
4824
|
+
let i = n[r];
|
|
4825
|
+
if (gi(i) && i.toolCallId === e) {
|
|
4826
|
+
t = i;
|
|
4827
|
+
break;
|
|
4828
|
+
}
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4814
4831
|
if (t == null) throw new zr({
|
|
4815
4832
|
chunkType: "tool-invocation",
|
|
4816
4833
|
chunkId: e,
|
|
@@ -4818,7 +4835,7 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
4818
4835
|
});
|
|
4819
4836
|
return t;
|
|
4820
4837
|
}
|
|
4821
|
-
function
|
|
4838
|
+
function f(e) {
|
|
4822
4839
|
let t = r.message.parts.filter(gi).find((t) => t.approval?.id === e);
|
|
4823
4840
|
if (t == null) throw new zr({
|
|
4824
4841
|
chunkType: "tool-approval-response",
|
|
@@ -4827,59 +4844,59 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
4827
4844
|
});
|
|
4828
4845
|
return t;
|
|
4829
4846
|
}
|
|
4830
|
-
function
|
|
4831
|
-
let
|
|
4832
|
-
if (
|
|
4833
|
-
|
|
4834
|
-
let
|
|
4835
|
-
if (
|
|
4836
|
-
let e =
|
|
4837
|
-
e.resultProviderMetadata =
|
|
4838
|
-
} else
|
|
4847
|
+
function p(e, t) {
|
|
4848
|
+
let n = t ?? l().find((t) => mi(t) && t.toolCallId === e.toolCallId), i = e, a = n;
|
|
4849
|
+
if (n != null) {
|
|
4850
|
+
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;
|
|
4851
|
+
let t = i.providerMetadata;
|
|
4852
|
+
if (t != null) if (e.state === "output-available" || e.state === "output-error") {
|
|
4853
|
+
let e = n;
|
|
4854
|
+
e.resultProviderMetadata = t;
|
|
4855
|
+
} else n.callProviderMetadata = t;
|
|
4839
4856
|
} else r.message.parts.push({
|
|
4840
4857
|
type: `tool-${e.toolName}`,
|
|
4841
4858
|
toolCallId: e.toolCallId,
|
|
4842
4859
|
state: e.state,
|
|
4843
4860
|
title: e.title,
|
|
4844
4861
|
...e.toolMetadata === void 0 ? {} : { toolMetadata: e.toolMetadata },
|
|
4845
|
-
input:
|
|
4846
|
-
output:
|
|
4847
|
-
rawInput:
|
|
4848
|
-
errorText:
|
|
4849
|
-
providerExecuted:
|
|
4850
|
-
preliminary:
|
|
4851
|
-
...
|
|
4852
|
-
...
|
|
4862
|
+
input: i.input,
|
|
4863
|
+
output: i.output,
|
|
4864
|
+
rawInput: i.rawInput,
|
|
4865
|
+
errorText: i.errorText,
|
|
4866
|
+
providerExecuted: i.providerExecuted,
|
|
4867
|
+
preliminary: i.preliminary,
|
|
4868
|
+
...i.providerMetadata != null && (e.state === "output-available" || e.state === "output-error") ? { resultProviderMetadata: i.providerMetadata } : {},
|
|
4869
|
+
...i.providerMetadata != null && !(e.state === "output-available" || e.state === "output-error") ? { callProviderMetadata: i.providerMetadata } : {}
|
|
4853
4870
|
});
|
|
4854
4871
|
}
|
|
4855
|
-
function
|
|
4856
|
-
let
|
|
4857
|
-
if (
|
|
4858
|
-
|
|
4859
|
-
let
|
|
4860
|
-
if (
|
|
4861
|
-
let e =
|
|
4862
|
-
e.resultProviderMetadata =
|
|
4863
|
-
} else
|
|
4872
|
+
function m(e, t) {
|
|
4873
|
+
let n = t ?? l().find((t) => t.type === "dynamic-tool" && t.toolCallId === e.toolCallId), i = e, a = n;
|
|
4874
|
+
if (n != null) {
|
|
4875
|
+
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.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;
|
|
4876
|
+
let t = i.providerMetadata;
|
|
4877
|
+
if (t != null) if (e.state === "output-available" || e.state === "output-error") {
|
|
4878
|
+
let e = n;
|
|
4879
|
+
e.resultProviderMetadata = t;
|
|
4880
|
+
} else n.callProviderMetadata = t;
|
|
4864
4881
|
} else r.message.parts.push({
|
|
4865
4882
|
type: "dynamic-tool",
|
|
4866
4883
|
toolName: e.toolName,
|
|
4867
4884
|
toolCallId: e.toolCallId,
|
|
4868
4885
|
state: e.state,
|
|
4869
|
-
input:
|
|
4870
|
-
output:
|
|
4871
|
-
errorText:
|
|
4872
|
-
preliminary:
|
|
4873
|
-
providerExecuted:
|
|
4886
|
+
input: i.input,
|
|
4887
|
+
output: i.output,
|
|
4888
|
+
errorText: i.errorText,
|
|
4889
|
+
preliminary: i.preliminary,
|
|
4890
|
+
providerExecuted: i.providerExecuted,
|
|
4874
4891
|
title: e.title,
|
|
4875
4892
|
...e.toolMetadata === void 0 ? {} : { toolMetadata: e.toolMetadata },
|
|
4876
|
-
...
|
|
4877
|
-
...
|
|
4893
|
+
...i.providerMetadata != null && (e.state === "output-available" || e.state === "output-error") ? { resultProviderMetadata: i.providerMetadata } : {},
|
|
4894
|
+
...i.providerMetadata != null && !(e.state === "output-available" || e.state === "output-error") ? { callProviderMetadata: i.providerMetadata } : {}
|
|
4878
4895
|
});
|
|
4879
4896
|
}
|
|
4880
|
-
async function
|
|
4897
|
+
async function h(e) {
|
|
4881
4898
|
if (e != null) {
|
|
4882
|
-
let n = r.message.metadata == null ? e :
|
|
4899
|
+
let n = r.message.metadata == null ? e : Br(r.message.metadata, e);
|
|
4883
4900
|
t != null && await Cr({
|
|
4884
4901
|
value: n,
|
|
4885
4902
|
schema: t,
|
|
@@ -4989,7 +5006,7 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
4989
5006
|
}), c();
|
|
4990
5007
|
break;
|
|
4991
5008
|
case "tool-input-start": {
|
|
4992
|
-
let t =
|
|
5009
|
+
let t = l().filter(mi);
|
|
4993
5010
|
r.partialToolCalls[e.toolCallId] = {
|
|
4994
5011
|
text: "",
|
|
4995
5012
|
toolName: e.toolName,
|
|
@@ -4997,7 +5014,7 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
4997
5014
|
dynamic: e.dynamic,
|
|
4998
5015
|
title: e.title,
|
|
4999
5016
|
toolMetadata: e.toolMetadata
|
|
5000
|
-
}, e.dynamic ?
|
|
5017
|
+
}, e.dynamic ? m({
|
|
5001
5018
|
toolCallId: e.toolCallId,
|
|
5002
5019
|
toolName: e.toolName,
|
|
5003
5020
|
state: "input-streaming",
|
|
@@ -5006,7 +5023,7 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5006
5023
|
title: e.title,
|
|
5007
5024
|
toolMetadata: e.toolMetadata,
|
|
5008
5025
|
providerMetadata: e.providerMetadata
|
|
5009
|
-
}) :
|
|
5026
|
+
}) : p({
|
|
5010
5027
|
toolCallId: e.toolCallId,
|
|
5011
5028
|
toolName: e.toolName,
|
|
5012
5029
|
state: "input-streaming",
|
|
@@ -5027,14 +5044,14 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5027
5044
|
});
|
|
5028
5045
|
t.text += e.inputTextDelta;
|
|
5029
5046
|
let { value: n } = await ii(t.text);
|
|
5030
|
-
t.dynamic ?
|
|
5047
|
+
t.dynamic ? m({
|
|
5031
5048
|
toolCallId: e.toolCallId,
|
|
5032
5049
|
toolName: t.toolName,
|
|
5033
5050
|
state: "input-streaming",
|
|
5034
5051
|
input: n,
|
|
5035
5052
|
title: t.title,
|
|
5036
5053
|
toolMetadata: t.toolMetadata
|
|
5037
|
-
}) :
|
|
5054
|
+
}) : p({
|
|
5038
5055
|
toolCallId: e.toolCallId,
|
|
5039
5056
|
toolName: t.toolName,
|
|
5040
5057
|
state: "input-streaming",
|
|
@@ -5045,7 +5062,7 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5045
5062
|
break;
|
|
5046
5063
|
}
|
|
5047
5064
|
case "tool-input-available":
|
|
5048
|
-
e.dynamic ?
|
|
5065
|
+
e.dynamic ? m({
|
|
5049
5066
|
toolCallId: e.toolCallId,
|
|
5050
5067
|
toolName: e.toolName,
|
|
5051
5068
|
state: "input-available",
|
|
@@ -5054,7 +5071,7 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5054
5071
|
providerMetadata: e.providerMetadata,
|
|
5055
5072
|
title: e.title,
|
|
5056
5073
|
toolMetadata: e.toolMetadata
|
|
5057
|
-
}) :
|
|
5074
|
+
}) : p({
|
|
5058
5075
|
toolCallId: e.toolCallId,
|
|
5059
5076
|
toolName: e.toolName,
|
|
5060
5077
|
state: "input-available",
|
|
@@ -5066,8 +5083,8 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5066
5083
|
}), c(), a && !e.providerExecuted && await a({ toolCall: e });
|
|
5067
5084
|
break;
|
|
5068
5085
|
case "tool-input-error": {
|
|
5069
|
-
let t =
|
|
5070
|
-
(t == null ? e.dynamic : t.type === "dynamic-tool") ?
|
|
5086
|
+
let t = l().filter(gi).find((t) => t.toolCallId === e.toolCallId);
|
|
5087
|
+
(t == null ? e.dynamic : t.type === "dynamic-tool") ? m({
|
|
5071
5088
|
toolCallId: e.toolCallId,
|
|
5072
5089
|
toolName: e.toolName,
|
|
5073
5090
|
state: "output-error",
|
|
@@ -5076,7 +5093,7 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5076
5093
|
providerExecuted: e.providerExecuted,
|
|
5077
5094
|
providerMetadata: e.providerMetadata,
|
|
5078
5095
|
toolMetadata: e.toolMetadata
|
|
5079
|
-
}) :
|
|
5096
|
+
}) : p({
|
|
5080
5097
|
toolCallId: e.toolCallId,
|
|
5081
5098
|
toolName: e.toolName,
|
|
5082
5099
|
state: "output-error",
|
|
@@ -5090,7 +5107,7 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5090
5107
|
break;
|
|
5091
5108
|
}
|
|
5092
5109
|
case "tool-approval-request": {
|
|
5093
|
-
let t =
|
|
5110
|
+
let t = d(e.toolCallId);
|
|
5094
5111
|
t.state = "approval-requested", t.approval = {
|
|
5095
5112
|
id: e.approvalId,
|
|
5096
5113
|
...e.isAutomatic === !0 ? { isAutomatic: !0 } : {},
|
|
@@ -5099,7 +5116,7 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5099
5116
|
break;
|
|
5100
5117
|
}
|
|
5101
5118
|
case "tool-approval-response": {
|
|
5102
|
-
let t =
|
|
5119
|
+
let t = f(e.approvalId), n = t.approval == null ? { id: e.approvalId } : t.approval;
|
|
5103
5120
|
t.state = "approval-responded", t.approval = {
|
|
5104
5121
|
id: e.approvalId,
|
|
5105
5122
|
approved: e.approved,
|
|
@@ -5110,13 +5127,13 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5110
5127
|
break;
|
|
5111
5128
|
}
|
|
5112
5129
|
case "tool-output-denied": {
|
|
5113
|
-
let t =
|
|
5130
|
+
let t = d(e.toolCallId);
|
|
5114
5131
|
t.state = "output-denied", c();
|
|
5115
5132
|
break;
|
|
5116
5133
|
}
|
|
5117
5134
|
case "tool-output-available": {
|
|
5118
|
-
let t =
|
|
5119
|
-
t.type === "dynamic-tool" ?
|
|
5135
|
+
let t = d(e.toolCallId);
|
|
5136
|
+
t.type === "dynamic-tool" ? m({
|
|
5120
5137
|
toolCallId: e.toolCallId,
|
|
5121
5138
|
toolName: t.toolName,
|
|
5122
5139
|
state: "output-available",
|
|
@@ -5127,7 +5144,7 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5127
5144
|
providerMetadata: e.providerMetadata,
|
|
5128
5145
|
title: t.title,
|
|
5129
5146
|
toolMetadata: t.toolMetadata
|
|
5130
|
-
}) :
|
|
5147
|
+
}, t) : p({
|
|
5131
5148
|
toolCallId: e.toolCallId,
|
|
5132
5149
|
toolName: _i(t),
|
|
5133
5150
|
state: "output-available",
|
|
@@ -5138,12 +5155,12 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5138
5155
|
providerMetadata: e.providerMetadata,
|
|
5139
5156
|
title: t.title,
|
|
5140
5157
|
toolMetadata: t.toolMetadata
|
|
5141
|
-
}), c();
|
|
5158
|
+
}, t), c();
|
|
5142
5159
|
break;
|
|
5143
5160
|
}
|
|
5144
5161
|
case "tool-output-error": {
|
|
5145
|
-
let t =
|
|
5146
|
-
t.type === "dynamic-tool" ?
|
|
5162
|
+
let t = d(e.toolCallId);
|
|
5163
|
+
t.type === "dynamic-tool" ? m({
|
|
5147
5164
|
toolCallId: e.toolCallId,
|
|
5148
5165
|
toolName: t.toolName,
|
|
5149
5166
|
state: "output-error",
|
|
@@ -5153,7 +5170,7 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5153
5170
|
providerMetadata: e.providerMetadata,
|
|
5154
5171
|
title: t.title,
|
|
5155
5172
|
toolMetadata: t.toolMetadata
|
|
5156
|
-
}) :
|
|
5173
|
+
}, t) : p({
|
|
5157
5174
|
toolCallId: e.toolCallId,
|
|
5158
5175
|
toolName: _i(t),
|
|
5159
5176
|
state: "output-error",
|
|
@@ -5164,7 +5181,7 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5164
5181
|
providerMetadata: e.providerMetadata,
|
|
5165
5182
|
title: t.title,
|
|
5166
5183
|
toolMetadata: t.toolMetadata
|
|
5167
|
-
}), c();
|
|
5184
|
+
}, t), c();
|
|
5168
5185
|
break;
|
|
5169
5186
|
}
|
|
5170
5187
|
case "start-step":
|
|
@@ -5174,13 +5191,13 @@ function yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
5174
5191
|
r.activeTextParts = pi(), r.activeReasoningParts = pi();
|
|
5175
5192
|
break;
|
|
5176
5193
|
case "start":
|
|
5177
|
-
e.messageId != null && (r.message.id = e.messageId), await
|
|
5194
|
+
e.messageId != null && (r.message.id = e.messageId), await h(e.messageMetadata), (e.messageId != null || e.messageMetadata != null) && c();
|
|
5178
5195
|
break;
|
|
5179
5196
|
case "finish":
|
|
5180
|
-
e.finishReason != null && (r.finishReason = e.finishReason), await
|
|
5197
|
+
e.finishReason != null && (r.finishReason = e.finishReason), await h(e.messageMetadata), e.messageMetadata != null && c();
|
|
5181
5198
|
break;
|
|
5182
5199
|
case "message-metadata":
|
|
5183
|
-
await
|
|
5200
|
+
await h(e.messageMetadata), e.messageMetadata != null && c();
|
|
5184
5201
|
break;
|
|
5185
5202
|
case "error":
|
|
5186
5203
|
i?.(Error(e.errorText));
|
|
@@ -5236,7 +5253,7 @@ K({
|
|
|
5236
5253
|
}), K({
|
|
5237
5254
|
prefix: "call",
|
|
5238
5255
|
size: 24
|
|
5239
|
-
}),
|
|
5256
|
+
}), t(h(), Vr.optional()), t(h(), h()), K({
|
|
5240
5257
|
prefix: "call",
|
|
5241
5258
|
size: 24
|
|
5242
5259
|
}), K({
|
|
@@ -5852,10 +5869,10 @@ function qi() {
|
|
|
5852
5869
|
if (!ae()) return console.error("useSWRV must be called inside setup() or an active effectScope()."), null;
|
|
5853
5870
|
var c = typeof window > "u" || typeof document > "u";
|
|
5854
5871
|
t.length >= 1 && (r = t[0]), t.length >= 2 && (i = t[1]), t.length > 2 && (a = $($({}, a), t[2]));
|
|
5855
|
-
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r :
|
|
5872
|
+
var l = c ? a.serverTTL : a.ttl, u = typeof r == "function" ? r : w(r);
|
|
5856
5873
|
i === void 0 && (i = a.fetcher);
|
|
5857
5874
|
var d = null;
|
|
5858
|
-
d ||=
|
|
5875
|
+
d ||= se({
|
|
5859
5876
|
data: void 0,
|
|
5860
5877
|
error: void 0,
|
|
5861
5878
|
isValidating: !0,
|
|
@@ -5925,7 +5942,7 @@ function qi() {
|
|
|
5925
5942
|
};
|
|
5926
5943
|
a.refreshInterval && (m = setTimeout(h, a.refreshInterval)), a.revalidateOnFocus && (document.addEventListener("visibilitychange", p, !1), window.addEventListener("focus", p, !1));
|
|
5927
5944
|
}
|
|
5928
|
-
|
|
5945
|
+
C(function() {
|
|
5929
5946
|
o = !0, m &&= (clearTimeout(m), null), !c && a.revalidateOnFocus && (document.removeEventListener("visibilitychange", p, !1), window.removeEventListener("focus", p, !1));
|
|
5930
5947
|
var e = Bi.get(u.value);
|
|
5931
5948
|
e && (e.data = e.data.filter(function(e) {
|
|
@@ -5933,11 +5950,11 @@ function qi() {
|
|
|
5933
5950
|
}));
|
|
5934
5951
|
});
|
|
5935
5952
|
try {
|
|
5936
|
-
|
|
5953
|
+
le(u, function(e) {
|
|
5937
5954
|
oe(u) || (u.value = e), d.key = e, d.isValidating = !!e, Ui(u.value, d, l), !c && !s && u.value && f(), s = !1;
|
|
5938
5955
|
}, { immediate: !0 });
|
|
5939
5956
|
} catch {}
|
|
5940
|
-
return $($({},
|
|
5957
|
+
return $($({}, ce(d)), { mutate: function(e, t) {
|
|
5941
5958
|
return f(e, $($({}, t), { forceRevalidate: !0 }));
|
|
5942
5959
|
} });
|
|
5943
5960
|
}
|
|
@@ -5950,13 +5967,13 @@ var Yi = qi;
|
|
|
5950
5967
|
Yi.default, Yi.default;
|
|
5951
5968
|
var Xi = class {
|
|
5952
5969
|
constructor(e) {
|
|
5953
|
-
this.statusRef =
|
|
5970
|
+
this.statusRef = w("ready"), this.errorRef = w(void 0), this.pushMessage = (e) => {
|
|
5954
5971
|
this.messagesRef.value = [...this.messagesRef.value, e];
|
|
5955
5972
|
}, this.popMessage = () => {
|
|
5956
5973
|
this.messagesRef.value = this.messagesRef.value.slice(0, -1);
|
|
5957
5974
|
}, this.replaceMessage = (e, t) => {
|
|
5958
5975
|
this.messagesRef.value[e] = { ...t };
|
|
5959
|
-
}, this.snapshot = (e) => e, this.messagesRef =
|
|
5976
|
+
}, this.snapshot = (e) => e, this.messagesRef = w(e ?? []);
|
|
5960
5977
|
}
|
|
5961
5978
|
get messages() {
|
|
5962
5979
|
return this.messagesRef.value;
|
|
@@ -5987,25 +6004,25 @@ var Xi = class {
|
|
|
5987
6004
|
//#endregion
|
|
5988
6005
|
//#region ../../packages/composable/src/chatbot/useChatbotStore.ts
|
|
5989
6006
|
function Qi(e) {
|
|
5990
|
-
return
|
|
5991
|
-
let { t, te: n, locale: r } =
|
|
6007
|
+
return T(`chatbot-${e}`, () => {
|
|
6008
|
+
let { t, te: n, locale: r } = de({ useScope: "global" }), i = w(""), a = w(), o = w(e), s = w(), c = w(), l = w(), u = w(), d = w(), f = w(), p = w(), m = w(), h = w(), ee = w(), g = w(), _ = w(), v = w(), y = w(), b = w(), x = w(!1), ae = fe(), oe = S(() => {
|
|
5992
6009
|
let e = u.value?.theme;
|
|
5993
6010
|
return (!e || e === "auto") && (e = b.value), e ? e === "dark" : ae.value;
|
|
5994
|
-
}),
|
|
6011
|
+
}), C = S(() => c.value === "reasoning"), se = S(() => C.value ? ee.value?.filter((e) => ![
|
|
5995
6012
|
"upvote",
|
|
5996
6013
|
"downvote",
|
|
5997
6014
|
"feedback"
|
|
5998
|
-
].includes(e)) : ee.value),
|
|
5999
|
-
|
|
6000
|
-
|
|
6015
|
+
].includes(e)) : ee.value), ce = ie(S(() => `${o.value}-chatId`), null);
|
|
6016
|
+
ue(() => {
|
|
6017
|
+
ce.value ||= sn();
|
|
6001
6018
|
});
|
|
6002
|
-
let
|
|
6003
|
-
get: () =>
|
|
6019
|
+
let T = S({
|
|
6020
|
+
get: () => ce.value,
|
|
6004
6021
|
set: (e) => {
|
|
6005
|
-
|
|
6022
|
+
ce.value = e;
|
|
6006
6023
|
}
|
|
6007
|
-
}),
|
|
6008
|
-
function
|
|
6024
|
+
}), he = w(), ge = w(!1), _e = S(() => he.value?.message?.toLowerCase().includes("conversation-blocked") ?? !1);
|
|
6025
|
+
function ve(e) {
|
|
6009
6026
|
try {
|
|
6010
6027
|
let t = JSON.parse(e.message);
|
|
6011
6028
|
return t.status === 404 || t.type?.includes("entity-not-found");
|
|
@@ -6013,22 +6030,22 @@ function Qi(e) {
|
|
|
6013
6030
|
return !1;
|
|
6014
6031
|
}
|
|
6015
6032
|
}
|
|
6016
|
-
function
|
|
6017
|
-
if (
|
|
6018
|
-
let e =
|
|
6019
|
-
|
|
6033
|
+
function E(e) {
|
|
6034
|
+
if (ve(e)) {
|
|
6035
|
+
let e = O.value.messages.filter((e) => e.role === "user"), t = e[e.length - 1], n = t ? re(t) : void 0;
|
|
6036
|
+
T.value = sn(), O.value.clearError(), he.value = void 0, n && O.value.sendMessage({ text: n });
|
|
6020
6037
|
return;
|
|
6021
6038
|
}
|
|
6022
|
-
ne.error(e),
|
|
6039
|
+
ne.error(e), he.value = e, _e.value && (ge.value = !0);
|
|
6023
6040
|
}
|
|
6024
|
-
let
|
|
6041
|
+
let D = S(() => te({
|
|
6025
6042
|
baseUrl: i.value,
|
|
6026
6043
|
basePath: a.value,
|
|
6027
6044
|
headers: () => p.value
|
|
6028
|
-
})),
|
|
6029
|
-
id:
|
|
6045
|
+
})), ye = w(null), O = S(() => new Zi({
|
|
6046
|
+
id: T.value,
|
|
6030
6047
|
transport: new wi({
|
|
6031
|
-
api:
|
|
6048
|
+
api: D.value.getChatEndpoint(o.value, C.value ? "reasoning" : "chat"),
|
|
6032
6049
|
prepareSendMessagesRequest: ({ messages: e, id: t }) => ({ body: {
|
|
6033
6050
|
id: t,
|
|
6034
6051
|
messages: [e[e.length - 1]],
|
|
@@ -6044,8 +6061,8 @@ function Qi(e) {
|
|
|
6044
6061
|
webSearch: f.value?.webSearch,
|
|
6045
6062
|
smoothStream: u.value?.smoothStream,
|
|
6046
6063
|
deviceContext: {
|
|
6047
|
-
...
|
|
6048
|
-
...
|
|
6064
|
+
...pe(),
|
|
6065
|
+
...ye.value ?? {}
|
|
6049
6066
|
},
|
|
6050
6067
|
externalContext: y.value,
|
|
6051
6068
|
disabledTools: f.value?.disabled,
|
|
@@ -6059,22 +6076,22 @@ function Qi(e) {
|
|
|
6059
6076
|
ne.log("Tool call:", e);
|
|
6060
6077
|
},
|
|
6061
6078
|
sendAutomaticallyWhen: Ei,
|
|
6062
|
-
onError:
|
|
6079
|
+
onError: E,
|
|
6063
6080
|
onFinish: () => {
|
|
6064
|
-
let e =
|
|
6065
|
-
!
|
|
6081
|
+
let e = T.value;
|
|
6082
|
+
!C.value && !k.value.some((t) => t.id === e) && I(o.value);
|
|
6066
6083
|
}
|
|
6067
|
-
})),
|
|
6084
|
+
})), be = S(() => {
|
|
6068
6085
|
let e = u.value?.initialMessage;
|
|
6069
6086
|
return e?.[r.value] ? e[r.value] : n("message.defaultAgentWelcome") ? t("message.defaultAgentWelcome") : "";
|
|
6070
|
-
}),
|
|
6071
|
-
id:
|
|
6087
|
+
}), xe = sn(), Se = S(() => ({
|
|
6088
|
+
id: xe,
|
|
6072
6089
|
role: "assistant",
|
|
6073
6090
|
parts: [{
|
|
6074
6091
|
type: "text",
|
|
6075
|
-
text:
|
|
6092
|
+
text: be.value
|
|
6076
6093
|
}]
|
|
6077
|
-
})),
|
|
6094
|
+
})), Ce = S(() => {
|
|
6078
6095
|
let e = (e) => e.map((e) => e.role !== "user" || !e.parts.some((e) => e.type === "file") ? e : {
|
|
6079
6096
|
...e,
|
|
6080
6097
|
parts: e.parts.map((e) => {
|
|
@@ -6084,160 +6101,160 @@ function Qi(e) {
|
|
|
6084
6101
|
let e = t.url.slice(13);
|
|
6085
6102
|
return {
|
|
6086
6103
|
...t,
|
|
6087
|
-
url:
|
|
6104
|
+
url: D.value.getMediaUrl(o.value, T.value, e)
|
|
6088
6105
|
};
|
|
6089
6106
|
}
|
|
6090
6107
|
return t.url.startsWith("blob:") ? t : {
|
|
6091
6108
|
...t,
|
|
6092
|
-
url:
|
|
6109
|
+
url: D.value.appendAuthToken(t.url)
|
|
6093
6110
|
};
|
|
6094
6111
|
})
|
|
6095
6112
|
});
|
|
6096
|
-
return
|
|
6097
|
-
}),
|
|
6113
|
+
return C.value ? e(O.value.messages) : !x.value && O.value.messages?.[0]?.role !== "assistant" ? [Se.value, ...e(O.value.messages)] : e(O.value.messages);
|
|
6114
|
+
}), we = S(() => {
|
|
6098
6115
|
let e = u.value?.messagePlaceholder;
|
|
6099
6116
|
return e?.[r.value] ? e[r.value] : n("placeholder.askAnything") ? t("placeholder.askAnything") : "";
|
|
6100
|
-
}),
|
|
6101
|
-
async function
|
|
6102
|
-
if (
|
|
6103
|
-
|
|
6117
|
+
}), k = w([]), Te = w(!1), A = w([]), Ee = w(!1), De = w("chat"), j = w([]), Oe = w(), ke = w(!1), Ae = w(!1), je = w(), M = w(!1), Me = w(!1), Ne = w(), Pe = w(""), N = w([]), P = w(""), F = w(0);
|
|
6118
|
+
async function I(e) {
|
|
6119
|
+
if (C.value) {
|
|
6120
|
+
k.value = [];
|
|
6104
6121
|
return;
|
|
6105
6122
|
}
|
|
6106
|
-
|
|
6123
|
+
Te.value = !0;
|
|
6107
6124
|
try {
|
|
6108
|
-
|
|
6125
|
+
k.value = await D.value.getConversations(e, l.value);
|
|
6109
6126
|
} catch {
|
|
6110
|
-
|
|
6127
|
+
k.value = [];
|
|
6111
6128
|
} finally {
|
|
6112
|
-
|
|
6129
|
+
Te.value = !1;
|
|
6113
6130
|
}
|
|
6114
6131
|
}
|
|
6115
|
-
async function
|
|
6116
|
-
let e =
|
|
6132
|
+
async function Fe() {
|
|
6133
|
+
let e = T.value;
|
|
6117
6134
|
if (!e) {
|
|
6118
|
-
|
|
6135
|
+
A.value = [];
|
|
6119
6136
|
return;
|
|
6120
6137
|
}
|
|
6121
|
-
|
|
6138
|
+
Ee.value = !0;
|
|
6122
6139
|
try {
|
|
6123
|
-
|
|
6140
|
+
A.value = await D.value.getChatFiles(e);
|
|
6124
6141
|
} catch {
|
|
6125
|
-
|
|
6142
|
+
A.value = [];
|
|
6126
6143
|
} finally {
|
|
6127
|
-
|
|
6144
|
+
Ee.value = !1;
|
|
6128
6145
|
}
|
|
6129
6146
|
}
|
|
6130
|
-
function
|
|
6131
|
-
return
|
|
6147
|
+
function L(e, t = !1) {
|
|
6148
|
+
return D.value.getChatFileDownloadUrl(e, t);
|
|
6132
6149
|
}
|
|
6133
|
-
function
|
|
6134
|
-
return
|
|
6150
|
+
function Ie(e) {
|
|
6151
|
+
return D.value.getChatFilePreviewUrl(e);
|
|
6135
6152
|
}
|
|
6136
|
-
async function
|
|
6137
|
-
await
|
|
6153
|
+
async function Le(e) {
|
|
6154
|
+
await D.value.deleteChatFile(e), A.value = A.value.filter((t) => t.documentId !== e);
|
|
6138
6155
|
}
|
|
6139
|
-
async function
|
|
6140
|
-
if (!
|
|
6141
|
-
let n = await
|
|
6142
|
-
if (t !==
|
|
6143
|
-
n && (
|
|
6156
|
+
async function Re(e, t) {
|
|
6157
|
+
if (!C.value) try {
|
|
6158
|
+
let n = await D.value.getChat(e, t);
|
|
6159
|
+
if (t !== T.value || O.value.status !== "ready" || O.value.messages.length > 0) return;
|
|
6160
|
+
n && (O.value.messages = n.messages, ge.value = n.blocked ?? !1);
|
|
6144
6161
|
} catch {}
|
|
6145
6162
|
}
|
|
6146
|
-
async function
|
|
6163
|
+
async function ze(e) {
|
|
6147
6164
|
try {
|
|
6148
|
-
|
|
6165
|
+
j.value = await D.value.getMessageFeedbacks(e);
|
|
6149
6166
|
} catch {
|
|
6150
|
-
|
|
6167
|
+
j.value = [];
|
|
6151
6168
|
}
|
|
6152
6169
|
}
|
|
6153
|
-
function
|
|
6154
|
-
let t =
|
|
6155
|
-
t >= 0 ?
|
|
6170
|
+
function R(e) {
|
|
6171
|
+
let t = j.value.findIndex((t) => t.messageId === e.messageId);
|
|
6172
|
+
t >= 0 ? j.value[t] = e : j.value.push(e);
|
|
6156
6173
|
}
|
|
6157
|
-
function
|
|
6158
|
-
let t =
|
|
6174
|
+
function z(e) {
|
|
6175
|
+
let t = Ce.value, n = t.findIndex((t) => t.id === e.id), r = re(e) ?? "";
|
|
6159
6176
|
return {
|
|
6160
6177
|
userQuestion: re(t.slice(0, n).reverse().find((e) => e.role === "user") ?? e) ?? "",
|
|
6161
6178
|
assistantMessage: r
|
|
6162
6179
|
};
|
|
6163
6180
|
}
|
|
6164
|
-
async function
|
|
6181
|
+
async function Be(e, t) {
|
|
6165
6182
|
await Promise.all([
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
]),
|
|
6170
|
-
e && (
|
|
6183
|
+
Re(e, t),
|
|
6184
|
+
I(e),
|
|
6185
|
+
ze(t)
|
|
6186
|
+
]), ye.value || me((e, t) => D.value.reverseGeocode(e, t, r.value)).then((e) => {
|
|
6187
|
+
e && (ye.value = e);
|
|
6171
6188
|
});
|
|
6172
6189
|
}
|
|
6173
|
-
async function
|
|
6174
|
-
let e =
|
|
6190
|
+
async function B() {
|
|
6191
|
+
let e = Pe.value.trim(), t = N.value.filter((e) => e.state === "done" && e.mediaSource !== void 0).map((e) => ({
|
|
6175
6192
|
type: "file",
|
|
6176
6193
|
mediaType: e.mediaSource.mimeType,
|
|
6177
6194
|
url: e.localUrl,
|
|
6178
6195
|
filename: e.mediaSource.name,
|
|
6179
6196
|
providerMetadata: { "8bot": { media: e.mediaSource } }
|
|
6180
6197
|
}));
|
|
6181
|
-
|
|
6182
|
-
let n =
|
|
6198
|
+
C.value && Ce.value.length > 0 && await Ue(), P.value = e, F.value = O.value.messages.length;
|
|
6199
|
+
let n = O.value.sendMessage;
|
|
6183
6200
|
n({
|
|
6184
6201
|
text: e,
|
|
6185
6202
|
files: t.length > 0 ? t : void 0
|
|
6186
|
-
}),
|
|
6203
|
+
}), Pe.value = "", He();
|
|
6187
6204
|
}
|
|
6188
|
-
function
|
|
6205
|
+
function V(e) {
|
|
6189
6206
|
let t = e.trim();
|
|
6190
6207
|
if (!t) return;
|
|
6191
|
-
if (
|
|
6208
|
+
if (O.value.status !== "ready") {
|
|
6192
6209
|
ne.warn("[useChatbotStore] sendMessage called before chat is ready. Listen for the \"ready\" event on the widget element.");
|
|
6193
6210
|
return;
|
|
6194
6211
|
}
|
|
6195
|
-
let n =
|
|
6212
|
+
let n = O.value.sendMessage;
|
|
6196
6213
|
n({ text: t });
|
|
6197
6214
|
}
|
|
6198
|
-
async function
|
|
6199
|
-
let e =
|
|
6200
|
-
await
|
|
6215
|
+
async function Ve() {
|
|
6216
|
+
let e = P.value.length > 0;
|
|
6217
|
+
await O.value.stop(), e && (Pe.value = P.value, O.value.messages = O.value.messages.slice(0, F.value), P.value = "");
|
|
6201
6218
|
}
|
|
6202
|
-
|
|
6203
|
-
e === "ready" &&
|
|
6219
|
+
le(() => O.value.status, (e) => {
|
|
6220
|
+
e === "ready" && P.value.length > 0 && (P.value = "");
|
|
6204
6221
|
});
|
|
6205
|
-
function
|
|
6206
|
-
for (let t of
|
|
6207
|
-
|
|
6222
|
+
function He(e = !1) {
|
|
6223
|
+
for (let t of N.value) (e || t.state !== "done") && URL.revokeObjectURL(t.localUrl);
|
|
6224
|
+
N.value = [], Ze.value = null;
|
|
6208
6225
|
}
|
|
6209
|
-
async function
|
|
6210
|
-
return
|
|
6226
|
+
async function Ue() {
|
|
6227
|
+
return P.value = "", await Ve(), T.value = sn(), O.value.clearError(), he.value = void 0, ge.value = !1, He(!0), ct("chat"), T.value;
|
|
6211
6228
|
}
|
|
6212
|
-
async function
|
|
6213
|
-
|
|
6229
|
+
async function We(e) {
|
|
6230
|
+
O.value.status !== "ready" && (P.value = "", await Ve()), await O.value.regenerate(e);
|
|
6214
6231
|
}
|
|
6215
|
-
function
|
|
6232
|
+
function Ge(e) {
|
|
6216
6233
|
if (e.tool === "requestGeolocation") {
|
|
6217
6234
|
let t = e.output;
|
|
6218
|
-
"latitude" in t && (
|
|
6235
|
+
"latitude" in t && (ye.value = {
|
|
6219
6236
|
geolocationLatitude: t.latitude,
|
|
6220
6237
|
geolocationLongitude: t.longitude,
|
|
6221
6238
|
geolocationAccuracy: t.accuracy,
|
|
6222
6239
|
geolocationCity: t.city
|
|
6223
6240
|
});
|
|
6224
6241
|
}
|
|
6225
|
-
|
|
6242
|
+
O.value.addToolOutput(e);
|
|
6226
6243
|
}
|
|
6227
|
-
let
|
|
6228
|
-
|
|
6244
|
+
let Ke = S(() => O.value.messages.reduce((e, t) => e + t.parts.filter((e) => e.type === "file").length, 0)), qe = S(() => g.value?.maxFilesPerMessage ?? 5), Je = S(() => g.value?.maxFilesPerChat ?? 20), Ye = S(() => Math.max(0, Math.min(qe.value - N.value.length, Je.value - Ke.value - N.value.length))), Xe = S(() => Ye.value <= 0), Ze = w(null), Qe = () => {
|
|
6245
|
+
Ze.value = null;
|
|
6229
6246
|
};
|
|
6230
|
-
|
|
6231
|
-
e || (
|
|
6247
|
+
le(Xe, (e) => {
|
|
6248
|
+
e || (Ze.value = null);
|
|
6232
6249
|
});
|
|
6233
|
-
async function
|
|
6234
|
-
if (
|
|
6235
|
-
|
|
6250
|
+
async function $e(e) {
|
|
6251
|
+
if (Xe.value) {
|
|
6252
|
+
Ze.value = Je.value - Ke.value - N.value.length <= qe.value - N.value.length ? {
|
|
6236
6253
|
reason: "per-chat",
|
|
6237
|
-
max:
|
|
6254
|
+
max: Je.value
|
|
6238
6255
|
} : {
|
|
6239
6256
|
reason: "per-message",
|
|
6240
|
-
max:
|
|
6257
|
+
max: qe.value
|
|
6241
6258
|
};
|
|
6242
6259
|
return;
|
|
6243
6260
|
}
|
|
@@ -6247,89 +6264,106 @@ function Qi(e) {
|
|
|
6247
6264
|
localUrl: URL.createObjectURL(e),
|
|
6248
6265
|
state: "uploading"
|
|
6249
6266
|
};
|
|
6250
|
-
|
|
6267
|
+
N.value = [...N.value, n];
|
|
6251
6268
|
try {
|
|
6252
|
-
let n = await
|
|
6253
|
-
|
|
6269
|
+
let n = await D.value.uploadMedia(o.value, T.value, e);
|
|
6270
|
+
N.value = N.value.map((e) => e.id === t ? {
|
|
6254
6271
|
...e,
|
|
6255
6272
|
state: "done",
|
|
6256
6273
|
mediaSource: n
|
|
6257
6274
|
} : e);
|
|
6258
6275
|
} catch (e) {
|
|
6259
6276
|
let n = e instanceof Error ? e.message : "Upload failed";
|
|
6260
|
-
|
|
6277
|
+
N.value = N.value.map((e) => e.id === t ? {
|
|
6261
6278
|
...e,
|
|
6262
6279
|
state: "error",
|
|
6263
6280
|
error: n
|
|
6264
6281
|
} : e);
|
|
6265
6282
|
}
|
|
6266
6283
|
}
|
|
6267
|
-
async function
|
|
6268
|
-
let { userQuestion: n, assistantMessage: r } =
|
|
6269
|
-
|
|
6284
|
+
async function et(e, t) {
|
|
6285
|
+
let { userQuestion: n, assistantMessage: r } = z(e);
|
|
6286
|
+
R(await D.value.submitMessageFeedback({
|
|
6270
6287
|
messageId: e.id,
|
|
6271
|
-
chatId:
|
|
6288
|
+
chatId: T.value,
|
|
6272
6289
|
agentId: o.value,
|
|
6273
6290
|
vote: t,
|
|
6274
6291
|
userQuestion: n,
|
|
6275
6292
|
assistantMessage: r
|
|
6276
6293
|
}));
|
|
6277
6294
|
}
|
|
6278
|
-
async function
|
|
6279
|
-
await
|
|
6295
|
+
async function tt(e) {
|
|
6296
|
+
await et(e, "upvote");
|
|
6280
6297
|
}
|
|
6281
|
-
async function
|
|
6282
|
-
await
|
|
6298
|
+
async function nt(e) {
|
|
6299
|
+
await et(e, "downvote");
|
|
6283
6300
|
}
|
|
6284
|
-
function
|
|
6285
|
-
|
|
6301
|
+
function rt(e) {
|
|
6302
|
+
Ae.value = !1, je.value = void 0, Oe.value = e;
|
|
6286
6303
|
}
|
|
6287
|
-
async function
|
|
6288
|
-
if (
|
|
6289
|
-
|
|
6290
|
-
let { userQuestion: t, assistantMessage: n } =
|
|
6291
|
-
|
|
6292
|
-
messageId:
|
|
6293
|
-
chatId:
|
|
6304
|
+
async function it(e) {
|
|
6305
|
+
if (Oe.value) try {
|
|
6306
|
+
ke.value = !0, Ae.value = !1, je.value = void 0;
|
|
6307
|
+
let { userQuestion: t, assistantMessage: n } = z(Oe.value);
|
|
6308
|
+
R(await D.value.submitMessageFeedback({
|
|
6309
|
+
messageId: Oe.value.id,
|
|
6310
|
+
chatId: T.value,
|
|
6294
6311
|
agentId: o.value,
|
|
6295
6312
|
userQuestion: t,
|
|
6296
6313
|
assistantMessage: n,
|
|
6297
6314
|
comment: e
|
|
6298
|
-
})),
|
|
6315
|
+
})), Ae.value = !0, await ze(T.value);
|
|
6299
6316
|
} catch {
|
|
6300
|
-
|
|
6317
|
+
je.value = n("message.feedbackSubmitError") ? t("message.feedbackSubmitError") : "Failed to submit feedback";
|
|
6301
6318
|
} finally {
|
|
6302
|
-
|
|
6319
|
+
ke.value = !1;
|
|
6303
6320
|
}
|
|
6304
6321
|
}
|
|
6305
|
-
async function
|
|
6322
|
+
async function at(e) {
|
|
6306
6323
|
try {
|
|
6307
|
-
|
|
6324
|
+
Me.value = !0, M.value = !1, Ne.value = void 0, await D.value.submitLead({
|
|
6308
6325
|
agentId: o.value,
|
|
6309
|
-
chatId:
|
|
6326
|
+
chatId: T.value,
|
|
6310
6327
|
...e
|
|
6311
|
-
}),
|
|
6328
|
+
}), M.value = !0;
|
|
6312
6329
|
} catch {
|
|
6313
|
-
|
|
6330
|
+
Ne.value = n("message.leadSubmitError") ? t("message.leadSubmitError") : "Failed to submit lead";
|
|
6314
6331
|
} finally {
|
|
6315
|
-
|
|
6332
|
+
Me.value = !1;
|
|
6316
6333
|
}
|
|
6317
6334
|
}
|
|
6318
|
-
async function
|
|
6319
|
-
let n = await
|
|
6320
|
-
|
|
6335
|
+
async function ot(e, t) {
|
|
6336
|
+
let n = await D.value.updateChatTitle(o.value, e, t);
|
|
6337
|
+
k.value = k.value.map((t) => t.id === e ? {
|
|
6321
6338
|
...t,
|
|
6322
6339
|
title: n.title
|
|
6323
6340
|
} : t);
|
|
6324
6341
|
}
|
|
6325
|
-
async function
|
|
6326
|
-
await
|
|
6342
|
+
async function st(e) {
|
|
6343
|
+
await D.value.deleteChat(o.value, e), k.value = k.value.filter((t) => t.id !== e), T.value === e && await Ue();
|
|
6344
|
+
}
|
|
6345
|
+
function ct(e) {
|
|
6346
|
+
De.value = e;
|
|
6327
6347
|
}
|
|
6348
|
+
let lt;
|
|
6328
6349
|
function ut(e) {
|
|
6329
|
-
|
|
6350
|
+
let t = () => D.value.getChat(o.value, e).then((e) => e !== null);
|
|
6351
|
+
return t().catch(() => t().catch(() => !1));
|
|
6330
6352
|
}
|
|
6331
|
-
return {
|
|
6332
|
-
|
|
6353
|
+
return le(l, async (e) => {
|
|
6354
|
+
if (!e || e === lt) return;
|
|
6355
|
+
let t = lt;
|
|
6356
|
+
if (lt = e, t === void 0) return;
|
|
6357
|
+
let n = T.value, r = !C.value && await ut(n);
|
|
6358
|
+
if (!(l.value !== e || T.value !== n)) {
|
|
6359
|
+
if (r) {
|
|
6360
|
+
I(o.value);
|
|
6361
|
+
return;
|
|
6362
|
+
}
|
|
6363
|
+
k.value = [], j.value = [], A.value = [], await Ue(), Pe.value = "";
|
|
6364
|
+
}
|
|
6365
|
+
}), {
|
|
6366
|
+
apiClient: D,
|
|
6333
6367
|
baseUrl: i,
|
|
6334
6368
|
basePath: a,
|
|
6335
6369
|
agentId: o,
|
|
@@ -6343,7 +6377,7 @@ function Qi(e) {
|
|
|
6343
6377
|
revisedAnswers: m,
|
|
6344
6378
|
model: h,
|
|
6345
6379
|
actionsInput: ee,
|
|
6346
|
-
actions:
|
|
6380
|
+
actions: se,
|
|
6347
6381
|
agentFileUpload: g,
|
|
6348
6382
|
fallbackModels: _,
|
|
6349
6383
|
gatewayOptions: v,
|
|
@@ -6351,56 +6385,56 @@ function Qi(e) {
|
|
|
6351
6385
|
systemTheme: b,
|
|
6352
6386
|
hideWelcomeMessage: x,
|
|
6353
6387
|
isDark: oe,
|
|
6354
|
-
chat:
|
|
6355
|
-
messages:
|
|
6356
|
-
conversations:
|
|
6357
|
-
isLoadingConversations:
|
|
6358
|
-
chatFiles:
|
|
6359
|
-
isLoadingChatFiles:
|
|
6360
|
-
input:
|
|
6361
|
-
pendingAttachments:
|
|
6362
|
-
isAttachmentLimitReached:
|
|
6363
|
-
fileLimitError:
|
|
6364
|
-
localChatId:
|
|
6365
|
-
isConversationBlocked:
|
|
6366
|
-
inputMessagePlaceholder:
|
|
6367
|
-
chatError:
|
|
6368
|
-
activeView:
|
|
6369
|
-
messageFeedbacks:
|
|
6370
|
-
feedbackDialogMessage:
|
|
6371
|
-
isFeedbackSubmitting:
|
|
6372
|
-
isFeedbackSubmitted:
|
|
6373
|
-
feedbackSubmitError:
|
|
6374
|
-
isLeadSubmitted:
|
|
6375
|
-
isLoadingSubmitLead:
|
|
6376
|
-
submitLeadError:
|
|
6377
|
-
initialize:
|
|
6378
|
-
loadConversations:
|
|
6379
|
-
loadChatFiles:
|
|
6380
|
-
getChatFileUrl:
|
|
6381
|
-
getChatFilePreviewUrl:
|
|
6382
|
-
deleteChatFile:
|
|
6383
|
-
handleSubmit:
|
|
6384
|
-
sendMessage:
|
|
6385
|
-
stopGeneration:
|
|
6386
|
-
startNewChat:
|
|
6387
|
-
regenerate:
|
|
6388
|
-
addToolOutput:
|
|
6389
|
-
handleFileSelect:
|
|
6390
|
-
clearFileLimitError:
|
|
6391
|
-
clearPendingAttachments:
|
|
6392
|
-
onUpvote:
|
|
6393
|
-
onDownvote:
|
|
6394
|
-
onFeedback:
|
|
6395
|
-
onFeedbackSubmit:
|
|
6396
|
-
onLeadSubmit:
|
|
6397
|
-
navigate:
|
|
6398
|
-
renameChatTitle:
|
|
6399
|
-
deleteChat:
|
|
6388
|
+
chat: O,
|
|
6389
|
+
messages: Ce,
|
|
6390
|
+
conversations: k,
|
|
6391
|
+
isLoadingConversations: Te,
|
|
6392
|
+
chatFiles: A,
|
|
6393
|
+
isLoadingChatFiles: Ee,
|
|
6394
|
+
input: Pe,
|
|
6395
|
+
pendingAttachments: N,
|
|
6396
|
+
isAttachmentLimitReached: Xe,
|
|
6397
|
+
fileLimitError: Ze,
|
|
6398
|
+
localChatId: T,
|
|
6399
|
+
isConversationBlocked: ge,
|
|
6400
|
+
inputMessagePlaceholder: we,
|
|
6401
|
+
chatError: he,
|
|
6402
|
+
activeView: De,
|
|
6403
|
+
messageFeedbacks: j,
|
|
6404
|
+
feedbackDialogMessage: Oe,
|
|
6405
|
+
isFeedbackSubmitting: ke,
|
|
6406
|
+
isFeedbackSubmitted: Ae,
|
|
6407
|
+
feedbackSubmitError: je,
|
|
6408
|
+
isLeadSubmitted: M,
|
|
6409
|
+
isLoadingSubmitLead: Me,
|
|
6410
|
+
submitLeadError: Ne,
|
|
6411
|
+
initialize: Be,
|
|
6412
|
+
loadConversations: I,
|
|
6413
|
+
loadChatFiles: Fe,
|
|
6414
|
+
getChatFileUrl: L,
|
|
6415
|
+
getChatFilePreviewUrl: Ie,
|
|
6416
|
+
deleteChatFile: Le,
|
|
6417
|
+
handleSubmit: B,
|
|
6418
|
+
sendMessage: V,
|
|
6419
|
+
stopGeneration: Ve,
|
|
6420
|
+
startNewChat: Ue,
|
|
6421
|
+
regenerate: We,
|
|
6422
|
+
addToolOutput: Ge,
|
|
6423
|
+
handleFileSelect: $e,
|
|
6424
|
+
clearFileLimitError: Qe,
|
|
6425
|
+
clearPendingAttachments: He,
|
|
6426
|
+
onUpvote: tt,
|
|
6427
|
+
onDownvote: nt,
|
|
6428
|
+
onFeedback: rt,
|
|
6429
|
+
onFeedbackSubmit: it,
|
|
6430
|
+
onLeadSubmit: at,
|
|
6431
|
+
navigate: ct,
|
|
6432
|
+
renameChatTitle: ot,
|
|
6433
|
+
deleteChat: st
|
|
6400
6434
|
};
|
|
6401
6435
|
})();
|
|
6402
6436
|
}
|
|
6403
6437
|
//#endregion
|
|
6404
6438
|
export { sn as i, Zi as n, wi as r, Qi as t };
|
|
6405
6439
|
|
|
6406
|
-
//# sourceMappingURL=useChatbotStore-
|
|
6440
|
+
//# sourceMappingURL=useChatbotStore-DeHwEN8W.js.map
|