@cogentic-co/ds 0.4.1
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 +139 -0
- package/dist/animations/animation-ai-analysis.d.ts +7 -0
- package/dist/animations/animation-ai-analysis.js +7 -0
- package/dist/animations/animation-ai-analysis.js.map +1 -0
- package/dist/animations/animation-audit-trail.d.ts +7 -0
- package/dist/animations/animation-audit-trail.js +5 -0
- package/dist/animations/animation-audit-trail.js.map +1 -0
- package/dist/animations/animation-compliance-reports.d.ts +7 -0
- package/dist/animations/animation-compliance-reports.js +7 -0
- package/dist/animations/animation-compliance-reports.js.map +1 -0
- package/dist/animations/animation-custom-rules.d.ts +7 -0
- package/dist/animations/animation-custom-rules.js +7 -0
- package/dist/animations/animation-custom-rules.js.map +1 -0
- package/dist/animations/animation-jira-ticket.d.ts +7 -0
- package/dist/animations/animation-jira-ticket.js +6 -0
- package/dist/animations/animation-jira-ticket.js.map +1 -0
- package/dist/animations/animation-jurisdiction-detection.d.ts +7 -0
- package/dist/animations/animation-jurisdiction-detection.js +7 -0
- package/dist/animations/animation-jurisdiction-detection.js.map +1 -0
- package/dist/animations/animation-multi-protocol.d.ts +7 -0
- package/dist/animations/animation-multi-protocol.js +5 -0
- package/dist/animations/animation-multi-protocol.js.map +1 -0
- package/dist/animations/animation-pricing-preview.d.ts +16 -0
- package/dist/animations/animation-pricing-preview.js +7 -0
- package/dist/animations/animation-pricing-preview.js.map +1 -0
- package/dist/animations/animation-realtime-updates.d.ts +7 -0
- package/dist/animations/animation-realtime-updates.js +8 -0
- package/dist/animations/animation-realtime-updates.js.map +1 -0
- package/dist/animations/animation-rest-api.d.ts +7 -0
- package/dist/animations/animation-rest-api.js +5 -0
- package/dist/animations/animation-rest-api.js.map +1 -0
- package/dist/animations/animation-risk-scoring.d.ts +7 -0
- package/dist/animations/animation-risk-scoring.js +8 -0
- package/dist/animations/animation-risk-scoring.js.map +1 -0
- package/dist/animations/animation-sandbox.d.ts +7 -0
- package/dist/animations/animation-sandbox.js +5 -0
- package/dist/animations/animation-sandbox.js.map +1 -0
- package/dist/animations/animation-scheduled-reports.d.ts +7 -0
- package/dist/animations/animation-scheduled-reports.js +7 -0
- package/dist/animations/animation-scheduled-reports.js.map +1 -0
- package/dist/animations/animation-secure-messaging.d.ts +7 -0
- package/dist/animations/animation-secure-messaging.js +6 -0
- package/dist/animations/animation-secure-messaging.js.map +1 -0
- package/dist/animations/animation-slack-notification.d.ts +7 -0
- package/dist/animations/animation-slack-notification.js +6 -0
- package/dist/animations/animation-slack-notification.js.map +1 -0
- package/dist/animations/animation-sop-mapping.d.ts +7 -0
- package/dist/animations/animation-sop-mapping.js +5 -0
- package/dist/animations/animation-sop-mapping.js.map +1 -0
- package/dist/animations/animation-team-routing.d.ts +7 -0
- package/dist/animations/animation-team-routing.js +7 -0
- package/dist/animations/animation-team-routing.js.map +1 -0
- package/dist/animations/animation-teams-notification.d.ts +7 -0
- package/dist/animations/animation-teams-notification.js +6 -0
- package/dist/animations/animation-teams-notification.js.map +1 -0
- package/dist/animations/animation-vasp-identification.d.ts +7 -0
- package/dist/animations/animation-vasp-identification.js +7 -0
- package/dist/animations/animation-vasp-identification.js.map +1 -0
- package/dist/animations/animation-webhooks.d.ts +7 -0
- package/dist/animations/animation-webhooks.js +6 -0
- package/dist/animations/animation-webhooks.js.map +1 -0
- package/dist/blocks/auth-form.d.ts +18 -0
- package/dist/blocks/auth-form.js +7 -0
- package/dist/blocks/auth-form.js.map +1 -0
- package/dist/blocks/feature-section.d.ts +17 -0
- package/dist/blocks/feature-section.js +5 -0
- package/dist/blocks/feature-section.js.map +1 -0
- package/dist/blocks/hero-section.d.ts +19 -0
- package/dist/blocks/hero-section.js +5 -0
- package/dist/blocks/hero-section.js.map +1 -0
- package/dist/blocks/pricing-table.d.ts +24 -0
- package/dist/blocks/pricing-table.js +6 -0
- package/dist/blocks/pricing-table.js.map +1 -0
- package/dist/blocks/stat-card.d.ts +15 -0
- package/dist/blocks/stat-card.js +6 -0
- package/dist/blocks/stat-card.js.map +1 -0
- package/dist/card-Cumdyf_G.d.ts +15 -0
- package/dist/charts.d.ts +4 -0
- package/dist/charts.js +5 -0
- package/dist/charts.js.map +1 -0
- package/dist/chatbot.d.ts +280 -0
- package/dist/chatbot.js +2202 -0
- package/dist/chatbot.js.map +1 -0
- package/dist/chunk-4NEQV6H2.js +39 -0
- package/dist/chunk-4NEQV6H2.js.map +1 -0
- package/dist/chunk-4YD3YS4B.js +110 -0
- package/dist/chunk-4YD3YS4B.js.map +1 -0
- package/dist/chunk-5JLZ42JT.js +125 -0
- package/dist/chunk-5JLZ42JT.js.map +1 -0
- package/dist/chunk-5OOO6TRA.js +111 -0
- package/dist/chunk-5OOO6TRA.js.map +1 -0
- package/dist/chunk-65Z2VEKG.js +161 -0
- package/dist/chunk-65Z2VEKG.js.map +1 -0
- package/dist/chunk-6RWCZUAD.js +12 -0
- package/dist/chunk-6RWCZUAD.js.map +1 -0
- package/dist/chunk-7HRPF2N2.js +56 -0
- package/dist/chunk-7HRPF2N2.js.map +1 -0
- package/dist/chunk-BNFSXNP2.js +71 -0
- package/dist/chunk-BNFSXNP2.js.map +1 -0
- package/dist/chunk-BTFYV3TI.js +102 -0
- package/dist/chunk-BTFYV3TI.js.map +1 -0
- package/dist/chunk-BTZB4JRC.js +117 -0
- package/dist/chunk-BTZB4JRC.js.map +1 -0
- package/dist/chunk-BZSA47MS.js +121 -0
- package/dist/chunk-BZSA47MS.js.map +1 -0
- package/dist/chunk-CG5JA7FM.js +107 -0
- package/dist/chunk-CG5JA7FM.js.map +1 -0
- package/dist/chunk-EFLWU2JP.js +145 -0
- package/dist/chunk-EFLWU2JP.js.map +1 -0
- package/dist/chunk-F7REPQOA.js +93 -0
- package/dist/chunk-F7REPQOA.js.map +1 -0
- package/dist/chunk-FKPK3CB7.js +143 -0
- package/dist/chunk-FKPK3CB7.js.map +1 -0
- package/dist/chunk-GZNLQE3I.js +55 -0
- package/dist/chunk-GZNLQE3I.js.map +1 -0
- package/dist/chunk-H7VUIMEL.js +172 -0
- package/dist/chunk-H7VUIMEL.js.map +1 -0
- package/dist/chunk-HTYR73ON.js +161 -0
- package/dist/chunk-HTYR73ON.js.map +1 -0
- package/dist/chunk-I26ZXVSY.js +124 -0
- package/dist/chunk-I26ZXVSY.js.map +1 -0
- package/dist/chunk-IKATDPHG.js +92 -0
- package/dist/chunk-IKATDPHG.js.map +1 -0
- package/dist/chunk-KUOF3XRZ.js +108 -0
- package/dist/chunk-KUOF3XRZ.js.map +1 -0
- package/dist/chunk-LW6GAWZM.js +148 -0
- package/dist/chunk-LW6GAWZM.js.map +1 -0
- package/dist/chunk-N7PBUY7G.js +110 -0
- package/dist/chunk-N7PBUY7G.js.map +1 -0
- package/dist/chunk-NAPDFVBI.js +102 -0
- package/dist/chunk-NAPDFVBI.js.map +1 -0
- package/dist/chunk-RTK7R4KZ.js +66 -0
- package/dist/chunk-RTK7R4KZ.js.map +1 -0
- package/dist/chunk-RXV2XUDZ.js +31 -0
- package/dist/chunk-RXV2XUDZ.js.map +1 -0
- package/dist/chunk-RZZTDJHG.js +110 -0
- package/dist/chunk-RZZTDJHG.js.map +1 -0
- package/dist/chunk-SNOJLZP4.js +197 -0
- package/dist/chunk-SNOJLZP4.js.map +1 -0
- package/dist/chunk-TAPJEVUA.js +24 -0
- package/dist/chunk-TAPJEVUA.js.map +1 -0
- package/dist/chunk-U4EPKN7G.js +518 -0
- package/dist/chunk-U4EPKN7G.js.map +1 -0
- package/dist/chunk-VWSX75RB.js +202 -0
- package/dist/chunk-VWSX75RB.js.map +1 -0
- package/dist/chunk-XFWKI45G.js +800 -0
- package/dist/chunk-XFWKI45G.js.map +1 -0
- package/dist/chunk-XQYFQ6PU.js +77 -0
- package/dist/chunk-XQYFQ6PU.js.map +1 -0
- package/dist/index-CcPuHWa-.d.ts +118 -0
- package/dist/index.d.ts +1385 -0
- package/dist/index.js +8673 -0
- package/dist/index.js.map +1 -0
- package/dist/workflow.d.ts +165 -0
- package/dist/workflow.js +5 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +157 -0
- package/src/styles/globals.css +211 -0
package/dist/chatbot.js
ADDED
|
@@ -0,0 +1,2202 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { __objRest, __spreadValues, cn, __spreadProps } from './chunk-GZNLQE3I.js';
|
|
3
|
+
import { File, FileAudio, FileVideo, FileImage, X, ChevronDown, Search, Bookmark, AlertTriangle, Check, Info, MessageSquare, ArrowDown, Download, ExternalLink, Copy, RefreshCw, ThumbsUp, ThumbsDown, ChevronLeft, ChevronRight, ListChecks, Paperclip, Square, ArrowUp, Circle, Loader2, Terminal } from 'lucide-react';
|
|
4
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
import { createContext, useState, useCallback, useId, useContext, useRef, useEffect, useMemo } from 'react';
|
|
6
|
+
import { cva } from 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
function Attachments(_a) {
|
|
9
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
10
|
+
return /* @__PURE__ */ jsx("div", __spreadValues({ "data-slot": "attachments", className: cn("flex flex-wrap gap-2", className) }, props));
|
|
11
|
+
}
|
|
12
|
+
var typeIcons = {
|
|
13
|
+
image: FileImage,
|
|
14
|
+
video: FileVideo,
|
|
15
|
+
audio: FileAudio,
|
|
16
|
+
file: File
|
|
17
|
+
};
|
|
18
|
+
function Attachment(_a) {
|
|
19
|
+
var _b = _a, {
|
|
20
|
+
name,
|
|
21
|
+
type = "file",
|
|
22
|
+
url,
|
|
23
|
+
onRemove,
|
|
24
|
+
className
|
|
25
|
+
} = _b, props = __objRest(_b, [
|
|
26
|
+
"name",
|
|
27
|
+
"type",
|
|
28
|
+
"url",
|
|
29
|
+
"onRemove",
|
|
30
|
+
"className"
|
|
31
|
+
]);
|
|
32
|
+
const Icon = typeIcons[type];
|
|
33
|
+
return /* @__PURE__ */ jsxs(
|
|
34
|
+
"div",
|
|
35
|
+
__spreadProps(__spreadValues({
|
|
36
|
+
"data-slot": "attachment",
|
|
37
|
+
className: cn(
|
|
38
|
+
"group/attachment relative flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2",
|
|
39
|
+
"text-sm transition-colors",
|
|
40
|
+
className
|
|
41
|
+
)
|
|
42
|
+
}, props), {
|
|
43
|
+
children: [
|
|
44
|
+
type === "image" && url ? /* @__PURE__ */ jsx("img", { src: url, alt: name, className: "size-8 rounded object-cover" }) : /* @__PURE__ */ jsx(Icon, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
45
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-foreground", children: name }),
|
|
46
|
+
onRemove && /* @__PURE__ */ jsx(
|
|
47
|
+
"button",
|
|
48
|
+
{
|
|
49
|
+
type: "button",
|
|
50
|
+
onClick: onRemove,
|
|
51
|
+
"aria-label": `Remove ${name}`,
|
|
52
|
+
className: "ml-1 shrink-0 rounded-full p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
53
|
+
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", className: "size-3" })
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
var ChainOfThoughtContext = createContext(null);
|
|
61
|
+
function ChainOfThought(_a) {
|
|
62
|
+
var _b = _a, {
|
|
63
|
+
defaultOpen = false,
|
|
64
|
+
className,
|
|
65
|
+
children
|
|
66
|
+
} = _b, props = __objRest(_b, [
|
|
67
|
+
"defaultOpen",
|
|
68
|
+
"className",
|
|
69
|
+
"children"
|
|
70
|
+
]);
|
|
71
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
72
|
+
const toggle = useCallback(() => setOpen((o) => !o), []);
|
|
73
|
+
const contentId = useId();
|
|
74
|
+
return /* @__PURE__ */ jsx(ChainOfThoughtContext.Provider, { value: { open, toggle, contentId }, children: /* @__PURE__ */ jsx(
|
|
75
|
+
"div",
|
|
76
|
+
__spreadProps(__spreadValues({
|
|
77
|
+
"data-slot": "chain-of-thought",
|
|
78
|
+
"data-state": open ? "open" : "closed",
|
|
79
|
+
className: cn("rounded-xl border border-border bg-card", className)
|
|
80
|
+
}, props), {
|
|
81
|
+
children
|
|
82
|
+
})
|
|
83
|
+
) });
|
|
84
|
+
}
|
|
85
|
+
function ChainOfThoughtHeader(_a) {
|
|
86
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
87
|
+
const ctx = useContext(ChainOfThoughtContext);
|
|
88
|
+
if (!ctx) throw new Error("ChainOfThoughtHeader must be used within <ChainOfThought>");
|
|
89
|
+
return /* @__PURE__ */ jsxs(
|
|
90
|
+
"button",
|
|
91
|
+
__spreadProps(__spreadValues({
|
|
92
|
+
"data-slot": "chain-of-thought-header",
|
|
93
|
+
type: "button",
|
|
94
|
+
onClick: ctx.toggle,
|
|
95
|
+
"aria-expanded": ctx.open,
|
|
96
|
+
"aria-controls": ctx.contentId,
|
|
97
|
+
className: cn(
|
|
98
|
+
"flex w-full items-center gap-2 px-4 py-3 font-medium text-sm",
|
|
99
|
+
"text-muted-foreground transition-colors hover:text-foreground",
|
|
100
|
+
className
|
|
101
|
+
)
|
|
102
|
+
}, props), {
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
ChevronDown,
|
|
106
|
+
{
|
|
107
|
+
"aria-hidden": "true",
|
|
108
|
+
className: cn(
|
|
109
|
+
"size-4 shrink-0 transition-transform duration-200",
|
|
110
|
+
ctx.open && "rotate-180"
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
children != null ? children : "Chain of thought"
|
|
115
|
+
]
|
|
116
|
+
})
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
function ChainOfThoughtContent(_a) {
|
|
120
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
121
|
+
const ctx = useContext(ChainOfThoughtContext);
|
|
122
|
+
if (!(ctx == null ? void 0 : ctx.open)) return null;
|
|
123
|
+
return /* @__PURE__ */ jsx(
|
|
124
|
+
"div",
|
|
125
|
+
__spreadValues({
|
|
126
|
+
id: ctx.contentId,
|
|
127
|
+
"data-slot": "chain-of-thought-content",
|
|
128
|
+
role: "region",
|
|
129
|
+
className: cn("space-y-3 border-border border-t px-4 py-3", className)
|
|
130
|
+
}, props)
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
function ChainOfThoughtStep(_a) {
|
|
134
|
+
var _b = _a, {
|
|
135
|
+
step,
|
|
136
|
+
status,
|
|
137
|
+
className,
|
|
138
|
+
children
|
|
139
|
+
} = _b, props = __objRest(_b, [
|
|
140
|
+
"step",
|
|
141
|
+
"status",
|
|
142
|
+
"className",
|
|
143
|
+
"children"
|
|
144
|
+
]);
|
|
145
|
+
return /* @__PURE__ */ jsxs(
|
|
146
|
+
"div",
|
|
147
|
+
__spreadProps(__spreadValues({
|
|
148
|
+
"data-slot": "chain-of-thought-step",
|
|
149
|
+
"data-status": status,
|
|
150
|
+
className: cn("flex gap-3", className)
|
|
151
|
+
}, props), {
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ jsx(
|
|
154
|
+
"span",
|
|
155
|
+
{
|
|
156
|
+
className: cn(
|
|
157
|
+
"flex size-6 shrink-0 items-center justify-center rounded-full font-bold text-xs",
|
|
158
|
+
status === "complete" && "bg-primary text-primary-foreground",
|
|
159
|
+
status === "active" && "bg-primary/20 text-primary ring-2 ring-primary/30",
|
|
160
|
+
(!status || status === "pending") && "bg-muted text-muted-foreground"
|
|
161
|
+
),
|
|
162
|
+
children: step
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1 text-foreground text-sm", children })
|
|
166
|
+
]
|
|
167
|
+
})
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
function ChainOfThoughtSearchResults(_a) {
|
|
171
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
172
|
+
return /* @__PURE__ */ jsx(
|
|
173
|
+
"div",
|
|
174
|
+
__spreadValues({
|
|
175
|
+
"data-slot": "chain-of-thought-search-results",
|
|
176
|
+
className: cn("space-y-2 pl-9", className)
|
|
177
|
+
}, props)
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
function ChainOfThoughtSearchResult(_a) {
|
|
181
|
+
var _b = _a, {
|
|
182
|
+
title,
|
|
183
|
+
url,
|
|
184
|
+
className
|
|
185
|
+
} = _b, props = __objRest(_b, [
|
|
186
|
+
"title",
|
|
187
|
+
"url",
|
|
188
|
+
"className"
|
|
189
|
+
]);
|
|
190
|
+
return /* @__PURE__ */ jsxs(
|
|
191
|
+
"a",
|
|
192
|
+
__spreadProps(__spreadValues({
|
|
193
|
+
"data-slot": "chain-of-thought-search-result",
|
|
194
|
+
href: url,
|
|
195
|
+
target: "_blank",
|
|
196
|
+
rel: "noopener noreferrer",
|
|
197
|
+
className: cn(
|
|
198
|
+
"flex items-center gap-2 rounded-lg p-2 text-sm transition-colors hover:bg-muted/50",
|
|
199
|
+
className
|
|
200
|
+
)
|
|
201
|
+
}, props), {
|
|
202
|
+
children: [
|
|
203
|
+
/* @__PURE__ */ jsx(Search, { className: "size-3.5 shrink-0 text-muted-foreground" }),
|
|
204
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-foreground", children: title })
|
|
205
|
+
]
|
|
206
|
+
})
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
function Checkpoint(_a) {
|
|
210
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
211
|
+
return /* @__PURE__ */ jsx(
|
|
212
|
+
"div",
|
|
213
|
+
__spreadProps(__spreadValues({
|
|
214
|
+
"data-slot": "checkpoint",
|
|
215
|
+
className: cn(
|
|
216
|
+
"flex items-center gap-3 rounded-lg border border-border border-dashed bg-muted/30 px-4 py-2.5",
|
|
217
|
+
className
|
|
218
|
+
)
|
|
219
|
+
}, props), {
|
|
220
|
+
children
|
|
221
|
+
})
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
function CheckpointIcon(_a) {
|
|
225
|
+
var _b = _a, {
|
|
226
|
+
icon,
|
|
227
|
+
className
|
|
228
|
+
} = _b, props = __objRest(_b, [
|
|
229
|
+
"icon",
|
|
230
|
+
"className"
|
|
231
|
+
]);
|
|
232
|
+
return /* @__PURE__ */ jsx(
|
|
233
|
+
"span",
|
|
234
|
+
__spreadProps(__spreadValues({
|
|
235
|
+
"data-slot": "checkpoint-icon",
|
|
236
|
+
className: cn("shrink-0 text-muted-foreground", className)
|
|
237
|
+
}, props), {
|
|
238
|
+
children: icon != null ? icon : /* @__PURE__ */ jsx(Bookmark, { className: "size-4" })
|
|
239
|
+
})
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
function CheckpointTrigger(_a) {
|
|
243
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
244
|
+
return /* @__PURE__ */ jsx(
|
|
245
|
+
"button",
|
|
246
|
+
__spreadValues({
|
|
247
|
+
"data-slot": "checkpoint-trigger",
|
|
248
|
+
type: "button",
|
|
249
|
+
className: cn(
|
|
250
|
+
"flex-1 truncate text-left text-muted-foreground text-sm transition-colors hover:text-foreground",
|
|
251
|
+
className
|
|
252
|
+
)
|
|
253
|
+
}, props)
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
var confirmationVariants = cva("rounded-xl border p-4 space-y-3", {
|
|
257
|
+
variants: {
|
|
258
|
+
status: {
|
|
259
|
+
pending: "border-border bg-card",
|
|
260
|
+
accepted: "border-emerald-500/30 bg-emerald-500/5",
|
|
261
|
+
rejected: "border-red-500/30 bg-red-500/5"
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
defaultVariants: { status: "pending" }
|
|
265
|
+
});
|
|
266
|
+
function Confirmation(_a) {
|
|
267
|
+
var _b = _a, {
|
|
268
|
+
status = "pending",
|
|
269
|
+
className,
|
|
270
|
+
children
|
|
271
|
+
} = _b, props = __objRest(_b, [
|
|
272
|
+
"status",
|
|
273
|
+
"className",
|
|
274
|
+
"children"
|
|
275
|
+
]);
|
|
276
|
+
return /* @__PURE__ */ jsx(
|
|
277
|
+
"div",
|
|
278
|
+
__spreadProps(__spreadValues({
|
|
279
|
+
"data-slot": "confirmation",
|
|
280
|
+
"data-status": status,
|
|
281
|
+
role: "alert",
|
|
282
|
+
className: cn(confirmationVariants({ status }), className)
|
|
283
|
+
}, props), {
|
|
284
|
+
children
|
|
285
|
+
})
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
function ConfirmationRequest(_a) {
|
|
289
|
+
var _b = _a, {
|
|
290
|
+
icon,
|
|
291
|
+
title,
|
|
292
|
+
description,
|
|
293
|
+
className
|
|
294
|
+
} = _b, props = __objRest(_b, [
|
|
295
|
+
"icon",
|
|
296
|
+
"title",
|
|
297
|
+
"description",
|
|
298
|
+
"className"
|
|
299
|
+
]);
|
|
300
|
+
return /* @__PURE__ */ jsxs(
|
|
301
|
+
"div",
|
|
302
|
+
__spreadProps(__spreadValues({
|
|
303
|
+
"data-slot": "confirmation-request",
|
|
304
|
+
className: cn("flex items-start gap-3", className)
|
|
305
|
+
}, props), {
|
|
306
|
+
children: [
|
|
307
|
+
icon != null ? icon : /* @__PURE__ */ jsx(AlertTriangle, { "aria-hidden": "true", className: "mt-0.5 size-5 shrink-0 text-amber-500" }),
|
|
308
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
309
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium text-foreground text-sm", children: title }),
|
|
310
|
+
description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-muted-foreground text-xs", children: description })
|
|
311
|
+
] })
|
|
312
|
+
]
|
|
313
|
+
})
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
function ConfirmationAccepted(_a) {
|
|
317
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
318
|
+
return /* @__PURE__ */ jsxs(
|
|
319
|
+
"div",
|
|
320
|
+
__spreadProps(__spreadValues({
|
|
321
|
+
"data-slot": "confirmation-accepted",
|
|
322
|
+
className: cn(
|
|
323
|
+
"flex items-center gap-2 text-emerald-600 text-sm dark:text-emerald-400",
|
|
324
|
+
className
|
|
325
|
+
)
|
|
326
|
+
}, props), {
|
|
327
|
+
children: [
|
|
328
|
+
/* @__PURE__ */ jsx(Check, { className: "size-4 shrink-0" }),
|
|
329
|
+
children != null ? children : "Approved"
|
|
330
|
+
]
|
|
331
|
+
})
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
function ConfirmationRejected(_a) {
|
|
335
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
336
|
+
return /* @__PURE__ */ jsxs(
|
|
337
|
+
"div",
|
|
338
|
+
__spreadProps(__spreadValues({
|
|
339
|
+
"data-slot": "confirmation-rejected",
|
|
340
|
+
className: cn("flex items-center gap-2 text-red-600 text-sm dark:text-red-400", className)
|
|
341
|
+
}, props), {
|
|
342
|
+
children: [
|
|
343
|
+
/* @__PURE__ */ jsx(X, { className: "size-4 shrink-0" }),
|
|
344
|
+
children != null ? children : "Rejected"
|
|
345
|
+
]
|
|
346
|
+
})
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
function ConfirmationActions(_a) {
|
|
350
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
351
|
+
return /* @__PURE__ */ jsx(
|
|
352
|
+
"div",
|
|
353
|
+
__spreadValues({
|
|
354
|
+
"data-slot": "confirmation-actions",
|
|
355
|
+
className: cn("flex items-center gap-2", className)
|
|
356
|
+
}, props)
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
function ConfirmationAction(_a) {
|
|
360
|
+
var _b = _a, {
|
|
361
|
+
variant = "default",
|
|
362
|
+
className
|
|
363
|
+
} = _b, props = __objRest(_b, [
|
|
364
|
+
"variant",
|
|
365
|
+
"className"
|
|
366
|
+
]);
|
|
367
|
+
return /* @__PURE__ */ jsx(
|
|
368
|
+
"button",
|
|
369
|
+
__spreadValues({
|
|
370
|
+
"data-slot": "confirmation-action",
|
|
371
|
+
type: "button",
|
|
372
|
+
className: cn(
|
|
373
|
+
"inline-flex items-center justify-center rounded-lg px-3 py-1.5 font-medium text-sm transition-colors",
|
|
374
|
+
variant === "destructive" ? "bg-red-500/10 text-red-600 hover:bg-red-500/20 dark:text-red-400" : "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
375
|
+
className
|
|
376
|
+
)
|
|
377
|
+
}, props)
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
function Context(_a) {
|
|
381
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
382
|
+
return /* @__PURE__ */ jsx(
|
|
383
|
+
"div",
|
|
384
|
+
__spreadValues({
|
|
385
|
+
"data-slot": "context",
|
|
386
|
+
className: cn("space-y-3 rounded-xl border border-border bg-card p-4", className)
|
|
387
|
+
}, props)
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
function ContextHeader(_a) {
|
|
391
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
392
|
+
return /* @__PURE__ */ jsxs(
|
|
393
|
+
"div",
|
|
394
|
+
__spreadProps(__spreadValues({
|
|
395
|
+
"data-slot": "context-header",
|
|
396
|
+
className: cn("flex items-center gap-2 font-medium text-foreground text-sm", className)
|
|
397
|
+
}, props), {
|
|
398
|
+
children: [
|
|
399
|
+
/* @__PURE__ */ jsx(Info, { "aria-hidden": "true", className: "size-4 shrink-0 text-muted-foreground" }),
|
|
400
|
+
children != null ? children : "Context"
|
|
401
|
+
]
|
|
402
|
+
})
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
function ContextBody(_a) {
|
|
406
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
407
|
+
return /* @__PURE__ */ jsx("div", __spreadValues({ "data-slot": "context-body", className: cn("space-y-2", className) }, props));
|
|
408
|
+
}
|
|
409
|
+
function ContextUsage(_a) {
|
|
410
|
+
var _b = _a, {
|
|
411
|
+
label,
|
|
412
|
+
used,
|
|
413
|
+
total,
|
|
414
|
+
className
|
|
415
|
+
} = _b, props = __objRest(_b, [
|
|
416
|
+
"label",
|
|
417
|
+
"used",
|
|
418
|
+
"total",
|
|
419
|
+
"className"
|
|
420
|
+
]);
|
|
421
|
+
const percentage = Math.min(100, Math.round(used / total * 100));
|
|
422
|
+
const isHigh = percentage > 80;
|
|
423
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ "data-slot": "context-usage", className: cn("space-y-1.5", className) }, props), { children: [
|
|
424
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs", children: [
|
|
425
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
|
|
426
|
+
/* @__PURE__ */ jsxs(
|
|
427
|
+
"span",
|
|
428
|
+
{
|
|
429
|
+
className: cn("font-mono tabular-nums", isHigh ? "text-amber-500" : "text-foreground"),
|
|
430
|
+
children: [
|
|
431
|
+
used.toLocaleString(),
|
|
432
|
+
" / ",
|
|
433
|
+
total.toLocaleString()
|
|
434
|
+
]
|
|
435
|
+
}
|
|
436
|
+
)
|
|
437
|
+
] }),
|
|
438
|
+
/* @__PURE__ */ jsx(
|
|
439
|
+
"div",
|
|
440
|
+
{
|
|
441
|
+
role: "progressbar",
|
|
442
|
+
"aria-valuenow": used,
|
|
443
|
+
"aria-valuemin": 0,
|
|
444
|
+
"aria-valuemax": total,
|
|
445
|
+
"aria-label": label,
|
|
446
|
+
className: "h-1.5 overflow-hidden rounded-full bg-muted",
|
|
447
|
+
children: /* @__PURE__ */ jsx(
|
|
448
|
+
"div",
|
|
449
|
+
{
|
|
450
|
+
className: cn(
|
|
451
|
+
"h-full rounded-full transition-all duration-300",
|
|
452
|
+
isHigh ? "bg-amber-500" : "bg-primary"
|
|
453
|
+
),
|
|
454
|
+
style: { width: `${percentage}%` }
|
|
455
|
+
}
|
|
456
|
+
)
|
|
457
|
+
}
|
|
458
|
+
)
|
|
459
|
+
] }));
|
|
460
|
+
}
|
|
461
|
+
function Conversation(_a) {
|
|
462
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
463
|
+
const ref = useRef(null);
|
|
464
|
+
const [isAtBottom, setIsAtBottom] = useState(true);
|
|
465
|
+
useEffect(() => {
|
|
466
|
+
const el = ref.current;
|
|
467
|
+
if (!el) return;
|
|
468
|
+
function handleScroll() {
|
|
469
|
+
const threshold = 100;
|
|
470
|
+
setIsAtBottom(el.scrollHeight - el.scrollTop - el.clientHeight < threshold);
|
|
471
|
+
}
|
|
472
|
+
el.addEventListener("scroll", handleScroll, { passive: true });
|
|
473
|
+
return () => el.removeEventListener("scroll", handleScroll);
|
|
474
|
+
}, []);
|
|
475
|
+
useEffect(() => {
|
|
476
|
+
if (isAtBottom && ref.current) {
|
|
477
|
+
ref.current.scrollTop = ref.current.scrollHeight;
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
const scrollToBottom = useCallback(() => {
|
|
481
|
+
var _a2;
|
|
482
|
+
(_a2 = ref.current) == null ? void 0 : _a2.scrollTo({ top: ref.current.scrollHeight, behavior: "smooth" });
|
|
483
|
+
}, []);
|
|
484
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ "data-slot": "conversation", className: cn("relative flex flex-col", className) }, props), { children: [
|
|
485
|
+
/* @__PURE__ */ jsx("div", { ref, role: "log", "aria-live": "polite", className: "flex-1 overflow-y-auto", children }),
|
|
486
|
+
!isAtBottom && /* @__PURE__ */ jsx(ConversationScrollButton, { onClick: scrollToBottom })
|
|
487
|
+
] }));
|
|
488
|
+
}
|
|
489
|
+
function ConversationContent(_a) {
|
|
490
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
491
|
+
return /* @__PURE__ */ jsx(
|
|
492
|
+
"div",
|
|
493
|
+
__spreadValues({
|
|
494
|
+
"data-slot": "conversation-content",
|
|
495
|
+
className: cn("flex flex-col gap-6 p-4", className)
|
|
496
|
+
}, props)
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
function ConversationEmptyState(_a) {
|
|
500
|
+
var _b = _a, {
|
|
501
|
+
title = "No messages yet",
|
|
502
|
+
description = "Start a conversation to see messages here",
|
|
503
|
+
icon,
|
|
504
|
+
className,
|
|
505
|
+
children
|
|
506
|
+
} = _b, props = __objRest(_b, [
|
|
507
|
+
"title",
|
|
508
|
+
"description",
|
|
509
|
+
"icon",
|
|
510
|
+
"className",
|
|
511
|
+
"children"
|
|
512
|
+
]);
|
|
513
|
+
return /* @__PURE__ */ jsxs(
|
|
514
|
+
"div",
|
|
515
|
+
__spreadProps(__spreadValues({
|
|
516
|
+
"data-slot": "conversation-empty-state",
|
|
517
|
+
className: cn(
|
|
518
|
+
"flex flex-1 flex-col items-center justify-center gap-4 p-8 text-center",
|
|
519
|
+
className
|
|
520
|
+
)
|
|
521
|
+
}, props), {
|
|
522
|
+
children: [
|
|
523
|
+
icon != null ? icon : /* @__PURE__ */ jsx(MessageSquare, { "aria-hidden": "true", className: "size-10 text-muted-foreground/40" }),
|
|
524
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
525
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium text-foreground text-sm", children: title }),
|
|
526
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: description })
|
|
527
|
+
] }),
|
|
528
|
+
children
|
|
529
|
+
]
|
|
530
|
+
})
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
function ConversationScrollButton(_a) {
|
|
534
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
535
|
+
return /* @__PURE__ */ jsxs(
|
|
536
|
+
"button",
|
|
537
|
+
__spreadProps(__spreadValues({
|
|
538
|
+
"data-slot": "conversation-scroll-button",
|
|
539
|
+
type: "button",
|
|
540
|
+
className: cn(
|
|
541
|
+
"absolute bottom-4 left-1/2 -translate-x-1/2",
|
|
542
|
+
"inline-flex items-center gap-1.5 rounded-full border border-border bg-card px-3 py-1.5",
|
|
543
|
+
"font-medium text-muted-foreground text-xs shadow-sm",
|
|
544
|
+
"transition-colors hover:bg-accent hover:text-foreground",
|
|
545
|
+
className
|
|
546
|
+
)
|
|
547
|
+
}, props), {
|
|
548
|
+
children: [
|
|
549
|
+
/* @__PURE__ */ jsx(ArrowDown, { className: "size-3" }),
|
|
550
|
+
"Scroll to bottom"
|
|
551
|
+
]
|
|
552
|
+
})
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
function ConversationDownload(_a) {
|
|
556
|
+
var _b = _a, {
|
|
557
|
+
messages,
|
|
558
|
+
filename = "conversation.md",
|
|
559
|
+
formatMessage,
|
|
560
|
+
className
|
|
561
|
+
} = _b, props = __objRest(_b, [
|
|
562
|
+
"messages",
|
|
563
|
+
"filename",
|
|
564
|
+
"formatMessage",
|
|
565
|
+
"className"
|
|
566
|
+
]);
|
|
567
|
+
const handleDownload = useCallback(() => {
|
|
568
|
+
const md = messages.map(
|
|
569
|
+
(msg, i) => {
|
|
570
|
+
var _a2;
|
|
571
|
+
return (_a2 = formatMessage == null ? void 0 : formatMessage(msg, i)) != null ? _a2 : `## ${msg.role === "user" ? "You" : msg.role === "assistant" ? "Assistant" : "System"}
|
|
572
|
+
|
|
573
|
+
${msg.content}`;
|
|
574
|
+
}
|
|
575
|
+
).join("\n\n---\n\n");
|
|
576
|
+
const blob = new Blob([md], { type: "text/markdown" });
|
|
577
|
+
const url = URL.createObjectURL(blob);
|
|
578
|
+
const a = document.createElement("a");
|
|
579
|
+
a.href = url;
|
|
580
|
+
a.download = filename;
|
|
581
|
+
a.click();
|
|
582
|
+
URL.revokeObjectURL(url);
|
|
583
|
+
}, [messages, filename, formatMessage]);
|
|
584
|
+
return /* @__PURE__ */ jsxs(
|
|
585
|
+
"button",
|
|
586
|
+
__spreadProps(__spreadValues({
|
|
587
|
+
"data-slot": "conversation-download",
|
|
588
|
+
type: "button",
|
|
589
|
+
onClick: handleDownload,
|
|
590
|
+
className: cn(
|
|
591
|
+
"inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs",
|
|
592
|
+
"text-muted-foreground transition-colors hover:text-foreground",
|
|
593
|
+
className
|
|
594
|
+
)
|
|
595
|
+
}, props), {
|
|
596
|
+
children: [
|
|
597
|
+
/* @__PURE__ */ jsx(Download, { className: "size-3.5" }),
|
|
598
|
+
"Download"
|
|
599
|
+
]
|
|
600
|
+
})
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
function InlineCitation(_a) {
|
|
604
|
+
var _b = _a, {
|
|
605
|
+
index,
|
|
606
|
+
href,
|
|
607
|
+
title,
|
|
608
|
+
description,
|
|
609
|
+
children,
|
|
610
|
+
className
|
|
611
|
+
} = _b, props = __objRest(_b, [
|
|
612
|
+
"index",
|
|
613
|
+
"href",
|
|
614
|
+
"title",
|
|
615
|
+
"description",
|
|
616
|
+
"children",
|
|
617
|
+
"className"
|
|
618
|
+
]);
|
|
619
|
+
const [showCard, setShowCard] = useState(false);
|
|
620
|
+
return /* @__PURE__ */ jsxs(
|
|
621
|
+
"span",
|
|
622
|
+
__spreadProps(__spreadValues({
|
|
623
|
+
"data-slot": "inline-citation",
|
|
624
|
+
className: cn("relative inline-flex items-baseline", className),
|
|
625
|
+
onMouseEnter: () => setShowCard(true),
|
|
626
|
+
onMouseLeave: () => setShowCard(false),
|
|
627
|
+
onFocus: () => setShowCard(true),
|
|
628
|
+
onBlur: () => setShowCard(false)
|
|
629
|
+
}, props), {
|
|
630
|
+
children: [
|
|
631
|
+
children,
|
|
632
|
+
/* @__PURE__ */ jsx(
|
|
633
|
+
"a",
|
|
634
|
+
{
|
|
635
|
+
href,
|
|
636
|
+
target: "_blank",
|
|
637
|
+
rel: "noopener noreferrer",
|
|
638
|
+
"aria-label": `Citation ${index}: ${title}`,
|
|
639
|
+
className: "ml-0.5 inline-flex size-4 items-center justify-center rounded-full bg-primary/10 align-super font-bold text-[10px] text-primary transition-colors hover:bg-primary/20",
|
|
640
|
+
children: index
|
|
641
|
+
}
|
|
642
|
+
),
|
|
643
|
+
showCard && /* @__PURE__ */ jsx("span", { role: "tooltip", className: "absolute bottom-full left-1/2 z-50 mb-2 -translate-x-1/2", children: /* @__PURE__ */ jsx(InlineCitationCard, { href, title, description }) })
|
|
644
|
+
]
|
|
645
|
+
})
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
function InlineCitationCard(_a) {
|
|
649
|
+
var _b = _a, {
|
|
650
|
+
href,
|
|
651
|
+
title,
|
|
652
|
+
description,
|
|
653
|
+
className
|
|
654
|
+
} = _b, props = __objRest(_b, [
|
|
655
|
+
"href",
|
|
656
|
+
"title",
|
|
657
|
+
"description",
|
|
658
|
+
"className"
|
|
659
|
+
]);
|
|
660
|
+
return /* @__PURE__ */ jsxs(
|
|
661
|
+
"a",
|
|
662
|
+
__spreadProps(__spreadValues({
|
|
663
|
+
"data-slot": "inline-citation-card",
|
|
664
|
+
href,
|
|
665
|
+
target: "_blank",
|
|
666
|
+
rel: "noopener noreferrer",
|
|
667
|
+
className: cn(
|
|
668
|
+
"block w-64 rounded-lg border border-border bg-popover p-3 shadow-md",
|
|
669
|
+
"transition-colors hover:bg-muted/50",
|
|
670
|
+
className
|
|
671
|
+
)
|
|
672
|
+
}, props), {
|
|
673
|
+
children: [
|
|
674
|
+
/* @__PURE__ */ jsx("p", { className: "truncate font-medium text-popover-foreground text-sm", children: title }),
|
|
675
|
+
description && /* @__PURE__ */ jsx("p", { className: "mt-1 line-clamp-2 text-muted-foreground text-xs", children: description }),
|
|
676
|
+
/* @__PURE__ */ jsxs("span", { className: "mt-2 inline-flex items-center gap-1 text-primary text-xs", children: [
|
|
677
|
+
"Open ",
|
|
678
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "size-3" })
|
|
679
|
+
] })
|
|
680
|
+
]
|
|
681
|
+
})
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
var MessageContext = createContext({ role: "assistant" });
|
|
685
|
+
var messageVariants = cva("group/message flex gap-3", {
|
|
686
|
+
variants: {
|
|
687
|
+
from: {
|
|
688
|
+
user: "flex-row-reverse",
|
|
689
|
+
assistant: "flex-row",
|
|
690
|
+
system: "flex-row justify-center"
|
|
691
|
+
}
|
|
692
|
+
},
|
|
693
|
+
defaultVariants: { from: "assistant" }
|
|
694
|
+
});
|
|
695
|
+
function Message(_a) {
|
|
696
|
+
var _b = _a, {
|
|
697
|
+
from = "assistant",
|
|
698
|
+
className,
|
|
699
|
+
children
|
|
700
|
+
} = _b, props = __objRest(_b, [
|
|
701
|
+
"from",
|
|
702
|
+
"className",
|
|
703
|
+
"children"
|
|
704
|
+
]);
|
|
705
|
+
return /* @__PURE__ */ jsx(MessageContext.Provider, { value: { role: from }, children: /* @__PURE__ */ jsx(
|
|
706
|
+
"div",
|
|
707
|
+
__spreadProps(__spreadValues({
|
|
708
|
+
"data-slot": "message",
|
|
709
|
+
"data-role": from,
|
|
710
|
+
className: cn(messageVariants({ from }), className)
|
|
711
|
+
}, props), {
|
|
712
|
+
children
|
|
713
|
+
})
|
|
714
|
+
) });
|
|
715
|
+
}
|
|
716
|
+
function MessageAvatar(_a) {
|
|
717
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
718
|
+
return /* @__PURE__ */ jsx(
|
|
719
|
+
"div",
|
|
720
|
+
__spreadValues({
|
|
721
|
+
"data-slot": "message-avatar",
|
|
722
|
+
className: cn(
|
|
723
|
+
"flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",
|
|
724
|
+
className
|
|
725
|
+
)
|
|
726
|
+
}, props)
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
function MessageContent(_a) {
|
|
730
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
731
|
+
const { role } = useContext(MessageContext);
|
|
732
|
+
return /* @__PURE__ */ jsx(
|
|
733
|
+
"div",
|
|
734
|
+
__spreadValues({
|
|
735
|
+
"data-slot": "message-content",
|
|
736
|
+
className: cn(
|
|
737
|
+
"flex max-w-[80%] flex-col gap-1",
|
|
738
|
+
role === "user" && "items-end",
|
|
739
|
+
role === "system" && "max-w-full items-center",
|
|
740
|
+
className
|
|
741
|
+
)
|
|
742
|
+
}, props)
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
var responseBubbleVariants = cva("rounded-2xl px-4 py-3 text-sm leading-relaxed", {
|
|
746
|
+
variants: {
|
|
747
|
+
from: {
|
|
748
|
+
user: "bg-primary text-primary-foreground",
|
|
749
|
+
assistant: "bg-muted text-foreground",
|
|
750
|
+
system: "bg-muted/50 text-muted-foreground italic text-center"
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
defaultVariants: { from: "assistant" }
|
|
754
|
+
});
|
|
755
|
+
function MessageResponse(_a) {
|
|
756
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
757
|
+
const { role } = useContext(MessageContext);
|
|
758
|
+
return /* @__PURE__ */ jsx(
|
|
759
|
+
"div",
|
|
760
|
+
__spreadValues({
|
|
761
|
+
"data-slot": "message-response",
|
|
762
|
+
className: cn(
|
|
763
|
+
responseBubbleVariants({ from: role }),
|
|
764
|
+
"prose prose-sm dark:prose-invert max-w-none",
|
|
765
|
+
"[&_pre]:rounded-lg [&_pre]:bg-card [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-xs",
|
|
766
|
+
"[&_code]:rounded [&_code]:bg-card [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-xs",
|
|
767
|
+
className
|
|
768
|
+
)
|
|
769
|
+
}, props)
|
|
770
|
+
);
|
|
771
|
+
}
|
|
772
|
+
function MessageActions(_a) {
|
|
773
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
774
|
+
return /* @__PURE__ */ jsx(
|
|
775
|
+
"div",
|
|
776
|
+
__spreadValues({
|
|
777
|
+
"data-slot": "message-actions",
|
|
778
|
+
className: cn(
|
|
779
|
+
"flex items-center gap-1 opacity-0 transition-opacity group-hover/message:opacity-100",
|
|
780
|
+
className
|
|
781
|
+
)
|
|
782
|
+
}, props)
|
|
783
|
+
);
|
|
784
|
+
}
|
|
785
|
+
function MessageAction(_a) {
|
|
786
|
+
var _b = _a, {
|
|
787
|
+
tooltip,
|
|
788
|
+
className
|
|
789
|
+
} = _b, props = __objRest(_b, [
|
|
790
|
+
"tooltip",
|
|
791
|
+
"className"
|
|
792
|
+
]);
|
|
793
|
+
return /* @__PURE__ */ jsx(
|
|
794
|
+
"button",
|
|
795
|
+
__spreadValues({
|
|
796
|
+
"data-slot": "message-action",
|
|
797
|
+
type: "button",
|
|
798
|
+
title: tooltip,
|
|
799
|
+
className: cn(
|
|
800
|
+
"inline-flex items-center justify-center rounded-md p-1.5",
|
|
801
|
+
"text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
802
|
+
className
|
|
803
|
+
)
|
|
804
|
+
}, props)
|
|
805
|
+
);
|
|
806
|
+
}
|
|
807
|
+
function MessageCopyAction(_a) {
|
|
808
|
+
var _b = _a, {
|
|
809
|
+
content,
|
|
810
|
+
className
|
|
811
|
+
} = _b, props = __objRest(_b, [
|
|
812
|
+
"content",
|
|
813
|
+
"className"
|
|
814
|
+
]);
|
|
815
|
+
const [copied, setCopied] = useState(false);
|
|
816
|
+
const handleCopy = useCallback(() => {
|
|
817
|
+
navigator.clipboard.writeText(content);
|
|
818
|
+
setCopied(true);
|
|
819
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
820
|
+
}, [content]);
|
|
821
|
+
return /* @__PURE__ */ jsx(
|
|
822
|
+
MessageAction,
|
|
823
|
+
__spreadProps(__spreadValues({
|
|
824
|
+
tooltip: copied ? "Copied!" : "Copy",
|
|
825
|
+
onClick: handleCopy,
|
|
826
|
+
className
|
|
827
|
+
}, props), {
|
|
828
|
+
children: /* @__PURE__ */ jsx(Copy, { className: "size-3.5" })
|
|
829
|
+
})
|
|
830
|
+
);
|
|
831
|
+
}
|
|
832
|
+
function MessageRegenerateAction(props) {
|
|
833
|
+
return /* @__PURE__ */ jsx(MessageAction, __spreadProps(__spreadValues({ tooltip: "Regenerate" }, props), { children: /* @__PURE__ */ jsx(RefreshCw, { className: "size-3.5" }) }));
|
|
834
|
+
}
|
|
835
|
+
function MessageFeedbackActions({
|
|
836
|
+
onThumbsUp,
|
|
837
|
+
onThumbsDown
|
|
838
|
+
}) {
|
|
839
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
840
|
+
/* @__PURE__ */ jsx(MessageAction, { tooltip: "Good response", onClick: onThumbsUp, children: /* @__PURE__ */ jsx(ThumbsUp, { className: "size-3.5" }) }),
|
|
841
|
+
/* @__PURE__ */ jsx(MessageAction, { tooltip: "Bad response", onClick: onThumbsDown, children: /* @__PURE__ */ jsx(ThumbsDown, { className: "size-3.5" }) })
|
|
842
|
+
] });
|
|
843
|
+
}
|
|
844
|
+
var BranchContext = createContext(null);
|
|
845
|
+
function MessageBranch({
|
|
846
|
+
total,
|
|
847
|
+
defaultBranch = 0,
|
|
848
|
+
onBranchChange,
|
|
849
|
+
children
|
|
850
|
+
}) {
|
|
851
|
+
const [branch, setBranch] = useState(defaultBranch);
|
|
852
|
+
const prev = useCallback(() => {
|
|
853
|
+
setBranch((b) => {
|
|
854
|
+
const next2 = Math.max(0, b - 1);
|
|
855
|
+
onBranchChange == null ? void 0 : onBranchChange(next2);
|
|
856
|
+
return next2;
|
|
857
|
+
});
|
|
858
|
+
}, [onBranchChange]);
|
|
859
|
+
const next = useCallback(() => {
|
|
860
|
+
setBranch((b) => {
|
|
861
|
+
const next2 = Math.min(total - 1, b + 1);
|
|
862
|
+
onBranchChange == null ? void 0 : onBranchChange(next2);
|
|
863
|
+
return next2;
|
|
864
|
+
});
|
|
865
|
+
}, [total, onBranchChange]);
|
|
866
|
+
return /* @__PURE__ */ jsx(BranchContext.Provider, { value: { branch, total, prev, next }, children });
|
|
867
|
+
}
|
|
868
|
+
function MessageBranchSelector(_a) {
|
|
869
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
870
|
+
const ctx = useContext(BranchContext);
|
|
871
|
+
if (!ctx || ctx.total <= 1) return null;
|
|
872
|
+
return /* @__PURE__ */ jsxs(
|
|
873
|
+
"div",
|
|
874
|
+
__spreadProps(__spreadValues({
|
|
875
|
+
"data-slot": "message-branch-selector",
|
|
876
|
+
className: cn("inline-flex items-center gap-1 text-muted-foreground text-xs", className)
|
|
877
|
+
}, props), {
|
|
878
|
+
children: [
|
|
879
|
+
/* @__PURE__ */ jsx(
|
|
880
|
+
"button",
|
|
881
|
+
{
|
|
882
|
+
type: "button",
|
|
883
|
+
onClick: ctx.prev,
|
|
884
|
+
disabled: ctx.branch === 0,
|
|
885
|
+
"aria-label": "Previous response",
|
|
886
|
+
className: "rounded p-0.5 transition-colors hover:bg-muted disabled:opacity-30",
|
|
887
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true", className: "size-3.5" })
|
|
888
|
+
}
|
|
889
|
+
),
|
|
890
|
+
/* @__PURE__ */ jsxs("span", { className: "tabular-nums", "aria-label": `Response ${ctx.branch + 1} of ${ctx.total}`, children: [
|
|
891
|
+
ctx.branch + 1,
|
|
892
|
+
" / ",
|
|
893
|
+
ctx.total
|
|
894
|
+
] }),
|
|
895
|
+
/* @__PURE__ */ jsx(
|
|
896
|
+
"button",
|
|
897
|
+
{
|
|
898
|
+
type: "button",
|
|
899
|
+
onClick: ctx.next,
|
|
900
|
+
disabled: ctx.branch === ctx.total - 1,
|
|
901
|
+
"aria-label": "Next response",
|
|
902
|
+
className: "rounded p-0.5 transition-colors hover:bg-muted disabled:opacity-30",
|
|
903
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true", className: "size-3.5" })
|
|
904
|
+
}
|
|
905
|
+
)
|
|
906
|
+
]
|
|
907
|
+
})
|
|
908
|
+
);
|
|
909
|
+
}
|
|
910
|
+
function MessageAttachments(_a) {
|
|
911
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
912
|
+
return /* @__PURE__ */ jsx(
|
|
913
|
+
"div",
|
|
914
|
+
__spreadValues({
|
|
915
|
+
"data-slot": "message-attachments",
|
|
916
|
+
className: cn("flex flex-wrap gap-2", className)
|
|
917
|
+
}, props)
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
var ModelSelectorContext = createContext(null);
|
|
921
|
+
function useModelSelector() {
|
|
922
|
+
const ctx = useContext(ModelSelectorContext);
|
|
923
|
+
if (!ctx) throw new Error("useModelSelector must be used within <ModelSelector>");
|
|
924
|
+
return ctx;
|
|
925
|
+
}
|
|
926
|
+
function ModelSelector({
|
|
927
|
+
value,
|
|
928
|
+
onValueChange,
|
|
929
|
+
children
|
|
930
|
+
}) {
|
|
931
|
+
const [open, setOpen] = useState(false);
|
|
932
|
+
const [search, setSearch] = useState("");
|
|
933
|
+
const [selected, setSelected] = useState(value != null ? value : null);
|
|
934
|
+
useEffect(() => {
|
|
935
|
+
if (value !== void 0) setSelected(value);
|
|
936
|
+
}, [value]);
|
|
937
|
+
const onSelect = useCallback(
|
|
938
|
+
(modelId) => {
|
|
939
|
+
setSelected(modelId);
|
|
940
|
+
onValueChange == null ? void 0 : onValueChange(modelId);
|
|
941
|
+
setOpen(false);
|
|
942
|
+
setSearch("");
|
|
943
|
+
},
|
|
944
|
+
[onValueChange]
|
|
945
|
+
);
|
|
946
|
+
return /* @__PURE__ */ jsx(ModelSelectorContext.Provider, { value: { open, setOpen, search, setSearch, selected, onSelect }, children: /* @__PURE__ */ jsx("div", { "data-slot": "model-selector", className: "relative", children }) });
|
|
947
|
+
}
|
|
948
|
+
function ModelSelectorTrigger(_a) {
|
|
949
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
950
|
+
var _a2;
|
|
951
|
+
const { open, setOpen, selected } = useModelSelector();
|
|
952
|
+
return /* @__PURE__ */ jsxs(
|
|
953
|
+
"button",
|
|
954
|
+
__spreadProps(__spreadValues({
|
|
955
|
+
"data-slot": "model-selector-trigger",
|
|
956
|
+
type: "button",
|
|
957
|
+
onClick: () => setOpen(!open),
|
|
958
|
+
"aria-haspopup": "listbox",
|
|
959
|
+
"aria-expanded": open,
|
|
960
|
+
className: cn(
|
|
961
|
+
"inline-flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2 text-sm",
|
|
962
|
+
"transition-colors hover:bg-accent",
|
|
963
|
+
className
|
|
964
|
+
)
|
|
965
|
+
}, props), {
|
|
966
|
+
children: [
|
|
967
|
+
(_a2 = children != null ? children : selected) != null ? _a2 : "Select model",
|
|
968
|
+
/* @__PURE__ */ jsx(
|
|
969
|
+
ChevronDown,
|
|
970
|
+
{
|
|
971
|
+
"aria-hidden": "true",
|
|
972
|
+
className: cn("size-3.5 text-muted-foreground transition-transform", open && "rotate-180")
|
|
973
|
+
}
|
|
974
|
+
)
|
|
975
|
+
]
|
|
976
|
+
})
|
|
977
|
+
);
|
|
978
|
+
}
|
|
979
|
+
function ModelSelectorContent(_a) {
|
|
980
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
981
|
+
const { open, setOpen } = useModelSelector();
|
|
982
|
+
const ref = useRef(null);
|
|
983
|
+
useEffect(() => {
|
|
984
|
+
if (!open) return;
|
|
985
|
+
function handleClickOutside(e) {
|
|
986
|
+
if (ref.current && !ref.current.contains(e.target)) {
|
|
987
|
+
setOpen(false);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
function handleEscape(e) {
|
|
991
|
+
if (e.key === "Escape") setOpen(false);
|
|
992
|
+
}
|
|
993
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
994
|
+
document.addEventListener("keydown", handleEscape);
|
|
995
|
+
return () => {
|
|
996
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
997
|
+
document.removeEventListener("keydown", handleEscape);
|
|
998
|
+
};
|
|
999
|
+
}, [open, setOpen]);
|
|
1000
|
+
if (!open) return null;
|
|
1001
|
+
return /* @__PURE__ */ jsx(
|
|
1002
|
+
"div",
|
|
1003
|
+
__spreadProps(__spreadValues({
|
|
1004
|
+
ref,
|
|
1005
|
+
"data-slot": "model-selector-content",
|
|
1006
|
+
className: cn(
|
|
1007
|
+
"absolute top-full left-0 z-50 mt-1 w-72",
|
|
1008
|
+
"rounded-xl border border-border bg-popover p-1 shadow-lg",
|
|
1009
|
+
className
|
|
1010
|
+
)
|
|
1011
|
+
}, props), {
|
|
1012
|
+
children
|
|
1013
|
+
})
|
|
1014
|
+
);
|
|
1015
|
+
}
|
|
1016
|
+
function ModelSelectorInput(_a) {
|
|
1017
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1018
|
+
const { search, setSearch } = useModelSelector();
|
|
1019
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative px-1 pb-1", children: [
|
|
1020
|
+
/* @__PURE__ */ jsx(
|
|
1021
|
+
Search,
|
|
1022
|
+
{
|
|
1023
|
+
"aria-hidden": "true",
|
|
1024
|
+
className: "absolute top-1/2 left-3 size-3.5 -translate-y-1/2 text-muted-foreground"
|
|
1025
|
+
}
|
|
1026
|
+
),
|
|
1027
|
+
/* @__PURE__ */ jsx(
|
|
1028
|
+
"input",
|
|
1029
|
+
__spreadValues({
|
|
1030
|
+
"data-slot": "model-selector-input",
|
|
1031
|
+
value: search,
|
|
1032
|
+
onChange: (e) => setSearch(e.target.value),
|
|
1033
|
+
placeholder: "Search models...",
|
|
1034
|
+
"aria-label": "Search models",
|
|
1035
|
+
className: cn(
|
|
1036
|
+
"w-full rounded-lg bg-muted/50 py-2 pr-3 pl-8 text-sm",
|
|
1037
|
+
"placeholder:text-muted-foreground focus:outline-none",
|
|
1038
|
+
className
|
|
1039
|
+
)
|
|
1040
|
+
}, props)
|
|
1041
|
+
)
|
|
1042
|
+
] });
|
|
1043
|
+
}
|
|
1044
|
+
function ModelSelectorList(_a) {
|
|
1045
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1046
|
+
return /* @__PURE__ */ jsx(
|
|
1047
|
+
"div",
|
|
1048
|
+
__spreadValues({
|
|
1049
|
+
"data-slot": "model-selector-list",
|
|
1050
|
+
role: "listbox",
|
|
1051
|
+
"aria-label": "Models",
|
|
1052
|
+
className: cn("max-h-64 overflow-y-auto", className)
|
|
1053
|
+
}, props)
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
function ModelSelectorGroup(_a) {
|
|
1057
|
+
var _b = _a, {
|
|
1058
|
+
label,
|
|
1059
|
+
className,
|
|
1060
|
+
children
|
|
1061
|
+
} = _b, props = __objRest(_b, [
|
|
1062
|
+
"label",
|
|
1063
|
+
"className",
|
|
1064
|
+
"children"
|
|
1065
|
+
]);
|
|
1066
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ "data-slot": "model-selector-group", className: cn("py-1", className) }, props), { children: [
|
|
1067
|
+
label && /* @__PURE__ */ jsx("p", { className: "px-2 py-1.5 font-medium text-[10px] text-muted-foreground uppercase tracking-wider", children: label }),
|
|
1068
|
+
children
|
|
1069
|
+
] }));
|
|
1070
|
+
}
|
|
1071
|
+
function ModelSelectorItem(_a) {
|
|
1072
|
+
var _b = _a, {
|
|
1073
|
+
value,
|
|
1074
|
+
logo,
|
|
1075
|
+
name,
|
|
1076
|
+
description,
|
|
1077
|
+
className
|
|
1078
|
+
} = _b, props = __objRest(_b, [
|
|
1079
|
+
"value",
|
|
1080
|
+
"logo",
|
|
1081
|
+
"name",
|
|
1082
|
+
"description",
|
|
1083
|
+
"className"
|
|
1084
|
+
]);
|
|
1085
|
+
const { selected, onSelect, search } = useModelSelector();
|
|
1086
|
+
const isSelected = selected === value;
|
|
1087
|
+
const visible = useMemo(() => {
|
|
1088
|
+
if (!search) return true;
|
|
1089
|
+
const q = search.toLowerCase();
|
|
1090
|
+
return name.toLowerCase().includes(q) || value.toLowerCase().includes(q);
|
|
1091
|
+
}, [search, name, value]);
|
|
1092
|
+
if (!visible) return null;
|
|
1093
|
+
return /* @__PURE__ */ jsxs(
|
|
1094
|
+
"button",
|
|
1095
|
+
__spreadProps(__spreadValues({
|
|
1096
|
+
"data-slot": "model-selector-item",
|
|
1097
|
+
type: "button",
|
|
1098
|
+
role: "option",
|
|
1099
|
+
"aria-selected": isSelected,
|
|
1100
|
+
onClick: () => onSelect(value),
|
|
1101
|
+
className: cn(
|
|
1102
|
+
"flex w-full items-center gap-3 rounded-lg px-2 py-2 text-left text-sm",
|
|
1103
|
+
"transition-colors hover:bg-muted/50",
|
|
1104
|
+
isSelected && "bg-muted",
|
|
1105
|
+
className
|
|
1106
|
+
)
|
|
1107
|
+
}, props), {
|
|
1108
|
+
children: [
|
|
1109
|
+
logo && /* @__PURE__ */ jsx("span", { className: "shrink-0 [&>img]:size-5 [&>img]:rounded [&>svg]:size-4", children: logo }),
|
|
1110
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
1111
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate font-medium text-foreground", children: name }),
|
|
1112
|
+
description && /* @__PURE__ */ jsx("span", { className: "block truncate text-muted-foreground text-xs", children: description })
|
|
1113
|
+
] }),
|
|
1114
|
+
isSelected && /* @__PURE__ */ jsx(Check, { "aria-hidden": "true", className: "size-4 shrink-0 text-primary" })
|
|
1115
|
+
]
|
|
1116
|
+
})
|
|
1117
|
+
);
|
|
1118
|
+
}
|
|
1119
|
+
function ModelSelectorEmpty(_a) {
|
|
1120
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1121
|
+
var _a2;
|
|
1122
|
+
return /* @__PURE__ */ jsx(
|
|
1123
|
+
"div",
|
|
1124
|
+
__spreadProps(__spreadValues({
|
|
1125
|
+
"data-slot": "model-selector-empty",
|
|
1126
|
+
className: cn("py-6 text-center text-muted-foreground text-sm", className)
|
|
1127
|
+
}, props), {
|
|
1128
|
+
children: (_a2 = props.children) != null ? _a2 : "No models found."
|
|
1129
|
+
})
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1132
|
+
function ModelSelectorSeparator(_a) {
|
|
1133
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1134
|
+
return /* @__PURE__ */ jsx(
|
|
1135
|
+
"div",
|
|
1136
|
+
__spreadValues({
|
|
1137
|
+
"data-slot": "model-selector-separator",
|
|
1138
|
+
role: "separator",
|
|
1139
|
+
className: cn("mx-1 my-1 h-px bg-border", className)
|
|
1140
|
+
}, props)
|
|
1141
|
+
);
|
|
1142
|
+
}
|
|
1143
|
+
var PlanContext = createContext(null);
|
|
1144
|
+
function Plan(_a) {
|
|
1145
|
+
var _b = _a, {
|
|
1146
|
+
defaultOpen = true,
|
|
1147
|
+
className,
|
|
1148
|
+
children
|
|
1149
|
+
} = _b, props = __objRest(_b, [
|
|
1150
|
+
"defaultOpen",
|
|
1151
|
+
"className",
|
|
1152
|
+
"children"
|
|
1153
|
+
]);
|
|
1154
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
1155
|
+
const toggle = useCallback(() => setOpen((o) => !o), []);
|
|
1156
|
+
const contentId = useId();
|
|
1157
|
+
return /* @__PURE__ */ jsx(PlanContext.Provider, { value: { open, toggle, contentId }, children: /* @__PURE__ */ jsx(
|
|
1158
|
+
"div",
|
|
1159
|
+
__spreadProps(__spreadValues({
|
|
1160
|
+
"data-slot": "plan",
|
|
1161
|
+
"data-state": open ? "open" : "closed",
|
|
1162
|
+
className: cn("rounded-xl border border-border bg-card", className)
|
|
1163
|
+
}, props), {
|
|
1164
|
+
children
|
|
1165
|
+
})
|
|
1166
|
+
) });
|
|
1167
|
+
}
|
|
1168
|
+
function PlanHeader(_a) {
|
|
1169
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1170
|
+
return /* @__PURE__ */ jsx(
|
|
1171
|
+
"div",
|
|
1172
|
+
__spreadValues({
|
|
1173
|
+
"data-slot": "plan-header",
|
|
1174
|
+
className: cn("flex items-center gap-3 px-4 py-3", className)
|
|
1175
|
+
}, props)
|
|
1176
|
+
);
|
|
1177
|
+
}
|
|
1178
|
+
function PlanTitle(_a) {
|
|
1179
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1180
|
+
return /* @__PURE__ */ jsx(
|
|
1181
|
+
"div",
|
|
1182
|
+
__spreadValues({
|
|
1183
|
+
"data-slot": "plan-title",
|
|
1184
|
+
className: cn("flex-1 font-medium text-foreground text-sm", className)
|
|
1185
|
+
}, props)
|
|
1186
|
+
);
|
|
1187
|
+
}
|
|
1188
|
+
function PlanDescription(_a) {
|
|
1189
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1190
|
+
return /* @__PURE__ */ jsx(
|
|
1191
|
+
"p",
|
|
1192
|
+
__spreadValues({
|
|
1193
|
+
"data-slot": "plan-description",
|
|
1194
|
+
className: cn("px-4 pb-3 text-muted-foreground text-xs", className)
|
|
1195
|
+
}, props)
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
function PlanTrigger(_a) {
|
|
1199
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1200
|
+
var _a2;
|
|
1201
|
+
const ctx = useContext(PlanContext);
|
|
1202
|
+
if (!ctx) throw new Error("PlanTrigger must be used within <Plan>");
|
|
1203
|
+
return /* @__PURE__ */ jsxs(
|
|
1204
|
+
"button",
|
|
1205
|
+
__spreadProps(__spreadValues({
|
|
1206
|
+
"data-slot": "plan-trigger",
|
|
1207
|
+
type: "button",
|
|
1208
|
+
onClick: ctx.toggle,
|
|
1209
|
+
"aria-expanded": ctx.open,
|
|
1210
|
+
"aria-controls": ctx.contentId,
|
|
1211
|
+
className: cn(
|
|
1212
|
+
"flex w-full items-center gap-2 px-4 py-3 font-medium text-sm",
|
|
1213
|
+
"text-muted-foreground transition-colors hover:text-foreground",
|
|
1214
|
+
className
|
|
1215
|
+
)
|
|
1216
|
+
}, props), {
|
|
1217
|
+
children: [
|
|
1218
|
+
/* @__PURE__ */ jsx(ListChecks, { "aria-hidden": "true", className: "size-4 shrink-0" }),
|
|
1219
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 text-left", children: (_a2 = props.children) != null ? _a2 : "Execution Plan" }),
|
|
1220
|
+
/* @__PURE__ */ jsx(
|
|
1221
|
+
ChevronDown,
|
|
1222
|
+
{
|
|
1223
|
+
"aria-hidden": "true",
|
|
1224
|
+
className: cn(
|
|
1225
|
+
"size-4 shrink-0 transition-transform duration-200",
|
|
1226
|
+
ctx.open && "rotate-180"
|
|
1227
|
+
)
|
|
1228
|
+
}
|
|
1229
|
+
)
|
|
1230
|
+
]
|
|
1231
|
+
})
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1234
|
+
function PlanContent(_a) {
|
|
1235
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1236
|
+
const ctx = useContext(PlanContext);
|
|
1237
|
+
if (!(ctx == null ? void 0 : ctx.open)) return null;
|
|
1238
|
+
return /* @__PURE__ */ jsx(
|
|
1239
|
+
"div",
|
|
1240
|
+
__spreadValues({
|
|
1241
|
+
id: ctx.contentId,
|
|
1242
|
+
"data-slot": "plan-content",
|
|
1243
|
+
role: "region",
|
|
1244
|
+
className: cn("space-y-2 border-border border-t px-4 py-3", className)
|
|
1245
|
+
}, props)
|
|
1246
|
+
);
|
|
1247
|
+
}
|
|
1248
|
+
function PlanFooter(_a) {
|
|
1249
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1250
|
+
return /* @__PURE__ */ jsx(
|
|
1251
|
+
"div",
|
|
1252
|
+
__spreadValues({
|
|
1253
|
+
"data-slot": "plan-footer",
|
|
1254
|
+
className: cn("flex items-center gap-2 border-border border-t px-4 py-2.5", className)
|
|
1255
|
+
}, props)
|
|
1256
|
+
);
|
|
1257
|
+
}
|
|
1258
|
+
function PlanAction(_a) {
|
|
1259
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1260
|
+
return /* @__PURE__ */ jsx(
|
|
1261
|
+
"button",
|
|
1262
|
+
__spreadValues({
|
|
1263
|
+
"data-slot": "plan-action",
|
|
1264
|
+
type: "button",
|
|
1265
|
+
className: cn(
|
|
1266
|
+
"inline-flex items-center rounded-lg px-3 py-1.5 font-medium text-xs",
|
|
1267
|
+
"bg-primary text-primary-foreground transition-colors hover:bg-primary/90",
|
|
1268
|
+
className
|
|
1269
|
+
)
|
|
1270
|
+
}, props)
|
|
1271
|
+
);
|
|
1272
|
+
}
|
|
1273
|
+
var PromptInputContext = createContext(null);
|
|
1274
|
+
function usePromptInput() {
|
|
1275
|
+
const ctx = useContext(PromptInputContext);
|
|
1276
|
+
if (!ctx) throw new Error("usePromptInput must be used within <PromptInput>");
|
|
1277
|
+
return ctx;
|
|
1278
|
+
}
|
|
1279
|
+
function PromptInput(_a) {
|
|
1280
|
+
var _b = _a, {
|
|
1281
|
+
onSubmit,
|
|
1282
|
+
isLoading = false,
|
|
1283
|
+
className,
|
|
1284
|
+
children
|
|
1285
|
+
} = _b, props = __objRest(_b, [
|
|
1286
|
+
"onSubmit",
|
|
1287
|
+
"isLoading",
|
|
1288
|
+
"className",
|
|
1289
|
+
"children"
|
|
1290
|
+
]);
|
|
1291
|
+
const [value, setValue] = useState("");
|
|
1292
|
+
const [files, setFiles] = useState([]);
|
|
1293
|
+
const addFiles = useCallback((newFiles) => {
|
|
1294
|
+
setFiles((prev) => [...prev, ...newFiles]);
|
|
1295
|
+
}, []);
|
|
1296
|
+
const removeFile = useCallback((index) => {
|
|
1297
|
+
setFiles((prev) => prev.filter((_, i) => i !== index));
|
|
1298
|
+
}, []);
|
|
1299
|
+
const clearFiles = useCallback(() => setFiles([]), []);
|
|
1300
|
+
const submit = useCallback(() => {
|
|
1301
|
+
if (!value.trim() && files.length === 0) return;
|
|
1302
|
+
onSubmit == null ? void 0 : onSubmit(value.trim(), files);
|
|
1303
|
+
setValue("");
|
|
1304
|
+
setFiles([]);
|
|
1305
|
+
}, [value, files, onSubmit]);
|
|
1306
|
+
const handleSubmit = useCallback(
|
|
1307
|
+
(e) => {
|
|
1308
|
+
e.preventDefault();
|
|
1309
|
+
submit();
|
|
1310
|
+
},
|
|
1311
|
+
[submit]
|
|
1312
|
+
);
|
|
1313
|
+
return /* @__PURE__ */ jsx(
|
|
1314
|
+
PromptInputContext.Provider,
|
|
1315
|
+
{
|
|
1316
|
+
value: { value, setValue, files, addFiles, removeFile, clearFiles, submit, isLoading },
|
|
1317
|
+
children: /* @__PURE__ */ jsx(
|
|
1318
|
+
"form",
|
|
1319
|
+
__spreadProps(__spreadValues({
|
|
1320
|
+
"data-slot": "prompt-input",
|
|
1321
|
+
onSubmit: handleSubmit,
|
|
1322
|
+
className: cn(
|
|
1323
|
+
"flex flex-col rounded-2xl border border-border bg-card shadow-sm",
|
|
1324
|
+
"focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
1325
|
+
className
|
|
1326
|
+
)
|
|
1327
|
+
}, props), {
|
|
1328
|
+
children
|
|
1329
|
+
})
|
|
1330
|
+
)
|
|
1331
|
+
}
|
|
1332
|
+
);
|
|
1333
|
+
}
|
|
1334
|
+
function PromptInputHeader(_a) {
|
|
1335
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1336
|
+
return /* @__PURE__ */ jsx(
|
|
1337
|
+
"div",
|
|
1338
|
+
__spreadValues({
|
|
1339
|
+
"data-slot": "prompt-input-header",
|
|
1340
|
+
className: cn("border-border border-b px-4 py-2", className)
|
|
1341
|
+
}, props)
|
|
1342
|
+
);
|
|
1343
|
+
}
|
|
1344
|
+
function PromptInputBody(_a) {
|
|
1345
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1346
|
+
return /* @__PURE__ */ jsx("div", __spreadValues({ "data-slot": "prompt-input-body", className: cn("flex-1", className) }, props));
|
|
1347
|
+
}
|
|
1348
|
+
function PromptInputFooter(_a) {
|
|
1349
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1350
|
+
return /* @__PURE__ */ jsx(
|
|
1351
|
+
"div",
|
|
1352
|
+
__spreadValues({
|
|
1353
|
+
"data-slot": "prompt-input-footer",
|
|
1354
|
+
className: cn("flex items-center gap-2 px-3 py-2", className)
|
|
1355
|
+
}, props)
|
|
1356
|
+
);
|
|
1357
|
+
}
|
|
1358
|
+
function PromptInputTextarea(_a) {
|
|
1359
|
+
var _b = _a, { className, onKeyDown } = _b, props = __objRest(_b, ["className", "onKeyDown"]);
|
|
1360
|
+
const { value, setValue, submit, isLoading } = usePromptInput();
|
|
1361
|
+
const ref = useRef(null);
|
|
1362
|
+
const handleInput = useCallback(() => {
|
|
1363
|
+
const el = ref.current;
|
|
1364
|
+
if (!el) return;
|
|
1365
|
+
el.style.height = "auto";
|
|
1366
|
+
el.style.height = `${Math.min(el.scrollHeight, 200)}px`;
|
|
1367
|
+
}, []);
|
|
1368
|
+
const handleKeyDown = useCallback(
|
|
1369
|
+
(e) => {
|
|
1370
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
1371
|
+
e.preventDefault();
|
|
1372
|
+
if (!isLoading) submit();
|
|
1373
|
+
}
|
|
1374
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
1375
|
+
},
|
|
1376
|
+
[submit, isLoading, onKeyDown]
|
|
1377
|
+
);
|
|
1378
|
+
return /* @__PURE__ */ jsx(
|
|
1379
|
+
"textarea",
|
|
1380
|
+
__spreadValues({
|
|
1381
|
+
ref,
|
|
1382
|
+
"data-slot": "prompt-input-textarea",
|
|
1383
|
+
value,
|
|
1384
|
+
onChange: (e) => {
|
|
1385
|
+
setValue(e.target.value);
|
|
1386
|
+
handleInput();
|
|
1387
|
+
},
|
|
1388
|
+
onKeyDown: handleKeyDown,
|
|
1389
|
+
placeholder: "Type a message...",
|
|
1390
|
+
rows: 1,
|
|
1391
|
+
disabled: isLoading,
|
|
1392
|
+
className: cn(
|
|
1393
|
+
"w-full resize-none bg-transparent px-4 py-3 text-foreground text-sm",
|
|
1394
|
+
"placeholder:text-muted-foreground",
|
|
1395
|
+
"focus:outline-none",
|
|
1396
|
+
"disabled:opacity-50",
|
|
1397
|
+
className
|
|
1398
|
+
)
|
|
1399
|
+
}, props)
|
|
1400
|
+
);
|
|
1401
|
+
}
|
|
1402
|
+
function PromptInputTools(_a) {
|
|
1403
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1404
|
+
return /* @__PURE__ */ jsx(
|
|
1405
|
+
"div",
|
|
1406
|
+
__spreadValues({
|
|
1407
|
+
"data-slot": "prompt-input-tools",
|
|
1408
|
+
className: cn("flex items-center gap-1", className)
|
|
1409
|
+
}, props)
|
|
1410
|
+
);
|
|
1411
|
+
}
|
|
1412
|
+
function PromptInputAttachButton(_a) {
|
|
1413
|
+
var _b = _a, {
|
|
1414
|
+
accept,
|
|
1415
|
+
multiple = true,
|
|
1416
|
+
className
|
|
1417
|
+
} = _b, props = __objRest(_b, [
|
|
1418
|
+
"accept",
|
|
1419
|
+
"multiple",
|
|
1420
|
+
"className"
|
|
1421
|
+
]);
|
|
1422
|
+
const { addFiles } = usePromptInput();
|
|
1423
|
+
const inputRef = useRef(null);
|
|
1424
|
+
const handleClick = useCallback(() => {
|
|
1425
|
+
var _a2;
|
|
1426
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.click();
|
|
1427
|
+
}, []);
|
|
1428
|
+
const handleChange = useCallback(
|
|
1429
|
+
(e) => {
|
|
1430
|
+
const fileList = e.target.files;
|
|
1431
|
+
if (fileList) {
|
|
1432
|
+
addFiles(Array.from(fileList));
|
|
1433
|
+
e.target.value = "";
|
|
1434
|
+
}
|
|
1435
|
+
},
|
|
1436
|
+
[addFiles]
|
|
1437
|
+
);
|
|
1438
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1439
|
+
/* @__PURE__ */ jsx(
|
|
1440
|
+
"input",
|
|
1441
|
+
{
|
|
1442
|
+
ref: inputRef,
|
|
1443
|
+
type: "file",
|
|
1444
|
+
accept,
|
|
1445
|
+
multiple,
|
|
1446
|
+
onChange: handleChange,
|
|
1447
|
+
className: "hidden",
|
|
1448
|
+
"aria-hidden": "true",
|
|
1449
|
+
tabIndex: -1
|
|
1450
|
+
}
|
|
1451
|
+
),
|
|
1452
|
+
/* @__PURE__ */ jsx(
|
|
1453
|
+
"button",
|
|
1454
|
+
__spreadProps(__spreadValues({
|
|
1455
|
+
"data-slot": "prompt-input-attach-button",
|
|
1456
|
+
type: "button",
|
|
1457
|
+
onClick: handleClick,
|
|
1458
|
+
"aria-label": "Attach files",
|
|
1459
|
+
className: cn(
|
|
1460
|
+
"inline-flex items-center justify-center rounded-md p-2",
|
|
1461
|
+
"text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
1462
|
+
className
|
|
1463
|
+
)
|
|
1464
|
+
}, props), {
|
|
1465
|
+
children: /* @__PURE__ */ jsx(Paperclip, { "aria-hidden": "true", className: "size-4" })
|
|
1466
|
+
})
|
|
1467
|
+
)
|
|
1468
|
+
] });
|
|
1469
|
+
}
|
|
1470
|
+
function PromptInputSubmit(_a) {
|
|
1471
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1472
|
+
const { value, files, isLoading } = usePromptInput();
|
|
1473
|
+
const hasContent = value.trim().length > 0 || files.length > 0;
|
|
1474
|
+
return /* @__PURE__ */ jsx(
|
|
1475
|
+
"button",
|
|
1476
|
+
__spreadProps(__spreadValues({
|
|
1477
|
+
"data-slot": "prompt-input-submit",
|
|
1478
|
+
type: "submit",
|
|
1479
|
+
disabled: !hasContent && !isLoading,
|
|
1480
|
+
"aria-label": isLoading ? "Stop generation" : "Send message",
|
|
1481
|
+
className: cn(
|
|
1482
|
+
"ml-auto inline-flex items-center justify-center rounded-full p-2",
|
|
1483
|
+
"transition-colors",
|
|
1484
|
+
isLoading ? "bg-destructive text-destructive-foreground hover:bg-destructive/90" : hasContent ? "bg-primary text-primary-foreground hover:bg-primary/90" : "bg-muted text-muted-foreground",
|
|
1485
|
+
className
|
|
1486
|
+
)
|
|
1487
|
+
}, props), {
|
|
1488
|
+
children: isLoading ? /* @__PURE__ */ jsx(Square, { className: "size-4" }) : /* @__PURE__ */ jsx(ArrowUp, { className: "size-4" })
|
|
1489
|
+
})
|
|
1490
|
+
);
|
|
1491
|
+
}
|
|
1492
|
+
function PromptInputFiles(_a) {
|
|
1493
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1494
|
+
const { files, removeFile } = usePromptInput();
|
|
1495
|
+
if (files.length === 0) return null;
|
|
1496
|
+
return /* @__PURE__ */ jsx(
|
|
1497
|
+
"div",
|
|
1498
|
+
__spreadProps(__spreadValues({
|
|
1499
|
+
"data-slot": "prompt-input-files",
|
|
1500
|
+
className: cn("flex flex-wrap gap-2 px-4 pt-2", className)
|
|
1501
|
+
}, props), {
|
|
1502
|
+
children: files.map((file, i) => /* @__PURE__ */ jsxs(
|
|
1503
|
+
"span",
|
|
1504
|
+
{
|
|
1505
|
+
className: "inline-flex items-center gap-1.5 rounded-lg border border-border bg-muted/50 px-2.5 py-1 text-foreground text-xs",
|
|
1506
|
+
children: [
|
|
1507
|
+
file.name,
|
|
1508
|
+
/* @__PURE__ */ jsx(
|
|
1509
|
+
"button",
|
|
1510
|
+
{
|
|
1511
|
+
type: "button",
|
|
1512
|
+
onClick: () => removeFile(i),
|
|
1513
|
+
"aria-label": `Remove ${file.name}`,
|
|
1514
|
+
className: "rounded-full p-0.5 text-muted-foreground transition-colors hover:text-foreground",
|
|
1515
|
+
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", className: "size-3" })
|
|
1516
|
+
}
|
|
1517
|
+
)
|
|
1518
|
+
]
|
|
1519
|
+
},
|
|
1520
|
+
`${file.name}-${i}`
|
|
1521
|
+
))
|
|
1522
|
+
})
|
|
1523
|
+
);
|
|
1524
|
+
}
|
|
1525
|
+
var QueueSectionContext = createContext(null);
|
|
1526
|
+
function QueueSection(_a) {
|
|
1527
|
+
var _b = _a, {
|
|
1528
|
+
defaultOpen = true,
|
|
1529
|
+
className,
|
|
1530
|
+
children
|
|
1531
|
+
} = _b, props = __objRest(_b, [
|
|
1532
|
+
"defaultOpen",
|
|
1533
|
+
"className",
|
|
1534
|
+
"children"
|
|
1535
|
+
]);
|
|
1536
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
1537
|
+
const toggle = useCallback(() => setOpen((o) => !o), []);
|
|
1538
|
+
const contentId = useId();
|
|
1539
|
+
return /* @__PURE__ */ jsx(QueueSectionContext.Provider, { value: { open, toggle, contentId }, children: /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ "data-slot": "queue-section", className: cn("space-y-1", className) }, props), { children })) });
|
|
1540
|
+
}
|
|
1541
|
+
function QueueSectionTrigger(_a) {
|
|
1542
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1543
|
+
const ctx = useContext(QueueSectionContext);
|
|
1544
|
+
if (!ctx) throw new Error("QueueSectionTrigger must be used within <QueueSection>");
|
|
1545
|
+
return /* @__PURE__ */ jsxs(
|
|
1546
|
+
"button",
|
|
1547
|
+
__spreadProps(__spreadValues({
|
|
1548
|
+
"data-slot": "queue-section-trigger",
|
|
1549
|
+
type: "button",
|
|
1550
|
+
onClick: ctx.toggle,
|
|
1551
|
+
"aria-expanded": ctx.open,
|
|
1552
|
+
"aria-controls": ctx.contentId,
|
|
1553
|
+
className: cn(
|
|
1554
|
+
"flex w-full items-center gap-2 px-2 py-1.5 font-medium text-muted-foreground text-xs",
|
|
1555
|
+
"rounded-md transition-colors hover:text-foreground",
|
|
1556
|
+
className
|
|
1557
|
+
)
|
|
1558
|
+
}, props), {
|
|
1559
|
+
children: [
|
|
1560
|
+
/* @__PURE__ */ jsx(
|
|
1561
|
+
ChevronDown,
|
|
1562
|
+
{
|
|
1563
|
+
"aria-hidden": "true",
|
|
1564
|
+
className: cn(
|
|
1565
|
+
"size-3.5 shrink-0 transition-transform duration-200",
|
|
1566
|
+
ctx.open && "rotate-180"
|
|
1567
|
+
)
|
|
1568
|
+
}
|
|
1569
|
+
),
|
|
1570
|
+
props.children
|
|
1571
|
+
]
|
|
1572
|
+
})
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
function QueueSectionLabel(_a) {
|
|
1576
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1577
|
+
return /* @__PURE__ */ jsx(
|
|
1578
|
+
"span",
|
|
1579
|
+
__spreadValues({
|
|
1580
|
+
"data-slot": "queue-section-label",
|
|
1581
|
+
className: cn("flex-1 text-left", className)
|
|
1582
|
+
}, props)
|
|
1583
|
+
);
|
|
1584
|
+
}
|
|
1585
|
+
function QueueList(_a) {
|
|
1586
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1587
|
+
const ctx = useContext(QueueSectionContext);
|
|
1588
|
+
if (ctx && !ctx.open) return null;
|
|
1589
|
+
return /* @__PURE__ */ jsx(
|
|
1590
|
+
"div",
|
|
1591
|
+
__spreadValues({
|
|
1592
|
+
id: ctx == null ? void 0 : ctx.contentId,
|
|
1593
|
+
"data-slot": "queue-list",
|
|
1594
|
+
role: "list",
|
|
1595
|
+
className: cn("space-y-1", className)
|
|
1596
|
+
}, props)
|
|
1597
|
+
);
|
|
1598
|
+
}
|
|
1599
|
+
var queueItemIndicatorVariants = cva("size-2 shrink-0 rounded-full", {
|
|
1600
|
+
variants: {
|
|
1601
|
+
status: {
|
|
1602
|
+
pending: "bg-muted-foreground/30",
|
|
1603
|
+
active: "bg-primary animate-pulse",
|
|
1604
|
+
complete: "bg-emerald-500",
|
|
1605
|
+
error: "bg-red-500"
|
|
1606
|
+
}
|
|
1607
|
+
},
|
|
1608
|
+
defaultVariants: { status: "pending" }
|
|
1609
|
+
});
|
|
1610
|
+
function QueueItem(_a) {
|
|
1611
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1612
|
+
return /* @__PURE__ */ jsx(
|
|
1613
|
+
"div",
|
|
1614
|
+
__spreadValues({
|
|
1615
|
+
"data-slot": "queue-item",
|
|
1616
|
+
role: "listitem",
|
|
1617
|
+
className: cn(
|
|
1618
|
+
"flex items-start gap-3 rounded-lg px-3 py-2.5",
|
|
1619
|
+
"transition-colors hover:bg-muted/50",
|
|
1620
|
+
className
|
|
1621
|
+
)
|
|
1622
|
+
}, props)
|
|
1623
|
+
);
|
|
1624
|
+
}
|
|
1625
|
+
function QueueItemIndicator(_a) {
|
|
1626
|
+
var _b = _a, {
|
|
1627
|
+
status = "pending",
|
|
1628
|
+
className
|
|
1629
|
+
} = _b, props = __objRest(_b, [
|
|
1630
|
+
"status",
|
|
1631
|
+
"className"
|
|
1632
|
+
]);
|
|
1633
|
+
return /* @__PURE__ */ jsx(
|
|
1634
|
+
"span",
|
|
1635
|
+
__spreadValues({
|
|
1636
|
+
"data-slot": "queue-item-indicator",
|
|
1637
|
+
role: "img",
|
|
1638
|
+
"aria-label": status,
|
|
1639
|
+
className: cn(queueItemIndicatorVariants({ status }), "mt-1.5", className)
|
|
1640
|
+
}, props)
|
|
1641
|
+
);
|
|
1642
|
+
}
|
|
1643
|
+
function QueueItemContent(_a) {
|
|
1644
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1645
|
+
return /* @__PURE__ */ jsx("div", __spreadValues({ "data-slot": "queue-item-content", className: cn("min-w-0 flex-1", className) }, props));
|
|
1646
|
+
}
|
|
1647
|
+
function QueueItemDescription(_a) {
|
|
1648
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1649
|
+
return /* @__PURE__ */ jsx(
|
|
1650
|
+
"p",
|
|
1651
|
+
__spreadValues({
|
|
1652
|
+
"data-slot": "queue-item-description",
|
|
1653
|
+
className: cn("mt-0.5 text-muted-foreground text-xs", className)
|
|
1654
|
+
}, props)
|
|
1655
|
+
);
|
|
1656
|
+
}
|
|
1657
|
+
function QueueItemActions(_a) {
|
|
1658
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1659
|
+
return /* @__PURE__ */ jsx(
|
|
1660
|
+
"div",
|
|
1661
|
+
__spreadValues({
|
|
1662
|
+
"data-slot": "queue-item-actions",
|
|
1663
|
+
className: cn("flex shrink-0 items-center gap-1", className)
|
|
1664
|
+
}, props)
|
|
1665
|
+
);
|
|
1666
|
+
}
|
|
1667
|
+
var ReasoningContext = createContext(null);
|
|
1668
|
+
function useReasoning() {
|
|
1669
|
+
const ctx = useContext(ReasoningContext);
|
|
1670
|
+
if (!ctx) throw new Error("useReasoning must be used within <Reasoning>");
|
|
1671
|
+
return ctx;
|
|
1672
|
+
}
|
|
1673
|
+
function Reasoning(_a) {
|
|
1674
|
+
var _b = _a, {
|
|
1675
|
+
defaultOpen = false,
|
|
1676
|
+
className,
|
|
1677
|
+
children
|
|
1678
|
+
} = _b, props = __objRest(_b, [
|
|
1679
|
+
"defaultOpen",
|
|
1680
|
+
"className",
|
|
1681
|
+
"children"
|
|
1682
|
+
]);
|
|
1683
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
1684
|
+
const toggle = useCallback(() => setOpen((o) => !o), []);
|
|
1685
|
+
const contentId = useId();
|
|
1686
|
+
return /* @__PURE__ */ jsx(ReasoningContext.Provider, { value: { open, toggle, contentId }, children: /* @__PURE__ */ jsx(
|
|
1687
|
+
"div",
|
|
1688
|
+
__spreadProps(__spreadValues({
|
|
1689
|
+
"data-slot": "reasoning",
|
|
1690
|
+
"data-state": open ? "open" : "closed",
|
|
1691
|
+
className: cn("rounded-xl border border-border bg-card", className)
|
|
1692
|
+
}, props), {
|
|
1693
|
+
children
|
|
1694
|
+
})
|
|
1695
|
+
) });
|
|
1696
|
+
}
|
|
1697
|
+
function ReasoningTrigger(_a) {
|
|
1698
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
1699
|
+
const { open, toggle, contentId } = useReasoning();
|
|
1700
|
+
return /* @__PURE__ */ jsxs(
|
|
1701
|
+
"button",
|
|
1702
|
+
__spreadProps(__spreadValues({
|
|
1703
|
+
"data-slot": "reasoning-trigger",
|
|
1704
|
+
type: "button",
|
|
1705
|
+
onClick: toggle,
|
|
1706
|
+
"aria-expanded": open,
|
|
1707
|
+
"aria-controls": contentId,
|
|
1708
|
+
className: cn(
|
|
1709
|
+
"flex w-full items-center gap-2 px-4 py-3 font-medium text-muted-foreground text-sm",
|
|
1710
|
+
"transition-colors hover:text-foreground",
|
|
1711
|
+
className
|
|
1712
|
+
)
|
|
1713
|
+
}, props), {
|
|
1714
|
+
children: [
|
|
1715
|
+
/* @__PURE__ */ jsx(
|
|
1716
|
+
ChevronDown,
|
|
1717
|
+
{
|
|
1718
|
+
"aria-hidden": "true",
|
|
1719
|
+
className: cn("size-4 shrink-0 transition-transform duration-200", open && "rotate-180")
|
|
1720
|
+
}
|
|
1721
|
+
),
|
|
1722
|
+
children != null ? children : open ? "Hide reasoning" : "Show reasoning"
|
|
1723
|
+
]
|
|
1724
|
+
})
|
|
1725
|
+
);
|
|
1726
|
+
}
|
|
1727
|
+
function ReasoningContent(_a) {
|
|
1728
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1729
|
+
const { open, contentId } = useReasoning();
|
|
1730
|
+
if (!open) return null;
|
|
1731
|
+
return /* @__PURE__ */ jsx(
|
|
1732
|
+
"div",
|
|
1733
|
+
__spreadValues({
|
|
1734
|
+
id: contentId,
|
|
1735
|
+
"data-slot": "reasoning-content",
|
|
1736
|
+
role: "region",
|
|
1737
|
+
className: cn(
|
|
1738
|
+
"border-border border-t px-4 py-3",
|
|
1739
|
+
"font-mono text-muted-foreground text-sm leading-relaxed",
|
|
1740
|
+
className
|
|
1741
|
+
)
|
|
1742
|
+
}, props)
|
|
1743
|
+
);
|
|
1744
|
+
}
|
|
1745
|
+
function Shimmer(_a) {
|
|
1746
|
+
var _b = _a, {
|
|
1747
|
+
as,
|
|
1748
|
+
className,
|
|
1749
|
+
duration = 2,
|
|
1750
|
+
spread = 0.3,
|
|
1751
|
+
style
|
|
1752
|
+
} = _b, props = __objRest(_b, [
|
|
1753
|
+
"as",
|
|
1754
|
+
"className",
|
|
1755
|
+
"duration",
|
|
1756
|
+
"spread",
|
|
1757
|
+
"style"
|
|
1758
|
+
]);
|
|
1759
|
+
const Component = as || "p";
|
|
1760
|
+
return /* @__PURE__ */ jsx(
|
|
1761
|
+
Component,
|
|
1762
|
+
__spreadValues({
|
|
1763
|
+
"data-slot": "shimmer",
|
|
1764
|
+
role: "status",
|
|
1765
|
+
"aria-label": "Loading",
|
|
1766
|
+
className: cn(
|
|
1767
|
+
"animate-shimmer bg-clip-text text-transparent",
|
|
1768
|
+
"bg-[length:200%_100%]",
|
|
1769
|
+
"bg-gradient-to-r from-muted-foreground via-foreground to-muted-foreground",
|
|
1770
|
+
className
|
|
1771
|
+
),
|
|
1772
|
+
style: __spreadValues({
|
|
1773
|
+
animationDuration: `${duration}s`
|
|
1774
|
+
}, style)
|
|
1775
|
+
}, props)
|
|
1776
|
+
);
|
|
1777
|
+
}
|
|
1778
|
+
var SourcesContext = createContext(null);
|
|
1779
|
+
function Sources(_a) {
|
|
1780
|
+
var _b = _a, {
|
|
1781
|
+
defaultOpen = false,
|
|
1782
|
+
className,
|
|
1783
|
+
children
|
|
1784
|
+
} = _b, props = __objRest(_b, [
|
|
1785
|
+
"defaultOpen",
|
|
1786
|
+
"className",
|
|
1787
|
+
"children"
|
|
1788
|
+
]);
|
|
1789
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
1790
|
+
const toggle = useCallback(() => setOpen((o) => !o), []);
|
|
1791
|
+
const contentId = useId();
|
|
1792
|
+
return /* @__PURE__ */ jsx(SourcesContext.Provider, { value: { open, toggle, contentId }, children: /* @__PURE__ */ jsx(
|
|
1793
|
+
"div",
|
|
1794
|
+
__spreadProps(__spreadValues({
|
|
1795
|
+
"data-slot": "sources",
|
|
1796
|
+
"data-state": open ? "open" : "closed",
|
|
1797
|
+
className: cn("rounded-xl border border-border bg-card", className)
|
|
1798
|
+
}, props), {
|
|
1799
|
+
children
|
|
1800
|
+
})
|
|
1801
|
+
) });
|
|
1802
|
+
}
|
|
1803
|
+
function SourcesTrigger(_a) {
|
|
1804
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
1805
|
+
const ctx = useContext(SourcesContext);
|
|
1806
|
+
if (!ctx) throw new Error("SourcesTrigger must be used within <Sources>");
|
|
1807
|
+
return /* @__PURE__ */ jsxs(
|
|
1808
|
+
"button",
|
|
1809
|
+
__spreadProps(__spreadValues({
|
|
1810
|
+
"data-slot": "sources-trigger",
|
|
1811
|
+
type: "button",
|
|
1812
|
+
onClick: ctx.toggle,
|
|
1813
|
+
"aria-expanded": ctx.open,
|
|
1814
|
+
"aria-controls": ctx.contentId,
|
|
1815
|
+
className: cn(
|
|
1816
|
+
"flex w-full items-center gap-2 px-4 py-3 font-medium text-muted-foreground text-sm",
|
|
1817
|
+
"transition-colors hover:text-foreground",
|
|
1818
|
+
className
|
|
1819
|
+
)
|
|
1820
|
+
}, props), {
|
|
1821
|
+
children: [
|
|
1822
|
+
/* @__PURE__ */ jsx(
|
|
1823
|
+
ChevronDown,
|
|
1824
|
+
{
|
|
1825
|
+
"aria-hidden": "true",
|
|
1826
|
+
className: cn(
|
|
1827
|
+
"size-4 shrink-0 transition-transform duration-200",
|
|
1828
|
+
ctx.open && "rotate-180"
|
|
1829
|
+
)
|
|
1830
|
+
}
|
|
1831
|
+
),
|
|
1832
|
+
children != null ? children : `${ctx.open ? "Hide" : "Show"} sources`
|
|
1833
|
+
]
|
|
1834
|
+
})
|
|
1835
|
+
);
|
|
1836
|
+
}
|
|
1837
|
+
function SourcesContent(_a) {
|
|
1838
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1839
|
+
const ctx = useContext(SourcesContext);
|
|
1840
|
+
if (!ctx) throw new Error("SourcesContent must be used within <Sources>");
|
|
1841
|
+
if (!ctx.open) return null;
|
|
1842
|
+
return /* @__PURE__ */ jsx(
|
|
1843
|
+
"div",
|
|
1844
|
+
__spreadValues({
|
|
1845
|
+
id: ctx.contentId,
|
|
1846
|
+
"data-slot": "sources-content",
|
|
1847
|
+
role: "region",
|
|
1848
|
+
className: cn("space-y-2 border-border border-t px-4 py-3", className)
|
|
1849
|
+
}, props)
|
|
1850
|
+
);
|
|
1851
|
+
}
|
|
1852
|
+
function Source(_a) {
|
|
1853
|
+
var _b = _a, {
|
|
1854
|
+
href,
|
|
1855
|
+
title,
|
|
1856
|
+
description,
|
|
1857
|
+
favicon,
|
|
1858
|
+
className
|
|
1859
|
+
} = _b, props = __objRest(_b, [
|
|
1860
|
+
"href",
|
|
1861
|
+
"title",
|
|
1862
|
+
"description",
|
|
1863
|
+
"favicon",
|
|
1864
|
+
"className"
|
|
1865
|
+
]);
|
|
1866
|
+
return /* @__PURE__ */ jsxs(
|
|
1867
|
+
"a",
|
|
1868
|
+
__spreadProps(__spreadValues({
|
|
1869
|
+
"data-slot": "source",
|
|
1870
|
+
href,
|
|
1871
|
+
target: "_blank",
|
|
1872
|
+
rel: "noopener noreferrer",
|
|
1873
|
+
className: cn(
|
|
1874
|
+
"flex items-start gap-3 rounded-lg p-3 transition-colors",
|
|
1875
|
+
"hover:bg-muted/50",
|
|
1876
|
+
className
|
|
1877
|
+
)
|
|
1878
|
+
}, props), {
|
|
1879
|
+
children: [
|
|
1880
|
+
favicon && /* @__PURE__ */ jsx("img", { src: favicon, alt: "", className: "mt-0.5 size-4 shrink-0 rounded" }),
|
|
1881
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1882
|
+
/* @__PURE__ */ jsx("p", { className: "truncate font-medium text-foreground text-sm", children: title }),
|
|
1883
|
+
description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 line-clamp-2 text-muted-foreground text-xs", children: description })
|
|
1884
|
+
] }),
|
|
1885
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "mt-0.5 size-3.5 shrink-0 text-muted-foreground" })
|
|
1886
|
+
]
|
|
1887
|
+
})
|
|
1888
|
+
);
|
|
1889
|
+
}
|
|
1890
|
+
function Suggestions(_a) {
|
|
1891
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1892
|
+
return /* @__PURE__ */ jsx("div", __spreadValues({ "data-slot": "suggestions", className: cn("flex flex-wrap gap-2", className) }, props));
|
|
1893
|
+
}
|
|
1894
|
+
function Suggestion(_a) {
|
|
1895
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1896
|
+
return /* @__PURE__ */ jsx(
|
|
1897
|
+
"button",
|
|
1898
|
+
__spreadValues({
|
|
1899
|
+
"data-slot": "suggestion",
|
|
1900
|
+
type: "button",
|
|
1901
|
+
className: cn(
|
|
1902
|
+
"inline-flex items-center gap-2 rounded-full border border-border bg-card px-4 py-2",
|
|
1903
|
+
"text-foreground text-sm transition-colors",
|
|
1904
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
1905
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
1906
|
+
className
|
|
1907
|
+
)
|
|
1908
|
+
}, props)
|
|
1909
|
+
);
|
|
1910
|
+
}
|
|
1911
|
+
var TaskContext = createContext(null);
|
|
1912
|
+
var statusIcons = {
|
|
1913
|
+
pending: Circle,
|
|
1914
|
+
running: Loader2,
|
|
1915
|
+
complete: Check,
|
|
1916
|
+
error: Circle
|
|
1917
|
+
};
|
|
1918
|
+
function Task(_a) {
|
|
1919
|
+
var _b = _a, {
|
|
1920
|
+
defaultOpen = false,
|
|
1921
|
+
className,
|
|
1922
|
+
children
|
|
1923
|
+
} = _b, props = __objRest(_b, [
|
|
1924
|
+
"defaultOpen",
|
|
1925
|
+
"className",
|
|
1926
|
+
"children"
|
|
1927
|
+
]);
|
|
1928
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
1929
|
+
const toggle = useCallback(() => setOpen((o) => !o), []);
|
|
1930
|
+
const contentId = useId();
|
|
1931
|
+
return /* @__PURE__ */ jsx(TaskContext.Provider, { value: { open, toggle, contentId }, children: /* @__PURE__ */ jsx(
|
|
1932
|
+
"div",
|
|
1933
|
+
__spreadProps(__spreadValues({
|
|
1934
|
+
"data-slot": "task",
|
|
1935
|
+
"data-state": open ? "open" : "closed",
|
|
1936
|
+
className: cn("rounded-xl border border-border bg-card", className)
|
|
1937
|
+
}, props), {
|
|
1938
|
+
children
|
|
1939
|
+
})
|
|
1940
|
+
) });
|
|
1941
|
+
}
|
|
1942
|
+
function TaskTrigger(_a) {
|
|
1943
|
+
var _b = _a, {
|
|
1944
|
+
status = "pending",
|
|
1945
|
+
className,
|
|
1946
|
+
children
|
|
1947
|
+
} = _b, props = __objRest(_b, [
|
|
1948
|
+
"status",
|
|
1949
|
+
"className",
|
|
1950
|
+
"children"
|
|
1951
|
+
]);
|
|
1952
|
+
const ctx = useContext(TaskContext);
|
|
1953
|
+
if (!ctx) throw new Error("TaskTrigger must be used within <Task>");
|
|
1954
|
+
const Icon = statusIcons[status];
|
|
1955
|
+
return /* @__PURE__ */ jsxs(
|
|
1956
|
+
"button",
|
|
1957
|
+
__spreadProps(__spreadValues({
|
|
1958
|
+
"data-slot": "task-trigger",
|
|
1959
|
+
type: "button",
|
|
1960
|
+
onClick: ctx.toggle,
|
|
1961
|
+
"aria-expanded": ctx.open,
|
|
1962
|
+
"aria-controls": ctx.contentId,
|
|
1963
|
+
className: cn(
|
|
1964
|
+
"flex w-full items-center gap-2.5 px-4 py-3 text-sm",
|
|
1965
|
+
"text-foreground transition-colors hover:bg-muted/50",
|
|
1966
|
+
className
|
|
1967
|
+
)
|
|
1968
|
+
}, props), {
|
|
1969
|
+
children: [
|
|
1970
|
+
/* @__PURE__ */ jsx(
|
|
1971
|
+
Icon,
|
|
1972
|
+
{
|
|
1973
|
+
"aria-hidden": "true",
|
|
1974
|
+
className: cn(
|
|
1975
|
+
"size-4 shrink-0",
|
|
1976
|
+
status === "complete" && "text-emerald-500",
|
|
1977
|
+
status === "running" && "animate-spin text-primary",
|
|
1978
|
+
status === "error" && "text-red-500",
|
|
1979
|
+
status === "pending" && "text-muted-foreground"
|
|
1980
|
+
)
|
|
1981
|
+
}
|
|
1982
|
+
),
|
|
1983
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-left font-medium", children }),
|
|
1984
|
+
/* @__PURE__ */ jsx(
|
|
1985
|
+
ChevronDown,
|
|
1986
|
+
{
|
|
1987
|
+
"aria-hidden": "true",
|
|
1988
|
+
className: cn(
|
|
1989
|
+
"size-4 shrink-0 text-muted-foreground transition-transform duration-200",
|
|
1990
|
+
ctx.open && "rotate-180"
|
|
1991
|
+
)
|
|
1992
|
+
}
|
|
1993
|
+
)
|
|
1994
|
+
]
|
|
1995
|
+
})
|
|
1996
|
+
);
|
|
1997
|
+
}
|
|
1998
|
+
function TaskContent(_a) {
|
|
1999
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2000
|
+
const ctx = useContext(TaskContext);
|
|
2001
|
+
if (!(ctx == null ? void 0 : ctx.open)) return null;
|
|
2002
|
+
return /* @__PURE__ */ jsx(
|
|
2003
|
+
"div",
|
|
2004
|
+
__spreadValues({
|
|
2005
|
+
id: ctx.contentId,
|
|
2006
|
+
"data-slot": "task-content",
|
|
2007
|
+
role: "region",
|
|
2008
|
+
className: cn(
|
|
2009
|
+
"space-y-2 border-border border-t px-4 py-3 text-muted-foreground text-sm",
|
|
2010
|
+
className
|
|
2011
|
+
)
|
|
2012
|
+
}, props)
|
|
2013
|
+
);
|
|
2014
|
+
}
|
|
2015
|
+
function TaskItem(_a) {
|
|
2016
|
+
var _b = _a, {
|
|
2017
|
+
status = "pending",
|
|
2018
|
+
className
|
|
2019
|
+
} = _b, props = __objRest(_b, [
|
|
2020
|
+
"status",
|
|
2021
|
+
"className"
|
|
2022
|
+
]);
|
|
2023
|
+
const Icon = statusIcons[status];
|
|
2024
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ "data-slot": "task-item", className: cn("flex items-center gap-2 py-1", className) }, props), { children: [
|
|
2025
|
+
/* @__PURE__ */ jsx(
|
|
2026
|
+
Icon,
|
|
2027
|
+
{
|
|
2028
|
+
className: cn(
|
|
2029
|
+
"size-3.5 shrink-0",
|
|
2030
|
+
status === "complete" && "text-emerald-500",
|
|
2031
|
+
status === "running" && "animate-spin text-primary",
|
|
2032
|
+
status === "error" && "text-red-500",
|
|
2033
|
+
status === "pending" && "text-muted-foreground/50"
|
|
2034
|
+
)
|
|
2035
|
+
}
|
|
2036
|
+
),
|
|
2037
|
+
/* @__PURE__ */ jsx(
|
|
2038
|
+
"span",
|
|
2039
|
+
{
|
|
2040
|
+
className: cn("text-sm", status === "complete" && "text-muted-foreground line-through"),
|
|
2041
|
+
children: props.children
|
|
2042
|
+
}
|
|
2043
|
+
)
|
|
2044
|
+
] }));
|
|
2045
|
+
}
|
|
2046
|
+
function TaskItemFile(_a) {
|
|
2047
|
+
var _b = _a, {
|
|
2048
|
+
filename,
|
|
2049
|
+
className
|
|
2050
|
+
} = _b, props = __objRest(_b, [
|
|
2051
|
+
"filename",
|
|
2052
|
+
"className"
|
|
2053
|
+
]);
|
|
2054
|
+
return /* @__PURE__ */ jsx(
|
|
2055
|
+
"span",
|
|
2056
|
+
__spreadProps(__spreadValues({
|
|
2057
|
+
"data-slot": "task-item-file",
|
|
2058
|
+
className: cn(
|
|
2059
|
+
"inline-flex items-center rounded bg-muted px-1.5 py-0.5 font-mono text-xs",
|
|
2060
|
+
className
|
|
2061
|
+
)
|
|
2062
|
+
}, props), {
|
|
2063
|
+
children: filename
|
|
2064
|
+
})
|
|
2065
|
+
);
|
|
2066
|
+
}
|
|
2067
|
+
var ToolContext = createContext(null);
|
|
2068
|
+
var statusBadgeVariants = cva(
|
|
2069
|
+
"inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider",
|
|
2070
|
+
{
|
|
2071
|
+
variants: {
|
|
2072
|
+
status: {
|
|
2073
|
+
pending: "bg-muted text-muted-foreground",
|
|
2074
|
+
running: "bg-primary/10 text-primary",
|
|
2075
|
+
success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
|
|
2076
|
+
error: "bg-red-500/10 text-red-600 dark:text-red-400"
|
|
2077
|
+
}
|
|
2078
|
+
},
|
|
2079
|
+
defaultVariants: { status: "pending" }
|
|
2080
|
+
}
|
|
2081
|
+
);
|
|
2082
|
+
function getStatusLabel(status) {
|
|
2083
|
+
switch (status) {
|
|
2084
|
+
case "pending":
|
|
2085
|
+
return "Pending";
|
|
2086
|
+
case "running":
|
|
2087
|
+
return "Running";
|
|
2088
|
+
case "success":
|
|
2089
|
+
return "Done";
|
|
2090
|
+
case "error":
|
|
2091
|
+
return "Error";
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
function Tool(_a) {
|
|
2095
|
+
var _b = _a, {
|
|
2096
|
+
defaultOpen = false,
|
|
2097
|
+
className,
|
|
2098
|
+
children
|
|
2099
|
+
} = _b, props = __objRest(_b, [
|
|
2100
|
+
"defaultOpen",
|
|
2101
|
+
"className",
|
|
2102
|
+
"children"
|
|
2103
|
+
]);
|
|
2104
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
2105
|
+
const toggle = useCallback(() => setOpen((o) => !o), []);
|
|
2106
|
+
const contentId = useId();
|
|
2107
|
+
return /* @__PURE__ */ jsx(ToolContext.Provider, { value: { open, toggle, contentId }, children: /* @__PURE__ */ jsx(
|
|
2108
|
+
"div",
|
|
2109
|
+
__spreadProps(__spreadValues({
|
|
2110
|
+
"data-slot": "tool",
|
|
2111
|
+
"data-state": open ? "open" : "closed",
|
|
2112
|
+
className: cn("rounded-xl border border-border bg-card", className)
|
|
2113
|
+
}, props), {
|
|
2114
|
+
children
|
|
2115
|
+
})
|
|
2116
|
+
) });
|
|
2117
|
+
}
|
|
2118
|
+
function ToolHeader(_a) {
|
|
2119
|
+
var _b = _a, {
|
|
2120
|
+
name,
|
|
2121
|
+
status = "pending",
|
|
2122
|
+
icon,
|
|
2123
|
+
className
|
|
2124
|
+
} = _b, props = __objRest(_b, [
|
|
2125
|
+
"name",
|
|
2126
|
+
"status",
|
|
2127
|
+
"icon",
|
|
2128
|
+
"className"
|
|
2129
|
+
]);
|
|
2130
|
+
const ctx = useContext(ToolContext);
|
|
2131
|
+
if (!ctx) throw new Error("ToolHeader must be used within <Tool>");
|
|
2132
|
+
return /* @__PURE__ */ jsxs(
|
|
2133
|
+
"button",
|
|
2134
|
+
__spreadProps(__spreadValues({
|
|
2135
|
+
"data-slot": "tool-header",
|
|
2136
|
+
type: "button",
|
|
2137
|
+
onClick: ctx.toggle,
|
|
2138
|
+
"aria-expanded": ctx.open,
|
|
2139
|
+
"aria-controls": ctx.contentId,
|
|
2140
|
+
className: cn(
|
|
2141
|
+
"flex w-full items-center gap-2.5 px-4 py-3 text-sm transition-colors hover:bg-muted/50",
|
|
2142
|
+
className
|
|
2143
|
+
)
|
|
2144
|
+
}, props), {
|
|
2145
|
+
children: [
|
|
2146
|
+
icon != null ? icon : /* @__PURE__ */ jsx(Terminal, { "aria-hidden": "true", className: "size-4 shrink-0 text-muted-foreground" }),
|
|
2147
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-left font-medium font-mono text-foreground", children: name }),
|
|
2148
|
+
/* @__PURE__ */ jsx("span", { className: statusBadgeVariants({ status }), children: getStatusLabel(status) }),
|
|
2149
|
+
/* @__PURE__ */ jsx(
|
|
2150
|
+
ChevronDown,
|
|
2151
|
+
{
|
|
2152
|
+
"aria-hidden": "true",
|
|
2153
|
+
className: cn(
|
|
2154
|
+
"size-4 shrink-0 text-muted-foreground transition-transform duration-200",
|
|
2155
|
+
ctx.open && "rotate-180"
|
|
2156
|
+
)
|
|
2157
|
+
}
|
|
2158
|
+
)
|
|
2159
|
+
]
|
|
2160
|
+
})
|
|
2161
|
+
);
|
|
2162
|
+
}
|
|
2163
|
+
function ToolContent(_a) {
|
|
2164
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2165
|
+
const ctx = useContext(ToolContext);
|
|
2166
|
+
if (!(ctx == null ? void 0 : ctx.open)) return null;
|
|
2167
|
+
return /* @__PURE__ */ jsx(
|
|
2168
|
+
"div",
|
|
2169
|
+
__spreadValues({
|
|
2170
|
+
id: ctx.contentId,
|
|
2171
|
+
"data-slot": "tool-content",
|
|
2172
|
+
role: "region",
|
|
2173
|
+
className: cn("border-border border-t", className)
|
|
2174
|
+
}, props)
|
|
2175
|
+
);
|
|
2176
|
+
}
|
|
2177
|
+
function ToolInput(_a) {
|
|
2178
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2179
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ "data-slot": "tool-input", className: cn("space-y-1 px-4 py-3", className) }, props), { children: [
|
|
2180
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium text-[10px] text-muted-foreground uppercase tracking-wider", children: "Input" }),
|
|
2181
|
+
/* @__PURE__ */ jsx("pre", { className: "overflow-x-auto rounded-lg bg-muted p-3 font-mono text-xs", children: props.children })
|
|
2182
|
+
] }));
|
|
2183
|
+
}
|
|
2184
|
+
function ToolOutput(_a) {
|
|
2185
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2186
|
+
return /* @__PURE__ */ jsxs(
|
|
2187
|
+
"div",
|
|
2188
|
+
__spreadProps(__spreadValues({
|
|
2189
|
+
"data-slot": "tool-output",
|
|
2190
|
+
className: cn("space-y-1 border-border border-t px-4 py-3", className)
|
|
2191
|
+
}, props), {
|
|
2192
|
+
children: [
|
|
2193
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium text-[10px] text-muted-foreground uppercase tracking-wider", children: "Output" }),
|
|
2194
|
+
/* @__PURE__ */ jsx("pre", { className: "overflow-x-auto rounded-lg bg-muted p-3 font-mono text-xs", children: props.children })
|
|
2195
|
+
]
|
|
2196
|
+
})
|
|
2197
|
+
);
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
export { Attachment, Attachments, ChainOfThought, ChainOfThoughtContent, ChainOfThoughtHeader, ChainOfThoughtSearchResult, ChainOfThoughtSearchResults, ChainOfThoughtStep, Checkpoint, CheckpointIcon, CheckpointTrigger, Confirmation, ConfirmationAccepted, ConfirmationAction, ConfirmationActions, ConfirmationRejected, ConfirmationRequest, Context, ContextBody, ContextHeader, ContextUsage, Conversation, ConversationContent, ConversationDownload, ConversationEmptyState, ConversationScrollButton, InlineCitation, InlineCitationCard, Message, MessageAction, MessageActions, MessageAttachments, MessageAvatar, MessageBranch, MessageBranchSelector, MessageContent, MessageCopyAction, MessageFeedbackActions, MessageRegenerateAction, MessageResponse, ModelSelector, ModelSelectorContent, ModelSelectorEmpty, ModelSelectorGroup, ModelSelectorInput, ModelSelectorItem, ModelSelectorList, ModelSelectorSeparator, ModelSelectorTrigger, Plan, PlanAction, PlanContent, PlanDescription, PlanFooter, PlanHeader, PlanTitle, PlanTrigger, PromptInput, PromptInputAttachButton, PromptInputBody, PromptInputFiles, PromptInputFooter, PromptInputHeader, PromptInputSubmit, PromptInputTextarea, PromptInputTools, QueueItem, QueueItemActions, QueueItemContent, QueueItemDescription, QueueItemIndicator, QueueList, QueueSection, QueueSectionLabel, QueueSectionTrigger, Reasoning, ReasoningContent, ReasoningTrigger, Shimmer, Source, Sources, SourcesContent, SourcesTrigger, Suggestion, Suggestions, Task, TaskContent, TaskItem, TaskItemFile, TaskTrigger, Tool, ToolContent, ToolHeader, ToolInput, ToolOutput, confirmationVariants, getStatusLabel, messageVariants, queueItemIndicatorVariants, responseBubbleVariants, statusBadgeVariants, useModelSelector, usePromptInput, useReasoning };
|
|
2201
|
+
//# sourceMappingURL=chatbot.js.map
|
|
2202
|
+
//# sourceMappingURL=chatbot.js.map
|