@aigentyc/chat-sdk 0.1.0
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/LICENSE +21 -0
- package/README.md +156 -0
- package/dist/JsonRenderResult-Ftw4AKwb.d.cts +18 -0
- package/dist/JsonRenderResult-Ftw4AKwb.d.ts +18 -0
- package/dist/JsonRenderResult-GQOYPLVH.cjs +15 -0
- package/dist/JsonRenderResult-GQOYPLVH.cjs.map +1 -0
- package/dist/JsonRenderResult-ZFJ6VWMS.js +6 -0
- package/dist/JsonRenderResult-ZFJ6VWMS.js.map +1 -0
- package/dist/SlotsContext-CBtt36al.d.ts +148 -0
- package/dist/SlotsContext-CHvISDJT.d.cts +148 -0
- package/dist/VisualizationRenderer-FNFYNN66.js +5 -0
- package/dist/VisualizationRenderer-FNFYNN66.js.map +1 -0
- package/dist/VisualizationRenderer-VKMZXRUX.cjs +20 -0
- package/dist/VisualizationRenderer-VKMZXRUX.cjs.map +1 -0
- package/dist/ai-elements.cjs +4608 -0
- package/dist/ai-elements.cjs.map +1 -0
- package/dist/ai-elements.d.cts +897 -0
- package/dist/ai-elements.d.ts +897 -0
- package/dist/ai-elements.js +4363 -0
- package/dist/ai-elements.js.map +1 -0
- package/dist/chunk-3MP2EGEJ.cjs +270 -0
- package/dist/chunk-3MP2EGEJ.cjs.map +1 -0
- package/dist/chunk-3RW7O444.js +26 -0
- package/dist/chunk-3RW7O444.js.map +1 -0
- package/dist/chunk-42ARGQXE.js +51 -0
- package/dist/chunk-42ARGQXE.js.map +1 -0
- package/dist/chunk-4FBVV64J.js +257 -0
- package/dist/chunk-4FBVV64J.js.map +1 -0
- package/dist/chunk-4QT25AXI.js +21 -0
- package/dist/chunk-4QT25AXI.js.map +1 -0
- package/dist/chunk-525KS5HM.cjs +30 -0
- package/dist/chunk-525KS5HM.cjs.map +1 -0
- package/dist/chunk-5F3O3ZJH.js +299 -0
- package/dist/chunk-5F3O3ZJH.js.map +1 -0
- package/dist/chunk-5QSXB6UL.cjs +259 -0
- package/dist/chunk-5QSXB6UL.cjs.map +1 -0
- package/dist/chunk-5T4FJ2SR.js +664 -0
- package/dist/chunk-5T4FJ2SR.js.map +1 -0
- package/dist/chunk-7BNYTOTE.cjs +67 -0
- package/dist/chunk-7BNYTOTE.cjs.map +1 -0
- package/dist/chunk-AWAJOSFP.cjs +96 -0
- package/dist/chunk-AWAJOSFP.cjs.map +1 -0
- package/dist/chunk-BKDV2H6Z.js +224 -0
- package/dist/chunk-BKDV2H6Z.js.map +1 -0
- package/dist/chunk-FQN6OBGN.cjs +171 -0
- package/dist/chunk-FQN6OBGN.cjs.map +1 -0
- package/dist/chunk-FYPJSHCL.js +190 -0
- package/dist/chunk-FYPJSHCL.js.map +1 -0
- package/dist/chunk-J2H6MLQF.cjs +680 -0
- package/dist/chunk-J2H6MLQF.cjs.map +1 -0
- package/dist/chunk-J2K7EJYP.cjs +198 -0
- package/dist/chunk-J2K7EJYP.cjs.map +1 -0
- package/dist/chunk-JI5KCSOI.cjs +23 -0
- package/dist/chunk-JI5KCSOI.cjs.map +1 -0
- package/dist/chunk-JOO6C3XT.cjs +44 -0
- package/dist/chunk-JOO6C3XT.cjs.map +1 -0
- package/dist/chunk-KBGPBUTI.cjs +78 -0
- package/dist/chunk-KBGPBUTI.cjs.map +1 -0
- package/dist/chunk-MT2AMINB.js +75 -0
- package/dist/chunk-MT2AMINB.js.map +1 -0
- package/dist/chunk-MZQKGNWF.js +4 -0
- package/dist/chunk-MZQKGNWF.js.map +1 -0
- package/dist/chunk-NG7OTWXQ.cjs +226 -0
- package/dist/chunk-NG7OTWXQ.cjs.map +1 -0
- package/dist/chunk-NPJKLYLV.js +68 -0
- package/dist/chunk-NPJKLYLV.js.map +1 -0
- package/dist/chunk-NW2ESHRV.js +685 -0
- package/dist/chunk-NW2ESHRV.js.map +1 -0
- package/dist/chunk-NWF735F5.js +1631 -0
- package/dist/chunk-NWF735F5.js.map +1 -0
- package/dist/chunk-NYQSM3EB.cjs +305 -0
- package/dist/chunk-NYQSM3EB.cjs.map +1 -0
- package/dist/chunk-OU7OROOE.cjs +1643 -0
- package/dist/chunk-OU7OROOE.cjs.map +1 -0
- package/dist/chunk-PS3U7T37.js +42 -0
- package/dist/chunk-PS3U7T37.js.map +1 -0
- package/dist/chunk-Q7T3VAJV.cjs +687 -0
- package/dist/chunk-Q7T3VAJV.cjs.map +1 -0
- package/dist/chunk-QYCEHFAB.js +265 -0
- package/dist/chunk-QYCEHFAB.js.map +1 -0
- package/dist/chunk-RPDJXB3U.js +676 -0
- package/dist/chunk-RPDJXB3U.js.map +1 -0
- package/dist/chunk-UKEL7FWS.js +64 -0
- package/dist/chunk-UKEL7FWS.js.map +1 -0
- package/dist/chunk-VS3NZ7FX.js +164 -0
- package/dist/chunk-VS3NZ7FX.js.map +1 -0
- package/dist/chunk-WZLWAVSS.cjs +73 -0
- package/dist/chunk-WZLWAVSS.cjs.map +1 -0
- package/dist/chunk-X5YEOOPK.cjs +758 -0
- package/dist/chunk-X5YEOOPK.cjs.map +1 -0
- package/dist/chunk-X7R334SB.cjs +5 -0
- package/dist/chunk-X7R334SB.cjs.map +1 -0
- package/dist/chunk-XXNDL5SJ.cjs +432 -0
- package/dist/chunk-XXNDL5SJ.cjs.map +1 -0
- package/dist/chunk-YQELMJW5.js +429 -0
- package/dist/chunk-YQELMJW5.js.map +1 -0
- package/dist/components.cjs +551 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.cts +181 -0
- package/dist/components.d.ts +181 -0
- package/dist/components.js +483 -0
- package/dist/components.js.map +1 -0
- package/dist/core.cjs +283 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +455 -0
- package/dist/core.d.ts +455 -0
- package/dist/core.js +241 -0
- package/dist/core.js.map +1 -0
- package/dist/hooks.cjs +324 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +163 -0
- package/dist/hooks.d.ts +163 -0
- package/dist/hooks.js +277 -0
- package/dist/hooks.js.map +1 -0
- package/dist/i18n.cjs +26 -0
- package/dist/i18n.cjs.map +1 -0
- package/dist/i18n.d.cts +50 -0
- package/dist/i18n.d.ts +50 -0
- package/dist/i18n.js +5 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.cjs +466 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +80 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.js +438 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction-tracker-D9P1Oq4j.d.cts +83 -0
- package/dist/interaction-tracker-D9P1Oq4j.d.ts +83 -0
- package/dist/json-render.cjs +23 -0
- package/dist/json-render.cjs.map +1 -0
- package/dist/json-render.d.cts +857 -0
- package/dist/json-render.d.ts +857 -0
- package/dist/json-render.js +6 -0
- package/dist/json-render.js.map +1 -0
- package/dist/live-chat-transport-4XLOIPOE.js +4 -0
- package/dist/live-chat-transport-4XLOIPOE.js.map +1 -0
- package/dist/live-chat-transport-ALVRGWX7.cjs +13 -0
- package/dist/live-chat-transport-ALVRGWX7.cjs.map +1 -0
- package/dist/select-B4l9yoyn.d.cts +99 -0
- package/dist/select-B4l9yoyn.d.ts +99 -0
- package/dist/styles.css +2 -0
- package/dist/theme.cjs +18 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +55 -0
- package/dist/theme.d.ts +55 -0
- package/dist/theme.js +5 -0
- package/dist/theme.js.map +1 -0
- package/dist/tools.cjs +32 -0
- package/dist/tools.cjs.map +1 -0
- package/dist/tools.d.cts +117 -0
- package/dist/tools.d.ts +117 -0
- package/dist/tools.js +11 -0
- package/dist/tools.js.map +1 -0
- package/dist/types-DKJ_-nbG.d.cts +349 -0
- package/dist/types-DKJ_-nbG.d.ts +349 -0
- package/dist/ui.cjs +667 -0
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.cts +95 -0
- package/dist/ui.d.ts +95 -0
- package/dist/ui.js +414 -0
- package/dist/ui.js.map +1 -0
- package/package.json +255 -0
|
@@ -0,0 +1,4608 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunkFQN6OBGN_cjs = require('./chunk-FQN6OBGN.cjs');
|
|
5
|
+
require('./chunk-X7R334SB.cjs');
|
|
6
|
+
var chunk3MP2EGEJ_cjs = require('./chunk-3MP2EGEJ.cjs');
|
|
7
|
+
var chunkJOO6C3XT_cjs = require('./chunk-JOO6C3XT.cjs');
|
|
8
|
+
var chunkX5YEOOPK_cjs = require('./chunk-X5YEOOPK.cjs');
|
|
9
|
+
var chunkWZLWAVSS_cjs = require('./chunk-WZLWAVSS.cjs');
|
|
10
|
+
var chunkAWAJOSFP_cjs = require('./chunk-AWAJOSFP.cjs');
|
|
11
|
+
var chunk525KS5HM_cjs = require('./chunk-525KS5HM.cjs');
|
|
12
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
13
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
14
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
15
|
+
var lucideReact = require('lucide-react');
|
|
16
|
+
var React2 = require('react');
|
|
17
|
+
var streamdown = require('streamdown');
|
|
18
|
+
var shiki = require('shiki');
|
|
19
|
+
var HoverCardPrimitive = require('@radix-ui/react-hover-card');
|
|
20
|
+
var reactUseControllableState = require('@radix-ui/react-use-controllable-state');
|
|
21
|
+
var react = require('motion/react');
|
|
22
|
+
var tokenlens = require('tokenlens');
|
|
23
|
+
var react$1 = require('@xyflow/react');
|
|
24
|
+
var cmdk = require('cmdk');
|
|
25
|
+
var nanoid = require('nanoid');
|
|
26
|
+
require('@xyflow/react/dist/style.css');
|
|
27
|
+
|
|
28
|
+
function _interopNamespace(e) {
|
|
29
|
+
if (e && e.__esModule) return e;
|
|
30
|
+
var n = Object.create(null);
|
|
31
|
+
if (e) {
|
|
32
|
+
Object.keys(e).forEach(function (k) {
|
|
33
|
+
if (k !== 'default') {
|
|
34
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
35
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return e[k]; }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
n.default = e;
|
|
43
|
+
return Object.freeze(n);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
47
|
+
var HoverCardPrimitive__namespace = /*#__PURE__*/_interopNamespace(HoverCardPrimitive);
|
|
48
|
+
|
|
49
|
+
var buttonGroupVariants = classVarianceAuthority.cva(
|
|
50
|
+
"flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
|
|
51
|
+
{
|
|
52
|
+
variants: {
|
|
53
|
+
orientation: {
|
|
54
|
+
horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
|
55
|
+
vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
defaultVariants: {
|
|
59
|
+
orientation: "horizontal"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
function ButtonGroup({
|
|
64
|
+
className,
|
|
65
|
+
orientation,
|
|
66
|
+
...props
|
|
67
|
+
}) {
|
|
68
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
role: "group",
|
|
72
|
+
"data-slot": "button-group",
|
|
73
|
+
"data-orientation": orientation,
|
|
74
|
+
className: chunk525KS5HM_cjs.cn(buttonGroupVariants({ orientation }), className),
|
|
75
|
+
...props
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
function ButtonGroupText({
|
|
80
|
+
className,
|
|
81
|
+
asChild = false,
|
|
82
|
+
...props
|
|
83
|
+
}) {
|
|
84
|
+
const Comp = asChild ? reactSlot.Slot : "div";
|
|
85
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
86
|
+
Comp,
|
|
87
|
+
{
|
|
88
|
+
className: chunk525KS5HM_cjs.cn(
|
|
89
|
+
"bg-muted shadow-xs flex items-center gap-2 rounded-md border px-4 text-sm font-medium [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none",
|
|
90
|
+
className
|
|
91
|
+
),
|
|
92
|
+
...props
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
var Message = ({ className, from, fullWidth, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
className: chunk525KS5HM_cjs.cn(
|
|
100
|
+
"group flex w-full flex-col gap-2",
|
|
101
|
+
fullWidth ? "" : from === "assistant" ? "max-w-[var(--ac-assistant-max-width,95%)]" : "max-w-[95%]",
|
|
102
|
+
from === "user" ? "is-user justify-end" : "is-assistant",
|
|
103
|
+
className
|
|
104
|
+
),
|
|
105
|
+
...props
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
var MessageContent = ({
|
|
109
|
+
children,
|
|
110
|
+
className,
|
|
111
|
+
fullWidth,
|
|
112
|
+
...props
|
|
113
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
className: chunk525KS5HM_cjs.cn(
|
|
117
|
+
"flex min-w-0 flex-col gap-2 overflow-hidden",
|
|
118
|
+
fullWidth ? "w-full" : "w-fit max-w-full",
|
|
119
|
+
"group-[.is-user]:ml-auto group-[.is-user]:px-6 group-[.is-user]:py-4 group-[.is-user]:text-foreground group-[.is-user]:rounded-bl-[24px] group-[.is-user]:rounded-br-[24px] group-[.is-user]:rounded-tl-[4px] group-[.is-user]:rounded-tr-[24px] group-[.is-user]:bg-[var(--ac-user-bubble-bg,#f0f4f8)]",
|
|
120
|
+
"group-[.is-assistant]:text-foreground group-[.is-assistant]:w-full",
|
|
121
|
+
className
|
|
122
|
+
),
|
|
123
|
+
...props,
|
|
124
|
+
children
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
var MessageActions = ({
|
|
128
|
+
className,
|
|
129
|
+
children,
|
|
130
|
+
...props
|
|
131
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("flex items-center gap-1", className), ...props, children });
|
|
132
|
+
var MessageAction = ({
|
|
133
|
+
tooltip,
|
|
134
|
+
children,
|
|
135
|
+
label,
|
|
136
|
+
variant = "ghost",
|
|
137
|
+
size = "icon-sm",
|
|
138
|
+
...props
|
|
139
|
+
}) => {
|
|
140
|
+
const button = /* @__PURE__ */ jsxRuntime.jsxs(chunkWZLWAVSS_cjs.Button, { size, type: "button", variant, ...props, children: [
|
|
141
|
+
children,
|
|
142
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: label || tooltip })
|
|
143
|
+
] });
|
|
144
|
+
if (tooltip) {
|
|
145
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkX5YEOOPK_cjs.Tooltip, { children: [
|
|
146
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipTrigger, { asChild: true, children: button }),
|
|
147
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: tooltip }) })
|
|
148
|
+
] }) });
|
|
149
|
+
}
|
|
150
|
+
return button;
|
|
151
|
+
};
|
|
152
|
+
var MessageBranchContext = React2.createContext(
|
|
153
|
+
null
|
|
154
|
+
);
|
|
155
|
+
var useMessageBranch = () => {
|
|
156
|
+
const context = React2.useContext(MessageBranchContext);
|
|
157
|
+
if (!context) {
|
|
158
|
+
throw new Error(
|
|
159
|
+
"MessageBranch components must be used within MessageBranch"
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
return context;
|
|
163
|
+
};
|
|
164
|
+
var MessageBranch = ({
|
|
165
|
+
defaultBranch = 0,
|
|
166
|
+
onBranchChange,
|
|
167
|
+
className,
|
|
168
|
+
...props
|
|
169
|
+
}) => {
|
|
170
|
+
const [currentBranch, setCurrentBranch] = React2.useState(defaultBranch);
|
|
171
|
+
const [branches, setBranches] = React2.useState([]);
|
|
172
|
+
const handleBranchChange = (newBranch) => {
|
|
173
|
+
setCurrentBranch(newBranch);
|
|
174
|
+
onBranchChange?.(newBranch);
|
|
175
|
+
};
|
|
176
|
+
const goToPrevious = () => {
|
|
177
|
+
const newBranch = currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
|
|
178
|
+
handleBranchChange(newBranch);
|
|
179
|
+
};
|
|
180
|
+
const goToNext = () => {
|
|
181
|
+
const newBranch = currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
|
|
182
|
+
handleBranchChange(newBranch);
|
|
183
|
+
};
|
|
184
|
+
const contextValue = {
|
|
185
|
+
currentBranch,
|
|
186
|
+
totalBranches: branches.length,
|
|
187
|
+
goToPrevious,
|
|
188
|
+
goToNext,
|
|
189
|
+
branches,
|
|
190
|
+
setBranches
|
|
191
|
+
};
|
|
192
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MessageBranchContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
193
|
+
"div",
|
|
194
|
+
{
|
|
195
|
+
className: chunk525KS5HM_cjs.cn("grid w-full gap-2 [&>div]:pb-0", className),
|
|
196
|
+
...props
|
|
197
|
+
}
|
|
198
|
+
) });
|
|
199
|
+
};
|
|
200
|
+
var MessageBranchContent = ({
|
|
201
|
+
children,
|
|
202
|
+
...props
|
|
203
|
+
}) => {
|
|
204
|
+
const { currentBranch, setBranches, branches } = useMessageBranch();
|
|
205
|
+
const childrenArray = Array.isArray(children) ? children : [children];
|
|
206
|
+
React2.useEffect(() => {
|
|
207
|
+
if (branches.length !== childrenArray.length) {
|
|
208
|
+
setBranches(childrenArray);
|
|
209
|
+
}
|
|
210
|
+
}, [childrenArray, branches, setBranches]);
|
|
211
|
+
return childrenArray.map((branch, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
212
|
+
"div",
|
|
213
|
+
{
|
|
214
|
+
className: chunk525KS5HM_cjs.cn(
|
|
215
|
+
"grid gap-2 overflow-hidden [&>div]:pb-0",
|
|
216
|
+
index === currentBranch ? "block" : "hidden"
|
|
217
|
+
),
|
|
218
|
+
...props,
|
|
219
|
+
children: branch
|
|
220
|
+
},
|
|
221
|
+
branch.key
|
|
222
|
+
));
|
|
223
|
+
};
|
|
224
|
+
var MessageBranchSelector = ({
|
|
225
|
+
className,
|
|
226
|
+
from,
|
|
227
|
+
...props
|
|
228
|
+
}) => {
|
|
229
|
+
const { totalBranches } = useMessageBranch();
|
|
230
|
+
if (totalBranches <= 1) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
234
|
+
ButtonGroup,
|
|
235
|
+
{
|
|
236
|
+
className: "[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
|
|
237
|
+
orientation: "horizontal",
|
|
238
|
+
...props
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
var MessageBranchPrevious = ({
|
|
243
|
+
children,
|
|
244
|
+
...props
|
|
245
|
+
}) => {
|
|
246
|
+
const { goToPrevious, totalBranches } = useMessageBranch();
|
|
247
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
248
|
+
chunkWZLWAVSS_cjs.Button,
|
|
249
|
+
{
|
|
250
|
+
"aria-label": "Previous branch",
|
|
251
|
+
disabled: totalBranches <= 1,
|
|
252
|
+
onClick: goToPrevious,
|
|
253
|
+
size: "icon-sm",
|
|
254
|
+
type: "button",
|
|
255
|
+
variant: "ghost",
|
|
256
|
+
...props,
|
|
257
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { size: 14 })
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
};
|
|
261
|
+
var MessageBranchNext = ({
|
|
262
|
+
children,
|
|
263
|
+
className,
|
|
264
|
+
...props
|
|
265
|
+
}) => {
|
|
266
|
+
const { goToNext, totalBranches } = useMessageBranch();
|
|
267
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
268
|
+
chunkWZLWAVSS_cjs.Button,
|
|
269
|
+
{
|
|
270
|
+
"aria-label": "Next branch",
|
|
271
|
+
disabled: totalBranches <= 1,
|
|
272
|
+
onClick: goToNext,
|
|
273
|
+
size: "icon-sm",
|
|
274
|
+
type: "button",
|
|
275
|
+
variant: "ghost",
|
|
276
|
+
...props,
|
|
277
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, { size: 14 })
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
};
|
|
281
|
+
var MessageBranchPage = ({
|
|
282
|
+
className,
|
|
283
|
+
...props
|
|
284
|
+
}) => {
|
|
285
|
+
const { currentBranch, totalBranches } = useMessageBranch();
|
|
286
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
287
|
+
ButtonGroupText,
|
|
288
|
+
{
|
|
289
|
+
className: chunk525KS5HM_cjs.cn(
|
|
290
|
+
"border-none bg-transparent text-muted-foreground shadow-none",
|
|
291
|
+
className
|
|
292
|
+
),
|
|
293
|
+
...props,
|
|
294
|
+
children: [
|
|
295
|
+
currentBranch + 1,
|
|
296
|
+
" of ",
|
|
297
|
+
totalBranches
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
};
|
|
302
|
+
function addUtmParams(url) {
|
|
303
|
+
try {
|
|
304
|
+
const urlObj = new URL(url);
|
|
305
|
+
urlObj.searchParams.set("utm_source", "chat");
|
|
306
|
+
urlObj.searchParams.set("utm_medium", "referral");
|
|
307
|
+
return urlObj.toString();
|
|
308
|
+
} catch {
|
|
309
|
+
return url;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
var CustomLink = ({ href, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
313
|
+
"a",
|
|
314
|
+
{
|
|
315
|
+
href: href ? addUtmParams(href) : href,
|
|
316
|
+
target: "_blank",
|
|
317
|
+
rel: "noopener noreferrer",
|
|
318
|
+
className: "hover:underline hover:opacity-80 transition-opacity font-medium",
|
|
319
|
+
...props,
|
|
320
|
+
children
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
var CustomImage = ({ src, alt, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
324
|
+
"img",
|
|
325
|
+
{
|
|
326
|
+
src,
|
|
327
|
+
alt: alt || "",
|
|
328
|
+
loading: "lazy",
|
|
329
|
+
className: "rounded-xl max-w-full h-auto my-4",
|
|
330
|
+
...props
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
var CustomTable = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-4 overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
334
|
+
"table",
|
|
335
|
+
{
|
|
336
|
+
className: "w-full text-sm rounded-xl border border-black/[0.08] overflow-hidden",
|
|
337
|
+
...props,
|
|
338
|
+
children
|
|
339
|
+
}
|
|
340
|
+
) });
|
|
341
|
+
var CustomThead = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-black/[0.04]", ...props, children });
|
|
342
|
+
var CustomTh = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
343
|
+
"th",
|
|
344
|
+
{
|
|
345
|
+
className: "px-4 py-3 text-start text-xs font-medium uppercase tracking-wider opacity-60 border-b border-black/[0.08]",
|
|
346
|
+
...props,
|
|
347
|
+
children
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
var CustomTd = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
351
|
+
"td",
|
|
352
|
+
{
|
|
353
|
+
className: "px-4 py-3 border-b border-black/[0.08]",
|
|
354
|
+
...props,
|
|
355
|
+
children
|
|
356
|
+
}
|
|
357
|
+
);
|
|
358
|
+
var CustomTr = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
359
|
+
"tr",
|
|
360
|
+
{
|
|
361
|
+
className: "hover:bg-black/[0.02] transition-colors",
|
|
362
|
+
...props,
|
|
363
|
+
children
|
|
364
|
+
}
|
|
365
|
+
);
|
|
366
|
+
var MessageResponse = React2.memo(
|
|
367
|
+
({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
368
|
+
streamdown.Streamdown,
|
|
369
|
+
{
|
|
370
|
+
className: chunk525KS5HM_cjs.cn(
|
|
371
|
+
"message-response size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
372
|
+
className
|
|
373
|
+
),
|
|
374
|
+
components: {
|
|
375
|
+
a: CustomLink,
|
|
376
|
+
img: CustomImage,
|
|
377
|
+
table: CustomTable,
|
|
378
|
+
thead: CustomThead,
|
|
379
|
+
th: CustomTh,
|
|
380
|
+
td: CustomTd,
|
|
381
|
+
tr: CustomTr
|
|
382
|
+
},
|
|
383
|
+
linkSafety: { enabled: false },
|
|
384
|
+
...props
|
|
385
|
+
}
|
|
386
|
+
),
|
|
387
|
+
(prevProps, nextProps) => prevProps.children === nextProps.children
|
|
388
|
+
);
|
|
389
|
+
MessageResponse.displayName = "MessageResponse";
|
|
390
|
+
function MessageAttachment({
|
|
391
|
+
data,
|
|
392
|
+
className,
|
|
393
|
+
onRemove,
|
|
394
|
+
...props
|
|
395
|
+
}) {
|
|
396
|
+
const filename = data.filename || "";
|
|
397
|
+
const mediaType = data.mediaType?.startsWith("image/") && data.url ? "image" : "file";
|
|
398
|
+
const isImage = mediaType === "image";
|
|
399
|
+
const attachmentLabel = filename || (isImage ? "Image" : "Attachment");
|
|
400
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
401
|
+
"div",
|
|
402
|
+
{
|
|
403
|
+
className: chunk525KS5HM_cjs.cn(
|
|
404
|
+
"group relative size-24 overflow-hidden rounded-lg",
|
|
405
|
+
className
|
|
406
|
+
),
|
|
407
|
+
...props,
|
|
408
|
+
children: isImage ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
409
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
410
|
+
"img",
|
|
411
|
+
{
|
|
412
|
+
alt: filename || "attachment",
|
|
413
|
+
className: "size-full object-cover",
|
|
414
|
+
height: 100,
|
|
415
|
+
src: data.url,
|
|
416
|
+
width: 100
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
onRemove && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
420
|
+
chunkWZLWAVSS_cjs.Button,
|
|
421
|
+
{
|
|
422
|
+
"aria-label": "Remove attachment",
|
|
423
|
+
className: "absolute top-2 right-2 size-6 rounded-full bg-background/80 p-0 opacity-0 backdrop-blur-sm transition-opacity hover:bg-background group-hover:opacity-100 [&>svg]:size-3",
|
|
424
|
+
onClick: (e) => {
|
|
425
|
+
e.stopPropagation();
|
|
426
|
+
onRemove();
|
|
427
|
+
},
|
|
428
|
+
type: "button",
|
|
429
|
+
variant: "ghost",
|
|
430
|
+
children: [
|
|
431
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
|
|
432
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Remove" })
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
)
|
|
436
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
437
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkX5YEOOPK_cjs.Tooltip, { children: [
|
|
438
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-full shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PaperclipIcon, { className: "size-4" }) }) }),
|
|
439
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: attachmentLabel }) })
|
|
440
|
+
] }),
|
|
441
|
+
onRemove && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
442
|
+
chunkWZLWAVSS_cjs.Button,
|
|
443
|
+
{
|
|
444
|
+
"aria-label": "Remove attachment",
|
|
445
|
+
className: "size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 [&>svg]:size-3",
|
|
446
|
+
onClick: (e) => {
|
|
447
|
+
e.stopPropagation();
|
|
448
|
+
onRemove();
|
|
449
|
+
},
|
|
450
|
+
type: "button",
|
|
451
|
+
variant: "ghost",
|
|
452
|
+
children: [
|
|
453
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
|
|
454
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Remove" })
|
|
455
|
+
]
|
|
456
|
+
}
|
|
457
|
+
)
|
|
458
|
+
] })
|
|
459
|
+
}
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
function MessageAttachments({
|
|
463
|
+
children,
|
|
464
|
+
className,
|
|
465
|
+
...props
|
|
466
|
+
}) {
|
|
467
|
+
if (!children) {
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
471
|
+
"div",
|
|
472
|
+
{
|
|
473
|
+
className: chunk525KS5HM_cjs.cn(
|
|
474
|
+
"ml-auto flex w-fit flex-wrap items-start gap-2",
|
|
475
|
+
className
|
|
476
|
+
),
|
|
477
|
+
...props,
|
|
478
|
+
children
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
var MessageToolbar = ({
|
|
483
|
+
className,
|
|
484
|
+
children,
|
|
485
|
+
...props
|
|
486
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
487
|
+
"div",
|
|
488
|
+
{
|
|
489
|
+
className: chunk525KS5HM_cjs.cn(
|
|
490
|
+
"mt-4 flex w-full items-center justify-between gap-4",
|
|
491
|
+
className
|
|
492
|
+
),
|
|
493
|
+
...props,
|
|
494
|
+
children
|
|
495
|
+
}
|
|
496
|
+
);
|
|
497
|
+
|
|
498
|
+
// src/core/api/kb-client.ts
|
|
499
|
+
function getDefaultEndpoint() {
|
|
500
|
+
try {
|
|
501
|
+
const env = undefined;
|
|
502
|
+
if (env?.VITE_API_ENDPOINT) return env.VITE_API_ENDPOINT;
|
|
503
|
+
} catch {
|
|
504
|
+
}
|
|
505
|
+
return "http://localhost:3000";
|
|
506
|
+
}
|
|
507
|
+
async function submitFeedback(request, apiKey, apiEndpoint) {
|
|
508
|
+
const endpoint = apiEndpoint || getDefaultEndpoint();
|
|
509
|
+
const headers = {
|
|
510
|
+
"Content-Type": "application/json"
|
|
511
|
+
};
|
|
512
|
+
if (apiKey) {
|
|
513
|
+
headers["Authorization"] = `Bearer ${apiKey}`;
|
|
514
|
+
}
|
|
515
|
+
try {
|
|
516
|
+
const response = await fetch(`${endpoint}/api/kb/feedback`, {
|
|
517
|
+
method: "POST",
|
|
518
|
+
headers,
|
|
519
|
+
credentials: "include",
|
|
520
|
+
body: JSON.stringify(request)
|
|
521
|
+
});
|
|
522
|
+
if (!response.ok) {
|
|
523
|
+
const error = await response.json().catch(() => ({ error: response.statusText }));
|
|
524
|
+
return { success: false, error: error.error || response.statusText };
|
|
525
|
+
}
|
|
526
|
+
return { success: true };
|
|
527
|
+
} catch (error) {
|
|
528
|
+
return {
|
|
529
|
+
success: false,
|
|
530
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
var ThumbsUpIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
535
|
+
"path",
|
|
536
|
+
{
|
|
537
|
+
d: "M7 11V19C7 19.2652 6.89464 19.5196 6.70711 19.7071C6.51957 19.8946 6.26522 20 6 20H4C3.73478 20 3.48043 19.8946 3.29289 19.7071C3.10536 19.5196 3 19.2652 3 19V12C3 11.7348 3.10536 11.4804 3.29289 11.2929C3.48043 11.1054 3.73478 11 4 11H7ZM7 11C8.06087 11 9.07828 10.5786 9.82843 9.82843C10.5786 9.07828 11 8.06087 11 7V6C11 5.46957 11.2107 4.96086 11.5858 4.58579C11.9609 4.21071 12.4696 4 13 4C13.5304 4 14.0391 4.21071 14.4142 4.58579C14.7893 4.96086 15 5.46957 15 6V11H18C18.5304 11 19.0391 11.2107 19.4142 11.5858C19.7893 11.9609 20 12.4696 20 13L19 18C18.8562 18.6135 18.5834 19.1402 18.2227 19.501C17.8619 19.8617 17.4328 20.0368 17 20H10C9.20435 20 8.44129 19.6839 7.87868 19.1213C7.31607 18.5587 7 17.7956 7 17",
|
|
538
|
+
stroke: "currentColor",
|
|
539
|
+
strokeWidth: "1.5",
|
|
540
|
+
strokeLinecap: "round",
|
|
541
|
+
strokeLinejoin: "round"
|
|
542
|
+
}
|
|
543
|
+
) });
|
|
544
|
+
var ThumbsDownIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
545
|
+
"path",
|
|
546
|
+
{
|
|
547
|
+
d: "M7 13V4.99999C7 4.73478 6.89464 4.48042 6.70711 4.29289C6.51957 4.10535 6.26522 3.99999 6 3.99999H4C3.73478 3.99999 3.48043 4.10535 3.29289 4.29289C3.10536 4.48042 3 4.73478 3 4.99999V12C3 12.2652 3.10536 12.5196 3.29289 12.7071C3.48043 12.8946 3.73478 13 4 13H7ZM7 13C8.06087 13 9.07828 13.4214 9.82843 14.1716C10.5786 14.9217 11 15.9391 11 17V18C11 18.5304 11.2107 19.0391 11.5858 19.4142C11.9609 19.7893 12.4696 20 13 20C13.5304 20 14.0391 19.7893 14.4142 19.4142C14.7893 19.0391 15 18.5304 15 18V13H18C18.5304 13 19.0391 12.7893 19.4142 12.4142C19.7893 12.0391 20 11.5304 20 11L19 5.99999C18.8562 5.38652 18.5834 4.85975 18.2227 4.49903C17.8619 4.13831 17.4328 3.96317 17 3.99999H10C9.20435 3.99999 8.44129 4.31606 7.87868 4.87867C7.31607 5.44128 7 6.20434 7 6.99999",
|
|
548
|
+
stroke: "currentColor",
|
|
549
|
+
strokeWidth: "1.5",
|
|
550
|
+
strokeLinecap: "round",
|
|
551
|
+
strokeLinejoin: "round"
|
|
552
|
+
}
|
|
553
|
+
) });
|
|
554
|
+
var REVIEW_TYPES = [
|
|
555
|
+
{ value: "wrong_answer", labelKey: "wrongAnswer" },
|
|
556
|
+
{ value: "partial_answer", labelKey: "partialAnswer" },
|
|
557
|
+
{ value: "hallucination", labelKey: "hallucination" },
|
|
558
|
+
{ value: "inappropriate_tone", labelKey: "inappropriateTone" }
|
|
559
|
+
];
|
|
560
|
+
function MessageFeedback({
|
|
561
|
+
messageId,
|
|
562
|
+
projectId,
|
|
563
|
+
sessionId,
|
|
564
|
+
apiKey,
|
|
565
|
+
apiEndpoint,
|
|
566
|
+
textContent,
|
|
567
|
+
trackInteraction
|
|
568
|
+
}) {
|
|
569
|
+
const { t } = chunk3MP2EGEJ_cjs.useI18n();
|
|
570
|
+
const [feedback, setFeedback] = React2.useState(null);
|
|
571
|
+
const [showReviewForm, setShowReviewForm] = React2.useState(false);
|
|
572
|
+
const [reviewType, setReviewType] = React2.useState(null);
|
|
573
|
+
const [reviewText, setReviewText] = React2.useState("");
|
|
574
|
+
const [isSubmitting, setIsSubmitting] = React2.useState(false);
|
|
575
|
+
const [copied, setCopied] = React2.useState(false);
|
|
576
|
+
const submitFeedbackToApi = async (feedbackData) => {
|
|
577
|
+
if (!projectId || !messageId || isSubmitting) return;
|
|
578
|
+
setIsSubmitting(true);
|
|
579
|
+
try {
|
|
580
|
+
const request = {
|
|
581
|
+
projectId,
|
|
582
|
+
sessionId,
|
|
583
|
+
messageId,
|
|
584
|
+
isPositive: feedbackData.isPositive,
|
|
585
|
+
issueType: feedbackData.reviewType,
|
|
586
|
+
feedbackText: feedbackData.reviewText
|
|
587
|
+
};
|
|
588
|
+
const result = await submitFeedback(request, apiKey, apiEndpoint);
|
|
589
|
+
if (!result.success) {
|
|
590
|
+
console.error("Failed to submit feedback:", result.error);
|
|
591
|
+
}
|
|
592
|
+
} catch (error) {
|
|
593
|
+
console.error("Failed to submit feedback:", error);
|
|
594
|
+
} finally {
|
|
595
|
+
setIsSubmitting(false);
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
const handlePositiveFeedback = () => {
|
|
599
|
+
if (isSubmitting) return;
|
|
600
|
+
setFeedback("positive");
|
|
601
|
+
setShowReviewForm(false);
|
|
602
|
+
submitFeedbackToApi({ isPositive: true });
|
|
603
|
+
trackInteraction?.({
|
|
604
|
+
type: "feedback",
|
|
605
|
+
target: "thumbs_up",
|
|
606
|
+
label: "Positive feedback",
|
|
607
|
+
messageId,
|
|
608
|
+
metadata: { isPositive: true }
|
|
609
|
+
});
|
|
610
|
+
};
|
|
611
|
+
const handleNegativeFeedback = () => {
|
|
612
|
+
if (isSubmitting) return;
|
|
613
|
+
setFeedback("negative");
|
|
614
|
+
setShowReviewForm(true);
|
|
615
|
+
};
|
|
616
|
+
const handleSubmitReview = () => {
|
|
617
|
+
if (isSubmitting) return;
|
|
618
|
+
const feedbackData = {
|
|
619
|
+
isPositive: false,
|
|
620
|
+
reviewType: reviewType ?? void 0,
|
|
621
|
+
reviewText: reviewText || void 0
|
|
622
|
+
};
|
|
623
|
+
setShowReviewForm(false);
|
|
624
|
+
submitFeedbackToApi(feedbackData);
|
|
625
|
+
trackInteraction?.({
|
|
626
|
+
type: "feedback",
|
|
627
|
+
target: "thumbs_down",
|
|
628
|
+
label: "Negative feedback",
|
|
629
|
+
messageId,
|
|
630
|
+
metadata: { isPositive: false, reviewType, reviewText }
|
|
631
|
+
});
|
|
632
|
+
};
|
|
633
|
+
const handleCancelReview = () => {
|
|
634
|
+
setFeedback(null);
|
|
635
|
+
setShowReviewForm(false);
|
|
636
|
+
setReviewType(null);
|
|
637
|
+
setReviewText("");
|
|
638
|
+
};
|
|
639
|
+
const handleCopy = async () => {
|
|
640
|
+
if (typeof window === "undefined" || !navigator?.clipboard?.writeText) return;
|
|
641
|
+
try {
|
|
642
|
+
await navigator.clipboard.writeText(textContent);
|
|
643
|
+
setCopied(true);
|
|
644
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
645
|
+
trackInteraction?.({
|
|
646
|
+
type: "copy",
|
|
647
|
+
target: "message",
|
|
648
|
+
label: "Copy response",
|
|
649
|
+
messageId,
|
|
650
|
+
metadata: { contentLength: textContent.length }
|
|
651
|
+
});
|
|
652
|
+
} catch (error) {
|
|
653
|
+
console.error("Failed to copy:", error);
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4", children: [
|
|
657
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
658
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
659
|
+
"button",
|
|
660
|
+
{
|
|
661
|
+
type: "button",
|
|
662
|
+
onClick: handlePositiveFeedback,
|
|
663
|
+
disabled: isSubmitting,
|
|
664
|
+
className: chunk525KS5HM_cjs.cn(
|
|
665
|
+
"group w-8 h-8 rounded-full flex items-center justify-center transition-all duration-300",
|
|
666
|
+
feedback === "positive" ? "bg-primary/10 text-primary" : "bg-secondary text-muted-foreground hover:bg-primary/10 hover:text-primary",
|
|
667
|
+
isSubmitting && "opacity-50 cursor-not-allowed"
|
|
668
|
+
),
|
|
669
|
+
title: t("helpful"),
|
|
670
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ThumbsUpIcon, {})
|
|
671
|
+
}
|
|
672
|
+
),
|
|
673
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
674
|
+
"button",
|
|
675
|
+
{
|
|
676
|
+
type: "button",
|
|
677
|
+
onClick: handleNegativeFeedback,
|
|
678
|
+
disabled: isSubmitting,
|
|
679
|
+
className: chunk525KS5HM_cjs.cn(
|
|
680
|
+
"group w-8 h-8 rounded-full flex items-center justify-center transition-all duration-300",
|
|
681
|
+
feedback === "negative" ? "bg-red-100 text-red-500" : "bg-secondary text-muted-foreground hover:bg-red-50 hover:text-red-500",
|
|
682
|
+
isSubmitting && "opacity-50 cursor-not-allowed"
|
|
683
|
+
),
|
|
684
|
+
title: t("notHelpful"),
|
|
685
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ThumbsDownIcon, {})
|
|
686
|
+
}
|
|
687
|
+
),
|
|
688
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
689
|
+
"button",
|
|
690
|
+
{
|
|
691
|
+
type: "button",
|
|
692
|
+
onClick: handleCopy,
|
|
693
|
+
className: "group w-8 h-8 rounded-full bg-secondary flex items-center justify-center text-muted-foreground hover:bg-primary/10 hover:text-primary transition-all duration-300",
|
|
694
|
+
title: t("copyResponse"),
|
|
695
|
+
children: copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-4 h-4 text-green-600" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "w-4 h-4" })
|
|
696
|
+
}
|
|
697
|
+
)
|
|
698
|
+
] }),
|
|
699
|
+
showReviewForm && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 bg-gradient-to-br from-accent to-secondary rounded-2xl border border-border overflow-hidden animate-in slide-in-from-top-2 duration-300", children: [
|
|
700
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-5 py-4 border-b border-border flex items-center justify-between", children: [
|
|
701
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
702
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-8 h-8 rounded-xl bg-card border border-border flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ThumbsDownIcon, { className: "text-red-500" }) }),
|
|
703
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-sm", children: t("whatWentWrong") })
|
|
704
|
+
] }),
|
|
705
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
706
|
+
"button",
|
|
707
|
+
{
|
|
708
|
+
type: "button",
|
|
709
|
+
onClick: handleCancelReview,
|
|
710
|
+
className: "w-8 h-8 rounded-full bg-card border border-border flex items-center justify-center hover:border-primary transition-colors",
|
|
711
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-4 h-4" })
|
|
712
|
+
}
|
|
713
|
+
)
|
|
714
|
+
] }),
|
|
715
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-5 space-y-4", children: [
|
|
716
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: REVIEW_TYPES.map((type) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
717
|
+
"button",
|
|
718
|
+
{
|
|
719
|
+
type: "button",
|
|
720
|
+
onClick: () => setReviewType(type.value),
|
|
721
|
+
className: chunk525KS5HM_cjs.cn(
|
|
722
|
+
"px-4 py-2 rounded-full text-xs font-medium transition-all duration-300",
|
|
723
|
+
reviewType === type.value ? "bg-primary text-primary-foreground shadow-md shadow-primary/20" : "bg-card border border-border text-foreground hover:border-primary hover:text-primary"
|
|
724
|
+
),
|
|
725
|
+
children: t(type.labelKey)
|
|
726
|
+
},
|
|
727
|
+
type.value
|
|
728
|
+
)) }),
|
|
729
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
730
|
+
chunkX5YEOOPK_cjs.Textarea,
|
|
731
|
+
{
|
|
732
|
+
placeholder: t("addDetails"),
|
|
733
|
+
value: reviewText,
|
|
734
|
+
onChange: (e) => setReviewText(e.target.value),
|
|
735
|
+
rows: 2,
|
|
736
|
+
className: "text-sm resize-none rounded-xl border-border focus:border-primary focus:ring-primary/20"
|
|
737
|
+
}
|
|
738
|
+
),
|
|
739
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
740
|
+
"button",
|
|
741
|
+
{
|
|
742
|
+
type: "button",
|
|
743
|
+
onClick: handleSubmitReview,
|
|
744
|
+
disabled: isSubmitting,
|
|
745
|
+
className: "group relative px-5 py-2.5 bg-primary text-primary-foreground rounded-full text-sm font-medium overflow-hidden transition-all duration-300 hover:shadow-lg hover:shadow-primary/25 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
746
|
+
children: [
|
|
747
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10", children: isSubmitting ? t("submitting") : t("submitFeedback") }),
|
|
748
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
749
|
+
"div",
|
|
750
|
+
{
|
|
751
|
+
className: "absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity bg-primary/90"
|
|
752
|
+
}
|
|
753
|
+
)
|
|
754
|
+
]
|
|
755
|
+
}
|
|
756
|
+
) })
|
|
757
|
+
] })
|
|
758
|
+
] }),
|
|
759
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `
|
|
760
|
+
.animate-in {
|
|
761
|
+
animation: animateIn 0.3s ease-out;
|
|
762
|
+
}
|
|
763
|
+
.slide-in-from-top-2 {
|
|
764
|
+
--tw-enter-translate-y: -0.5rem;
|
|
765
|
+
}
|
|
766
|
+
@keyframes animateIn {
|
|
767
|
+
from {
|
|
768
|
+
opacity: 0;
|
|
769
|
+
transform: translateY(var(--tw-enter-translate-y, 0));
|
|
770
|
+
}
|
|
771
|
+
to {
|
|
772
|
+
opacity: 1;
|
|
773
|
+
transform: translateY(0);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
` })
|
|
777
|
+
] });
|
|
778
|
+
}
|
|
779
|
+
var MOBILE_BREAKPOINT = 768;
|
|
780
|
+
function subscribeToResize(cb) {
|
|
781
|
+
if (typeof window === "undefined") return () => {
|
|
782
|
+
};
|
|
783
|
+
window.addEventListener("resize", cb);
|
|
784
|
+
return () => window.removeEventListener("resize", cb);
|
|
785
|
+
}
|
|
786
|
+
function getIsMobile() {
|
|
787
|
+
if (typeof window === "undefined") return false;
|
|
788
|
+
return window.innerWidth < MOBILE_BREAKPOINT;
|
|
789
|
+
}
|
|
790
|
+
function ComponentRenderer({
|
|
791
|
+
htmlCode,
|
|
792
|
+
cssCode,
|
|
793
|
+
data,
|
|
794
|
+
mobileGridCols = 1,
|
|
795
|
+
desktopGridCols = 3,
|
|
796
|
+
onInteraction,
|
|
797
|
+
messageId,
|
|
798
|
+
eventId,
|
|
799
|
+
mobilePageSize = 4,
|
|
800
|
+
desktopPageSize = 4
|
|
801
|
+
}) {
|
|
802
|
+
const containerId = React2.useId();
|
|
803
|
+
const containerRef = React2.useRef(null);
|
|
804
|
+
const [currentPage, setCurrentPage] = React2.useState(0);
|
|
805
|
+
const isMobile = React2.useSyncExternalStore(subscribeToResize, getIsMobile, () => true);
|
|
806
|
+
const pageSize = isMobile ? mobilePageSize : desktopPageSize;
|
|
807
|
+
const isArray = Array.isArray(data);
|
|
808
|
+
const totalItems = isArray ? data.length : 1;
|
|
809
|
+
const totalPages = isArray ? Math.ceil(totalItems / pageSize) : 1;
|
|
810
|
+
const hasPagination = isArray && totalItems > pageSize;
|
|
811
|
+
React2.useEffect(() => {
|
|
812
|
+
setCurrentPage((p) => Math.min(p, Math.max(0, totalPages - 1)));
|
|
813
|
+
}, [totalPages]);
|
|
814
|
+
const displayData = isArray && hasPagination ? data.slice(currentPage * pageSize, (currentPage + 1) * pageSize) : data;
|
|
815
|
+
React2.useEffect(() => {
|
|
816
|
+
if (!containerRef.current) return;
|
|
817
|
+
if (typeof document === "undefined") return;
|
|
818
|
+
let processedHtml = "";
|
|
819
|
+
if (Array.isArray(displayData)) {
|
|
820
|
+
const gridId = `grid-${containerId}`;
|
|
821
|
+
const items = displayData.map((item, idx) => {
|
|
822
|
+
let rendered = replaceTemplateVariables(htmlCode, item);
|
|
823
|
+
rendered = chunkJOO6C3XT_cjs.processImagesInHtml(rendered);
|
|
824
|
+
const globalIndex = currentPage * pageSize + idx;
|
|
825
|
+
return `<div class="grid-item" data-item-index="${globalIndex}">${rendered}</div>`;
|
|
826
|
+
}).join("");
|
|
827
|
+
processedHtml = `<div class="grid-container" id="${gridId}">${items}</div>`;
|
|
828
|
+
} else {
|
|
829
|
+
processedHtml = replaceTemplateVariables(htmlCode, displayData);
|
|
830
|
+
processedHtml = chunkJOO6C3XT_cjs.processImagesInHtml(processedHtml);
|
|
831
|
+
}
|
|
832
|
+
containerRef.current.innerHTML = processedHtml;
|
|
833
|
+
const styleId = `component-style-${containerId}`;
|
|
834
|
+
const existingStyle = document.getElementById(styleId);
|
|
835
|
+
if (existingStyle) {
|
|
836
|
+
existingStyle.remove();
|
|
837
|
+
}
|
|
838
|
+
let finalCss = cssCode;
|
|
839
|
+
if (Array.isArray(displayData)) {
|
|
840
|
+
const gridCss = `
|
|
841
|
+
#${containerId} .grid-container {
|
|
842
|
+
display: grid;
|
|
843
|
+
grid-template-columns: repeat(${mobileGridCols}, 1fr);
|
|
844
|
+
gap: 1rem;
|
|
845
|
+
width: 100%;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
#${containerId} .grid-item {
|
|
849
|
+
width: 100%;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
@media (min-width: 768px) {
|
|
853
|
+
#${containerId} .grid-container {
|
|
854
|
+
grid-template-columns: repeat(${desktopGridCols}, 1fr);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
`;
|
|
858
|
+
finalCss = `${cssCode}
|
|
859
|
+
${gridCss}`;
|
|
860
|
+
}
|
|
861
|
+
const style = document.createElement("style");
|
|
862
|
+
style.id = styleId;
|
|
863
|
+
style.textContent = finalCss;
|
|
864
|
+
containerRef.current.appendChild(style);
|
|
865
|
+
const images = containerRef.current.querySelectorAll("img");
|
|
866
|
+
images.forEach((img) => {
|
|
867
|
+
if (!img.hasAttribute("loading")) {
|
|
868
|
+
img.setAttribute("loading", "lazy");
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
const links = containerRef.current.querySelectorAll("a");
|
|
872
|
+
links.forEach((link) => {
|
|
873
|
+
link.setAttribute("target", "_blank");
|
|
874
|
+
link.setAttribute("rel", "noopener noreferrer");
|
|
875
|
+
});
|
|
876
|
+
}, [htmlCode, cssCode, displayData, mobileGridCols, desktopGridCols, containerId, currentPage, pageSize, totalItems, totalPages]);
|
|
877
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "component-renderer-wrapper", children: [
|
|
878
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
879
|
+
"div",
|
|
880
|
+
{
|
|
881
|
+
ref: containerRef,
|
|
882
|
+
id: containerId,
|
|
883
|
+
className: "component-render w-full rounded",
|
|
884
|
+
onClick: (e) => {
|
|
885
|
+
if (!onInteraction) return;
|
|
886
|
+
const target = e.target;
|
|
887
|
+
const link = target.closest("a");
|
|
888
|
+
const button = target.closest("button");
|
|
889
|
+
if (link?.href) {
|
|
890
|
+
onInteraction({
|
|
891
|
+
type: "link_click",
|
|
892
|
+
target: link.href,
|
|
893
|
+
label: link.textContent || link.href,
|
|
894
|
+
metadata: { url: link.href, text: link.textContent },
|
|
895
|
+
messageId,
|
|
896
|
+
eventId
|
|
897
|
+
});
|
|
898
|
+
} else if (button && !button.hasAttribute("data-no-track")) {
|
|
899
|
+
onInteraction({
|
|
900
|
+
type: "button_click",
|
|
901
|
+
target: button.textContent || "button",
|
|
902
|
+
label: button.textContent || "button",
|
|
903
|
+
metadata: { buttonText: button.textContent },
|
|
904
|
+
messageId,
|
|
905
|
+
eventId
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
style: { display: "block" }
|
|
910
|
+
}
|
|
911
|
+
),
|
|
912
|
+
hasPagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-2 mt-4", dir: "ltr", children: [
|
|
913
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
914
|
+
"button",
|
|
915
|
+
{
|
|
916
|
+
onClick: () => setCurrentPage((p) => Math.max(0, p - 1)),
|
|
917
|
+
disabled: currentPage === 0,
|
|
918
|
+
className: "px-3 py-1.5 text-sm rounded-md border border-gray-300 disabled:opacity-40 disabled:cursor-not-allowed hover:bg-gray-100 transition-colors",
|
|
919
|
+
"aria-label": "Previous page",
|
|
920
|
+
children: "\u2039"
|
|
921
|
+
}
|
|
922
|
+
),
|
|
923
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-gray-600 px-2 tabular-nums", children: [
|
|
924
|
+
currentPage + 1,
|
|
925
|
+
" / ",
|
|
926
|
+
totalPages
|
|
927
|
+
] }),
|
|
928
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
929
|
+
"button",
|
|
930
|
+
{
|
|
931
|
+
onClick: () => setCurrentPage((p) => Math.min(totalPages - 1, p + 1)),
|
|
932
|
+
disabled: currentPage >= totalPages - 1,
|
|
933
|
+
className: "px-3 py-1.5 text-sm rounded-md border border-gray-300 disabled:opacity-40 disabled:cursor-not-allowed hover:bg-gray-100 transition-colors",
|
|
934
|
+
"aria-label": "Next page",
|
|
935
|
+
children: "\u203A"
|
|
936
|
+
}
|
|
937
|
+
)
|
|
938
|
+
] })
|
|
939
|
+
] });
|
|
940
|
+
}
|
|
941
|
+
function replaceTemplateVariables(html, data) {
|
|
942
|
+
let processed = processEachBlocks(html, data);
|
|
943
|
+
processed = processed.replace(/\{\{[#/][^}]+\}\}/g, "");
|
|
944
|
+
processed = processed.replace(/\{\{this\}\}/g, () => {
|
|
945
|
+
return data !== void 0 && data !== null ? String(data) : "";
|
|
946
|
+
});
|
|
947
|
+
processed = processed.replace(/\{\{this\.([^}]+)\}\}/g, "{{$1}}");
|
|
948
|
+
return processed.replace(/\{\{([^}]+)\}\}/g, (match, path) => {
|
|
949
|
+
try {
|
|
950
|
+
const trimmedPath = path.trim();
|
|
951
|
+
const value = getNestedValue(data, trimmedPath);
|
|
952
|
+
if (value === void 0 || value === null) {
|
|
953
|
+
return "";
|
|
954
|
+
}
|
|
955
|
+
if (typeof value === "object") {
|
|
956
|
+
return JSON.stringify(value);
|
|
957
|
+
}
|
|
958
|
+
return String(value);
|
|
959
|
+
} catch (error) {
|
|
960
|
+
console.error(`Error processing template variable {{${path}}}:`, error);
|
|
961
|
+
return match;
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
function processEachBlocks(html, data) {
|
|
966
|
+
const eachRegex = /\{\{#each\s+([^}]+)\}\}([\s\S]*?)\{\{\/each\}\}/g;
|
|
967
|
+
return html.replace(eachRegex, (_match, field, content) => {
|
|
968
|
+
const trimmedField = field.trim();
|
|
969
|
+
const array = getNestedValue(data, trimmedField);
|
|
970
|
+
if (!Array.isArray(array)) {
|
|
971
|
+
return "";
|
|
972
|
+
}
|
|
973
|
+
return array.map((item) => {
|
|
974
|
+
let itemHtml = processEachBlocks(content, item);
|
|
975
|
+
if (typeof item !== "object" || item === null) {
|
|
976
|
+
itemHtml = itemHtml.replace(/\{\{this\}\}/g, String(item));
|
|
977
|
+
return itemHtml;
|
|
978
|
+
}
|
|
979
|
+
itemHtml = itemHtml.replace(/\{\{this\.([^}]+)\}\}/g, "{{$1}}");
|
|
980
|
+
itemHtml = itemHtml.replace(/\{\{([^}]+)\}\}/g, (m, path) => {
|
|
981
|
+
const trimmedPath = path.trim();
|
|
982
|
+
if (trimmedPath.startsWith("#") || trimmedPath.startsWith("/")) return m;
|
|
983
|
+
const value = getNestedValue(item, trimmedPath);
|
|
984
|
+
if (value === void 0 || value === null) return "";
|
|
985
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
986
|
+
return String(value);
|
|
987
|
+
});
|
|
988
|
+
return itemHtml;
|
|
989
|
+
}).join("");
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
function getNestedValue(obj, path) {
|
|
993
|
+
if (!path || obj === null || obj === void 0) {
|
|
994
|
+
return void 0;
|
|
995
|
+
}
|
|
996
|
+
const parts = path.split(/\.(?![^[]*\])/);
|
|
997
|
+
let current = obj;
|
|
998
|
+
for (const part of parts) {
|
|
999
|
+
if (current === null || current === void 0) {
|
|
1000
|
+
return void 0;
|
|
1001
|
+
}
|
|
1002
|
+
const arrayMatch = part.match(/^([^[]+)\[([^\]]+)\]$/);
|
|
1003
|
+
if (arrayMatch) {
|
|
1004
|
+
const [, key, index] = arrayMatch;
|
|
1005
|
+
current = current[key];
|
|
1006
|
+
if (Array.isArray(current)) {
|
|
1007
|
+
current = current[parseInt(index, 10)];
|
|
1008
|
+
}
|
|
1009
|
+
} else {
|
|
1010
|
+
current = current[part];
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
return current;
|
|
1014
|
+
}
|
|
1015
|
+
var Artifact = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1016
|
+
"div",
|
|
1017
|
+
{
|
|
1018
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1019
|
+
"flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm",
|
|
1020
|
+
className
|
|
1021
|
+
),
|
|
1022
|
+
...props
|
|
1023
|
+
}
|
|
1024
|
+
);
|
|
1025
|
+
var ArtifactHeader = ({
|
|
1026
|
+
className,
|
|
1027
|
+
...props
|
|
1028
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1029
|
+
"div",
|
|
1030
|
+
{
|
|
1031
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1032
|
+
"flex items-center justify-between border-b bg-muted/50 px-4 py-3",
|
|
1033
|
+
className
|
|
1034
|
+
),
|
|
1035
|
+
...props
|
|
1036
|
+
}
|
|
1037
|
+
);
|
|
1038
|
+
var ArtifactClose = ({
|
|
1039
|
+
className,
|
|
1040
|
+
children,
|
|
1041
|
+
size = "sm",
|
|
1042
|
+
variant = "ghost",
|
|
1043
|
+
...props
|
|
1044
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1045
|
+
chunkWZLWAVSS_cjs.Button,
|
|
1046
|
+
{
|
|
1047
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1048
|
+
"size-8 p-0 text-muted-foreground hover:text-foreground",
|
|
1049
|
+
className
|
|
1050
|
+
),
|
|
1051
|
+
size,
|
|
1052
|
+
type: "button",
|
|
1053
|
+
variant,
|
|
1054
|
+
...props,
|
|
1055
|
+
children: [
|
|
1056
|
+
children ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "size-4" }),
|
|
1057
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
|
|
1058
|
+
]
|
|
1059
|
+
}
|
|
1060
|
+
);
|
|
1061
|
+
var ArtifactTitle = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1062
|
+
"p",
|
|
1063
|
+
{
|
|
1064
|
+
className: chunk525KS5HM_cjs.cn("font-medium text-foreground text-sm", className),
|
|
1065
|
+
...props
|
|
1066
|
+
}
|
|
1067
|
+
);
|
|
1068
|
+
var ArtifactDescription = ({
|
|
1069
|
+
className,
|
|
1070
|
+
...props
|
|
1071
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: chunk525KS5HM_cjs.cn("text-muted-foreground text-sm", className), ...props });
|
|
1072
|
+
var ArtifactActions = ({
|
|
1073
|
+
className,
|
|
1074
|
+
...props
|
|
1075
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("flex items-center gap-1", className), ...props });
|
|
1076
|
+
var ArtifactAction = ({
|
|
1077
|
+
tooltip,
|
|
1078
|
+
label,
|
|
1079
|
+
icon: Icon,
|
|
1080
|
+
children,
|
|
1081
|
+
className,
|
|
1082
|
+
size = "sm",
|
|
1083
|
+
variant = "ghost",
|
|
1084
|
+
...props
|
|
1085
|
+
}) => {
|
|
1086
|
+
const button = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1087
|
+
chunkWZLWAVSS_cjs.Button,
|
|
1088
|
+
{
|
|
1089
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1090
|
+
"size-8 p-0 text-muted-foreground hover:text-foreground",
|
|
1091
|
+
className
|
|
1092
|
+
),
|
|
1093
|
+
size,
|
|
1094
|
+
type: "button",
|
|
1095
|
+
variant,
|
|
1096
|
+
...props,
|
|
1097
|
+
children: [
|
|
1098
|
+
Icon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" }) : children,
|
|
1099
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: label || tooltip })
|
|
1100
|
+
]
|
|
1101
|
+
}
|
|
1102
|
+
);
|
|
1103
|
+
if (tooltip) {
|
|
1104
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkX5YEOOPK_cjs.Tooltip, { children: [
|
|
1105
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipTrigger, { asChild: true, children: button }),
|
|
1106
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: tooltip }) })
|
|
1107
|
+
] }) });
|
|
1108
|
+
}
|
|
1109
|
+
return button;
|
|
1110
|
+
};
|
|
1111
|
+
var ArtifactContent = ({
|
|
1112
|
+
className,
|
|
1113
|
+
...props
|
|
1114
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("flex-1 overflow-auto p-4", className), ...props });
|
|
1115
|
+
var CodeBlockContext = React2.createContext({
|
|
1116
|
+
code: ""
|
|
1117
|
+
});
|
|
1118
|
+
var lineNumberTransformer = {
|
|
1119
|
+
name: "line-numbers",
|
|
1120
|
+
line(node, line) {
|
|
1121
|
+
node.children.unshift({
|
|
1122
|
+
type: "element",
|
|
1123
|
+
tagName: "span",
|
|
1124
|
+
properties: {
|
|
1125
|
+
className: [
|
|
1126
|
+
"inline-block",
|
|
1127
|
+
"min-w-10",
|
|
1128
|
+
"mr-4",
|
|
1129
|
+
"text-right",
|
|
1130
|
+
"select-none",
|
|
1131
|
+
"text-muted-foreground"
|
|
1132
|
+
]
|
|
1133
|
+
},
|
|
1134
|
+
children: [{ type: "text", value: String(line) }]
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
};
|
|
1138
|
+
async function highlightCode(code, language, showLineNumbers = false) {
|
|
1139
|
+
const transformers = showLineNumbers ? [lineNumberTransformer] : [];
|
|
1140
|
+
return await Promise.all([
|
|
1141
|
+
shiki.codeToHtml(code, {
|
|
1142
|
+
lang: language,
|
|
1143
|
+
theme: "one-light",
|
|
1144
|
+
transformers
|
|
1145
|
+
}),
|
|
1146
|
+
shiki.codeToHtml(code, {
|
|
1147
|
+
lang: language,
|
|
1148
|
+
theme: "one-dark-pro",
|
|
1149
|
+
transformers
|
|
1150
|
+
})
|
|
1151
|
+
]);
|
|
1152
|
+
}
|
|
1153
|
+
var CodeBlock = ({
|
|
1154
|
+
code,
|
|
1155
|
+
language,
|
|
1156
|
+
showLineNumbers = false,
|
|
1157
|
+
className,
|
|
1158
|
+
children,
|
|
1159
|
+
...props
|
|
1160
|
+
}) => {
|
|
1161
|
+
const [html, setHtml] = React2.useState("");
|
|
1162
|
+
const [darkHtml, setDarkHtml] = React2.useState("");
|
|
1163
|
+
const mounted = React2.useRef(false);
|
|
1164
|
+
React2.useEffect(() => {
|
|
1165
|
+
highlightCode(code, language, showLineNumbers).then(([light, dark]) => {
|
|
1166
|
+
if (!mounted.current) {
|
|
1167
|
+
setHtml(light);
|
|
1168
|
+
setDarkHtml(dark);
|
|
1169
|
+
mounted.current = true;
|
|
1170
|
+
}
|
|
1171
|
+
});
|
|
1172
|
+
return () => {
|
|
1173
|
+
mounted.current = false;
|
|
1174
|
+
};
|
|
1175
|
+
}, [code, language, showLineNumbers]);
|
|
1176
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CodeBlockContext.Provider, { value: { code }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1177
|
+
"div",
|
|
1178
|
+
{
|
|
1179
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1180
|
+
"group relative w-full overflow-hidden rounded-md border bg-background text-foreground",
|
|
1181
|
+
className
|
|
1182
|
+
),
|
|
1183
|
+
...props,
|
|
1184
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
1185
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1186
|
+
"div",
|
|
1187
|
+
{
|
|
1188
|
+
className: "overflow-auto dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",
|
|
1189
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
1190
|
+
}
|
|
1191
|
+
),
|
|
1192
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1193
|
+
"div",
|
|
1194
|
+
{
|
|
1195
|
+
className: "hidden overflow-auto dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",
|
|
1196
|
+
dangerouslySetInnerHTML: { __html: darkHtml }
|
|
1197
|
+
}
|
|
1198
|
+
),
|
|
1199
|
+
children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-2 right-2 flex items-center gap-2", children })
|
|
1200
|
+
] })
|
|
1201
|
+
}
|
|
1202
|
+
) });
|
|
1203
|
+
};
|
|
1204
|
+
var CodeBlockCopyButton = ({
|
|
1205
|
+
onCopy,
|
|
1206
|
+
onError,
|
|
1207
|
+
timeout = 2e3,
|
|
1208
|
+
children,
|
|
1209
|
+
className,
|
|
1210
|
+
...props
|
|
1211
|
+
}) => {
|
|
1212
|
+
const [isCopied, setIsCopied] = React2.useState(false);
|
|
1213
|
+
const { code } = React2.useContext(CodeBlockContext);
|
|
1214
|
+
const copyToClipboard = async () => {
|
|
1215
|
+
if (typeof window === "undefined" || !navigator?.clipboard?.writeText) {
|
|
1216
|
+
onError?.(new Error("Clipboard API not available"));
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
try {
|
|
1220
|
+
await navigator.clipboard.writeText(code);
|
|
1221
|
+
setIsCopied(true);
|
|
1222
|
+
onCopy?.();
|
|
1223
|
+
setTimeout(() => setIsCopied(false), timeout);
|
|
1224
|
+
} catch (error) {
|
|
1225
|
+
onError?.(error);
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
const Icon = isCopied ? lucideReact.CheckIcon : lucideReact.CopyIcon;
|
|
1229
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1230
|
+
chunkWZLWAVSS_cjs.Button,
|
|
1231
|
+
{
|
|
1232
|
+
className: chunk525KS5HM_cjs.cn("shrink-0", className),
|
|
1233
|
+
onClick: copyToClipboard,
|
|
1234
|
+
size: "icon",
|
|
1235
|
+
variant: "ghost",
|
|
1236
|
+
...props,
|
|
1237
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 14 })
|
|
1238
|
+
}
|
|
1239
|
+
);
|
|
1240
|
+
};
|
|
1241
|
+
var WebPreviewContext = React2.createContext(null);
|
|
1242
|
+
var useWebPreview = () => {
|
|
1243
|
+
const context = React2.useContext(WebPreviewContext);
|
|
1244
|
+
if (!context) {
|
|
1245
|
+
throw new Error("WebPreview components must be used within a WebPreview");
|
|
1246
|
+
}
|
|
1247
|
+
return context;
|
|
1248
|
+
};
|
|
1249
|
+
var WebPreview = ({
|
|
1250
|
+
className,
|
|
1251
|
+
children,
|
|
1252
|
+
defaultUrl = "",
|
|
1253
|
+
onUrlChange,
|
|
1254
|
+
...props
|
|
1255
|
+
}) => {
|
|
1256
|
+
const [url, setUrl] = React2.useState(defaultUrl);
|
|
1257
|
+
const [consoleOpen, setConsoleOpen] = React2.useState(false);
|
|
1258
|
+
const handleUrlChange = (newUrl) => {
|
|
1259
|
+
setUrl(newUrl);
|
|
1260
|
+
onUrlChange?.(newUrl);
|
|
1261
|
+
};
|
|
1262
|
+
const contextValue = {
|
|
1263
|
+
url,
|
|
1264
|
+
setUrl: handleUrlChange,
|
|
1265
|
+
consoleOpen,
|
|
1266
|
+
setConsoleOpen
|
|
1267
|
+
};
|
|
1268
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WebPreviewContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1269
|
+
"div",
|
|
1270
|
+
{
|
|
1271
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1272
|
+
"flex size-full flex-col rounded-lg border bg-card",
|
|
1273
|
+
className
|
|
1274
|
+
),
|
|
1275
|
+
...props,
|
|
1276
|
+
children
|
|
1277
|
+
}
|
|
1278
|
+
) });
|
|
1279
|
+
};
|
|
1280
|
+
var WebPreviewNavigation = ({
|
|
1281
|
+
className,
|
|
1282
|
+
children,
|
|
1283
|
+
...props
|
|
1284
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1285
|
+
"div",
|
|
1286
|
+
{
|
|
1287
|
+
className: chunk525KS5HM_cjs.cn("flex items-center gap-1 border-b p-2", className),
|
|
1288
|
+
...props,
|
|
1289
|
+
children
|
|
1290
|
+
}
|
|
1291
|
+
);
|
|
1292
|
+
var WebPreviewNavigationButton = ({
|
|
1293
|
+
onClick,
|
|
1294
|
+
disabled,
|
|
1295
|
+
tooltip,
|
|
1296
|
+
children,
|
|
1297
|
+
...props
|
|
1298
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkX5YEOOPK_cjs.Tooltip, { children: [
|
|
1299
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1300
|
+
chunkWZLWAVSS_cjs.Button,
|
|
1301
|
+
{
|
|
1302
|
+
className: "h-8 w-8 p-0 hover:text-foreground",
|
|
1303
|
+
disabled,
|
|
1304
|
+
onClick,
|
|
1305
|
+
size: "sm",
|
|
1306
|
+
variant: "ghost",
|
|
1307
|
+
...props,
|
|
1308
|
+
children
|
|
1309
|
+
}
|
|
1310
|
+
) }),
|
|
1311
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: tooltip }) })
|
|
1312
|
+
] }) });
|
|
1313
|
+
var WebPreviewUrl = ({
|
|
1314
|
+
value,
|
|
1315
|
+
onChange,
|
|
1316
|
+
onKeyDown,
|
|
1317
|
+
...props
|
|
1318
|
+
}) => {
|
|
1319
|
+
const { url, setUrl } = useWebPreview();
|
|
1320
|
+
const [inputValue, setInputValue] = React2.useState(url);
|
|
1321
|
+
React2.useEffect(() => {
|
|
1322
|
+
setInputValue(url);
|
|
1323
|
+
}, [url]);
|
|
1324
|
+
const handleChange = (event) => {
|
|
1325
|
+
setInputValue(event.target.value);
|
|
1326
|
+
onChange?.(event);
|
|
1327
|
+
};
|
|
1328
|
+
const handleKeyDown = (event) => {
|
|
1329
|
+
if (event.key === "Enter") {
|
|
1330
|
+
const target = event.target;
|
|
1331
|
+
setUrl(target.value);
|
|
1332
|
+
}
|
|
1333
|
+
onKeyDown?.(event);
|
|
1334
|
+
};
|
|
1335
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1336
|
+
chunkX5YEOOPK_cjs.Input,
|
|
1337
|
+
{
|
|
1338
|
+
className: "h-8 flex-1 text-sm",
|
|
1339
|
+
onChange: onChange ?? handleChange,
|
|
1340
|
+
onKeyDown: handleKeyDown,
|
|
1341
|
+
placeholder: "Enter URL...",
|
|
1342
|
+
value: value ?? inputValue,
|
|
1343
|
+
...props
|
|
1344
|
+
}
|
|
1345
|
+
);
|
|
1346
|
+
};
|
|
1347
|
+
var WebPreviewBody = ({
|
|
1348
|
+
className,
|
|
1349
|
+
loading,
|
|
1350
|
+
src,
|
|
1351
|
+
...props
|
|
1352
|
+
}) => {
|
|
1353
|
+
const { url } = useWebPreview();
|
|
1354
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
|
|
1355
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1356
|
+
"iframe",
|
|
1357
|
+
{
|
|
1358
|
+
className: chunk525KS5HM_cjs.cn("size-full", className),
|
|
1359
|
+
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-presentation",
|
|
1360
|
+
src: (src ?? url) || void 0,
|
|
1361
|
+
title: "Preview",
|
|
1362
|
+
...props
|
|
1363
|
+
}
|
|
1364
|
+
),
|
|
1365
|
+
loading
|
|
1366
|
+
] });
|
|
1367
|
+
};
|
|
1368
|
+
var WebPreviewConsole = ({
|
|
1369
|
+
className,
|
|
1370
|
+
logs = [],
|
|
1371
|
+
children,
|
|
1372
|
+
...props
|
|
1373
|
+
}) => {
|
|
1374
|
+
const { consoleOpen, setConsoleOpen } = useWebPreview();
|
|
1375
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1376
|
+
chunkX5YEOOPK_cjs.Collapsible,
|
|
1377
|
+
{
|
|
1378
|
+
className: chunk525KS5HM_cjs.cn("border-t bg-muted/50 font-mono text-sm", className),
|
|
1379
|
+
onOpenChange: setConsoleOpen,
|
|
1380
|
+
open: consoleOpen,
|
|
1381
|
+
...props,
|
|
1382
|
+
children: [
|
|
1383
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1384
|
+
chunkWZLWAVSS_cjs.Button,
|
|
1385
|
+
{
|
|
1386
|
+
className: "flex w-full items-center justify-between p-4 text-start font-medium hover:bg-muted/50",
|
|
1387
|
+
variant: "ghost",
|
|
1388
|
+
children: [
|
|
1389
|
+
"Console",
|
|
1390
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1391
|
+
lucideReact.ChevronDownIcon,
|
|
1392
|
+
{
|
|
1393
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1394
|
+
"h-4 w-4 transition-transform duration-200",
|
|
1395
|
+
consoleOpen && "rotate-180"
|
|
1396
|
+
)
|
|
1397
|
+
}
|
|
1398
|
+
)
|
|
1399
|
+
]
|
|
1400
|
+
}
|
|
1401
|
+
) }),
|
|
1402
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1403
|
+
chunkX5YEOOPK_cjs.CollapsibleContent,
|
|
1404
|
+
{
|
|
1405
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1406
|
+
"px-4 pb-4",
|
|
1407
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in"
|
|
1408
|
+
),
|
|
1409
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-h-48 space-y-1 overflow-y-auto", children: [
|
|
1410
|
+
logs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground", children: "No console output" }) : logs.map((log, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1411
|
+
"div",
|
|
1412
|
+
{
|
|
1413
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1414
|
+
"text-xs",
|
|
1415
|
+
log.level === "error" && "text-destructive",
|
|
1416
|
+
log.level === "warn" && "text-yellow-600",
|
|
1417
|
+
log.level === "log" && "text-foreground"
|
|
1418
|
+
),
|
|
1419
|
+
children: [
|
|
1420
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: log.timestamp.toLocaleTimeString() }),
|
|
1421
|
+
" ",
|
|
1422
|
+
log.message
|
|
1423
|
+
]
|
|
1424
|
+
},
|
|
1425
|
+
`${log.timestamp.getTime()}-${index}`
|
|
1426
|
+
)),
|
|
1427
|
+
children
|
|
1428
|
+
] })
|
|
1429
|
+
}
|
|
1430
|
+
)
|
|
1431
|
+
]
|
|
1432
|
+
}
|
|
1433
|
+
);
|
|
1434
|
+
};
|
|
1435
|
+
var Sources = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1436
|
+
chunkX5YEOOPK_cjs.Collapsible,
|
|
1437
|
+
{
|
|
1438
|
+
className: chunk525KS5HM_cjs.cn("not-prose mb-4 text-primary text-xs", className),
|
|
1439
|
+
...props
|
|
1440
|
+
}
|
|
1441
|
+
);
|
|
1442
|
+
var SourcesTrigger = ({
|
|
1443
|
+
className,
|
|
1444
|
+
count,
|
|
1445
|
+
children,
|
|
1446
|
+
...props
|
|
1447
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1448
|
+
chunkX5YEOOPK_cjs.CollapsibleTrigger,
|
|
1449
|
+
{
|
|
1450
|
+
className: chunk525KS5HM_cjs.cn("flex items-center gap-2", className),
|
|
1451
|
+
...props,
|
|
1452
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1453
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-medium", children: [
|
|
1454
|
+
"Used ",
|
|
1455
|
+
count,
|
|
1456
|
+
" sources"
|
|
1457
|
+
] }),
|
|
1458
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "h-4 w-4" })
|
|
1459
|
+
] })
|
|
1460
|
+
}
|
|
1461
|
+
);
|
|
1462
|
+
var SourcesContent = ({
|
|
1463
|
+
className,
|
|
1464
|
+
...props
|
|
1465
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1466
|
+
chunkX5YEOOPK_cjs.CollapsibleContent,
|
|
1467
|
+
{
|
|
1468
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1469
|
+
"mt-3 flex w-fit flex-col gap-2",
|
|
1470
|
+
"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
1471
|
+
className
|
|
1472
|
+
),
|
|
1473
|
+
...props
|
|
1474
|
+
}
|
|
1475
|
+
);
|
|
1476
|
+
var Source = ({ href, title, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1477
|
+
"a",
|
|
1478
|
+
{
|
|
1479
|
+
className: "flex items-center gap-2",
|
|
1480
|
+
href,
|
|
1481
|
+
rel: "noreferrer",
|
|
1482
|
+
target: "_blank",
|
|
1483
|
+
...props,
|
|
1484
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1485
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.BookIcon, { className: "h-4 w-4" }),
|
|
1486
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block font-medium", children: title })
|
|
1487
|
+
] })
|
|
1488
|
+
}
|
|
1489
|
+
);
|
|
1490
|
+
var HoverCard = HoverCardPrimitive__namespace.Root;
|
|
1491
|
+
var HoverCardTrigger = HoverCardPrimitive__namespace.Trigger;
|
|
1492
|
+
var HoverCardContent = React2__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1493
|
+
HoverCardPrimitive__namespace.Content,
|
|
1494
|
+
{
|
|
1495
|
+
ref,
|
|
1496
|
+
align,
|
|
1497
|
+
sideOffset,
|
|
1498
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1499
|
+
"z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-hover-card-content-transform-origin]",
|
|
1500
|
+
className
|
|
1501
|
+
),
|
|
1502
|
+
...props
|
|
1503
|
+
}
|
|
1504
|
+
));
|
|
1505
|
+
HoverCardContent.displayName = HoverCardPrimitive__namespace.Content.displayName;
|
|
1506
|
+
var InlineCitation = ({
|
|
1507
|
+
className,
|
|
1508
|
+
...props
|
|
1509
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1510
|
+
"span",
|
|
1511
|
+
{
|
|
1512
|
+
className: chunk525KS5HM_cjs.cn("group inline items-center gap-1", className),
|
|
1513
|
+
...props
|
|
1514
|
+
}
|
|
1515
|
+
);
|
|
1516
|
+
var InlineCitationText = ({
|
|
1517
|
+
className,
|
|
1518
|
+
...props
|
|
1519
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1520
|
+
"span",
|
|
1521
|
+
{
|
|
1522
|
+
className: chunk525KS5HM_cjs.cn("transition-colors group-hover:bg-accent", className),
|
|
1523
|
+
...props
|
|
1524
|
+
}
|
|
1525
|
+
);
|
|
1526
|
+
var InlineCitationCard = (props) => /* @__PURE__ */ jsxRuntime.jsx(HoverCard, { closeDelay: 0, openDelay: 0, ...props });
|
|
1527
|
+
var InlineCitationCardTrigger = ({
|
|
1528
|
+
sources,
|
|
1529
|
+
className,
|
|
1530
|
+
...props
|
|
1531
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1532
|
+
chunkX5YEOOPK_cjs.Badge,
|
|
1533
|
+
{
|
|
1534
|
+
className: chunk525KS5HM_cjs.cn("ml-1 rounded-full", className),
|
|
1535
|
+
variant: "secondary",
|
|
1536
|
+
...props,
|
|
1537
|
+
children: sources[0] ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1538
|
+
new URL(sources[0]).hostname,
|
|
1539
|
+
" ",
|
|
1540
|
+
sources.length > 1 && `+${sources.length - 1}`
|
|
1541
|
+
] }) : "unknown"
|
|
1542
|
+
}
|
|
1543
|
+
) });
|
|
1544
|
+
var InlineCitationCardBody = ({
|
|
1545
|
+
className,
|
|
1546
|
+
...props
|
|
1547
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(HoverCardContent, { className: chunk525KS5HM_cjs.cn("relative w-80 p-0", className), ...props });
|
|
1548
|
+
var CarouselApiContext = React2.createContext(void 0);
|
|
1549
|
+
var useCarouselApi = () => {
|
|
1550
|
+
const context = React2.useContext(CarouselApiContext);
|
|
1551
|
+
return context;
|
|
1552
|
+
};
|
|
1553
|
+
var InlineCitationCarousel = ({
|
|
1554
|
+
className,
|
|
1555
|
+
children,
|
|
1556
|
+
...props
|
|
1557
|
+
}) => {
|
|
1558
|
+
const [api, setApi] = React2.useState();
|
|
1559
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CarouselApiContext.Provider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.Carousel, { className: chunk525KS5HM_cjs.cn("w-full", className), setApi, ...props, children }) });
|
|
1560
|
+
};
|
|
1561
|
+
var InlineCitationCarouselContent = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.CarouselContent, { ...props });
|
|
1562
|
+
var InlineCitationCarouselItem = ({
|
|
1563
|
+
className,
|
|
1564
|
+
...props
|
|
1565
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1566
|
+
chunkX5YEOOPK_cjs.CarouselItem,
|
|
1567
|
+
{
|
|
1568
|
+
className: chunk525KS5HM_cjs.cn("w-full space-y-2 p-4 pl-8", className),
|
|
1569
|
+
...props
|
|
1570
|
+
}
|
|
1571
|
+
);
|
|
1572
|
+
var InlineCitationCarouselHeader = ({
|
|
1573
|
+
className,
|
|
1574
|
+
...props
|
|
1575
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1576
|
+
"div",
|
|
1577
|
+
{
|
|
1578
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1579
|
+
"flex items-center justify-between gap-2 rounded-t-md bg-secondary p-2",
|
|
1580
|
+
className
|
|
1581
|
+
),
|
|
1582
|
+
...props
|
|
1583
|
+
}
|
|
1584
|
+
);
|
|
1585
|
+
var InlineCitationCarouselIndex = ({
|
|
1586
|
+
children,
|
|
1587
|
+
className,
|
|
1588
|
+
...props
|
|
1589
|
+
}) => {
|
|
1590
|
+
const api = useCarouselApi();
|
|
1591
|
+
const [current, setCurrent] = React2.useState(0);
|
|
1592
|
+
const [count, setCount] = React2.useState(0);
|
|
1593
|
+
React2.useEffect(() => {
|
|
1594
|
+
if (!api) {
|
|
1595
|
+
return;
|
|
1596
|
+
}
|
|
1597
|
+
setCount(api.scrollSnapList().length);
|
|
1598
|
+
setCurrent(api.selectedScrollSnap() + 1);
|
|
1599
|
+
api.on("select", () => {
|
|
1600
|
+
setCurrent(api.selectedScrollSnap() + 1);
|
|
1601
|
+
});
|
|
1602
|
+
}, [api]);
|
|
1603
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1604
|
+
"div",
|
|
1605
|
+
{
|
|
1606
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1607
|
+
"flex flex-1 items-center justify-end px-3 py-1 text-muted-foreground text-xs",
|
|
1608
|
+
className
|
|
1609
|
+
),
|
|
1610
|
+
...props,
|
|
1611
|
+
children: children ?? `${current}/${count}`
|
|
1612
|
+
}
|
|
1613
|
+
);
|
|
1614
|
+
};
|
|
1615
|
+
var InlineCitationCarouselPrev = ({
|
|
1616
|
+
className,
|
|
1617
|
+
...props
|
|
1618
|
+
}) => {
|
|
1619
|
+
const api = useCarouselApi();
|
|
1620
|
+
const handleClick = React2.useCallback(() => {
|
|
1621
|
+
if (api) {
|
|
1622
|
+
api.scrollPrev();
|
|
1623
|
+
}
|
|
1624
|
+
}, [api]);
|
|
1625
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1626
|
+
"button",
|
|
1627
|
+
{
|
|
1628
|
+
"aria-label": "Previous",
|
|
1629
|
+
className: chunk525KS5HM_cjs.cn("shrink-0", className),
|
|
1630
|
+
onClick: handleClick,
|
|
1631
|
+
type: "button",
|
|
1632
|
+
...props,
|
|
1633
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeftIcon, { className: "size-4 text-muted-foreground" })
|
|
1634
|
+
}
|
|
1635
|
+
);
|
|
1636
|
+
};
|
|
1637
|
+
var InlineCitationCarouselNext = ({
|
|
1638
|
+
className,
|
|
1639
|
+
...props
|
|
1640
|
+
}) => {
|
|
1641
|
+
const api = useCarouselApi();
|
|
1642
|
+
const handleClick = React2.useCallback(() => {
|
|
1643
|
+
if (api) {
|
|
1644
|
+
api.scrollNext();
|
|
1645
|
+
}
|
|
1646
|
+
}, [api]);
|
|
1647
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1648
|
+
"button",
|
|
1649
|
+
{
|
|
1650
|
+
"aria-label": "Next",
|
|
1651
|
+
className: chunk525KS5HM_cjs.cn("shrink-0", className),
|
|
1652
|
+
onClick: handleClick,
|
|
1653
|
+
type: "button",
|
|
1654
|
+
...props,
|
|
1655
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRightIcon, { className: "size-4 text-muted-foreground" })
|
|
1656
|
+
}
|
|
1657
|
+
);
|
|
1658
|
+
};
|
|
1659
|
+
var InlineCitationSource = ({
|
|
1660
|
+
title,
|
|
1661
|
+
url,
|
|
1662
|
+
description,
|
|
1663
|
+
className,
|
|
1664
|
+
children,
|
|
1665
|
+
...props
|
|
1666
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunk525KS5HM_cjs.cn("space-y-1", className), ...props, children: [
|
|
1667
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "truncate font-medium text-sm leading-tight", children: title }),
|
|
1668
|
+
url && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate break-all text-muted-foreground text-xs", children: url }),
|
|
1669
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-3 text-muted-foreground text-sm leading-relaxed", children: description }),
|
|
1670
|
+
children
|
|
1671
|
+
] });
|
|
1672
|
+
var InlineCitationQuote = ({
|
|
1673
|
+
children,
|
|
1674
|
+
className,
|
|
1675
|
+
...props
|
|
1676
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1677
|
+
"blockquote",
|
|
1678
|
+
{
|
|
1679
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1680
|
+
"border-muted border-l-2 pl-3 text-muted-foreground text-sm italic",
|
|
1681
|
+
className
|
|
1682
|
+
),
|
|
1683
|
+
...props,
|
|
1684
|
+
children
|
|
1685
|
+
}
|
|
1686
|
+
);
|
|
1687
|
+
var ShimmerComponent = ({
|
|
1688
|
+
children,
|
|
1689
|
+
as: Component = "p",
|
|
1690
|
+
className,
|
|
1691
|
+
duration = 2,
|
|
1692
|
+
spread = 2
|
|
1693
|
+
}) => {
|
|
1694
|
+
const MotionComponent = react.motion.create(
|
|
1695
|
+
Component
|
|
1696
|
+
);
|
|
1697
|
+
const dynamicSpread = React2.useMemo(
|
|
1698
|
+
() => (children?.length ?? 0) * spread,
|
|
1699
|
+
[children, spread]
|
|
1700
|
+
);
|
|
1701
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1702
|
+
MotionComponent,
|
|
1703
|
+
{
|
|
1704
|
+
animate: { backgroundPosition: "0% center" },
|
|
1705
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1706
|
+
"relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent",
|
|
1707
|
+
"[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--ac-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",
|
|
1708
|
+
className
|
|
1709
|
+
),
|
|
1710
|
+
initial: { backgroundPosition: "100% center" },
|
|
1711
|
+
style: {
|
|
1712
|
+
"--spread": `${dynamicSpread}px`,
|
|
1713
|
+
backgroundImage: "var(--bg), linear-gradient(var(--ac-muted-foreground), var(--ac-muted-foreground))"
|
|
1714
|
+
},
|
|
1715
|
+
transition: {
|
|
1716
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
1717
|
+
duration,
|
|
1718
|
+
ease: "linear"
|
|
1719
|
+
},
|
|
1720
|
+
children
|
|
1721
|
+
}
|
|
1722
|
+
);
|
|
1723
|
+
};
|
|
1724
|
+
var Shimmer = React2.memo(ShimmerComponent);
|
|
1725
|
+
var ReasoningContext = React2.createContext(null);
|
|
1726
|
+
var useReasoning = () => {
|
|
1727
|
+
const context = React2.useContext(ReasoningContext);
|
|
1728
|
+
if (!context) {
|
|
1729
|
+
throw new Error("Reasoning components must be used within Reasoning");
|
|
1730
|
+
}
|
|
1731
|
+
return context;
|
|
1732
|
+
};
|
|
1733
|
+
var AUTO_CLOSE_DELAY = 1e3;
|
|
1734
|
+
var MS_IN_S = 1e3;
|
|
1735
|
+
var Reasoning = React2.memo(
|
|
1736
|
+
({
|
|
1737
|
+
className,
|
|
1738
|
+
isStreaming = false,
|
|
1739
|
+
open,
|
|
1740
|
+
defaultOpen = true,
|
|
1741
|
+
onOpenChange,
|
|
1742
|
+
duration: durationProp,
|
|
1743
|
+
children,
|
|
1744
|
+
...props
|
|
1745
|
+
}) => {
|
|
1746
|
+
const [isOpen, setIsOpen] = reactUseControllableState.useControllableState({
|
|
1747
|
+
prop: open,
|
|
1748
|
+
defaultProp: defaultOpen,
|
|
1749
|
+
onChange: onOpenChange
|
|
1750
|
+
});
|
|
1751
|
+
const [duration, setDuration] = reactUseControllableState.useControllableState({
|
|
1752
|
+
prop: durationProp,
|
|
1753
|
+
defaultProp: void 0
|
|
1754
|
+
});
|
|
1755
|
+
const [hasAutoClosed, setHasAutoClosed] = React2.useState(false);
|
|
1756
|
+
const [startTime, setStartTime] = React2.useState(null);
|
|
1757
|
+
React2.useEffect(() => {
|
|
1758
|
+
if (isStreaming) {
|
|
1759
|
+
if (startTime === null) {
|
|
1760
|
+
setStartTime(Date.now());
|
|
1761
|
+
}
|
|
1762
|
+
} else if (startTime !== null) {
|
|
1763
|
+
setDuration(Math.ceil((Date.now() - startTime) / MS_IN_S));
|
|
1764
|
+
setStartTime(null);
|
|
1765
|
+
}
|
|
1766
|
+
}, [isStreaming, startTime, setDuration]);
|
|
1767
|
+
React2.useEffect(() => {
|
|
1768
|
+
if (defaultOpen && !isStreaming && isOpen && !hasAutoClosed) {
|
|
1769
|
+
const timer = setTimeout(() => {
|
|
1770
|
+
setIsOpen(false);
|
|
1771
|
+
setHasAutoClosed(true);
|
|
1772
|
+
}, AUTO_CLOSE_DELAY);
|
|
1773
|
+
return () => clearTimeout(timer);
|
|
1774
|
+
}
|
|
1775
|
+
}, [isStreaming, isOpen, defaultOpen, setIsOpen, hasAutoClosed]);
|
|
1776
|
+
const handleOpenChange = (newOpen) => {
|
|
1777
|
+
setIsOpen(newOpen);
|
|
1778
|
+
};
|
|
1779
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1780
|
+
ReasoningContext.Provider,
|
|
1781
|
+
{
|
|
1782
|
+
value: { isStreaming, isOpen, setIsOpen, duration },
|
|
1783
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1784
|
+
chunkX5YEOOPK_cjs.Collapsible,
|
|
1785
|
+
{
|
|
1786
|
+
className: chunk525KS5HM_cjs.cn("not-prose mb-4", className),
|
|
1787
|
+
onOpenChange: handleOpenChange,
|
|
1788
|
+
open: isOpen,
|
|
1789
|
+
...props,
|
|
1790
|
+
children
|
|
1791
|
+
}
|
|
1792
|
+
)
|
|
1793
|
+
}
|
|
1794
|
+
);
|
|
1795
|
+
}
|
|
1796
|
+
);
|
|
1797
|
+
var defaultGetThinkingMessage = (isStreaming, duration) => {
|
|
1798
|
+
if (isStreaming || duration === 0) {
|
|
1799
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Shimmer, { duration: 1, children: "Thinking..." });
|
|
1800
|
+
}
|
|
1801
|
+
if (duration === void 0) {
|
|
1802
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Thought for a few seconds" });
|
|
1803
|
+
}
|
|
1804
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
|
|
1805
|
+
"Thought for ",
|
|
1806
|
+
duration,
|
|
1807
|
+
" seconds"
|
|
1808
|
+
] });
|
|
1809
|
+
};
|
|
1810
|
+
var ReasoningTrigger = React2.memo(
|
|
1811
|
+
({ className, children, getThinkingMessage = defaultGetThinkingMessage, ...props }) => {
|
|
1812
|
+
const { isStreaming, isOpen, duration } = useReasoning();
|
|
1813
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1814
|
+
chunkX5YEOOPK_cjs.CollapsibleTrigger,
|
|
1815
|
+
{
|
|
1816
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1817
|
+
"flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",
|
|
1818
|
+
className
|
|
1819
|
+
),
|
|
1820
|
+
...props,
|
|
1821
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1822
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.BrainIcon, { className: "size-4" }),
|
|
1823
|
+
getThinkingMessage(isStreaming, duration),
|
|
1824
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1825
|
+
lucideReact.ChevronDownIcon,
|
|
1826
|
+
{
|
|
1827
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1828
|
+
"size-4 transition-transform",
|
|
1829
|
+
isOpen ? "rotate-180" : "rotate-0"
|
|
1830
|
+
)
|
|
1831
|
+
}
|
|
1832
|
+
)
|
|
1833
|
+
] })
|
|
1834
|
+
}
|
|
1835
|
+
);
|
|
1836
|
+
}
|
|
1837
|
+
);
|
|
1838
|
+
var ReasoningContent = React2.memo(
|
|
1839
|
+
({ className, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1840
|
+
chunkX5YEOOPK_cjs.CollapsibleContent,
|
|
1841
|
+
{
|
|
1842
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1843
|
+
"mt-4 text-sm",
|
|
1844
|
+
"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
1845
|
+
className
|
|
1846
|
+
),
|
|
1847
|
+
...props,
|
|
1848
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(streamdown.Streamdown, { ...props, children })
|
|
1849
|
+
}
|
|
1850
|
+
)
|
|
1851
|
+
);
|
|
1852
|
+
Reasoning.displayName = "Reasoning";
|
|
1853
|
+
ReasoningTrigger.displayName = "ReasoningTrigger";
|
|
1854
|
+
ReasoningContent.displayName = "ReasoningContent";
|
|
1855
|
+
function ThinkingSpinner({
|
|
1856
|
+
text = "Thinking...",
|
|
1857
|
+
className
|
|
1858
|
+
}) {
|
|
1859
|
+
const [displayText, setDisplayText] = React2.useState(text);
|
|
1860
|
+
const [isAnimating, setIsAnimating] = React2.useState(false);
|
|
1861
|
+
const prevTextRef = React2.useRef(text);
|
|
1862
|
+
React2.useEffect(() => {
|
|
1863
|
+
if (text !== prevTextRef.current) {
|
|
1864
|
+
setIsAnimating(true);
|
|
1865
|
+
const timer = setTimeout(() => {
|
|
1866
|
+
setDisplayText(text);
|
|
1867
|
+
setIsAnimating(false);
|
|
1868
|
+
prevTextRef.current = text;
|
|
1869
|
+
}, 150);
|
|
1870
|
+
return () => clearTimeout(timer);
|
|
1871
|
+
}
|
|
1872
|
+
}, [text]);
|
|
1873
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunk525KS5HM_cjs.cn("flex items-center gap-3 my-4", className), children: [
|
|
1874
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1875
|
+
"svg",
|
|
1876
|
+
{
|
|
1877
|
+
className: "animate-spin",
|
|
1878
|
+
width: "20",
|
|
1879
|
+
height: "20",
|
|
1880
|
+
viewBox: "0 0 20 20",
|
|
1881
|
+
fill: "none",
|
|
1882
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1883
|
+
style: { color: "var(--ac-loader-color, var(--ac-primary, #2f80ed))" },
|
|
1884
|
+
children: [
|
|
1885
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1886
|
+
"circle",
|
|
1887
|
+
{
|
|
1888
|
+
cx: "10",
|
|
1889
|
+
cy: "10",
|
|
1890
|
+
r: "8",
|
|
1891
|
+
stroke: "#E5E5E5",
|
|
1892
|
+
strokeWidth: "2",
|
|
1893
|
+
fill: "none"
|
|
1894
|
+
}
|
|
1895
|
+
),
|
|
1896
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1897
|
+
"path",
|
|
1898
|
+
{
|
|
1899
|
+
d: "M10 2C14.4183 2 18 5.58172 18 10",
|
|
1900
|
+
stroke: "currentColor",
|
|
1901
|
+
strokeWidth: "2",
|
|
1902
|
+
strokeLinecap: "round",
|
|
1903
|
+
fill: "none"
|
|
1904
|
+
}
|
|
1905
|
+
)
|
|
1906
|
+
]
|
|
1907
|
+
}
|
|
1908
|
+
),
|
|
1909
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1910
|
+
"span",
|
|
1911
|
+
{
|
|
1912
|
+
className: chunk525KS5HM_cjs.cn(
|
|
1913
|
+
"text-sm text-muted-foreground transition-all duration-150",
|
|
1914
|
+
isAnimating ? "opacity-0" : "opacity-100"
|
|
1915
|
+
),
|
|
1916
|
+
children: displayText
|
|
1917
|
+
}
|
|
1918
|
+
)
|
|
1919
|
+
] });
|
|
1920
|
+
}
|
|
1921
|
+
function FollowupButtons({
|
|
1922
|
+
suggestions,
|
|
1923
|
+
onSelect,
|
|
1924
|
+
className,
|
|
1925
|
+
disabled = false
|
|
1926
|
+
}) {
|
|
1927
|
+
if (!suggestions || suggestions.length === 0) return null;
|
|
1928
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("flex flex-wrap gap-2", className), children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1929
|
+
chunkWZLWAVSS_cjs.Button,
|
|
1930
|
+
{
|
|
1931
|
+
variant: "outline",
|
|
1932
|
+
size: "sm",
|
|
1933
|
+
onClick: () => onSelect(suggestion),
|
|
1934
|
+
disabled,
|
|
1935
|
+
className: "text-xs h-auto py-1.5 px-3 whitespace-normal text-start",
|
|
1936
|
+
children: suggestion
|
|
1937
|
+
},
|
|
1938
|
+
index
|
|
1939
|
+
)) });
|
|
1940
|
+
}
|
|
1941
|
+
var Suggestions = ({
|
|
1942
|
+
className,
|
|
1943
|
+
children,
|
|
1944
|
+
...props
|
|
1945
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(chunkX5YEOOPK_cjs.ScrollArea, { className: "w-full overflow-x-auto whitespace-nowrap", ...props, children: [
|
|
1946
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("flex w-max flex-nowrap items-center gap-2", className), children }),
|
|
1947
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.ScrollBar, { className: "hidden", orientation: "horizontal" })
|
|
1948
|
+
] });
|
|
1949
|
+
var Suggestion = ({
|
|
1950
|
+
suggestion,
|
|
1951
|
+
onClick,
|
|
1952
|
+
className,
|
|
1953
|
+
variant = "outline",
|
|
1954
|
+
size = "sm",
|
|
1955
|
+
children,
|
|
1956
|
+
...props
|
|
1957
|
+
}) => {
|
|
1958
|
+
const handleClick = () => {
|
|
1959
|
+
onClick?.(suggestion);
|
|
1960
|
+
};
|
|
1961
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1962
|
+
chunkWZLWAVSS_cjs.Button,
|
|
1963
|
+
{
|
|
1964
|
+
className: chunk525KS5HM_cjs.cn("cursor-pointer rounded-full px-4", className),
|
|
1965
|
+
onClick: handleClick,
|
|
1966
|
+
size,
|
|
1967
|
+
type: "button",
|
|
1968
|
+
variant,
|
|
1969
|
+
...props,
|
|
1970
|
+
children: children || suggestion
|
|
1971
|
+
}
|
|
1972
|
+
);
|
|
1973
|
+
};
|
|
1974
|
+
var PERCENT_MAX = 100;
|
|
1975
|
+
var ICON_RADIUS = 10;
|
|
1976
|
+
var ICON_VIEWBOX = 24;
|
|
1977
|
+
var ICON_CENTER = 12;
|
|
1978
|
+
var ICON_STROKE_WIDTH = 2;
|
|
1979
|
+
var ContextContext = React2.createContext(null);
|
|
1980
|
+
var useContextValue = () => {
|
|
1981
|
+
const context = React2.useContext(ContextContext);
|
|
1982
|
+
if (!context) {
|
|
1983
|
+
throw new Error("Context components must be used within Context");
|
|
1984
|
+
}
|
|
1985
|
+
return context;
|
|
1986
|
+
};
|
|
1987
|
+
var Context = ({
|
|
1988
|
+
usedTokens,
|
|
1989
|
+
maxTokens,
|
|
1990
|
+
usage,
|
|
1991
|
+
modelId,
|
|
1992
|
+
...props
|
|
1993
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1994
|
+
ContextContext.Provider,
|
|
1995
|
+
{
|
|
1996
|
+
value: {
|
|
1997
|
+
usedTokens,
|
|
1998
|
+
maxTokens,
|
|
1999
|
+
usage,
|
|
2000
|
+
modelId
|
|
2001
|
+
},
|
|
2002
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(HoverCard, { closeDelay: 0, openDelay: 0, ...props })
|
|
2003
|
+
}
|
|
2004
|
+
);
|
|
2005
|
+
var ContextIcon = () => {
|
|
2006
|
+
const { usedTokens, maxTokens } = useContextValue();
|
|
2007
|
+
const circumference = 2 * Math.PI * ICON_RADIUS;
|
|
2008
|
+
const usedPercent = usedTokens / maxTokens;
|
|
2009
|
+
const dashOffset = circumference * (1 - usedPercent);
|
|
2010
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2011
|
+
"svg",
|
|
2012
|
+
{
|
|
2013
|
+
"aria-label": "Model context usage",
|
|
2014
|
+
height: "20",
|
|
2015
|
+
role: "img",
|
|
2016
|
+
style: { color: "currentcolor" },
|
|
2017
|
+
viewBox: `0 0 ${ICON_VIEWBOX} ${ICON_VIEWBOX}`,
|
|
2018
|
+
width: "20",
|
|
2019
|
+
children: [
|
|
2020
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2021
|
+
"circle",
|
|
2022
|
+
{
|
|
2023
|
+
cx: ICON_CENTER,
|
|
2024
|
+
cy: ICON_CENTER,
|
|
2025
|
+
fill: "none",
|
|
2026
|
+
opacity: "0.25",
|
|
2027
|
+
r: ICON_RADIUS,
|
|
2028
|
+
stroke: "currentColor",
|
|
2029
|
+
strokeWidth: ICON_STROKE_WIDTH
|
|
2030
|
+
}
|
|
2031
|
+
),
|
|
2032
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2033
|
+
"circle",
|
|
2034
|
+
{
|
|
2035
|
+
cx: ICON_CENTER,
|
|
2036
|
+
cy: ICON_CENTER,
|
|
2037
|
+
fill: "none",
|
|
2038
|
+
opacity: "0.7",
|
|
2039
|
+
r: ICON_RADIUS,
|
|
2040
|
+
stroke: "currentColor",
|
|
2041
|
+
strokeDasharray: `${circumference} ${circumference}`,
|
|
2042
|
+
strokeDashoffset: dashOffset,
|
|
2043
|
+
strokeLinecap: "round",
|
|
2044
|
+
strokeWidth: ICON_STROKE_WIDTH,
|
|
2045
|
+
style: { transformOrigin: "center", transform: "rotate(-90deg)" }
|
|
2046
|
+
}
|
|
2047
|
+
)
|
|
2048
|
+
]
|
|
2049
|
+
}
|
|
2050
|
+
);
|
|
2051
|
+
};
|
|
2052
|
+
var ContextTrigger = ({ children, ...props }) => {
|
|
2053
|
+
const { usedTokens, maxTokens } = useContextValue();
|
|
2054
|
+
const usedPercent = usedTokens / maxTokens;
|
|
2055
|
+
const renderedPercent = new Intl.NumberFormat("en-US", {
|
|
2056
|
+
style: "percent",
|
|
2057
|
+
maximumFractionDigits: 1
|
|
2058
|
+
}).format(usedPercent);
|
|
2059
|
+
return /* @__PURE__ */ jsxRuntime.jsx(HoverCardTrigger, { asChild: true, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(chunkWZLWAVSS_cjs.Button, { type: "button", variant: "ghost", ...props, children: [
|
|
2060
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-muted-foreground", children: renderedPercent }),
|
|
2061
|
+
/* @__PURE__ */ jsxRuntime.jsx(ContextIcon, {})
|
|
2062
|
+
] }) });
|
|
2063
|
+
};
|
|
2064
|
+
var ContextContent = ({
|
|
2065
|
+
className,
|
|
2066
|
+
...props
|
|
2067
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2068
|
+
HoverCardContent,
|
|
2069
|
+
{
|
|
2070
|
+
className: chunk525KS5HM_cjs.cn("min-w-60 divide-y overflow-hidden p-0", className),
|
|
2071
|
+
...props
|
|
2072
|
+
}
|
|
2073
|
+
);
|
|
2074
|
+
var ContextContentHeader = ({
|
|
2075
|
+
children,
|
|
2076
|
+
className,
|
|
2077
|
+
...props
|
|
2078
|
+
}) => {
|
|
2079
|
+
const { usedTokens, maxTokens } = useContextValue();
|
|
2080
|
+
const usedPercent = usedTokens / maxTokens;
|
|
2081
|
+
const displayPct = new Intl.NumberFormat("en-US", {
|
|
2082
|
+
style: "percent",
|
|
2083
|
+
maximumFractionDigits: 1
|
|
2084
|
+
}).format(usedPercent);
|
|
2085
|
+
const used = new Intl.NumberFormat("en-US", {
|
|
2086
|
+
notation: "compact"
|
|
2087
|
+
}).format(usedTokens);
|
|
2088
|
+
const total = new Intl.NumberFormat("en-US", {
|
|
2089
|
+
notation: "compact"
|
|
2090
|
+
}).format(maxTokens);
|
|
2091
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("w-full space-y-2 p-3", className), ...props, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2092
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3 text-xs", children: [
|
|
2093
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: displayPct }),
|
|
2094
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-mono text-muted-foreground", children: [
|
|
2095
|
+
used,
|
|
2096
|
+
" / ",
|
|
2097
|
+
total
|
|
2098
|
+
] })
|
|
2099
|
+
] }),
|
|
2100
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.Progress, { className: "bg-muted", value: usedPercent * PERCENT_MAX }) })
|
|
2101
|
+
] }) });
|
|
2102
|
+
};
|
|
2103
|
+
var ContextContentBody = ({
|
|
2104
|
+
children,
|
|
2105
|
+
className,
|
|
2106
|
+
...props
|
|
2107
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("w-full p-3", className), ...props, children });
|
|
2108
|
+
var ContextContentFooter = ({
|
|
2109
|
+
children,
|
|
2110
|
+
className,
|
|
2111
|
+
...props
|
|
2112
|
+
}) => {
|
|
2113
|
+
const { modelId, usage } = useContextValue();
|
|
2114
|
+
const costUSD = modelId ? tokenlens.getUsage({
|
|
2115
|
+
modelId,
|
|
2116
|
+
usage: {
|
|
2117
|
+
input: usage?.inputTokens ?? 0,
|
|
2118
|
+
output: usage?.outputTokens ?? 0
|
|
2119
|
+
}
|
|
2120
|
+
}).costUSD?.totalUSD : void 0;
|
|
2121
|
+
const totalCost = new Intl.NumberFormat("en-US", {
|
|
2122
|
+
style: "currency",
|
|
2123
|
+
currency: "USD"
|
|
2124
|
+
}).format(costUSD ?? 0);
|
|
2125
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2126
|
+
"div",
|
|
2127
|
+
{
|
|
2128
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2129
|
+
"flex w-full items-center justify-between gap-3 bg-secondary p-3 text-xs",
|
|
2130
|
+
className
|
|
2131
|
+
),
|
|
2132
|
+
...props,
|
|
2133
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2134
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Total cost" }),
|
|
2135
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: totalCost })
|
|
2136
|
+
] })
|
|
2137
|
+
}
|
|
2138
|
+
);
|
|
2139
|
+
};
|
|
2140
|
+
var ContextInputUsage = ({
|
|
2141
|
+
className,
|
|
2142
|
+
children,
|
|
2143
|
+
...props
|
|
2144
|
+
}) => {
|
|
2145
|
+
const { usage, modelId } = useContextValue();
|
|
2146
|
+
const inputTokens = usage?.inputTokens ?? 0;
|
|
2147
|
+
if (children) {
|
|
2148
|
+
return children;
|
|
2149
|
+
}
|
|
2150
|
+
if (!inputTokens) {
|
|
2151
|
+
return null;
|
|
2152
|
+
}
|
|
2153
|
+
const inputCost = modelId ? tokenlens.getUsage({
|
|
2154
|
+
modelId,
|
|
2155
|
+
usage: { input: inputTokens, output: 0 }
|
|
2156
|
+
}).costUSD?.totalUSD : void 0;
|
|
2157
|
+
const inputCostText = new Intl.NumberFormat("en-US", {
|
|
2158
|
+
style: "currency",
|
|
2159
|
+
currency: "USD"
|
|
2160
|
+
}).format(inputCost ?? 0);
|
|
2161
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2162
|
+
"div",
|
|
2163
|
+
{
|
|
2164
|
+
className: chunk525KS5HM_cjs.cn("flex items-center justify-between text-xs", className),
|
|
2165
|
+
...props,
|
|
2166
|
+
children: [
|
|
2167
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Input" }),
|
|
2168
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokensWithCost, { costText: inputCostText, tokens: inputTokens })
|
|
2169
|
+
]
|
|
2170
|
+
}
|
|
2171
|
+
);
|
|
2172
|
+
};
|
|
2173
|
+
var ContextOutputUsage = ({
|
|
2174
|
+
className,
|
|
2175
|
+
children,
|
|
2176
|
+
...props
|
|
2177
|
+
}) => {
|
|
2178
|
+
const { usage, modelId } = useContextValue();
|
|
2179
|
+
const outputTokens = usage?.outputTokens ?? 0;
|
|
2180
|
+
if (children) {
|
|
2181
|
+
return children;
|
|
2182
|
+
}
|
|
2183
|
+
if (!outputTokens) {
|
|
2184
|
+
return null;
|
|
2185
|
+
}
|
|
2186
|
+
const outputCost = modelId ? tokenlens.getUsage({
|
|
2187
|
+
modelId,
|
|
2188
|
+
usage: { input: 0, output: outputTokens }
|
|
2189
|
+
}).costUSD?.totalUSD : void 0;
|
|
2190
|
+
const outputCostText = new Intl.NumberFormat("en-US", {
|
|
2191
|
+
style: "currency",
|
|
2192
|
+
currency: "USD"
|
|
2193
|
+
}).format(outputCost ?? 0);
|
|
2194
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2195
|
+
"div",
|
|
2196
|
+
{
|
|
2197
|
+
className: chunk525KS5HM_cjs.cn("flex items-center justify-between text-xs", className),
|
|
2198
|
+
...props,
|
|
2199
|
+
children: [
|
|
2200
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Output" }),
|
|
2201
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokensWithCost, { costText: outputCostText, tokens: outputTokens })
|
|
2202
|
+
]
|
|
2203
|
+
}
|
|
2204
|
+
);
|
|
2205
|
+
};
|
|
2206
|
+
var ContextReasoningUsage = ({
|
|
2207
|
+
className,
|
|
2208
|
+
children,
|
|
2209
|
+
...props
|
|
2210
|
+
}) => {
|
|
2211
|
+
const { usage, modelId } = useContextValue();
|
|
2212
|
+
const reasoningTokens = usage?.reasoningTokens ?? 0;
|
|
2213
|
+
if (children) {
|
|
2214
|
+
return children;
|
|
2215
|
+
}
|
|
2216
|
+
if (!reasoningTokens) {
|
|
2217
|
+
return null;
|
|
2218
|
+
}
|
|
2219
|
+
const reasoningCost = modelId ? tokenlens.getUsage({
|
|
2220
|
+
modelId,
|
|
2221
|
+
usage: { reasoningTokens }
|
|
2222
|
+
}).costUSD?.totalUSD : void 0;
|
|
2223
|
+
const reasoningCostText = new Intl.NumberFormat("en-US", {
|
|
2224
|
+
style: "currency",
|
|
2225
|
+
currency: "USD"
|
|
2226
|
+
}).format(reasoningCost ?? 0);
|
|
2227
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2228
|
+
"div",
|
|
2229
|
+
{
|
|
2230
|
+
className: chunk525KS5HM_cjs.cn("flex items-center justify-between text-xs", className),
|
|
2231
|
+
...props,
|
|
2232
|
+
children: [
|
|
2233
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Reasoning" }),
|
|
2234
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokensWithCost, { costText: reasoningCostText, tokens: reasoningTokens })
|
|
2235
|
+
]
|
|
2236
|
+
}
|
|
2237
|
+
);
|
|
2238
|
+
};
|
|
2239
|
+
var ContextCacheUsage = ({
|
|
2240
|
+
className,
|
|
2241
|
+
children,
|
|
2242
|
+
...props
|
|
2243
|
+
}) => {
|
|
2244
|
+
const { usage, modelId } = useContextValue();
|
|
2245
|
+
const cacheTokens = usage?.cachedInputTokens ?? 0;
|
|
2246
|
+
if (children) {
|
|
2247
|
+
return children;
|
|
2248
|
+
}
|
|
2249
|
+
if (!cacheTokens) {
|
|
2250
|
+
return null;
|
|
2251
|
+
}
|
|
2252
|
+
const cacheCost = modelId ? tokenlens.getUsage({
|
|
2253
|
+
modelId,
|
|
2254
|
+
usage: { cacheReads: cacheTokens, input: 0, output: 0 }
|
|
2255
|
+
}).costUSD?.totalUSD : void 0;
|
|
2256
|
+
const cacheCostText = new Intl.NumberFormat("en-US", {
|
|
2257
|
+
style: "currency",
|
|
2258
|
+
currency: "USD"
|
|
2259
|
+
}).format(cacheCost ?? 0);
|
|
2260
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2261
|
+
"div",
|
|
2262
|
+
{
|
|
2263
|
+
className: chunk525KS5HM_cjs.cn("flex items-center justify-between text-xs", className),
|
|
2264
|
+
...props,
|
|
2265
|
+
children: [
|
|
2266
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Cache" }),
|
|
2267
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokensWithCost, { costText: cacheCostText, tokens: cacheTokens })
|
|
2268
|
+
]
|
|
2269
|
+
}
|
|
2270
|
+
);
|
|
2271
|
+
};
|
|
2272
|
+
var TokensWithCost = ({
|
|
2273
|
+
tokens,
|
|
2274
|
+
costText
|
|
2275
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
2276
|
+
tokens === void 0 ? "\u2014" : new Intl.NumberFormat("en-US", {
|
|
2277
|
+
notation: "compact"
|
|
2278
|
+
}).format(tokens),
|
|
2279
|
+
costText ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-2 text-muted-foreground", children: [
|
|
2280
|
+
"\u2022 ",
|
|
2281
|
+
costText
|
|
2282
|
+
] }) : null
|
|
2283
|
+
] });
|
|
2284
|
+
var ChainOfThoughtContext = React2.createContext(
|
|
2285
|
+
null
|
|
2286
|
+
);
|
|
2287
|
+
var useChainOfThought = () => {
|
|
2288
|
+
const context = React2.useContext(ChainOfThoughtContext);
|
|
2289
|
+
if (!context) {
|
|
2290
|
+
throw new Error(
|
|
2291
|
+
"ChainOfThought components must be used within ChainOfThought"
|
|
2292
|
+
);
|
|
2293
|
+
}
|
|
2294
|
+
return context;
|
|
2295
|
+
};
|
|
2296
|
+
var ChainOfThought = React2.memo(
|
|
2297
|
+
({
|
|
2298
|
+
className,
|
|
2299
|
+
open,
|
|
2300
|
+
defaultOpen = false,
|
|
2301
|
+
onOpenChange,
|
|
2302
|
+
children,
|
|
2303
|
+
...props
|
|
2304
|
+
}) => {
|
|
2305
|
+
const [isOpen, setIsOpen] = reactUseControllableState.useControllableState({
|
|
2306
|
+
prop: open,
|
|
2307
|
+
defaultProp: defaultOpen,
|
|
2308
|
+
onChange: onOpenChange
|
|
2309
|
+
});
|
|
2310
|
+
const chainOfThoughtContext = React2.useMemo(
|
|
2311
|
+
() => ({ isOpen, setIsOpen }),
|
|
2312
|
+
[isOpen, setIsOpen]
|
|
2313
|
+
);
|
|
2314
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ChainOfThoughtContext.Provider, { value: chainOfThoughtContext, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2315
|
+
"div",
|
|
2316
|
+
{
|
|
2317
|
+
className: chunk525KS5HM_cjs.cn("not-prose max-w-prose space-y-4", className),
|
|
2318
|
+
...props,
|
|
2319
|
+
children
|
|
2320
|
+
}
|
|
2321
|
+
) });
|
|
2322
|
+
}
|
|
2323
|
+
);
|
|
2324
|
+
var ChainOfThoughtHeader = React2.memo(
|
|
2325
|
+
({ className, children, ...props }) => {
|
|
2326
|
+
const { isOpen, setIsOpen } = useChainOfThought();
|
|
2327
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.Collapsible, { onOpenChange: setIsOpen, open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2328
|
+
chunkX5YEOOPK_cjs.CollapsibleTrigger,
|
|
2329
|
+
{
|
|
2330
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2331
|
+
"flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",
|
|
2332
|
+
className
|
|
2333
|
+
),
|
|
2334
|
+
...props,
|
|
2335
|
+
children: [
|
|
2336
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.BrainIcon, { className: "size-4" }),
|
|
2337
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-start", children: children ?? "Chain of Thought" }),
|
|
2338
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2339
|
+
lucideReact.ChevronDownIcon,
|
|
2340
|
+
{
|
|
2341
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2342
|
+
"size-4 transition-transform",
|
|
2343
|
+
isOpen ? "rotate-180" : "rotate-0"
|
|
2344
|
+
)
|
|
2345
|
+
}
|
|
2346
|
+
)
|
|
2347
|
+
]
|
|
2348
|
+
}
|
|
2349
|
+
) });
|
|
2350
|
+
}
|
|
2351
|
+
);
|
|
2352
|
+
var ChainOfThoughtStep = React2.memo(
|
|
2353
|
+
({
|
|
2354
|
+
className,
|
|
2355
|
+
icon: Icon = lucideReact.DotIcon,
|
|
2356
|
+
label,
|
|
2357
|
+
description,
|
|
2358
|
+
status = "complete",
|
|
2359
|
+
children,
|
|
2360
|
+
...props
|
|
2361
|
+
}) => {
|
|
2362
|
+
const statusStyles = {
|
|
2363
|
+
complete: "text-muted-foreground",
|
|
2364
|
+
active: "text-foreground",
|
|
2365
|
+
pending: "text-muted-foreground/50"
|
|
2366
|
+
};
|
|
2367
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2368
|
+
"div",
|
|
2369
|
+
{
|
|
2370
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2371
|
+
"flex gap-2 text-sm",
|
|
2372
|
+
statusStyles[status],
|
|
2373
|
+
"fade-in-0 slide-in-from-top-2 animate-in",
|
|
2374
|
+
className
|
|
2375
|
+
),
|
|
2376
|
+
...props,
|
|
2377
|
+
children: [
|
|
2378
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative mt-0.5", children: [
|
|
2379
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" }),
|
|
2380
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "-mx-px absolute top-7 bottom-0 left-1/2 w-px bg-border" })
|
|
2381
|
+
] }),
|
|
2382
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-2 overflow-hidden", children: [
|
|
2383
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: label }),
|
|
2384
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground text-xs", children: description }),
|
|
2385
|
+
children
|
|
2386
|
+
] })
|
|
2387
|
+
]
|
|
2388
|
+
}
|
|
2389
|
+
);
|
|
2390
|
+
}
|
|
2391
|
+
);
|
|
2392
|
+
var ChainOfThoughtSearchResults = React2.memo(
|
|
2393
|
+
({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2394
|
+
"div",
|
|
2395
|
+
{
|
|
2396
|
+
className: chunk525KS5HM_cjs.cn("flex flex-wrap items-center gap-2", className),
|
|
2397
|
+
...props
|
|
2398
|
+
}
|
|
2399
|
+
)
|
|
2400
|
+
);
|
|
2401
|
+
var ChainOfThoughtSearchResult = React2.memo(
|
|
2402
|
+
({ className, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2403
|
+
chunkX5YEOOPK_cjs.Badge,
|
|
2404
|
+
{
|
|
2405
|
+
className: chunk525KS5HM_cjs.cn("gap-1 px-2 py-0.5 font-normal text-xs", className),
|
|
2406
|
+
variant: "secondary",
|
|
2407
|
+
...props,
|
|
2408
|
+
children
|
|
2409
|
+
}
|
|
2410
|
+
)
|
|
2411
|
+
);
|
|
2412
|
+
var ChainOfThoughtContent = React2.memo(
|
|
2413
|
+
({ className, children, ...props }) => {
|
|
2414
|
+
const { isOpen } = useChainOfThought();
|
|
2415
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.Collapsible, { open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2416
|
+
chunkX5YEOOPK_cjs.CollapsibleContent,
|
|
2417
|
+
{
|
|
2418
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2419
|
+
"mt-2 space-y-3",
|
|
2420
|
+
"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
2421
|
+
className
|
|
2422
|
+
),
|
|
2423
|
+
...props,
|
|
2424
|
+
children
|
|
2425
|
+
}
|
|
2426
|
+
) });
|
|
2427
|
+
}
|
|
2428
|
+
);
|
|
2429
|
+
var ChainOfThoughtImage = React2.memo(
|
|
2430
|
+
({ className, children, caption, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunk525KS5HM_cjs.cn("mt-2 space-y-2", className), ...props, children: [
|
|
2431
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg bg-muted p-3", children }),
|
|
2432
|
+
caption && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: caption })
|
|
2433
|
+
] })
|
|
2434
|
+
);
|
|
2435
|
+
ChainOfThought.displayName = "ChainOfThought";
|
|
2436
|
+
ChainOfThoughtHeader.displayName = "ChainOfThoughtHeader";
|
|
2437
|
+
ChainOfThoughtStep.displayName = "ChainOfThoughtStep";
|
|
2438
|
+
ChainOfThoughtSearchResults.displayName = "ChainOfThoughtSearchResults";
|
|
2439
|
+
ChainOfThoughtSearchResult.displayName = "ChainOfThoughtSearchResult";
|
|
2440
|
+
ChainOfThoughtContent.displayName = "ChainOfThoughtContent";
|
|
2441
|
+
ChainOfThoughtImage.displayName = "ChainOfThoughtImage";
|
|
2442
|
+
var ConfirmationContext = React2.createContext(
|
|
2443
|
+
null
|
|
2444
|
+
);
|
|
2445
|
+
var useConfirmation = () => {
|
|
2446
|
+
const context = React2.useContext(ConfirmationContext);
|
|
2447
|
+
if (!context) {
|
|
2448
|
+
throw new Error("Confirmation components must be used within Confirmation");
|
|
2449
|
+
}
|
|
2450
|
+
return context;
|
|
2451
|
+
};
|
|
2452
|
+
var Confirmation = ({
|
|
2453
|
+
className,
|
|
2454
|
+
approval,
|
|
2455
|
+
state,
|
|
2456
|
+
...props
|
|
2457
|
+
}) => {
|
|
2458
|
+
if (!approval || state === "input-streaming" || state === "input-available") {
|
|
2459
|
+
return null;
|
|
2460
|
+
}
|
|
2461
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ConfirmationContext.Provider, { value: { approval, state }, children: /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.Alert, { className: chunk525KS5HM_cjs.cn("flex flex-col gap-2", className), ...props }) });
|
|
2462
|
+
};
|
|
2463
|
+
var ConfirmationTitle = ({
|
|
2464
|
+
className,
|
|
2465
|
+
...props
|
|
2466
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.AlertDescription, { className: chunk525KS5HM_cjs.cn("inline", className), ...props });
|
|
2467
|
+
var ConfirmationRequest = ({ children }) => {
|
|
2468
|
+
const { state } = useConfirmation();
|
|
2469
|
+
if (state !== "approval-requested") {
|
|
2470
|
+
return null;
|
|
2471
|
+
}
|
|
2472
|
+
return children;
|
|
2473
|
+
};
|
|
2474
|
+
var ConfirmationAccepted = ({
|
|
2475
|
+
children
|
|
2476
|
+
}) => {
|
|
2477
|
+
const { approval, state } = useConfirmation();
|
|
2478
|
+
if (!approval?.approved || state !== "approval-responded" && state !== "output-denied" && state !== "output-available") {
|
|
2479
|
+
return null;
|
|
2480
|
+
}
|
|
2481
|
+
return children;
|
|
2482
|
+
};
|
|
2483
|
+
var ConfirmationRejected = ({
|
|
2484
|
+
children
|
|
2485
|
+
}) => {
|
|
2486
|
+
const { approval, state } = useConfirmation();
|
|
2487
|
+
if (approval?.approved !== false || state !== "approval-responded" && state !== "output-denied" && state !== "output-available") {
|
|
2488
|
+
return null;
|
|
2489
|
+
}
|
|
2490
|
+
return children;
|
|
2491
|
+
};
|
|
2492
|
+
var ConfirmationActions = ({
|
|
2493
|
+
className,
|
|
2494
|
+
...props
|
|
2495
|
+
}) => {
|
|
2496
|
+
const { state } = useConfirmation();
|
|
2497
|
+
if (state !== "approval-requested") {
|
|
2498
|
+
return null;
|
|
2499
|
+
}
|
|
2500
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2501
|
+
"div",
|
|
2502
|
+
{
|
|
2503
|
+
className: chunk525KS5HM_cjs.cn("flex items-center justify-end gap-2 self-end", className),
|
|
2504
|
+
...props
|
|
2505
|
+
}
|
|
2506
|
+
);
|
|
2507
|
+
};
|
|
2508
|
+
var ConfirmationAction = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkWZLWAVSS_cjs.Button, { className: "h-8 px-3 text-sm", type: "button", ...props });
|
|
2509
|
+
var Controls = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2510
|
+
react$1.Controls,
|
|
2511
|
+
{
|
|
2512
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2513
|
+
"gap-px overflow-hidden rounded-md border bg-card p-1 shadow-none!",
|
|
2514
|
+
"[&>button]:rounded-md [&>button]:border-none! [&>button]:bg-transparent! [&>button]:hover:bg-secondary!",
|
|
2515
|
+
className
|
|
2516
|
+
),
|
|
2517
|
+
...props
|
|
2518
|
+
}
|
|
2519
|
+
);
|
|
2520
|
+
var Command = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2521
|
+
cmdk.Command,
|
|
2522
|
+
{
|
|
2523
|
+
ref,
|
|
2524
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2525
|
+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
2526
|
+
className
|
|
2527
|
+
),
|
|
2528
|
+
...props
|
|
2529
|
+
}
|
|
2530
|
+
));
|
|
2531
|
+
Command.displayName = cmdk.Command.displayName;
|
|
2532
|
+
var CommandDialog = ({ children, ...props }) => {
|
|
2533
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.Dialog, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DialogContent, { className: "overflow-hidden p-0", children: /* @__PURE__ */ jsxRuntime.jsx(Command, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children }) }) });
|
|
2534
|
+
};
|
|
2535
|
+
var CommandInput = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
2536
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
2537
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2538
|
+
cmdk.Command.Input,
|
|
2539
|
+
{
|
|
2540
|
+
ref,
|
|
2541
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2542
|
+
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
2543
|
+
className
|
|
2544
|
+
),
|
|
2545
|
+
...props
|
|
2546
|
+
}
|
|
2547
|
+
)
|
|
2548
|
+
] }));
|
|
2549
|
+
CommandInput.displayName = cmdk.Command.Input.displayName;
|
|
2550
|
+
var CommandList = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2551
|
+
cmdk.Command.List,
|
|
2552
|
+
{
|
|
2553
|
+
ref,
|
|
2554
|
+
className: chunk525KS5HM_cjs.cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className),
|
|
2555
|
+
...props
|
|
2556
|
+
}
|
|
2557
|
+
));
|
|
2558
|
+
CommandList.displayName = cmdk.Command.List.displayName;
|
|
2559
|
+
var CommandEmpty = React2__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2560
|
+
cmdk.Command.Empty,
|
|
2561
|
+
{
|
|
2562
|
+
ref,
|
|
2563
|
+
className: "py-6 text-center text-sm",
|
|
2564
|
+
...props
|
|
2565
|
+
}
|
|
2566
|
+
));
|
|
2567
|
+
CommandEmpty.displayName = cmdk.Command.Empty.displayName;
|
|
2568
|
+
var CommandGroup = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2569
|
+
cmdk.Command.Group,
|
|
2570
|
+
{
|
|
2571
|
+
ref,
|
|
2572
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2573
|
+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
2574
|
+
className
|
|
2575
|
+
),
|
|
2576
|
+
...props
|
|
2577
|
+
}
|
|
2578
|
+
));
|
|
2579
|
+
CommandGroup.displayName = cmdk.Command.Group.displayName;
|
|
2580
|
+
var CommandSeparator = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2581
|
+
cmdk.Command.Separator,
|
|
2582
|
+
{
|
|
2583
|
+
ref,
|
|
2584
|
+
className: chunk525KS5HM_cjs.cn("-mx-1 h-px bg-border", className),
|
|
2585
|
+
...props
|
|
2586
|
+
}
|
|
2587
|
+
));
|
|
2588
|
+
CommandSeparator.displayName = cmdk.Command.Separator.displayName;
|
|
2589
|
+
var CommandItem = React2__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2590
|
+
cmdk.Command.Item,
|
|
2591
|
+
{
|
|
2592
|
+
ref,
|
|
2593
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2594
|
+
"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
2595
|
+
className
|
|
2596
|
+
),
|
|
2597
|
+
...props
|
|
2598
|
+
}
|
|
2599
|
+
));
|
|
2600
|
+
CommandItem.displayName = cmdk.Command.Item.displayName;
|
|
2601
|
+
var CommandShortcut = ({
|
|
2602
|
+
className,
|
|
2603
|
+
...props
|
|
2604
|
+
}) => {
|
|
2605
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2606
|
+
"span",
|
|
2607
|
+
{
|
|
2608
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2609
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
2610
|
+
className
|
|
2611
|
+
),
|
|
2612
|
+
...props
|
|
2613
|
+
}
|
|
2614
|
+
);
|
|
2615
|
+
};
|
|
2616
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
2617
|
+
var ModelSelector = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.Dialog, { ...props });
|
|
2618
|
+
var ModelSelectorTrigger = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DialogTrigger, { ...props });
|
|
2619
|
+
var ModelSelectorContent = ({
|
|
2620
|
+
className,
|
|
2621
|
+
children,
|
|
2622
|
+
title = "Model Selector",
|
|
2623
|
+
...props
|
|
2624
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(chunkX5YEOOPK_cjs.DialogContent, { className: chunk525KS5HM_cjs.cn("p-0", className), ...props, children: [
|
|
2625
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DialogTitle, { className: "sr-only", children: title }),
|
|
2626
|
+
/* @__PURE__ */ jsxRuntime.jsx(Command, { className: "**:data-[slot=command-input-wrapper]:h-auto", children })
|
|
2627
|
+
] });
|
|
2628
|
+
var ModelSelectorDialog = (props) => /* @__PURE__ */ jsxRuntime.jsx(CommandDialog, { ...props });
|
|
2629
|
+
var ModelSelectorInput = ({
|
|
2630
|
+
className,
|
|
2631
|
+
...props
|
|
2632
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(CommandInput, { className: chunk525KS5HM_cjs.cn("h-auto py-3.5", className), ...props });
|
|
2633
|
+
var ModelSelectorList = (props) => /* @__PURE__ */ jsxRuntime.jsx(CommandList, { ...props });
|
|
2634
|
+
var ModelSelectorEmpty = (props) => /* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { ...props });
|
|
2635
|
+
var ModelSelectorGroup = (props) => /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { ...props });
|
|
2636
|
+
var ModelSelectorItem = (props) => /* @__PURE__ */ jsxRuntime.jsx(CommandItem, { ...props });
|
|
2637
|
+
var ModelSelectorShortcut = (props) => /* @__PURE__ */ jsxRuntime.jsx(CommandShortcut, { ...props });
|
|
2638
|
+
var ModelSelectorSeparator = (props) => /* @__PURE__ */ jsxRuntime.jsx(CommandSeparator, { ...props });
|
|
2639
|
+
var ModelSelectorLogo = ({
|
|
2640
|
+
provider,
|
|
2641
|
+
className,
|
|
2642
|
+
...props
|
|
2643
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2644
|
+
"img",
|
|
2645
|
+
{
|
|
2646
|
+
...props,
|
|
2647
|
+
alt: `${provider} logo`,
|
|
2648
|
+
className: chunk525KS5HM_cjs.cn("size-3 dark:invert", className),
|
|
2649
|
+
height: 12,
|
|
2650
|
+
src: `https://models.dev/logos/${provider}.svg`,
|
|
2651
|
+
width: 12
|
|
2652
|
+
}
|
|
2653
|
+
);
|
|
2654
|
+
var ModelSelectorLogoGroup = ({
|
|
2655
|
+
className,
|
|
2656
|
+
...props
|
|
2657
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2658
|
+
"div",
|
|
2659
|
+
{
|
|
2660
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2661
|
+
"-space-x-1 flex shrink-0 items-center [&>img]:rounded-full [&>img]:bg-background [&>img]:p-px [&>img]:ring-1 dark:[&>img]:bg-foreground",
|
|
2662
|
+
className
|
|
2663
|
+
),
|
|
2664
|
+
...props
|
|
2665
|
+
}
|
|
2666
|
+
);
|
|
2667
|
+
var ModelSelectorName = ({
|
|
2668
|
+
className,
|
|
2669
|
+
...props
|
|
2670
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: chunk525KS5HM_cjs.cn("flex-1 truncate text-start", className), ...props });
|
|
2671
|
+
var providers = {
|
|
2672
|
+
github: {
|
|
2673
|
+
title: "Open in GitHub",
|
|
2674
|
+
createUrl: (url) => url,
|
|
2675
|
+
icon: /* @__PURE__ */ jsxRuntime.jsxs("svg", { fill: "currentColor", role: "img", viewBox: "0 0 24 24", children: [
|
|
2676
|
+
/* @__PURE__ */ jsxRuntime.jsx("title", { children: "GitHub" }),
|
|
2677
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" })
|
|
2678
|
+
] })
|
|
2679
|
+
},
|
|
2680
|
+
chatgpt: {
|
|
2681
|
+
title: "Open in ChatGPT",
|
|
2682
|
+
createUrl: (prompt) => `https://chatgpt.com/?${new URLSearchParams({
|
|
2683
|
+
hints: "search",
|
|
2684
|
+
prompt
|
|
2685
|
+
})}`,
|
|
2686
|
+
icon: /* @__PURE__ */ jsxRuntime.jsxs("svg", { fill: "currentColor", role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2687
|
+
/* @__PURE__ */ jsxRuntime.jsx("title", { children: "OpenAI" }),
|
|
2688
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729z" })
|
|
2689
|
+
] })
|
|
2690
|
+
},
|
|
2691
|
+
claude: {
|
|
2692
|
+
title: "Open in Claude",
|
|
2693
|
+
createUrl: (q) => `https://claude.ai/new?${new URLSearchParams({ q })}`,
|
|
2694
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx("svg", { fill: "currentColor", role: "img", viewBox: "0 0 12 12", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: "Claude" }) })
|
|
2695
|
+
},
|
|
2696
|
+
t3: {
|
|
2697
|
+
title: "Open in T3 Chat",
|
|
2698
|
+
createUrl: (q) => `https://t3.chat/new?${new URLSearchParams({ q })}`,
|
|
2699
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageCircleIcon, {})
|
|
2700
|
+
},
|
|
2701
|
+
scira: {
|
|
2702
|
+
title: "Open in Scira",
|
|
2703
|
+
createUrl: (q) => `https://scira.ai/?${new URLSearchParams({ q })}`,
|
|
2704
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 910 934", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: "Scira AI" }) })
|
|
2705
|
+
},
|
|
2706
|
+
v0: {
|
|
2707
|
+
title: "Open in v0",
|
|
2708
|
+
createUrl: (q) => `https://v0.app?${new URLSearchParams({ q })}`,
|
|
2709
|
+
icon: /* @__PURE__ */ jsxRuntime.jsxs("svg", { fill: "currentColor", viewBox: "0 0 147 70", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2710
|
+
/* @__PURE__ */ jsxRuntime.jsx("title", { children: "v0" }),
|
|
2711
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M56 50.2031V14H70V60.1562C70 65.5928 65.5928 70 60.1562 70C57.5605 70 54.9982 68.9992 53.1562 67.1573L0 14H19.7969L56 50.2031Z" }),
|
|
2712
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M147 56H133V23.9531L100.953 56H133V70H96.6875C85.8144 70 77 61.1856 77 50.3125V14H91V46.1562L123.156 14H91V0H127.312C138.186 0 147 8.81439 147 19.6875V56Z" })
|
|
2713
|
+
] })
|
|
2714
|
+
},
|
|
2715
|
+
cursor: {
|
|
2716
|
+
title: "Open in Cursor",
|
|
2717
|
+
createUrl: (text) => {
|
|
2718
|
+
if (typeof window === "undefined") return `https://cursor.com/link/prompt?text=${encodeURIComponent(text)}`;
|
|
2719
|
+
const url = new URL("https://cursor.com/link/prompt");
|
|
2720
|
+
url.searchParams.set("text", text);
|
|
2721
|
+
return url.toString();
|
|
2722
|
+
},
|
|
2723
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx("svg", { version: "1.1", viewBox: "0 0 466.73 532.09", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: "Cursor" }) })
|
|
2724
|
+
}
|
|
2725
|
+
};
|
|
2726
|
+
var OpenInContext = React2.createContext(void 0);
|
|
2727
|
+
var useOpenInContext = () => {
|
|
2728
|
+
const context = React2.useContext(OpenInContext);
|
|
2729
|
+
if (!context) {
|
|
2730
|
+
throw new Error("OpenIn components must be used within an OpenIn provider");
|
|
2731
|
+
}
|
|
2732
|
+
return context;
|
|
2733
|
+
};
|
|
2734
|
+
var OpenIn = ({ query, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(OpenInContext.Provider, { value: { query }, children: /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DropdownMenu, { ...props }) });
|
|
2735
|
+
var OpenInContent = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2736
|
+
chunkX5YEOOPK_cjs.DropdownMenuContent,
|
|
2737
|
+
{
|
|
2738
|
+
align: "start",
|
|
2739
|
+
className: chunk525KS5HM_cjs.cn("w-[240px]", className),
|
|
2740
|
+
...props
|
|
2741
|
+
}
|
|
2742
|
+
);
|
|
2743
|
+
var OpenInItem = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DropdownMenuItem, { ...props });
|
|
2744
|
+
var OpenInLabel = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DropdownMenuLabel, { ...props });
|
|
2745
|
+
var OpenInSeparator = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DropdownMenuSeparator, { ...props });
|
|
2746
|
+
var OpenInTrigger = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DropdownMenuTrigger, { ...props, asChild: true, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(chunkWZLWAVSS_cjs.Button, { type: "button", variant: "outline", children: [
|
|
2747
|
+
"Open in chat",
|
|
2748
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4" })
|
|
2749
|
+
] }) });
|
|
2750
|
+
var makeProviderItem = (key) => {
|
|
2751
|
+
return (props) => {
|
|
2752
|
+
const { query } = useOpenInContext();
|
|
2753
|
+
const p = providers[key];
|
|
2754
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DropdownMenuItem, { asChild: true, ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2755
|
+
"a",
|
|
2756
|
+
{
|
|
2757
|
+
className: "flex items-center gap-2",
|
|
2758
|
+
href: p.createUrl(query),
|
|
2759
|
+
rel: "noopener",
|
|
2760
|
+
target: "_blank",
|
|
2761
|
+
children: [
|
|
2762
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: p.icon }),
|
|
2763
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: p.title }),
|
|
2764
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLinkIcon, { className: "size-4 shrink-0" })
|
|
2765
|
+
]
|
|
2766
|
+
}
|
|
2767
|
+
) });
|
|
2768
|
+
};
|
|
2769
|
+
};
|
|
2770
|
+
var OpenInChatGPT = makeProviderItem("chatgpt");
|
|
2771
|
+
var OpenInClaude = makeProviderItem("claude");
|
|
2772
|
+
var OpenInT3 = makeProviderItem("t3");
|
|
2773
|
+
var OpenInScira = makeProviderItem("scira");
|
|
2774
|
+
var OpenInv0 = makeProviderItem("v0");
|
|
2775
|
+
var OpenInCursor = makeProviderItem("cursor");
|
|
2776
|
+
var Panel = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2777
|
+
react$1.Panel,
|
|
2778
|
+
{
|
|
2779
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2780
|
+
"m-4 overflow-hidden rounded-md border bg-card p-1",
|
|
2781
|
+
className
|
|
2782
|
+
),
|
|
2783
|
+
...props
|
|
2784
|
+
}
|
|
2785
|
+
);
|
|
2786
|
+
var PlanContext = React2.createContext(null);
|
|
2787
|
+
var usePlan = () => {
|
|
2788
|
+
const context = React2.useContext(PlanContext);
|
|
2789
|
+
if (!context) {
|
|
2790
|
+
throw new Error("Plan components must be used within Plan");
|
|
2791
|
+
}
|
|
2792
|
+
return context;
|
|
2793
|
+
};
|
|
2794
|
+
var Plan = ({
|
|
2795
|
+
className,
|
|
2796
|
+
isStreaming = false,
|
|
2797
|
+
children,
|
|
2798
|
+
...props
|
|
2799
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(PlanContext.Provider, { value: { isStreaming }, children: /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.Collapsible, { asChild: true, "data-slot": "plan", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(chunkAWAJOSFP_cjs.Card, { className: chunk525KS5HM_cjs.cn("shadow-none", className), children }) }) });
|
|
2800
|
+
var PlanHeader = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2801
|
+
chunkAWAJOSFP_cjs.CardHeader,
|
|
2802
|
+
{
|
|
2803
|
+
className: chunk525KS5HM_cjs.cn("flex items-start justify-between", className),
|
|
2804
|
+
"data-slot": "plan-header",
|
|
2805
|
+
...props
|
|
2806
|
+
}
|
|
2807
|
+
);
|
|
2808
|
+
var PlanTitle = ({ children, ...props }) => {
|
|
2809
|
+
const { isStreaming } = usePlan();
|
|
2810
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkAWAJOSFP_cjs.CardTitle, { "data-slot": "plan-title", ...props, children: isStreaming ? /* @__PURE__ */ jsxRuntime.jsx(Shimmer, { children }) : children });
|
|
2811
|
+
};
|
|
2812
|
+
var PlanDescription = ({
|
|
2813
|
+
className,
|
|
2814
|
+
children,
|
|
2815
|
+
...props
|
|
2816
|
+
}) => {
|
|
2817
|
+
const { isStreaming } = usePlan();
|
|
2818
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2819
|
+
chunkAWAJOSFP_cjs.CardDescription,
|
|
2820
|
+
{
|
|
2821
|
+
className: chunk525KS5HM_cjs.cn("text-balance", className),
|
|
2822
|
+
"data-slot": "plan-description",
|
|
2823
|
+
...props,
|
|
2824
|
+
children: isStreaming ? /* @__PURE__ */ jsxRuntime.jsx(Shimmer, { children }) : children
|
|
2825
|
+
}
|
|
2826
|
+
);
|
|
2827
|
+
};
|
|
2828
|
+
var PlanAction = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkAWAJOSFP_cjs.CardAction, { "data-slot": "plan-action", ...props });
|
|
2829
|
+
var PlanContent = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.CollapsibleContent, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(chunkAWAJOSFP_cjs.CardContent, { "data-slot": "plan-content", ...props }) });
|
|
2830
|
+
var PlanFooter = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkAWAJOSFP_cjs.CardFooter, { "data-slot": "plan-footer", ...props });
|
|
2831
|
+
var PlanTrigger = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2832
|
+
chunkWZLWAVSS_cjs.Button,
|
|
2833
|
+
{
|
|
2834
|
+
className: chunk525KS5HM_cjs.cn("size-8", className),
|
|
2835
|
+
"data-slot": "plan-trigger",
|
|
2836
|
+
size: "icon",
|
|
2837
|
+
variant: "ghost",
|
|
2838
|
+
...props,
|
|
2839
|
+
children: [
|
|
2840
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDownIcon, { className: "size-4" }),
|
|
2841
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle plan" })
|
|
2842
|
+
]
|
|
2843
|
+
}
|
|
2844
|
+
) });
|
|
2845
|
+
function InputGroup({ className, ...props }) {
|
|
2846
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2847
|
+
"div",
|
|
2848
|
+
{
|
|
2849
|
+
"data-slot": "input-group",
|
|
2850
|
+
role: "group",
|
|
2851
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2852
|
+
" shadow-xs relative flex w-full items-center rounded-md outline-none transition-[color,box-shadow]",
|
|
2853
|
+
"h-9 has-[>textarea]:h-auto",
|
|
2854
|
+
// Variants based on alignment.
|
|
2855
|
+
"has-[>[data-align=inline-start]]:[&>input]:pl-2",
|
|
2856
|
+
"has-[>[data-align=inline-end]]:[&>input]:pr-2",
|
|
2857
|
+
"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
|
|
2858
|
+
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
|
|
2859
|
+
// Focus state.
|
|
2860
|
+
"has-[[data-slot=input-group-control]:focus-visible]:ring-ring has-[[data-slot=input-group-control]:focus-visible]:ring-1",
|
|
2861
|
+
// Error state.
|
|
2862
|
+
"has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
|
|
2863
|
+
className
|
|
2864
|
+
),
|
|
2865
|
+
...props
|
|
2866
|
+
}
|
|
2867
|
+
);
|
|
2868
|
+
}
|
|
2869
|
+
var inputGroupAddonVariants = classVarianceAuthority.cva(
|
|
2870
|
+
"text-muted-foreground flex h-auto cursor-text select-none items-center justify-center gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
|
|
2871
|
+
{
|
|
2872
|
+
variants: {
|
|
2873
|
+
align: {
|
|
2874
|
+
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
2875
|
+
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]",
|
|
2876
|
+
"block-start": "[.border-b]:pb-3 order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5",
|
|
2877
|
+
"block-end": "[.border-t]:pt-3 order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5"
|
|
2878
|
+
}
|
|
2879
|
+
},
|
|
2880
|
+
defaultVariants: {
|
|
2881
|
+
align: "inline-start"
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
);
|
|
2885
|
+
function InputGroupAddon({
|
|
2886
|
+
className,
|
|
2887
|
+
align = "inline-start",
|
|
2888
|
+
...props
|
|
2889
|
+
}) {
|
|
2890
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2891
|
+
"div",
|
|
2892
|
+
{
|
|
2893
|
+
role: "group",
|
|
2894
|
+
"data-slot": "input-group-addon",
|
|
2895
|
+
"data-align": align,
|
|
2896
|
+
className: chunk525KS5HM_cjs.cn(inputGroupAddonVariants({ align }), className),
|
|
2897
|
+
onClick: (e) => {
|
|
2898
|
+
if (e.target.closest("button")) {
|
|
2899
|
+
return;
|
|
2900
|
+
}
|
|
2901
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
2902
|
+
},
|
|
2903
|
+
...props
|
|
2904
|
+
}
|
|
2905
|
+
);
|
|
2906
|
+
}
|
|
2907
|
+
var inputGroupButtonVariants = classVarianceAuthority.cva(
|
|
2908
|
+
"flex items-center gap-2 text-sm shadow-none",
|
|
2909
|
+
{
|
|
2910
|
+
variants: {
|
|
2911
|
+
size: {
|
|
2912
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
|
|
2913
|
+
sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
|
|
2914
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
2915
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
2916
|
+
}
|
|
2917
|
+
},
|
|
2918
|
+
defaultVariants: {
|
|
2919
|
+
size: "xs"
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
);
|
|
2923
|
+
function InputGroupButton({
|
|
2924
|
+
className,
|
|
2925
|
+
type = "button",
|
|
2926
|
+
variant = "ghost",
|
|
2927
|
+
size = "xs",
|
|
2928
|
+
...props
|
|
2929
|
+
}) {
|
|
2930
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2931
|
+
chunkWZLWAVSS_cjs.Button,
|
|
2932
|
+
{
|
|
2933
|
+
type,
|
|
2934
|
+
"data-size": size,
|
|
2935
|
+
variant,
|
|
2936
|
+
className: chunk525KS5HM_cjs.cn(inputGroupButtonVariants({ size }), className),
|
|
2937
|
+
...props
|
|
2938
|
+
}
|
|
2939
|
+
);
|
|
2940
|
+
}
|
|
2941
|
+
function InputGroupTextarea({
|
|
2942
|
+
className,
|
|
2943
|
+
...props
|
|
2944
|
+
}) {
|
|
2945
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2946
|
+
chunkX5YEOOPK_cjs.Textarea,
|
|
2947
|
+
{
|
|
2948
|
+
"data-slot": "input-group-control",
|
|
2949
|
+
className: chunk525KS5HM_cjs.cn(
|
|
2950
|
+
"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
2951
|
+
className
|
|
2952
|
+
),
|
|
2953
|
+
...props
|
|
2954
|
+
}
|
|
2955
|
+
);
|
|
2956
|
+
}
|
|
2957
|
+
var PromptInputController = React2.createContext(
|
|
2958
|
+
null
|
|
2959
|
+
);
|
|
2960
|
+
var ProviderAttachmentsContext = React2.createContext(
|
|
2961
|
+
null
|
|
2962
|
+
);
|
|
2963
|
+
var usePromptInputController = () => {
|
|
2964
|
+
const ctx = React2.useContext(PromptInputController);
|
|
2965
|
+
if (!ctx) {
|
|
2966
|
+
throw new Error(
|
|
2967
|
+
"Wrap your component inside <PromptInputProvider> to use usePromptInputController()."
|
|
2968
|
+
);
|
|
2969
|
+
}
|
|
2970
|
+
return ctx;
|
|
2971
|
+
};
|
|
2972
|
+
var useOptionalPromptInputController = () => React2.useContext(PromptInputController);
|
|
2973
|
+
var useProviderAttachments = () => {
|
|
2974
|
+
const ctx = React2.useContext(ProviderAttachmentsContext);
|
|
2975
|
+
if (!ctx) {
|
|
2976
|
+
throw new Error(
|
|
2977
|
+
"Wrap your component inside <PromptInputProvider> to use useProviderAttachments()."
|
|
2978
|
+
);
|
|
2979
|
+
}
|
|
2980
|
+
return ctx;
|
|
2981
|
+
};
|
|
2982
|
+
var useOptionalProviderAttachments = () => React2.useContext(ProviderAttachmentsContext);
|
|
2983
|
+
function PromptInputProvider({
|
|
2984
|
+
initialInput: initialTextInput = "",
|
|
2985
|
+
children
|
|
2986
|
+
}) {
|
|
2987
|
+
const [textInput, setTextInput] = React2.useState(initialTextInput);
|
|
2988
|
+
const clearInput = React2.useCallback(() => setTextInput(""), []);
|
|
2989
|
+
const [attachmentFiles, setAttachmentFiles] = React2.useState([]);
|
|
2990
|
+
const fileInputRef = React2.useRef(null);
|
|
2991
|
+
const openRef = React2.useRef(() => {
|
|
2992
|
+
});
|
|
2993
|
+
const add = React2.useCallback((files) => {
|
|
2994
|
+
const incoming = Array.from(files);
|
|
2995
|
+
if (incoming.length === 0) {
|
|
2996
|
+
return;
|
|
2997
|
+
}
|
|
2998
|
+
setAttachmentFiles(
|
|
2999
|
+
(prev) => prev.concat(
|
|
3000
|
+
incoming.map((file) => ({
|
|
3001
|
+
id: nanoid.nanoid(),
|
|
3002
|
+
type: "file",
|
|
3003
|
+
url: typeof window !== "undefined" ? URL.createObjectURL(file) : "",
|
|
3004
|
+
mediaType: file.type,
|
|
3005
|
+
filename: file.name
|
|
3006
|
+
}))
|
|
3007
|
+
)
|
|
3008
|
+
);
|
|
3009
|
+
}, []);
|
|
3010
|
+
const remove = React2.useCallback((id) => {
|
|
3011
|
+
setAttachmentFiles((prev) => {
|
|
3012
|
+
const found = prev.find((f) => f.id === id);
|
|
3013
|
+
if (found?.url && typeof window !== "undefined") {
|
|
3014
|
+
URL.revokeObjectURL(found.url);
|
|
3015
|
+
}
|
|
3016
|
+
return prev.filter((f) => f.id !== id);
|
|
3017
|
+
});
|
|
3018
|
+
}, []);
|
|
3019
|
+
const clear = React2.useCallback(() => {
|
|
3020
|
+
setAttachmentFiles((prev) => {
|
|
3021
|
+
if (typeof window !== "undefined") {
|
|
3022
|
+
for (const f of prev) {
|
|
3023
|
+
if (f.url) {
|
|
3024
|
+
URL.revokeObjectURL(f.url);
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
return [];
|
|
3029
|
+
});
|
|
3030
|
+
}, []);
|
|
3031
|
+
const attachmentsRef = React2.useRef(attachmentFiles);
|
|
3032
|
+
attachmentsRef.current = attachmentFiles;
|
|
3033
|
+
React2.useEffect(() => {
|
|
3034
|
+
return () => {
|
|
3035
|
+
if (typeof window !== "undefined") {
|
|
3036
|
+
for (const f of attachmentsRef.current) {
|
|
3037
|
+
if (f.url) {
|
|
3038
|
+
URL.revokeObjectURL(f.url);
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
}
|
|
3042
|
+
};
|
|
3043
|
+
}, []);
|
|
3044
|
+
const openFileDialog = React2.useCallback(() => {
|
|
3045
|
+
openRef.current?.();
|
|
3046
|
+
}, []);
|
|
3047
|
+
const attachments = React2.useMemo(
|
|
3048
|
+
() => ({
|
|
3049
|
+
files: attachmentFiles,
|
|
3050
|
+
add,
|
|
3051
|
+
remove,
|
|
3052
|
+
clear,
|
|
3053
|
+
openFileDialog,
|
|
3054
|
+
fileInputRef
|
|
3055
|
+
}),
|
|
3056
|
+
[attachmentFiles, add, remove, clear, openFileDialog]
|
|
3057
|
+
);
|
|
3058
|
+
const __registerFileInput = React2.useCallback(
|
|
3059
|
+
(ref, open) => {
|
|
3060
|
+
fileInputRef.current = ref.current;
|
|
3061
|
+
openRef.current = open;
|
|
3062
|
+
},
|
|
3063
|
+
[]
|
|
3064
|
+
);
|
|
3065
|
+
const controller = React2.useMemo(
|
|
3066
|
+
() => ({
|
|
3067
|
+
textInput: {
|
|
3068
|
+
value: textInput,
|
|
3069
|
+
setInput: setTextInput,
|
|
3070
|
+
clear: clearInput
|
|
3071
|
+
},
|
|
3072
|
+
attachments,
|
|
3073
|
+
__registerFileInput
|
|
3074
|
+
}),
|
|
3075
|
+
[textInput, clearInput, attachments, __registerFileInput]
|
|
3076
|
+
);
|
|
3077
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PromptInputController.Provider, { value: controller, children: /* @__PURE__ */ jsxRuntime.jsx(ProviderAttachmentsContext.Provider, { value: attachments, children }) });
|
|
3078
|
+
}
|
|
3079
|
+
var LocalAttachmentsContext = React2.createContext(null);
|
|
3080
|
+
var usePromptInputAttachments = () => {
|
|
3081
|
+
const provider = useOptionalProviderAttachments();
|
|
3082
|
+
const local = React2.useContext(LocalAttachmentsContext);
|
|
3083
|
+
const context = provider ?? local;
|
|
3084
|
+
if (!context) {
|
|
3085
|
+
throw new Error(
|
|
3086
|
+
"usePromptInputAttachments must be used within a PromptInput or PromptInputProvider"
|
|
3087
|
+
);
|
|
3088
|
+
}
|
|
3089
|
+
return context;
|
|
3090
|
+
};
|
|
3091
|
+
function PromptInputAttachment({
|
|
3092
|
+
data,
|
|
3093
|
+
className,
|
|
3094
|
+
...props
|
|
3095
|
+
}) {
|
|
3096
|
+
const attachments = usePromptInputAttachments();
|
|
3097
|
+
const filename = data.filename || "";
|
|
3098
|
+
const mediaType = data.mediaType?.startsWith("image/") && data.url ? "image" : "file";
|
|
3099
|
+
const isImage = mediaType === "image";
|
|
3100
|
+
const attachmentLabel = filename || (isImage ? "Image" : "Attachment");
|
|
3101
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(PromptInputHoverCard, { children: [
|
|
3102
|
+
/* @__PURE__ */ jsxRuntime.jsx(HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3103
|
+
"div",
|
|
3104
|
+
{
|
|
3105
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3106
|
+
"group relative flex h-8 cursor-pointer select-none items-center gap-1.5 rounded-md border border-border px-1.5 font-medium text-sm transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
3107
|
+
className
|
|
3108
|
+
),
|
|
3109
|
+
...props,
|
|
3110
|
+
children: [
|
|
3111
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative size-5 shrink-0", children: [
|
|
3112
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded bg-background transition-opacity group-hover:opacity-0", children: isImage ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3113
|
+
"img",
|
|
3114
|
+
{
|
|
3115
|
+
alt: filename || "attachment",
|
|
3116
|
+
className: "size-5 object-cover",
|
|
3117
|
+
height: 20,
|
|
3118
|
+
src: data.url,
|
|
3119
|
+
width: 20
|
|
3120
|
+
}
|
|
3121
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-5 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PaperclipIcon, { className: "size-3" }) }) }),
|
|
3122
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3123
|
+
chunkWZLWAVSS_cjs.Button,
|
|
3124
|
+
{
|
|
3125
|
+
"aria-label": "Remove attachment",
|
|
3126
|
+
className: "absolute inset-0 size-5 cursor-pointer rounded p-0 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 [&>svg]:size-2.5",
|
|
3127
|
+
onClick: (e) => {
|
|
3128
|
+
e.stopPropagation();
|
|
3129
|
+
attachments.remove(data.id);
|
|
3130
|
+
},
|
|
3131
|
+
type: "button",
|
|
3132
|
+
variant: "ghost",
|
|
3133
|
+
children: [
|
|
3134
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
|
|
3135
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Remove" })
|
|
3136
|
+
]
|
|
3137
|
+
}
|
|
3138
|
+
)
|
|
3139
|
+
] }),
|
|
3140
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", children: attachmentLabel })
|
|
3141
|
+
]
|
|
3142
|
+
},
|
|
3143
|
+
data.id
|
|
3144
|
+
) }),
|
|
3145
|
+
/* @__PURE__ */ jsxRuntime.jsx(PromptInputHoverCardContent, { className: "w-auto p-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-auto space-y-3", children: [
|
|
3146
|
+
isImage && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3147
|
+
"img",
|
|
3148
|
+
{
|
|
3149
|
+
alt: filename || "attachment preview",
|
|
3150
|
+
className: "max-h-full max-w-full object-contain",
|
|
3151
|
+
height: 384,
|
|
3152
|
+
src: data.url,
|
|
3153
|
+
width: 448
|
|
3154
|
+
}
|
|
3155
|
+
) }),
|
|
3156
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2.5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 space-y-1 px-0.5", children: [
|
|
3157
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "truncate font-semibold text-sm leading-none", children: filename || (isImage ? "Image" : "Attachment") }),
|
|
3158
|
+
data.mediaType && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate font-mono text-muted-foreground text-xs", children: data.mediaType })
|
|
3159
|
+
] }) })
|
|
3160
|
+
] }) })
|
|
3161
|
+
] });
|
|
3162
|
+
}
|
|
3163
|
+
function PromptInputAttachments({
|
|
3164
|
+
children,
|
|
3165
|
+
className,
|
|
3166
|
+
...props
|
|
3167
|
+
}) {
|
|
3168
|
+
const attachments = usePromptInputAttachments();
|
|
3169
|
+
if (!attachments.files.length) {
|
|
3170
|
+
return null;
|
|
3171
|
+
}
|
|
3172
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3173
|
+
"div",
|
|
3174
|
+
{
|
|
3175
|
+
className: chunk525KS5HM_cjs.cn("flex flex-wrap items-center gap-2 p-3 w-full", className),
|
|
3176
|
+
...props,
|
|
3177
|
+
children: attachments.files.map((file) => /* @__PURE__ */ jsxRuntime.jsx(React2.Fragment, { children: children(file) }, file.id))
|
|
3178
|
+
}
|
|
3179
|
+
);
|
|
3180
|
+
}
|
|
3181
|
+
var PromptInputActionAddAttachments = ({
|
|
3182
|
+
label = "Add photos or files",
|
|
3183
|
+
...props
|
|
3184
|
+
}) => {
|
|
3185
|
+
const attachments = usePromptInputAttachments();
|
|
3186
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3187
|
+
chunkX5YEOOPK_cjs.DropdownMenuItem,
|
|
3188
|
+
{
|
|
3189
|
+
...props,
|
|
3190
|
+
onSelect: (e) => {
|
|
3191
|
+
e.preventDefault();
|
|
3192
|
+
attachments.openFileDialog();
|
|
3193
|
+
},
|
|
3194
|
+
children: [
|
|
3195
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ImageIcon, { className: "mr-2 size-4" }),
|
|
3196
|
+
" ",
|
|
3197
|
+
label
|
|
3198
|
+
]
|
|
3199
|
+
}
|
|
3200
|
+
);
|
|
3201
|
+
};
|
|
3202
|
+
var PromptInput = ({
|
|
3203
|
+
className,
|
|
3204
|
+
accept,
|
|
3205
|
+
multiple,
|
|
3206
|
+
globalDrop,
|
|
3207
|
+
syncHiddenInput,
|
|
3208
|
+
maxFiles,
|
|
3209
|
+
maxFileSize,
|
|
3210
|
+
onError,
|
|
3211
|
+
onSubmit,
|
|
3212
|
+
children,
|
|
3213
|
+
...props
|
|
3214
|
+
}) => {
|
|
3215
|
+
const controller = useOptionalPromptInputController();
|
|
3216
|
+
const usingProvider = !!controller;
|
|
3217
|
+
const inputRef = React2.useRef(null);
|
|
3218
|
+
const formRef = React2.useRef(null);
|
|
3219
|
+
const [items, setItems] = React2.useState([]);
|
|
3220
|
+
const files = usingProvider ? controller.attachments.files : items;
|
|
3221
|
+
const filesRef = React2.useRef(files);
|
|
3222
|
+
filesRef.current = files;
|
|
3223
|
+
const openFileDialogLocal = React2.useCallback(() => {
|
|
3224
|
+
inputRef.current?.click();
|
|
3225
|
+
}, []);
|
|
3226
|
+
const matchesAccept = React2.useCallback(
|
|
3227
|
+
(f) => {
|
|
3228
|
+
if (!accept || accept.trim() === "") {
|
|
3229
|
+
return true;
|
|
3230
|
+
}
|
|
3231
|
+
const patterns = accept.split(",").map((s) => s.trim()).filter(Boolean);
|
|
3232
|
+
return patterns.some((pattern) => {
|
|
3233
|
+
if (pattern.endsWith("/*")) {
|
|
3234
|
+
const prefix = pattern.slice(0, -1);
|
|
3235
|
+
return f.type.startsWith(prefix);
|
|
3236
|
+
}
|
|
3237
|
+
return f.type === pattern;
|
|
3238
|
+
});
|
|
3239
|
+
},
|
|
3240
|
+
[accept]
|
|
3241
|
+
);
|
|
3242
|
+
const addLocal = React2.useCallback(
|
|
3243
|
+
(fileList) => {
|
|
3244
|
+
const incoming = Array.from(fileList);
|
|
3245
|
+
const accepted = incoming.filter((f) => matchesAccept(f));
|
|
3246
|
+
if (incoming.length && accepted.length === 0) {
|
|
3247
|
+
onError?.({
|
|
3248
|
+
code: "accept",
|
|
3249
|
+
message: "No files match the accepted types."
|
|
3250
|
+
});
|
|
3251
|
+
return;
|
|
3252
|
+
}
|
|
3253
|
+
const withinSize = (f) => maxFileSize ? f.size <= maxFileSize : true;
|
|
3254
|
+
const sized = accepted.filter(withinSize);
|
|
3255
|
+
if (accepted.length > 0 && sized.length === 0) {
|
|
3256
|
+
onError?.({
|
|
3257
|
+
code: "max_file_size",
|
|
3258
|
+
message: "All files exceed the maximum size."
|
|
3259
|
+
});
|
|
3260
|
+
return;
|
|
3261
|
+
}
|
|
3262
|
+
setItems((prev) => {
|
|
3263
|
+
const capacity = typeof maxFiles === "number" ? Math.max(0, maxFiles - prev.length) : void 0;
|
|
3264
|
+
const capped = typeof capacity === "number" ? sized.slice(0, capacity) : sized;
|
|
3265
|
+
if (typeof capacity === "number" && sized.length > capacity) {
|
|
3266
|
+
onError?.({
|
|
3267
|
+
code: "max_files",
|
|
3268
|
+
message: "Too many files. Some were not added."
|
|
3269
|
+
});
|
|
3270
|
+
}
|
|
3271
|
+
const next = [];
|
|
3272
|
+
for (const file of capped) {
|
|
3273
|
+
next.push({
|
|
3274
|
+
id: nanoid.nanoid(),
|
|
3275
|
+
type: "file",
|
|
3276
|
+
url: typeof window !== "undefined" ? URL.createObjectURL(file) : "",
|
|
3277
|
+
mediaType: file.type,
|
|
3278
|
+
filename: file.name
|
|
3279
|
+
});
|
|
3280
|
+
}
|
|
3281
|
+
return prev.concat(next);
|
|
3282
|
+
});
|
|
3283
|
+
},
|
|
3284
|
+
[matchesAccept, maxFiles, maxFileSize, onError]
|
|
3285
|
+
);
|
|
3286
|
+
const removeLocal = React2.useCallback(
|
|
3287
|
+
(id) => setItems((prev) => {
|
|
3288
|
+
const found = prev.find((file) => file.id === id);
|
|
3289
|
+
if (found?.url && typeof window !== "undefined") {
|
|
3290
|
+
URL.revokeObjectURL(found.url);
|
|
3291
|
+
}
|
|
3292
|
+
return prev.filter((file) => file.id !== id);
|
|
3293
|
+
}),
|
|
3294
|
+
[]
|
|
3295
|
+
);
|
|
3296
|
+
const clearLocal = React2.useCallback(
|
|
3297
|
+
() => setItems((prev) => {
|
|
3298
|
+
if (typeof window !== "undefined") {
|
|
3299
|
+
for (const file of prev) {
|
|
3300
|
+
if (file.url) {
|
|
3301
|
+
URL.revokeObjectURL(file.url);
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
return [];
|
|
3306
|
+
}),
|
|
3307
|
+
[]
|
|
3308
|
+
);
|
|
3309
|
+
const add = usingProvider ? controller.attachments.add : addLocal;
|
|
3310
|
+
const remove = usingProvider ? controller.attachments.remove : removeLocal;
|
|
3311
|
+
const clear = usingProvider ? controller.attachments.clear : clearLocal;
|
|
3312
|
+
const openFileDialog = usingProvider ? controller.attachments.openFileDialog : openFileDialogLocal;
|
|
3313
|
+
React2.useEffect(() => {
|
|
3314
|
+
if (!usingProvider) return;
|
|
3315
|
+
controller.__registerFileInput(inputRef, () => inputRef.current?.click());
|
|
3316
|
+
}, [usingProvider, controller]);
|
|
3317
|
+
React2.useEffect(() => {
|
|
3318
|
+
if (syncHiddenInput && inputRef.current && files.length === 0) {
|
|
3319
|
+
inputRef.current.value = "";
|
|
3320
|
+
}
|
|
3321
|
+
}, [files, syncHiddenInput]);
|
|
3322
|
+
React2.useEffect(() => {
|
|
3323
|
+
const form = formRef.current;
|
|
3324
|
+
if (!form) return;
|
|
3325
|
+
if (globalDrop) return;
|
|
3326
|
+
const onDragOver = (e) => {
|
|
3327
|
+
if (e.dataTransfer?.types?.includes("Files")) {
|
|
3328
|
+
e.preventDefault();
|
|
3329
|
+
}
|
|
3330
|
+
};
|
|
3331
|
+
const onDrop = (e) => {
|
|
3332
|
+
if (e.dataTransfer?.types?.includes("Files")) {
|
|
3333
|
+
e.preventDefault();
|
|
3334
|
+
}
|
|
3335
|
+
if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) {
|
|
3336
|
+
add(e.dataTransfer.files);
|
|
3337
|
+
}
|
|
3338
|
+
};
|
|
3339
|
+
form.addEventListener("dragover", onDragOver);
|
|
3340
|
+
form.addEventListener("drop", onDrop);
|
|
3341
|
+
return () => {
|
|
3342
|
+
form.removeEventListener("dragover", onDragOver);
|
|
3343
|
+
form.removeEventListener("drop", onDrop);
|
|
3344
|
+
};
|
|
3345
|
+
}, [add, globalDrop]);
|
|
3346
|
+
React2.useEffect(() => {
|
|
3347
|
+
if (!globalDrop) return;
|
|
3348
|
+
if (typeof document === "undefined") return;
|
|
3349
|
+
const onDragOver = (e) => {
|
|
3350
|
+
if (e.dataTransfer?.types?.includes("Files")) {
|
|
3351
|
+
e.preventDefault();
|
|
3352
|
+
}
|
|
3353
|
+
};
|
|
3354
|
+
const onDrop = (e) => {
|
|
3355
|
+
if (e.dataTransfer?.types?.includes("Files")) {
|
|
3356
|
+
e.preventDefault();
|
|
3357
|
+
}
|
|
3358
|
+
if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) {
|
|
3359
|
+
add(e.dataTransfer.files);
|
|
3360
|
+
}
|
|
3361
|
+
};
|
|
3362
|
+
document.addEventListener("dragover", onDragOver);
|
|
3363
|
+
document.addEventListener("drop", onDrop);
|
|
3364
|
+
return () => {
|
|
3365
|
+
document.removeEventListener("dragover", onDragOver);
|
|
3366
|
+
document.removeEventListener("drop", onDrop);
|
|
3367
|
+
};
|
|
3368
|
+
}, [add, globalDrop]);
|
|
3369
|
+
React2.useEffect(
|
|
3370
|
+
() => () => {
|
|
3371
|
+
if (!usingProvider && typeof window !== "undefined") {
|
|
3372
|
+
for (const f of filesRef.current) {
|
|
3373
|
+
if (f.url) URL.revokeObjectURL(f.url);
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
},
|
|
3377
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3378
|
+
[usingProvider]
|
|
3379
|
+
);
|
|
3380
|
+
const handleChange = (event) => {
|
|
3381
|
+
if (event.currentTarget.files) {
|
|
3382
|
+
add(event.currentTarget.files);
|
|
3383
|
+
}
|
|
3384
|
+
event.currentTarget.value = "";
|
|
3385
|
+
};
|
|
3386
|
+
const convertBlobUrlToDataUrl = async (url) => {
|
|
3387
|
+
if (typeof window === "undefined") return null;
|
|
3388
|
+
try {
|
|
3389
|
+
const response = await fetch(url);
|
|
3390
|
+
const blob = await response.blob();
|
|
3391
|
+
return new Promise((resolve) => {
|
|
3392
|
+
const reader = new FileReader();
|
|
3393
|
+
reader.onloadend = () => resolve(reader.result);
|
|
3394
|
+
reader.onerror = () => resolve(null);
|
|
3395
|
+
reader.readAsDataURL(blob);
|
|
3396
|
+
});
|
|
3397
|
+
} catch {
|
|
3398
|
+
return null;
|
|
3399
|
+
}
|
|
3400
|
+
};
|
|
3401
|
+
const ctx = React2.useMemo(
|
|
3402
|
+
() => ({
|
|
3403
|
+
files: files.map((item) => ({ ...item, id: item.id })),
|
|
3404
|
+
add,
|
|
3405
|
+
remove,
|
|
3406
|
+
clear,
|
|
3407
|
+
openFileDialog,
|
|
3408
|
+
fileInputRef: inputRef
|
|
3409
|
+
}),
|
|
3410
|
+
[files, add, remove, clear, openFileDialog]
|
|
3411
|
+
);
|
|
3412
|
+
const handleSubmit = (event) => {
|
|
3413
|
+
event.preventDefault();
|
|
3414
|
+
const form = event.currentTarget;
|
|
3415
|
+
const text = usingProvider ? controller.textInput.value : (() => {
|
|
3416
|
+
const formData = new FormData(form);
|
|
3417
|
+
return formData.get("message") || "";
|
|
3418
|
+
})();
|
|
3419
|
+
if (!usingProvider) {
|
|
3420
|
+
form.reset();
|
|
3421
|
+
}
|
|
3422
|
+
Promise.all(
|
|
3423
|
+
files.map(async ({ id, ...item }) => {
|
|
3424
|
+
if (item.url && item.url.startsWith("blob:")) {
|
|
3425
|
+
const dataUrl = await convertBlobUrlToDataUrl(item.url);
|
|
3426
|
+
return {
|
|
3427
|
+
...item,
|
|
3428
|
+
url: dataUrl ?? item.url
|
|
3429
|
+
};
|
|
3430
|
+
}
|
|
3431
|
+
return item;
|
|
3432
|
+
})
|
|
3433
|
+
).then((convertedFiles) => {
|
|
3434
|
+
try {
|
|
3435
|
+
const result = onSubmit({ text, files: convertedFiles }, event);
|
|
3436
|
+
if (result instanceof Promise) {
|
|
3437
|
+
result.then(() => {
|
|
3438
|
+
clear();
|
|
3439
|
+
if (usingProvider) {
|
|
3440
|
+
controller.textInput.clear();
|
|
3441
|
+
}
|
|
3442
|
+
}).catch(() => {
|
|
3443
|
+
});
|
|
3444
|
+
} else {
|
|
3445
|
+
clear();
|
|
3446
|
+
if (usingProvider) {
|
|
3447
|
+
controller.textInput.clear();
|
|
3448
|
+
}
|
|
3449
|
+
}
|
|
3450
|
+
} catch {
|
|
3451
|
+
}
|
|
3452
|
+
}).catch(() => {
|
|
3453
|
+
});
|
|
3454
|
+
};
|
|
3455
|
+
const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3456
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3457
|
+
"input",
|
|
3458
|
+
{
|
|
3459
|
+
accept,
|
|
3460
|
+
"aria-label": "Upload files",
|
|
3461
|
+
className: "hidden",
|
|
3462
|
+
multiple,
|
|
3463
|
+
onChange: handleChange,
|
|
3464
|
+
ref: inputRef,
|
|
3465
|
+
title: "Upload files",
|
|
3466
|
+
type: "file"
|
|
3467
|
+
}
|
|
3468
|
+
),
|
|
3469
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3470
|
+
"form",
|
|
3471
|
+
{
|
|
3472
|
+
className: chunk525KS5HM_cjs.cn("w-full", className),
|
|
3473
|
+
onSubmit: handleSubmit,
|
|
3474
|
+
ref: formRef,
|
|
3475
|
+
...props,
|
|
3476
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(InputGroup, { className: "overflow-hidden", children })
|
|
3477
|
+
}
|
|
3478
|
+
)
|
|
3479
|
+
] });
|
|
3480
|
+
return usingProvider ? inner : /* @__PURE__ */ jsxRuntime.jsx(LocalAttachmentsContext.Provider, { value: ctx, children: inner });
|
|
3481
|
+
};
|
|
3482
|
+
var PromptInputBody = ({
|
|
3483
|
+
className,
|
|
3484
|
+
...props
|
|
3485
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("contents", className), ...props });
|
|
3486
|
+
var PromptInputTextarea = ({
|
|
3487
|
+
onChange,
|
|
3488
|
+
className,
|
|
3489
|
+
placeholder = "What would you like to know?",
|
|
3490
|
+
...props
|
|
3491
|
+
}) => {
|
|
3492
|
+
const controller = useOptionalPromptInputController();
|
|
3493
|
+
const attachments = usePromptInputAttachments();
|
|
3494
|
+
const [isComposing, setIsComposing] = React2.useState(false);
|
|
3495
|
+
const handleKeyDown = (e) => {
|
|
3496
|
+
if (e.key === "Enter") {
|
|
3497
|
+
if (isComposing || e.nativeEvent.isComposing) {
|
|
3498
|
+
return;
|
|
3499
|
+
}
|
|
3500
|
+
if (e.shiftKey) {
|
|
3501
|
+
return;
|
|
3502
|
+
}
|
|
3503
|
+
e.preventDefault();
|
|
3504
|
+
const form = e.currentTarget.form;
|
|
3505
|
+
const submitButton = form?.querySelector(
|
|
3506
|
+
'button[type="submit"]'
|
|
3507
|
+
);
|
|
3508
|
+
if (submitButton?.disabled) {
|
|
3509
|
+
return;
|
|
3510
|
+
}
|
|
3511
|
+
form?.requestSubmit();
|
|
3512
|
+
}
|
|
3513
|
+
if (e.key === "Backspace" && e.currentTarget.value === "" && attachments.files.length > 0) {
|
|
3514
|
+
e.preventDefault();
|
|
3515
|
+
const lastAttachment = attachments.files.at(-1);
|
|
3516
|
+
if (lastAttachment) {
|
|
3517
|
+
attachments.remove(lastAttachment.id);
|
|
3518
|
+
}
|
|
3519
|
+
}
|
|
3520
|
+
};
|
|
3521
|
+
const handlePaste = (event) => {
|
|
3522
|
+
const items = event.clipboardData?.items;
|
|
3523
|
+
if (!items) {
|
|
3524
|
+
return;
|
|
3525
|
+
}
|
|
3526
|
+
const files = [];
|
|
3527
|
+
for (const item of items) {
|
|
3528
|
+
if (item.kind === "file") {
|
|
3529
|
+
const file = item.getAsFile();
|
|
3530
|
+
if (file) {
|
|
3531
|
+
files.push(file);
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
if (files.length > 0) {
|
|
3536
|
+
event.preventDefault();
|
|
3537
|
+
attachments.add(files);
|
|
3538
|
+
}
|
|
3539
|
+
};
|
|
3540
|
+
const controlledProps = controller ? {
|
|
3541
|
+
value: controller.textInput.value,
|
|
3542
|
+
onChange: (e) => {
|
|
3543
|
+
controller.textInput.setInput(e.currentTarget.value);
|
|
3544
|
+
onChange?.(e);
|
|
3545
|
+
}
|
|
3546
|
+
} : {
|
|
3547
|
+
onChange
|
|
3548
|
+
};
|
|
3549
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3550
|
+
InputGroupTextarea,
|
|
3551
|
+
{
|
|
3552
|
+
className: chunk525KS5HM_cjs.cn("field-sizing-content max-h-48 min-h-16", className),
|
|
3553
|
+
name: "message",
|
|
3554
|
+
onCompositionEnd: () => setIsComposing(false),
|
|
3555
|
+
onCompositionStart: () => setIsComposing(true),
|
|
3556
|
+
onKeyDown: handleKeyDown,
|
|
3557
|
+
onPaste: handlePaste,
|
|
3558
|
+
placeholder,
|
|
3559
|
+
...props,
|
|
3560
|
+
...controlledProps
|
|
3561
|
+
}
|
|
3562
|
+
);
|
|
3563
|
+
};
|
|
3564
|
+
var PromptInputHeader = ({
|
|
3565
|
+
className,
|
|
3566
|
+
...props
|
|
3567
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3568
|
+
InputGroupAddon,
|
|
3569
|
+
{
|
|
3570
|
+
align: "block-end",
|
|
3571
|
+
className: chunk525KS5HM_cjs.cn("order-first flex-wrap gap-1", className),
|
|
3572
|
+
...props
|
|
3573
|
+
}
|
|
3574
|
+
);
|
|
3575
|
+
var PromptInputFooter = ({
|
|
3576
|
+
className,
|
|
3577
|
+
...props
|
|
3578
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3579
|
+
InputGroupAddon,
|
|
3580
|
+
{
|
|
3581
|
+
align: "block-end",
|
|
3582
|
+
className: chunk525KS5HM_cjs.cn("justify-between gap-1", className),
|
|
3583
|
+
...props
|
|
3584
|
+
}
|
|
3585
|
+
);
|
|
3586
|
+
var PromptInputTools = ({
|
|
3587
|
+
className,
|
|
3588
|
+
...props
|
|
3589
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("flex items-center gap-1", className), ...props });
|
|
3590
|
+
var PromptInputButton = ({
|
|
3591
|
+
variant = "ghost",
|
|
3592
|
+
className,
|
|
3593
|
+
size,
|
|
3594
|
+
...props
|
|
3595
|
+
}) => {
|
|
3596
|
+
const newSize = size ?? (React2.Children.count(props.children) > 1 ? "sm" : "icon-sm");
|
|
3597
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3598
|
+
InputGroupButton,
|
|
3599
|
+
{
|
|
3600
|
+
className: chunk525KS5HM_cjs.cn(className),
|
|
3601
|
+
size: newSize,
|
|
3602
|
+
type: "button",
|
|
3603
|
+
variant,
|
|
3604
|
+
...props
|
|
3605
|
+
}
|
|
3606
|
+
);
|
|
3607
|
+
};
|
|
3608
|
+
var PromptInputActionMenu = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DropdownMenu, { ...props });
|
|
3609
|
+
var PromptInputActionMenuTrigger = ({
|
|
3610
|
+
className,
|
|
3611
|
+
children,
|
|
3612
|
+
...props
|
|
3613
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(PromptInputButton, { className, ...props, children: children ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "size-4" }) }) });
|
|
3614
|
+
var PromptInputActionMenuContent = ({
|
|
3615
|
+
className,
|
|
3616
|
+
...props
|
|
3617
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DropdownMenuContent, { align: "start", className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3618
|
+
var PromptInputActionMenuItem = ({
|
|
3619
|
+
className,
|
|
3620
|
+
...props
|
|
3621
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.DropdownMenuItem, { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3622
|
+
var PromptInputSubmit = ({
|
|
3623
|
+
className,
|
|
3624
|
+
variant = "default",
|
|
3625
|
+
size = "icon-sm",
|
|
3626
|
+
status,
|
|
3627
|
+
children,
|
|
3628
|
+
...props
|
|
3629
|
+
}) => {
|
|
3630
|
+
let Icon = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CornerDownLeftIcon, { className: "size-4" });
|
|
3631
|
+
if (status === "submitted") {
|
|
3632
|
+
Icon = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2Icon, { className: "size-4 animate-spin" });
|
|
3633
|
+
} else if (status === "streaming") {
|
|
3634
|
+
Icon = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SquareIcon, { className: "size-4" });
|
|
3635
|
+
} else if (status === "error") {
|
|
3636
|
+
Icon = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "size-4" });
|
|
3637
|
+
}
|
|
3638
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3639
|
+
InputGroupButton,
|
|
3640
|
+
{
|
|
3641
|
+
"aria-label": "Submit",
|
|
3642
|
+
className: chunk525KS5HM_cjs.cn(className),
|
|
3643
|
+
size,
|
|
3644
|
+
type: "submit",
|
|
3645
|
+
variant,
|
|
3646
|
+
...props,
|
|
3647
|
+
children: children ?? Icon
|
|
3648
|
+
}
|
|
3649
|
+
);
|
|
3650
|
+
};
|
|
3651
|
+
var PromptInputSpeechButton = ({
|
|
3652
|
+
className,
|
|
3653
|
+
textareaRef,
|
|
3654
|
+
onTranscriptionChange,
|
|
3655
|
+
...props
|
|
3656
|
+
}) => {
|
|
3657
|
+
const [isListening, setIsListening] = React2.useState(false);
|
|
3658
|
+
const [recognition, setRecognition] = React2.useState(
|
|
3659
|
+
null
|
|
3660
|
+
);
|
|
3661
|
+
const recognitionRef = React2.useRef(null);
|
|
3662
|
+
React2.useEffect(() => {
|
|
3663
|
+
if (typeof window !== "undefined" && ("SpeechRecognition" in window || "webkitSpeechRecognition" in window)) {
|
|
3664
|
+
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
3665
|
+
const speechRecognition = new SpeechRecognition();
|
|
3666
|
+
speechRecognition.continuous = true;
|
|
3667
|
+
speechRecognition.interimResults = true;
|
|
3668
|
+
speechRecognition.lang = "en-US";
|
|
3669
|
+
speechRecognition.onstart = () => {
|
|
3670
|
+
setIsListening(true);
|
|
3671
|
+
};
|
|
3672
|
+
speechRecognition.onend = () => {
|
|
3673
|
+
setIsListening(false);
|
|
3674
|
+
};
|
|
3675
|
+
speechRecognition.onresult = (event) => {
|
|
3676
|
+
let finalTranscript = "";
|
|
3677
|
+
for (let i = event.resultIndex; i < event.results.length; i++) {
|
|
3678
|
+
const result = event.results[i];
|
|
3679
|
+
if (result.isFinal) {
|
|
3680
|
+
finalTranscript += result[0]?.transcript ?? "";
|
|
3681
|
+
}
|
|
3682
|
+
}
|
|
3683
|
+
if (finalTranscript && textareaRef?.current) {
|
|
3684
|
+
const textarea = textareaRef.current;
|
|
3685
|
+
const currentValue = textarea.value;
|
|
3686
|
+
const newValue = currentValue + (currentValue ? " " : "") + finalTranscript;
|
|
3687
|
+
textarea.value = newValue;
|
|
3688
|
+
textarea.dispatchEvent(new Event("input", { bubbles: true }));
|
|
3689
|
+
onTranscriptionChange?.(newValue);
|
|
3690
|
+
}
|
|
3691
|
+
};
|
|
3692
|
+
speechRecognition.onerror = (event) => {
|
|
3693
|
+
console.error("Speech recognition error:", event.error);
|
|
3694
|
+
setIsListening(false);
|
|
3695
|
+
};
|
|
3696
|
+
recognitionRef.current = speechRecognition;
|
|
3697
|
+
setRecognition(speechRecognition);
|
|
3698
|
+
}
|
|
3699
|
+
return () => {
|
|
3700
|
+
if (recognitionRef.current) {
|
|
3701
|
+
recognitionRef.current.stop();
|
|
3702
|
+
}
|
|
3703
|
+
};
|
|
3704
|
+
}, [textareaRef, onTranscriptionChange]);
|
|
3705
|
+
const toggleListening = React2.useCallback(() => {
|
|
3706
|
+
if (!recognition) {
|
|
3707
|
+
return;
|
|
3708
|
+
}
|
|
3709
|
+
if (isListening) {
|
|
3710
|
+
recognition.stop();
|
|
3711
|
+
} else {
|
|
3712
|
+
recognition.start();
|
|
3713
|
+
}
|
|
3714
|
+
}, [recognition, isListening]);
|
|
3715
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3716
|
+
PromptInputButton,
|
|
3717
|
+
{
|
|
3718
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3719
|
+
"relative transition-all duration-200",
|
|
3720
|
+
isListening && "animate-pulse bg-accent text-accent-foreground",
|
|
3721
|
+
className
|
|
3722
|
+
),
|
|
3723
|
+
disabled: !recognition,
|
|
3724
|
+
onClick: toggleListening,
|
|
3725
|
+
...props,
|
|
3726
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MicIcon, { className: "size-4" })
|
|
3727
|
+
}
|
|
3728
|
+
);
|
|
3729
|
+
};
|
|
3730
|
+
var PromptInputSelect = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.Select, { ...props });
|
|
3731
|
+
var PromptInputSelectTrigger = ({
|
|
3732
|
+
className,
|
|
3733
|
+
...props
|
|
3734
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3735
|
+
chunkX5YEOOPK_cjs.SelectTrigger,
|
|
3736
|
+
{
|
|
3737
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3738
|
+
"border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors",
|
|
3739
|
+
"hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground",
|
|
3740
|
+
className
|
|
3741
|
+
),
|
|
3742
|
+
...props
|
|
3743
|
+
}
|
|
3744
|
+
);
|
|
3745
|
+
var PromptInputSelectContent = ({
|
|
3746
|
+
className,
|
|
3747
|
+
...props
|
|
3748
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.SelectContent, { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3749
|
+
var PromptInputSelectItem = ({
|
|
3750
|
+
className,
|
|
3751
|
+
...props
|
|
3752
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.SelectItem, { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3753
|
+
var PromptInputSelectValue = ({
|
|
3754
|
+
className,
|
|
3755
|
+
...props
|
|
3756
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.SelectValue, { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3757
|
+
var PromptInputHoverCard = ({
|
|
3758
|
+
openDelay = 0,
|
|
3759
|
+
closeDelay = 0,
|
|
3760
|
+
...props
|
|
3761
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(HoverCard, { closeDelay, openDelay, ...props });
|
|
3762
|
+
var PromptInputHoverCardTrigger = (props) => /* @__PURE__ */ jsxRuntime.jsx(HoverCardTrigger, { ...props });
|
|
3763
|
+
var PromptInputHoverCardContent = ({
|
|
3764
|
+
align = "start",
|
|
3765
|
+
...props
|
|
3766
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(HoverCardContent, { align, ...props });
|
|
3767
|
+
var PromptInputTabsList = ({
|
|
3768
|
+
className,
|
|
3769
|
+
...props
|
|
3770
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3771
|
+
var PromptInputTab = ({
|
|
3772
|
+
className,
|
|
3773
|
+
...props
|
|
3774
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3775
|
+
var PromptInputTabLabel = ({
|
|
3776
|
+
className,
|
|
3777
|
+
...props
|
|
3778
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3779
|
+
"h3",
|
|
3780
|
+
{
|
|
3781
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3782
|
+
"mb-2 px-3 font-medium text-muted-foreground text-xs",
|
|
3783
|
+
className
|
|
3784
|
+
),
|
|
3785
|
+
...props
|
|
3786
|
+
}
|
|
3787
|
+
);
|
|
3788
|
+
var PromptInputTabBody = ({
|
|
3789
|
+
className,
|
|
3790
|
+
...props
|
|
3791
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("space-y-1", className), ...props });
|
|
3792
|
+
var PromptInputTabItem = ({
|
|
3793
|
+
className,
|
|
3794
|
+
...props
|
|
3795
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3796
|
+
"div",
|
|
3797
|
+
{
|
|
3798
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3799
|
+
"flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent",
|
|
3800
|
+
className
|
|
3801
|
+
),
|
|
3802
|
+
...props
|
|
3803
|
+
}
|
|
3804
|
+
);
|
|
3805
|
+
var PromptInputCommand = ({
|
|
3806
|
+
className,
|
|
3807
|
+
...props
|
|
3808
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(Command, { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3809
|
+
var PromptInputCommandInput = ({
|
|
3810
|
+
className,
|
|
3811
|
+
...props
|
|
3812
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(CommandInput, { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3813
|
+
var PromptInputCommandList = ({
|
|
3814
|
+
className,
|
|
3815
|
+
...props
|
|
3816
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(CommandList, { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3817
|
+
var PromptInputCommandEmpty = ({
|
|
3818
|
+
className,
|
|
3819
|
+
...props
|
|
3820
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3821
|
+
var PromptInputCommandGroup = ({
|
|
3822
|
+
className,
|
|
3823
|
+
...props
|
|
3824
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3825
|
+
var PromptInputCommandItem = ({
|
|
3826
|
+
className,
|
|
3827
|
+
...props
|
|
3828
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(CommandItem, { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3829
|
+
var PromptInputCommandSeparator = ({
|
|
3830
|
+
className,
|
|
3831
|
+
...props
|
|
3832
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(CommandSeparator, { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3833
|
+
var QueueItem = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3834
|
+
"li",
|
|
3835
|
+
{
|
|
3836
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3837
|
+
"group flex flex-col gap-1 rounded-md px-3 py-1 text-sm transition-colors hover:bg-muted",
|
|
3838
|
+
className
|
|
3839
|
+
),
|
|
3840
|
+
...props
|
|
3841
|
+
}
|
|
3842
|
+
);
|
|
3843
|
+
var QueueItemIndicator = ({
|
|
3844
|
+
completed = false,
|
|
3845
|
+
className,
|
|
3846
|
+
...props
|
|
3847
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3848
|
+
"span",
|
|
3849
|
+
{
|
|
3850
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3851
|
+
"mt-0.5 inline-block size-2.5 rounded-full border",
|
|
3852
|
+
completed ? "border-muted-foreground/20 bg-muted-foreground/10" : "border-muted-foreground/50",
|
|
3853
|
+
className
|
|
3854
|
+
),
|
|
3855
|
+
...props
|
|
3856
|
+
}
|
|
3857
|
+
);
|
|
3858
|
+
var QueueItemContent = ({
|
|
3859
|
+
completed = false,
|
|
3860
|
+
className,
|
|
3861
|
+
...props
|
|
3862
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3863
|
+
"span",
|
|
3864
|
+
{
|
|
3865
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3866
|
+
"line-clamp-1 grow break-words",
|
|
3867
|
+
completed ? "text-muted-foreground/50 line-through" : "text-muted-foreground",
|
|
3868
|
+
className
|
|
3869
|
+
),
|
|
3870
|
+
...props
|
|
3871
|
+
}
|
|
3872
|
+
);
|
|
3873
|
+
var QueueItemDescription = ({
|
|
3874
|
+
completed = false,
|
|
3875
|
+
className,
|
|
3876
|
+
...props
|
|
3877
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3878
|
+
"div",
|
|
3879
|
+
{
|
|
3880
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3881
|
+
"ml-6 text-xs",
|
|
3882
|
+
completed ? "text-muted-foreground/40 line-through" : "text-muted-foreground",
|
|
3883
|
+
className
|
|
3884
|
+
),
|
|
3885
|
+
...props
|
|
3886
|
+
}
|
|
3887
|
+
);
|
|
3888
|
+
var QueueItemActions = ({
|
|
3889
|
+
className,
|
|
3890
|
+
...props
|
|
3891
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("flex gap-1", className), ...props });
|
|
3892
|
+
var QueueItemAction = ({
|
|
3893
|
+
className,
|
|
3894
|
+
...props
|
|
3895
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3896
|
+
chunkWZLWAVSS_cjs.Button,
|
|
3897
|
+
{
|
|
3898
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3899
|
+
"size-auto rounded p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-muted-foreground/10 hover:text-foreground group-hover:opacity-100",
|
|
3900
|
+
className
|
|
3901
|
+
),
|
|
3902
|
+
size: "icon",
|
|
3903
|
+
type: "button",
|
|
3904
|
+
variant: "ghost",
|
|
3905
|
+
...props
|
|
3906
|
+
}
|
|
3907
|
+
);
|
|
3908
|
+
var QueueItemAttachment = ({
|
|
3909
|
+
className,
|
|
3910
|
+
...props
|
|
3911
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("mt-1 flex flex-wrap gap-2", className), ...props });
|
|
3912
|
+
var QueueItemImage = ({
|
|
3913
|
+
className,
|
|
3914
|
+
...props
|
|
3915
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3916
|
+
"img",
|
|
3917
|
+
{
|
|
3918
|
+
alt: "",
|
|
3919
|
+
className: chunk525KS5HM_cjs.cn("h-8 w-8 rounded border object-cover", className),
|
|
3920
|
+
height: 32,
|
|
3921
|
+
width: 32,
|
|
3922
|
+
...props
|
|
3923
|
+
}
|
|
3924
|
+
);
|
|
3925
|
+
var QueueItemFile = ({
|
|
3926
|
+
children,
|
|
3927
|
+
className,
|
|
3928
|
+
...props
|
|
3929
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3930
|
+
"span",
|
|
3931
|
+
{
|
|
3932
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3933
|
+
"flex items-center gap-1 rounded border bg-muted px-2 py-1 text-xs",
|
|
3934
|
+
className
|
|
3935
|
+
),
|
|
3936
|
+
...props,
|
|
3937
|
+
children: [
|
|
3938
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.PaperclipIcon, { size: 12 }),
|
|
3939
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-w-[100px] truncate", children })
|
|
3940
|
+
]
|
|
3941
|
+
}
|
|
3942
|
+
);
|
|
3943
|
+
var QueueList = ({
|
|
3944
|
+
children,
|
|
3945
|
+
className,
|
|
3946
|
+
...props
|
|
3947
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.ScrollArea, { className: chunk525KS5HM_cjs.cn("-mb-1 mt-2", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-40 pr-4", children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children }) }) });
|
|
3948
|
+
var QueueSection = ({
|
|
3949
|
+
className,
|
|
3950
|
+
defaultOpen = true,
|
|
3951
|
+
...props
|
|
3952
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.Collapsible, { className: chunk525KS5HM_cjs.cn(className), defaultOpen, ...props });
|
|
3953
|
+
var QueueSectionTrigger = ({
|
|
3954
|
+
children,
|
|
3955
|
+
className,
|
|
3956
|
+
...props
|
|
3957
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3958
|
+
"button",
|
|
3959
|
+
{
|
|
3960
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3961
|
+
"group flex w-full items-center justify-between rounded-md bg-muted/40 px-3 py-2 text-start font-medium text-muted-foreground text-sm transition-colors hover:bg-muted",
|
|
3962
|
+
className
|
|
3963
|
+
),
|
|
3964
|
+
type: "button",
|
|
3965
|
+
...props,
|
|
3966
|
+
children
|
|
3967
|
+
}
|
|
3968
|
+
) });
|
|
3969
|
+
var QueueSectionLabel = ({
|
|
3970
|
+
count,
|
|
3971
|
+
label,
|
|
3972
|
+
icon,
|
|
3973
|
+
className,
|
|
3974
|
+
...props
|
|
3975
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: chunk525KS5HM_cjs.cn("flex items-center gap-2", className), ...props, children: [
|
|
3976
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "group-data-[state=closed]:-rotate-90 size-4 transition-transform" }),
|
|
3977
|
+
icon,
|
|
3978
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3979
|
+
count,
|
|
3980
|
+
" ",
|
|
3981
|
+
label
|
|
3982
|
+
] })
|
|
3983
|
+
] });
|
|
3984
|
+
var QueueSectionContent = ({
|
|
3985
|
+
className,
|
|
3986
|
+
...props
|
|
3987
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.CollapsibleContent, { className: chunk525KS5HM_cjs.cn(className), ...props });
|
|
3988
|
+
var Queue = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3989
|
+
"div",
|
|
3990
|
+
{
|
|
3991
|
+
className: chunk525KS5HM_cjs.cn(
|
|
3992
|
+
"flex flex-col gap-2 rounded-xl border border-border bg-background px-3 pt-2 pb-2 shadow-xs",
|
|
3993
|
+
className
|
|
3994
|
+
),
|
|
3995
|
+
...props
|
|
3996
|
+
}
|
|
3997
|
+
);
|
|
3998
|
+
var TaskItemFile = ({
|
|
3999
|
+
children,
|
|
4000
|
+
className,
|
|
4001
|
+
...props
|
|
4002
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4003
|
+
"div",
|
|
4004
|
+
{
|
|
4005
|
+
className: chunk525KS5HM_cjs.cn(
|
|
4006
|
+
"inline-flex items-center gap-1 rounded-md border bg-secondary px-1.5 py-0.5 text-foreground text-xs",
|
|
4007
|
+
className
|
|
4008
|
+
),
|
|
4009
|
+
...props,
|
|
4010
|
+
children
|
|
4011
|
+
}
|
|
4012
|
+
);
|
|
4013
|
+
var TaskItem = ({ children, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("text-muted-foreground text-sm", className), ...props, children });
|
|
4014
|
+
var Task = ({
|
|
4015
|
+
defaultOpen = true,
|
|
4016
|
+
className,
|
|
4017
|
+
...props
|
|
4018
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.Collapsible, { className: chunk525KS5HM_cjs.cn(className), defaultOpen, ...props });
|
|
4019
|
+
var TaskTrigger = ({
|
|
4020
|
+
children,
|
|
4021
|
+
className,
|
|
4022
|
+
title,
|
|
4023
|
+
...props
|
|
4024
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.CollapsibleTrigger, { asChild: true, className: chunk525KS5HM_cjs.cn("group", className), ...props, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full cursor-pointer items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground", children: [
|
|
4025
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "size-4" }),
|
|
4026
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: title }),
|
|
4027
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4 transition-transform group-data-[state=open]:rotate-180" })
|
|
4028
|
+
] }) });
|
|
4029
|
+
var TaskContent = ({
|
|
4030
|
+
children,
|
|
4031
|
+
className,
|
|
4032
|
+
...props
|
|
4033
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4034
|
+
chunkX5YEOOPK_cjs.CollapsibleContent,
|
|
4035
|
+
{
|
|
4036
|
+
className: chunk525KS5HM_cjs.cn(
|
|
4037
|
+
"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
4038
|
+
className
|
|
4039
|
+
),
|
|
4040
|
+
...props,
|
|
4041
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 space-y-2 border-muted border-l-2 pl-4", children })
|
|
4042
|
+
}
|
|
4043
|
+
);
|
|
4044
|
+
var Tool = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4045
|
+
chunkX5YEOOPK_cjs.Collapsible,
|
|
4046
|
+
{
|
|
4047
|
+
className: chunk525KS5HM_cjs.cn("not-prose mb-4 w-full rounded-md border", className),
|
|
4048
|
+
...props
|
|
4049
|
+
}
|
|
4050
|
+
);
|
|
4051
|
+
var getStatusBadge = (status) => {
|
|
4052
|
+
const labels = {
|
|
4053
|
+
"input-streaming": "Pending",
|
|
4054
|
+
"input-available": "Running",
|
|
4055
|
+
"approval-requested": "Awaiting Approval",
|
|
4056
|
+
"approval-responded": "Responded",
|
|
4057
|
+
"output-available": "Completed",
|
|
4058
|
+
"output-error": "Error",
|
|
4059
|
+
"output-denied": "Denied"
|
|
4060
|
+
};
|
|
4061
|
+
const icons = {
|
|
4062
|
+
"input-streaming": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleIcon, { className: "size-4" }),
|
|
4063
|
+
"input-available": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ClockIcon, { className: "size-4 animate-pulse" }),
|
|
4064
|
+
"approval-requested": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ClockIcon, { className: "size-4 text-yellow-600" }),
|
|
4065
|
+
"approval-responded": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircleIcon, { className: "size-4 text-blue-600" }),
|
|
4066
|
+
"output-available": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircleIcon, { className: "size-4 text-green-600" }),
|
|
4067
|
+
"output-error": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircleIcon, { className: "size-4 text-red-600" }),
|
|
4068
|
+
"output-denied": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircleIcon, { className: "size-4 text-orange-600" })
|
|
4069
|
+
};
|
|
4070
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(chunkX5YEOOPK_cjs.Badge, { className: "gap-1.5 rounded-full text-xs", variant: "secondary", children: [
|
|
4071
|
+
icons[status],
|
|
4072
|
+
labels[status]
|
|
4073
|
+
] });
|
|
4074
|
+
};
|
|
4075
|
+
var ToolHeader = ({
|
|
4076
|
+
className,
|
|
4077
|
+
title,
|
|
4078
|
+
type,
|
|
4079
|
+
state,
|
|
4080
|
+
...props
|
|
4081
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4082
|
+
chunkX5YEOOPK_cjs.CollapsibleTrigger,
|
|
4083
|
+
{
|
|
4084
|
+
className: chunk525KS5HM_cjs.cn(
|
|
4085
|
+
"flex w-full items-center justify-between gap-4 p-3",
|
|
4086
|
+
className
|
|
4087
|
+
),
|
|
4088
|
+
...props,
|
|
4089
|
+
children: [
|
|
4090
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4091
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.WrenchIcon, { className: "size-4 text-muted-foreground" }),
|
|
4092
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-sm", children: title ?? type.split("-").slice(1).join("-") }),
|
|
4093
|
+
getStatusBadge(state)
|
|
4094
|
+
] }),
|
|
4095
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })
|
|
4096
|
+
]
|
|
4097
|
+
}
|
|
4098
|
+
);
|
|
4099
|
+
var ToolContent = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4100
|
+
chunkX5YEOOPK_cjs.CollapsibleContent,
|
|
4101
|
+
{
|
|
4102
|
+
className: chunk525KS5HM_cjs.cn(
|
|
4103
|
+
"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
4104
|
+
className
|
|
4105
|
+
),
|
|
4106
|
+
...props
|
|
4107
|
+
}
|
|
4108
|
+
);
|
|
4109
|
+
var ToolInput = ({ className, input, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunk525KS5HM_cjs.cn("space-y-2 overflow-hidden p-4", className), ...props, children: [
|
|
4110
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wide", children: "Parameters" }),
|
|
4111
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md bg-muted/50", children: /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { code: JSON.stringify(input, null, 2), language: "json" }) })
|
|
4112
|
+
] });
|
|
4113
|
+
var ToolOutput = ({
|
|
4114
|
+
className,
|
|
4115
|
+
output,
|
|
4116
|
+
errorText,
|
|
4117
|
+
...props
|
|
4118
|
+
}) => {
|
|
4119
|
+
if (!(output || errorText)) {
|
|
4120
|
+
return null;
|
|
4121
|
+
}
|
|
4122
|
+
let Output = /* @__PURE__ */ jsxRuntime.jsx("div", { children: output });
|
|
4123
|
+
if (typeof output === "object" && !React2.isValidElement(output)) {
|
|
4124
|
+
Output = /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { code: JSON.stringify(output, null, 2), language: "json" });
|
|
4125
|
+
} else if (typeof output === "string") {
|
|
4126
|
+
Output = /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { code: output, language: "json" });
|
|
4127
|
+
}
|
|
4128
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunk525KS5HM_cjs.cn("space-y-2 p-4", className), ...props, children: [
|
|
4129
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wide", children: errorText ? "Error" : "Result" }),
|
|
4130
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4131
|
+
"div",
|
|
4132
|
+
{
|
|
4133
|
+
className: chunk525KS5HM_cjs.cn(
|
|
4134
|
+
"overflow-x-auto rounded-md text-xs [&_table]:w-full",
|
|
4135
|
+
errorText ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground"
|
|
4136
|
+
),
|
|
4137
|
+
children: [
|
|
4138
|
+
errorText && /* @__PURE__ */ jsxRuntime.jsx("div", { children: errorText }),
|
|
4139
|
+
Output
|
|
4140
|
+
]
|
|
4141
|
+
}
|
|
4142
|
+
)
|
|
4143
|
+
] });
|
|
4144
|
+
};
|
|
4145
|
+
var Toolbar = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4146
|
+
react$1.NodeToolbar,
|
|
4147
|
+
{
|
|
4148
|
+
className: chunk525KS5HM_cjs.cn(
|
|
4149
|
+
"flex items-center gap-1 rounded-sm border bg-background p-1.5",
|
|
4150
|
+
className
|
|
4151
|
+
),
|
|
4152
|
+
position: react$1.Position.Bottom,
|
|
4153
|
+
...props
|
|
4154
|
+
}
|
|
4155
|
+
);
|
|
4156
|
+
var Canvas = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4157
|
+
react$1.ReactFlow,
|
|
4158
|
+
{
|
|
4159
|
+
deleteKeyCode: ["Backspace", "Delete"],
|
|
4160
|
+
fitView: true,
|
|
4161
|
+
panOnDrag: false,
|
|
4162
|
+
panOnScroll: true,
|
|
4163
|
+
selectionOnDrag: true,
|
|
4164
|
+
zoomOnDoubleClick: false,
|
|
4165
|
+
...props,
|
|
4166
|
+
children: [
|
|
4167
|
+
/* @__PURE__ */ jsxRuntime.jsx(react$1.Background, { bgColor: "var(--ac-sidebar)" }),
|
|
4168
|
+
children
|
|
4169
|
+
]
|
|
4170
|
+
}
|
|
4171
|
+
);
|
|
4172
|
+
var Checkpoint = ({
|
|
4173
|
+
className,
|
|
4174
|
+
children,
|
|
4175
|
+
...props
|
|
4176
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4177
|
+
"div",
|
|
4178
|
+
{
|
|
4179
|
+
className: chunk525KS5HM_cjs.cn("flex items-center gap-0.5 text-muted-foreground overflow-hidden", className),
|
|
4180
|
+
...props,
|
|
4181
|
+
children: [
|
|
4182
|
+
children,
|
|
4183
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.Separator, {})
|
|
4184
|
+
]
|
|
4185
|
+
}
|
|
4186
|
+
);
|
|
4187
|
+
var CheckpointIcon = ({
|
|
4188
|
+
className,
|
|
4189
|
+
children,
|
|
4190
|
+
...props
|
|
4191
|
+
}) => children ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BookmarkIcon, { className: chunk525KS5HM_cjs.cn("size-4 shrink-0", className), ...props });
|
|
4192
|
+
var CheckpointTrigger = ({
|
|
4193
|
+
children,
|
|
4194
|
+
className,
|
|
4195
|
+
variant = "ghost",
|
|
4196
|
+
size = "sm",
|
|
4197
|
+
tooltip,
|
|
4198
|
+
...props
|
|
4199
|
+
}) => tooltip ? /* @__PURE__ */ jsxRuntime.jsxs(chunkX5YEOOPK_cjs.Tooltip, { children: [
|
|
4200
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(chunkWZLWAVSS_cjs.Button, { size, type: "button", variant, ...props, children }) }),
|
|
4201
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkX5YEOOPK_cjs.TooltipContent, { align: "start", side: "bottom", children: tooltip })
|
|
4202
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(chunkWZLWAVSS_cjs.Button, { size, type: "button", variant, ...props, children });
|
|
4203
|
+
var HALF = 0.5;
|
|
4204
|
+
var Connection = ({
|
|
4205
|
+
fromX,
|
|
4206
|
+
fromY,
|
|
4207
|
+
toX,
|
|
4208
|
+
toY
|
|
4209
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
4210
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4211
|
+
"path",
|
|
4212
|
+
{
|
|
4213
|
+
className: "animated",
|
|
4214
|
+
d: `M${fromX},${fromY} C ${fromX + (toX - fromX) * HALF},${fromY} ${fromX + (toX - fromX) * HALF},${toY} ${toX},${toY}`,
|
|
4215
|
+
fill: "none",
|
|
4216
|
+
stroke: "var(--ac-ring)",
|
|
4217
|
+
strokeWidth: 1
|
|
4218
|
+
}
|
|
4219
|
+
),
|
|
4220
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4221
|
+
"circle",
|
|
4222
|
+
{
|
|
4223
|
+
cx: toX,
|
|
4224
|
+
cy: toY,
|
|
4225
|
+
fill: "#fff",
|
|
4226
|
+
r: 3,
|
|
4227
|
+
stroke: "var(--ac-ring)",
|
|
4228
|
+
strokeWidth: 1
|
|
4229
|
+
}
|
|
4230
|
+
)
|
|
4231
|
+
] });
|
|
4232
|
+
var Temporary = ({
|
|
4233
|
+
id,
|
|
4234
|
+
sourceX,
|
|
4235
|
+
sourceY,
|
|
4236
|
+
targetX,
|
|
4237
|
+
targetY,
|
|
4238
|
+
sourcePosition,
|
|
4239
|
+
targetPosition
|
|
4240
|
+
}) => {
|
|
4241
|
+
const [edgePath] = react$1.getSimpleBezierPath({
|
|
4242
|
+
sourceX,
|
|
4243
|
+
sourceY,
|
|
4244
|
+
sourcePosition,
|
|
4245
|
+
targetX,
|
|
4246
|
+
targetY,
|
|
4247
|
+
targetPosition
|
|
4248
|
+
});
|
|
4249
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4250
|
+
react$1.BaseEdge,
|
|
4251
|
+
{
|
|
4252
|
+
className: "stroke-1 stroke-ring",
|
|
4253
|
+
id,
|
|
4254
|
+
path: edgePath,
|
|
4255
|
+
style: {
|
|
4256
|
+
strokeDasharray: "5, 5"
|
|
4257
|
+
}
|
|
4258
|
+
}
|
|
4259
|
+
);
|
|
4260
|
+
};
|
|
4261
|
+
var getHandleCoordsByPosition = (node, handlePosition) => {
|
|
4262
|
+
const handleType = handlePosition === react$1.Position.Left ? "target" : "source";
|
|
4263
|
+
const handle = node.internals.handleBounds?.[handleType]?.find(
|
|
4264
|
+
(h) => h.position === handlePosition
|
|
4265
|
+
);
|
|
4266
|
+
if (!handle) {
|
|
4267
|
+
return [0, 0];
|
|
4268
|
+
}
|
|
4269
|
+
let offsetX = handle.width / 2;
|
|
4270
|
+
let offsetY = handle.height / 2;
|
|
4271
|
+
switch (handlePosition) {
|
|
4272
|
+
case react$1.Position.Left:
|
|
4273
|
+
offsetX = 0;
|
|
4274
|
+
break;
|
|
4275
|
+
case react$1.Position.Right:
|
|
4276
|
+
offsetX = handle.width;
|
|
4277
|
+
break;
|
|
4278
|
+
case react$1.Position.Top:
|
|
4279
|
+
offsetY = 0;
|
|
4280
|
+
break;
|
|
4281
|
+
case react$1.Position.Bottom:
|
|
4282
|
+
offsetY = handle.height;
|
|
4283
|
+
break;
|
|
4284
|
+
default:
|
|
4285
|
+
throw new Error(`Invalid handle position: ${handlePosition}`);
|
|
4286
|
+
}
|
|
4287
|
+
const x = node.internals.positionAbsolute.x + handle.x + offsetX;
|
|
4288
|
+
const y = node.internals.positionAbsolute.y + handle.y + offsetY;
|
|
4289
|
+
return [x, y];
|
|
4290
|
+
};
|
|
4291
|
+
var getEdgeParams = (source, target) => {
|
|
4292
|
+
const sourcePos = react$1.Position.Right;
|
|
4293
|
+
const [sx, sy] = getHandleCoordsByPosition(source, sourcePos);
|
|
4294
|
+
const targetPos = react$1.Position.Left;
|
|
4295
|
+
const [tx, ty] = getHandleCoordsByPosition(target, targetPos);
|
|
4296
|
+
return {
|
|
4297
|
+
sx,
|
|
4298
|
+
sy,
|
|
4299
|
+
tx,
|
|
4300
|
+
ty,
|
|
4301
|
+
sourcePos,
|
|
4302
|
+
targetPos
|
|
4303
|
+
};
|
|
4304
|
+
};
|
|
4305
|
+
var Animated = ({ id, source, target, markerEnd, style }) => {
|
|
4306
|
+
const sourceNode = react$1.useInternalNode(source);
|
|
4307
|
+
const targetNode = react$1.useInternalNode(target);
|
|
4308
|
+
if (!(sourceNode && targetNode)) {
|
|
4309
|
+
return null;
|
|
4310
|
+
}
|
|
4311
|
+
const { sx, sy, tx, ty, sourcePos, targetPos } = getEdgeParams(
|
|
4312
|
+
sourceNode,
|
|
4313
|
+
targetNode
|
|
4314
|
+
);
|
|
4315
|
+
const [edgePath] = react$1.getBezierPath({
|
|
4316
|
+
sourceX: sx,
|
|
4317
|
+
sourceY: sy,
|
|
4318
|
+
sourcePosition: sourcePos,
|
|
4319
|
+
targetX: tx,
|
|
4320
|
+
targetY: ty,
|
|
4321
|
+
targetPosition: targetPos
|
|
4322
|
+
});
|
|
4323
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4324
|
+
/* @__PURE__ */ jsxRuntime.jsx(react$1.BaseEdge, { id, markerEnd, path: edgePath, style }),
|
|
4325
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { fill: "var(--ac-primary)", r: "4", children: /* @__PURE__ */ jsxRuntime.jsx("animateMotion", { dur: "2s", path: edgePath, repeatCount: "indefinite" }) })
|
|
4326
|
+
] });
|
|
4327
|
+
};
|
|
4328
|
+
var Edge = {
|
|
4329
|
+
Temporary,
|
|
4330
|
+
Animated
|
|
4331
|
+
};
|
|
4332
|
+
var Node = ({ handles, className, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4333
|
+
chunkAWAJOSFP_cjs.Card,
|
|
4334
|
+
{
|
|
4335
|
+
className: chunk525KS5HM_cjs.cn(
|
|
4336
|
+
"node-container relative size-full h-auto w-sm gap-0 rounded-md p-0",
|
|
4337
|
+
className
|
|
4338
|
+
),
|
|
4339
|
+
...props,
|
|
4340
|
+
children: [
|
|
4341
|
+
handles.target && /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { position: react$1.Position.Left, type: "target" }),
|
|
4342
|
+
handles.source && /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { position: react$1.Position.Right, type: "source" }),
|
|
4343
|
+
props.children
|
|
4344
|
+
]
|
|
4345
|
+
}
|
|
4346
|
+
);
|
|
4347
|
+
var NodeHeader = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4348
|
+
chunkAWAJOSFP_cjs.CardHeader,
|
|
4349
|
+
{
|
|
4350
|
+
className: chunk525KS5HM_cjs.cn("gap-0.5 rounded-t-md border-b bg-secondary p-3!", className),
|
|
4351
|
+
...props
|
|
4352
|
+
}
|
|
4353
|
+
);
|
|
4354
|
+
var NodeTitle = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkAWAJOSFP_cjs.CardTitle, { ...props });
|
|
4355
|
+
var NodeDescription = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkAWAJOSFP_cjs.CardDescription, { ...props });
|
|
4356
|
+
var NodeAction = (props) => /* @__PURE__ */ jsxRuntime.jsx(chunkAWAJOSFP_cjs.CardAction, { ...props });
|
|
4357
|
+
var NodeContent = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(chunkAWAJOSFP_cjs.CardContent, { className: chunk525KS5HM_cjs.cn("p-3", className), ...props });
|
|
4358
|
+
var NodeFooter = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4359
|
+
chunkAWAJOSFP_cjs.CardFooter,
|
|
4360
|
+
{
|
|
4361
|
+
className: chunk525KS5HM_cjs.cn("rounded-b-md border-t bg-secondary p-3!", className),
|
|
4362
|
+
...props
|
|
4363
|
+
}
|
|
4364
|
+
);
|
|
4365
|
+
var Image = ({
|
|
4366
|
+
base64,
|
|
4367
|
+
uint8Array,
|
|
4368
|
+
mediaType,
|
|
4369
|
+
...props
|
|
4370
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4371
|
+
"img",
|
|
4372
|
+
{
|
|
4373
|
+
...props,
|
|
4374
|
+
alt: props.alt,
|
|
4375
|
+
className: chunk525KS5HM_cjs.cn(
|
|
4376
|
+
"h-auto max-w-full overflow-hidden rounded-md",
|
|
4377
|
+
props.className
|
|
4378
|
+
),
|
|
4379
|
+
src: `data:${mediaType};base64,${base64}`
|
|
4380
|
+
}
|
|
4381
|
+
);
|
|
4382
|
+
|
|
4383
|
+
Object.defineProperty(exports, "Conversation", {
|
|
4384
|
+
enumerable: true,
|
|
4385
|
+
get: function () { return chunkFQN6OBGN_cjs.Conversation; }
|
|
4386
|
+
});
|
|
4387
|
+
Object.defineProperty(exports, "ConversationContent", {
|
|
4388
|
+
enumerable: true,
|
|
4389
|
+
get: function () { return chunkFQN6OBGN_cjs.ConversationContent; }
|
|
4390
|
+
});
|
|
4391
|
+
Object.defineProperty(exports, "ConversationEmptyState", {
|
|
4392
|
+
enumerable: true,
|
|
4393
|
+
get: function () { return chunkFQN6OBGN_cjs.ConversationEmptyState; }
|
|
4394
|
+
});
|
|
4395
|
+
Object.defineProperty(exports, "ConversationScrollButton", {
|
|
4396
|
+
enumerable: true,
|
|
4397
|
+
get: function () { return chunkFQN6OBGN_cjs.ConversationScrollButton; }
|
|
4398
|
+
});
|
|
4399
|
+
Object.defineProperty(exports, "Loader", {
|
|
4400
|
+
enumerable: true,
|
|
4401
|
+
get: function () { return chunkFQN6OBGN_cjs.Loader; }
|
|
4402
|
+
});
|
|
4403
|
+
Object.defineProperty(exports, "SpinnerLoader", {
|
|
4404
|
+
enumerable: true,
|
|
4405
|
+
get: function () { return chunkFQN6OBGN_cjs.SpinnerLoader; }
|
|
4406
|
+
});
|
|
4407
|
+
exports.AIImage = Image;
|
|
4408
|
+
exports.Artifact = Artifact;
|
|
4409
|
+
exports.ArtifactAction = ArtifactAction;
|
|
4410
|
+
exports.ArtifactActions = ArtifactActions;
|
|
4411
|
+
exports.ArtifactClose = ArtifactClose;
|
|
4412
|
+
exports.ArtifactContent = ArtifactContent;
|
|
4413
|
+
exports.ArtifactDescription = ArtifactDescription;
|
|
4414
|
+
exports.ArtifactHeader = ArtifactHeader;
|
|
4415
|
+
exports.ArtifactTitle = ArtifactTitle;
|
|
4416
|
+
exports.Canvas = Canvas;
|
|
4417
|
+
exports.ChainOfThought = ChainOfThought;
|
|
4418
|
+
exports.ChainOfThoughtContent = ChainOfThoughtContent;
|
|
4419
|
+
exports.ChainOfThoughtHeader = ChainOfThoughtHeader;
|
|
4420
|
+
exports.ChainOfThoughtImage = ChainOfThoughtImage;
|
|
4421
|
+
exports.ChainOfThoughtSearchResult = ChainOfThoughtSearchResult;
|
|
4422
|
+
exports.ChainOfThoughtSearchResults = ChainOfThoughtSearchResults;
|
|
4423
|
+
exports.ChainOfThoughtStep = ChainOfThoughtStep;
|
|
4424
|
+
exports.Checkpoint = Checkpoint;
|
|
4425
|
+
exports.CheckpointIcon = CheckpointIcon;
|
|
4426
|
+
exports.CheckpointTrigger = CheckpointTrigger;
|
|
4427
|
+
exports.CodeBlock = CodeBlock;
|
|
4428
|
+
exports.CodeBlockCopyButton = CodeBlockCopyButton;
|
|
4429
|
+
exports.ComponentRenderer = ComponentRenderer;
|
|
4430
|
+
exports.Confirmation = Confirmation;
|
|
4431
|
+
exports.ConfirmationAccepted = ConfirmationAccepted;
|
|
4432
|
+
exports.ConfirmationAction = ConfirmationAction;
|
|
4433
|
+
exports.ConfirmationActions = ConfirmationActions;
|
|
4434
|
+
exports.ConfirmationRejected = ConfirmationRejected;
|
|
4435
|
+
exports.ConfirmationRequest = ConfirmationRequest;
|
|
4436
|
+
exports.ConfirmationTitle = ConfirmationTitle;
|
|
4437
|
+
exports.Connection = Connection;
|
|
4438
|
+
exports.Context = Context;
|
|
4439
|
+
exports.ContextCacheUsage = ContextCacheUsage;
|
|
4440
|
+
exports.ContextContent = ContextContent;
|
|
4441
|
+
exports.ContextContentBody = ContextContentBody;
|
|
4442
|
+
exports.ContextContentFooter = ContextContentFooter;
|
|
4443
|
+
exports.ContextContentHeader = ContextContentHeader;
|
|
4444
|
+
exports.ContextInputUsage = ContextInputUsage;
|
|
4445
|
+
exports.ContextOutputUsage = ContextOutputUsage;
|
|
4446
|
+
exports.ContextReasoningUsage = ContextReasoningUsage;
|
|
4447
|
+
exports.ContextTrigger = ContextTrigger;
|
|
4448
|
+
exports.Controls = Controls;
|
|
4449
|
+
exports.Edge = Edge;
|
|
4450
|
+
exports.FollowupButtons = FollowupButtons;
|
|
4451
|
+
exports.InlineCitation = InlineCitation;
|
|
4452
|
+
exports.InlineCitationCard = InlineCitationCard;
|
|
4453
|
+
exports.InlineCitationCardBody = InlineCitationCardBody;
|
|
4454
|
+
exports.InlineCitationCardTrigger = InlineCitationCardTrigger;
|
|
4455
|
+
exports.InlineCitationCarousel = InlineCitationCarousel;
|
|
4456
|
+
exports.InlineCitationCarouselContent = InlineCitationCarouselContent;
|
|
4457
|
+
exports.InlineCitationCarouselHeader = InlineCitationCarouselHeader;
|
|
4458
|
+
exports.InlineCitationCarouselIndex = InlineCitationCarouselIndex;
|
|
4459
|
+
exports.InlineCitationCarouselItem = InlineCitationCarouselItem;
|
|
4460
|
+
exports.InlineCitationCarouselNext = InlineCitationCarouselNext;
|
|
4461
|
+
exports.InlineCitationCarouselPrev = InlineCitationCarouselPrev;
|
|
4462
|
+
exports.InlineCitationQuote = InlineCitationQuote;
|
|
4463
|
+
exports.InlineCitationSource = InlineCitationSource;
|
|
4464
|
+
exports.InlineCitationText = InlineCitationText;
|
|
4465
|
+
exports.Message = Message;
|
|
4466
|
+
exports.MessageAction = MessageAction;
|
|
4467
|
+
exports.MessageActions = MessageActions;
|
|
4468
|
+
exports.MessageAttachment = MessageAttachment;
|
|
4469
|
+
exports.MessageAttachments = MessageAttachments;
|
|
4470
|
+
exports.MessageBranch = MessageBranch;
|
|
4471
|
+
exports.MessageBranchContent = MessageBranchContent;
|
|
4472
|
+
exports.MessageBranchNext = MessageBranchNext;
|
|
4473
|
+
exports.MessageBranchPage = MessageBranchPage;
|
|
4474
|
+
exports.MessageBranchPrevious = MessageBranchPrevious;
|
|
4475
|
+
exports.MessageBranchSelector = MessageBranchSelector;
|
|
4476
|
+
exports.MessageContent = MessageContent;
|
|
4477
|
+
exports.MessageFeedback = MessageFeedback;
|
|
4478
|
+
exports.MessageResponse = MessageResponse;
|
|
4479
|
+
exports.MessageToolbar = MessageToolbar;
|
|
4480
|
+
exports.ModelSelector = ModelSelector;
|
|
4481
|
+
exports.ModelSelectorContent = ModelSelectorContent;
|
|
4482
|
+
exports.ModelSelectorDialog = ModelSelectorDialog;
|
|
4483
|
+
exports.ModelSelectorEmpty = ModelSelectorEmpty;
|
|
4484
|
+
exports.ModelSelectorGroup = ModelSelectorGroup;
|
|
4485
|
+
exports.ModelSelectorInput = ModelSelectorInput;
|
|
4486
|
+
exports.ModelSelectorItem = ModelSelectorItem;
|
|
4487
|
+
exports.ModelSelectorList = ModelSelectorList;
|
|
4488
|
+
exports.ModelSelectorLogo = ModelSelectorLogo;
|
|
4489
|
+
exports.ModelSelectorLogoGroup = ModelSelectorLogoGroup;
|
|
4490
|
+
exports.ModelSelectorName = ModelSelectorName;
|
|
4491
|
+
exports.ModelSelectorSeparator = ModelSelectorSeparator;
|
|
4492
|
+
exports.ModelSelectorShortcut = ModelSelectorShortcut;
|
|
4493
|
+
exports.ModelSelectorTrigger = ModelSelectorTrigger;
|
|
4494
|
+
exports.Node = Node;
|
|
4495
|
+
exports.NodeAction = NodeAction;
|
|
4496
|
+
exports.NodeContent = NodeContent;
|
|
4497
|
+
exports.NodeDescription = NodeDescription;
|
|
4498
|
+
exports.NodeFooter = NodeFooter;
|
|
4499
|
+
exports.NodeHeader = NodeHeader;
|
|
4500
|
+
exports.NodeTitle = NodeTitle;
|
|
4501
|
+
exports.OpenIn = OpenIn;
|
|
4502
|
+
exports.OpenInChatGPT = OpenInChatGPT;
|
|
4503
|
+
exports.OpenInClaude = OpenInClaude;
|
|
4504
|
+
exports.OpenInContent = OpenInContent;
|
|
4505
|
+
exports.OpenInCursor = OpenInCursor;
|
|
4506
|
+
exports.OpenInItem = OpenInItem;
|
|
4507
|
+
exports.OpenInLabel = OpenInLabel;
|
|
4508
|
+
exports.OpenInScira = OpenInScira;
|
|
4509
|
+
exports.OpenInSeparator = OpenInSeparator;
|
|
4510
|
+
exports.OpenInT3 = OpenInT3;
|
|
4511
|
+
exports.OpenInTrigger = OpenInTrigger;
|
|
4512
|
+
exports.OpenInv0 = OpenInv0;
|
|
4513
|
+
exports.Panel = Panel;
|
|
4514
|
+
exports.Plan = Plan;
|
|
4515
|
+
exports.PlanAction = PlanAction;
|
|
4516
|
+
exports.PlanContent = PlanContent;
|
|
4517
|
+
exports.PlanDescription = PlanDescription;
|
|
4518
|
+
exports.PlanFooter = PlanFooter;
|
|
4519
|
+
exports.PlanHeader = PlanHeader;
|
|
4520
|
+
exports.PlanTitle = PlanTitle;
|
|
4521
|
+
exports.PlanTrigger = PlanTrigger;
|
|
4522
|
+
exports.PromptInput = PromptInput;
|
|
4523
|
+
exports.PromptInputActionAddAttachments = PromptInputActionAddAttachments;
|
|
4524
|
+
exports.PromptInputActionMenu = PromptInputActionMenu;
|
|
4525
|
+
exports.PromptInputActionMenuContent = PromptInputActionMenuContent;
|
|
4526
|
+
exports.PromptInputActionMenuItem = PromptInputActionMenuItem;
|
|
4527
|
+
exports.PromptInputActionMenuTrigger = PromptInputActionMenuTrigger;
|
|
4528
|
+
exports.PromptInputAttachment = PromptInputAttachment;
|
|
4529
|
+
exports.PromptInputAttachments = PromptInputAttachments;
|
|
4530
|
+
exports.PromptInputBody = PromptInputBody;
|
|
4531
|
+
exports.PromptInputButton = PromptInputButton;
|
|
4532
|
+
exports.PromptInputCommand = PromptInputCommand;
|
|
4533
|
+
exports.PromptInputCommandEmpty = PromptInputCommandEmpty;
|
|
4534
|
+
exports.PromptInputCommandGroup = PromptInputCommandGroup;
|
|
4535
|
+
exports.PromptInputCommandInput = PromptInputCommandInput;
|
|
4536
|
+
exports.PromptInputCommandItem = PromptInputCommandItem;
|
|
4537
|
+
exports.PromptInputCommandList = PromptInputCommandList;
|
|
4538
|
+
exports.PromptInputCommandSeparator = PromptInputCommandSeparator;
|
|
4539
|
+
exports.PromptInputFooter = PromptInputFooter;
|
|
4540
|
+
exports.PromptInputHeader = PromptInputHeader;
|
|
4541
|
+
exports.PromptInputHoverCard = PromptInputHoverCard;
|
|
4542
|
+
exports.PromptInputHoverCardContent = PromptInputHoverCardContent;
|
|
4543
|
+
exports.PromptInputHoverCardTrigger = PromptInputHoverCardTrigger;
|
|
4544
|
+
exports.PromptInputProvider = PromptInputProvider;
|
|
4545
|
+
exports.PromptInputSelect = PromptInputSelect;
|
|
4546
|
+
exports.PromptInputSelectContent = PromptInputSelectContent;
|
|
4547
|
+
exports.PromptInputSelectItem = PromptInputSelectItem;
|
|
4548
|
+
exports.PromptInputSelectTrigger = PromptInputSelectTrigger;
|
|
4549
|
+
exports.PromptInputSelectValue = PromptInputSelectValue;
|
|
4550
|
+
exports.PromptInputSpeechButton = PromptInputSpeechButton;
|
|
4551
|
+
exports.PromptInputSubmit = PromptInputSubmit;
|
|
4552
|
+
exports.PromptInputTab = PromptInputTab;
|
|
4553
|
+
exports.PromptInputTabBody = PromptInputTabBody;
|
|
4554
|
+
exports.PromptInputTabItem = PromptInputTabItem;
|
|
4555
|
+
exports.PromptInputTabLabel = PromptInputTabLabel;
|
|
4556
|
+
exports.PromptInputTabsList = PromptInputTabsList;
|
|
4557
|
+
exports.PromptInputTextarea = PromptInputTextarea;
|
|
4558
|
+
exports.PromptInputTools = PromptInputTools;
|
|
4559
|
+
exports.Queue = Queue;
|
|
4560
|
+
exports.QueueItem = QueueItem;
|
|
4561
|
+
exports.QueueItemAction = QueueItemAction;
|
|
4562
|
+
exports.QueueItemActions = QueueItemActions;
|
|
4563
|
+
exports.QueueItemAttachment = QueueItemAttachment;
|
|
4564
|
+
exports.QueueItemContent = QueueItemContent;
|
|
4565
|
+
exports.QueueItemDescription = QueueItemDescription;
|
|
4566
|
+
exports.QueueItemFile = QueueItemFile;
|
|
4567
|
+
exports.QueueItemImage = QueueItemImage;
|
|
4568
|
+
exports.QueueItemIndicator = QueueItemIndicator;
|
|
4569
|
+
exports.QueueList = QueueList;
|
|
4570
|
+
exports.QueueSection = QueueSection;
|
|
4571
|
+
exports.QueueSectionContent = QueueSectionContent;
|
|
4572
|
+
exports.QueueSectionLabel = QueueSectionLabel;
|
|
4573
|
+
exports.QueueSectionTrigger = QueueSectionTrigger;
|
|
4574
|
+
exports.Reasoning = Reasoning;
|
|
4575
|
+
exports.ReasoningContent = ReasoningContent;
|
|
4576
|
+
exports.ReasoningTrigger = ReasoningTrigger;
|
|
4577
|
+
exports.Shimmer = Shimmer;
|
|
4578
|
+
exports.Source = Source;
|
|
4579
|
+
exports.Sources = Sources;
|
|
4580
|
+
exports.SourcesContent = SourcesContent;
|
|
4581
|
+
exports.SourcesTrigger = SourcesTrigger;
|
|
4582
|
+
exports.Suggestion = Suggestion;
|
|
4583
|
+
exports.Suggestions = Suggestions;
|
|
4584
|
+
exports.Task = Task;
|
|
4585
|
+
exports.TaskContent = TaskContent;
|
|
4586
|
+
exports.TaskItem = TaskItem;
|
|
4587
|
+
exports.TaskItemFile = TaskItemFile;
|
|
4588
|
+
exports.TaskTrigger = TaskTrigger;
|
|
4589
|
+
exports.ThinkingSpinner = ThinkingSpinner;
|
|
4590
|
+
exports.Tool = Tool;
|
|
4591
|
+
exports.ToolContent = ToolContent;
|
|
4592
|
+
exports.ToolHeader = ToolHeader;
|
|
4593
|
+
exports.ToolInput = ToolInput;
|
|
4594
|
+
exports.ToolOutput = ToolOutput;
|
|
4595
|
+
exports.Toolbar = Toolbar;
|
|
4596
|
+
exports.WebPreview = WebPreview;
|
|
4597
|
+
exports.WebPreviewBody = WebPreviewBody;
|
|
4598
|
+
exports.WebPreviewConsole = WebPreviewConsole;
|
|
4599
|
+
exports.WebPreviewNavigation = WebPreviewNavigation;
|
|
4600
|
+
exports.WebPreviewNavigationButton = WebPreviewNavigationButton;
|
|
4601
|
+
exports.WebPreviewUrl = WebPreviewUrl;
|
|
4602
|
+
exports.highlightCode = highlightCode;
|
|
4603
|
+
exports.usePromptInputAttachments = usePromptInputAttachments;
|
|
4604
|
+
exports.usePromptInputController = usePromptInputController;
|
|
4605
|
+
exports.useProviderAttachments = useProviderAttachments;
|
|
4606
|
+
exports.useReasoning = useReasoning;
|
|
4607
|
+
//# sourceMappingURL=ai-elements.cjs.map
|
|
4608
|
+
//# sourceMappingURL=ai-elements.cjs.map
|