@marimo-team/islands 0.25.3-dev197 → 0.25.3-dev198
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ConnectedDataExplorerComponent-BRuwLOIx.js → ConnectedDataExplorerComponent-BsWiIPFk.js} +4 -4
- package/dist/{ErrorBoundary-jQVF8yMb.js → ErrorBoundary-D1Z3KAf_.js} +2 -2
- package/dist/{abnfDiagram-VCTEODGH-LlJTOOU_.js → abnfDiagram-VCTEODGH-I2x4Yu25.js} +2 -2
- package/dist/{architectureDiagram-5GKGNRK7-9PQtGLLZ.js → architectureDiagram-5GKGNRK7-1bSQMKzK.js} +1 -1
- package/dist/{arrays-DA6KkLfq.js → arrays-DoQ-AILx.js} +7 -21
- package/dist/{capabilities-CvWU-ey_.js → capabilities-C2QUNRXi.js} +1 -1
- package/dist/{chat-ui-Bl2euMBD.js → chat-ui-BAyHM_GD.js} +524 -524
- package/dist/{chunk-IMKFNOWR-DcXv-BD5.js → chunk-IMKFNOWR-fsCGAJ9G.js} +1 -1
- package/dist/{chunk-SHT3W25Y-VwnELN23.js → chunk-SHT3W25Y-D2STW4hj.js} +1 -1
- package/dist/{chunk-SVP7TREG-DgQpI5Zi.js → chunk-SVP7TREG-CiY7cQG-.js} +1 -1
- package/dist/{chunk-TICWLB2K-CTg6VTJT.js → chunk-TICWLB2K-C_t5RBp9.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-UzmcFrnW.js → classDiagram-ZZMXUADV-B2JvZAP4.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-DhjiI6IQ.js → classDiagram-v2-VYDZK3BY-L8VsZG5A.js} +2 -2
- package/dist/{code-visibility-CjZo_SV8.js → code-visibility-CInEQd1e.js} +19 -19
- package/dist/{common-CFLvScF3.js → common-W5HfVJPN.js} +4362 -4362
- package/dist/{cynefinDiagram-5FMLGOSQ-O4ShIbJX.js → cynefinDiagram-5FMLGOSQ-DdllC264.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-dtHhhcPu.js → dagre-GXQ25YYZ-BaWHw4_f.js} +1 -1
- package/dist/{data-grid-overlay-editor-CzW3mY6m.js → data-grid-overlay-editor-BQCaV0fI.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-ppPYVZ6W.js → diagram-S7CK7UJ4-pFt-tUDe.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-CMZDf--k.js → diagram-UQ7AKVKN-DqGJiBp4.js} +1 -1
- package/dist/{diagram-VX7I27RA-CFvJdx-C.js → diagram-VX7I27RA-Dr-yzMjf.js} +1 -1
- package/dist/{diagram-Z3DM3KII-Dt6_uFbv.js → diagram-Z3DM3KII-8xzJzv-w.js} +1 -1
- package/dist/{dropdown-menu-CeaOsjWZ.js → dropdown-menu-NlnsmNA6.js} +2 -2
- package/dist/{ebnfDiagram-PWID7BFC-DpRFrKK-.js → ebnfDiagram-PWID7BFC-Br04Wy-E.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-CqAU4b0u.js → erDiagram-RLTQ6QDP-D5-XVgvv.js} +1 -1
- package/dist/{error-entries-CYGwr5-O.js → error-entries-BacCWMWj.js} +4678 -5028
- package/dist/{feedback-button-GR_8U4Vo.js → feedback-button-DLXUcQ7l.js} +113 -113
- package/dist/{flowDiagram-HODETNUW-i8-Gw8HO.js → flowDiagram-HODETNUW-CVl2kREF.js} +2 -2
- package/dist/{formats-BtoHHy42.js → formats-BCYthwyc.js} +1 -1
- package/dist/{glide-data-editor-Dfdxc22H.js → glide-data-editor-D5YaHPKx.js} +5 -5
- package/dist/{globals-CxjzBEbP.js → globals-DjX1uxzy.js} +2 -2
- package/dist/{html-to-image-Cy5UDpQJ.js → html-to-image-DAmgSo5P.js} +624 -573
- package/dist/{infoDiagram-27XIBGKW-DpfOKdLL.js → infoDiagram-27XIBGKW-BJ4vNcZE.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-Dg7mrMG7.js → ishikawaDiagram-5VMMS53U-B_Jy1Dsm.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-QB6e3Jrj.js → kanban-definition-UXKFOSKX-C6MkS9vw.js} +1 -1
- package/dist/main.js +1117 -1117
- package/dist/{mermaid-CeWG4Egr.js → mermaid-Bh918qrq.js} +34 -34
- package/dist/{mindmap-definition-YA3MSWOX-BTz3uTGe.js → mindmap-definition-YA3MSWOX-BP3ZTuir.js} +1 -1
- package/dist/{number-overlay-editor-CwHYeI4e.js → number-overlay-editor-3C_K6w_0.js} +1 -1
- package/dist/{once-DWGO2mQ2.js → once-NnpX_HnX.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-3ZIEa3mB.js → pegDiagram-XKGWAZYB-nNGOQtnt.js} +2 -2
- package/dist/{pieDiagram-E7YTZNPT-BJAlk046.js → pieDiagram-E7YTZNPT-CpRz5BZz.js} +1 -1
- package/dist/{process-output-q9MTAIMX.js → process-output-DweUmAmV.js} +3 -3
- package/dist/{railroadDiagram-O6MQD6OU-Dn3bsSRa.js → railroadDiagram-O6MQD6OU-BqOEN4I0.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-wcOmQQCL.js → requirementDiagram-BXWQKSXE-CEfg6vu9.js} +1 -1
- package/dist/{reveal-component-C5bOqXlB.js → reveal-component-JjJRTT9d.js} +17 -17
- package/dist/{sequenceDiagram-WJ2MYXX4-DSh_qxoF.js → sequenceDiagram-WJ2MYXX4-IOmpQcOi.js} +1 -1
- package/dist/{spec-C7Fos-If.js → spec-Dkp64vVQ.js} +1 -1
- package/dist/{stateDiagram-D77RDMKH-DH_H8NMH.js → stateDiagram-D77RDMKH-tgU-EY9_.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-D_JM7MEK.js → stateDiagram-v2-MP3YSRHH-BofhG6q1.js} +2 -2
- package/dist/{swimlanes-42K2YHIH-CfoTJO-9.js → swimlanes-42K2YHIH-DW4vWDBd.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-Z_QhvK0G.js → swimlanesDiagram-VR7AAH4N-BJcrqUJr.js} +2 -2
- package/dist/{swiper-component-D2geL1Ku.js → swiper-component-BVfnhbnt.js} +1 -1
- package/dist/{timeline-definition-24CTP7MA-BFtdScaL.js → timeline-definition-24CTP7MA-D_QU3NGs.js} +1 -1
- package/dist/{toDate-CQAFSwos.js → toDate-BNDEXbfV.js} +30 -30
- package/dist/{useAsyncData-BeyZyjso.js → useAsyncData-ASDni9vH.js} +1 -1
- package/dist/{useDeepCompareMemoize-DOQgae0W.js → useDeepCompareMemoize-B1Ogyf53.js} +1 -1
- package/dist/{useIframeCapabilities-DNvaj9wM.js → useIframeCapabilities-6a_yDNXp.js} +1 -1
- package/dist/{useLifecycle-n2lnCFS8.js → useLifecycle-Bfpa2m7k.js} +1 -1
- package/dist/{useTheme-CY777LXN.js → useTheme-5TwyOh3B.js} +66 -66
- package/dist/{vega-component-0nQzA-I8.js → vega-component-BHS9UOtC.js} +19 -19
- package/dist/{vennDiagram-4TSXK5OY-BXY8IGCA.js → vennDiagram-4TSXK5OY-YFYsNIAh.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-D0tFe6eC.js → wardleyDiagram-VM6X3IG4-i_n8mAWC.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-Dx8wFM-y.js → xychartDiagram-S5SC5T6Z-BYGN95wW.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/document.tsx +13 -4
- package/src/__mocks__/notebook.ts +1 -2
- package/src/components/datasources/datasources.tsx +1 -1
- package/src/components/dependency-graph/custom-node.tsx +1 -1
- package/src/components/dependency-graph/minimap-content.tsx +12 -14
- package/src/components/editor/actions/useSetCodeVisibility.ts +1 -1
- package/src/components/editor/actions/useSetOutputsExpanded.ts +1 -1
- package/src/components/editor/alerts/stdin-blocking-alert.tsx +1 -1
- package/src/components/editor/cell/code/cell-editor.tsx +1 -1
- package/src/components/editor/cell/useSplitCell.tsx +8 -5
- package/src/components/editor/chrome/panels/dependency-graph-panel.tsx +1 -1
- package/src/components/editor/chrome/panels/session-panel.tsx +1 -1
- package/src/components/editor/chrome/panels/variable-panel.tsx +1 -5
- package/src/components/editor/chrome/wrapper/minimap-state.ts +1 -1
- package/src/components/editor/columns/__tests__/cell-column.test.tsx +1 -1
- package/src/components/editor/columns/cell-column.tsx +1 -1
- package/src/components/editor/columns/sortable-column.tsx +1 -1
- package/src/components/editor/links/__tests__/cell-link.test.tsx +1 -1
- package/src/components/editor/links/cell-link-list.tsx +1 -1
- package/src/components/editor/links/cell-link.tsx +1 -1
- package/src/components/editor/navigation/__tests__/navigation.test.ts +20 -6
- package/src/components/editor/navigation/__tests__/selection.test.ts +1 -2
- package/src/components/editor/navigation/clipboard.ts +5 -3
- package/src/components/editor/renderers/cell-array.tsx +7 -12
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +1 -1
- package/src/components/editor/renderers/vertical-layout/__tests__/useFocusFirstEditor.test.ts +4 -4
- package/src/components/editor/renderers/vertical-layout/useFocusFirstEditor.ts +1 -1
- package/src/components/editor/stdin-blocking-alert.tsx +1 -1
- package/src/components/slides/__tests__/minimap-actions.test.tsx +13 -4
- package/src/components/slides/__tests__/minimap.test.ts +38 -19
- package/src/components/slides/minimap.tsx +11 -10
- package/src/components/sort/SortableCellsProvider.tsx +2 -21
- package/src/components/tracing/tracing.tsx +1 -1
- package/src/core/ai/__tests__/staged-cells.test.ts +1 -1
- package/src/core/ai/context/providers/__tests__/cell-output.test.ts +8 -12
- package/src/core/ai/context/providers/cell-output.ts +2 -2
- package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +34 -66
- package/src/core/ai/tools/edit-notebook-tool.ts +12 -10
- package/src/core/cells/__tests__/actions.test.ts +64 -25
- package/src/core/cells/__tests__/arrange.test.ts +156 -4
- package/src/core/cells/__tests__/cells.test.ts +12 -290
- package/src/core/cells/__tests__/document.test.ts +2 -46
- package/src/core/cells/__tests__/harness.ts +28 -4
- package/src/core/cells/__tests__/layout.test.ts +42 -54
- package/src/core/cells/__tests__/session.test.ts +0 -2
- package/src/core/cells/__tests__/utils.test.ts +9 -107
- package/src/core/cells/actions.ts +112 -26
- package/src/core/cells/add-missing-import.ts +1 -1
- package/src/core/cells/arrange.ts +206 -13
- package/src/core/cells/cells.ts +28 -256
- package/src/core/cells/document.ts +18 -122
- package/src/core/cells/layout.ts +79 -10
- package/src/core/cells/pending-delete-service.ts +1 -1
- package/src/core/cells/utils.ts +4 -4
- package/src/core/codemirror/copilot/__tests__/getCodes.test.ts +6 -7
- package/src/core/codemirror/copilot/getCodes.ts +2 -2
- package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +1 -2
- package/src/core/codemirror/lsp/utils.ts +1 -1
- package/src/core/documentation/doc-lookup.ts +1 -1
- package/src/core/edit-app.tsx +2 -5
- package/src/core/errors/error-entries.ts +1 -1
- package/src/core/islands/__tests__/bootstrap.test.ts +2 -6
- package/src/core/islands/components/web-components.tsx +1 -1
- package/src/core/notebook/document/__tests__/codemirror.test.ts +8 -0
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +1 -1
- package/src/stories/cell.stories.tsx +1 -2
- package/src/stories/layout/vertical/one-column.stories.tsx +1 -2
- package/src/stories/runtime-story.tsx +2 -3
- package/src/utils/__tests__/id-tree.test.ts +0 -617
- package/src/utils/id-tree.tsx +0 -609
|
@@ -3,26 +3,26 @@ import { c as n, g as r, h as i, t as a } from "./button-BQRdqQi1.js";
|
|
|
3
3
|
import { t as o } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as s } from "./compiler-runtime-CldRdSsv.js";
|
|
5
5
|
import { i as c, t as l } from "./copy-icon-De584pZ4.js";
|
|
6
|
-
import { B as u, H as d, I as f, Q as p, S as m, U as h, W as g, X as _, Z as v, _ as y, a as b, b as x, f as S, g as C, h as w, l as T, m as E, n as D, p as O, r as k, t as
|
|
7
|
-
import { m as
|
|
8
|
-
import {
|
|
9
|
-
import { A as
|
|
10
|
-
import { _ as
|
|
11
|
-
import { C as
|
|
12
|
-
import { d as
|
|
13
|
-
import { t as
|
|
14
|
-
import { A as
|
|
15
|
-
import { n as
|
|
16
|
-
import { t as
|
|
17
|
-
import { t as
|
|
18
|
-
import { E as
|
|
19
|
-
import { t as
|
|
20
|
-
import { At as
|
|
21
|
-
import { n as
|
|
22
|
-
import { n as
|
|
23
|
-
import { n as
|
|
24
|
-
import { t as
|
|
25
|
-
var
|
|
6
|
+
import { B as u, H as d, I as f, Q as p, S as m, U as h, W as g, X as _, Z as v, _ as y, a as b, b as x, f as S, g as C, h as w, l as T, m as E, n as D, p as O, r as k, t as ee, u as te, v as A, y as ne } from "./html-to-image-DAmgSo5P.js";
|
|
7
|
+
import { m as j, t as re } from "./tooltip-s4zZxwKe.js";
|
|
8
|
+
import { It as ie, J as ae, Jt as oe, Lt as se, P as ce, Q as le, Rt as ue, Vt as de, b as fe, fn as pe, gt as me, ht as he, i as ge, kt as _e, ln as ve, m as ye, on as be, ot as xe, r as Se, sn as Ce, t as we, tt as Te, yt as Ee } from "./error-entries-BacCWMWj.js";
|
|
9
|
+
import { A as De, C as Oe, M as ke, b as Ae } from "./select-2KOiReNY.js";
|
|
10
|
+
import { _ as je, f as Me, h as Ne, i as Pe, n as Fe, t as Ie } from "./dropdown-menu-NlnsmNA6.js";
|
|
11
|
+
import { C as Le, d as Re } from "./toDate-BNDEXbfV.js";
|
|
12
|
+
import { d as ze, f as Be, i as Ve, n as He, t as Ue, u as We } from "./process-output-DweUmAmV.js";
|
|
13
|
+
import { t as Ge } from "./jsx-runtime-3BD1kT0s.js";
|
|
14
|
+
import { A as Ke, B as qe, C as Je, E as Ye, I as Xe, L as Ze, M as Qe, N as $e, O as et, P as tt, S as nt, T as rt, U as it, V as at, b as ot, k as st, w as ct, x as lt, y as ut, z as dt } from "./use-restore-focus-BgDTd2tc.js";
|
|
15
|
+
import { n as ft } from "./error-banner-DxJ3s8YO.js";
|
|
16
|
+
import { t as pt } from "./label-Qvw1E97W.js";
|
|
17
|
+
import { t as mt } from "./isEmpty-BSZ1LaUo.js";
|
|
18
|
+
import { E as ht, P as gt, R as _t, n as vt } from "./useTheme-5TwyOh3B.js";
|
|
19
|
+
import { t as yt } from "./objects-DCmMvZtn.js";
|
|
20
|
+
import { At as bt, Ct as xt, Et as St, G as Ct, J as wt, Nt as Tt, U as Et, jt as Dt, ot as Ot, q as kt, st as At, wt as jt } from "./dist-BmS-ZGjl.js";
|
|
21
|
+
import { n as Mt, o as Nt, r as Pt } from "./dist-OUle2RT7.js";
|
|
22
|
+
import { n as Ft } from "./dist-DtGn9N4h.js";
|
|
23
|
+
import { n as It, t as Lt } from "./esm-mDQNEFe_.js";
|
|
24
|
+
import { t as Rt } from "./useAsyncData-ASDni9vH.js";
|
|
25
|
+
var zt = j("ban", [["circle", {
|
|
26
26
|
cx: "12",
|
|
27
27
|
cy: "12",
|
|
28
28
|
r: "10",
|
|
@@ -30,7 +30,7 @@ var Rt = M("ban", [["circle", {
|
|
|
30
30
|
}], ["path", {
|
|
31
31
|
d: "M4.929 4.929 19.07 19.071",
|
|
32
32
|
key: "196cmz"
|
|
33
|
-
}]]),
|
|
33
|
+
}]]), Bt = j("bot-message-square", [
|
|
34
34
|
["path", {
|
|
35
35
|
d: "M12 6V2H8",
|
|
36
36
|
key: "1155em"
|
|
@@ -55,13 +55,13 @@ var Rt = M("ban", [["circle", {
|
|
|
55
55
|
d: "M9 11v2",
|
|
56
56
|
key: "1ueba0"
|
|
57
57
|
}]
|
|
58
|
-
]),
|
|
58
|
+
]), Vt = j("circle-check-big", [["path", {
|
|
59
59
|
d: "M21.801 10A10 10 0 1 1 17 3.335",
|
|
60
60
|
key: "yps3ct"
|
|
61
61
|
}], ["path", {
|
|
62
62
|
d: "m9 11 3 3L22 4",
|
|
63
63
|
key: "1pflzl"
|
|
64
|
-
}]]),
|
|
64
|
+
}]]), Ht = j("circle-slash", [["circle", {
|
|
65
65
|
cx: "12",
|
|
66
66
|
cy: "12",
|
|
67
67
|
r: "10",
|
|
@@ -72,22 +72,22 @@ var Rt = M("ban", [["circle", {
|
|
|
72
72
|
y1: "15",
|
|
73
73
|
y2: "9",
|
|
74
74
|
key: "1dfufj"
|
|
75
|
-
}]]),
|
|
75
|
+
}]]), Ut = j("paperclip", [["path", {
|
|
76
76
|
d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",
|
|
77
77
|
key: "1miecu"
|
|
78
|
-
}]]),
|
|
78
|
+
}]]), Wt = j("rotate-cw", [["path", {
|
|
79
79
|
d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",
|
|
80
80
|
key: "1p45f6"
|
|
81
81
|
}], ["path", {
|
|
82
82
|
d: "M21 3v5h-5",
|
|
83
83
|
key: "1q7to0"
|
|
84
|
-
}]]),
|
|
84
|
+
}]]), Gt = j("send-horizontal", [["path", {
|
|
85
85
|
d: "M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",
|
|
86
86
|
key: "117uat"
|
|
87
87
|
}], ["path", {
|
|
88
88
|
d: "M6 12h16",
|
|
89
89
|
key: "s4cdu5"
|
|
90
|
-
}]]),
|
|
90
|
+
}]]), Kt = j("settings", [["path", {
|
|
91
91
|
d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
|
|
92
92
|
key: "1i5ecw"
|
|
93
93
|
}], ["circle", {
|
|
@@ -95,7 +95,7 @@ var Rt = M("ban", [["circle", {
|
|
|
95
95
|
cy: "12",
|
|
96
96
|
r: "3",
|
|
97
97
|
key: "1v7zrd"
|
|
98
|
-
}]]),
|
|
98
|
+
}]]), qt = j("shield-question-mark", [
|
|
99
99
|
["path", {
|
|
100
100
|
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
101
101
|
key: "oel41y"
|
|
@@ -108,66 +108,66 @@ var Rt = M("ban", [["circle", {
|
|
|
108
108
|
d: "M12 17h.01",
|
|
109
109
|
key: "p32p05"
|
|
110
110
|
}]
|
|
111
|
-
]),
|
|
111
|
+
]), M = s(), Jt = "vercel.ai.error", Yt = Symbol.for(Jt), Xt, Zt, N = class e extends (Zt = Error, Xt = Yt, Zt) {
|
|
112
112
|
constructor({ name: e, message: t, cause: n }) {
|
|
113
|
-
super(t), this[
|
|
113
|
+
super(t), this[Xt] = !0, this.name = e, this.cause = n;
|
|
114
114
|
}
|
|
115
115
|
static isInstance(t) {
|
|
116
|
-
return e.hasMarker(t,
|
|
116
|
+
return e.hasMarker(t, Jt);
|
|
117
117
|
}
|
|
118
118
|
static hasMarker(e, t) {
|
|
119
119
|
let n = Symbol.for(t);
|
|
120
120
|
return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
|
|
121
121
|
}
|
|
122
|
-
},
|
|
122
|
+
}, Qt = "AI_APICallError", $t = `vercel.ai.error.${Qt}`, en = Symbol.for($t), tn, nn, rn = class extends (nn = N, tn = en, nn) {
|
|
123
123
|
constructor({ message: e, url: t, requestBodyValues: n, statusCode: r, responseHeaders: i, responseBody: a, cause: o, isRetryable: s = r != null && (r === 408 || r === 409 || r === 429 || r >= 500), data: c }) {
|
|
124
124
|
super({
|
|
125
|
-
name:
|
|
125
|
+
name: Qt,
|
|
126
126
|
message: e,
|
|
127
127
|
cause: o
|
|
128
|
-
}), this[
|
|
128
|
+
}), this[tn] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
|
|
129
129
|
}
|
|
130
130
|
static isInstance(e) {
|
|
131
|
-
return
|
|
131
|
+
return N.hasMarker(e, $t);
|
|
132
132
|
}
|
|
133
|
-
},
|
|
133
|
+
}, an = "AI_EmptyResponseBodyError", on = `vercel.ai.error.${an}`, sn = Symbol.for(on), cn, ln, un = class extends (ln = N, cn = sn, ln) {
|
|
134
134
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
135
135
|
super({
|
|
136
|
-
name:
|
|
136
|
+
name: an,
|
|
137
137
|
message: e
|
|
138
|
-
}), this[
|
|
138
|
+
}), this[cn] = !0;
|
|
139
139
|
}
|
|
140
140
|
static isInstance(e) {
|
|
141
|
-
return
|
|
141
|
+
return N.hasMarker(e, on);
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
-
function
|
|
144
|
+
function dn(e) {
|
|
145
145
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
146
146
|
}
|
|
147
|
-
var
|
|
147
|
+
var fn = "AI_InvalidArgumentError", pn = `vercel.ai.error.${fn}`, mn = Symbol.for(pn), hn, gn, _n = class extends (gn = N, hn = mn, gn) {
|
|
148
148
|
constructor({ message: e, cause: t, argument: n }) {
|
|
149
149
|
super({
|
|
150
|
-
name:
|
|
150
|
+
name: fn,
|
|
151
151
|
message: e,
|
|
152
152
|
cause: t
|
|
153
|
-
}), this[
|
|
153
|
+
}), this[hn] = !0, this.argument = n;
|
|
154
154
|
}
|
|
155
155
|
static isInstance(e) {
|
|
156
|
-
return
|
|
156
|
+
return N.hasMarker(e, pn);
|
|
157
157
|
}
|
|
158
|
-
},
|
|
158
|
+
}, vn = "AI_JSONParseError", yn = `vercel.ai.error.${vn}`, bn = Symbol.for(yn), xn, Sn, Cn = class extends (Sn = N, xn = bn, Sn) {
|
|
159
159
|
constructor({ text: e, cause: t }) {
|
|
160
160
|
super({
|
|
161
|
-
name:
|
|
161
|
+
name: vn,
|
|
162
162
|
message: `JSON parsing failed: Text: ${e}.
|
|
163
|
-
Error message: ${
|
|
163
|
+
Error message: ${dn(t)}`,
|
|
164
164
|
cause: t
|
|
165
|
-
}), this[
|
|
165
|
+
}), this[xn] = !0, this.text = e;
|
|
166
166
|
}
|
|
167
167
|
static isInstance(e) {
|
|
168
|
-
return
|
|
168
|
+
return N.hasMarker(e, yn);
|
|
169
169
|
}
|
|
170
|
-
},
|
|
170
|
+
}, wn = "AI_TypeValidationError", Tn = `vercel.ai.error.${wn}`, En = Symbol.for(Tn), Dn, On, P = class e extends (On = N, Dn = En, On) {
|
|
171
171
|
constructor({ value: e, cause: t, context: n }) {
|
|
172
172
|
let r = "Type validation failed";
|
|
173
173
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -176,14 +176,14 @@ Error message: ${un(t)}`,
|
|
|
176
176
|
n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
|
|
177
177
|
}
|
|
178
178
|
super({
|
|
179
|
-
name:
|
|
179
|
+
name: wn,
|
|
180
180
|
message: `${r}: Value: ${JSON.stringify(e)}.
|
|
181
|
-
Error message: ${
|
|
181
|
+
Error message: ${dn(t)}`,
|
|
182
182
|
cause: t
|
|
183
|
-
}), this[
|
|
183
|
+
}), this[Dn] = !0, this.value = e, this.context = n;
|
|
184
184
|
}
|
|
185
185
|
static isInstance(e) {
|
|
186
|
-
return
|
|
186
|
+
return N.hasMarker(e, Tn);
|
|
187
187
|
}
|
|
188
188
|
static wrap({ value: t, cause: n, context: r }) {
|
|
189
189
|
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({
|
|
@@ -192,25 +192,25 @@ Error message: ${un(t)}`,
|
|
|
192
192
|
context: r
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
|
-
},
|
|
195
|
+
}, kn = "AI_UnsupportedFunctionalityError", An = `vercel.ai.error.${kn}`, jn = Symbol.for(An), Mn, Nn, Pn = class extends (Nn = N, Mn = jn, Nn) {
|
|
196
196
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
197
197
|
super({
|
|
198
|
-
name:
|
|
198
|
+
name: kn,
|
|
199
199
|
message: t
|
|
200
|
-
}), this[
|
|
200
|
+
}), this[Mn] = !0, this.functionality = e;
|
|
201
201
|
}
|
|
202
202
|
static isInstance(e) {
|
|
203
|
-
return
|
|
203
|
+
return N.hasMarker(e, An);
|
|
204
204
|
}
|
|
205
|
-
},
|
|
205
|
+
}, Fn = class extends Error {
|
|
206
206
|
constructor(e, t) {
|
|
207
207
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
208
208
|
}
|
|
209
|
-
},
|
|
210
|
-
function
|
|
211
|
-
function
|
|
209
|
+
}, In = 10, Ln = 13, Rn = 32;
|
|
210
|
+
function zn(e) {}
|
|
211
|
+
function Bn(e) {
|
|
212
212
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
213
|
-
let { onEvent: t =
|
|
213
|
+
let { onEvent: t = zn, onError: n = zn, onRetry: r = zn, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
|
|
214
214
|
function m(e) {
|
|
215
215
|
if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
216
216
|
if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
|
|
@@ -229,7 +229,7 @@ function zn(e) {
|
|
|
229
229
|
n !== "" && (o.push(n), s = n.length), h();
|
|
230
230
|
}
|
|
231
231
|
function h() {
|
|
232
|
-
a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new
|
|
232
|
+
a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new Fn(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
|
|
233
233
|
}
|
|
234
234
|
function g(e) {
|
|
235
235
|
let n = 0;
|
|
@@ -245,9 +245,9 @@ function zn(e) {
|
|
|
245
245
|
continue;
|
|
246
246
|
}
|
|
247
247
|
let i = e.charCodeAt(n);
|
|
248
|
-
if (
|
|
249
|
-
let i = e.charCodeAt(n + 5) ===
|
|
250
|
-
if (d === 0 && e.charCodeAt(r + 1) ===
|
|
248
|
+
if (Vn(e, n, i)) {
|
|
249
|
+
let i = e.charCodeAt(n + 5) === Rn ? n + 6 : n + 5, a = e.slice(i, r);
|
|
250
|
+
if (d === 0 && e.charCodeAt(r + 1) === In) {
|
|
251
251
|
t({
|
|
252
252
|
id: l,
|
|
253
253
|
event: f,
|
|
@@ -257,7 +257,7 @@ function zn(e) {
|
|
|
257
257
|
}
|
|
258
258
|
u = d === 0 ? a : `${u}
|
|
259
259
|
${a}`, d++;
|
|
260
|
-
} else
|
|
260
|
+
} else Hn(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === Rn ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
|
|
261
261
|
n = r + 1, r = e.indexOf("\n", n);
|
|
262
262
|
}
|
|
263
263
|
return e.slice(n);
|
|
@@ -265,7 +265,7 @@ ${a}`, d++;
|
|
|
265
265
|
for (; n < e.length;) {
|
|
266
266
|
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
267
267
|
if (t !== -1 && r !== -1 ? i = t < r ? t : r : t === -1 ? r !== -1 && (i = r) : i = t === e.length - 1 ? -1 : t, i === -1) break;
|
|
268
|
-
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) ===
|
|
268
|
+
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) === Ln && e.charCodeAt(n) === In && n++;
|
|
269
269
|
}
|
|
270
270
|
return e.slice(n);
|
|
271
271
|
}
|
|
@@ -275,25 +275,25 @@ ${a}`, d++;
|
|
|
275
275
|
return;
|
|
276
276
|
}
|
|
277
277
|
let r = e.charCodeAt(t);
|
|
278
|
-
if (
|
|
279
|
-
let r = e.charCodeAt(t + 5) ===
|
|
278
|
+
if (Vn(e, t, r)) {
|
|
279
|
+
let r = e.charCodeAt(t + 5) === Rn ? t + 6 : t + 5, i = e.slice(r, n);
|
|
280
280
|
u = d === 0 ? i : `${u}
|
|
281
281
|
${i}`, d++;
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
|
-
if (
|
|
285
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
284
|
+
if (Hn(e, t, r)) {
|
|
285
|
+
f = e.slice(e.charCodeAt(t + 6) === Rn ? t + 7 : t + 6, n) || void 0;
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
288
288
|
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
289
|
-
let r = e.slice(e.charCodeAt(t + 3) ===
|
|
289
|
+
let r = e.slice(e.charCodeAt(t + 3) === Rn ? t + 4 : t + 3, n);
|
|
290
290
|
l = r.includes("\0") ? void 0 : r;
|
|
291
291
|
return;
|
|
292
292
|
}
|
|
293
293
|
if (r === 58) {
|
|
294
294
|
if (i) {
|
|
295
295
|
let r = e.slice(t, n);
|
|
296
|
-
i(r.slice(e.charCodeAt(t + 1) ===
|
|
296
|
+
i(r.slice(e.charCodeAt(t + 1) === Rn ? 2 : 1));
|
|
297
297
|
}
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
@@ -302,7 +302,7 @@ ${i}`, d++;
|
|
|
302
302
|
v(a, "", a);
|
|
303
303
|
return;
|
|
304
304
|
}
|
|
305
|
-
let s = a.slice(0, o), c = a.charCodeAt(o + 1) ===
|
|
305
|
+
let s = a.slice(0, o), c = a.charCodeAt(o + 1) === Rn ? 2 : 1;
|
|
306
306
|
v(s, a.slice(o + c), a);
|
|
307
307
|
}
|
|
308
308
|
function v(e, t, i) {
|
|
@@ -318,13 +318,13 @@ ${t}`, d++;
|
|
|
318
318
|
l = t.includes("\0") ? void 0 : t;
|
|
319
319
|
break;
|
|
320
320
|
case "retry":
|
|
321
|
-
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new
|
|
321
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new Fn(`Invalid \`retry\` value: "${t}"`, {
|
|
322
322
|
type: "invalid-retry",
|
|
323
323
|
value: t,
|
|
324
324
|
line: i
|
|
325
325
|
}));
|
|
326
326
|
break;
|
|
327
|
-
default: n(new
|
|
327
|
+
default: n(new Fn(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
|
|
328
328
|
type: "unknown-field",
|
|
329
329
|
field: e,
|
|
330
330
|
value: t,
|
|
@@ -351,20 +351,20 @@ ${t}`, d++;
|
|
|
351
351
|
reset: b
|
|
352
352
|
};
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function Vn(e, t, n) {
|
|
355
355
|
return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
|
|
356
356
|
}
|
|
357
|
-
function
|
|
357
|
+
function Hn(e, t, n) {
|
|
358
358
|
return n === 101 && e.charCodeAt(t + 1) === 118 && e.charCodeAt(t + 2) === 101 && e.charCodeAt(t + 3) === 110 && e.charCodeAt(t + 4) === 116 && e.charCodeAt(t + 5) === 58;
|
|
359
359
|
}
|
|
360
360
|
//#endregion
|
|
361
361
|
//#region ../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
|
|
362
|
-
var
|
|
362
|
+
var Un = class extends TransformStream {
|
|
363
363
|
constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
|
|
364
364
|
let i;
|
|
365
365
|
super({
|
|
366
366
|
start(a) {
|
|
367
|
-
i =
|
|
367
|
+
i = Bn({
|
|
368
368
|
onEvent: (e) => {
|
|
369
369
|
a.enqueue(e);
|
|
370
370
|
},
|
|
@@ -383,8 +383,8 @@ var Hn = class extends TransformStream {
|
|
|
383
383
|
}
|
|
384
384
|
};
|
|
385
385
|
new TextDecoder();
|
|
386
|
-
var { btoa:
|
|
387
|
-
function
|
|
386
|
+
var { btoa: Wn, atob: Gn } = globalThis;
|
|
387
|
+
function Kn(e) {
|
|
388
388
|
if (e == null) return {};
|
|
389
389
|
let t = {};
|
|
390
390
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -396,28 +396,28 @@ function Gn(e) {
|
|
|
396
396
|
}
|
|
397
397
|
return t;
|
|
398
398
|
}
|
|
399
|
-
var
|
|
399
|
+
var F = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
|
|
400
400
|
let i = () => {
|
|
401
401
|
let e = n.length, r = Array(t);
|
|
402
402
|
for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
|
|
403
403
|
return r.join("");
|
|
404
404
|
};
|
|
405
405
|
if (e == null) return i;
|
|
406
|
-
if (n.includes(r)) throw new
|
|
406
|
+
if (n.includes(r)) throw new _n({
|
|
407
407
|
argument: "separator",
|
|
408
408
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
409
409
|
});
|
|
410
410
|
return () => `${e}${r}${i()}`;
|
|
411
|
-
},
|
|
412
|
-
function
|
|
411
|
+
}, qn = F();
|
|
412
|
+
function Jn(e) {
|
|
413
413
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
414
414
|
}
|
|
415
|
-
var
|
|
416
|
-
function
|
|
415
|
+
var Yn = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, Xn = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
416
|
+
function Zn(e) {
|
|
417
417
|
let t = JSON.parse(e);
|
|
418
|
-
return typeof t != "object" || !t ||
|
|
418
|
+
return typeof t != "object" || !t || Yn.test(e) === !1 && Xn.test(e) === !1 ? t : Qn(t);
|
|
419
419
|
}
|
|
420
|
-
function
|
|
420
|
+
function Qn(e) {
|
|
421
421
|
let t = [e];
|
|
422
422
|
for (; t.length;) {
|
|
423
423
|
let e = t;
|
|
@@ -432,35 +432,35 @@ function Zn(e) {
|
|
|
432
432
|
}
|
|
433
433
|
return e;
|
|
434
434
|
}
|
|
435
|
-
function
|
|
435
|
+
function $n(e) {
|
|
436
436
|
let { stackTraceLimit: t } = Error;
|
|
437
437
|
try {
|
|
438
438
|
Error.stackTraceLimit = 0;
|
|
439
439
|
} catch {
|
|
440
|
-
return
|
|
440
|
+
return Zn(e);
|
|
441
441
|
}
|
|
442
442
|
try {
|
|
443
|
-
return
|
|
443
|
+
return Zn(e);
|
|
444
444
|
} finally {
|
|
445
445
|
Error.stackTraceLimit = t;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function er(e) {
|
|
449
449
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
450
450
|
let { additionalProperties: t } = e;
|
|
451
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
451
|
+
e.additionalProperties = t != null && typeof t != "boolean" && I(t);
|
|
452
452
|
let { properties: n } = e;
|
|
453
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
453
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = I(n[e]);
|
|
454
454
|
}
|
|
455
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
455
|
+
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(I) : I(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(I)), e.allOf != null && (e.allOf = e.allOf.map(I)), e.oneOf != null && (e.oneOf = e.oneOf.map(I));
|
|
456
456
|
let { definitions: t } = e;
|
|
457
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
457
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = I(t[e]);
|
|
458
458
|
return e;
|
|
459
459
|
}
|
|
460
|
-
function
|
|
461
|
-
return typeof e == "boolean" ? e :
|
|
460
|
+
function I(e) {
|
|
461
|
+
return typeof e == "boolean" ? e : er(e);
|
|
462
462
|
}
|
|
463
|
-
var
|
|
463
|
+
var tr = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use"), nr = {
|
|
464
464
|
name: void 0,
|
|
465
465
|
$refStrategy: "root",
|
|
466
466
|
basePath: ["#"],
|
|
@@ -480,24 +480,24 @@ var er = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to u
|
|
|
480
480
|
emailStrategy: "format:email",
|
|
481
481
|
base64Strategy: "contentEncoding:base64",
|
|
482
482
|
nameStrategy: "ref"
|
|
483
|
-
},
|
|
484
|
-
...
|
|
483
|
+
}, rr = (e) => typeof e == "string" ? {
|
|
484
|
+
...nr,
|
|
485
485
|
name: e
|
|
486
486
|
} : {
|
|
487
|
-
...
|
|
487
|
+
...nr,
|
|
488
488
|
...e
|
|
489
489
|
};
|
|
490
|
-
function
|
|
490
|
+
function L() {
|
|
491
491
|
return {};
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function ir(e, t) {
|
|
494
494
|
let n = { type: "array" };
|
|
495
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
495
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = V(e.type._def, {
|
|
496
496
|
...t,
|
|
497
497
|
currentPath: [...t.currentPath, "items"]
|
|
498
498
|
})), e.minLength && (n.minItems = e.minLength.value), e.maxLength && (n.maxItems = e.maxLength.value), e.exactLength && (n.minItems = e.exactLength.value, n.maxItems = e.exactLength.value), n;
|
|
499
499
|
}
|
|
500
|
-
function
|
|
500
|
+
function ar(e) {
|
|
501
501
|
let t = {
|
|
502
502
|
type: "integer",
|
|
503
503
|
format: "int64"
|
|
@@ -514,16 +514,16 @@ function ir(e) {
|
|
|
514
514
|
}
|
|
515
515
|
return t;
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function or() {
|
|
518
518
|
return { type: "boolean" };
|
|
519
519
|
}
|
|
520
|
-
function
|
|
521
|
-
return
|
|
520
|
+
function sr(e, t) {
|
|
521
|
+
return V(e.type._def, t);
|
|
522
522
|
}
|
|
523
|
-
var
|
|
524
|
-
function
|
|
523
|
+
var cr = (e, t) => V(e.innerType._def, t);
|
|
524
|
+
function lr(e, t, n) {
|
|
525
525
|
let r = n ?? t.dateStrategy;
|
|
526
|
-
if (Array.isArray(r)) return { anyOf: r.map((n) =>
|
|
526
|
+
if (Array.isArray(r)) return { anyOf: r.map((n) => lr(e, t, n)) };
|
|
527
527
|
switch (r) {
|
|
528
528
|
case "string":
|
|
529
529
|
case "format:date-time": return {
|
|
@@ -534,10 +534,10 @@ function cr(e, t, n) {
|
|
|
534
534
|
type: "string",
|
|
535
535
|
format: "date"
|
|
536
536
|
};
|
|
537
|
-
case "integer": return
|
|
537
|
+
case "integer": return ur(e);
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
|
-
var
|
|
540
|
+
var ur = (e) => {
|
|
541
541
|
let t = {
|
|
542
542
|
type: "integer",
|
|
543
543
|
format: "unix-time"
|
|
@@ -550,31 +550,31 @@ var lr = (e) => {
|
|
|
550
550
|
}
|
|
551
551
|
return t;
|
|
552
552
|
};
|
|
553
|
-
function
|
|
553
|
+
function dr(e, t) {
|
|
554
554
|
return {
|
|
555
|
-
...
|
|
555
|
+
...V(e.innerType._def, t),
|
|
556
556
|
default: e.defaultValue()
|
|
557
557
|
};
|
|
558
558
|
}
|
|
559
|
-
function
|
|
560
|
-
return t.effectStrategy === "input" ?
|
|
559
|
+
function fr(e, t) {
|
|
560
|
+
return t.effectStrategy === "input" ? V(e.schema._def, t) : L();
|
|
561
561
|
}
|
|
562
|
-
function
|
|
562
|
+
function pr(e) {
|
|
563
563
|
return {
|
|
564
564
|
type: "string",
|
|
565
565
|
enum: Array.from(e.values)
|
|
566
566
|
};
|
|
567
567
|
}
|
|
568
|
-
var
|
|
569
|
-
function
|
|
570
|
-
let n = [
|
|
568
|
+
var mr = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
569
|
+
function hr(e, t) {
|
|
570
|
+
let n = [V(e.left._def, {
|
|
571
571
|
...t,
|
|
572
572
|
currentPath: [
|
|
573
573
|
...t.currentPath,
|
|
574
574
|
"allOf",
|
|
575
575
|
"0"
|
|
576
576
|
]
|
|
577
|
-
}),
|
|
577
|
+
}), V(e.right._def, {
|
|
578
578
|
...t,
|
|
579
579
|
currentPath: [
|
|
580
580
|
...t.currentPath,
|
|
@@ -583,7 +583,7 @@ function mr(e, t) {
|
|
|
583
583
|
]
|
|
584
584
|
})].filter((e) => !!e), r = [];
|
|
585
585
|
return n.forEach((e) => {
|
|
586
|
-
if (
|
|
586
|
+
if (mr(e)) r.push(...e.allOf);
|
|
587
587
|
else {
|
|
588
588
|
let t = e;
|
|
589
589
|
if ("additionalProperties" in e && e.additionalProperties === !1) {
|
|
@@ -594,19 +594,19 @@ function mr(e, t) {
|
|
|
594
594
|
}
|
|
595
595
|
}), r.length ? { allOf: r } : void 0;
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function gr(e) {
|
|
598
598
|
let t = typeof e.value;
|
|
599
599
|
return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
|
|
600
600
|
type: t === "bigint" ? "integer" : t,
|
|
601
601
|
const: e.value
|
|
602
602
|
};
|
|
603
603
|
}
|
|
604
|
-
var
|
|
604
|
+
var _r = void 0, R = {
|
|
605
605
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
606
606
|
cuid2: /^[0-9a-z]+$/,
|
|
607
607
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
608
608
|
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
609
|
-
emoji: () => (
|
|
609
|
+
emoji: () => (_r === void 0 && (_r = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), _r),
|
|
610
610
|
uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
|
|
611
611
|
ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
612
612
|
ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
|
|
@@ -617,7 +617,7 @@ var gr = void 0, z = {
|
|
|
617
617
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
618
618
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
619
619
|
};
|
|
620
|
-
function
|
|
620
|
+
function vr(e, t) {
|
|
621
621
|
let n = { type: "string" };
|
|
622
622
|
if (e.checks) for (let r of e.checks) switch (r.kind) {
|
|
623
623
|
case "min":
|
|
@@ -629,108 +629,108 @@ function _r(e, t) {
|
|
|
629
629
|
case "email":
|
|
630
630
|
switch (t.emailStrategy) {
|
|
631
631
|
case "format:email":
|
|
632
|
-
|
|
632
|
+
z(n, "email", r.message, t);
|
|
633
633
|
break;
|
|
634
634
|
case "format:idn-email":
|
|
635
|
-
|
|
635
|
+
z(n, "idn-email", r.message, t);
|
|
636
636
|
break;
|
|
637
|
-
case "pattern:zod":
|
|
637
|
+
case "pattern:zod": B(n, R.email, r.message, t);
|
|
638
638
|
}
|
|
639
639
|
break;
|
|
640
640
|
case "url":
|
|
641
|
-
|
|
641
|
+
z(n, "uri", r.message, t);
|
|
642
642
|
break;
|
|
643
643
|
case "uuid":
|
|
644
|
-
|
|
644
|
+
z(n, "uuid", r.message, t);
|
|
645
645
|
break;
|
|
646
646
|
case "regex":
|
|
647
|
-
|
|
647
|
+
B(n, r.regex, r.message, t);
|
|
648
648
|
break;
|
|
649
649
|
case "cuid":
|
|
650
|
-
|
|
650
|
+
B(n, R.cuid, r.message, t);
|
|
651
651
|
break;
|
|
652
652
|
case "cuid2":
|
|
653
|
-
|
|
653
|
+
B(n, R.cuid2, r.message, t);
|
|
654
654
|
break;
|
|
655
655
|
case "startsWith":
|
|
656
|
-
|
|
656
|
+
B(n, RegExp(`^${yr(r.value, t)}`), r.message, t);
|
|
657
657
|
break;
|
|
658
658
|
case "endsWith":
|
|
659
|
-
|
|
659
|
+
B(n, RegExp(`${yr(r.value, t)}$`), r.message, t);
|
|
660
660
|
break;
|
|
661
661
|
case "datetime":
|
|
662
|
-
|
|
662
|
+
z(n, "date-time", r.message, t);
|
|
663
663
|
break;
|
|
664
664
|
case "date":
|
|
665
|
-
|
|
665
|
+
z(n, "date", r.message, t);
|
|
666
666
|
break;
|
|
667
667
|
case "time":
|
|
668
|
-
|
|
668
|
+
z(n, "time", r.message, t);
|
|
669
669
|
break;
|
|
670
670
|
case "duration":
|
|
671
|
-
|
|
671
|
+
z(n, "duration", r.message, t);
|
|
672
672
|
break;
|
|
673
673
|
case "length":
|
|
674
674
|
n.minLength = typeof n.minLength == "number" ? Math.max(n.minLength, r.value) : r.value, n.maxLength = typeof n.maxLength == "number" ? Math.min(n.maxLength, r.value) : r.value;
|
|
675
675
|
break;
|
|
676
676
|
case "includes":
|
|
677
|
-
|
|
677
|
+
B(n, RegExp(yr(r.value, t)), r.message, t);
|
|
678
678
|
break;
|
|
679
679
|
case "ip":
|
|
680
|
-
r.version !== "v6" &&
|
|
680
|
+
r.version !== "v6" && z(n, "ipv4", r.message, t), r.version !== "v4" && z(n, "ipv6", r.message, t);
|
|
681
681
|
break;
|
|
682
682
|
case "base64url":
|
|
683
|
-
|
|
683
|
+
B(n, R.base64url, r.message, t);
|
|
684
684
|
break;
|
|
685
685
|
case "jwt":
|
|
686
|
-
|
|
686
|
+
B(n, R.jwt, r.message, t);
|
|
687
687
|
break;
|
|
688
688
|
case "cidr":
|
|
689
|
-
r.version !== "v6" &&
|
|
689
|
+
r.version !== "v6" && B(n, R.ipv4Cidr, r.message, t), r.version !== "v4" && B(n, R.ipv6Cidr, r.message, t);
|
|
690
690
|
break;
|
|
691
691
|
case "emoji":
|
|
692
|
-
|
|
692
|
+
B(n, R.emoji(), r.message, t);
|
|
693
693
|
break;
|
|
694
694
|
case "ulid":
|
|
695
|
-
|
|
695
|
+
B(n, R.ulid, r.message, t);
|
|
696
696
|
break;
|
|
697
697
|
case "base64":
|
|
698
698
|
switch (t.base64Strategy) {
|
|
699
699
|
case "format:binary":
|
|
700
|
-
|
|
700
|
+
z(n, "binary", r.message, t);
|
|
701
701
|
break;
|
|
702
702
|
case "contentEncoding:base64":
|
|
703
703
|
n.contentEncoding = "base64";
|
|
704
704
|
break;
|
|
705
|
-
case "pattern:zod":
|
|
705
|
+
case "pattern:zod": B(n, R.base64, r.message, t);
|
|
706
706
|
}
|
|
707
707
|
break;
|
|
708
|
-
case "nanoid":
|
|
708
|
+
case "nanoid": B(n, R.nanoid, r.message, t);
|
|
709
709
|
}
|
|
710
710
|
return n;
|
|
711
711
|
}
|
|
712
|
-
function
|
|
713
|
-
return t.patternStrategy === "escape" ?
|
|
712
|
+
function yr(e, t) {
|
|
713
|
+
return t.patternStrategy === "escape" ? xr(e) : e;
|
|
714
714
|
}
|
|
715
|
-
var
|
|
716
|
-
function
|
|
715
|
+
var br = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
716
|
+
function xr(e) {
|
|
717
717
|
let t = "";
|
|
718
|
-
for (let n = 0; n < e.length; n++)
|
|
718
|
+
for (let n = 0; n < e.length; n++) br.has(e[n]) || (t += "\\"), t += e[n];
|
|
719
719
|
return t;
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function z(e, t, n, r) {
|
|
722
722
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
723
723
|
format: t,
|
|
724
724
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
725
725
|
})) : e.format = t;
|
|
726
726
|
}
|
|
727
|
-
function
|
|
727
|
+
function B(e, t, n, r) {
|
|
728
728
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
729
|
-
pattern:
|
|
729
|
+
pattern: Sr(t, r),
|
|
730
730
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
731
|
-
})) : e.pattern =
|
|
731
|
+
})) : e.pattern = Sr(t, r);
|
|
732
732
|
}
|
|
733
|
-
function
|
|
733
|
+
function Sr(e, t) {
|
|
734
734
|
if (!t.applyRegexFlags || !e.flags) return e.source;
|
|
735
735
|
let n = {
|
|
736
736
|
i: e.flags.includes("i"),
|
|
@@ -778,16 +778,16 @@ function xr(e, t) {
|
|
|
778
778
|
}
|
|
779
779
|
return i;
|
|
780
780
|
}
|
|
781
|
-
function
|
|
781
|
+
function Cr(e, t) {
|
|
782
782
|
let n = {
|
|
783
783
|
type: "object",
|
|
784
|
-
additionalProperties:
|
|
784
|
+
additionalProperties: V(e.valueType._def, {
|
|
785
785
|
...t,
|
|
786
786
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
787
787
|
}) ?? t.allowedAdditionalProperties
|
|
788
788
|
};
|
|
789
789
|
if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
|
|
790
|
-
let { type: r, ...i } =
|
|
790
|
+
let { type: r, ...i } = vr(e.keyType._def, t);
|
|
791
791
|
return {
|
|
792
792
|
...n,
|
|
793
793
|
propertyNames: i
|
|
@@ -798,7 +798,7 @@ function Sr(e, t) {
|
|
|
798
798
|
propertyNames: { enum: e.keyType._def.values }
|
|
799
799
|
};
|
|
800
800
|
if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
|
|
801
|
-
let { type: r, ...i } =
|
|
801
|
+
let { type: r, ...i } = sr(e.keyType._def, t);
|
|
802
802
|
return {
|
|
803
803
|
...n,
|
|
804
804
|
propertyNames: i
|
|
@@ -806,13 +806,13 @@ function Sr(e, t) {
|
|
|
806
806
|
}
|
|
807
807
|
return n;
|
|
808
808
|
}
|
|
809
|
-
function
|
|
810
|
-
return t.mapStrategy === "record" ?
|
|
809
|
+
function wr(e, t) {
|
|
810
|
+
return t.mapStrategy === "record" ? Cr(e, t) : {
|
|
811
811
|
type: "array",
|
|
812
812
|
maxItems: 125,
|
|
813
813
|
items: {
|
|
814
814
|
type: "array",
|
|
815
|
-
items: [
|
|
815
|
+
items: [V(e.keyType._def, {
|
|
816
816
|
...t,
|
|
817
817
|
currentPath: [
|
|
818
818
|
...t.currentPath,
|
|
@@ -820,7 +820,7 @@ function Cr(e, t) {
|
|
|
820
820
|
"items",
|
|
821
821
|
"0"
|
|
822
822
|
]
|
|
823
|
-
}) ||
|
|
823
|
+
}) || L(), V(e.valueType._def, {
|
|
824
824
|
...t,
|
|
825
825
|
currentPath: [
|
|
826
826
|
...t.currentPath,
|
|
@@ -828,37 +828,37 @@ function Cr(e, t) {
|
|
|
828
828
|
"items",
|
|
829
829
|
"1"
|
|
830
830
|
]
|
|
831
|
-
}) ||
|
|
831
|
+
}) || L()],
|
|
832
832
|
minItems: 2,
|
|
833
833
|
maxItems: 2
|
|
834
834
|
}
|
|
835
835
|
};
|
|
836
836
|
}
|
|
837
|
-
function
|
|
837
|
+
function Tr(e) {
|
|
838
838
|
let t = e.values, n = Object.keys(e.values).filter((e) => typeof t[t[e]] != "number").map((e) => t[e]), r = Array.from(new Set(n.map((e) => typeof e)));
|
|
839
839
|
return {
|
|
840
840
|
type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
841
841
|
enum: n
|
|
842
842
|
};
|
|
843
843
|
}
|
|
844
|
-
function Tr() {
|
|
845
|
-
return { not: R() };
|
|
846
|
-
}
|
|
847
844
|
function Er() {
|
|
845
|
+
return { not: L() };
|
|
846
|
+
}
|
|
847
|
+
function Dr() {
|
|
848
848
|
return { type: "null" };
|
|
849
849
|
}
|
|
850
|
-
var
|
|
850
|
+
var Or = {
|
|
851
851
|
ZodString: "string",
|
|
852
852
|
ZodNumber: "number",
|
|
853
853
|
ZodBigInt: "integer",
|
|
854
854
|
ZodBoolean: "boolean",
|
|
855
855
|
ZodNull: "null"
|
|
856
856
|
};
|
|
857
|
-
function
|
|
857
|
+
function kr(e, t) {
|
|
858
858
|
let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
859
|
-
if (n.every((e) => e._def.typeName in
|
|
859
|
+
if (n.every((e) => e._def.typeName in Or && (!e._def.checks || !e._def.checks.length))) {
|
|
860
860
|
let e = n.reduce((e, t) => {
|
|
861
|
-
let n =
|
|
861
|
+
let n = Or[t._def.typeName];
|
|
862
862
|
return n && !e.includes(n) ? [...e, n] : e;
|
|
863
863
|
}, []);
|
|
864
864
|
return { type: e.length > 1 ? e : e[0] };
|
|
@@ -886,10 +886,10 @@ function Or(e, t) {
|
|
|
886
886
|
type: "string",
|
|
887
887
|
enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
|
|
888
888
|
};
|
|
889
|
-
return
|
|
889
|
+
return Ar(e, t);
|
|
890
890
|
}
|
|
891
|
-
var
|
|
892
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
891
|
+
var Ar = (e, t) => {
|
|
892
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => V(e._def, {
|
|
893
893
|
...t,
|
|
894
894
|
currentPath: [
|
|
895
895
|
...t.currentPath,
|
|
@@ -899,15 +899,15 @@ var kr = (e, t) => {
|
|
|
899
899
|
})).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
|
|
900
900
|
return n.length ? { anyOf: n } : void 0;
|
|
901
901
|
};
|
|
902
|
-
function
|
|
902
|
+
function jr(e, t) {
|
|
903
903
|
if ([
|
|
904
904
|
"ZodString",
|
|
905
905
|
"ZodNumber",
|
|
906
906
|
"ZodBigInt",
|
|
907
907
|
"ZodBoolean",
|
|
908
908
|
"ZodNull"
|
|
909
|
-
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [
|
|
910
|
-
let n =
|
|
909
|
+
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [Or[e.innerType._def.typeName], "null"] };
|
|
910
|
+
let n = V(e.innerType._def, {
|
|
911
911
|
...t,
|
|
912
912
|
currentPath: [
|
|
913
913
|
...t.currentPath,
|
|
@@ -917,7 +917,7 @@ function Ar(e, t) {
|
|
|
917
917
|
});
|
|
918
918
|
return n && { anyOf: [n, { type: "null" }] };
|
|
919
919
|
}
|
|
920
|
-
function
|
|
920
|
+
function Mr(e) {
|
|
921
921
|
let t = { type: "number" };
|
|
922
922
|
if (!e.checks) return t;
|
|
923
923
|
for (let n of e.checks) switch (n.kind) {
|
|
@@ -934,7 +934,7 @@ function jr(e) {
|
|
|
934
934
|
}
|
|
935
935
|
return t;
|
|
936
936
|
}
|
|
937
|
-
function
|
|
937
|
+
function Nr(e, t) {
|
|
938
938
|
let n = {
|
|
939
939
|
type: "object",
|
|
940
940
|
properties: {}
|
|
@@ -942,7 +942,7 @@ function Mr(e, t) {
|
|
|
942
942
|
for (let e in i) {
|
|
943
943
|
let a = i[e];
|
|
944
944
|
if (a === void 0 || a._def === void 0) continue;
|
|
945
|
-
let o =
|
|
945
|
+
let o = Fr(a), s = V(a._def, {
|
|
946
946
|
...t,
|
|
947
947
|
currentPath: [
|
|
948
948
|
...t.currentPath,
|
|
@@ -958,11 +958,11 @@ function Mr(e, t) {
|
|
|
958
958
|
s !== void 0 && (n.properties[e] = s, o || r.push(e));
|
|
959
959
|
}
|
|
960
960
|
r.length && (n.required = r);
|
|
961
|
-
let a =
|
|
961
|
+
let a = Pr(e, t);
|
|
962
962
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
963
963
|
}
|
|
964
|
-
function
|
|
965
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
964
|
+
function Pr(e, t) {
|
|
965
|
+
if (e.catchall._def.typeName !== "ZodNever") return V(e.catchall._def, {
|
|
966
966
|
...t,
|
|
967
967
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
968
968
|
});
|
|
@@ -972,16 +972,16 @@ function Nr(e, t) {
|
|
|
972
972
|
case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
973
973
|
}
|
|
974
974
|
}
|
|
975
|
-
function
|
|
975
|
+
function Fr(e) {
|
|
976
976
|
try {
|
|
977
977
|
return e.isOptional();
|
|
978
978
|
} catch {
|
|
979
979
|
return !0;
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
|
-
var
|
|
983
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
984
|
-
let n =
|
|
982
|
+
var Ir = (e, t) => {
|
|
983
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return V(e.innerType._def, t);
|
|
984
|
+
let n = V(e.innerType._def, {
|
|
985
985
|
...t,
|
|
986
986
|
currentPath: [
|
|
987
987
|
...t.currentPath,
|
|
@@ -989,11 +989,11 @@ var Fr = (e, t) => {
|
|
|
989
989
|
"1"
|
|
990
990
|
]
|
|
991
991
|
});
|
|
992
|
-
return n ? { anyOf: [{ not:
|
|
993
|
-
},
|
|
994
|
-
if (t.pipeStrategy === "input") return
|
|
995
|
-
if (t.pipeStrategy === "output") return
|
|
996
|
-
let n =
|
|
992
|
+
return n ? { anyOf: [{ not: L() }, n] } : L();
|
|
993
|
+
}, Lr = (e, t) => {
|
|
994
|
+
if (t.pipeStrategy === "input") return V(e.in._def, t);
|
|
995
|
+
if (t.pipeStrategy === "output") return V(e.out._def, t);
|
|
996
|
+
let n = V(e.in._def, {
|
|
997
997
|
...t,
|
|
998
998
|
currentPath: [
|
|
999
999
|
...t.currentPath,
|
|
@@ -1001,7 +1001,7 @@ var Fr = (e, t) => {
|
|
|
1001
1001
|
"0"
|
|
1002
1002
|
]
|
|
1003
1003
|
});
|
|
1004
|
-
return { allOf: [n,
|
|
1004
|
+
return { allOf: [n, V(e.out._def, {
|
|
1005
1005
|
...t,
|
|
1006
1006
|
currentPath: [
|
|
1007
1007
|
...t.currentPath,
|
|
@@ -1010,25 +1010,25 @@ var Fr = (e, t) => {
|
|
|
1010
1010
|
]
|
|
1011
1011
|
})].filter((e) => e !== void 0) };
|
|
1012
1012
|
};
|
|
1013
|
-
function Lr(e, t) {
|
|
1014
|
-
return H(e.type._def, t);
|
|
1015
|
-
}
|
|
1016
1013
|
function Rr(e, t) {
|
|
1014
|
+
return V(e.type._def, t);
|
|
1015
|
+
}
|
|
1016
|
+
function zr(e, t) {
|
|
1017
1017
|
let n = {
|
|
1018
1018
|
type: "array",
|
|
1019
1019
|
uniqueItems: !0,
|
|
1020
|
-
items:
|
|
1020
|
+
items: V(e.valueType._def, {
|
|
1021
1021
|
...t,
|
|
1022
1022
|
currentPath: [...t.currentPath, "items"]
|
|
1023
1023
|
})
|
|
1024
1024
|
};
|
|
1025
1025
|
return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1027
|
+
function Br(e, t) {
|
|
1028
1028
|
return e.rest ? {
|
|
1029
1029
|
type: "array",
|
|
1030
1030
|
minItems: e.items.length,
|
|
1031
|
-
items: e.items.map((e, n) =>
|
|
1031
|
+
items: e.items.map((e, n) => V(e._def, {
|
|
1032
1032
|
...t,
|
|
1033
1033
|
currentPath: [
|
|
1034
1034
|
...t.currentPath,
|
|
@@ -1036,7 +1036,7 @@ function zr(e, t) {
|
|
|
1036
1036
|
`${n}`
|
|
1037
1037
|
]
|
|
1038
1038
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
1039
|
-
additionalItems:
|
|
1039
|
+
additionalItems: V(e.rest._def, {
|
|
1040
1040
|
...t,
|
|
1041
1041
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
1042
1042
|
})
|
|
@@ -1044,7 +1044,7 @@ function zr(e, t) {
|
|
|
1044
1044
|
type: "array",
|
|
1045
1045
|
minItems: e.items.length,
|
|
1046
1046
|
maxItems: e.items.length,
|
|
1047
|
-
items: e.items.map((e, n) =>
|
|
1047
|
+
items: e.items.map((e, n) => V(e._def, {
|
|
1048
1048
|
...t,
|
|
1049
1049
|
currentPath: [
|
|
1050
1050
|
...t.currentPath,
|
|
@@ -1054,65 +1054,65 @@ function zr(e, t) {
|
|
|
1054
1054
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], [])
|
|
1055
1055
|
};
|
|
1056
1056
|
}
|
|
1057
|
-
function Br() {
|
|
1058
|
-
return { not: R() };
|
|
1059
|
-
}
|
|
1060
1057
|
function Vr() {
|
|
1061
|
-
return
|
|
1058
|
+
return { not: L() };
|
|
1059
|
+
}
|
|
1060
|
+
function Hr() {
|
|
1061
|
+
return L();
|
|
1062
1062
|
}
|
|
1063
|
-
var
|
|
1063
|
+
var Ur = (e, t) => V(e.innerType._def, t), Wr = (e, t, n) => {
|
|
1064
1064
|
switch (t) {
|
|
1065
|
-
case "ZodString": return
|
|
1066
|
-
case "ZodNumber": return
|
|
1067
|
-
case "ZodObject": return
|
|
1068
|
-
case "ZodBigInt": return
|
|
1069
|
-
case "ZodBoolean": return
|
|
1070
|
-
case "ZodDate": return
|
|
1071
|
-
case "ZodUndefined": return
|
|
1072
|
-
case "ZodNull": return
|
|
1073
|
-
case "ZodArray": return
|
|
1065
|
+
case "ZodString": return vr(e, n);
|
|
1066
|
+
case "ZodNumber": return Mr(e);
|
|
1067
|
+
case "ZodObject": return Nr(e, n);
|
|
1068
|
+
case "ZodBigInt": return ar(e);
|
|
1069
|
+
case "ZodBoolean": return or();
|
|
1070
|
+
case "ZodDate": return lr(e, n);
|
|
1071
|
+
case "ZodUndefined": return Vr();
|
|
1072
|
+
case "ZodNull": return Dr();
|
|
1073
|
+
case "ZodArray": return ir(e, n);
|
|
1074
1074
|
case "ZodUnion":
|
|
1075
|
-
case "ZodDiscriminatedUnion": return
|
|
1076
|
-
case "ZodIntersection": return
|
|
1077
|
-
case "ZodTuple": return
|
|
1078
|
-
case "ZodRecord": return
|
|
1079
|
-
case "ZodLiteral": return
|
|
1080
|
-
case "ZodEnum": return
|
|
1081
|
-
case "ZodNativeEnum": return
|
|
1082
|
-
case "ZodNullable": return
|
|
1083
|
-
case "ZodOptional": return
|
|
1084
|
-
case "ZodMap": return
|
|
1085
|
-
case "ZodSet": return
|
|
1075
|
+
case "ZodDiscriminatedUnion": return kr(e, n);
|
|
1076
|
+
case "ZodIntersection": return hr(e, n);
|
|
1077
|
+
case "ZodTuple": return Br(e, n);
|
|
1078
|
+
case "ZodRecord": return Cr(e, n);
|
|
1079
|
+
case "ZodLiteral": return gr(e);
|
|
1080
|
+
case "ZodEnum": return pr(e);
|
|
1081
|
+
case "ZodNativeEnum": return Tr(e);
|
|
1082
|
+
case "ZodNullable": return jr(e, n);
|
|
1083
|
+
case "ZodOptional": return Ir(e, n);
|
|
1084
|
+
case "ZodMap": return wr(e, n);
|
|
1085
|
+
case "ZodSet": return zr(e, n);
|
|
1086
1086
|
case "ZodLazy": return () => e.getter()._def;
|
|
1087
|
-
case "ZodPromise": return
|
|
1087
|
+
case "ZodPromise": return Rr(e, n);
|
|
1088
1088
|
case "ZodNaN":
|
|
1089
|
-
case "ZodNever": return
|
|
1090
|
-
case "ZodEffects": return
|
|
1091
|
-
case "ZodAny": return
|
|
1092
|
-
case "ZodUnknown": return
|
|
1093
|
-
case "ZodDefault": return
|
|
1094
|
-
case "ZodBranded": return
|
|
1095
|
-
case "ZodReadonly": return
|
|
1096
|
-
case "ZodCatch": return
|
|
1097
|
-
case "ZodPipeline": return
|
|
1089
|
+
case "ZodNever": return Er();
|
|
1090
|
+
case "ZodEffects": return fr(e, n);
|
|
1091
|
+
case "ZodAny": return L();
|
|
1092
|
+
case "ZodUnknown": return Hr();
|
|
1093
|
+
case "ZodDefault": return dr(e, n);
|
|
1094
|
+
case "ZodBranded": return sr(e, n);
|
|
1095
|
+
case "ZodReadonly": return Ur(e, n);
|
|
1096
|
+
case "ZodCatch": return cr(e, n);
|
|
1097
|
+
case "ZodPipeline": return Lr(e, n);
|
|
1098
1098
|
case "ZodFunction":
|
|
1099
1099
|
case "ZodVoid":
|
|
1100
1100
|
case "ZodSymbol": return;
|
|
1101
1101
|
default: return /* @__PURE__ */ ((e) => void 0)(t);
|
|
1102
1102
|
}
|
|
1103
|
-
},
|
|
1103
|
+
}, Gr = (e, t) => {
|
|
1104
1104
|
let n = 0;
|
|
1105
1105
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1106
1106
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1107
1107
|
};
|
|
1108
|
-
function
|
|
1108
|
+
function V(e, t, n = !1) {
|
|
1109
1109
|
let r = t.seen.get(e);
|
|
1110
1110
|
if (t.override) {
|
|
1111
1111
|
let i = t.override?.call(t, e, t, r, n);
|
|
1112
|
-
if (i !==
|
|
1112
|
+
if (i !== tr) return i;
|
|
1113
1113
|
}
|
|
1114
1114
|
if (r && !n) {
|
|
1115
|
-
let e =
|
|
1115
|
+
let e = Kr(r, t);
|
|
1116
1116
|
if (e !== void 0) return e;
|
|
1117
1117
|
}
|
|
1118
1118
|
let i = {
|
|
@@ -1121,22 +1121,22 @@ function H(e, t, n = !1) {
|
|
|
1121
1121
|
jsonSchema: void 0
|
|
1122
1122
|
};
|
|
1123
1123
|
t.seen.set(e, i);
|
|
1124
|
-
let a =
|
|
1125
|
-
if (o &&
|
|
1124
|
+
let a = Wr(e, e.typeName, t), o = typeof a == "function" ? V(a(), t) : a;
|
|
1125
|
+
if (o && qr(e, t, o), t.postProcess) {
|
|
1126
1126
|
let n = t.postProcess(o, e, t);
|
|
1127
1127
|
return i.jsonSchema = o, n;
|
|
1128
1128
|
}
|
|
1129
1129
|
return i.jsonSchema = o, o;
|
|
1130
1130
|
}
|
|
1131
|
-
var
|
|
1131
|
+
var Kr = (e, t) => {
|
|
1132
1132
|
switch (t.$refStrategy) {
|
|
1133
1133
|
case "root": return { $ref: e.path.join("/") };
|
|
1134
|
-
case "relative": return { $ref:
|
|
1134
|
+
case "relative": return { $ref: Gr(t.currentPath, e.path) };
|
|
1135
1135
|
case "none":
|
|
1136
|
-
case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),
|
|
1136
|
+
case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), L()) : t.$refStrategy === "seen" ? L() : void 0;
|
|
1137
1137
|
}
|
|
1138
|
-
},
|
|
1139
|
-
let t =
|
|
1138
|
+
}, qr = (e, t, n) => (e.description && (n.description = e.description), n), Jr = (e) => {
|
|
1139
|
+
let t = rr(e), n = t.name === void 0 ? t.basePath : [
|
|
1140
1140
|
...t.basePath,
|
|
1141
1141
|
t.definitionPath,
|
|
1142
1142
|
t.name
|
|
@@ -1155,25 +1155,25 @@ var Gr = (e, t) => {
|
|
|
1155
1155
|
jsonSchema: void 0
|
|
1156
1156
|
}]))
|
|
1157
1157
|
};
|
|
1158
|
-
},
|
|
1159
|
-
let n =
|
|
1158
|
+
}, Yr = (e, t) => {
|
|
1159
|
+
let n = Jr(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1160
1160
|
...e,
|
|
1161
|
-
[t]:
|
|
1161
|
+
[t]: V(r._def, {
|
|
1162
1162
|
...n,
|
|
1163
1163
|
currentPath: [
|
|
1164
1164
|
...n.basePath,
|
|
1165
1165
|
n.definitionPath,
|
|
1166
1166
|
t
|
|
1167
1167
|
]
|
|
1168
|
-
}, !0) ??
|
|
1169
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1168
|
+
}, !0) ?? L()
|
|
1169
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = V(e._def, i === void 0 ? n : {
|
|
1170
1170
|
...n,
|
|
1171
1171
|
currentPath: [
|
|
1172
1172
|
...n.basePath,
|
|
1173
1173
|
n.definitionPath,
|
|
1174
1174
|
i
|
|
1175
1175
|
]
|
|
1176
|
-
}, !1) ??
|
|
1176
|
+
}, !1) ?? L(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1177
1177
|
o !== void 0 && (a.title = o);
|
|
1178
1178
|
let s = i === void 0 ? r ? {
|
|
1179
1179
|
...a,
|
|
@@ -1190,14 +1190,14 @@ var Gr = (e, t) => {
|
|
|
1190
1190
|
}
|
|
1191
1191
|
};
|
|
1192
1192
|
return s.$schema = "http://json-schema.org/draft-07/schema#", s;
|
|
1193
|
-
},
|
|
1194
|
-
function
|
|
1193
|
+
}, Xr = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
|
|
1194
|
+
function Zr(e) {
|
|
1195
1195
|
let t;
|
|
1196
1196
|
return () => (t ??= e(), t);
|
|
1197
1197
|
}
|
|
1198
|
-
function
|
|
1198
|
+
function Qr(e, { validate: t } = {}) {
|
|
1199
1199
|
return {
|
|
1200
|
-
[
|
|
1200
|
+
[Xr]: !0,
|
|
1201
1201
|
_type: void 0,
|
|
1202
1202
|
get jsonSchema() {
|
|
1203
1203
|
return typeof e == "function" && (e = e()), e;
|
|
@@ -1205,20 +1205,20 @@ function Zr(e, { validate: t } = {}) {
|
|
|
1205
1205
|
validate: t
|
|
1206
1206
|
};
|
|
1207
1207
|
}
|
|
1208
|
-
function Qr(e) {
|
|
1209
|
-
return typeof e == "object" && !!e && Yr in e && e[Yr] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1210
|
-
}
|
|
1211
1208
|
function $r(e) {
|
|
1212
|
-
return e ==
|
|
1209
|
+
return typeof e == "object" && !!e && Xr in e && e[Xr] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1210
|
+
}
|
|
1211
|
+
function ei(e) {
|
|
1212
|
+
return e == null ? Qr({
|
|
1213
1213
|
type: "object",
|
|
1214
1214
|
properties: {},
|
|
1215
1215
|
additionalProperties: !1
|
|
1216
|
-
}) :
|
|
1216
|
+
}) : $r(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? oi(e) : ti(e) : e();
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1219
|
-
return
|
|
1220
|
-
if (!
|
|
1221
|
-
return
|
|
1218
|
+
function ti(e) {
|
|
1219
|
+
return Qr(() => {
|
|
1220
|
+
if (!ni(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1221
|
+
return er(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1222
1222
|
}, { validate: async (t) => {
|
|
1223
1223
|
let n = await e["~standard"].validate(t);
|
|
1224
1224
|
return "value" in n ? {
|
|
@@ -1226,19 +1226,19 @@ function ei(e) {
|
|
|
1226
1226
|
value: n.value
|
|
1227
1227
|
} : {
|
|
1228
1228
|
success: !1,
|
|
1229
|
-
error: new
|
|
1229
|
+
error: new P({
|
|
1230
1230
|
value: t,
|
|
1231
1231
|
cause: n.issues
|
|
1232
1232
|
})
|
|
1233
1233
|
};
|
|
1234
1234
|
} });
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1236
|
+
function ni(e) {
|
|
1237
1237
|
return e["~standard"].jsonSchema != null;
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1239
|
+
function ri(e, t) {
|
|
1240
1240
|
let n = t?.useReferences ?? !1;
|
|
1241
|
-
return
|
|
1241
|
+
return Qr(() => Yr(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
|
|
1242
1242
|
let n = await e.safeParseAsync(t);
|
|
1243
1243
|
return n.success ? {
|
|
1244
1244
|
success: !0,
|
|
@@ -1249,14 +1249,14 @@ function ni(e, t) {
|
|
|
1249
1249
|
};
|
|
1250
1250
|
} });
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1252
|
+
function ii(e, t) {
|
|
1253
1253
|
let n = t?.useReferences ?? !1;
|
|
1254
|
-
return
|
|
1254
|
+
return Qr(() => er(it(e, {
|
|
1255
1255
|
target: "draft-7",
|
|
1256
1256
|
io: "input",
|
|
1257
1257
|
reused: n ? "ref" : "inline"
|
|
1258
1258
|
})), { validate: async (t) => {
|
|
1259
|
-
let n = await
|
|
1259
|
+
let n = await at(e, t);
|
|
1260
1260
|
return n.success ? {
|
|
1261
1261
|
success: !0,
|
|
1262
1262
|
value: n.data
|
|
@@ -1266,27 +1266,27 @@ function ri(e, t) {
|
|
|
1266
1266
|
};
|
|
1267
1267
|
} });
|
|
1268
1268
|
}
|
|
1269
|
-
function
|
|
1269
|
+
function ai(e) {
|
|
1270
1270
|
return "_zod" in e;
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1273
|
-
return
|
|
1272
|
+
function oi(e, t) {
|
|
1273
|
+
return ai(e) ? ii(e, t) : ri(e, t);
|
|
1274
1274
|
}
|
|
1275
|
-
async function
|
|
1276
|
-
let r = await
|
|
1275
|
+
async function si({ value: e, schema: t, context: n }) {
|
|
1276
|
+
let r = await ci({
|
|
1277
1277
|
value: e,
|
|
1278
1278
|
schema: t,
|
|
1279
1279
|
context: n
|
|
1280
1280
|
});
|
|
1281
|
-
if (!r.success) throw
|
|
1281
|
+
if (!r.success) throw P.wrap({
|
|
1282
1282
|
value: e,
|
|
1283
1283
|
cause: r.error,
|
|
1284
1284
|
context: n
|
|
1285
1285
|
});
|
|
1286
1286
|
return r.value;
|
|
1287
1287
|
}
|
|
1288
|
-
async function
|
|
1289
|
-
let r =
|
|
1288
|
+
async function ci({ value: e, schema: t, context: n }) {
|
|
1289
|
+
let r = ei(t);
|
|
1290
1290
|
try {
|
|
1291
1291
|
if (r.validate == null) return {
|
|
1292
1292
|
success: !0,
|
|
@@ -1300,7 +1300,7 @@ async function si({ value: e, schema: t, context: n }) {
|
|
|
1300
1300
|
rawValue: e
|
|
1301
1301
|
} : {
|
|
1302
1302
|
success: !1,
|
|
1303
|
-
error:
|
|
1303
|
+
error: P.wrap({
|
|
1304
1304
|
value: e,
|
|
1305
1305
|
cause: t.error,
|
|
1306
1306
|
context: n
|
|
@@ -1310,7 +1310,7 @@ async function si({ value: e, schema: t, context: n }) {
|
|
|
1310
1310
|
} catch (t) {
|
|
1311
1311
|
return {
|
|
1312
1312
|
success: !1,
|
|
1313
|
-
error:
|
|
1313
|
+
error: P.wrap({
|
|
1314
1314
|
value: e,
|
|
1315
1315
|
cause: t,
|
|
1316
1316
|
context: n
|
|
@@ -1319,21 +1319,21 @@ async function si({ value: e, schema: t, context: n }) {
|
|
|
1319
1319
|
};
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
-
async function
|
|
1322
|
+
async function li({ text: e, schema: t }) {
|
|
1323
1323
|
try {
|
|
1324
|
-
let n =
|
|
1324
|
+
let n = $n(e);
|
|
1325
1325
|
return t == null ? {
|
|
1326
1326
|
success: !0,
|
|
1327
1327
|
value: n,
|
|
1328
1328
|
rawValue: n
|
|
1329
|
-
} : await
|
|
1329
|
+
} : await ci({
|
|
1330
1330
|
value: n,
|
|
1331
1331
|
schema: t
|
|
1332
1332
|
});
|
|
1333
1333
|
} catch (t) {
|
|
1334
1334
|
return {
|
|
1335
1335
|
success: !1,
|
|
1336
|
-
error:
|
|
1336
|
+
error: Cn.isInstance(t) ? t : new Cn({
|
|
1337
1337
|
text: e,
|
|
1338
1338
|
cause: t
|
|
1339
1339
|
}),
|
|
@@ -1341,15 +1341,15 @@ async function ci({ text: e, schema: t }) {
|
|
|
1341
1341
|
};
|
|
1342
1342
|
}
|
|
1343
1343
|
}
|
|
1344
|
-
function
|
|
1345
|
-
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new
|
|
1346
|
-
e !== "[DONE]" && n.enqueue(await
|
|
1344
|
+
function ui({ stream: e, schema: t }) {
|
|
1345
|
+
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new Un()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1346
|
+
e !== "[DONE]" && n.enqueue(await li({
|
|
1347
1347
|
text: e,
|
|
1348
1348
|
schema: t
|
|
1349
1349
|
}));
|
|
1350
1350
|
} }));
|
|
1351
1351
|
}
|
|
1352
|
-
async function
|
|
1352
|
+
async function H(e) {
|
|
1353
1353
|
return typeof e == "function" && (e = e()), Promise.resolve(e);
|
|
1354
1354
|
}
|
|
1355
1355
|
new TextDecoder();
|
|
@@ -1358,7 +1358,7 @@ var di = Object.defineProperty, fi = (e, t) => {
|
|
|
1358
1358
|
get: t[n],
|
|
1359
1359
|
enumerable: !0
|
|
1360
1360
|
});
|
|
1361
|
-
}, pi = "AI_InvalidArgumentError", mi = `vercel.ai.error.${pi}`, hi = Symbol.for(mi), gi, _i, vi = class extends (_i =
|
|
1361
|
+
}, pi = "AI_InvalidArgumentError", mi = `vercel.ai.error.${pi}`, hi = Symbol.for(mi), gi, _i, vi = class extends (_i = N, gi = hi, _i) {
|
|
1362
1362
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1363
1363
|
super({
|
|
1364
1364
|
name: pi,
|
|
@@ -1366,9 +1366,9 @@ var di = Object.defineProperty, fi = (e, t) => {
|
|
|
1366
1366
|
}), this[gi] = !0, this.parameter = e, this.value = t;
|
|
1367
1367
|
}
|
|
1368
1368
|
static isInstance(e) {
|
|
1369
|
-
return
|
|
1369
|
+
return N.hasMarker(e, mi);
|
|
1370
1370
|
}
|
|
1371
|
-
}, yi = "AI_NoObjectGeneratedError", bi = `vercel.ai.error.${yi}`, xi = Symbol.for(bi), Si, Ci, U = class extends (Ci =
|
|
1371
|
+
}, yi = "AI_NoObjectGeneratedError", bi = `vercel.ai.error.${yi}`, xi = Symbol.for(bi), Si, Ci, U = class extends (Ci = N, Si = xi, Ci) {
|
|
1372
1372
|
constructor({ message: e = "No object generated.", cause: t, text: n, response: r, usage: i, finishReason: a }) {
|
|
1373
1373
|
super({
|
|
1374
1374
|
name: yi,
|
|
@@ -1377,9 +1377,9 @@ var di = Object.defineProperty, fi = (e, t) => {
|
|
|
1377
1377
|
}), this[Si] = !0, this.text = n, this.response = r, this.usage = i, this.finishReason = a;
|
|
1378
1378
|
}
|
|
1379
1379
|
static isInstance(e) {
|
|
1380
|
-
return
|
|
1380
|
+
return N.hasMarker(e, bi);
|
|
1381
1381
|
}
|
|
1382
|
-
}, wi = "AI_UIMessageStreamError", Ti = `vercel.ai.error.${wi}`, Ei = Symbol.for(Ti), Di, Oi, ki = class extends (Oi =
|
|
1382
|
+
}, wi = "AI_UIMessageStreamError", Ti = `vercel.ai.error.${wi}`, Ei = Symbol.for(Ti), Di, Oi, ki = class extends (Oi = N, Di = Ei, Oi) {
|
|
1383
1383
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1384
1384
|
super({
|
|
1385
1385
|
name: wi,
|
|
@@ -1387,7 +1387,7 @@ var di = Object.defineProperty, fi = (e, t) => {
|
|
|
1387
1387
|
}), this[Di] = !0, this.chunkType = e, this.chunkId = t;
|
|
1388
1388
|
}
|
|
1389
1389
|
static isInstance(e) {
|
|
1390
|
-
return
|
|
1390
|
+
return N.hasMarker(e, Ti);
|
|
1391
1391
|
}
|
|
1392
1392
|
};
|
|
1393
1393
|
function Ai({ warning: e, provider: t, model: n }) {
|
|
@@ -1446,23 +1446,23 @@ function Fi(e, t) {
|
|
|
1446
1446
|
return n;
|
|
1447
1447
|
}
|
|
1448
1448
|
var W = {
|
|
1449
|
-
array:
|
|
1450
|
-
boolean:
|
|
1451
|
-
custom:
|
|
1452
|
-
discriminatedUnion:
|
|
1453
|
-
enum:
|
|
1454
|
-
instanceof:
|
|
1455
|
-
lazy:
|
|
1456
|
-
literal:
|
|
1457
|
-
looseObject:
|
|
1458
|
-
never:
|
|
1459
|
-
null:
|
|
1460
|
-
number:
|
|
1461
|
-
object:
|
|
1462
|
-
record:
|
|
1463
|
-
string:
|
|
1464
|
-
union:
|
|
1465
|
-
unknown:
|
|
1449
|
+
array: Je,
|
|
1450
|
+
boolean: ct,
|
|
1451
|
+
custom: rt,
|
|
1452
|
+
discriminatedUnion: Ye,
|
|
1453
|
+
enum: ut,
|
|
1454
|
+
instanceof: ot,
|
|
1455
|
+
lazy: et,
|
|
1456
|
+
literal: st,
|
|
1457
|
+
looseObject: Ke,
|
|
1458
|
+
never: Qe,
|
|
1459
|
+
null: lt,
|
|
1460
|
+
number: $e,
|
|
1461
|
+
object: tt,
|
|
1462
|
+
record: Xe,
|
|
1463
|
+
string: Ze,
|
|
1464
|
+
union: dt,
|
|
1465
|
+
unknown: qe
|
|
1466
1466
|
}, Ii = W.lazy(() => W.union([
|
|
1467
1467
|
W.null(),
|
|
1468
1468
|
W.string(),
|
|
@@ -1474,7 +1474,7 @@ var W = {
|
|
|
1474
1474
|
W.string(),
|
|
1475
1475
|
W.instanceof(Uint8Array),
|
|
1476
1476
|
W.instanceof(ArrayBuffer),
|
|
1477
|
-
W.custom(
|
|
1477
|
+
W.custom(Jn, { message: "Must be a Buffer" })
|
|
1478
1478
|
]), Ri = W.record(W.string(), W.string()), zi = W.object({
|
|
1479
1479
|
type: W.literal("text"),
|
|
1480
1480
|
text: W.string(),
|
|
@@ -1882,11 +1882,11 @@ async function ra(e) {
|
|
|
1882
1882
|
value: void 0,
|
|
1883
1883
|
state: "undefined-input"
|
|
1884
1884
|
};
|
|
1885
|
-
let t = await
|
|
1885
|
+
let t = await li({ text: e });
|
|
1886
1886
|
return t.success ? {
|
|
1887
1887
|
value: t.value,
|
|
1888
1888
|
state: "successful-parse"
|
|
1889
|
-
} : (t = await
|
|
1889
|
+
} : (t = await li({ text: na(e) }), t.success ? {
|
|
1890
1890
|
value: t.value,
|
|
1891
1891
|
state: "repaired-parse"
|
|
1892
1892
|
} : {
|
|
@@ -1905,17 +1905,17 @@ var ia = () => ({
|
|
|
1905
1905
|
},
|
|
1906
1906
|
createElementStreamTransform() {}
|
|
1907
1907
|
}), aa = ({ schema: e, name: t, description: n }) => {
|
|
1908
|
-
let r =
|
|
1908
|
+
let r = ei(e);
|
|
1909
1909
|
return {
|
|
1910
1910
|
name: "object",
|
|
1911
|
-
responseFormat:
|
|
1911
|
+
responseFormat: H(r.jsonSchema).then((e) => ({
|
|
1912
1912
|
type: "json",
|
|
1913
1913
|
schema: e,
|
|
1914
1914
|
...t != null && { name: t },
|
|
1915
1915
|
...n != null && { description: n }
|
|
1916
1916
|
})),
|
|
1917
1917
|
async parseCompleteOutput({ text: e }, t) {
|
|
1918
|
-
let n = await
|
|
1918
|
+
let n = await li({ text: e });
|
|
1919
1919
|
if (!n.success) throw new U({
|
|
1920
1920
|
message: "No object generated: could not parse the response.",
|
|
1921
1921
|
cause: n.error,
|
|
@@ -1924,7 +1924,7 @@ var ia = () => ({
|
|
|
1924
1924
|
usage: t.usage,
|
|
1925
1925
|
finishReason: t.finishReason
|
|
1926
1926
|
});
|
|
1927
|
-
let i = await
|
|
1927
|
+
let i = await ci({
|
|
1928
1928
|
value: n.value,
|
|
1929
1929
|
schema: r
|
|
1930
1930
|
});
|
|
@@ -1961,10 +1961,10 @@ var ia = () => ({
|
|
|
1961
1961
|
value: t,
|
|
1962
1962
|
message: "minItems must be less than or equal to maxItems"
|
|
1963
1963
|
});
|
|
1964
|
-
let a =
|
|
1964
|
+
let a = ei(e);
|
|
1965
1965
|
return {
|
|
1966
1966
|
name: "array",
|
|
1967
|
-
responseFormat:
|
|
1967
|
+
responseFormat: H(a.jsonSchema).then((e) => {
|
|
1968
1968
|
let { $schema: a, definitions: o, $defs: s, ...c } = e;
|
|
1969
1969
|
return {
|
|
1970
1970
|
type: "json",
|
|
@@ -1987,7 +1987,7 @@ var ia = () => ({
|
|
|
1987
1987
|
};
|
|
1988
1988
|
}),
|
|
1989
1989
|
async parseCompleteOutput({ text: e }, r) {
|
|
1990
|
-
let i = await
|
|
1990
|
+
let i = await li({ text: e });
|
|
1991
1991
|
if (!i.success) throw new U({
|
|
1992
1992
|
message: "No object generated: could not parse the response.",
|
|
1993
1993
|
cause: i.error,
|
|
@@ -1999,7 +1999,7 @@ var ia = () => ({
|
|
|
1999
1999
|
let o = i.value;
|
|
2000
2000
|
if (typeof o != "object" || !o || !("elements" in o) || !Array.isArray(o.elements)) throw new U({
|
|
2001
2001
|
message: "No object generated: response did not match schema.",
|
|
2002
|
-
cause: new
|
|
2002
|
+
cause: new P({
|
|
2003
2003
|
value: o,
|
|
2004
2004
|
cause: "response must be an object with an elements array"
|
|
2005
2005
|
}),
|
|
@@ -2023,7 +2023,7 @@ var ia = () => ({
|
|
|
2023
2023
|
});
|
|
2024
2024
|
let c = [];
|
|
2025
2025
|
for (let t of o.elements) {
|
|
2026
|
-
let n = await
|
|
2026
|
+
let n = await ci({
|
|
2027
2027
|
value: t,
|
|
2028
2028
|
schema: a
|
|
2029
2029
|
});
|
|
@@ -2050,7 +2050,7 @@ var ia = () => ({
|
|
|
2050
2050
|
if (typeof e != "object" || !e || !("elements" in e) || !Array.isArray(e.elements)) return;
|
|
2051
2051
|
let n = t.state === "repaired-parse" && e.elements.length > 0 ? e.elements.slice(0, -1) : e.elements, r = [];
|
|
2052
2052
|
for (let e of n) {
|
|
2053
|
-
let t = await
|
|
2053
|
+
let t = await ci({
|
|
2054
2054
|
value: e,
|
|
2055
2055
|
schema: a
|
|
2056
2056
|
});
|
|
@@ -2092,11 +2092,11 @@ function sa({ name: e, value: t }) {
|
|
|
2092
2092
|
}
|
|
2093
2093
|
}
|
|
2094
2094
|
function ca({ value: e, minItems: t, maxItems: n }) {
|
|
2095
|
-
if (t != null && e.length < t) return new
|
|
2095
|
+
if (t != null && e.length < t) return new P({
|
|
2096
2096
|
value: e,
|
|
2097
2097
|
cause: `elements array must contain at least ${t} items`
|
|
2098
2098
|
});
|
|
2099
|
-
if (n != null && e.length > n) return new
|
|
2099
|
+
if (n != null && e.length > n) return new P({
|
|
2100
2100
|
value: e,
|
|
2101
2101
|
cause: `elements array must contain at most ${n} items`
|
|
2102
2102
|
});
|
|
@@ -2119,7 +2119,7 @@ var la = ({ options: e, name: t, description: n }) => ({
|
|
|
2119
2119
|
...n != null && { description: n }
|
|
2120
2120
|
}),
|
|
2121
2121
|
async parseCompleteOutput({ text: t }, n) {
|
|
2122
|
-
let r = await
|
|
2122
|
+
let r = await li({ text: t });
|
|
2123
2123
|
if (!r.success) throw new U({
|
|
2124
2124
|
message: "No object generated: could not parse the response.",
|
|
2125
2125
|
cause: r.error,
|
|
@@ -2131,7 +2131,7 @@ var la = ({ options: e, name: t, description: n }) => ({
|
|
|
2131
2131
|
let i = r.value;
|
|
2132
2132
|
if (typeof i != "object" || !i || !("result" in i) || typeof i.result != "string" || !e.includes(i.result)) throw new U({
|
|
2133
2133
|
message: "No object generated: response did not match schema.",
|
|
2134
|
-
cause: new
|
|
2134
|
+
cause: new P({
|
|
2135
2135
|
value: i,
|
|
2136
2136
|
cause: "response must be an object that contains a choice value."
|
|
2137
2137
|
}),
|
|
@@ -2165,7 +2165,7 @@ var la = ({ options: e, name: t, description: n }) => ({
|
|
|
2165
2165
|
...t != null && { description: t }
|
|
2166
2166
|
}),
|
|
2167
2167
|
async parseCompleteOutput({ text: e }, t) {
|
|
2168
|
-
let n = await
|
|
2168
|
+
let n = await li({ text: e });
|
|
2169
2169
|
if (!n.success) throw new U({
|
|
2170
2170
|
message: "No object generated: could not parse the response.",
|
|
2171
2171
|
cause: n.error,
|
|
@@ -2187,10 +2187,10 @@ var la = ({ options: e, name: t, description: n }) => ({
|
|
|
2187
2187
|
},
|
|
2188
2188
|
createElementStreamTransform() {}
|
|
2189
2189
|
});
|
|
2190
|
-
new TextEncoder(), new TextEncoder(),
|
|
2190
|
+
new TextEncoder(), new TextEncoder(), F({
|
|
2191
2191
|
prefix: "aitxt",
|
|
2192
2192
|
size: 24
|
|
2193
|
-
}),
|
|
2193
|
+
}), F({
|
|
2194
2194
|
prefix: "call",
|
|
2195
2195
|
size: 24
|
|
2196
2196
|
});
|
|
@@ -2231,7 +2231,7 @@ function ma({ status: e, statusText: t, headers: n, stream: r, consumeSseStream:
|
|
|
2231
2231
|
headers: da(n, pa)
|
|
2232
2232
|
});
|
|
2233
2233
|
}
|
|
2234
|
-
var ha = W.record(W.string(), Ii.optional()), ga =
|
|
2234
|
+
var ha = W.record(W.string(), Ii.optional()), ga = Zr(() => oi(W.union([
|
|
2235
2235
|
W.looseObject({
|
|
2236
2236
|
type: W.literal("text-start"),
|
|
2237
2237
|
id: W.string(),
|
|
@@ -2548,7 +2548,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2548
2548
|
async function h(e) {
|
|
2549
2549
|
if (e != null) {
|
|
2550
2550
|
let n = r.message.metadata == null ? e : Fi(r.message.metadata, e);
|
|
2551
|
-
t != null && await
|
|
2551
|
+
t != null && await si({
|
|
2552
2552
|
value: n,
|
|
2553
2553
|
schema: t,
|
|
2554
2554
|
context: {
|
|
@@ -2861,7 +2861,7 @@ function Ta({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2861
2861
|
default: if (_a(e)) {
|
|
2862
2862
|
if (n?.[e.type] != null) {
|
|
2863
2863
|
let t = r.message.parts.findIndex((t) => "id" in t && "data" in t && t.id === e.id && t.type === e.type), i = t >= 0 ? t : r.message.parts.length;
|
|
2864
|
-
await
|
|
2864
|
+
await si({
|
|
2865
2865
|
value: e.data,
|
|
2866
2866
|
schema: n[e.type],
|
|
2867
2867
|
context: {
|
|
@@ -2900,25 +2900,25 @@ async function Ea({ stream: e, onError: t, abortSignal: n }) {
|
|
|
2900
2900
|
n?.removeEventListener("abort", i), r.releaseLock();
|
|
2901
2901
|
}
|
|
2902
2902
|
}
|
|
2903
|
-
|
|
2903
|
+
F({
|
|
2904
2904
|
prefix: "aitxt",
|
|
2905
2905
|
size: 24
|
|
2906
|
-
}),
|
|
2906
|
+
}), F({
|
|
2907
2907
|
prefix: "call",
|
|
2908
2908
|
size: 24
|
|
2909
|
-
}),
|
|
2909
|
+
}), F({
|
|
2910
2910
|
prefix: "aitxt",
|
|
2911
2911
|
size: 24
|
|
2912
|
-
}),
|
|
2912
|
+
}), F({
|
|
2913
2913
|
prefix: "call",
|
|
2914
2914
|
size: 24
|
|
2915
|
-
}), W.record(W.string(), Ii.optional()), W.record(W.string(), W.string()),
|
|
2915
|
+
}), W.record(W.string(), Ii.optional()), W.record(W.string(), W.string()), F({
|
|
2916
2916
|
prefix: "call",
|
|
2917
2917
|
size: 24
|
|
2918
|
-
}),
|
|
2918
|
+
}), F({
|
|
2919
2919
|
prefix: "call",
|
|
2920
2920
|
size: 24
|
|
2921
|
-
}), new TextEncoder(),
|
|
2921
|
+
}), new TextEncoder(), F({
|
|
2922
2922
|
prefix: "aiobj",
|
|
2923
2923
|
size: 24
|
|
2924
2924
|
});
|
|
@@ -2944,7 +2944,7 @@ var { atob: Da } = globalThis, Oa = class {
|
|
|
2944
2944
|
});
|
|
2945
2945
|
}
|
|
2946
2946
|
};
|
|
2947
|
-
|
|
2947
|
+
F({
|
|
2948
2948
|
prefix: "aiobj",
|
|
2949
2949
|
size: 24
|
|
2950
2950
|
}), W.object({
|
|
@@ -2964,13 +2964,13 @@ I({
|
|
|
2964
2964
|
description: W.string().optional(),
|
|
2965
2965
|
parameters: W.record(W.string(), W.unknown())
|
|
2966
2966
|
})).optional()
|
|
2967
|
-
}),
|
|
2967
|
+
}), F({
|
|
2968
2968
|
prefix: "call",
|
|
2969
2969
|
size: 24
|
|
2970
2970
|
});
|
|
2971
2971
|
async function ka({ response: e, url: t, fallbackMessage: n }) {
|
|
2972
2972
|
let r = await e.text();
|
|
2973
|
-
return new
|
|
2973
|
+
return new rn({
|
|
2974
2974
|
message: r || n,
|
|
2975
2975
|
url: t,
|
|
2976
2976
|
requestBodyValues: void 0,
|
|
@@ -2980,7 +2980,7 @@ async function ka({ response: e, url: t, fallbackMessage: n }) {
|
|
|
2980
2980
|
}
|
|
2981
2981
|
async function Aa(e) {
|
|
2982
2982
|
if (e == null) return [];
|
|
2983
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
2983
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Pn({
|
|
2984
2984
|
functionality: "FileList",
|
|
2985
2985
|
message: "FileList is not supported in the current environment"
|
|
2986
2986
|
});
|
|
@@ -3008,9 +3008,9 @@ var Ma = class {
|
|
|
3008
3008
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
3009
3009
|
}
|
|
3010
3010
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
3011
|
-
let n = await
|
|
3012
|
-
...
|
|
3013
|
-
...
|
|
3011
|
+
let n = await H(this.body), r = await H(this.headers), i = await H(this.credentials), a = {
|
|
3012
|
+
...Kn(r),
|
|
3013
|
+
...Kn(t.headers)
|
|
3014
3014
|
}, o = await this.prepareSendMessagesRequest?.call(this, {
|
|
3015
3015
|
api: this.api,
|
|
3016
3016
|
id: t.chatId,
|
|
@@ -3024,7 +3024,7 @@ var Ma = class {
|
|
|
3024
3024
|
requestMetadata: t.metadata,
|
|
3025
3025
|
trigger: t.trigger,
|
|
3026
3026
|
messageId: t.messageId
|
|
3027
|
-
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a :
|
|
3027
|
+
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : Kn(o.headers), l = o?.body === void 0 ? {
|
|
3028
3028
|
...n,
|
|
3029
3029
|
...t.body,
|
|
3030
3030
|
id: t.chatId,
|
|
@@ -3046,13 +3046,13 @@ var Ma = class {
|
|
|
3046
3046
|
url: s,
|
|
3047
3047
|
fallbackMessage: "Failed to fetch the chat response."
|
|
3048
3048
|
});
|
|
3049
|
-
if (!d.body) throw new
|
|
3049
|
+
if (!d.body) throw new un({ message: "The response body is empty." });
|
|
3050
3050
|
return this.processResponseStream(d.body);
|
|
3051
3051
|
}
|
|
3052
3052
|
async reconnectToStream(e) {
|
|
3053
|
-
let t = await
|
|
3054
|
-
...
|
|
3055
|
-
...
|
|
3053
|
+
let t = await H(this.body), n = await H(this.headers), r = await H(this.credentials), i = {
|
|
3054
|
+
...Kn(n),
|
|
3055
|
+
...Kn(e.headers)
|
|
3056
3056
|
}, a = await this.prepareReconnectToStreamRequest?.call(this, {
|
|
3057
3057
|
api: this.api,
|
|
3058
3058
|
id: e.chatId,
|
|
@@ -3063,7 +3063,7 @@ var Ma = class {
|
|
|
3063
3063
|
headers: i,
|
|
3064
3064
|
credentials: r,
|
|
3065
3065
|
requestMetadata: e.metadata
|
|
3066
|
-
}), o = a?.api ?? ja(this.api, `/${e.chatId}/stream`), s = a?.headers === void 0 ? i :
|
|
3066
|
+
}), o = a?.api ?? ja(this.api, `/${e.chatId}/stream`), s = a?.headers === void 0 ? i : Kn(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
3067
3067
|
method: "GET",
|
|
3068
3068
|
headers: s,
|
|
3069
3069
|
credentials: c,
|
|
@@ -3075,7 +3075,7 @@ var Ma = class {
|
|
|
3075
3075
|
url: o,
|
|
3076
3076
|
fallbackMessage: "Failed to fetch the chat response."
|
|
3077
3077
|
});
|
|
3078
|
-
if (!l.body) throw new
|
|
3078
|
+
if (!l.body) throw new un({ message: "The response body is empty." });
|
|
3079
3079
|
return this.processResponseStream(l.body);
|
|
3080
3080
|
}
|
|
3081
3081
|
}, Na = class extends Ma {
|
|
@@ -3083,7 +3083,7 @@ var Ma = class {
|
|
|
3083
3083
|
super(e);
|
|
3084
3084
|
}
|
|
3085
3085
|
processResponseStream(e) {
|
|
3086
|
-
return
|
|
3086
|
+
return ui({
|
|
3087
3087
|
stream: e,
|
|
3088
3088
|
schema: ga
|
|
3089
3089
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
@@ -3092,7 +3092,7 @@ var Ma = class {
|
|
|
3092
3092
|
} }));
|
|
3093
3093
|
}
|
|
3094
3094
|
}, Pa = class {
|
|
3095
|
-
constructor({ generateId: e =
|
|
3095
|
+
constructor({ generateId: e = qn, id: t = e(), transport: n = new Na(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
|
|
3096
3096
|
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.jobExecutor = new Oa(), this.sendMessage = async (e, t) => {
|
|
3097
3097
|
if (e == null) {
|
|
3098
3098
|
await this.makeRequest({
|
|
@@ -3375,7 +3375,7 @@ var La = /* @__PURE__ */ t(((e, t) => {
|
|
|
3375
3375
|
};
|
|
3376
3376
|
}
|
|
3377
3377
|
t.exports = n;
|
|
3378
|
-
})), q = /* @__PURE__ */ e(o(), 1), Ra = /* @__PURE__ */ e(La(), 1), J =
|
|
3378
|
+
})), q = /* @__PURE__ */ e(o(), 1), Ra = /* @__PURE__ */ e(La(), 1), J = Ge(), za = (e, t, n) => {
|
|
3379
3379
|
if (!t.has(e)) throw TypeError("Cannot " + n);
|
|
3380
3380
|
}, Y = (e, t, n) => (za(e, t, "read from private field"), n ? n.call(e) : t.get(e)), X = (e, t, n) => {
|
|
3381
3381
|
if (t.has(e)) throw TypeError("Cannot add the same private member more than once");
|
|
@@ -3575,8 +3575,8 @@ var oo = class extends w {
|
|
|
3575
3575
|
super(), this.store = e;
|
|
3576
3576
|
}
|
|
3577
3577
|
getItems() {
|
|
3578
|
-
let e = this.store.get(
|
|
3579
|
-
for (let n of e.cellIds
|
|
3578
|
+
let e = this.store.get(ye), t = [];
|
|
3579
|
+
for (let n of e.cellIds) {
|
|
3580
3580
|
let r = lo(n, e), i = r.cellOutput;
|
|
3581
3581
|
if (!i) continue;
|
|
3582
3582
|
let a = i.output.mimetype || "unknown";
|
|
@@ -3653,7 +3653,7 @@ async function so(e, t, n) {
|
|
|
3653
3653
|
let i = e.filter((e) => e.shouldDownloadImage && e.outputType === "media");
|
|
3654
3654
|
if (i.length === 0) return [];
|
|
3655
3655
|
let a = i.flatMap((e) => {
|
|
3656
|
-
let i = document.getElementById(
|
|
3656
|
+
let i = document.getElementById(Ee.create(t));
|
|
3657
3657
|
return i ? {
|
|
3658
3658
|
cellId: t,
|
|
3659
3659
|
cellName: n,
|
|
@@ -3666,7 +3666,7 @@ async function so(e, t, n) {
|
|
|
3666
3666
|
type: "file",
|
|
3667
3667
|
filename: `${n}-output-screenshot`,
|
|
3668
3668
|
mediaType: "image/png",
|
|
3669
|
-
url: await
|
|
3669
|
+
url: await ee(e.element)
|
|
3670
3670
|
})));
|
|
3671
3671
|
} catch (e) {
|
|
3672
3672
|
return r.error("Error downloading cell output images:", e), [];
|
|
@@ -3674,7 +3674,7 @@ async function so(e, t, n) {
|
|
|
3674
3674
|
}
|
|
3675
3675
|
function co(e) {
|
|
3676
3676
|
if (b(e)) return null;
|
|
3677
|
-
let t = e.mimetype, n = ao(t, String(e.data)) ? "media" : "text", r =
|
|
3677
|
+
let t = e.mimetype, n = ao(t, String(e.data)) ? "media" : "text", r = Ue(e), i, a = !1;
|
|
3678
3678
|
return n === "media" && (typeof e.data == "string" && e.data.startsWith("data:") || typeof e.data == "string" && e.data.startsWith("http") ? i = e.data : a = !0), {
|
|
3679
3679
|
processedContent: r,
|
|
3680
3680
|
imageUrl: i,
|
|
@@ -3684,7 +3684,7 @@ function co(e) {
|
|
|
3684
3684
|
};
|
|
3685
3685
|
}
|
|
3686
3686
|
function lo(e, t, n) {
|
|
3687
|
-
let { includeConsoleOutput: r = !1 } = n || {}, i = t.cellRuntime[e], a = t.cellData[e], o = t.cellIds.
|
|
3687
|
+
let { includeConsoleOutput: r = !1 } = n || {}, i = t.cellRuntime[e], a = t.cellData[e], o = t.cellIds.indexOf(e), s = ce(a.name, o), c;
|
|
3688
3688
|
r && (c = i.consoleOutputs.map((e) => co(e)).filter((e) => e !== null));
|
|
3689
3689
|
let l, u = i.output;
|
|
3690
3690
|
return u && !b(u) && (l = co(u) ?? void 0), {
|
|
@@ -3699,8 +3699,8 @@ function lo(e, t, n) {
|
|
|
3699
3699
|
//#region src/core/ai/context/providers/error.ts
|
|
3700
3700
|
function uo(e, t) {
|
|
3701
3701
|
let n = [`Code:\n${e.cellCode}`];
|
|
3702
|
-
if (e.tracebackHtml && n.push(`Traceback:\n${
|
|
3703
|
-
let r =
|
|
3702
|
+
if (e.tracebackHtml && n.push(`Traceback:\n${fe(e.tracebackHtml)}`), e.errorData.length > 0 && n.push(e.errorData.map((e) => Se(e)).join("\n\n")), e.errorData.some((e) => e.type === "sql-error")) {
|
|
3703
|
+
let r = te(e.cellId, t);
|
|
3704
3704
|
r && n.push(`Database schema:\n${r}`);
|
|
3705
3705
|
}
|
|
3706
3706
|
return n.join("\n\n");
|
|
@@ -3716,12 +3716,12 @@ function fo(e, t) {
|
|
|
3716
3716
|
});
|
|
3717
3717
|
}
|
|
3718
3718
|
function po(e) {
|
|
3719
|
-
return e.errorData.length === 1 ?
|
|
3719
|
+
return e.errorData.length === 1 ? we(e.errorData[0]) : e.errorData.length > 1 ? `${e.errorData.length} errors` : e.tracebackHtml ? fe(e.tracebackHtml).trim().split("\n").find((e) => e.trim())?.trim() || "traceback" : "error";
|
|
3720
3720
|
}
|
|
3721
3721
|
function mo(e) {
|
|
3722
3722
|
return `Error: ${e.cellName || `Cell ${e.cellId}`}`;
|
|
3723
3723
|
}
|
|
3724
|
-
var ho = new
|
|
3724
|
+
var ho = new _e("error", "errors"), go = class extends w {
|
|
3725
3725
|
title = "Errors";
|
|
3726
3726
|
mentionPrefix = "@";
|
|
3727
3727
|
contextType = "error";
|
|
@@ -3730,7 +3730,7 @@ var ho = new pe("error", "errors"), go = class extends w {
|
|
|
3730
3730
|
super(), this.store = e;
|
|
3731
3731
|
}
|
|
3732
3732
|
getItems() {
|
|
3733
|
-
let e =
|
|
3733
|
+
let e = ge(this.store);
|
|
3734
3734
|
if (e.length === 0) return [];
|
|
3735
3735
|
let t = [{
|
|
3736
3736
|
uri: this.asURI("all"),
|
|
@@ -3917,7 +3917,7 @@ var ho = new pe("error", "errors"), go = class extends w {
|
|
|
3917
3917
|
description: e.message
|
|
3918
3918
|
}), null));
|
|
3919
3919
|
if (!l) return;
|
|
3920
|
-
let u = l.mimeType || "text/plain", d =
|
|
3920
|
+
let u = l.mimeType || "text/plain", d = We({
|
|
3921
3921
|
contents: l.contents ?? "",
|
|
3922
3922
|
mimeType: u,
|
|
3923
3923
|
isBase64: l.isBase64 ?? !1
|
|
@@ -3926,7 +3926,7 @@ var ho = new pe("error", "errors"), go = class extends w {
|
|
|
3926
3926
|
from: a,
|
|
3927
3927
|
to: o,
|
|
3928
3928
|
insert: ""
|
|
3929
|
-
} }),
|
|
3929
|
+
} }), Nt(e);
|
|
3930
3930
|
},
|
|
3931
3931
|
info: () => {
|
|
3932
3932
|
let e = document.createElement("div");
|
|
@@ -3996,10 +3996,10 @@ var ho = new pe("error", "errors"), go = class extends w {
|
|
|
3996
3996
|
displayLabel: t,
|
|
3997
3997
|
detail: n.source === "memory" ? "in-memory" : n.source,
|
|
3998
3998
|
boost: n.source_type === "local" ? S.LOCAL_TABLE : S.REMOTE_TABLE,
|
|
3999
|
-
type:
|
|
3999
|
+
type: ue(n),
|
|
4000
4000
|
apply: `@${t}`,
|
|
4001
4001
|
section: {
|
|
4002
|
-
name:
|
|
4002
|
+
name: ue(n) === "dataframe" ? "Dataframe" : "Table",
|
|
4003
4003
|
rank: O.TABLE.rank
|
|
4004
4004
|
},
|
|
4005
4005
|
info: () => this.createTableInfoElement(t, n)
|
|
@@ -4086,7 +4086,7 @@ var ho = new pe("error", "errors"), go = class extends w {
|
|
|
4086
4086
|
detail: n.dataType ?? "",
|
|
4087
4087
|
type: this.contextType,
|
|
4088
4088
|
section: O.VARIABLE,
|
|
4089
|
-
info: () =>
|
|
4089
|
+
info: () => ae(n)
|
|
4090
4090
|
};
|
|
4091
4091
|
}
|
|
4092
4092
|
formatContext(e) {
|
|
@@ -4104,11 +4104,11 @@ var ho = new pe("error", "errors"), go = class extends w {
|
|
|
4104
4104
|
//#endregion
|
|
4105
4105
|
//#region src/core/ai/context/context.ts
|
|
4106
4106
|
function So(e) {
|
|
4107
|
-
let t = e.get(
|
|
4107
|
+
let t = e.get(se), n = e.get(ie), r = e.get(me);
|
|
4108
4108
|
return new C().register(new bo(n)).register(new xo(r, n)).register(new go(e)).register(new oo(e)).register(new T(t.connectionsMap, n));
|
|
4109
4109
|
}
|
|
4110
4110
|
function Co() {
|
|
4111
|
-
return new yo(
|
|
4111
|
+
return new yo(de());
|
|
4112
4112
|
}
|
|
4113
4113
|
//#endregion
|
|
4114
4114
|
//#region src/components/editor/ai/completion-utils.ts
|
|
@@ -4128,7 +4128,7 @@ async function To(e) {
|
|
|
4128
4128
|
type: "file",
|
|
4129
4129
|
mediaType: e.type,
|
|
4130
4130
|
filename: e.name,
|
|
4131
|
-
url: await
|
|
4131
|
+
url: await He(e, "dataUrl")
|
|
4132
4132
|
})));
|
|
4133
4133
|
}
|
|
4134
4134
|
function Eo(e) {
|
|
@@ -4140,7 +4140,7 @@ function Eo(e) {
|
|
|
4140
4140
|
//#endregion
|
|
4141
4141
|
//#region src/components/chat/chat-components.tsx
|
|
4142
4142
|
var Do = (e) => {
|
|
4143
|
-
let t = (0,
|
|
4143
|
+
let t = (0, M.c)(6), { attachment: n } = e;
|
|
4144
4144
|
if (n.mediaType?.startsWith("image/")) {
|
|
4145
4145
|
let e = n.filename || "Attachment", r;
|
|
4146
4146
|
return t[0] !== n.url || t[1] !== e ? (r = /* @__PURE__ */ (0, J.jsx)("img", {
|
|
@@ -4150,14 +4150,14 @@ var Do = (e) => {
|
|
|
4150
4150
|
}), t[0] = n.url, t[1] = e, t[2] = r) : r = t[2], r;
|
|
4151
4151
|
}
|
|
4152
4152
|
let r;
|
|
4153
|
-
t[3] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ (0, J.jsx)(
|
|
4153
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ (0, J.jsx)(Be, { className: "h-3 w-3 mt-0.5" }), t[3] = r) : r = t[3];
|
|
4154
4154
|
let i = n.filename || "Attachment", a;
|
|
4155
4155
|
return t[4] === i ? a = t[5] : (a = /* @__PURE__ */ (0, J.jsxs)("div", {
|
|
4156
4156
|
className: "flex flex-row gap-1 items-center text-xs",
|
|
4157
4157
|
children: [r, i]
|
|
4158
4158
|
}), t[4] = i, t[5] = a), a;
|
|
4159
4159
|
}, Oo = (e) => {
|
|
4160
|
-
let t = (0,
|
|
4160
|
+
let t = (0, M.c)(15), { icon: n, title: r, subtitle: i, href: a } = e, o;
|
|
4161
4161
|
t[0] === r ? o = t[1] : (o = /* @__PURE__ */ (0, J.jsx)("span", {
|
|
4162
4162
|
className: "truncate font-medium",
|
|
4163
4163
|
children: r
|
|
@@ -4178,7 +4178,7 @@ var Do = (e) => {
|
|
|
4178
4178
|
s
|
|
4179
4179
|
] }), t[4] = n, t[5] = o, t[6] = s, t[7] = c) : c = t[7];
|
|
4180
4180
|
let l = c;
|
|
4181
|
-
if (a &&
|
|
4181
|
+
if (a && Re(a)) {
|
|
4182
4182
|
let e = i ?? r, n;
|
|
4183
4183
|
return t[8] !== l || t[9] !== a || t[10] !== e ? (n = /* @__PURE__ */ (0, J.jsx)("a", {
|
|
4184
4184
|
href: a,
|
|
@@ -4196,10 +4196,10 @@ var Do = (e) => {
|
|
|
4196
4196
|
children: l
|
|
4197
4197
|
}), t[12] = l, t[13] = u, t[14] = d) : d = t[14], d;
|
|
4198
4198
|
}, ko = (e) => {
|
|
4199
|
-
let t = (0,
|
|
4199
|
+
let t = (0, M.c)(13), { reasoning: n, index: r, isStreaming: i } = e, a = r === void 0 ? 0 : r, o = i !== void 0 && i, [s, c] = q.useState("");
|
|
4200
4200
|
if (!n && !o) return null;
|
|
4201
4201
|
let l = o ? "reasoning" : s, u;
|
|
4202
|
-
t[0] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ (0, J.jsx)(
|
|
4202
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ (0, J.jsx)(Bt, { className: "h-3 w-3" }), t[0] = u) : u = t[0];
|
|
4203
4203
|
let d = o ? "Thinking" : "View reasoning", f = n.length > 0 && ` (${n.length} chars)`, p;
|
|
4204
4204
|
t[1] !== d || t[2] !== f ? (p = /* @__PURE__ */ (0, J.jsx)(x, {
|
|
4205
4205
|
className: "text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",
|
|
@@ -4213,7 +4213,7 @@ var Do = (e) => {
|
|
|
4213
4213
|
})
|
|
4214
4214
|
}), t[1] = d, t[2] = f, t[3] = p) : p = t[3];
|
|
4215
4215
|
let m;
|
|
4216
|
-
t[4] === n ? m = t[5] : (m = /* @__PURE__ */ (0, J.jsx)(
|
|
4216
|
+
t[4] === n ? m = t[5] : (m = /* @__PURE__ */ (0, J.jsx)(A, {
|
|
4217
4217
|
className: "pb-2 px-2",
|
|
4218
4218
|
children: /* @__PURE__ */ (0, J.jsx)("div", {
|
|
4219
4219
|
className: "bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",
|
|
@@ -4224,7 +4224,7 @@ var Do = (e) => {
|
|
|
4224
4224
|
})
|
|
4225
4225
|
}), t[4] = n, t[5] = m);
|
|
4226
4226
|
let h;
|
|
4227
|
-
t[6] !== p || t[7] !== m ? (h = /* @__PURE__ */ (0, J.jsxs)(
|
|
4227
|
+
t[6] !== p || t[7] !== m ? (h = /* @__PURE__ */ (0, J.jsxs)(ne, {
|
|
4228
4228
|
value: "reasoning",
|
|
4229
4229
|
className: "border-0",
|
|
4230
4230
|
children: [p, m]
|
|
@@ -4247,7 +4247,7 @@ function Ao(e) {
|
|
|
4247
4247
|
//#endregion
|
|
4248
4248
|
//#region src/components/chat/tool-call/tool-args.tsx
|
|
4249
4249
|
var jo = (e) => {
|
|
4250
|
-
let t = (0,
|
|
4250
|
+
let t = (0, M.c)(9), { input: n, label: r } = e, i = r === void 0 ? "Tool Request" : r;
|
|
4251
4251
|
if (n == null) return null;
|
|
4252
4252
|
let a;
|
|
4253
4253
|
t[0] === i ? a = t[1] : (a = /* @__PURE__ */ (0, J.jsx)("h3", {
|
|
@@ -4267,12 +4267,12 @@ var jo = (e) => {
|
|
|
4267
4267
|
children: [a, s]
|
|
4268
4268
|
}), t[6] = a, t[7] = s, t[8] = c) : c = t[8], c;
|
|
4269
4269
|
}, Mo = (e) => {
|
|
4270
|
-
let t = (0,
|
|
4270
|
+
let t = (0, M.c)(27), { toolName: n, input: r, approval: o, onApprove: s, className: c } = e, l;
|
|
4271
4271
|
t[0] === c ? l = t[1] : (l = i("rounded-md border border-(--amber-6) bg-(--amber-2) p-3 space-y-3", c), t[0] = c, t[1] = l);
|
|
4272
4272
|
let u;
|
|
4273
4273
|
t[2] === n ? u = t[3] : (u = Ao(n), t[2] = n, t[3] = u);
|
|
4274
4274
|
let d = `Approval required for ${u}`, f;
|
|
4275
|
-
t[4] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ (0, J.jsx)(
|
|
4275
|
+
t[4] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ (0, J.jsx)(qt, { className: "h-4 w-4 text-(--amber-11) mt-0.5 shrink-0" }), t[4] = f) : f = t[4];
|
|
4276
4276
|
let p;
|
|
4277
4277
|
t[5] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ (0, J.jsx)("span", {
|
|
4278
4278
|
className: "font-semibold",
|
|
@@ -4333,7 +4333,7 @@ var jo = (e) => {
|
|
|
4333
4333
|
]
|
|
4334
4334
|
}), t[21] = l, t[22] = y, t[23] = d, t[24] = h, t[25] = g, t[26] = b) : b = t[26], b;
|
|
4335
4335
|
}, No = (e) => {
|
|
4336
|
-
let t = (0,
|
|
4336
|
+
let t = (0, M.c)(28), { toolName: n, input: r, errorText: a, isLive: o, className: s } = e, [c, l] = q.useState(o), u = q.useRef(o), d, f;
|
|
4337
4337
|
t[0] === o ? (d = t[1], f = t[2]) : (d = () => {
|
|
4338
4338
|
u.current && !o && l(!1), u.current = o;
|
|
4339
4339
|
}, f = [o], t[0] = o, t[1] = d, t[2] = f), q.useEffect(d, f);
|
|
@@ -4342,7 +4342,7 @@ var jo = (e) => {
|
|
|
4342
4342
|
let m;
|
|
4343
4343
|
t[5] === Symbol.for("react.memo_cache_sentinel") ? (m = () => l(Po), t[5] = m) : m = t[5];
|
|
4344
4344
|
let h;
|
|
4345
|
-
t[6] === Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ (0, J.jsx)(
|
|
4345
|
+
t[6] === Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ (0, J.jsx)(pe, { className: "h-3.5 w-3.5 shrink-0" }), t[6] = h) : h = t[6];
|
|
4346
4346
|
let g;
|
|
4347
4347
|
t[7] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ (0, J.jsx)("span", {
|
|
4348
4348
|
className: "font-semibold",
|
|
@@ -4365,7 +4365,7 @@ var jo = (e) => {
|
|
|
4365
4365
|
let y = c && "rotate-180", b;
|
|
4366
4366
|
t[12] === y ? b = t[13] : (b = i("h-3.5 w-3.5 shrink-0 transition-transform", y), t[12] = y, t[13] = b);
|
|
4367
4367
|
let x;
|
|
4368
|
-
t[14] === b ? x = t[15] : (x = /* @__PURE__ */ (0, J.jsx)(
|
|
4368
|
+
t[14] === b ? x = t[15] : (x = /* @__PURE__ */ (0, J.jsx)(ke, { className: b }), t[14] = b, t[15] = x);
|
|
4369
4369
|
let S;
|
|
4370
4370
|
t[16] !== c || t[17] !== x || t[18] !== v ? (S = /* @__PURE__ */ (0, J.jsxs)("button", {
|
|
4371
4371
|
type: "button",
|
|
@@ -4401,17 +4401,17 @@ function Po(e) {
|
|
|
4401
4401
|
//#endregion
|
|
4402
4402
|
//#region src/components/chat/tool-call/tool-result.tsx
|
|
4403
4403
|
function Fo(e) {
|
|
4404
|
-
return e == null || typeof e == "object" &&
|
|
4405
|
-
}
|
|
4406
|
-
var Io =
|
|
4407
|
-
status:
|
|
4408
|
-
auth_required:
|
|
4409
|
-
action_url:
|
|
4410
|
-
next_steps:
|
|
4411
|
-
meta:
|
|
4412
|
-
message:
|
|
4404
|
+
return e == null || typeof e == "object" && mt(e);
|
|
4405
|
+
}
|
|
4406
|
+
var Io = Ke({
|
|
4407
|
+
status: Ze().default("success"),
|
|
4408
|
+
auth_required: ct().default(!1),
|
|
4409
|
+
action_url: nt().optional(),
|
|
4410
|
+
next_steps: nt().optional(),
|
|
4411
|
+
meta: nt().optional(),
|
|
4412
|
+
message: Ze().nullish()
|
|
4413
4413
|
}), Lo = (e) => {
|
|
4414
|
-
let t = (0,
|
|
4414
|
+
let t = (0, M.c)(12), { data: n } = e, r;
|
|
4415
4415
|
if (t[0] !== n) {
|
|
4416
4416
|
let { status: e, auth_required: i, action_url: a, meta: o, next_steps: s, message: c, ...l } = n, u;
|
|
4417
4417
|
t[2] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ (0, J.jsx)("h3", {
|
|
@@ -4439,7 +4439,7 @@ var Io = Ge({
|
|
|
4439
4439
|
let m;
|
|
4440
4440
|
t[10] === c ? m = t[11] : (m = c && /* @__PURE__ */ (0, J.jsxs)("div", {
|
|
4441
4441
|
className: "flex items-start gap-2",
|
|
4442
|
-
children: [/* @__PURE__ */ (0, J.jsx)(
|
|
4442
|
+
children: [/* @__PURE__ */ (0, J.jsx)(be, { className: "h-3 w-3 text-(--blue-11) mt-0.5 shrink-0" }), /* @__PURE__ */ (0, J.jsx)("div", {
|
|
4443
4443
|
className: "text-xs text-foreground",
|
|
4444
4444
|
children: c
|
|
4445
4445
|
})]
|
|
@@ -4457,7 +4457,7 @@ var Io = Ge({
|
|
|
4457
4457
|
} else r = t[1];
|
|
4458
4458
|
return r;
|
|
4459
4459
|
}, Ro = (e) => {
|
|
4460
|
-
let t = (0,
|
|
4460
|
+
let t = (0, M.c)(8), { result: n } = e, r;
|
|
4461
4461
|
t[0] === n ? r = t[1] : (r = Io.safeParse(n), t[0] = n, t[1] = r);
|
|
4462
4462
|
let i = r;
|
|
4463
4463
|
if (i.success) {
|
|
@@ -4498,10 +4498,10 @@ var Bo = {
|
|
|
4498
4498
|
"input-available",
|
|
4499
4499
|
"approval-responded"
|
|
4500
4500
|
]), Ho = (e) => {
|
|
4501
|
-
let t = (0,
|
|
4501
|
+
let t = (0, M.c)(5), { state: n, interrupted: r } = e;
|
|
4502
4502
|
if (r) {
|
|
4503
4503
|
let e;
|
|
4504
|
-
return t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0, J.jsx)(
|
|
4504
|
+
return t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0, J.jsx)(Ht, { className: "h-3 w-3 text-muted-foreground" }), t[0] = e) : e = t[0], e;
|
|
4505
4505
|
}
|
|
4506
4506
|
switch (n) {
|
|
4507
4507
|
case "input-streaming":
|
|
@@ -4512,14 +4512,14 @@ var Bo = {
|
|
|
4512
4512
|
}
|
|
4513
4513
|
case "output-available": {
|
|
4514
4514
|
let e;
|
|
4515
|
-
return t[2] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0, J.jsx)(
|
|
4515
|
+
return t[2] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0, J.jsx)(Vt, { className: "h-3 w-3 text-(--grass-11)" }), t[2] = e) : e = t[2], e;
|
|
4516
4516
|
}
|
|
4517
4517
|
case "output-denied": {
|
|
4518
4518
|
let e;
|
|
4519
|
-
return t[3] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0, J.jsx)(
|
|
4519
|
+
return t[3] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0, J.jsx)(zt, { className: "h-3 w-3 text-muted-foreground" }), t[3] = e) : e = t[3], e;
|
|
4520
4520
|
}
|
|
4521
4521
|
default: {
|
|
4522
|
-
|
|
4522
|
+
Oe(n);
|
|
4523
4523
|
let e;
|
|
4524
4524
|
return t[4] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ (0, J.jsx)(_, { className: "h-3 w-3" }), t[4] = e) : e = t[4], e;
|
|
4525
4525
|
}
|
|
@@ -4532,11 +4532,11 @@ function Uo(e) {
|
|
|
4532
4532
|
case "input-streaming":
|
|
4533
4533
|
case "input-available":
|
|
4534
4534
|
case "approval-responded": return "";
|
|
4535
|
-
default: return
|
|
4535
|
+
default: return Oe(e), "";
|
|
4536
4536
|
}
|
|
4537
4537
|
}
|
|
4538
4538
|
var Wo = (e) => {
|
|
4539
|
-
let t = (0,
|
|
4539
|
+
let t = (0, M.c)(34), { toolName: n, state: r, input: a, result: o, approval: s, index: c, className: l, isActive: u } = e, d = c === void 0 ? 0 : c, f = u === void 0 || u, p;
|
|
4540
4540
|
t[0] !== f || t[1] !== r ? (p = !f && Vo.has(r), t[0] = f, t[1] = r, t[2] = p) : p = t[2];
|
|
4541
4541
|
let m = p, h = `tool-${d}`, g;
|
|
4542
4542
|
t[3] === l ? g = t[4] : (g = i("w-full", l), t[3] = l, t[4] = g);
|
|
@@ -4570,7 +4570,7 @@ var Wo = (e) => {
|
|
|
4570
4570
|
children: w
|
|
4571
4571
|
}), t[19] = w, t[20] = _, t[21] = T) : T = t[21];
|
|
4572
4572
|
let E;
|
|
4573
|
-
t[22] !== s || t[23] !== a || t[24] !== o || t[25] !== r ? (E = /* @__PURE__ */ (0, J.jsx)(
|
|
4573
|
+
t[22] !== s || t[23] !== a || t[24] !== o || t[25] !== r ? (E = /* @__PURE__ */ (0, J.jsx)(A, {
|
|
4574
4574
|
className: "py-2 px-2",
|
|
4575
4575
|
children: /* @__PURE__ */ (0, J.jsx)(Go, {
|
|
4576
4576
|
state: r,
|
|
@@ -4580,7 +4580,7 @@ var Wo = (e) => {
|
|
|
4580
4580
|
})
|
|
4581
4581
|
}), t[22] = s, t[23] = a, t[24] = o, t[25] = r, t[26] = E) : E = t[26];
|
|
4582
4582
|
let D;
|
|
4583
|
-
t[27] !== T || t[28] !== E ? (D = /* @__PURE__ */ (0, J.jsxs)(
|
|
4583
|
+
t[27] !== T || t[28] !== E ? (D = /* @__PURE__ */ (0, J.jsxs)(ne, {
|
|
4584
4584
|
value: "tool-call",
|
|
4585
4585
|
className: "border-0",
|
|
4586
4586
|
children: [T, E]
|
|
@@ -4593,7 +4593,7 @@ var Wo = (e) => {
|
|
|
4593
4593
|
children: D
|
|
4594
4594
|
}, h), t[30] = D, t[31] = h, t[32] = g, t[33] = O) : O = t[33], O;
|
|
4595
4595
|
}, Go = (e) => {
|
|
4596
|
-
let t = (0,
|
|
4596
|
+
let t = (0, M.c)(16), { state: n, input: r, result: i, approval: a } = e;
|
|
4597
4597
|
switch (n) {
|
|
4598
4598
|
case "input-streaming":
|
|
4599
4599
|
case "input-available":
|
|
@@ -4626,10 +4626,10 @@ var Wo = (e) => {
|
|
|
4626
4626
|
children: [e, i]
|
|
4627
4627
|
}), t[13] = e, t[14] = i, t[15] = o) : o = t[15], o;
|
|
4628
4628
|
}
|
|
4629
|
-
default: return
|
|
4629
|
+
default: return Oe(n), null;
|
|
4630
4630
|
}
|
|
4631
4631
|
}, Ko = (e) => {
|
|
4632
|
-
let t = (0,
|
|
4632
|
+
let t = (0, M.c)(27), { toolName: n, state: r, result: i, errorText: a, input: o, approval: s, onApprove: c, index: l, className: u, isLive: d, isActive: f } = e, p = d === void 0 || d, m = f === void 0 || f;
|
|
4633
4633
|
switch (r) {
|
|
4634
4634
|
case "approval-requested": {
|
|
4635
4635
|
if (s != null && c != null) {
|
|
@@ -4679,7 +4679,7 @@ var Wo = (e) => {
|
|
|
4679
4679
|
isActive: m
|
|
4680
4680
|
}), t[18] = s, t[19] = u, t[20] = l, t[21] = o, t[22] = m, t[23] = i, t[24] = r, t[25] = n, t[26] = e) : e = t[26], e;
|
|
4681
4681
|
}
|
|
4682
|
-
default: return
|
|
4682
|
+
default: return Oe(r), null;
|
|
4683
4683
|
}
|
|
4684
4684
|
}, qo = ({ message: e, isStreamingReasoning: t, isLast: n, isActive: i, addToolApprovalResponse: a }) => {
|
|
4685
4685
|
return /* @__PURE__ */ (0, J.jsx)(J.Fragment, { children: e.parts.map((e, t) => o(e, t)) });
|
|
@@ -4723,12 +4723,12 @@ var Wo = (e) => {
|
|
|
4723
4723
|
isActive: i
|
|
4724
4724
|
}, s);
|
|
4725
4725
|
case "source-document": return /* @__PURE__ */ (0, J.jsx)(Oo, {
|
|
4726
|
-
icon: /* @__PURE__ */ (0, J.jsx)(
|
|
4726
|
+
icon: /* @__PURE__ */ (0, J.jsx)(Ce, { className: "h-3 w-3 shrink-0" }),
|
|
4727
4727
|
title: o.title,
|
|
4728
4728
|
subtitle: o.filename
|
|
4729
4729
|
}, s);
|
|
4730
4730
|
case "source-url": return /* @__PURE__ */ (0, J.jsx)(Oo, {
|
|
4731
|
-
icon: /* @__PURE__ */ (0, J.jsx)(
|
|
4731
|
+
icon: /* @__PURE__ */ (0, J.jsx)(ve, { className: "h-3 w-3 shrink-0" }),
|
|
4732
4732
|
title: o.title ?? o.url,
|
|
4733
4733
|
subtitle: o.title ? o.url : void 0,
|
|
4734
4734
|
href: o.url
|
|
@@ -4738,7 +4738,7 @@ var Wo = (e) => {
|
|
|
4738
4738
|
children: o.kind
|
|
4739
4739
|
}, s);
|
|
4740
4740
|
case "step-start": return null;
|
|
4741
|
-
default: return
|
|
4741
|
+
default: return Oe(o), null;
|
|
4742
4742
|
}
|
|
4743
4743
|
}
|
|
4744
4744
|
};
|
|
@@ -4751,11 +4751,11 @@ function Yo(e) {
|
|
|
4751
4751
|
//#endregion
|
|
4752
4752
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-ai@0.3.10_@codemirror+state@6.7.6_@codemirror+view@6.43.13/node_modules/@marimo-team/codemirror-ai/dist/utils/facet.js
|
|
4753
4753
|
function Xo(e) {
|
|
4754
|
-
return
|
|
4754
|
+
return jt.define({ combine: (t) => t[0] ?? e });
|
|
4755
4755
|
}
|
|
4756
4756
|
//#endregion
|
|
4757
4757
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-ai@0.3.10_@codemirror+state@6.7.6_@codemirror+view@6.43.13/node_modules/@marimo-team/codemirror-ai/dist/prompt-history/extension.js
|
|
4758
|
-
var Zo = Xo({}), Qo =
|
|
4758
|
+
var Zo = Xo({}), Qo = bt.define(), $o = bt.define(), es = 50, ts = Dt.define({
|
|
4759
4759
|
create() {
|
|
4760
4760
|
return {
|
|
4761
4761
|
prompts: [],
|
|
@@ -4814,7 +4814,7 @@ function is(e = {}) {
|
|
|
4814
4814
|
navigationIndex: -1,
|
|
4815
4815
|
originalText: ""
|
|
4816
4816
|
})), Zo.of(t ?? {})];
|
|
4817
|
-
return n && r.push(
|
|
4817
|
+
return n && r.push(At.of([{
|
|
4818
4818
|
key: "ArrowUp",
|
|
4819
4819
|
run: ns
|
|
4820
4820
|
}, {
|
|
@@ -4824,7 +4824,7 @@ function is(e = {}) {
|
|
|
4824
4824
|
}
|
|
4825
4825
|
//#endregion
|
|
4826
4826
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/state.js
|
|
4827
|
-
var as =
|
|
4827
|
+
var as = bt.define(), Q = Dt.define({
|
|
4828
4828
|
create() {
|
|
4829
4829
|
return /* @__PURE__ */ new Map();
|
|
4830
4830
|
},
|
|
@@ -4836,7 +4836,7 @@ var as = yt.define(), Q = Et.define({
|
|
|
4836
4836
|
}
|
|
4837
4837
|
return r;
|
|
4838
4838
|
}
|
|
4839
|
-
}), os =
|
|
4839
|
+
}), os = Dt.define({
|
|
4840
4840
|
create() {
|
|
4841
4841
|
return {
|
|
4842
4842
|
onResourceClick: void 0,
|
|
@@ -4848,8 +4848,8 @@ var as = yt.define(), Q = Et.define({
|
|
|
4848
4848
|
update(e) {
|
|
4849
4849
|
return e;
|
|
4850
4850
|
}
|
|
4851
|
-
}), ss =
|
|
4852
|
-
|
|
4851
|
+
}), ss = bt.define();
|
|
4852
|
+
Dt.define({
|
|
4853
4853
|
create() {
|
|
4854
4854
|
return /* @__PURE__ */ new Map();
|
|
4855
4855
|
},
|
|
@@ -4897,7 +4897,7 @@ function $(e) {
|
|
|
4897
4897
|
}
|
|
4898
4898
|
//#endregion
|
|
4899
4899
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/decoration.js
|
|
4900
|
-
var us = class extends
|
|
4900
|
+
var us = class extends wt {
|
|
4901
4901
|
resource;
|
|
4902
4902
|
view;
|
|
4903
4903
|
constructor(e, t) {
|
|
@@ -4918,7 +4918,7 @@ var us = class extends Ct {
|
|
|
4918
4918
|
e.preventDefault(), e.stopPropagation(), i(this.resource);
|
|
4919
4919
|
}), e;
|
|
4920
4920
|
}
|
|
4921
|
-
}, ds = class extends
|
|
4921
|
+
}, ds = class extends wt {
|
|
4922
4922
|
uri;
|
|
4923
4923
|
view;
|
|
4924
4924
|
constructor(e, t) {
|
|
@@ -4938,12 +4938,12 @@ function fs(e) {
|
|
|
4938
4938
|
let a = e.state.doc.sliceString(r, i);
|
|
4939
4939
|
for (let i of $(a)) {
|
|
4940
4940
|
let a = r + i.index, o = i[0].slice(1), s = t.get(o);
|
|
4941
|
-
s ? n.push(
|
|
4941
|
+
s ? n.push(Et.replace({ widget: new us(s, e) }).range(a, a + i[0].length)) : n.push(Et.replace({ widget: new ds(o, e) }).range(a, a + i[0].length));
|
|
4942
4942
|
}
|
|
4943
4943
|
}
|
|
4944
|
-
return
|
|
4944
|
+
return Et.set(n);
|
|
4945
4945
|
}
|
|
4946
|
-
var ps =
|
|
4946
|
+
var ps = kt.fromClass(class {
|
|
4947
4947
|
decorations;
|
|
4948
4948
|
constructor(e) {
|
|
4949
4949
|
this.decorations = fs(e);
|
|
@@ -4983,7 +4983,7 @@ function hs(e, t, n, r = 0) {
|
|
|
4983
4983
|
return null;
|
|
4984
4984
|
}
|
|
4985
4985
|
function gs(e) {
|
|
4986
|
-
return
|
|
4986
|
+
return Ot((t, n) => {
|
|
4987
4987
|
let { from: r, text: i } = t.state.doc.lineAt(n), a = hs(i, n, t.state.field(Q), r);
|
|
4988
4988
|
return a ? {
|
|
4989
4989
|
pos: a.start,
|
|
@@ -5053,8 +5053,8 @@ function xs(e, t) {
|
|
|
5053
5053
|
}
|
|
5054
5054
|
return null;
|
|
5055
5055
|
}
|
|
5056
|
-
var Ss =
|
|
5057
|
-
let t = e.annotation(
|
|
5056
|
+
var Ss = xt.transactionFilter.of((e) => {
|
|
5057
|
+
let t = e.annotation(Tt.userEvent);
|
|
5058
5058
|
if (!t) return e;
|
|
5059
5059
|
let n = e.startState.selection.main;
|
|
5060
5060
|
if (!n.empty) return e;
|
|
@@ -5236,11 +5236,11 @@ function Os(e, t) {
|
|
|
5236
5236
|
};
|
|
5237
5237
|
}
|
|
5238
5238
|
function ks(e, t = {}) {
|
|
5239
|
-
return
|
|
5239
|
+
return kt.fromClass(Os(e, t));
|
|
5240
5240
|
}
|
|
5241
5241
|
//#endregion
|
|
5242
5242
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/theme.js
|
|
5243
|
-
var As =
|
|
5243
|
+
var As = Ct.baseTheme({
|
|
5244
5244
|
".cm-resource-widget": {
|
|
5245
5245
|
background: "light-dark(rgba(86,156,214,0.08),rgba(86,156,214,0.18))",
|
|
5246
5246
|
borderRadius: "4px",
|
|
@@ -5273,10 +5273,10 @@ function Fs(e) {
|
|
|
5273
5273
|
let { language: t, store: n, onAddFiles: i } = e, a = () => Ps(n);
|
|
5274
5274
|
return [
|
|
5275
5275
|
t.data.of({ autocomplete: cs(async () => a(), (e) => e.type === js ? Ns : So(n).getProvider(e.type)?.formatCompletion(e) || {}) }),
|
|
5276
|
-
|
|
5276
|
+
St.high(At.of([{
|
|
5277
5277
|
key: "Tab",
|
|
5278
5278
|
preventDefault: !0,
|
|
5279
|
-
run: (e) =>
|
|
5279
|
+
run: (e) => Mt(e)
|
|
5280
5280
|
}])),
|
|
5281
5281
|
_o.of({ addAttachment: (e) => i?.([e]) }),
|
|
5282
5282
|
...i ? [t.data.of({ autocomplete: Co().createCompletionSource() })] : [],
|
|
@@ -5303,14 +5303,14 @@ function Is(e) {
|
|
|
5303
5303
|
let t = document.createElement("div");
|
|
5304
5304
|
return t.textContent = e, { dom: t };
|
|
5305
5305
|
}
|
|
5306
|
-
|
|
5307
|
-
var Ls = "marimo:ai-prompt-history", Rs = new
|
|
5308
|
-
let t = (0,
|
|
5306
|
+
ht("marimo:ai-language", "python", he);
|
|
5307
|
+
var Ls = "marimo:ai-prompt-history", Rs = new xe(Je(Ze()), () => []), zs = (e) => {
|
|
5308
|
+
let t = (0, M.c)(35), { value: n, placeholder: r, inputRef: a, className: o, onChange: s, onSubmit: c, onKeyDown: l, onClose: u, onAddFiles: d, additionalCompletions: f, maxHeight: p } = e, m = c, h = u, g = gt(), { theme: _ } = vt(), v;
|
|
5309
5309
|
t[0] === f ? v = t[1] : (v = (e) => f ? wo([f.triggerCompletionRegex], f.completions)(e) : null, t[0] = f, t[1] = v);
|
|
5310
|
-
let y =
|
|
5310
|
+
let y = _t(v), b, x, S, C;
|
|
5311
5311
|
if (t[2] !== y || t[3] !== d || t[4] !== g) {
|
|
5312
|
-
let e =
|
|
5313
|
-
t[9] === Symbol.for("react.memo_cache_sentinel") ? (b =
|
|
5312
|
+
let e = Ft();
|
|
5313
|
+
t[9] === Symbol.for("react.memo_cache_sentinel") ? (b = Pt({}), t[9] = b) : b = t[9], x = e, S = Fs({
|
|
5314
5314
|
language: e.language,
|
|
5315
5315
|
store: g,
|
|
5316
5316
|
onAddFiles: d
|
|
@@ -5322,9 +5322,9 @@ var Ls = "marimo:ai-prompt-history", Rs = new se(qe(Xe()), () => []), zs = (e) =
|
|
|
5322
5322
|
save: Vs
|
|
5323
5323
|
} }), t[10] = w) : w = t[10];
|
|
5324
5324
|
let T;
|
|
5325
|
-
t[11] === Symbol.for("react.memo_cache_sentinel") ? (T =
|
|
5325
|
+
t[11] === Symbol.for("react.memo_cache_sentinel") ? (T = It(), t[11] = T) : T = t[11];
|
|
5326
5326
|
let E;
|
|
5327
|
-
t[12] === m ? E = t[13] : (E =
|
|
5327
|
+
t[12] === m ? E = t[13] : (E = St.highest(At.of([{
|
|
5328
5328
|
preventDefault: !0,
|
|
5329
5329
|
stopPropagation: !0,
|
|
5330
5330
|
any: (e, t) => {
|
|
@@ -5348,7 +5348,7 @@ var Ls = "marimo:ai-prompt-history", Rs = new se(qe(Xe()), () => []), zs = (e) =
|
|
|
5348
5348
|
}
|
|
5349
5349
|
}])), t[12] = m, t[13] = E);
|
|
5350
5350
|
let D;
|
|
5351
|
-
t[14] === h ? D = t[15] : (D =
|
|
5351
|
+
t[14] === h ? D = t[15] : (D = At.of([{
|
|
5352
5352
|
key: "Escape",
|
|
5353
5353
|
preventDefault: !0,
|
|
5354
5354
|
stopPropagation: !0,
|
|
@@ -5361,17 +5361,17 @@ var Ls = "marimo:ai-prompt-history", Rs = new se(qe(Xe()), () => []), zs = (e) =
|
|
|
5361
5361
|
S,
|
|
5362
5362
|
C,
|
|
5363
5363
|
w,
|
|
5364
|
-
|
|
5364
|
+
Ct.lineWrapping,
|
|
5365
5365
|
T,
|
|
5366
5366
|
E,
|
|
5367
5367
|
D
|
|
5368
5368
|
], t[16] = b, t[17] = x, t[18] = S, t[19] = C, t[20] = E, t[21] = D, t[22] = O) : O = t[22];
|
|
5369
|
-
let k = O,
|
|
5370
|
-
t[23] === o ?
|
|
5371
|
-
let
|
|
5372
|
-
return t[25] !== k || t[26] !== a || t[27] !== p || t[28] !== s || t[29] !== l || t[30] !==
|
|
5369
|
+
let k = O, ee;
|
|
5370
|
+
t[23] === o ? ee = t[24] : (ee = i("flex-1 font-sans overflow-auto my-1", o), t[23] = o, t[24] = ee);
|
|
5371
|
+
let te = _ === "dark" ? "dark" : "light", A = r || "Generate with AI, @ to include context", ne;
|
|
5372
|
+
return t[25] !== k || t[26] !== a || t[27] !== p || t[28] !== s || t[29] !== l || t[30] !== ee || t[31] !== te || t[32] !== A || t[33] !== n ? (ne = /* @__PURE__ */ (0, J.jsx)(Lt, {
|
|
5373
5373
|
ref: a,
|
|
5374
|
-
className:
|
|
5374
|
+
className: ee,
|
|
5375
5375
|
width: "100%",
|
|
5376
5376
|
maxHeight: p,
|
|
5377
5377
|
value: n,
|
|
@@ -5379,9 +5379,9 @@ var Ls = "marimo:ai-prompt-history", Rs = new se(qe(Xe()), () => []), zs = (e) =
|
|
|
5379
5379
|
extensions: k,
|
|
5380
5380
|
onChange: s,
|
|
5381
5381
|
onKeyDown: l,
|
|
5382
|
-
theme:
|
|
5383
|
-
placeholder:
|
|
5384
|
-
}), t[25] = k, t[26] = a, t[27] = p, t[28] = s, t[29] = l, t[30] =
|
|
5382
|
+
theme: te,
|
|
5383
|
+
placeholder: A
|
|
5384
|
+
}), t[25] = k, t[26] = a, t[27] = p, t[28] = s, t[29] = l, t[30] = ee, t[31] = te, t[32] = A, t[33] = n, t[34] = ne) : ne = t[34], ne;
|
|
5385
5385
|
};
|
|
5386
5386
|
function Bs() {
|
|
5387
5387
|
return Rs.get(Ls);
|
|
@@ -5391,11 +5391,11 @@ function Vs(e) {
|
|
|
5391
5391
|
}
|
|
5392
5392
|
//#endregion
|
|
5393
5393
|
//#region src/plugins/impl/chat/chat-ui.tsx
|
|
5394
|
-
var Hs = g, Us =
|
|
5395
|
-
type:
|
|
5396
|
-
message_id:
|
|
5397
|
-
content:
|
|
5398
|
-
is_final:
|
|
5394
|
+
var Hs = g, Us = tt({
|
|
5395
|
+
type: st("stream_chunk"),
|
|
5396
|
+
message_id: Ze(),
|
|
5397
|
+
content: nt().nullable().transform((e) => e),
|
|
5398
|
+
is_final: ct().optional()
|
|
5399
5399
|
});
|
|
5400
5400
|
function Ws(e, t) {
|
|
5401
5401
|
let { controllerRef: n, activeRequestIdRef: i } = t, a = n.current;
|
|
@@ -5415,7 +5415,7 @@ var Gs = (e) => {
|
|
|
5415
5415
|
}, [s]);
|
|
5416
5416
|
let b = (0, q.useRef)(null), x = (0, q.useRef)(null), S = (0, q.useRef)(null), [C, w] = (0, q.useState)(null), T = () => {
|
|
5417
5417
|
S.current = null, w(null);
|
|
5418
|
-
}, { data: E } =
|
|
5418
|
+
}, { data: E } = Rt(async () => (await e.get_chat_history({})).messages, []), O = e.value.length > 0 ? e.value : E, { messages: k, sendMessage: ee, setMessages: te, status: A, stop: ne, error: j, regenerate: ie, clearError: ae, addToolApprovalResponse: oe } = eo({
|
|
5419
5419
|
sendAutomaticallyWhen: ({ messages: e }) => Eo(e),
|
|
5420
5420
|
transport: new Na({ fetch: async (t, n) => {
|
|
5421
5421
|
if (n === void 0) return fetch(t);
|
|
@@ -5431,7 +5431,7 @@ var Gs = (e) => {
|
|
|
5431
5431
|
let t = i.messages.map((e) => ({
|
|
5432
5432
|
...e,
|
|
5433
5433
|
content: e.parts?.map((e) => "text" in e ? e.text : "").join("\n")
|
|
5434
|
-
})), n =
|
|
5434
|
+
})), n = Te();
|
|
5435
5435
|
T();
|
|
5436
5436
|
let s = new ReadableStream({
|
|
5437
5437
|
start(t) {
|
|
@@ -5491,7 +5491,7 @@ var Gs = (e) => {
|
|
|
5491
5491
|
r.error("An error occurred:", e);
|
|
5492
5492
|
}
|
|
5493
5493
|
});
|
|
5494
|
-
n(e.host,
|
|
5494
|
+
n(e.host, Ve.TYPE, (e) => {
|
|
5495
5495
|
let t = Us.safeParse(e.detail.message);
|
|
5496
5496
|
if (t.success) {
|
|
5497
5497
|
if (t.data.content && t.data.message_id === x.current) {
|
|
@@ -5504,27 +5504,27 @@ var Gs = (e) => {
|
|
|
5504
5504
|
});
|
|
5505
5505
|
}
|
|
5506
5506
|
});
|
|
5507
|
-
let
|
|
5507
|
+
let se = A === "submitted" || A === "streaming", ce = (t) => {
|
|
5508
5508
|
let n = k.findIndex((e) => e.id === t);
|
|
5509
5509
|
if (n !== -1) {
|
|
5510
5510
|
let r = k.filter((e) => e.id !== t);
|
|
5511
|
-
e.delete_chat_message({ index: n }),
|
|
5511
|
+
e.delete_chat_message({ index: n }), te(r), e.setValue(r), r.length === 0 && T();
|
|
5512
5512
|
}
|
|
5513
|
-
},
|
|
5513
|
+
}, ue = Array.isArray(e.allowAttachments) && e.allowAttachments.length > 0 || e.allowAttachments === !0, de = {
|
|
5514
5514
|
triggerCompletionRegex: /^\/(\w+)?/,
|
|
5515
5515
|
completions: e.prompts.map((e) => ({
|
|
5516
5516
|
label: `/${e}`,
|
|
5517
5517
|
displayLabel: e,
|
|
5518
5518
|
apply: e
|
|
5519
5519
|
}))
|
|
5520
|
-
},
|
|
5520
|
+
}, fe = e.prompts.length > 0 ? "Type your message here, / for prompts" : "Type your message here...";
|
|
5521
5521
|
(0, q.useEffect)(() => {
|
|
5522
5522
|
_.current?.scrollTo({
|
|
5523
5523
|
top: _.current.scrollHeight,
|
|
5524
5524
|
behavior: "smooth"
|
|
5525
5525
|
});
|
|
5526
5526
|
}, [k.length, _]);
|
|
5527
|
-
let
|
|
5527
|
+
let pe = () => {
|
|
5528
5528
|
let e = g.current?.view;
|
|
5529
5529
|
if (e) {
|
|
5530
5530
|
let t = e.state.doc.length;
|
|
@@ -5548,9 +5548,9 @@ var Gs = (e) => {
|
|
|
5548
5548
|
size: "icon",
|
|
5549
5549
|
disabled: k.length === 0,
|
|
5550
5550
|
onClick: () => {
|
|
5551
|
-
|
|
5551
|
+
te([]), e.setValue([]), e.delete_chat_history({}), ae(), T();
|
|
5552
5552
|
},
|
|
5553
|
-
children: /* @__PURE__ */ (0, J.jsx)(
|
|
5553
|
+
children: /* @__PURE__ */ (0, J.jsx)(Wt, { className: "h-3 w-3" })
|
|
5554
5554
|
})
|
|
5555
5555
|
}),
|
|
5556
5556
|
/* @__PURE__ */ (0, J.jsxs)("div", {
|
|
@@ -5560,7 +5560,7 @@ var Gs = (e) => {
|
|
|
5560
5560
|
k.length === 0 && /* @__PURE__ */ (0, J.jsxs)("div", {
|
|
5561
5561
|
className: "flex flex-col items-center justify-center h-full text-muted-foreground text-center p-4",
|
|
5562
5562
|
children: [
|
|
5563
|
-
/* @__PURE__ */ (0, J.jsx)(
|
|
5563
|
+
/* @__PURE__ */ (0, J.jsx)(Bt, { className: "h-12 w-12 mb-4" }),
|
|
5564
5564
|
/* @__PURE__ */ (0, J.jsx)("h3", {
|
|
5565
5565
|
className: "text-lg font-semibold mb-2",
|
|
5566
5566
|
children: "No messages yet"
|
|
@@ -5579,10 +5579,10 @@ var Gs = (e) => {
|
|
|
5579
5579
|
className: `max-w-[80%] p-3 rounded-lg ${e.role === "user" ? "bg-(--sky-11) text-(--slate-1) whitespace-pre-wrap" : "bg-(--slate-4) text-(--slate-12)"}`,
|
|
5580
5580
|
children: qo({
|
|
5581
5581
|
message: e,
|
|
5582
|
-
isStreamingReasoning:
|
|
5582
|
+
isStreamingReasoning: A === "streaming",
|
|
5583
5583
|
isLast: r,
|
|
5584
|
-
isActive:
|
|
5585
|
-
addToolApprovalResponse: r ?
|
|
5584
|
+
isActive: se,
|
|
5585
|
+
addToolApprovalResponse: r ? oe : void 0
|
|
5586
5586
|
})
|
|
5587
5587
|
}), /* @__PURE__ */ (0, J.jsxs)("div", {
|
|
5588
5588
|
className: "flex justify-end text-xs gap-2 opacity-0 group-hover:opacity-100 focus-within:opacity-100",
|
|
@@ -5593,27 +5593,27 @@ var Gs = (e) => {
|
|
|
5593
5593
|
}), /* @__PURE__ */ (0, J.jsx)("button", {
|
|
5594
5594
|
type: "button",
|
|
5595
5595
|
"aria-label": "Delete message",
|
|
5596
|
-
onClick: () =>
|
|
5596
|
+
onClick: () => ce(e.id),
|
|
5597
5597
|
className: "text-xs text-(--slate-9) hover:text-(--slate-11)",
|
|
5598
5598
|
children: /* @__PURE__ */ (0, J.jsx)(v, { className: "h-3 w-3 text-(--red-9)" })
|
|
5599
5599
|
})]
|
|
5600
5600
|
})]
|
|
5601
5601
|
}, e.id);
|
|
5602
5602
|
}),
|
|
5603
|
-
|
|
5603
|
+
se && /* @__PURE__ */ (0, J.jsx)("div", {
|
|
5604
5604
|
className: "flex items-center justify-center mb-4",
|
|
5605
5605
|
children: /* @__PURE__ */ (0, J.jsx)(D, { size: "small" })
|
|
5606
5606
|
}),
|
|
5607
|
-
|
|
5607
|
+
j && /* @__PURE__ */ (0, J.jsxs)("div", {
|
|
5608
5608
|
className: "flex items-center justify-center space-x-2 mb-4",
|
|
5609
|
-
children: [/* @__PURE__ */ (0, J.jsx)(
|
|
5609
|
+
children: [/* @__PURE__ */ (0, J.jsx)(ft, { error: j }), /* @__PURE__ */ (0, J.jsx)(a, {
|
|
5610
5610
|
variant: "outline",
|
|
5611
5611
|
size: "sm",
|
|
5612
|
-
onClick: () =>
|
|
5612
|
+
onClick: () => ie(),
|
|
5613
5613
|
children: "Retry"
|
|
5614
5614
|
})]
|
|
5615
5615
|
}),
|
|
5616
|
-
C && !
|
|
5616
|
+
C && !se && !j && /* @__PURE__ */ (0, J.jsx)("div", {
|
|
5617
5617
|
className: "flex justify-center py-2",
|
|
5618
5618
|
children: /* @__PURE__ */ (0, J.jsx)("span", {
|
|
5619
5619
|
className: "text-xs text-muted-foreground",
|
|
@@ -5626,13 +5626,13 @@ var Gs = (e) => {
|
|
|
5626
5626
|
onSubmit: async (n) => {
|
|
5627
5627
|
if (n.preventDefault(), e.disabled) return;
|
|
5628
5628
|
let r = f ? await To(f) : void 0;
|
|
5629
|
-
|
|
5629
|
+
ee({
|
|
5630
5630
|
role: "user",
|
|
5631
5631
|
parts: [{
|
|
5632
5632
|
type: "text",
|
|
5633
5633
|
text: t
|
|
5634
5634
|
}, ...r ?? []]
|
|
5635
|
-
}),
|
|
5635
|
+
}), pe();
|
|
5636
5636
|
},
|
|
5637
5637
|
ref: h,
|
|
5638
5638
|
inert: e.disabled || void 0,
|
|
@@ -5647,13 +5647,13 @@ var Gs = (e) => {
|
|
|
5647
5647
|
onSelect: (e) => {
|
|
5648
5648
|
o(e), requestAnimationFrame(() => {
|
|
5649
5649
|
let e = g.current?.view;
|
|
5650
|
-
e?.focus(),
|
|
5650
|
+
e?.focus(), le(e);
|
|
5651
5651
|
});
|
|
5652
5652
|
}
|
|
5653
5653
|
}),
|
|
5654
5654
|
/* @__PURE__ */ (0, J.jsx)(zs, {
|
|
5655
5655
|
className: "rounded-sm mr-2",
|
|
5656
|
-
placeholder:
|
|
5656
|
+
placeholder: fe,
|
|
5657
5657
|
value: t,
|
|
5658
5658
|
inputRef: g,
|
|
5659
5659
|
maxHeight: e.maxHeight ? `${e.maxHeight / 2}px` : void 0,
|
|
@@ -5662,7 +5662,7 @@ var Gs = (e) => {
|
|
|
5662
5662
|
t.trim() && h.current?.requestSubmit();
|
|
5663
5663
|
},
|
|
5664
5664
|
onClose: () => {},
|
|
5665
|
-
additionalCompletions:
|
|
5665
|
+
additionalCompletions: de
|
|
5666
5666
|
}),
|
|
5667
5667
|
f && f.length === 1 && /* @__PURE__ */ (0, J.jsx)("span", {
|
|
5668
5668
|
title: f[0].name,
|
|
@@ -5681,14 +5681,14 @@ var Gs = (e) => {
|
|
|
5681
5681
|
onClick: () => {
|
|
5682
5682
|
p(void 0), m.current && (m.current.value = "");
|
|
5683
5683
|
},
|
|
5684
|
-
children: /* @__PURE__ */ (0, J.jsx)(
|
|
5684
|
+
children: /* @__PURE__ */ (0, J.jsx)(De, { className: "size-3" })
|
|
5685
5685
|
}),
|
|
5686
|
-
|
|
5686
|
+
ue && /* @__PURE__ */ (0, J.jsxs)(J.Fragment, { children: [/* @__PURE__ */ (0, J.jsx)(a, {
|
|
5687
5687
|
type: "button",
|
|
5688
5688
|
variant: "text",
|
|
5689
5689
|
size: "sm",
|
|
5690
5690
|
onClick: () => m.current?.click(),
|
|
5691
|
-
children: /* @__PURE__ */ (0, J.jsx)(
|
|
5691
|
+
children: /* @__PURE__ */ (0, J.jsx)(Ut, { className: "h-4" })
|
|
5692
5692
|
}), /* @__PURE__ */ (0, J.jsx)("input", {
|
|
5693
5693
|
type: "file",
|
|
5694
5694
|
ref: m,
|
|
@@ -5699,15 +5699,15 @@ var Gs = (e) => {
|
|
|
5699
5699
|
e.target.files && p([...e.target.files]);
|
|
5700
5700
|
}
|
|
5701
5701
|
})] }),
|
|
5702
|
-
|
|
5702
|
+
se ? /* @__PURE__ */ (0, J.jsx)(re, {
|
|
5703
5703
|
content: "Stop generating",
|
|
5704
5704
|
children: /* @__PURE__ */ (0, J.jsx)(a, {
|
|
5705
5705
|
type: "button",
|
|
5706
5706
|
variant: "link",
|
|
5707
5707
|
size: "xs",
|
|
5708
|
-
onClick: () =>
|
|
5708
|
+
onClick: () => ne(),
|
|
5709
5709
|
className: "text-(--red-9) hover:text-(--red-11)",
|
|
5710
|
-
children: /* @__PURE__ */ (0, J.jsx)(
|
|
5710
|
+
children: /* @__PURE__ */ (0, J.jsx)(ze, { className: "h-4 w-4 fill-current" })
|
|
5711
5711
|
})
|
|
5712
5712
|
}) : /* @__PURE__ */ (0, J.jsx)(a, {
|
|
5713
5713
|
type: "submit",
|
|
@@ -5716,7 +5716,7 @@ var Gs = (e) => {
|
|
|
5716
5716
|
size: "xs",
|
|
5717
5717
|
className: "text-(--slate-11)",
|
|
5718
5718
|
"aria-label": "Send message",
|
|
5719
|
-
children: /* @__PURE__ */ (0, J.jsx)(
|
|
5719
|
+
children: /* @__PURE__ */ (0, J.jsx)(Gt, { className: "h-4 w-4" })
|
|
5720
5720
|
})
|
|
5721
5721
|
]
|
|
5722
5722
|
})
|
|
@@ -5756,7 +5756,7 @@ var Gs = (e) => {
|
|
|
5756
5756
|
description: "Penalizes new tokens (-2: favor, 2: avoid)"
|
|
5757
5757
|
}
|
|
5758
5758
|
}, qs = (e) => {
|
|
5759
|
-
let t = (0,
|
|
5759
|
+
let t = (0, M.c)(16), { config: n, onChange: r } = e, [i, o] = (0, q.useState)(!1), s;
|
|
5760
5760
|
t[0] !== n || t[1] !== r ? (s = (e, t) => {
|
|
5761
5761
|
let i = t === null || Number.isNaN(t) ? null : t;
|
|
5762
5762
|
if (i !== null) {
|
|
@@ -5774,7 +5774,7 @@ var Gs = (e) => {
|
|
|
5774
5774
|
e.key === "Enter" && (e.preventDefault(), o(!1));
|
|
5775
5775
|
}, t[3] = l) : l = t[3];
|
|
5776
5776
|
let f = l, p;
|
|
5777
|
-
t[4] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ (0, J.jsx)(
|
|
5777
|
+
t[4] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ (0, J.jsx)(re, {
|
|
5778
5778
|
content: "Configuration",
|
|
5779
5779
|
children: /* @__PURE__ */ (0, J.jsx)(h, {
|
|
5780
5780
|
asChild: !0,
|
|
@@ -5782,7 +5782,7 @@ var Gs = (e) => {
|
|
|
5782
5782
|
variant: "outline",
|
|
5783
5783
|
size: "sm",
|
|
5784
5784
|
className: "border-none shadow-none hover:bg-transparent",
|
|
5785
|
-
children: /* @__PURE__ */ (0, J.jsx)(
|
|
5785
|
+
children: /* @__PURE__ */ (0, J.jsx)(Kt, { className: "h-3 w-3" })
|
|
5786
5786
|
})
|
|
5787
5787
|
})
|
|
5788
5788
|
}), t[4] = p) : p = t[4];
|
|
@@ -5798,19 +5798,19 @@ var Gs = (e) => {
|
|
|
5798
5798
|
let [t, n] = e;
|
|
5799
5799
|
return /* @__PURE__ */ (0, J.jsxs)("div", {
|
|
5800
5800
|
className: "grid grid-cols-3 items-center gap-1",
|
|
5801
|
-
children: [/* @__PURE__ */ (0, J.jsxs)(
|
|
5801
|
+
children: [/* @__PURE__ */ (0, J.jsxs)(pt, {
|
|
5802
5802
|
htmlFor: t,
|
|
5803
5803
|
className: "flex w-full justify-between col-span-3 align-end",
|
|
5804
|
-
children: [
|
|
5804
|
+
children: [Ae.startCase(t), /* @__PURE__ */ (0, J.jsx)(re, {
|
|
5805
5805
|
delayDuration: 200,
|
|
5806
5806
|
side: "top",
|
|
5807
5807
|
content: /* @__PURE__ */ (0, J.jsx)("div", {
|
|
5808
5808
|
className: "text-xs flex flex-col",
|
|
5809
5809
|
children: Ks[t].description
|
|
5810
5810
|
}),
|
|
5811
|
-
children: /* @__PURE__ */ (0, J.jsx)(
|
|
5811
|
+
children: /* @__PURE__ */ (0, J.jsx)(Le, { className: "h-3 w-3 cursor-help text-muted-foreground hover:text-foreground" })
|
|
5812
5812
|
})]
|
|
5813
|
-
}), /* @__PURE__ */ (0, J.jsx)(
|
|
5813
|
+
}), /* @__PURE__ */ (0, J.jsx)(je, {
|
|
5814
5814
|
id: t,
|
|
5815
5815
|
"aria-label": t,
|
|
5816
5816
|
value: n ?? NaN,
|
|
@@ -5823,7 +5823,7 @@ var Gs = (e) => {
|
|
|
5823
5823
|
className: "col-span-3"
|
|
5824
5824
|
})]
|
|
5825
5825
|
}, t);
|
|
5826
|
-
}, t[9] = c, t[10] = e), g =
|
|
5826
|
+
}, t[9] = c, t[10] = e), g = yt.entries(n).map(e), t[6] = n, t[7] = c, t[8] = g;
|
|
5827
5827
|
} else g = t[8];
|
|
5828
5828
|
let _;
|
|
5829
5829
|
t[11] === g ? _ = t[12] : (_ = /* @__PURE__ */ (0, J.jsx)(d, {
|
|
@@ -5840,14 +5840,14 @@ var Gs = (e) => {
|
|
|
5840
5840
|
children: [p, _]
|
|
5841
5841
|
}), t[13] = i, t[14] = _, t[15] = v) : v = t[15], v;
|
|
5842
5842
|
}, Js = (e) => {
|
|
5843
|
-
let t = (0,
|
|
5843
|
+
let t = (0, M.c)(18), { prompts: n, onSelect: r } = e, [i, o] = (0, q.useState)(!1), [s, c] = (0, q.useState)(""), l;
|
|
5844
5844
|
t[0] === r ? l = t[1] : (l = (e) => {
|
|
5845
5845
|
[...e.matchAll(/{{(\w+)}}/g)].length > 0 ? (c(e), o(!0)) : r(e);
|
|
5846
5846
|
}, t[0] = r, t[1] = l);
|
|
5847
5847
|
let f = l, p;
|
|
5848
|
-
t[2] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ (0, J.jsx)(
|
|
5848
|
+
t[2] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ (0, J.jsx)(re, {
|
|
5849
5849
|
content: "Select a prompt",
|
|
5850
|
-
children: /* @__PURE__ */ (0, J.jsx)(
|
|
5850
|
+
children: /* @__PURE__ */ (0, J.jsx)(Me, {
|
|
5851
5851
|
asChild: !0,
|
|
5852
5852
|
children: /* @__PURE__ */ (0, J.jsx)(a, {
|
|
5853
5853
|
variant: "outline",
|
|
@@ -5860,14 +5860,14 @@ var Gs = (e) => {
|
|
|
5860
5860
|
let h;
|
|
5861
5861
|
if (t[3] !== f || t[4] !== n) {
|
|
5862
5862
|
let e;
|
|
5863
|
-
t[6] === f ? e = t[7] : (e = (e, t) => /* @__PURE__ */ (0, J.jsx)(
|
|
5863
|
+
t[6] === f ? e = t[7] : (e = (e, t) => /* @__PURE__ */ (0, J.jsx)(Pe, {
|
|
5864
5864
|
onSelect: () => f(e),
|
|
5865
5865
|
className: "whitespace-normal text-left",
|
|
5866
5866
|
children: e
|
|
5867
5867
|
}, t), t[6] = f, t[7] = e), h = n.map(e), t[3] = f, t[4] = n, t[5] = h;
|
|
5868
5868
|
} else h = t[5];
|
|
5869
5869
|
let g;
|
|
5870
|
-
t[8] === h ? g = t[9] : (g = /* @__PURE__ */ (0, J.jsx)(Hs, { children: /* @__PURE__ */ (0, J.jsxs)(
|
|
5870
|
+
t[8] === h ? g = t[9] : (g = /* @__PURE__ */ (0, J.jsx)(Hs, { children: /* @__PURE__ */ (0, J.jsxs)(Ie, { children: [p, /* @__PURE__ */ (0, J.jsx)(Fe, {
|
|
5871
5871
|
side: "right",
|
|
5872
5872
|
align: "end",
|
|
5873
5873
|
onCloseAutoFocus: Xs,
|
|
@@ -5894,7 +5894,7 @@ var Gs = (e) => {
|
|
|
5894
5894
|
children: [g, v]
|
|
5895
5895
|
}), t[14] = i, t[15] = g, t[16] = v, t[17] = y) : y = t[17], y;
|
|
5896
5896
|
}, Ys = (e) => {
|
|
5897
|
-
let t = (0,
|
|
5897
|
+
let t = (0, M.c)(30), { prompt: n, onClose: r, onSelect: i } = e, o;
|
|
5898
5898
|
t[0] === n ? o = t[1] : (o = () => [...n.matchAll(/{{(\w+)}}/g)].reduce(Zs, {}), t[0] = n, t[1] = o);
|
|
5899
5899
|
let [s, c] = (0, q.useState)(o), l;
|
|
5900
5900
|
t[2] === Symbol.for("react.memo_cache_sentinel") ? (l = (e, t) => {
|
|
@@ -5923,11 +5923,11 @@ var Gs = (e) => {
|
|
|
5923
5923
|
let [n, r] = e;
|
|
5924
5924
|
return /* @__PURE__ */ (0, J.jsxs)("div", {
|
|
5925
5925
|
className: "grid grid-cols-4 items-center gap-2",
|
|
5926
|
-
children: [/* @__PURE__ */ (0, J.jsx)(
|
|
5926
|
+
children: [/* @__PURE__ */ (0, J.jsx)(pt, {
|
|
5927
5927
|
htmlFor: n,
|
|
5928
5928
|
className: "font-semibold text-base",
|
|
5929
5929
|
children: n
|
|
5930
|
-
}), /* @__PURE__ */ (0, J.jsx)(
|
|
5930
|
+
}), /* @__PURE__ */ (0, J.jsx)(Ne, {
|
|
5931
5931
|
id: n,
|
|
5932
5932
|
value: r,
|
|
5933
5933
|
onChange: (e) => u(n, e.target.value),
|