@copilotz/chat-ui 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -32
- package/dist/components/chat/AgentSelectors.d.ts +50 -0
- package/dist/components/chat/AgentSelectors.d.ts.map +1 -0
- package/dist/components/chat/AgentSelectors.js +67 -0
- package/dist/components/chat/AgentSelectors.js.map +1 -0
- package/dist/components/chat/AssistantActivity.d.ts +11 -0
- package/dist/components/chat/AssistantActivity.d.ts.map +1 -0
- package/dist/components/chat/AssistantActivity.js +82 -0
- package/dist/components/chat/AssistantActivity.js.map +1 -0
- package/dist/components/chat/ChatHeader.d.ts +56 -0
- package/dist/components/chat/ChatHeader.d.ts.map +1 -0
- package/dist/components/chat/ChatHeader.js +71 -0
- package/dist/components/chat/ChatHeader.js.map +1 -0
- package/dist/components/chat/ChatInput.d.ts +25 -0
- package/dist/components/chat/ChatInput.d.ts.map +1 -0
- package/dist/components/chat/ChatInput.js +732 -0
- package/dist/components/chat/ChatInput.js.map +1 -0
- package/dist/components/chat/ChatUI.d.ts +4 -0
- package/dist/components/chat/ChatUI.d.ts.map +1 -0
- package/dist/components/chat/ChatUI.js +470 -0
- package/dist/components/chat/ChatUI.js.map +1 -0
- package/dist/components/chat/Message.d.ts +37 -0
- package/dist/components/chat/Message.d.ts.map +1 -0
- package/dist/components/chat/Message.js +262 -0
- package/dist/components/chat/Message.js.map +1 -0
- package/dist/components/chat/Sidebar.d.ts +52 -0
- package/dist/components/chat/Sidebar.d.ts.map +1 -0
- package/dist/components/chat/Sidebar.js +112 -0
- package/dist/components/chat/Sidebar.js.map +1 -0
- package/dist/components/chat/ThreadManager.d.ts +18 -0
- package/dist/components/chat/ThreadManager.d.ts.map +1 -0
- package/dist/components/chat/ThreadManager.js +108 -0
- package/dist/components/chat/ThreadManager.js.map +1 -0
- package/dist/components/chat/UserContext.d.ts +15 -0
- package/dist/components/chat/UserContext.d.ts.map +1 -0
- package/dist/components/chat/UserContext.js +39 -0
- package/dist/components/chat/UserContext.js.map +1 -0
- package/dist/components/chat/UserMenu.d.ts +38 -0
- package/dist/components/chat/UserMenu.d.ts.map +1 -0
- package/dist/components/chat/UserMenu.js +44 -0
- package/dist/components/chat/UserMenu.js.map +1 -0
- package/dist/components/chat/UserProfile.d.ts +51 -0
- package/dist/components/chat/UserProfile.d.ts.map +1 -0
- package/dist/components/chat/UserProfile.js +206 -0
- package/dist/components/chat/UserProfile.js.map +1 -0
- package/dist/components/chat/VoiceComposer.d.ts +29 -0
- package/dist/components/chat/VoiceComposer.d.ts.map +1 -0
- package/dist/components/chat/VoiceComposer.js +99 -0
- package/dist/components/chat/VoiceComposer.js.map +1 -0
- package/dist/components/ui/Spinner.d.ts +7 -0
- package/dist/components/ui/Spinner.d.ts.map +1 -0
- package/dist/components/ui/Spinner.js +14 -0
- package/dist/components/ui/Spinner.js.map +1 -0
- package/dist/components/ui/accordion.d.ts +8 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +14 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +15 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +66 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +15 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +23 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +32 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +25 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +6 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +26 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +51 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +16 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +63 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +26 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +51 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/input.d.ts +4 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +7 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/progress.d.ts +5 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +8 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +8 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +16 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +12 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +21 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +9 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +66 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +70 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +212 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +7 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +7 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +18 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/config/chatConfig.d.ts +4 -0
- package/dist/config/chatConfig.d.ts.map +1 -0
- package/dist/config/chatConfig.js +173 -0
- package/dist/config/chatConfig.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +16 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/index.cjs +1095 -1363
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -345
- package/dist/index.d.ts +36 -345
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1038 -1308
- package/dist/index.js.map +1 -1
- package/dist/lib/chatUtils.d.ts +18 -0
- package/dist/lib/chatUtils.d.ts.map +1 -0
- package/dist/lib/chatUtils.js +64 -0
- package/dist/lib/chatUtils.js.map +1 -0
- package/dist/lib/utils.d.ts +6 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +46 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/voiceCompose.d.ts +6 -0
- package/dist/lib/voiceCompose.d.ts.map +1 -0
- package/dist/lib/voiceCompose.js +344 -0
- package/dist/lib/voiceCompose.js.map +1 -0
- package/dist/styles.css +57 -108
- package/dist/types/chatTypes.d.ts +386 -0
- package/dist/types/chatTypes.d.ts.map +1 -0
- package/dist/types/chatTypes.js +2 -0
- package/dist/types/chatTypes.js.map +1 -0
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/chat/ChatUI.tsx
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as useState9, useEffect as useEffect11, useRef as useRef6, useCallback as useCallback4, useMemo as useMemo6 } from "react";
|
|
3
3
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
4
4
|
|
|
5
5
|
// src/config/chatConfig.ts
|
|
@@ -80,10 +80,16 @@ var defaultChatConfig = {
|
|
|
80
80
|
cancel: "Cancel",
|
|
81
81
|
create: "Create Conversation",
|
|
82
82
|
footerLabel: "Assistant can make mistakes. Check the AI results.",
|
|
83
|
-
toolUsed: "Tool Used",
|
|
84
83
|
daysAgo: "days ago",
|
|
85
84
|
inputHelpText: "Press Enter to send, Shift+Enter to add a new line.",
|
|
86
|
-
|
|
85
|
+
activityThinking: "Thinking...",
|
|
86
|
+
activityWorking: "Working...",
|
|
87
|
+
activityUsingTools: "Using tools...",
|
|
88
|
+
activityPreparingAnswer: "Preparing answer...",
|
|
89
|
+
activityToolRunning: "Using {{tool}}...",
|
|
90
|
+
activityMultipleTools: "Using {{count}} tools...",
|
|
91
|
+
activityShowDetails: "Show details",
|
|
92
|
+
activityHideDetails: "Hide details",
|
|
87
93
|
defaultThreadName: "Main Thread",
|
|
88
94
|
loadOlderMessages: "Load older messages",
|
|
89
95
|
loadingOlderMessages: "Loading older messages...",
|
|
@@ -97,7 +103,7 @@ var defaultChatConfig = {
|
|
|
97
103
|
enableMessageEditing: true,
|
|
98
104
|
enableMessageCopy: true,
|
|
99
105
|
enableRegeneration: true,
|
|
100
|
-
|
|
106
|
+
activityDisplay: "full",
|
|
101
107
|
maxAttachments: 4,
|
|
102
108
|
maxFileSize: 10 * 1024 * 1024
|
|
103
109
|
// 10MB
|
|
@@ -169,37 +175,12 @@ function mergeConfig(_baseConfig, userConfig) {
|
|
|
169
175
|
}
|
|
170
176
|
|
|
171
177
|
// src/components/chat/Message.tsx
|
|
172
|
-
import
|
|
178
|
+
import React2, { useState as useState2, useMemo as useMemo2, useEffect as useEffect2, memo as memo2 } from "react";
|
|
173
179
|
import ReactMarkdown from "react-markdown";
|
|
174
180
|
import remarkGfm from "remark-gfm";
|
|
175
181
|
import rehypeHighlight from "rehype-highlight";
|
|
176
182
|
|
|
177
183
|
// src/lib/chatUtils.ts
|
|
178
|
-
var chatUtils = {
|
|
179
|
-
generateId: () => globalThis.crypto?.randomUUID?.() ?? `id-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
|
|
180
|
-
generateMessageId: () => chatUtils.generateId(),
|
|
181
|
-
generateThreadId: () => chatUtils.generateId(),
|
|
182
|
-
createMessage: (role, content, attachments) => ({
|
|
183
|
-
id: chatUtils.generateMessageId(),
|
|
184
|
-
role,
|
|
185
|
-
content,
|
|
186
|
-
timestamp: Date.now(),
|
|
187
|
-
attachments,
|
|
188
|
-
isComplete: true
|
|
189
|
-
}),
|
|
190
|
-
createThread: (title) => ({
|
|
191
|
-
id: chatUtils.generateThreadId(),
|
|
192
|
-
title,
|
|
193
|
-
createdAt: Date.now(),
|
|
194
|
-
updatedAt: Date.now(),
|
|
195
|
-
messageCount: 0
|
|
196
|
-
}),
|
|
197
|
-
generateThreadTitle: (firstMessage) => {
|
|
198
|
-
const cleaned = firstMessage.replace(/[^\w\s]/g, "").trim();
|
|
199
|
-
const words = cleaned.split(/\s+/).slice(0, 6);
|
|
200
|
-
return words.join(" ") || "Nova Conversa";
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
184
|
var AGENT_COLORS = [
|
|
204
185
|
"#6366f1",
|
|
205
186
|
// indigo
|
|
@@ -253,24 +234,6 @@ import { twMerge } from "tailwind-merge";
|
|
|
253
234
|
function cn(...inputs) {
|
|
254
235
|
return twMerge(clsx(inputs));
|
|
255
236
|
}
|
|
256
|
-
var formatDate = (timestamp, labels) => {
|
|
257
|
-
const date = new Date(timestamp);
|
|
258
|
-
const now = /* @__PURE__ */ new Date();
|
|
259
|
-
const diffMs = now.getTime() - date.getTime();
|
|
260
|
-
const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
|
|
261
|
-
if (diffDays === 0) {
|
|
262
|
-
return labels?.today || "Today";
|
|
263
|
-
} else if (diffDays === 1) {
|
|
264
|
-
return labels?.yesterday || "Yesterday";
|
|
265
|
-
} else if (diffDays < 7) {
|
|
266
|
-
return `${diffDays} ${labels?.daysAgo || "days ago"}`;
|
|
267
|
-
} else {
|
|
268
|
-
return date.toLocaleDateString("en-US", {
|
|
269
|
-
day: "2-digit",
|
|
270
|
-
month: "short"
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
237
|
var createObjectUrlFromDataUrl = (dataUrl) => {
|
|
275
238
|
const match = dataUrl.match(/^data:(.+?);base64,(.+)$/s);
|
|
276
239
|
if (!match) {
|
|
@@ -421,59 +384,10 @@ function Badge({
|
|
|
421
384
|
);
|
|
422
385
|
}
|
|
423
386
|
|
|
424
|
-
// src/components/ui/card.tsx
|
|
425
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
426
|
-
function Card({ className, ...props }) {
|
|
427
|
-
return /* @__PURE__ */ jsx4(
|
|
428
|
-
"div",
|
|
429
|
-
{
|
|
430
|
-
"data-slot": "card",
|
|
431
|
-
className: cn(
|
|
432
|
-
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
433
|
-
className
|
|
434
|
-
),
|
|
435
|
-
...props
|
|
436
|
-
}
|
|
437
|
-
);
|
|
438
|
-
}
|
|
439
|
-
function CardHeader({ className, ...props }) {
|
|
440
|
-
return /* @__PURE__ */ jsx4(
|
|
441
|
-
"div",
|
|
442
|
-
{
|
|
443
|
-
"data-slot": "card-header",
|
|
444
|
-
className: cn(
|
|
445
|
-
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
446
|
-
className
|
|
447
|
-
),
|
|
448
|
-
...props
|
|
449
|
-
}
|
|
450
|
-
);
|
|
451
|
-
}
|
|
452
|
-
function CardTitle({ className, ...props }) {
|
|
453
|
-
return /* @__PURE__ */ jsx4(
|
|
454
|
-
"div",
|
|
455
|
-
{
|
|
456
|
-
"data-slot": "card-title",
|
|
457
|
-
className: cn("leading-none font-semibold", className),
|
|
458
|
-
...props
|
|
459
|
-
}
|
|
460
|
-
);
|
|
461
|
-
}
|
|
462
|
-
function CardContent({ className, ...props }) {
|
|
463
|
-
return /* @__PURE__ */ jsx4(
|
|
464
|
-
"div",
|
|
465
|
-
{
|
|
466
|
-
"data-slot": "card-content",
|
|
467
|
-
className: cn("px-6", className),
|
|
468
|
-
...props
|
|
469
|
-
}
|
|
470
|
-
);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
387
|
// src/components/ui/textarea.tsx
|
|
474
|
-
import { jsx as
|
|
388
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
475
389
|
function Textarea({ className, ...props }) {
|
|
476
|
-
return /* @__PURE__ */
|
|
390
|
+
return /* @__PURE__ */ jsx4(
|
|
477
391
|
"textarea",
|
|
478
392
|
{
|
|
479
393
|
"data-slot": "textarea",
|
|
@@ -488,12 +402,12 @@ function Textarea({ className, ...props }) {
|
|
|
488
402
|
|
|
489
403
|
// src/components/ui/tooltip.tsx
|
|
490
404
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
491
|
-
import { jsx as
|
|
405
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
492
406
|
function TooltipProvider({
|
|
493
407
|
delayDuration = 0,
|
|
494
408
|
...props
|
|
495
409
|
}) {
|
|
496
|
-
return /* @__PURE__ */
|
|
410
|
+
return /* @__PURE__ */ jsx5(
|
|
497
411
|
TooltipPrimitive.Provider,
|
|
498
412
|
{
|
|
499
413
|
"data-slot": "tooltip-provider",
|
|
@@ -505,12 +419,12 @@ function TooltipProvider({
|
|
|
505
419
|
function Tooltip({
|
|
506
420
|
...props
|
|
507
421
|
}) {
|
|
508
|
-
return /* @__PURE__ */
|
|
422
|
+
return /* @__PURE__ */ jsx5(TooltipProvider, { children: /* @__PURE__ */ jsx5(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
|
|
509
423
|
}
|
|
510
424
|
function TooltipTrigger({
|
|
511
425
|
...props
|
|
512
426
|
}) {
|
|
513
|
-
return /* @__PURE__ */
|
|
427
|
+
return /* @__PURE__ */ jsx5(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
514
428
|
}
|
|
515
429
|
function TooltipContent({
|
|
516
430
|
className,
|
|
@@ -518,7 +432,7 @@ function TooltipContent({
|
|
|
518
432
|
children,
|
|
519
433
|
...props
|
|
520
434
|
}) {
|
|
521
|
-
return /* @__PURE__ */
|
|
435
|
+
return /* @__PURE__ */ jsx5(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
522
436
|
TooltipPrimitive.Content,
|
|
523
437
|
{
|
|
524
438
|
"data-slot": "tooltip-content",
|
|
@@ -530,90 +444,204 @@ function TooltipContent({
|
|
|
530
444
|
...props,
|
|
531
445
|
children: [
|
|
532
446
|
children,
|
|
533
|
-
/* @__PURE__ */
|
|
447
|
+
/* @__PURE__ */ jsx5(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
534
448
|
]
|
|
535
449
|
}
|
|
536
450
|
) });
|
|
537
451
|
}
|
|
538
452
|
|
|
539
|
-
// src/components/chat/
|
|
540
|
-
import {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
import { Fragment, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
553
|
-
var ThinkingIndicator = memo(function ThinkingIndicator2({ label = "Thinking..." }) {
|
|
554
|
-
return /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 py-2", children: [
|
|
555
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex gap-1", children: [
|
|
556
|
-
/* @__PURE__ */ jsx7(
|
|
557
|
-
"span",
|
|
558
|
-
{
|
|
559
|
-
className: "inline-block w-2 h-2 bg-primary rounded-full animate-bounce",
|
|
560
|
-
style: { animationDelay: "0ms" }
|
|
561
|
-
}
|
|
453
|
+
// src/components/chat/AssistantActivity.tsx
|
|
454
|
+
import { memo, useEffect, useMemo, useState } from "react";
|
|
455
|
+
|
|
456
|
+
// src/components/ui/card.tsx
|
|
457
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
458
|
+
function Card({ className, ...props }) {
|
|
459
|
+
return /* @__PURE__ */ jsx6(
|
|
460
|
+
"div",
|
|
461
|
+
{
|
|
462
|
+
"data-slot": "card",
|
|
463
|
+
className: cn(
|
|
464
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
465
|
+
className
|
|
562
466
|
),
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
467
|
+
...props
|
|
468
|
+
}
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
function CardHeader({ className, ...props }) {
|
|
472
|
+
return /* @__PURE__ */ jsx6(
|
|
473
|
+
"div",
|
|
474
|
+
{
|
|
475
|
+
"data-slot": "card-header",
|
|
476
|
+
className: cn(
|
|
477
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
478
|
+
className
|
|
569
479
|
),
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
480
|
+
...props
|
|
481
|
+
}
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
function CardContent({ className, ...props }) {
|
|
485
|
+
return /* @__PURE__ */ jsx6(
|
|
486
|
+
"div",
|
|
487
|
+
{
|
|
488
|
+
"data-slot": "card-content",
|
|
489
|
+
className: cn("px-6", className),
|
|
490
|
+
...props
|
|
491
|
+
}
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// src/components/ui/collapsible.tsx
|
|
496
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
497
|
+
var Collapsible = CollapsiblePrimitive.Root;
|
|
498
|
+
var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger;
|
|
499
|
+
var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
|
|
500
|
+
|
|
501
|
+
// src/components/chat/AssistantActivity.tsx
|
|
502
|
+
import { Brain, ChevronDown, ChevronRight, LoaderCircle, Sparkles, Wrench } from "lucide-react";
|
|
503
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
504
|
+
var interpolate = (template, replacements) => Object.entries(replacements).reduce(
|
|
505
|
+
(output, [key, value]) => output.replaceAll(`{{${key}}}`, String(value ?? "")),
|
|
506
|
+
template
|
|
507
|
+
);
|
|
508
|
+
var resolveSummaryLabel = (activity, labels) => {
|
|
509
|
+
const summary = activity.summary;
|
|
510
|
+
if (summary.kind === "using_tools") {
|
|
511
|
+
if (summary.toolName) {
|
|
512
|
+
return interpolate(labels?.activityToolRunning || "Using {{tool}}...", {
|
|
513
|
+
tool: summary.toolName
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
if (typeof summary.toolCount === "number" && summary.toolCount > 1) {
|
|
517
|
+
return interpolate(labels?.activityMultipleTools || "Using {{count}} tools...", {
|
|
518
|
+
count: summary.toolCount
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
return labels?.activityUsingTools || "Using tools...";
|
|
522
|
+
}
|
|
523
|
+
if (summary.kind === "preparing_answer") {
|
|
524
|
+
return labels?.activityPreparingAnswer || "Preparing answer...";
|
|
525
|
+
}
|
|
526
|
+
if (summary.kind === "working") {
|
|
527
|
+
return labels?.activityWorking || "Working...";
|
|
528
|
+
}
|
|
529
|
+
return labels?.activityThinking || "Thinking...";
|
|
530
|
+
};
|
|
531
|
+
var getStatusIcon = (toolCall) => {
|
|
532
|
+
if (toolCall.status === "failed") {
|
|
533
|
+
return /* @__PURE__ */ jsx7(Badge, { variant: "destructive", children: "failed" });
|
|
534
|
+
}
|
|
535
|
+
if (toolCall.status === "completed") {
|
|
536
|
+
return /* @__PURE__ */ jsx7(Badge, { variant: "secondary", className: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300", children: "done" });
|
|
537
|
+
}
|
|
538
|
+
if (toolCall.status === "running") {
|
|
539
|
+
return /* @__PURE__ */ jsx7(Badge, { variant: "secondary", className: "bg-primary/10 text-primary", children: "running" });
|
|
540
|
+
}
|
|
541
|
+
return /* @__PURE__ */ jsx7(Badge, { variant: "secondary", children: "pending" });
|
|
542
|
+
};
|
|
543
|
+
var AssistantActivitySkeleton = memo(function AssistantActivitySkeleton2() {
|
|
544
|
+
return /* @__PURE__ */ jsxs2("div", { className: "mb-3 flex items-center gap-3 rounded-lg border border-border/50 bg-muted/20 px-3 py-2", children: [
|
|
545
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1.5", children: [
|
|
546
|
+
/* @__PURE__ */ jsx7("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/80 animate-pulse" }),
|
|
547
|
+
/* @__PURE__ */ jsx7("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/60 animate-pulse [animation-delay:120ms]" }),
|
|
548
|
+
/* @__PURE__ */ jsx7("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/40 animate-pulse [animation-delay:240ms]" })
|
|
577
549
|
] }),
|
|
578
|
-
/* @__PURE__ */ jsx7("
|
|
550
|
+
/* @__PURE__ */ jsx7("div", { className: "h-3 w-28 rounded-full bg-muted animate-pulse" })
|
|
579
551
|
] });
|
|
580
552
|
});
|
|
581
|
-
var
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
553
|
+
var AssistantActivitySummary = memo(function AssistantActivitySummary2({
|
|
554
|
+
activity,
|
|
555
|
+
labels
|
|
556
|
+
}) {
|
|
557
|
+
const summaryLabel = useMemo(() => resolveSummaryLabel(activity, labels), [activity, labels]);
|
|
558
|
+
const isActive = activity.isActive;
|
|
559
|
+
const icon = activity.summary.kind === "using_tools" ? /* @__PURE__ */ jsx7(Wrench, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") }) : activity.summary.kind === "preparing_answer" ? /* @__PURE__ */ jsx7(Sparkles, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") }) : /* @__PURE__ */ jsx7(Brain, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") });
|
|
560
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn(
|
|
561
|
+
"flex items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors",
|
|
562
|
+
isActive ? "border-primary/30 bg-primary/5 text-foreground" : "border-border/60 bg-muted/20 text-muted-foreground"
|
|
563
|
+
), children: [
|
|
564
|
+
icon,
|
|
565
|
+
/* @__PURE__ */ jsx7("span", { className: "min-w-0 flex-1 truncate", children: summaryLabel }),
|
|
566
|
+
isActive && /* @__PURE__ */ jsx7(LoaderCircle, { className: "h-4 w-4 shrink-0 animate-spin text-primary" })
|
|
567
|
+
] });
|
|
568
|
+
});
|
|
569
|
+
var AssistantActivityDetails = memo(function AssistantActivityDetails2({
|
|
570
|
+
activity
|
|
571
|
+
}) {
|
|
572
|
+
return /* @__PURE__ */ jsxs2("div", { className: "space-y-3 pt-3", children: [
|
|
573
|
+
activity.reasoning && /* @__PURE__ */ jsxs2("div", { className: "space-y-1", children: [
|
|
574
|
+
/* @__PURE__ */ jsx7("div", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Reasoning" }),
|
|
575
|
+
/* @__PURE__ */ jsx7("div", { className: "whitespace-pre-wrap break-words text-sm leading-6 text-muted-foreground", children: activity.reasoning })
|
|
576
|
+
] }),
|
|
577
|
+
Array.isArray(activity.toolCalls) && activity.toolCalls.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
578
|
+
/* @__PURE__ */ jsx7("div", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Tools" }),
|
|
579
|
+
activity.toolCalls.map((toolCall) => /* @__PURE__ */ jsx7(Card, { className: "border-border/60 bg-background/70", children: /* @__PURE__ */ jsxs2(CardContent, { className: "space-y-2 px-3 py-3", children: [
|
|
580
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between gap-3", children: [
|
|
581
|
+
/* @__PURE__ */ jsx7("div", { className: "min-w-0", children: /* @__PURE__ */ jsx7("div", { className: "truncate text-sm font-medium", children: toolCall.name }) }),
|
|
582
|
+
getStatusIcon(toolCall)
|
|
583
|
+
] }),
|
|
584
|
+
/* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
585
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
586
|
+
/* @__PURE__ */ jsx7("div", { className: "mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Args" }),
|
|
587
|
+
/* @__PURE__ */ jsx7("pre", { className: "overflow-x-auto rounded-md bg-muted/70 p-2 text-xs text-muted-foreground", children: JSON.stringify(toolCall.arguments, null, 2) })
|
|
601
588
|
] }),
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
] }) })
|
|
589
|
+
typeof toolCall.result !== "undefined" && /* @__PURE__ */ jsxs2("div", { children: [
|
|
590
|
+
/* @__PURE__ */ jsx7("div", { className: "mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Result" }),
|
|
591
|
+
/* @__PURE__ */ jsx7("pre", { className: "overflow-x-auto rounded-md bg-muted/70 p-2 text-xs text-muted-foreground", children: JSON.stringify(toolCall.result, null, 2) })
|
|
592
|
+
] })
|
|
593
|
+
] })
|
|
594
|
+
] }) }, toolCall.id))
|
|
595
|
+
] })
|
|
610
596
|
] });
|
|
611
597
|
});
|
|
598
|
+
var AssistantActivity = memo(function AssistantActivity2({
|
|
599
|
+
activity,
|
|
600
|
+
displayMode,
|
|
601
|
+
labels
|
|
602
|
+
}) {
|
|
603
|
+
if (!activity) return null;
|
|
604
|
+
if (displayMode === "hidden") {
|
|
605
|
+
return activity.isActive ? /* @__PURE__ */ jsx7(AssistantActivitySkeleton, {}) : null;
|
|
606
|
+
}
|
|
607
|
+
if (displayMode === "summary") {
|
|
608
|
+
if (!activity.isActive && activity.isComplete) return null;
|
|
609
|
+
return /* @__PURE__ */ jsx7("div", { className: "mb-3", children: /* @__PURE__ */ jsx7(AssistantActivitySummary, { activity, labels }) });
|
|
610
|
+
}
|
|
611
|
+
const hasDetails = Boolean(activity.reasoning) || Boolean(activity.toolCalls?.length);
|
|
612
|
+
const defaultOpen = activity.isActive && hasDetails;
|
|
613
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
614
|
+
useEffect(() => {
|
|
615
|
+
if (activity.isActive && hasDetails) {
|
|
616
|
+
setOpen(true);
|
|
617
|
+
}
|
|
618
|
+
}, [activity.isActive, hasDetails]);
|
|
619
|
+
return /* @__PURE__ */ jsx7("div", { className: "mb-3", children: /* @__PURE__ */ jsx7(Collapsible, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
620
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
621
|
+
/* @__PURE__ */ jsx7("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx7(AssistantActivitySummary, { activity, labels }) }),
|
|
622
|
+
hasDetails && /* @__PURE__ */ jsx7(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs2(Button, { variant: "ghost", size: "sm", className: "h-9 shrink-0 px-2 text-xs text-muted-foreground", children: [
|
|
623
|
+
open ? labels?.activityHideDetails || "Hide details" : labels?.activityShowDetails || "Show details",
|
|
624
|
+
open ? /* @__PURE__ */ jsx7(ChevronDown, { className: "ml-1 h-3.5 w-3.5" }) : /* @__PURE__ */ jsx7(ChevronRight, { className: "ml-1 h-3.5 w-3.5" })
|
|
625
|
+
] }) })
|
|
626
|
+
] }),
|
|
627
|
+
hasDetails && /* @__PURE__ */ jsx7(CollapsibleContent2, { className: "overflow-hidden rounded-lg border border-border/60 bg-muted/10 px-3", children: /* @__PURE__ */ jsx7(AssistantActivityDetails, { activity }) })
|
|
628
|
+
] }) }) });
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
// src/components/chat/Message.tsx
|
|
632
|
+
import {
|
|
633
|
+
Copy,
|
|
634
|
+
Edit,
|
|
635
|
+
RotateCcw,
|
|
636
|
+
Check,
|
|
637
|
+
X
|
|
638
|
+
} from "lucide-react";
|
|
639
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
612
640
|
var defaultMarkdownComponents = {
|
|
613
641
|
code: ({ node, className, children, ...props }) => {
|
|
614
642
|
const inline = props.inline;
|
|
615
643
|
const match = /language-(\w+)/.exec(className || "");
|
|
616
|
-
return !inline && match ? /* @__PURE__ */
|
|
644
|
+
return !inline && match ? /* @__PURE__ */ jsx8("pre", { className: "relative", children: /* @__PURE__ */ jsx8("code", { className, ...props, children }) }) : /* @__PURE__ */ jsx8("code", { className: "bg-muted px-1 py-0.5 rounded text-sm", ...props, children });
|
|
617
645
|
}
|
|
618
646
|
};
|
|
619
647
|
var remarkPluginsDefault = [remarkGfm];
|
|
@@ -649,66 +677,64 @@ var getCollapsedPreview = (content, previewChars, previewOverride) => {
|
|
|
649
677
|
}
|
|
650
678
|
return `${content.slice(0, previewChars).trimEnd()}...`;
|
|
651
679
|
};
|
|
652
|
-
var LongContentShell =
|
|
653
|
-
return /* @__PURE__ */
|
|
680
|
+
var LongContentShell = memo2(function LongContentShell2({ children, className, style }) {
|
|
681
|
+
return /* @__PURE__ */ jsx8("div", { className, style, children });
|
|
654
682
|
});
|
|
655
|
-
var PlainTextContent =
|
|
683
|
+
var PlainTextContent = memo2(function PlainTextContent2({
|
|
656
684
|
content,
|
|
657
685
|
className = "",
|
|
658
686
|
chunkSize = 12e3,
|
|
659
687
|
style
|
|
660
688
|
}) {
|
|
661
|
-
const chunks =
|
|
662
|
-
return /* @__PURE__ */
|
|
689
|
+
const chunks = useMemo2(() => getPlainTextChunks(content, chunkSize), [content, chunkSize]);
|
|
690
|
+
return /* @__PURE__ */ jsx8(
|
|
663
691
|
LongContentShell,
|
|
664
692
|
{
|
|
665
693
|
className: `text-sm leading-6 whitespace-pre-wrap break-words ${className}`.trim(),
|
|
666
694
|
style,
|
|
667
|
-
children: chunks.map((chunk, index) => /* @__PURE__ */
|
|
695
|
+
children: chunks.map((chunk, index) => /* @__PURE__ */ jsx8(React2.Fragment, { children: chunk }, index))
|
|
668
696
|
}
|
|
669
697
|
);
|
|
670
698
|
});
|
|
671
|
-
var StreamingText =
|
|
699
|
+
var StreamingText = memo2(function StreamingText2({
|
|
672
700
|
content,
|
|
673
701
|
isStreaming = false,
|
|
674
|
-
thinkingLabel = "Thinking...",
|
|
675
702
|
className = "",
|
|
676
703
|
renderMarkdown = true,
|
|
677
704
|
markdown,
|
|
678
705
|
plainTextChunkChars = 12e3,
|
|
679
|
-
contentStyle
|
|
680
|
-
hideThinkingIndicator = false
|
|
706
|
+
contentStyle
|
|
681
707
|
}) {
|
|
682
708
|
const hasContent = content.trim().length > 0;
|
|
683
709
|
const enableSyntaxHighlight = renderMarkdown && !isStreaming && hasCodeBlocks(content);
|
|
684
|
-
const mergedComponents =
|
|
710
|
+
const mergedComponents = useMemo2(
|
|
685
711
|
() => ({
|
|
686
712
|
...defaultMarkdownComponents,
|
|
687
713
|
...markdown?.components
|
|
688
714
|
}),
|
|
689
715
|
[markdown?.components]
|
|
690
716
|
);
|
|
691
|
-
const mergedRemarkPlugins =
|
|
717
|
+
const mergedRemarkPlugins = useMemo2(
|
|
692
718
|
() => [
|
|
693
719
|
...remarkPluginsDefault,
|
|
694
720
|
...markdown?.remarkPlugins ?? []
|
|
695
721
|
],
|
|
696
722
|
[markdown?.remarkPlugins]
|
|
697
723
|
);
|
|
698
|
-
const mergedRehypePlugins =
|
|
724
|
+
const mergedRehypePlugins = useMemo2(
|
|
699
725
|
() => [
|
|
700
726
|
...enableSyntaxHighlight ? rehypePluginsDefault : rehypePluginsEmpty,
|
|
701
727
|
...markdown?.rehypePlugins ?? []
|
|
702
728
|
],
|
|
703
729
|
[enableSyntaxHighlight, markdown?.rehypePlugins]
|
|
704
730
|
);
|
|
705
|
-
return /* @__PURE__ */
|
|
706
|
-
hasContent ? renderMarkdown ? /* @__PURE__ */
|
|
731
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
732
|
+
hasContent ? renderMarkdown ? /* @__PURE__ */ jsx8(
|
|
707
733
|
LongContentShell,
|
|
708
734
|
{
|
|
709
735
|
className: `prose prose-sm max-w-none dark:prose-invert break-words ${className}`.trim(),
|
|
710
736
|
style: contentStyle,
|
|
711
|
-
children: /* @__PURE__ */
|
|
737
|
+
children: /* @__PURE__ */ jsx8(
|
|
712
738
|
ReactMarkdown,
|
|
713
739
|
{
|
|
714
740
|
remarkPlugins: mergedRemarkPlugins,
|
|
@@ -718,7 +744,7 @@ var StreamingText = memo(function StreamingText2({
|
|
|
718
744
|
}
|
|
719
745
|
)
|
|
720
746
|
}
|
|
721
|
-
) : /* @__PURE__ */
|
|
747
|
+
) : /* @__PURE__ */ jsx8(
|
|
722
748
|
PlainTextContent,
|
|
723
749
|
{
|
|
724
750
|
content,
|
|
@@ -726,13 +752,13 @@ var StreamingText = memo(function StreamingText2({
|
|
|
726
752
|
chunkSize: plainTextChunkChars,
|
|
727
753
|
style: contentStyle
|
|
728
754
|
}
|
|
729
|
-
) :
|
|
730
|
-
isStreaming && hasContent && /* @__PURE__ */
|
|
755
|
+
) : null,
|
|
756
|
+
isStreaming && hasContent && /* @__PURE__ */ jsx8("span", { className: "inline-block w-2 h-4 bg-primary animate-pulse ml-1" })
|
|
731
757
|
] });
|
|
732
758
|
});
|
|
733
|
-
var MediaRenderer =
|
|
734
|
-
const [audioPlaybackSrc, setAudioPlaybackSrc] =
|
|
735
|
-
|
|
759
|
+
var MediaRenderer = memo2(function MediaRenderer2({ attachment }) {
|
|
760
|
+
const [audioPlaybackSrc, setAudioPlaybackSrc] = useState2(attachment.dataUrl);
|
|
761
|
+
useEffect2(() => {
|
|
736
762
|
if (attachment.kind !== "audio" || !attachment.dataUrl.startsWith("data:")) {
|
|
737
763
|
setAudioPlaybackSrc(attachment.dataUrl);
|
|
738
764
|
return;
|
|
@@ -755,8 +781,8 @@ var MediaRenderer = memo(function MediaRenderer2({ attachment }) {
|
|
|
755
781
|
};
|
|
756
782
|
switch (attachment.kind) {
|
|
757
783
|
case "image":
|
|
758
|
-
return /* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
784
|
+
return /* @__PURE__ */ jsxs3("div", { className: "relative rounded-lg overflow-hidden border bg-muted/20 max-w-md", children: [
|
|
785
|
+
/* @__PURE__ */ jsx8(
|
|
760
786
|
"img",
|
|
761
787
|
{
|
|
762
788
|
src: attachment.dataUrl,
|
|
@@ -765,21 +791,21 @@ var MediaRenderer = memo(function MediaRenderer2({ attachment }) {
|
|
|
765
791
|
loading: "lazy"
|
|
766
792
|
}
|
|
767
793
|
),
|
|
768
|
-
attachment.fileName && /* @__PURE__ */
|
|
794
|
+
attachment.fileName && /* @__PURE__ */ jsx8("div", { className: "absolute bottom-0 left-0 right-0 bg-black/50 text-white text-xs p-2", children: attachment.fileName })
|
|
769
795
|
] });
|
|
770
796
|
case "audio":
|
|
771
|
-
return /* @__PURE__ */
|
|
797
|
+
return /* @__PURE__ */ jsx8("div", { className: "flex w-full max-w-md py-0 min-w-64 items-center gap-3", children: /* @__PURE__ */ jsx8(
|
|
772
798
|
"audio",
|
|
773
799
|
{
|
|
774
800
|
className: "w-full mt-2",
|
|
775
801
|
preload: "metadata",
|
|
776
802
|
controls: true,
|
|
777
|
-
children: /* @__PURE__ */
|
|
803
|
+
children: /* @__PURE__ */ jsx8("source", { src: audioPlaybackSrc, type: attachment.mimeType })
|
|
778
804
|
}
|
|
779
805
|
) });
|
|
780
806
|
case "video":
|
|
781
|
-
return /* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
807
|
+
return /* @__PURE__ */ jsxs3("div", { className: "relative rounded-lg overflow-hidden border bg-muted/20 max-w-lg", children: [
|
|
808
|
+
/* @__PURE__ */ jsx8(
|
|
783
809
|
"video",
|
|
784
810
|
{
|
|
785
811
|
src: attachment.dataUrl,
|
|
@@ -788,82 +814,12 @@ var MediaRenderer = memo(function MediaRenderer2({ attachment }) {
|
|
|
788
814
|
className: "w-full h-auto"
|
|
789
815
|
}
|
|
790
816
|
),
|
|
791
|
-
attachment.fileName && /* @__PURE__ */
|
|
817
|
+
attachment.fileName && /* @__PURE__ */ jsx8("div", { className: "absolute bottom-0 left-0 right-0 bg-black/50 text-white text-xs p-2", children: attachment.fileName })
|
|
792
818
|
] });
|
|
793
819
|
default:
|
|
794
820
|
return null;
|
|
795
821
|
}
|
|
796
822
|
});
|
|
797
|
-
var ToolCallsDisplay = memo(function ToolCallsDisplay2({ toolCalls, label }) {
|
|
798
|
-
const [expandedCall, setExpandedCall] = useState(null);
|
|
799
|
-
const getStatusIcon = (status) => {
|
|
800
|
-
switch (status) {
|
|
801
|
-
case "pending":
|
|
802
|
-
return /* @__PURE__ */ jsx7(Clock, { className: "h-3 w-3 text-muted-foreground" });
|
|
803
|
-
case "running":
|
|
804
|
-
return /* @__PURE__ */ jsx7("div", { className: "h-3 w-3 border-2 border-primary border-t-transparent rounded-full animate-spin" });
|
|
805
|
-
case "completed":
|
|
806
|
-
return /* @__PURE__ */ jsx7(Check, { className: "h-3 w-3 text-green-500" });
|
|
807
|
-
case "failed":
|
|
808
|
-
return /* @__PURE__ */ jsx7(X, { className: "h-3 w-3 text-destructive" });
|
|
809
|
-
}
|
|
810
|
-
};
|
|
811
|
-
const getStatusBadgeClasses = (status) => {
|
|
812
|
-
switch (status) {
|
|
813
|
-
case "pending":
|
|
814
|
-
return "bg-muted text-muted-foreground";
|
|
815
|
-
case "running":
|
|
816
|
-
return "bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300";
|
|
817
|
-
case "completed":
|
|
818
|
-
return "bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300";
|
|
819
|
-
case "failed":
|
|
820
|
-
return "bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300";
|
|
821
|
-
}
|
|
822
|
-
};
|
|
823
|
-
return /* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
824
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 text-xs uppercase tracking-wide text-muted-foreground font-semibold", children: [
|
|
825
|
-
/* @__PURE__ */ jsx7(Wrench, { className: "h-3 w-3" }),
|
|
826
|
-
label || "Ferramenta utilizada"
|
|
827
|
-
] }),
|
|
828
|
-
toolCalls.map((call) => {
|
|
829
|
-
const isExpanded = expandedCall === call.id;
|
|
830
|
-
const ToggleIcon = isExpanded ? ChevronDown : ChevronRight;
|
|
831
|
-
return /* @__PURE__ */ jsxs2(Card, { className: "border border-dashed border-primary/40 bg-card/60", children: [
|
|
832
|
-
/* @__PURE__ */ jsxs2(
|
|
833
|
-
"button",
|
|
834
|
-
{
|
|
835
|
-
type: "button",
|
|
836
|
-
className: "flex w-full items-center justify-between gap-3 px-3 py-2 text-left",
|
|
837
|
-
onClick: () => setExpandedCall(isExpanded ? null : call.id),
|
|
838
|
-
children: [
|
|
839
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
840
|
-
getStatusIcon(call.status),
|
|
841
|
-
/* @__PURE__ */ jsx7("span", { className: "font-medium text-sm", children: call.name }),
|
|
842
|
-
/* @__PURE__ */ jsx7(Badge, { variant: "secondary", className: getStatusBadgeClasses(call.status), children: call.status })
|
|
843
|
-
] }),
|
|
844
|
-
/* @__PURE__ */ jsx7(ToggleIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
845
|
-
]
|
|
846
|
-
}
|
|
847
|
-
),
|
|
848
|
-
isExpanded && /* @__PURE__ */ jsxs2(CardContent, { className: "pt-0 pb-3 px-3 text-xs space-y-2", children: [
|
|
849
|
-
/* @__PURE__ */ jsxs2("div", { children: [
|
|
850
|
-
/* @__PURE__ */ jsx7("div", { className: "font-medium text-muted-foreground mb-1", children: "Args" }),
|
|
851
|
-
/* @__PURE__ */ jsx7("pre", { className: "rounded bg-muted p-2 overflow-x-auto text-xs", children: JSON.stringify(call.arguments, null, 2) })
|
|
852
|
-
] }),
|
|
853
|
-
typeof call.result !== "undefined" && /* @__PURE__ */ jsxs2("div", { children: [
|
|
854
|
-
/* @__PURE__ */ jsx7("div", { className: "font-medium text-muted-foreground mb-1", children: "Result" }),
|
|
855
|
-
/* @__PURE__ */ jsx7("pre", { className: "rounded bg-muted p-2 overflow-x-auto text-xs", children: JSON.stringify(call.result, null, 2) })
|
|
856
|
-
] }),
|
|
857
|
-
call.startTime && call.endTime && /* @__PURE__ */ jsxs2("div", { className: "text-muted-foreground", children: [
|
|
858
|
-
"Executed in ",
|
|
859
|
-
call.endTime - call.startTime,
|
|
860
|
-
"ms"
|
|
861
|
-
] })
|
|
862
|
-
] })
|
|
863
|
-
] }, call.id);
|
|
864
|
-
})
|
|
865
|
-
] });
|
|
866
|
-
});
|
|
867
823
|
var arePropsEqual = (prevProps, nextProps) => {
|
|
868
824
|
if (prevProps.message !== nextProps.message) return false;
|
|
869
825
|
if (prevProps.isUser !== nextProps.isUser) return false;
|
|
@@ -875,11 +831,10 @@ var arePropsEqual = (prevProps, nextProps) => {
|
|
|
875
831
|
if (prevProps.enableCopy !== nextProps.enableCopy) return false;
|
|
876
832
|
if (prevProps.enableEdit !== nextProps.enableEdit) return false;
|
|
877
833
|
if (prevProps.enableRegenerate !== nextProps.enableRegenerate) return false;
|
|
878
|
-
if (prevProps.
|
|
834
|
+
if (prevProps.activityDisplay !== nextProps.activityDisplay) return false;
|
|
879
835
|
if (prevProps.compactMode !== nextProps.compactMode) return false;
|
|
880
836
|
if (prevProps.className !== nextProps.className) return false;
|
|
881
|
-
if (prevProps.
|
|
882
|
-
if (prevProps.thinkingLabel !== nextProps.thinkingLabel) return false;
|
|
837
|
+
if (prevProps.labels !== nextProps.labels) return false;
|
|
883
838
|
if (prevProps.showMoreLabel !== nextProps.showMoreLabel) return false;
|
|
884
839
|
if (prevProps.showLessLabel !== nextProps.showLessLabel) return false;
|
|
885
840
|
if (prevProps.collapseLongMessages !== nextProps.collapseLongMessages) return false;
|
|
@@ -890,11 +845,10 @@ var arePropsEqual = (prevProps, nextProps) => {
|
|
|
890
845
|
if (prevProps.markdown !== nextProps.markdown) return false;
|
|
891
846
|
if (prevProps.isExpanded !== nextProps.isExpanded) return false;
|
|
892
847
|
if (prevProps.onToggleExpanded !== nextProps.onToggleExpanded) return false;
|
|
893
|
-
if (prevProps.isGrouped !== nextProps.isGrouped) return false;
|
|
894
848
|
if (prevProps.assistantAvatar !== nextProps.assistantAvatar) return false;
|
|
895
849
|
return true;
|
|
896
850
|
};
|
|
897
|
-
var Message =
|
|
851
|
+
var Message = memo2(({
|
|
898
852
|
message,
|
|
899
853
|
isUser,
|
|
900
854
|
userAvatar,
|
|
@@ -906,12 +860,11 @@ var Message = memo(({
|
|
|
906
860
|
enableCopy = true,
|
|
907
861
|
enableEdit = true,
|
|
908
862
|
enableRegenerate = true,
|
|
909
|
-
|
|
863
|
+
activityDisplay = "full",
|
|
910
864
|
compactMode = false,
|
|
911
865
|
onAction,
|
|
912
866
|
className = "",
|
|
913
|
-
|
|
914
|
-
thinkingLabel = "Thinking...",
|
|
867
|
+
labels,
|
|
915
868
|
showMoreLabel = "Show more",
|
|
916
869
|
showLessLabel = "Show less",
|
|
917
870
|
collapseLongMessages = false,
|
|
@@ -922,13 +875,12 @@ var Message = memo(({
|
|
|
922
875
|
markdown,
|
|
923
876
|
isExpanded = false,
|
|
924
877
|
onToggleExpanded,
|
|
925
|
-
isGrouped = false,
|
|
926
878
|
agentOptions = []
|
|
927
879
|
}) => {
|
|
928
|
-
const [isEditing, setIsEditing] =
|
|
929
|
-
const [editContent, setEditContent] =
|
|
930
|
-
const [showActions, setShowActions] =
|
|
931
|
-
const [copied, setCopied] =
|
|
880
|
+
const [isEditing, setIsEditing] = useState2(false);
|
|
881
|
+
const [editContent, setEditContent] = useState2(message.content);
|
|
882
|
+
const [showActions, setShowActions] = useState2(false);
|
|
883
|
+
const [copied, setCopied] = useState2(false);
|
|
932
884
|
const messageIsUser = isUser ?? message.role === "user";
|
|
933
885
|
const agentSender = !messageIsUser && message.senderAgentId ? agentOptions.find(
|
|
934
886
|
(a) => a.id === message.senderAgentId || a.name.toLowerCase() === (message.senderAgentId ?? "").toLowerCase() || a.name.toLowerCase() === (message.senderName ?? "").toLowerCase()
|
|
@@ -988,20 +940,20 @@ var Message = memo(({
|
|
|
988
940
|
minute: "2-digit"
|
|
989
941
|
});
|
|
990
942
|
};
|
|
991
|
-
return /* @__PURE__ */
|
|
943
|
+
return /* @__PURE__ */ jsxs3(
|
|
992
944
|
"div",
|
|
993
945
|
{
|
|
994
946
|
className: `flex w-full flex-col ${className} max-w-[800px] mx-auto`,
|
|
995
947
|
onMouseEnter: () => setShowActions(true),
|
|
996
948
|
onMouseLeave: () => setShowActions(false),
|
|
997
949
|
children: [
|
|
998
|
-
|
|
999
|
-
showAvatar && /* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
/* @__PURE__ */
|
|
1002
|
-
] }) : agentSender ? /* @__PURE__ */
|
|
1003
|
-
agentSender.avatarUrl ? /* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
950
|
+
/* @__PURE__ */ jsxs3("div", { className: `flex gap-3 ${messageIsUser ? "flex-row-reverse" : "flex-row"} w-full mb-1`, children: [
|
|
951
|
+
showAvatar && /* @__PURE__ */ jsx8("div", { className: `flex-shrink-0 ${compactMode ? "mt-1" : "mt-0"}`, children: /* @__PURE__ */ jsx8(Avatar, { className: compactMode ? "h-6 w-6" : "h-8 w-8", children: messageIsUser ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
952
|
+
/* @__PURE__ */ jsx8(AvatarImage, { src: userAvatar, alt: userName }),
|
|
953
|
+
/* @__PURE__ */ jsx8(AvatarFallback, { className: "bg-primary text-primary-foreground", children: userName.charAt(0).toUpperCase() })
|
|
954
|
+
] }) : agentSender ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
955
|
+
agentSender.avatarUrl ? /* @__PURE__ */ jsx8(AvatarImage, { src: agentSender.avatarUrl, alt: agentSender.name }) : null,
|
|
956
|
+
/* @__PURE__ */ jsx8(
|
|
1005
957
|
AvatarFallback,
|
|
1006
958
|
{
|
|
1007
959
|
style: agentColor ? { backgroundColor: agentColor, color: "white" } : void 0,
|
|
@@ -1009,9 +961,9 @@ var Message = memo(({
|
|
|
1009
961
|
children: getAgentInitials(agentSender.name)
|
|
1010
962
|
}
|
|
1011
963
|
)
|
|
1012
|
-
] }) : /* @__PURE__ */
|
|
1013
|
-
/* @__PURE__ */
|
|
1014
|
-
/* @__PURE__ */
|
|
964
|
+
] }) : /* @__PURE__ */ jsx8(Fragment, { children: assistantAvatar || /* @__PURE__ */ jsx8(AvatarFallback, { className: "bg-secondary text-secondary-foreground", children: "AI" }) }) }) }),
|
|
965
|
+
/* @__PURE__ */ jsxs3("div", { className: `flex items-center gap-2 mb-1 ${messageIsUser ? "flex-row-reverse" : "flex-row"}`, children: [
|
|
966
|
+
/* @__PURE__ */ jsx8(
|
|
1015
967
|
"span",
|
|
1016
968
|
{
|
|
1017
969
|
className: `font-medium ${compactMode ? "text-sm" : "text-base"}`,
|
|
@@ -1019,13 +971,13 @@ var Message = memo(({
|
|
|
1019
971
|
children: messageIsUser ? userName : resolvedAssistantName
|
|
1020
972
|
}
|
|
1021
973
|
),
|
|
1022
|
-
showTimestamp && /* @__PURE__ */
|
|
1023
|
-
message.isEdited && /* @__PURE__ */
|
|
974
|
+
showTimestamp && /* @__PURE__ */ jsx8("span", { className: "text-xs text-muted-foreground", children: formatTime(message.timestamp) }),
|
|
975
|
+
message.isEdited && /* @__PURE__ */ jsx8(Badge, { variant: "outline", className: "text-xs", children: "editado" })
|
|
1024
976
|
] })
|
|
1025
977
|
] }),
|
|
1026
|
-
/* @__PURE__ */
|
|
1027
|
-
isEditing ? /* @__PURE__ */
|
|
1028
|
-
/* @__PURE__ */
|
|
978
|
+
/* @__PURE__ */ jsx8("div", { className: `flex-1 min-w-0 ${messageIsUser ? "text-right" : "text-left"} ${horizontalOffsetClass}`, children: /* @__PURE__ */ jsxs3("div", { className: `relative inline-flex flex-col overflow-hidden text-left ${messageIsUser ? "rounded-lg p-3 bg-primary text-primary-foreground ml-auto max-w-[85%]" : "max-w-full"}`, children: [
|
|
979
|
+
isEditing ? /* @__PURE__ */ jsxs3("div", { className: "space-y-2", children: [
|
|
980
|
+
/* @__PURE__ */ jsx8(
|
|
1029
981
|
Textarea,
|
|
1030
982
|
{
|
|
1031
983
|
value: editContent,
|
|
@@ -1034,40 +986,37 @@ var Message = memo(({
|
|
|
1034
986
|
autoFocus: true
|
|
1035
987
|
}
|
|
1036
988
|
),
|
|
1037
|
-
/* @__PURE__ */
|
|
1038
|
-
/* @__PURE__ */
|
|
1039
|
-
/* @__PURE__ */
|
|
989
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex gap-2 justify-end", children: [
|
|
990
|
+
/* @__PURE__ */ jsxs3(Button, { variant: "outline", size: "sm", onClick: handleCancelEdit, children: [
|
|
991
|
+
/* @__PURE__ */ jsx8(X, { className: "h-4 w-4 mr-1" }),
|
|
1040
992
|
"Cancelar"
|
|
1041
993
|
] }),
|
|
1042
|
-
/* @__PURE__ */
|
|
1043
|
-
/* @__PURE__ */
|
|
994
|
+
/* @__PURE__ */ jsxs3(Button, { size: "sm", onClick: handleEdit, children: [
|
|
995
|
+
/* @__PURE__ */ jsx8(Check, { className: "h-4 w-4 mr-1" }),
|
|
1044
996
|
"Salvar"
|
|
1045
997
|
] })
|
|
1046
998
|
] })
|
|
1047
|
-
] }) : /* @__PURE__ */
|
|
1048
|
-
!messageIsUser &&
|
|
1049
|
-
|
|
999
|
+
] }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1000
|
+
!messageIsUser && /* @__PURE__ */ jsx8(
|
|
1001
|
+
AssistantActivity,
|
|
1050
1002
|
{
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1003
|
+
activity: message.activity,
|
|
1004
|
+
displayMode: activityDisplay,
|
|
1005
|
+
labels
|
|
1054
1006
|
}
|
|
1055
1007
|
),
|
|
1056
|
-
|
|
1057
|
-
/* @__PURE__ */ jsx7(
|
|
1008
|
+
/* @__PURE__ */ jsx8(
|
|
1058
1009
|
StreamingText,
|
|
1059
1010
|
{
|
|
1060
1011
|
content: contentToRender,
|
|
1061
1012
|
isStreaming: message.isStreaming,
|
|
1062
|
-
thinkingLabel,
|
|
1063
1013
|
renderMarkdown: shouldRenderMarkdown,
|
|
1064
1014
|
markdown,
|
|
1065
1015
|
plainTextChunkChars: normalizedChunkChars,
|
|
1066
|
-
contentStyle
|
|
1067
|
-
hideThinkingIndicator: !!message.reasoning
|
|
1016
|
+
contentStyle
|
|
1068
1017
|
}
|
|
1069
1018
|
),
|
|
1070
|
-
canCollapseMessage && /* @__PURE__ */
|
|
1019
|
+
canCollapseMessage && /* @__PURE__ */ jsx8("div", { className: "mt-3", children: /* @__PURE__ */ jsx8(
|
|
1071
1020
|
Button,
|
|
1072
1021
|
{
|
|
1073
1022
|
type: "button",
|
|
@@ -1079,47 +1028,47 @@ var Message = memo(({
|
|
|
1079
1028
|
children: isCollapsed ? showMoreLabel : showLessLabel
|
|
1080
1029
|
}
|
|
1081
1030
|
) }),
|
|
1082
|
-
message.attachments && message.attachments.length > 0 && /* @__PURE__ */
|
|
1031
|
+
message.attachments && message.attachments.length > 0 && /* @__PURE__ */ jsx8("div", { className: "mt-3 space-y-2", children: message.attachments.map((attachment, index) => /* @__PURE__ */ jsx8(MediaRenderer, { attachment }, index)) })
|
|
1083
1032
|
] }),
|
|
1084
|
-
!isEditing && (showActions || copied) && /* @__PURE__ */
|
|
1085
|
-
enableCopy && /* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */
|
|
1033
|
+
!isEditing && (showActions || copied) && /* @__PURE__ */ jsxs3("div", { className: `absolute -top-2 flex gap-1 ${messageIsUser ? "-left-2" : "-right-2"}`, children: [
|
|
1034
|
+
enableCopy && /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
|
1035
|
+
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
1087
1036
|
Button,
|
|
1088
1037
|
{
|
|
1089
1038
|
variant: "secondary",
|
|
1090
1039
|
size: "icon",
|
|
1091
1040
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1092
1041
|
onClick: handleCopy,
|
|
1093
|
-
children: copied ? /* @__PURE__ */
|
|
1042
|
+
children: copied ? /* @__PURE__ */ jsx8(Check, { className: "h-3 w-3 text-green-500" }) : /* @__PURE__ */ jsx8(Copy, { className: "h-3 w-3" })
|
|
1094
1043
|
}
|
|
1095
1044
|
) }),
|
|
1096
|
-
/* @__PURE__ */
|
|
1045
|
+
/* @__PURE__ */ jsx8(TooltipContent, { children: copied ? "Copiado!" : "Copiar" })
|
|
1097
1046
|
] }),
|
|
1098
|
-
canEdit && /* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1047
|
+
canEdit && /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
|
1048
|
+
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
1100
1049
|
Button,
|
|
1101
1050
|
{
|
|
1102
1051
|
variant: "secondary",
|
|
1103
1052
|
size: "icon",
|
|
1104
1053
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1105
1054
|
onClick: handleEdit,
|
|
1106
|
-
children: /* @__PURE__ */
|
|
1055
|
+
children: /* @__PURE__ */ jsx8(Edit, { className: "h-3 w-3" })
|
|
1107
1056
|
}
|
|
1108
1057
|
) }),
|
|
1109
|
-
/* @__PURE__ */
|
|
1058
|
+
/* @__PURE__ */ jsx8(TooltipContent, { children: "Editar" })
|
|
1110
1059
|
] }),
|
|
1111
|
-
canRegenerate && /* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1060
|
+
canRegenerate && /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
|
1061
|
+
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
1113
1062
|
Button,
|
|
1114
1063
|
{
|
|
1115
1064
|
variant: "secondary",
|
|
1116
1065
|
size: "icon",
|
|
1117
1066
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1118
1067
|
onClick: handleRegenerate,
|
|
1119
|
-
children: /* @__PURE__ */
|
|
1068
|
+
children: /* @__PURE__ */ jsx8(RotateCcw, { className: "h-3 w-3" })
|
|
1120
1069
|
}
|
|
1121
1070
|
) }),
|
|
1122
|
-
/* @__PURE__ */
|
|
1071
|
+
/* @__PURE__ */ jsx8(TooltipContent, { children: "Regenerar" })
|
|
1123
1072
|
] })
|
|
1124
1073
|
] })
|
|
1125
1074
|
] }) })
|
|
@@ -1129,12 +1078,12 @@ var Message = memo(({
|
|
|
1129
1078
|
}, arePropsEqual);
|
|
1130
1079
|
|
|
1131
1080
|
// src/components/chat/Sidebar.tsx
|
|
1132
|
-
import { useState as
|
|
1081
|
+
import { useState as useState5, useRef as useRef4, useEffect as useEffect8 } from "react";
|
|
1133
1082
|
|
|
1134
1083
|
// src/components/ui/input.tsx
|
|
1135
|
-
import { jsx as
|
|
1084
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1136
1085
|
function Input({ className, type, ...props }) {
|
|
1137
|
-
return /* @__PURE__ */
|
|
1086
|
+
return /* @__PURE__ */ jsx9(
|
|
1138
1087
|
"input",
|
|
1139
1088
|
{
|
|
1140
1089
|
type,
|
|
@@ -1151,17 +1100,17 @@ function Input({ className, type, ...props }) {
|
|
|
1151
1100
|
}
|
|
1152
1101
|
|
|
1153
1102
|
// src/components/ui/sidebar.tsx
|
|
1154
|
-
import * as
|
|
1103
|
+
import * as React5 from "react";
|
|
1155
1104
|
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
1156
1105
|
import { cva as cva3 } from "class-variance-authority";
|
|
1157
1106
|
import { PanelLeftIcon } from "lucide-react";
|
|
1158
1107
|
|
|
1159
1108
|
// src/hooks/use-mobile.ts
|
|
1160
|
-
import * as
|
|
1109
|
+
import * as React3 from "react";
|
|
1161
1110
|
var MOBILE_BREAKPOINT = 768;
|
|
1162
1111
|
function useIsMobile() {
|
|
1163
|
-
const [isMobile, setIsMobile] =
|
|
1164
|
-
|
|
1112
|
+
const [isMobile, setIsMobile] = React3.useState(void 0);
|
|
1113
|
+
React3.useEffect(() => {
|
|
1165
1114
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
1166
1115
|
const onChange = () => {
|
|
1167
1116
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -1175,14 +1124,14 @@ function useIsMobile() {
|
|
|
1175
1124
|
|
|
1176
1125
|
// src/components/ui/separator.tsx
|
|
1177
1126
|
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
1178
|
-
import { jsx as
|
|
1127
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1179
1128
|
function Separator({
|
|
1180
1129
|
className,
|
|
1181
1130
|
orientation = "horizontal",
|
|
1182
1131
|
decorative = true,
|
|
1183
1132
|
...props
|
|
1184
1133
|
}) {
|
|
1185
|
-
return /* @__PURE__ */
|
|
1134
|
+
return /* @__PURE__ */ jsx10(
|
|
1186
1135
|
SeparatorPrimitive.Root,
|
|
1187
1136
|
{
|
|
1188
1137
|
"data-slot": "separator",
|
|
@@ -1198,41 +1147,41 @@ function Separator({
|
|
|
1198
1147
|
}
|
|
1199
1148
|
|
|
1200
1149
|
// src/components/ui/sheet.tsx
|
|
1201
|
-
import * as
|
|
1150
|
+
import * as React4 from "react";
|
|
1202
1151
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
1203
1152
|
import { XIcon } from "lucide-react";
|
|
1204
|
-
import { jsx as
|
|
1153
|
+
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1205
1154
|
function cleanupBodyStyles() {
|
|
1206
1155
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1207
1156
|
document.body.style.pointerEvents = "";
|
|
1208
1157
|
}
|
|
1209
1158
|
}
|
|
1210
1159
|
function Sheet({ open, onOpenChange, ...props }) {
|
|
1211
|
-
const prevOpenRef =
|
|
1212
|
-
|
|
1160
|
+
const prevOpenRef = React4.useRef(open);
|
|
1161
|
+
React4.useEffect(() => {
|
|
1213
1162
|
if (prevOpenRef.current === true && open === false) {
|
|
1214
1163
|
const timeout = setTimeout(cleanupBodyStyles, 350);
|
|
1215
1164
|
return () => clearTimeout(timeout);
|
|
1216
1165
|
}
|
|
1217
1166
|
prevOpenRef.current = open;
|
|
1218
1167
|
}, [open]);
|
|
1219
|
-
|
|
1168
|
+
React4.useEffect(() => {
|
|
1220
1169
|
return () => {
|
|
1221
1170
|
cleanupBodyStyles();
|
|
1222
1171
|
};
|
|
1223
1172
|
}, []);
|
|
1224
|
-
return /* @__PURE__ */
|
|
1173
|
+
return /* @__PURE__ */ jsx11(SheetPrimitive.Root, { "data-slot": "sheet", open, onOpenChange, ...props });
|
|
1225
1174
|
}
|
|
1226
1175
|
function SheetPortal({
|
|
1227
1176
|
...props
|
|
1228
1177
|
}) {
|
|
1229
|
-
return /* @__PURE__ */
|
|
1178
|
+
return /* @__PURE__ */ jsx11(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
1230
1179
|
}
|
|
1231
1180
|
function SheetOverlay({
|
|
1232
1181
|
className,
|
|
1233
1182
|
...props
|
|
1234
1183
|
}) {
|
|
1235
|
-
return /* @__PURE__ */
|
|
1184
|
+
return /* @__PURE__ */ jsx11(
|
|
1236
1185
|
SheetPrimitive.Overlay,
|
|
1237
1186
|
{
|
|
1238
1187
|
"data-slot": "sheet-overlay",
|
|
@@ -1253,9 +1202,9 @@ function SheetContent({
|
|
|
1253
1202
|
side = "right",
|
|
1254
1203
|
...props
|
|
1255
1204
|
}) {
|
|
1256
|
-
return /* @__PURE__ */
|
|
1257
|
-
/* @__PURE__ */
|
|
1258
|
-
/* @__PURE__ */
|
|
1205
|
+
return /* @__PURE__ */ jsxs4(SheetPortal, { children: [
|
|
1206
|
+
/* @__PURE__ */ jsx11(SheetOverlay, {}),
|
|
1207
|
+
/* @__PURE__ */ jsxs4(
|
|
1259
1208
|
SheetPrimitive.Content,
|
|
1260
1209
|
{
|
|
1261
1210
|
"data-slot": "sheet-content",
|
|
@@ -1271,9 +1220,9 @@ function SheetContent({
|
|
|
1271
1220
|
...props,
|
|
1272
1221
|
children: [
|
|
1273
1222
|
children,
|
|
1274
|
-
/* @__PURE__ */
|
|
1275
|
-
/* @__PURE__ */
|
|
1276
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ jsxs4(SheetPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
|
|
1224
|
+
/* @__PURE__ */ jsx11(XIcon, { className: "size-4" }),
|
|
1225
|
+
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: "Close" })
|
|
1277
1226
|
] })
|
|
1278
1227
|
]
|
|
1279
1228
|
}
|
|
@@ -1281,7 +1230,7 @@ function SheetContent({
|
|
|
1281
1230
|
] });
|
|
1282
1231
|
}
|
|
1283
1232
|
function SheetHeader({ className, ...props }) {
|
|
1284
|
-
return /* @__PURE__ */
|
|
1233
|
+
return /* @__PURE__ */ jsx11(
|
|
1285
1234
|
"div",
|
|
1286
1235
|
{
|
|
1287
1236
|
"data-slot": "sheet-header",
|
|
@@ -1294,7 +1243,7 @@ function SheetTitle({
|
|
|
1294
1243
|
className,
|
|
1295
1244
|
...props
|
|
1296
1245
|
}) {
|
|
1297
|
-
return /* @__PURE__ */
|
|
1246
|
+
return /* @__PURE__ */ jsx11(
|
|
1298
1247
|
SheetPrimitive.Title,
|
|
1299
1248
|
{
|
|
1300
1249
|
"data-slot": "sheet-title",
|
|
@@ -1307,7 +1256,7 @@ function SheetDescription({
|
|
|
1307
1256
|
className,
|
|
1308
1257
|
...props
|
|
1309
1258
|
}) {
|
|
1310
|
-
return /* @__PURE__ */
|
|
1259
|
+
return /* @__PURE__ */ jsx11(
|
|
1311
1260
|
SheetPrimitive.Description,
|
|
1312
1261
|
{
|
|
1313
1262
|
"data-slot": "sheet-description",
|
|
@@ -1318,9 +1267,9 @@ function SheetDescription({
|
|
|
1318
1267
|
}
|
|
1319
1268
|
|
|
1320
1269
|
// src/components/ui/skeleton.tsx
|
|
1321
|
-
import { jsx as
|
|
1270
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1322
1271
|
function Skeleton({ className, ...props }) {
|
|
1323
|
-
return /* @__PURE__ */
|
|
1272
|
+
return /* @__PURE__ */ jsx12(
|
|
1324
1273
|
"div",
|
|
1325
1274
|
{
|
|
1326
1275
|
"data-slot": "skeleton",
|
|
@@ -1331,16 +1280,16 @@ function Skeleton({ className, ...props }) {
|
|
|
1331
1280
|
}
|
|
1332
1281
|
|
|
1333
1282
|
// src/components/ui/sidebar.tsx
|
|
1334
|
-
import { jsx as
|
|
1283
|
+
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1335
1284
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
1336
1285
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
1337
1286
|
var SIDEBAR_WIDTH = "16rem";
|
|
1338
1287
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
1339
1288
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
1340
1289
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
1341
|
-
var SidebarContext =
|
|
1290
|
+
var SidebarContext = React5.createContext(null);
|
|
1342
1291
|
function useSidebar() {
|
|
1343
|
-
const context =
|
|
1292
|
+
const context = React5.useContext(SidebarContext);
|
|
1344
1293
|
if (!context) {
|
|
1345
1294
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
1346
1295
|
}
|
|
@@ -1356,10 +1305,10 @@ function SidebarProvider({
|
|
|
1356
1305
|
...props
|
|
1357
1306
|
}) {
|
|
1358
1307
|
const isMobile = useIsMobile();
|
|
1359
|
-
const [openMobile, setOpenMobile] =
|
|
1360
|
-
const [_open, _setOpen] =
|
|
1308
|
+
const [openMobile, setOpenMobile] = React5.useState(false);
|
|
1309
|
+
const [_open, _setOpen] = React5.useState(defaultOpen);
|
|
1361
1310
|
const open = openProp ?? _open;
|
|
1362
|
-
const setOpen =
|
|
1311
|
+
const setOpen = React5.useCallback(
|
|
1363
1312
|
(value) => {
|
|
1364
1313
|
const openState = typeof value === "function" ? value(open) : value;
|
|
1365
1314
|
if (setOpenProp) {
|
|
@@ -1371,10 +1320,10 @@ function SidebarProvider({
|
|
|
1371
1320
|
},
|
|
1372
1321
|
[setOpenProp, open]
|
|
1373
1322
|
);
|
|
1374
|
-
const toggleSidebar =
|
|
1323
|
+
const toggleSidebar = React5.useCallback(() => {
|
|
1375
1324
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
1376
1325
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
1377
|
-
|
|
1326
|
+
React5.useEffect(() => {
|
|
1378
1327
|
const handleKeyDown = (event) => {
|
|
1379
1328
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
1380
1329
|
event.preventDefault();
|
|
@@ -1385,7 +1334,7 @@ function SidebarProvider({
|
|
|
1385
1334
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1386
1335
|
}, [toggleSidebar]);
|
|
1387
1336
|
const state = open ? "expanded" : "collapsed";
|
|
1388
|
-
const contextValue =
|
|
1337
|
+
const contextValue = React5.useMemo(
|
|
1389
1338
|
() => ({
|
|
1390
1339
|
state,
|
|
1391
1340
|
open,
|
|
@@ -1397,7 +1346,7 @@ function SidebarProvider({
|
|
|
1397
1346
|
}),
|
|
1398
1347
|
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
1399
1348
|
);
|
|
1400
|
-
return /* @__PURE__ */
|
|
1349
|
+
return /* @__PURE__ */ jsx13(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx13(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx13(
|
|
1401
1350
|
"div",
|
|
1402
1351
|
{
|
|
1403
1352
|
"data-slot": "sidebar-wrapper",
|
|
@@ -1425,7 +1374,7 @@ function Sidebar({
|
|
|
1425
1374
|
}) {
|
|
1426
1375
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
1427
1376
|
if (collapsible === "none") {
|
|
1428
|
-
return /* @__PURE__ */
|
|
1377
|
+
return /* @__PURE__ */ jsx13(
|
|
1429
1378
|
"div",
|
|
1430
1379
|
{
|
|
1431
1380
|
"data-slot": "sidebar",
|
|
@@ -1439,7 +1388,7 @@ function Sidebar({
|
|
|
1439
1388
|
);
|
|
1440
1389
|
}
|
|
1441
1390
|
if (isMobile) {
|
|
1442
|
-
return /* @__PURE__ */
|
|
1391
|
+
return /* @__PURE__ */ jsx13(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs5(
|
|
1443
1392
|
SheetContent,
|
|
1444
1393
|
{
|
|
1445
1394
|
"data-sidebar": "sidebar",
|
|
@@ -1451,16 +1400,16 @@ function Sidebar({
|
|
|
1451
1400
|
},
|
|
1452
1401
|
side,
|
|
1453
1402
|
children: [
|
|
1454
|
-
/* @__PURE__ */
|
|
1455
|
-
/* @__PURE__ */
|
|
1456
|
-
/* @__PURE__ */
|
|
1403
|
+
/* @__PURE__ */ jsxs5(SheetHeader, { className: "sr-only", children: [
|
|
1404
|
+
/* @__PURE__ */ jsx13(SheetTitle, { children: "Sidebar" }),
|
|
1405
|
+
/* @__PURE__ */ jsx13(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
1457
1406
|
] }),
|
|
1458
|
-
/* @__PURE__ */
|
|
1407
|
+
/* @__PURE__ */ jsx13("div", { className: "flex h-full w-full flex-col", children })
|
|
1459
1408
|
]
|
|
1460
1409
|
}
|
|
1461
1410
|
) });
|
|
1462
1411
|
}
|
|
1463
|
-
return /* @__PURE__ */
|
|
1412
|
+
return /* @__PURE__ */ jsxs5(
|
|
1464
1413
|
"div",
|
|
1465
1414
|
{
|
|
1466
1415
|
className: "group peer text-sidebar-foreground hidden md:block",
|
|
@@ -1470,7 +1419,7 @@ function Sidebar({
|
|
|
1470
1419
|
"data-side": side,
|
|
1471
1420
|
"data-slot": "sidebar",
|
|
1472
1421
|
children: [
|
|
1473
|
-
/* @__PURE__ */
|
|
1422
|
+
/* @__PURE__ */ jsx13(
|
|
1474
1423
|
"div",
|
|
1475
1424
|
{
|
|
1476
1425
|
"data-slot": "sidebar-gap",
|
|
@@ -1482,7 +1431,7 @@ function Sidebar({
|
|
|
1482
1431
|
)
|
|
1483
1432
|
}
|
|
1484
1433
|
),
|
|
1485
|
-
/* @__PURE__ */
|
|
1434
|
+
/* @__PURE__ */ jsx13(
|
|
1486
1435
|
"div",
|
|
1487
1436
|
{
|
|
1488
1437
|
"data-slot": "sidebar-container",
|
|
@@ -1494,7 +1443,7 @@ function Sidebar({
|
|
|
1494
1443
|
className
|
|
1495
1444
|
),
|
|
1496
1445
|
...props,
|
|
1497
|
-
children: /* @__PURE__ */
|
|
1446
|
+
children: /* @__PURE__ */ jsx13(
|
|
1498
1447
|
"div",
|
|
1499
1448
|
{
|
|
1500
1449
|
"data-sidebar": "sidebar",
|
|
@@ -1515,7 +1464,7 @@ function SidebarTrigger({
|
|
|
1515
1464
|
...props
|
|
1516
1465
|
}) {
|
|
1517
1466
|
const { toggleSidebar } = useSidebar();
|
|
1518
|
-
return /* @__PURE__ */
|
|
1467
|
+
return /* @__PURE__ */ jsxs5(
|
|
1519
1468
|
Button,
|
|
1520
1469
|
{
|
|
1521
1470
|
"data-sidebar": "trigger",
|
|
@@ -1529,15 +1478,15 @@ function SidebarTrigger({
|
|
|
1529
1478
|
},
|
|
1530
1479
|
...props,
|
|
1531
1480
|
children: [
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1481
|
+
/* @__PURE__ */ jsx13(PanelLeftIcon, {}),
|
|
1482
|
+
/* @__PURE__ */ jsx13("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
1534
1483
|
]
|
|
1535
1484
|
}
|
|
1536
1485
|
);
|
|
1537
1486
|
}
|
|
1538
1487
|
function SidebarRail({ className, ...props }) {
|
|
1539
1488
|
const { toggleSidebar } = useSidebar();
|
|
1540
|
-
return /* @__PURE__ */
|
|
1489
|
+
return /* @__PURE__ */ jsx13(
|
|
1541
1490
|
"button",
|
|
1542
1491
|
{
|
|
1543
1492
|
"data-sidebar": "rail",
|
|
@@ -1560,7 +1509,7 @@ function SidebarRail({ className, ...props }) {
|
|
|
1560
1509
|
);
|
|
1561
1510
|
}
|
|
1562
1511
|
function SidebarInset({ className, ...props }) {
|
|
1563
|
-
return /* @__PURE__ */
|
|
1512
|
+
return /* @__PURE__ */ jsx13(
|
|
1564
1513
|
"main",
|
|
1565
1514
|
{
|
|
1566
1515
|
"data-slot": "sidebar-inset",
|
|
@@ -1574,7 +1523,7 @@ function SidebarInset({ className, ...props }) {
|
|
|
1574
1523
|
);
|
|
1575
1524
|
}
|
|
1576
1525
|
function SidebarHeader({ className, ...props }) {
|
|
1577
|
-
return /* @__PURE__ */
|
|
1526
|
+
return /* @__PURE__ */ jsx13(
|
|
1578
1527
|
"div",
|
|
1579
1528
|
{
|
|
1580
1529
|
"data-slot": "sidebar-header",
|
|
@@ -1585,7 +1534,7 @@ function SidebarHeader({ className, ...props }) {
|
|
|
1585
1534
|
);
|
|
1586
1535
|
}
|
|
1587
1536
|
function SidebarFooter({ className, ...props }) {
|
|
1588
|
-
return /* @__PURE__ */
|
|
1537
|
+
return /* @__PURE__ */ jsx13(
|
|
1589
1538
|
"div",
|
|
1590
1539
|
{
|
|
1591
1540
|
"data-slot": "sidebar-footer",
|
|
@@ -1596,7 +1545,7 @@ function SidebarFooter({ className, ...props }) {
|
|
|
1596
1545
|
);
|
|
1597
1546
|
}
|
|
1598
1547
|
function SidebarContent({ className, ...props }) {
|
|
1599
|
-
return /* @__PURE__ */
|
|
1548
|
+
return /* @__PURE__ */ jsx13(
|
|
1600
1549
|
"div",
|
|
1601
1550
|
{
|
|
1602
1551
|
"data-slot": "sidebar-content",
|
|
@@ -1610,7 +1559,7 @@ function SidebarContent({ className, ...props }) {
|
|
|
1610
1559
|
);
|
|
1611
1560
|
}
|
|
1612
1561
|
function SidebarGroup({ className, ...props }) {
|
|
1613
|
-
return /* @__PURE__ */
|
|
1562
|
+
return /* @__PURE__ */ jsx13(
|
|
1614
1563
|
"div",
|
|
1615
1564
|
{
|
|
1616
1565
|
"data-slot": "sidebar-group",
|
|
@@ -1626,7 +1575,7 @@ function SidebarGroupLabel({
|
|
|
1626
1575
|
...props
|
|
1627
1576
|
}) {
|
|
1628
1577
|
const Comp = asChild ? Slot3 : "div";
|
|
1629
|
-
return /* @__PURE__ */
|
|
1578
|
+
return /* @__PURE__ */ jsx13(
|
|
1630
1579
|
Comp,
|
|
1631
1580
|
{
|
|
1632
1581
|
"data-slot": "sidebar-group-label",
|
|
@@ -1644,7 +1593,7 @@ function SidebarGroupContent({
|
|
|
1644
1593
|
className,
|
|
1645
1594
|
...props
|
|
1646
1595
|
}) {
|
|
1647
|
-
return /* @__PURE__ */
|
|
1596
|
+
return /* @__PURE__ */ jsx13(
|
|
1648
1597
|
"div",
|
|
1649
1598
|
{
|
|
1650
1599
|
"data-slot": "sidebar-group-content",
|
|
@@ -1655,7 +1604,7 @@ function SidebarGroupContent({
|
|
|
1655
1604
|
);
|
|
1656
1605
|
}
|
|
1657
1606
|
function SidebarMenu({ className, ...props }) {
|
|
1658
|
-
return /* @__PURE__ */
|
|
1607
|
+
return /* @__PURE__ */ jsx13(
|
|
1659
1608
|
"ul",
|
|
1660
1609
|
{
|
|
1661
1610
|
"data-slot": "sidebar-menu",
|
|
@@ -1666,7 +1615,7 @@ function SidebarMenu({ className, ...props }) {
|
|
|
1666
1615
|
);
|
|
1667
1616
|
}
|
|
1668
1617
|
function SidebarMenuItem({ className, ...props }) {
|
|
1669
|
-
return /* @__PURE__ */
|
|
1618
|
+
return /* @__PURE__ */ jsx13(
|
|
1670
1619
|
"li",
|
|
1671
1620
|
{
|
|
1672
1621
|
"data-slot": "sidebar-menu-item",
|
|
@@ -1707,7 +1656,7 @@ function SidebarMenuButton({
|
|
|
1707
1656
|
}) {
|
|
1708
1657
|
const Comp = asChild ? Slot3 : "button";
|
|
1709
1658
|
const { isMobile, state } = useSidebar();
|
|
1710
|
-
const button = /* @__PURE__ */
|
|
1659
|
+
const button = /* @__PURE__ */ jsx13(
|
|
1711
1660
|
Comp,
|
|
1712
1661
|
{
|
|
1713
1662
|
"data-slot": "sidebar-menu-button",
|
|
@@ -1726,9 +1675,9 @@ function SidebarMenuButton({
|
|
|
1726
1675
|
children: tooltip
|
|
1727
1676
|
};
|
|
1728
1677
|
}
|
|
1729
|
-
return /* @__PURE__ */
|
|
1730
|
-
/* @__PURE__ */
|
|
1731
|
-
/* @__PURE__ */
|
|
1678
|
+
return /* @__PURE__ */ jsxs5(Tooltip, { children: [
|
|
1679
|
+
/* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: button }),
|
|
1680
|
+
/* @__PURE__ */ jsx13(
|
|
1732
1681
|
TooltipContent,
|
|
1733
1682
|
{
|
|
1734
1683
|
side: "right",
|
|
@@ -1746,7 +1695,7 @@ function SidebarMenuAction({
|
|
|
1746
1695
|
...props
|
|
1747
1696
|
}) {
|
|
1748
1697
|
const Comp = asChild ? Slot3 : "button";
|
|
1749
|
-
return /* @__PURE__ */
|
|
1698
|
+
return /* @__PURE__ */ jsx13(
|
|
1750
1699
|
Comp,
|
|
1751
1700
|
{
|
|
1752
1701
|
"data-slot": "sidebar-menu-action",
|
|
@@ -1768,10 +1717,10 @@ function SidebarMenuAction({
|
|
|
1768
1717
|
}
|
|
1769
1718
|
|
|
1770
1719
|
// src/components/ui/dialog.tsx
|
|
1771
|
-
import * as
|
|
1720
|
+
import * as React6 from "react";
|
|
1772
1721
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
1773
1722
|
import { XIcon as XIcon2 } from "lucide-react";
|
|
1774
|
-
import { jsx as
|
|
1723
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1775
1724
|
function cleanupBodyStyles2() {
|
|
1776
1725
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1777
1726
|
document.body.style.pointerEvents = "";
|
|
@@ -1782,36 +1731,36 @@ function Dialog({
|
|
|
1782
1731
|
onOpenChange,
|
|
1783
1732
|
...props
|
|
1784
1733
|
}) {
|
|
1785
|
-
const prevOpenRef =
|
|
1786
|
-
|
|
1734
|
+
const prevOpenRef = React6.useRef(open);
|
|
1735
|
+
React6.useEffect(() => {
|
|
1787
1736
|
if (prevOpenRef.current === true && open === false) {
|
|
1788
1737
|
const timeout = setTimeout(cleanupBodyStyles2, 250);
|
|
1789
1738
|
return () => clearTimeout(timeout);
|
|
1790
1739
|
}
|
|
1791
1740
|
prevOpenRef.current = open;
|
|
1792
1741
|
}, [open]);
|
|
1793
|
-
|
|
1742
|
+
React6.useEffect(() => {
|
|
1794
1743
|
return () => {
|
|
1795
1744
|
cleanupBodyStyles2();
|
|
1796
1745
|
};
|
|
1797
1746
|
}, []);
|
|
1798
|
-
return /* @__PURE__ */
|
|
1747
|
+
return /* @__PURE__ */ jsx14(DialogPrimitive.Root, { "data-slot": "dialog", open, onOpenChange, ...props });
|
|
1799
1748
|
}
|
|
1800
1749
|
function DialogTrigger({
|
|
1801
1750
|
...props
|
|
1802
1751
|
}) {
|
|
1803
|
-
return /* @__PURE__ */
|
|
1752
|
+
return /* @__PURE__ */ jsx14(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
1804
1753
|
}
|
|
1805
1754
|
function DialogPortal({
|
|
1806
1755
|
...props
|
|
1807
1756
|
}) {
|
|
1808
|
-
return /* @__PURE__ */
|
|
1757
|
+
return /* @__PURE__ */ jsx14(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
1809
1758
|
}
|
|
1810
1759
|
function DialogOverlay({
|
|
1811
1760
|
className,
|
|
1812
1761
|
...props
|
|
1813
1762
|
}) {
|
|
1814
|
-
return /* @__PURE__ */
|
|
1763
|
+
return /* @__PURE__ */ jsx14(
|
|
1815
1764
|
DialogPrimitive.Overlay,
|
|
1816
1765
|
{
|
|
1817
1766
|
"data-slot": "dialog-overlay",
|
|
@@ -1832,9 +1781,9 @@ function DialogContent({
|
|
|
1832
1781
|
showCloseButton = true,
|
|
1833
1782
|
...props
|
|
1834
1783
|
}) {
|
|
1835
|
-
return /* @__PURE__ */
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
/* @__PURE__ */
|
|
1784
|
+
return /* @__PURE__ */ jsxs6(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
1785
|
+
/* @__PURE__ */ jsx14(DialogOverlay, {}),
|
|
1786
|
+
/* @__PURE__ */ jsxs6(
|
|
1838
1787
|
DialogPrimitive.Content,
|
|
1839
1788
|
{
|
|
1840
1789
|
"data-slot": "dialog-content",
|
|
@@ -1846,14 +1795,14 @@ function DialogContent({
|
|
|
1846
1795
|
...props,
|
|
1847
1796
|
children: [
|
|
1848
1797
|
children,
|
|
1849
|
-
showCloseButton && /* @__PURE__ */
|
|
1798
|
+
showCloseButton && /* @__PURE__ */ jsxs6(
|
|
1850
1799
|
DialogPrimitive.Close,
|
|
1851
1800
|
{
|
|
1852
1801
|
"data-slot": "dialog-close",
|
|
1853
1802
|
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
1854
1803
|
children: [
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
/* @__PURE__ */
|
|
1804
|
+
/* @__PURE__ */ jsx14(XIcon2, {}),
|
|
1805
|
+
/* @__PURE__ */ jsx14("span", { className: "sr-only", children: "Close" })
|
|
1857
1806
|
]
|
|
1858
1807
|
}
|
|
1859
1808
|
)
|
|
@@ -1863,7 +1812,7 @@ function DialogContent({
|
|
|
1863
1812
|
] });
|
|
1864
1813
|
}
|
|
1865
1814
|
function DialogHeader({ className, ...props }) {
|
|
1866
|
-
return /* @__PURE__ */
|
|
1815
|
+
return /* @__PURE__ */ jsx14(
|
|
1867
1816
|
"div",
|
|
1868
1817
|
{
|
|
1869
1818
|
"data-slot": "dialog-header",
|
|
@@ -1873,7 +1822,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
1873
1822
|
);
|
|
1874
1823
|
}
|
|
1875
1824
|
function DialogFooter({ className, ...props }) {
|
|
1876
|
-
return /* @__PURE__ */
|
|
1825
|
+
return /* @__PURE__ */ jsx14(
|
|
1877
1826
|
"div",
|
|
1878
1827
|
{
|
|
1879
1828
|
"data-slot": "dialog-footer",
|
|
@@ -1889,7 +1838,7 @@ function DialogTitle({
|
|
|
1889
1838
|
className,
|
|
1890
1839
|
...props
|
|
1891
1840
|
}) {
|
|
1892
|
-
return /* @__PURE__ */
|
|
1841
|
+
return /* @__PURE__ */ jsx14(
|
|
1893
1842
|
DialogPrimitive.Title,
|
|
1894
1843
|
{
|
|
1895
1844
|
"data-slot": "dialog-title",
|
|
@@ -1902,7 +1851,7 @@ function DialogDescription({
|
|
|
1902
1851
|
className,
|
|
1903
1852
|
...props
|
|
1904
1853
|
}) {
|
|
1905
|
-
return /* @__PURE__ */
|
|
1854
|
+
return /* @__PURE__ */ jsx14(
|
|
1906
1855
|
DialogPrimitive.Description,
|
|
1907
1856
|
{
|
|
1908
1857
|
"data-slot": "dialog-description",
|
|
@@ -1913,9 +1862,9 @@ function DialogDescription({
|
|
|
1913
1862
|
}
|
|
1914
1863
|
|
|
1915
1864
|
// src/components/ui/alert-dialog.tsx
|
|
1916
|
-
import * as
|
|
1865
|
+
import * as React7 from "react";
|
|
1917
1866
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
1918
|
-
import { jsx as
|
|
1867
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1919
1868
|
function cleanupBodyStyles3() {
|
|
1920
1869
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1921
1870
|
document.body.style.pointerEvents = "";
|
|
@@ -1926,31 +1875,31 @@ function AlertDialog({
|
|
|
1926
1875
|
onOpenChange,
|
|
1927
1876
|
...props
|
|
1928
1877
|
}) {
|
|
1929
|
-
const prevOpenRef =
|
|
1930
|
-
|
|
1878
|
+
const prevOpenRef = React7.useRef(open);
|
|
1879
|
+
React7.useEffect(() => {
|
|
1931
1880
|
if (prevOpenRef.current === true && open === false) {
|
|
1932
1881
|
const timeout = setTimeout(cleanupBodyStyles3, 250);
|
|
1933
1882
|
return () => clearTimeout(timeout);
|
|
1934
1883
|
}
|
|
1935
1884
|
prevOpenRef.current = open;
|
|
1936
1885
|
}, [open]);
|
|
1937
|
-
|
|
1886
|
+
React7.useEffect(() => {
|
|
1938
1887
|
return () => {
|
|
1939
1888
|
cleanupBodyStyles3();
|
|
1940
1889
|
};
|
|
1941
1890
|
}, []);
|
|
1942
|
-
return /* @__PURE__ */
|
|
1891
|
+
return /* @__PURE__ */ jsx15(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", open, onOpenChange, ...props });
|
|
1943
1892
|
}
|
|
1944
1893
|
function AlertDialogPortal({
|
|
1945
1894
|
...props
|
|
1946
1895
|
}) {
|
|
1947
|
-
return /* @__PURE__ */
|
|
1896
|
+
return /* @__PURE__ */ jsx15(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props });
|
|
1948
1897
|
}
|
|
1949
1898
|
function AlertDialogOverlay({
|
|
1950
1899
|
className,
|
|
1951
1900
|
...props
|
|
1952
1901
|
}) {
|
|
1953
|
-
return /* @__PURE__ */
|
|
1902
|
+
return /* @__PURE__ */ jsx15(
|
|
1954
1903
|
AlertDialogPrimitive.Overlay,
|
|
1955
1904
|
{
|
|
1956
1905
|
"data-slot": "alert-dialog-overlay",
|
|
@@ -1969,9 +1918,9 @@ function AlertDialogContent({
|
|
|
1969
1918
|
className,
|
|
1970
1919
|
...props
|
|
1971
1920
|
}) {
|
|
1972
|
-
return /* @__PURE__ */
|
|
1973
|
-
/* @__PURE__ */
|
|
1974
|
-
/* @__PURE__ */
|
|
1921
|
+
return /* @__PURE__ */ jsxs7(AlertDialogPortal, { children: [
|
|
1922
|
+
/* @__PURE__ */ jsx15(AlertDialogOverlay, {}),
|
|
1923
|
+
/* @__PURE__ */ jsx15(
|
|
1975
1924
|
AlertDialogPrimitive.Content,
|
|
1976
1925
|
{
|
|
1977
1926
|
"data-slot": "alert-dialog-content",
|
|
@@ -1988,7 +1937,7 @@ function AlertDialogHeader({
|
|
|
1988
1937
|
className,
|
|
1989
1938
|
...props
|
|
1990
1939
|
}) {
|
|
1991
|
-
return /* @__PURE__ */
|
|
1940
|
+
return /* @__PURE__ */ jsx15(
|
|
1992
1941
|
"div",
|
|
1993
1942
|
{
|
|
1994
1943
|
"data-slot": "alert-dialog-header",
|
|
@@ -2001,7 +1950,7 @@ function AlertDialogFooter({
|
|
|
2001
1950
|
className,
|
|
2002
1951
|
...props
|
|
2003
1952
|
}) {
|
|
2004
|
-
return /* @__PURE__ */
|
|
1953
|
+
return /* @__PURE__ */ jsx15(
|
|
2005
1954
|
"div",
|
|
2006
1955
|
{
|
|
2007
1956
|
"data-slot": "alert-dialog-footer",
|
|
@@ -2017,7 +1966,7 @@ function AlertDialogTitle({
|
|
|
2017
1966
|
className,
|
|
2018
1967
|
...props
|
|
2019
1968
|
}) {
|
|
2020
|
-
return /* @__PURE__ */
|
|
1969
|
+
return /* @__PURE__ */ jsx15(
|
|
2021
1970
|
AlertDialogPrimitive.Title,
|
|
2022
1971
|
{
|
|
2023
1972
|
"data-slot": "alert-dialog-title",
|
|
@@ -2030,7 +1979,7 @@ function AlertDialogDescription({
|
|
|
2030
1979
|
className,
|
|
2031
1980
|
...props
|
|
2032
1981
|
}) {
|
|
2033
|
-
return /* @__PURE__ */
|
|
1982
|
+
return /* @__PURE__ */ jsx15(
|
|
2034
1983
|
AlertDialogPrimitive.Description,
|
|
2035
1984
|
{
|
|
2036
1985
|
"data-slot": "alert-dialog-description",
|
|
@@ -2043,7 +1992,7 @@ function AlertDialogAction({
|
|
|
2043
1992
|
className,
|
|
2044
1993
|
...props
|
|
2045
1994
|
}) {
|
|
2046
|
-
return /* @__PURE__ */
|
|
1995
|
+
return /* @__PURE__ */ jsx15(
|
|
2047
1996
|
AlertDialogPrimitive.Action,
|
|
2048
1997
|
{
|
|
2049
1998
|
className: cn(buttonVariants(), className),
|
|
@@ -2055,7 +2004,7 @@ function AlertDialogCancel({
|
|
|
2055
2004
|
className,
|
|
2056
2005
|
...props
|
|
2057
2006
|
}) {
|
|
2058
|
-
return /* @__PURE__ */
|
|
2007
|
+
return /* @__PURE__ */ jsx15(
|
|
2059
2008
|
AlertDialogPrimitive.Cancel,
|
|
2060
2009
|
{
|
|
2061
2010
|
className: cn(buttonVariants({ variant: "outline" }), className),
|
|
@@ -2067,16 +2016,16 @@ function AlertDialogCancel({
|
|
|
2067
2016
|
// src/components/ui/dropdown-menu.tsx
|
|
2068
2017
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2069
2018
|
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
2070
|
-
import { jsx as
|
|
2019
|
+
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2071
2020
|
function DropdownMenu({
|
|
2072
2021
|
...props
|
|
2073
2022
|
}) {
|
|
2074
|
-
return /* @__PURE__ */
|
|
2023
|
+
return /* @__PURE__ */ jsx16(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
2075
2024
|
}
|
|
2076
2025
|
function DropdownMenuTrigger({
|
|
2077
2026
|
...props
|
|
2078
2027
|
}) {
|
|
2079
|
-
return /* @__PURE__ */
|
|
2028
|
+
return /* @__PURE__ */ jsx16(
|
|
2080
2029
|
DropdownMenuPrimitive.Trigger,
|
|
2081
2030
|
{
|
|
2082
2031
|
"data-slot": "dropdown-menu-trigger",
|
|
@@ -2089,7 +2038,7 @@ function DropdownMenuContent({
|
|
|
2089
2038
|
sideOffset = 4,
|
|
2090
2039
|
...props
|
|
2091
2040
|
}) {
|
|
2092
|
-
return /* @__PURE__ */
|
|
2041
|
+
return /* @__PURE__ */ jsx16(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx16(
|
|
2093
2042
|
DropdownMenuPrimitive.Content,
|
|
2094
2043
|
{
|
|
2095
2044
|
"data-slot": "dropdown-menu-content",
|
|
@@ -2108,7 +2057,7 @@ function DropdownMenuItem({
|
|
|
2108
2057
|
variant = "default",
|
|
2109
2058
|
...props
|
|
2110
2059
|
}) {
|
|
2111
|
-
return /* @__PURE__ */
|
|
2060
|
+
return /* @__PURE__ */ jsx16(
|
|
2112
2061
|
DropdownMenuPrimitive.Item,
|
|
2113
2062
|
{
|
|
2114
2063
|
"data-slot": "dropdown-menu-item",
|
|
@@ -2127,7 +2076,7 @@ function DropdownMenuLabel({
|
|
|
2127
2076
|
inset,
|
|
2128
2077
|
...props
|
|
2129
2078
|
}) {
|
|
2130
|
-
return /* @__PURE__ */
|
|
2079
|
+
return /* @__PURE__ */ jsx16(
|
|
2131
2080
|
DropdownMenuPrimitive.Label,
|
|
2132
2081
|
{
|
|
2133
2082
|
"data-slot": "dropdown-menu-label",
|
|
@@ -2144,7 +2093,7 @@ function DropdownMenuSeparator({
|
|
|
2144
2093
|
className,
|
|
2145
2094
|
...props
|
|
2146
2095
|
}) {
|
|
2147
|
-
return /* @__PURE__ */
|
|
2096
|
+
return /* @__PURE__ */ jsx16(
|
|
2148
2097
|
DropdownMenuPrimitive.Separator,
|
|
2149
2098
|
{
|
|
2150
2099
|
"data-slot": "dropdown-menu-separator",
|
|
@@ -2176,7 +2125,7 @@ import {
|
|
|
2176
2125
|
Sun,
|
|
2177
2126
|
Palette
|
|
2178
2127
|
} from "lucide-react";
|
|
2179
|
-
import { Fragment as Fragment2, jsx as
|
|
2128
|
+
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2180
2129
|
var getInitials = (name, email) => {
|
|
2181
2130
|
if (name) {
|
|
2182
2131
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -2211,27 +2160,27 @@ var UserMenu = ({
|
|
|
2211
2160
|
};
|
|
2212
2161
|
const displayName = getDisplayName(user, labels.guest);
|
|
2213
2162
|
const initials = getInitials(user?.name, user?.email);
|
|
2214
|
-
return /* @__PURE__ */
|
|
2215
|
-
/* @__PURE__ */
|
|
2163
|
+
return /* @__PURE__ */ jsx17(SidebarMenu, { children: /* @__PURE__ */ jsx17(SidebarMenuItem, { children: /* @__PURE__ */ jsxs9(DropdownMenu, { children: [
|
|
2164
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(
|
|
2216
2165
|
SidebarMenuButton,
|
|
2217
2166
|
{
|
|
2218
2167
|
size: "lg",
|
|
2219
2168
|
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
2220
2169
|
tooltip: displayName,
|
|
2221
2170
|
children: [
|
|
2222
|
-
/* @__PURE__ */
|
|
2223
|
-
user?.avatar && /* @__PURE__ */
|
|
2224
|
-
/* @__PURE__ */
|
|
2171
|
+
/* @__PURE__ */ jsxs9(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
2172
|
+
user?.avatar && /* @__PURE__ */ jsx17(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
2173
|
+
/* @__PURE__ */ jsx17(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
|
|
2225
2174
|
] }),
|
|
2226
|
-
/* @__PURE__ */
|
|
2227
|
-
/* @__PURE__ */
|
|
2228
|
-
user?.email && /* @__PURE__ */
|
|
2175
|
+
/* @__PURE__ */ jsxs9("div", { className: "grid flex-1 text-left text-sm leading-tight group-data-[collapsible=icon]:hidden", children: [
|
|
2176
|
+
/* @__PURE__ */ jsx17("span", { className: "truncate font-medium", children: displayName }),
|
|
2177
|
+
user?.email && /* @__PURE__ */ jsx17("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
2229
2178
|
] }),
|
|
2230
|
-
/* @__PURE__ */
|
|
2179
|
+
/* @__PURE__ */ jsx17(ChevronsUpDown, { className: "ml-auto size-4 group-data-[collapsible=icon]:hidden" })
|
|
2231
2180
|
]
|
|
2232
2181
|
}
|
|
2233
2182
|
) }),
|
|
2234
|
-
/* @__PURE__ */
|
|
2183
|
+
/* @__PURE__ */ jsxs9(
|
|
2235
2184
|
DropdownMenuContent,
|
|
2236
2185
|
{
|
|
2237
2186
|
className: "w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg",
|
|
@@ -2239,72 +2188,72 @@ var UserMenu = ({
|
|
|
2239
2188
|
align: "end",
|
|
2240
2189
|
sideOffset: 4,
|
|
2241
2190
|
children: [
|
|
2242
|
-
/* @__PURE__ */
|
|
2243
|
-
/* @__PURE__ */
|
|
2244
|
-
user?.avatar && /* @__PURE__ */
|
|
2245
|
-
/* @__PURE__ */
|
|
2191
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
|
|
2192
|
+
/* @__PURE__ */ jsxs9(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
2193
|
+
user?.avatar && /* @__PURE__ */ jsx17(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
2194
|
+
/* @__PURE__ */ jsx17(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
|
|
2246
2195
|
] }),
|
|
2247
|
-
/* @__PURE__ */
|
|
2248
|
-
/* @__PURE__ */
|
|
2249
|
-
user?.email && /* @__PURE__ */
|
|
2196
|
+
/* @__PURE__ */ jsxs9("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
2197
|
+
/* @__PURE__ */ jsx17("span", { className: "truncate font-medium", children: displayName }),
|
|
2198
|
+
user?.email && /* @__PURE__ */ jsx17("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
2250
2199
|
] })
|
|
2251
2200
|
] }) }),
|
|
2252
|
-
/* @__PURE__ */
|
|
2253
|
-
callbacks?.onViewProfile && /* @__PURE__ */
|
|
2254
|
-
/* @__PURE__ */
|
|
2255
|
-
/* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2202
|
+
callbacks?.onViewProfile && /* @__PURE__ */ jsxs9(DropdownMenuItem, { onClick: callbacks.onViewProfile, children: [
|
|
2203
|
+
/* @__PURE__ */ jsx17(User, { className: "mr-2 h-4 w-4" }),
|
|
2204
|
+
/* @__PURE__ */ jsx17("span", { children: labels.profile })
|
|
2256
2205
|
] }),
|
|
2257
|
-
callbacks?.onOpenSettings && /* @__PURE__ */
|
|
2258
|
-
/* @__PURE__ */
|
|
2259
|
-
/* @__PURE__ */
|
|
2206
|
+
callbacks?.onOpenSettings && /* @__PURE__ */ jsxs9(DropdownMenuItem, { onClick: callbacks.onOpenSettings, children: [
|
|
2207
|
+
/* @__PURE__ */ jsx17(Settings, { className: "mr-2 h-4 w-4" }),
|
|
2208
|
+
/* @__PURE__ */ jsx17("span", { children: labels.settings })
|
|
2260
2209
|
] }),
|
|
2261
2210
|
additionalItems,
|
|
2262
|
-
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */
|
|
2263
|
-
/* @__PURE__ */
|
|
2264
|
-
/* @__PURE__ */
|
|
2211
|
+
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2212
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2213
|
+
/* @__PURE__ */ jsxs9(
|
|
2265
2214
|
DropdownMenuItem,
|
|
2266
2215
|
{
|
|
2267
2216
|
onClick: () => callbacks.onThemeChange?.("light"),
|
|
2268
2217
|
className: currentTheme === "light" ? "bg-accent" : "",
|
|
2269
2218
|
children: [
|
|
2270
|
-
/* @__PURE__ */
|
|
2271
|
-
/* @__PURE__ */
|
|
2219
|
+
/* @__PURE__ */ jsx17(Sun, { className: "mr-2 h-4 w-4" }),
|
|
2220
|
+
/* @__PURE__ */ jsx17("span", { children: labels.lightMode })
|
|
2272
2221
|
]
|
|
2273
2222
|
}
|
|
2274
2223
|
),
|
|
2275
|
-
/* @__PURE__ */
|
|
2224
|
+
/* @__PURE__ */ jsxs9(
|
|
2276
2225
|
DropdownMenuItem,
|
|
2277
2226
|
{
|
|
2278
2227
|
onClick: () => callbacks.onThemeChange?.("dark"),
|
|
2279
2228
|
className: currentTheme === "dark" ? "bg-accent" : "",
|
|
2280
2229
|
children: [
|
|
2281
|
-
/* @__PURE__ */
|
|
2282
|
-
/* @__PURE__ */
|
|
2230
|
+
/* @__PURE__ */ jsx17(Moon, { className: "mr-2 h-4 w-4" }),
|
|
2231
|
+
/* @__PURE__ */ jsx17("span", { children: labels.darkMode })
|
|
2283
2232
|
]
|
|
2284
2233
|
}
|
|
2285
2234
|
),
|
|
2286
|
-
/* @__PURE__ */
|
|
2235
|
+
/* @__PURE__ */ jsxs9(
|
|
2287
2236
|
DropdownMenuItem,
|
|
2288
2237
|
{
|
|
2289
2238
|
onClick: () => callbacks.onThemeChange?.("system"),
|
|
2290
2239
|
className: currentTheme === "system" ? "bg-accent" : "",
|
|
2291
2240
|
children: [
|
|
2292
|
-
/* @__PURE__ */
|
|
2293
|
-
/* @__PURE__ */
|
|
2241
|
+
/* @__PURE__ */ jsx17(Palette, { className: "mr-2 h-4 w-4" }),
|
|
2242
|
+
/* @__PURE__ */ jsx17("span", { children: labels.systemTheme })
|
|
2294
2243
|
]
|
|
2295
2244
|
}
|
|
2296
2245
|
)
|
|
2297
2246
|
] }),
|
|
2298
|
-
callbacks?.onLogout && /* @__PURE__ */
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
2247
|
+
callbacks?.onLogout && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2248
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2249
|
+
/* @__PURE__ */ jsxs9(
|
|
2301
2250
|
DropdownMenuItem,
|
|
2302
2251
|
{
|
|
2303
2252
|
onClick: callbacks.onLogout,
|
|
2304
2253
|
className: "text-destructive focus:text-destructive focus:bg-destructive/10",
|
|
2305
2254
|
children: [
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2255
|
+
/* @__PURE__ */ jsx17(LogOut, { className: "mr-2 h-4 w-4" }),
|
|
2256
|
+
/* @__PURE__ */ jsx17("span", { children: labels.logout })
|
|
2308
2257
|
]
|
|
2309
2258
|
}
|
|
2310
2259
|
)
|
|
@@ -2316,26 +2265,26 @@ var UserMenu = ({
|
|
|
2316
2265
|
};
|
|
2317
2266
|
|
|
2318
2267
|
// src/components/chat/Sidebar.tsx
|
|
2319
|
-
import { jsx as
|
|
2268
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2320
2269
|
var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
2321
|
-
const [title, setTitle] =
|
|
2322
|
-
const [isOpen, setIsOpen] =
|
|
2270
|
+
const [title, setTitle] = useState5("");
|
|
2271
|
+
const [isOpen, setIsOpen] = useState5(false);
|
|
2323
2272
|
const handleCreate = () => {
|
|
2324
2273
|
onCreateThread(title.trim() || void 0);
|
|
2325
2274
|
setTitle("");
|
|
2326
2275
|
setIsOpen(false);
|
|
2327
2276
|
};
|
|
2328
|
-
return /* @__PURE__ */
|
|
2329
|
-
/* @__PURE__ */
|
|
2330
|
-
/* @__PURE__ */
|
|
2277
|
+
return /* @__PURE__ */ jsxs10(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
2278
|
+
/* @__PURE__ */ jsx18(DialogTrigger, { asChild: true, children: trigger || /* @__PURE__ */ jsxs10(Button, { className: "w-full justify-start", variant: "outline", children: [
|
|
2279
|
+
/* @__PURE__ */ jsx18(Plus, { className: "mr-2 h-4 w-4" }),
|
|
2331
2280
|
config.labels?.newChat || "New Chat"
|
|
2332
2281
|
] }) }),
|
|
2333
|
-
/* @__PURE__ */
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
/* @__PURE__ */
|
|
2282
|
+
/* @__PURE__ */ jsxs10(DialogContent, { children: [
|
|
2283
|
+
/* @__PURE__ */ jsxs10(DialogHeader, { children: [
|
|
2284
|
+
/* @__PURE__ */ jsx18(DialogTitle, { children: config.labels?.createNewThread || "New Conversation" }),
|
|
2285
|
+
/* @__PURE__ */ jsx18(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
|
|
2337
2286
|
] }),
|
|
2338
|
-
/* @__PURE__ */
|
|
2287
|
+
/* @__PURE__ */ jsx18(
|
|
2339
2288
|
Input,
|
|
2340
2289
|
{
|
|
2341
2290
|
value: title,
|
|
@@ -2345,16 +2294,16 @@ var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
|
2345
2294
|
autoFocus: true
|
|
2346
2295
|
}
|
|
2347
2296
|
),
|
|
2348
|
-
/* @__PURE__ */
|
|
2349
|
-
/* @__PURE__ */
|
|
2350
|
-
/* @__PURE__ */
|
|
2297
|
+
/* @__PURE__ */ jsxs10(DialogFooter, { children: [
|
|
2298
|
+
/* @__PURE__ */ jsx18(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config.labels?.cancel || "Cancel" }),
|
|
2299
|
+
/* @__PURE__ */ jsx18(Button, { onClick: handleCreate, children: config.labels?.create || "Create" })
|
|
2351
2300
|
] })
|
|
2352
2301
|
] })
|
|
2353
2302
|
] });
|
|
2354
2303
|
};
|
|
2355
2304
|
var ThreadInitialsIcon = ({ title }) => {
|
|
2356
2305
|
const initials = title?.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase() || "?";
|
|
2357
|
-
return /* @__PURE__ */
|
|
2306
|
+
return /* @__PURE__ */ jsx18("div", { className: "flex shrink-0 items-center justify-center rounded bg-muted text-[10px] font-medium", children: initials });
|
|
2358
2307
|
};
|
|
2359
2308
|
var Sidebar2 = ({
|
|
2360
2309
|
threads,
|
|
@@ -2373,14 +2322,14 @@ var Sidebar2 = ({
|
|
|
2373
2322
|
userMenuAdditionalItems,
|
|
2374
2323
|
...props
|
|
2375
2324
|
}) => {
|
|
2376
|
-
const [searchQuery, setSearchQuery] =
|
|
2377
|
-
const [showArchived, setShowArchived] =
|
|
2378
|
-
const [deleteThreadId, setDeleteThreadId] =
|
|
2379
|
-
const [editingThreadId, setEditingThreadId] =
|
|
2380
|
-
const [editTitle, setEditTitle] =
|
|
2325
|
+
const [searchQuery, setSearchQuery] = useState5("");
|
|
2326
|
+
const [showArchived, setShowArchived] = useState5(false);
|
|
2327
|
+
const [deleteThreadId, setDeleteThreadId] = useState5(null);
|
|
2328
|
+
const [editingThreadId, setEditingThreadId] = useState5(null);
|
|
2329
|
+
const [editTitle, setEditTitle] = useState5("");
|
|
2381
2330
|
const inputRef = useRef4(null);
|
|
2382
2331
|
const { setOpen } = useSidebar();
|
|
2383
|
-
|
|
2332
|
+
useEffect8(() => {
|
|
2384
2333
|
if (editingThreadId && inputRef.current) {
|
|
2385
2334
|
inputRef.current.focus();
|
|
2386
2335
|
inputRef.current.select();
|
|
@@ -2431,38 +2380,38 @@ var Sidebar2 = ({
|
|
|
2431
2380
|
const cancelEdit = () => {
|
|
2432
2381
|
setEditingThreadId(null);
|
|
2433
2382
|
};
|
|
2434
|
-
return /* @__PURE__ */
|
|
2435
|
-
/* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */
|
|
2440
|
-
config.branding?.subtitle && /* @__PURE__ */
|
|
2383
|
+
return /* @__PURE__ */ jsxs10(Sidebar, { collapsible: "icon", ...props, children: [
|
|
2384
|
+
/* @__PURE__ */ jsxs10(SidebarHeader, { children: [
|
|
2385
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-3 px-2 py-3", children: [
|
|
2386
|
+
/* @__PURE__ */ jsx18("div", { className: "flex items-center justify-center shrink-0", children: config.branding?.logo || /* @__PURE__ */ jsx18(Avatar, { className: "h-8 w-8", children: /* @__PURE__ */ jsx18(AvatarFallback, { className: "bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx18(Bot, { className: "h-4 w-4" }) }) }) }),
|
|
2387
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col min-w-0 group-data-[collapsible=icon]:hidden", children: [
|
|
2388
|
+
/* @__PURE__ */ jsx18("span", { className: "text-sm font-semibold truncate", children: config.branding?.title || "Chat" }),
|
|
2389
|
+
config.branding?.subtitle && /* @__PURE__ */ jsx18("span", { className: "text-xs text-muted-foreground truncate", children: config.branding.subtitle })
|
|
2441
2390
|
] })
|
|
2442
2391
|
] }),
|
|
2443
|
-
onCreateThread && /* @__PURE__ */
|
|
2392
|
+
onCreateThread && /* @__PURE__ */ jsx18(
|
|
2444
2393
|
CreateThreadDialog,
|
|
2445
2394
|
{
|
|
2446
2395
|
config,
|
|
2447
2396
|
onCreateThread,
|
|
2448
|
-
trigger: /* @__PURE__ */
|
|
2397
|
+
trigger: /* @__PURE__ */ jsx18(SidebarMenu, { children: /* @__PURE__ */ jsx18(SidebarMenuItem, { children: /* @__PURE__ */ jsxs10(
|
|
2449
2398
|
SidebarMenuButton,
|
|
2450
2399
|
{
|
|
2451
2400
|
size: "lg",
|
|
2452
2401
|
className: "w-full justify-start gap-2 border border-sidebar-border shadow-sm hover:bg-sidebar-accent hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:justify-center",
|
|
2453
2402
|
tooltip: config.labels?.newChat || "New Chat",
|
|
2454
2403
|
children: [
|
|
2455
|
-
/* @__PURE__ */
|
|
2456
|
-
/* @__PURE__ */
|
|
2404
|
+
/* @__PURE__ */ jsx18(Plus, { className: "size-4" }),
|
|
2405
|
+
/* @__PURE__ */ jsx18("span", { className: "group-data-[collapsible=icon]:hidden", children: config.labels?.newChat || "New Chat" })
|
|
2457
2406
|
]
|
|
2458
2407
|
}
|
|
2459
2408
|
) }) })
|
|
2460
2409
|
}
|
|
2461
2410
|
),
|
|
2462
|
-
/* @__PURE__ */
|
|
2463
|
-
/* @__PURE__ */
|
|
2464
|
-
/* @__PURE__ */
|
|
2465
|
-
/* @__PURE__ */
|
|
2411
|
+
/* @__PURE__ */ jsxs10("div", { className: "px-2 py-1 mt-4", children: [
|
|
2412
|
+
/* @__PURE__ */ jsxs10("div", { className: "relative group-data-[collapsible=icon]:hidden", children: [
|
|
2413
|
+
/* @__PURE__ */ jsx18(Search, { className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 select-none opacity-50" }),
|
|
2414
|
+
/* @__PURE__ */ jsx18(
|
|
2466
2415
|
Input,
|
|
2467
2416
|
{
|
|
2468
2417
|
className: "pl-8 h-8 bg-sidebar-accent/50 border-sidebar-border focus-visible:ring-1 focus-visible:ring-sidebar-ring",
|
|
@@ -2472,7 +2421,7 @@ var Sidebar2 = ({
|
|
|
2472
2421
|
}
|
|
2473
2422
|
)
|
|
2474
2423
|
] }),
|
|
2475
|
-
/* @__PURE__ */
|
|
2424
|
+
/* @__PURE__ */ jsx18("div", { className: "hidden group-data-[collapsible=icon]:flex justify-center", children: /* @__PURE__ */ jsx18(
|
|
2476
2425
|
Button,
|
|
2477
2426
|
{
|
|
2478
2427
|
variant: "ghost",
|
|
@@ -2480,13 +2429,13 @@ var Sidebar2 = ({
|
|
|
2480
2429
|
className: "h-7 w-7",
|
|
2481
2430
|
onClick: () => setOpen(true),
|
|
2482
2431
|
title: config.labels?.search || "Search",
|
|
2483
|
-
children: /* @__PURE__ */
|
|
2432
|
+
children: /* @__PURE__ */ jsx18(Search, { className: "h-4 w-4" })
|
|
2484
2433
|
}
|
|
2485
2434
|
) })
|
|
2486
2435
|
] })
|
|
2487
2436
|
] }),
|
|
2488
|
-
/* @__PURE__ */
|
|
2489
|
-
threads.some((t) => t.isArchived) && /* @__PURE__ */
|
|
2437
|
+
/* @__PURE__ */ jsxs10(SidebarContent, { children: [
|
|
2438
|
+
threads.some((t) => t.isArchived) && /* @__PURE__ */ jsx18("div", { className: "px-4 py-2 mt-2 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsxs10(
|
|
2490
2439
|
Button,
|
|
2491
2440
|
{
|
|
2492
2441
|
variant: "ghost",
|
|
@@ -2494,18 +2443,18 @@ var Sidebar2 = ({
|
|
|
2494
2443
|
onClick: () => setShowArchived(!showArchived),
|
|
2495
2444
|
className: "h-6 text-xs w-full justify-start text-muted-foreground",
|
|
2496
2445
|
children: [
|
|
2497
|
-
/* @__PURE__ */
|
|
2446
|
+
/* @__PURE__ */ jsx18(Filter, { className: "mr-2 h-3 w-3" }),
|
|
2498
2447
|
showArchived ? config.labels?.hideArchived || "Hide Archived" : config.labels?.showArchived || "Show Archived"
|
|
2499
2448
|
]
|
|
2500
2449
|
}
|
|
2501
2450
|
) }),
|
|
2502
|
-
Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */
|
|
2503
|
-
/* @__PURE__ */
|
|
2504
|
-
/* @__PURE__ */
|
|
2505
|
-
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */
|
|
2506
|
-
/* @__PURE__ */
|
|
2507
|
-
/* @__PURE__ */
|
|
2508
|
-
editingThreadId === thread.id ? /* @__PURE__ */
|
|
2451
|
+
Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ jsxs10("div", { className: "px-4 py-8 text-center text-muted-foreground group-data-[collapsible=icon]:hidden", children: [
|
|
2452
|
+
/* @__PURE__ */ jsx18("div", { className: "mx-auto h-8 w-8 mb-2 flex items-center justify-center rounded-full bg-muted/50", children: /* @__PURE__ */ jsx18(Plus, { className: "h-4 w-4 opacity-50" }) }),
|
|
2453
|
+
/* @__PURE__ */ jsx18("p", { className: "text-xs", children: searchQuery ? config.labels?.noThreadsFound || "No conversations found" : config.labels?.noThreadsYet || "No conversations yet" })
|
|
2454
|
+
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs10(SidebarGroup, { className: "mt-2", children: [
|
|
2455
|
+
/* @__PURE__ */ jsx18(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: group }),
|
|
2456
|
+
/* @__PURE__ */ jsx18(SidebarGroupContent, { children: /* @__PURE__ */ jsx18(SidebarMenu, { children: groupThreads.map((thread) => /* @__PURE__ */ jsxs10(SidebarMenuItem, { children: [
|
|
2457
|
+
editingThreadId === thread.id ? /* @__PURE__ */ jsx18("div", { className: "flex items-center gap-1 px-2 py-1", children: /* @__PURE__ */ jsx18(
|
|
2509
2458
|
Input,
|
|
2510
2459
|
{
|
|
2511
2460
|
ref: inputRef,
|
|
@@ -2518,42 +2467,42 @@ var Sidebar2 = ({
|
|
|
2518
2467
|
onBlur: saveEdit,
|
|
2519
2468
|
className: "h-7 text-sm"
|
|
2520
2469
|
}
|
|
2521
|
-
) }) : /* @__PURE__ */
|
|
2470
|
+
) }) : /* @__PURE__ */ jsxs10(
|
|
2522
2471
|
SidebarMenuButton,
|
|
2523
2472
|
{
|
|
2524
2473
|
isActive: currentThreadId === thread.id,
|
|
2525
2474
|
onClick: () => onSelectThread?.(thread.id),
|
|
2526
2475
|
tooltip: thread.title,
|
|
2527
2476
|
children: [
|
|
2528
|
-
/* @__PURE__ */
|
|
2529
|
-
/* @__PURE__ */
|
|
2530
|
-
thread.isArchived && /* @__PURE__ */
|
|
2477
|
+
/* @__PURE__ */ jsx18(ThreadInitialsIcon, { title: thread.title || "?" }),
|
|
2478
|
+
/* @__PURE__ */ jsx18("div", { className: "flex flex-col items-start gap-0.5 flex-1 min-w-0 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsx18("span", { className: "truncate w-full", children: thread.title || "New Chat" }) }),
|
|
2479
|
+
thread.isArchived && /* @__PURE__ */ jsx18(Archive, { className: "ml-auto h-3 w-3 opacity-50 group-data-[collapsible=icon]:hidden" })
|
|
2531
2480
|
]
|
|
2532
2481
|
}
|
|
2533
2482
|
),
|
|
2534
|
-
!editingThreadId && /* @__PURE__ */
|
|
2535
|
-
/* @__PURE__ */
|
|
2536
|
-
/* @__PURE__ */
|
|
2537
|
-
/* @__PURE__ */
|
|
2483
|
+
!editingThreadId && /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
|
|
2484
|
+
/* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(SidebarMenuAction, { showOnHover: true, children: [
|
|
2485
|
+
/* @__PURE__ */ jsx18(MoreHorizontal, {}),
|
|
2486
|
+
/* @__PURE__ */ jsx18("span", { className: "sr-only", children: "More" })
|
|
2538
2487
|
] }) }),
|
|
2539
|
-
/* @__PURE__ */
|
|
2540
|
-
/* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2488
|
+
/* @__PURE__ */ jsxs10(DropdownMenuContent, { className: "w-48", side: "right", align: "start", children: [
|
|
2489
|
+
/* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: () => startEditing(thread), children: [
|
|
2490
|
+
/* @__PURE__ */ jsx18(Edit2, { className: "mr-2 h-4 w-4" }),
|
|
2491
|
+
/* @__PURE__ */ jsx18("span", { children: config.labels?.renameThread || "Rename" })
|
|
2543
2492
|
] }),
|
|
2544
|
-
/* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
2493
|
+
/* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: () => onArchiveThread?.(thread.id), children: [
|
|
2494
|
+
/* @__PURE__ */ jsx18(Archive, { className: "mr-2 h-4 w-4" }),
|
|
2495
|
+
/* @__PURE__ */ jsx18("span", { children: thread.isArchived ? config.labels?.unarchiveThread || "Unarchive" : config.labels?.archiveThread || "Archive" })
|
|
2547
2496
|
] }),
|
|
2548
|
-
/* @__PURE__ */
|
|
2549
|
-
/* @__PURE__ */
|
|
2497
|
+
/* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
|
|
2498
|
+
/* @__PURE__ */ jsxs10(
|
|
2550
2499
|
DropdownMenuItem,
|
|
2551
2500
|
{
|
|
2552
2501
|
onClick: () => setDeleteThreadId(thread.id),
|
|
2553
2502
|
className: "text-destructive focus:text-destructive",
|
|
2554
2503
|
children: [
|
|
2555
|
-
/* @__PURE__ */
|
|
2556
|
-
/* @__PURE__ */
|
|
2504
|
+
/* @__PURE__ */ jsx18(Trash2, { className: "mr-2 h-4 w-4" }),
|
|
2505
|
+
/* @__PURE__ */ jsx18("span", { children: config.labels?.deleteThread || "Delete" })
|
|
2557
2506
|
]
|
|
2558
2507
|
}
|
|
2559
2508
|
)
|
|
@@ -2562,7 +2511,7 @@ var Sidebar2 = ({
|
|
|
2562
2511
|
] }, thread.id)) }) })
|
|
2563
2512
|
] }, group))
|
|
2564
2513
|
] }),
|
|
2565
|
-
/* @__PURE__ */
|
|
2514
|
+
/* @__PURE__ */ jsx18(SidebarFooter, { children: /* @__PURE__ */ jsx18(
|
|
2566
2515
|
UserMenu,
|
|
2567
2516
|
{
|
|
2568
2517
|
user,
|
|
@@ -2573,15 +2522,15 @@ var Sidebar2 = ({
|
|
|
2573
2522
|
additionalItems: userMenuAdditionalItems
|
|
2574
2523
|
}
|
|
2575
2524
|
) }),
|
|
2576
|
-
/* @__PURE__ */
|
|
2577
|
-
deleteThreadId && /* @__PURE__ */
|
|
2578
|
-
/* @__PURE__ */
|
|
2579
|
-
/* @__PURE__ */
|
|
2580
|
-
/* @__PURE__ */
|
|
2525
|
+
/* @__PURE__ */ jsx18(SidebarRail, {}),
|
|
2526
|
+
deleteThreadId && /* @__PURE__ */ jsx18(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ jsxs10(AlertDialogContent, { children: [
|
|
2527
|
+
/* @__PURE__ */ jsxs10(AlertDialogHeader, { children: [
|
|
2528
|
+
/* @__PURE__ */ jsx18(AlertDialogTitle, { children: config.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
2529
|
+
/* @__PURE__ */ jsx18(AlertDialogDescription, { children: config.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
2581
2530
|
] }),
|
|
2582
|
-
/* @__PURE__ */
|
|
2583
|
-
/* @__PURE__ */
|
|
2584
|
-
/* @__PURE__ */
|
|
2531
|
+
/* @__PURE__ */ jsxs10(AlertDialogFooter, { children: [
|
|
2532
|
+
/* @__PURE__ */ jsx18(AlertDialogCancel, { children: config.labels?.cancel || "Cancel" }),
|
|
2533
|
+
/* @__PURE__ */ jsx18(
|
|
2585
2534
|
AlertDialogAction,
|
|
2586
2535
|
{
|
|
2587
2536
|
onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
|
|
@@ -2595,7 +2544,7 @@ var Sidebar2 = ({
|
|
|
2595
2544
|
};
|
|
2596
2545
|
|
|
2597
2546
|
// src/components/chat/ChatHeader.tsx
|
|
2598
|
-
import
|
|
2547
|
+
import React10 from "react";
|
|
2599
2548
|
import {
|
|
2600
2549
|
Bot as Bot2,
|
|
2601
2550
|
MoreVertical,
|
|
@@ -2611,10 +2560,10 @@ import {
|
|
|
2611
2560
|
} from "lucide-react";
|
|
2612
2561
|
|
|
2613
2562
|
// src/components/chat/AgentSelectors.tsx
|
|
2614
|
-
import { memo as
|
|
2563
|
+
import { memo as memo3, useMemo as useMemo4 } from "react";
|
|
2615
2564
|
import { Check as Check2, ChevronDown as ChevronDown2, Users, AtSign, X as X2 } from "lucide-react";
|
|
2616
|
-
import { Fragment as Fragment3, jsx as
|
|
2617
|
-
var ParticipantsSelector =
|
|
2565
|
+
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2566
|
+
var ParticipantsSelector = memo3(({
|
|
2618
2567
|
agents,
|
|
2619
2568
|
participantIds,
|
|
2620
2569
|
onParticipantsChange,
|
|
@@ -2622,8 +2571,8 @@ var ParticipantsSelector = memo2(({
|
|
|
2622
2571
|
maxVisible = 3,
|
|
2623
2572
|
disabled = false
|
|
2624
2573
|
}) => {
|
|
2625
|
-
const agentsWithColors =
|
|
2626
|
-
const selectedAgents =
|
|
2574
|
+
const agentsWithColors = useMemo4(() => assignAgentColors(agents), [agents]);
|
|
2575
|
+
const selectedAgents = useMemo4(
|
|
2627
2576
|
() => agentsWithColors.filter((a) => participantIds.includes(a.id)),
|
|
2628
2577
|
[agentsWithColors, participantIds]
|
|
2629
2578
|
);
|
|
@@ -2641,19 +2590,19 @@ var ParticipantsSelector = memo2(({
|
|
|
2641
2590
|
};
|
|
2642
2591
|
const visibleAgents = selectedAgents.slice(0, maxVisible);
|
|
2643
2592
|
const hiddenCount = selectedAgents.length - maxVisible;
|
|
2644
|
-
return /* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
2593
|
+
return /* @__PURE__ */ jsxs11(DropdownMenu, { children: [
|
|
2594
|
+
/* @__PURE__ */ jsx19(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
|
|
2646
2595
|
Button,
|
|
2647
2596
|
{
|
|
2648
2597
|
variant: "ghost",
|
|
2649
2598
|
className: "h-9 px-2 gap-1.5 text-sm hover:bg-accent/50",
|
|
2650
2599
|
disabled,
|
|
2651
2600
|
children: [
|
|
2652
|
-
/* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */
|
|
2654
|
-
/* @__PURE__ */
|
|
2655
|
-
/* @__PURE__ */
|
|
2656
|
-
/* @__PURE__ */
|
|
2601
|
+
/* @__PURE__ */ jsx19(Users, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2602
|
+
/* @__PURE__ */ jsx19("div", { className: "flex items-center gap-1", children: visibleAgents.length > 0 ? /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
2603
|
+
/* @__PURE__ */ jsx19("div", { className: "flex -space-x-1.5", children: visibleAgents.map((agent) => /* @__PURE__ */ jsxs11(Avatar, { className: "h-5 w-5 border-2 border-background", children: [
|
|
2604
|
+
/* @__PURE__ */ jsx19(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2605
|
+
/* @__PURE__ */ jsx19(
|
|
2657
2606
|
AvatarFallback,
|
|
2658
2607
|
{
|
|
2659
2608
|
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
@@ -2662,34 +2611,34 @@ var ParticipantsSelector = memo2(({
|
|
|
2662
2611
|
}
|
|
2663
2612
|
)
|
|
2664
2613
|
] }, agent.id)) }),
|
|
2665
|
-
hiddenCount > 0 && /* @__PURE__ */
|
|
2614
|
+
hiddenCount > 0 && /* @__PURE__ */ jsxs11("span", { className: "text-xs text-muted-foreground", children: [
|
|
2666
2615
|
"+",
|
|
2667
2616
|
hiddenCount
|
|
2668
2617
|
] })
|
|
2669
|
-
] }) : /* @__PURE__ */
|
|
2670
|
-
/* @__PURE__ */
|
|
2618
|
+
] }) : /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: label }) }),
|
|
2619
|
+
/* @__PURE__ */ jsx19(ChevronDown2, { className: "h-3 w-3 opacity-50" })
|
|
2671
2620
|
]
|
|
2672
2621
|
}
|
|
2673
2622
|
) }),
|
|
2674
|
-
/* @__PURE__ */
|
|
2675
|
-
/* @__PURE__ */
|
|
2676
|
-
/* @__PURE__ */
|
|
2677
|
-
selectedAgents.length < agentsWithColors.length && /* @__PURE__ */
|
|
2623
|
+
/* @__PURE__ */ jsxs11(DropdownMenuContent, { align: "start", className: "w-[260px]", children: [
|
|
2624
|
+
/* @__PURE__ */ jsxs11(DropdownMenuLabel, { className: "flex items-center justify-between", children: [
|
|
2625
|
+
/* @__PURE__ */ jsx19("span", { children: "Participants" }),
|
|
2626
|
+
selectedAgents.length < agentsWithColors.length && /* @__PURE__ */ jsx19(Button, { variant: "ghost", size: "sm", className: "h-6 text-xs", onClick: selectAll, children: "Select All" })
|
|
2678
2627
|
] }),
|
|
2679
|
-
/* @__PURE__ */
|
|
2628
|
+
/* @__PURE__ */ jsx19(DropdownMenuSeparator, {}),
|
|
2680
2629
|
agentsWithColors.map((agent) => {
|
|
2681
2630
|
const isSelected = participantIds.includes(agent.id);
|
|
2682
2631
|
const isLastSelected = isSelected && participantIds.length === 1;
|
|
2683
|
-
return /* @__PURE__ */
|
|
2632
|
+
return /* @__PURE__ */ jsxs11(
|
|
2684
2633
|
DropdownMenuItem,
|
|
2685
2634
|
{
|
|
2686
2635
|
onClick: () => toggleParticipant(agent.id),
|
|
2687
2636
|
className: "flex items-center gap-3 p-2 cursor-pointer",
|
|
2688
2637
|
disabled: isLastSelected,
|
|
2689
2638
|
children: [
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
2692
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsxs11(Avatar, { className: "h-6 w-6", children: [
|
|
2640
|
+
/* @__PURE__ */ jsx19(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2641
|
+
/* @__PURE__ */ jsx19(
|
|
2693
2642
|
AvatarFallback,
|
|
2694
2643
|
{
|
|
2695
2644
|
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
@@ -2698,11 +2647,11 @@ var ParticipantsSelector = memo2(({
|
|
|
2698
2647
|
}
|
|
2699
2648
|
)
|
|
2700
2649
|
] }),
|
|
2701
|
-
/* @__PURE__ */
|
|
2702
|
-
/* @__PURE__ */
|
|
2703
|
-
agent.description && /* @__PURE__ */
|
|
2650
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
|
|
2651
|
+
/* @__PURE__ */ jsx19("div", { className: "font-medium text-sm truncate", children: agent.name }),
|
|
2652
|
+
agent.description && /* @__PURE__ */ jsx19("div", { className: "text-xs text-muted-foreground truncate", children: agent.description })
|
|
2704
2653
|
] }),
|
|
2705
|
-
isSelected && /* @__PURE__ */
|
|
2654
|
+
isSelected && /* @__PURE__ */ jsx19(Check2, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2706
2655
|
]
|
|
2707
2656
|
},
|
|
2708
2657
|
agent.id
|
|
@@ -2712,7 +2661,7 @@ var ParticipantsSelector = memo2(({
|
|
|
2712
2661
|
] });
|
|
2713
2662
|
});
|
|
2714
2663
|
ParticipantsSelector.displayName = "ParticipantsSelector";
|
|
2715
|
-
var TargetAgentSelector =
|
|
2664
|
+
var TargetAgentSelector = memo3(({
|
|
2716
2665
|
agents,
|
|
2717
2666
|
targetAgentId,
|
|
2718
2667
|
onTargetChange,
|
|
@@ -2720,24 +2669,24 @@ var TargetAgentSelector = memo2(({
|
|
|
2720
2669
|
placeholder = "Select agent",
|
|
2721
2670
|
disabled = false
|
|
2722
2671
|
}) => {
|
|
2723
|
-
const agentsWithColors =
|
|
2724
|
-
const selectedAgent =
|
|
2672
|
+
const agentsWithColors = useMemo4(() => assignAgentColors(agents), [agents]);
|
|
2673
|
+
const selectedAgent = useMemo4(
|
|
2725
2674
|
() => agentsWithColors.find((a) => a.id === targetAgentId),
|
|
2726
2675
|
[agentsWithColors, targetAgentId]
|
|
2727
2676
|
);
|
|
2728
|
-
return /* @__PURE__ */
|
|
2729
|
-
/* @__PURE__ */
|
|
2677
|
+
return /* @__PURE__ */ jsxs11(DropdownMenu, { children: [
|
|
2678
|
+
/* @__PURE__ */ jsx19(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
|
|
2730
2679
|
Button,
|
|
2731
2680
|
{
|
|
2732
2681
|
variant: "ghost",
|
|
2733
2682
|
className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
|
|
2734
2683
|
disabled,
|
|
2735
2684
|
children: [
|
|
2736
|
-
/* @__PURE__ */
|
|
2737
|
-
selectedAgent ? /* @__PURE__ */
|
|
2738
|
-
/* @__PURE__ */
|
|
2739
|
-
/* @__PURE__ */
|
|
2740
|
-
/* @__PURE__ */
|
|
2685
|
+
/* @__PURE__ */ jsx19(AtSign, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2686
|
+
selectedAgent ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2687
|
+
/* @__PURE__ */ jsxs11(Avatar, { className: "h-5 w-5", children: [
|
|
2688
|
+
/* @__PURE__ */ jsx19(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
|
|
2689
|
+
/* @__PURE__ */ jsx19(
|
|
2741
2690
|
AvatarFallback,
|
|
2742
2691
|
{
|
|
2743
2692
|
style: { backgroundColor: selectedAgent.color || getAgentColor(selectedAgent.id), color: "white" },
|
|
@@ -2746,26 +2695,26 @@ var TargetAgentSelector = memo2(({
|
|
|
2746
2695
|
}
|
|
2747
2696
|
)
|
|
2748
2697
|
] }),
|
|
2749
|
-
/* @__PURE__ */
|
|
2750
|
-
] }) : /* @__PURE__ */
|
|
2751
|
-
/* @__PURE__ */
|
|
2698
|
+
/* @__PURE__ */ jsx19("span", { className: "max-w-[150px] truncate", children: selectedAgent.name })
|
|
2699
|
+
] }) : /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: placeholder }),
|
|
2700
|
+
/* @__PURE__ */ jsx19(ChevronDown2, { className: "h-4 w-4 opacity-50" })
|
|
2752
2701
|
]
|
|
2753
2702
|
}
|
|
2754
2703
|
) }),
|
|
2755
|
-
/* @__PURE__ */
|
|
2756
|
-
/* @__PURE__ */
|
|
2757
|
-
/* @__PURE__ */
|
|
2704
|
+
/* @__PURE__ */ jsxs11(DropdownMenuContent, { align: "start", className: "w-[280px]", children: [
|
|
2705
|
+
/* @__PURE__ */ jsx19(DropdownMenuLabel, { children: label }),
|
|
2706
|
+
/* @__PURE__ */ jsx19(DropdownMenuSeparator, {}),
|
|
2758
2707
|
agentsWithColors.map((agent) => {
|
|
2759
2708
|
const isSelected = agent.id === targetAgentId;
|
|
2760
|
-
return /* @__PURE__ */
|
|
2709
|
+
return /* @__PURE__ */ jsxs11(
|
|
2761
2710
|
DropdownMenuItem,
|
|
2762
2711
|
{
|
|
2763
2712
|
onClick: () => onTargetChange(agent.id),
|
|
2764
2713
|
className: "flex items-start gap-3 p-3 cursor-pointer",
|
|
2765
2714
|
children: [
|
|
2766
|
-
/* @__PURE__ */
|
|
2767
|
-
/* @__PURE__ */
|
|
2768
|
-
/* @__PURE__ */
|
|
2715
|
+
/* @__PURE__ */ jsxs11(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
|
|
2716
|
+
/* @__PURE__ */ jsx19(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2717
|
+
/* @__PURE__ */ jsx19(
|
|
2769
2718
|
AvatarFallback,
|
|
2770
2719
|
{
|
|
2771
2720
|
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
@@ -2774,12 +2723,12 @@ var TargetAgentSelector = memo2(({
|
|
|
2774
2723
|
}
|
|
2775
2724
|
)
|
|
2776
2725
|
] }),
|
|
2777
|
-
/* @__PURE__ */
|
|
2778
|
-
/* @__PURE__ */
|
|
2779
|
-
/* @__PURE__ */
|
|
2780
|
-
isSelected && /* @__PURE__ */
|
|
2726
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
|
|
2727
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2728
|
+
/* @__PURE__ */ jsx19("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2729
|
+
isSelected && /* @__PURE__ */ jsx19(Check2, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2781
2730
|
] }),
|
|
2782
|
-
agent.description && /* @__PURE__ */
|
|
2731
|
+
agent.description && /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2783
2732
|
] })
|
|
2784
2733
|
]
|
|
2785
2734
|
},
|
|
@@ -2790,7 +2739,7 @@ var TargetAgentSelector = memo2(({
|
|
|
2790
2739
|
] });
|
|
2791
2740
|
});
|
|
2792
2741
|
TargetAgentSelector.displayName = "TargetAgentSelector";
|
|
2793
|
-
var AgentBadge =
|
|
2742
|
+
var AgentBadge = memo3(({
|
|
2794
2743
|
agent,
|
|
2795
2744
|
onRemove,
|
|
2796
2745
|
showRemove = false,
|
|
@@ -2799,16 +2748,16 @@ var AgentBadge = memo2(({
|
|
|
2799
2748
|
const color = agent.color || getAgentColor(agent.id);
|
|
2800
2749
|
const avatarSize = size === "sm" ? "h-4 w-4" : "h-5 w-5";
|
|
2801
2750
|
const textSize = size === "sm" ? "text-xs" : "text-sm";
|
|
2802
|
-
return /* @__PURE__ */
|
|
2751
|
+
return /* @__PURE__ */ jsxs11(
|
|
2803
2752
|
Badge,
|
|
2804
2753
|
{
|
|
2805
2754
|
variant: "secondary",
|
|
2806
2755
|
className: "flex items-center gap-1.5 pr-1",
|
|
2807
2756
|
style: { borderColor: color, borderWidth: 1 },
|
|
2808
2757
|
children: [
|
|
2809
|
-
/* @__PURE__ */
|
|
2810
|
-
/* @__PURE__ */
|
|
2811
|
-
/* @__PURE__ */
|
|
2758
|
+
/* @__PURE__ */ jsxs11(Avatar, { className: avatarSize, children: [
|
|
2759
|
+
/* @__PURE__ */ jsx19(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2760
|
+
/* @__PURE__ */ jsx19(
|
|
2812
2761
|
AvatarFallback,
|
|
2813
2762
|
{
|
|
2814
2763
|
style: { backgroundColor: color, color: "white" },
|
|
@@ -2817,8 +2766,8 @@ var AgentBadge = memo2(({
|
|
|
2817
2766
|
}
|
|
2818
2767
|
)
|
|
2819
2768
|
] }),
|
|
2820
|
-
/* @__PURE__ */
|
|
2821
|
-
showRemove && onRemove && /* @__PURE__ */
|
|
2769
|
+
/* @__PURE__ */ jsx19("span", { className: textSize, children: agent.name }),
|
|
2770
|
+
showRemove && onRemove && /* @__PURE__ */ jsx19(
|
|
2822
2771
|
Button,
|
|
2823
2772
|
{
|
|
2824
2773
|
variant: "ghost",
|
|
@@ -2828,7 +2777,7 @@ var AgentBadge = memo2(({
|
|
|
2828
2777
|
e.stopPropagation();
|
|
2829
2778
|
onRemove();
|
|
2830
2779
|
},
|
|
2831
|
-
children: /* @__PURE__ */
|
|
2780
|
+
children: /* @__PURE__ */ jsx19(X2, { className: "h-3 w-3" })
|
|
2832
2781
|
}
|
|
2833
2782
|
)
|
|
2834
2783
|
]
|
|
@@ -2838,7 +2787,7 @@ var AgentBadge = memo2(({
|
|
|
2838
2787
|
AgentBadge.displayName = "AgentBadge";
|
|
2839
2788
|
|
|
2840
2789
|
// src/components/chat/ChatHeader.tsx
|
|
2841
|
-
import { Fragment as Fragment4, jsx as
|
|
2790
|
+
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2842
2791
|
var ChatHeader = ({
|
|
2843
2792
|
config,
|
|
2844
2793
|
currentThreadTitle,
|
|
@@ -2859,11 +2808,11 @@ var ChatHeader = ({
|
|
|
2859
2808
|
onParticipantsChange,
|
|
2860
2809
|
className = ""
|
|
2861
2810
|
}) => {
|
|
2862
|
-
const [isDarkMode, setIsDarkMode] =
|
|
2811
|
+
const [isDarkMode, setIsDarkMode] = React10.useState(() => {
|
|
2863
2812
|
if (typeof window === "undefined") return false;
|
|
2864
2813
|
return document.documentElement.classList.contains("dark");
|
|
2865
2814
|
});
|
|
2866
|
-
|
|
2815
|
+
React10.useEffect(() => {
|
|
2867
2816
|
const observer = new MutationObserver(() => {
|
|
2868
2817
|
setIsDarkMode(document.documentElement.classList.contains("dark"));
|
|
2869
2818
|
});
|
|
@@ -2909,19 +2858,19 @@ var ChatHeader = ({
|
|
|
2909
2858
|
};
|
|
2910
2859
|
const selectedAgent = agentOptions.find((agent) => agent.id === selectedAgentId) || null;
|
|
2911
2860
|
const agentPlaceholder = config.agentSelector?.label || "Select agent";
|
|
2912
|
-
return /* @__PURE__ */
|
|
2861
|
+
return /* @__PURE__ */ jsx20(
|
|
2913
2862
|
Card,
|
|
2914
2863
|
{
|
|
2915
2864
|
"data-chat-header": true,
|
|
2916
2865
|
className: `py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 ${className}`,
|
|
2917
2866
|
style: isMobile ? { paddingTop: "env(safe-area-inset-top)" } : void 0,
|
|
2918
|
-
children: /* @__PURE__ */
|
|
2919
|
-
/* @__PURE__ */
|
|
2920
|
-
/* @__PURE__ */
|
|
2921
|
-
/* @__PURE__ */
|
|
2922
|
-
/* @__PURE__ */
|
|
2867
|
+
children: /* @__PURE__ */ jsx20(CardHeader, { className: "p-2", children: /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2868
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
|
|
2869
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
2870
|
+
/* @__PURE__ */ jsx20(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx20(SidebarTrigger, { className: "-ml-1" }) }),
|
|
2871
|
+
/* @__PURE__ */ jsx20(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
|
|
2923
2872
|
] }),
|
|
2924
|
-
showAgentSelector && isMultiAgentMode && onParticipantsChange && /* @__PURE__ */
|
|
2873
|
+
showAgentSelector && isMultiAgentMode && onParticipantsChange && /* @__PURE__ */ jsx20(
|
|
2925
2874
|
ParticipantsSelector,
|
|
2926
2875
|
{
|
|
2927
2876
|
agents: agentOptions,
|
|
@@ -2929,40 +2878,40 @@ var ChatHeader = ({
|
|
|
2929
2878
|
onParticipantsChange
|
|
2930
2879
|
}
|
|
2931
2880
|
),
|
|
2932
|
-
showAgentSelector && !isMultiAgentMode && /* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
2881
|
+
showAgentSelector && !isMultiAgentMode && /* @__PURE__ */ jsxs12(DropdownMenu, { children: [
|
|
2882
|
+
/* @__PURE__ */ jsx20(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
2934
2883
|
Button,
|
|
2935
2884
|
{
|
|
2936
2885
|
variant: "ghost",
|
|
2937
2886
|
className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
|
|
2938
2887
|
children: [
|
|
2939
|
-
selectedAgent?.avatarUrl ? /* @__PURE__ */
|
|
2940
|
-
/* @__PURE__ */
|
|
2941
|
-
/* @__PURE__ */
|
|
2888
|
+
selectedAgent?.avatarUrl ? /* @__PURE__ */ jsxs12(Avatar, { className: "h-5 w-5", children: [
|
|
2889
|
+
/* @__PURE__ */ jsx20(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
|
|
2890
|
+
/* @__PURE__ */ jsx20(AvatarFallback, { className: "text-[10px]", children: selectedAgent.name.charAt(0).toUpperCase() })
|
|
2942
2891
|
] }) : null,
|
|
2943
|
-
/* @__PURE__ */
|
|
2944
|
-
/* @__PURE__ */
|
|
2892
|
+
/* @__PURE__ */ jsx20("span", { className: "max-w-[200px] truncate", children: selectedAgent?.name || agentPlaceholder }),
|
|
2893
|
+
/* @__PURE__ */ jsx20(ChevronDown3, { className: "h-4 w-4 opacity-50" })
|
|
2945
2894
|
]
|
|
2946
2895
|
}
|
|
2947
2896
|
) }),
|
|
2948
|
-
/* @__PURE__ */
|
|
2897
|
+
/* @__PURE__ */ jsx20(DropdownMenuContent, { align: "start", className: "w-[280px]", children: agentOptions.map((agent) => {
|
|
2949
2898
|
const isSelected = agent.id === selectedAgentId;
|
|
2950
|
-
return /* @__PURE__ */
|
|
2899
|
+
return /* @__PURE__ */ jsxs12(
|
|
2951
2900
|
DropdownMenuItem,
|
|
2952
2901
|
{
|
|
2953
2902
|
onClick: () => onSelectAgent?.(agent.id),
|
|
2954
2903
|
className: "flex items-start gap-3 p-3 cursor-pointer",
|
|
2955
2904
|
children: [
|
|
2956
|
-
agent.avatarUrl ? /* @__PURE__ */
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2959
|
-
] }) : /* @__PURE__ */
|
|
2960
|
-
/* @__PURE__ */
|
|
2961
|
-
/* @__PURE__ */
|
|
2962
|
-
/* @__PURE__ */
|
|
2963
|
-
isSelected && /* @__PURE__ */
|
|
2905
|
+
agent.avatarUrl ? /* @__PURE__ */ jsxs12(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
|
|
2906
|
+
/* @__PURE__ */ jsx20(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2907
|
+
/* @__PURE__ */ jsx20(AvatarFallback, { className: "text-[10px]", children: agent.name.charAt(0).toUpperCase() })
|
|
2908
|
+
] }) : /* @__PURE__ */ jsx20("div", { className: "h-6 w-6 mt-0.5 shrink-0 flex items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx20(Bot2, { className: "h-3.5 w-3.5 text-primary" }) }),
|
|
2909
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
|
|
2910
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2911
|
+
/* @__PURE__ */ jsx20("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2912
|
+
isSelected && /* @__PURE__ */ jsx20(Check3, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2964
2913
|
] }),
|
|
2965
|
-
agent.description && /* @__PURE__ */
|
|
2914
|
+
agent.description && /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2966
2915
|
] })
|
|
2967
2916
|
]
|
|
2968
2917
|
},
|
|
@@ -2970,59 +2919,59 @@ var ChatHeader = ({
|
|
|
2970
2919
|
);
|
|
2971
2920
|
}) })
|
|
2972
2921
|
] }),
|
|
2973
|
-
!showAgentSelector && isMobile && /* @__PURE__ */
|
|
2922
|
+
!showAgentSelector && isMobile && /* @__PURE__ */ jsx20("span", { className: "text-sm font-medium truncate max-w-[150px] ml-2", children: currentThreadTitle || config.branding?.title || "Chat" })
|
|
2974
2923
|
] }),
|
|
2975
|
-
/* @__PURE__ */
|
|
2976
|
-
/* @__PURE__ */
|
|
2977
|
-
showCustomComponentButton && config.customComponent && /* @__PURE__ */
|
|
2978
|
-
/* @__PURE__ */
|
|
2924
|
+
/* @__PURE__ */ jsx20("div", { className: "flex-1" }),
|
|
2925
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
|
|
2926
|
+
showCustomComponentButton && config.customComponent && /* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
2927
|
+
/* @__PURE__ */ jsx20(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx20(
|
|
2979
2928
|
Button,
|
|
2980
2929
|
{
|
|
2981
2930
|
variant: "ghost",
|
|
2982
2931
|
size: "icon",
|
|
2983
2932
|
className: "h-8 w-8",
|
|
2984
2933
|
onClick: onCustomComponentToggle,
|
|
2985
|
-
children: config.customComponent.icon || /* @__PURE__ */
|
|
2934
|
+
children: config.customComponent.icon || /* @__PURE__ */ jsx20(Menu, { className: "h-4 w-4" })
|
|
2986
2935
|
}
|
|
2987
2936
|
) }),
|
|
2988
|
-
/* @__PURE__ */
|
|
2937
|
+
/* @__PURE__ */ jsx20(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
|
|
2989
2938
|
] }),
|
|
2990
2939
|
config.headerActions,
|
|
2991
|
-
/* @__PURE__ */
|
|
2992
|
-
/* @__PURE__ */
|
|
2993
|
-
/* @__PURE__ */
|
|
2994
|
-
onNewThread && /* @__PURE__ */
|
|
2995
|
-
/* @__PURE__ */
|
|
2996
|
-
/* @__PURE__ */
|
|
2940
|
+
/* @__PURE__ */ jsxs12(DropdownMenu, { children: [
|
|
2941
|
+
/* @__PURE__ */ jsx20(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx20(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ jsx20(MoreVertical, { className: "h-4 w-4" }) }) }),
|
|
2942
|
+
/* @__PURE__ */ jsxs12(DropdownMenuContent, { align: "end", children: [
|
|
2943
|
+
onNewThread && /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2944
|
+
/* @__PURE__ */ jsxs12(DropdownMenuItem, { onClick: () => onNewThread?.(), className: "font-medium text-primary", children: [
|
|
2945
|
+
/* @__PURE__ */ jsx20(Plus2, { className: "h-4 w-4 mr-2" }),
|
|
2997
2946
|
config.labels?.newThread || "New Thread"
|
|
2998
2947
|
] }),
|
|
2999
|
-
/* @__PURE__ */
|
|
2948
|
+
/* @__PURE__ */ jsx20(DropdownMenuSeparator, {})
|
|
3000
2949
|
] }),
|
|
3001
|
-
onExportData && /* @__PURE__ */
|
|
3002
|
-
/* @__PURE__ */
|
|
2950
|
+
onExportData && /* @__PURE__ */ jsxs12(DropdownMenuItem, { onClick: onExportData, children: [
|
|
2951
|
+
/* @__PURE__ */ jsx20(Download, { className: "h-4 w-4 mr-2" }),
|
|
3003
2952
|
config.labels?.exportData || "Export Data"
|
|
3004
2953
|
] }),
|
|
3005
|
-
onImportData && /* @__PURE__ */
|
|
3006
|
-
/* @__PURE__ */
|
|
2954
|
+
onImportData && /* @__PURE__ */ jsxs12(DropdownMenuItem, { onClick: handleImportClick, children: [
|
|
2955
|
+
/* @__PURE__ */ jsx20(Upload, { className: "h-4 w-4 mr-2" }),
|
|
3007
2956
|
config.labels?.importData || "Import Data"
|
|
3008
2957
|
] }),
|
|
3009
|
-
(onExportData || onImportData) && /* @__PURE__ */
|
|
3010
|
-
/* @__PURE__ */
|
|
3011
|
-
/* @__PURE__ */
|
|
2958
|
+
(onExportData || onImportData) && /* @__PURE__ */ jsx20(DropdownMenuSeparator, {}),
|
|
2959
|
+
/* @__PURE__ */ jsx20(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2960
|
+
/* @__PURE__ */ jsx20(Sun2, { className: "h-4 w-4 mr-2" }),
|
|
3012
2961
|
config.labels?.lightMode || "Light Mode"
|
|
3013
|
-
] }) : /* @__PURE__ */
|
|
3014
|
-
/* @__PURE__ */
|
|
2962
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2963
|
+
/* @__PURE__ */ jsx20(Moon2, { className: "h-4 w-4 mr-2" }),
|
|
3015
2964
|
config.labels?.darkMode || "Dark Mode"
|
|
3016
2965
|
] }) }),
|
|
3017
|
-
onClearAll && /* @__PURE__ */
|
|
3018
|
-
/* @__PURE__ */
|
|
3019
|
-
/* @__PURE__ */
|
|
2966
|
+
onClearAll && /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2967
|
+
/* @__PURE__ */ jsx20(DropdownMenuSeparator, {}),
|
|
2968
|
+
/* @__PURE__ */ jsxs12(
|
|
3020
2969
|
DropdownMenuItem,
|
|
3021
2970
|
{
|
|
3022
2971
|
onClick: onClearAll,
|
|
3023
2972
|
className: "text-destructive",
|
|
3024
2973
|
children: [
|
|
3025
|
-
/* @__PURE__ */
|
|
2974
|
+
/* @__PURE__ */ jsx20(Trash22, { className: "h-4 w-4 mr-2" }),
|
|
3026
2975
|
config.labels?.clearAll || "Clear All"
|
|
3027
2976
|
]
|
|
3028
2977
|
}
|
|
@@ -3037,18 +2986,18 @@ var ChatHeader = ({
|
|
|
3037
2986
|
};
|
|
3038
2987
|
|
|
3039
2988
|
// src/components/chat/ChatInput.tsx
|
|
3040
|
-
import
|
|
2989
|
+
import React12, { useState as useState7, useRef as useRef5, useCallback as useCallback3, useEffect as useEffect10, memo as memo4 } from "react";
|
|
3041
2990
|
|
|
3042
2991
|
// src/components/chat/UserContext.tsx
|
|
3043
|
-
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as
|
|
3044
|
-
import { jsx as
|
|
2992
|
+
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect9, useMemo as useMemo5, useState as useState6 } from "react";
|
|
2993
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3045
2994
|
var Ctx = createContext2(void 0);
|
|
3046
2995
|
var ChatUserContextProvider = ({ children, initial }) => {
|
|
3047
|
-
const [ctx, setCtx] =
|
|
2996
|
+
const [ctx, setCtx] = useState6(() => ({
|
|
3048
2997
|
updatedAt: Date.now(),
|
|
3049
2998
|
...initial ?? {}
|
|
3050
2999
|
}));
|
|
3051
|
-
|
|
3000
|
+
useEffect9(() => {
|
|
3052
3001
|
if (!initial) return;
|
|
3053
3002
|
setCtx((prev) => {
|
|
3054
3003
|
const keys = Object.keys(initial);
|
|
@@ -3063,12 +3012,12 @@ var ChatUserContextProvider = ({ children, initial }) => {
|
|
|
3063
3012
|
return { ...prev, ...partial, updatedAt: Date.now() };
|
|
3064
3013
|
});
|
|
3065
3014
|
}, []);
|
|
3066
|
-
const value =
|
|
3015
|
+
const value = useMemo5(() => ({
|
|
3067
3016
|
context: ctx,
|
|
3068
3017
|
setContext: setPartial,
|
|
3069
3018
|
resetContext: () => setCtx({ updatedAt: Date.now() })
|
|
3070
3019
|
}), [ctx, setPartial]);
|
|
3071
|
-
return /* @__PURE__ */
|
|
3020
|
+
return /* @__PURE__ */ jsx21(Ctx.Provider, { value, children });
|
|
3072
3021
|
};
|
|
3073
3022
|
function useChatUserContext() {
|
|
3074
3023
|
const v = useContext2(Ctx);
|
|
@@ -3402,13 +3351,13 @@ var resolveVoiceProviderFactory = (createProvider) => createProvider ?? createMa
|
|
|
3402
3351
|
|
|
3403
3352
|
// src/components/ui/progress.tsx
|
|
3404
3353
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
3405
|
-
import { jsx as
|
|
3354
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3406
3355
|
function Progress({
|
|
3407
3356
|
className,
|
|
3408
3357
|
value,
|
|
3409
3358
|
...props
|
|
3410
3359
|
}) {
|
|
3411
|
-
return /* @__PURE__ */
|
|
3360
|
+
return /* @__PURE__ */ jsx22(
|
|
3412
3361
|
ProgressPrimitive.Root,
|
|
3413
3362
|
{
|
|
3414
3363
|
"data-slot": "progress",
|
|
@@ -3417,7 +3366,7 @@ function Progress({
|
|
|
3417
3366
|
className
|
|
3418
3367
|
),
|
|
3419
3368
|
...props,
|
|
3420
|
-
children: /* @__PURE__ */
|
|
3369
|
+
children: /* @__PURE__ */ jsx22(
|
|
3421
3370
|
ProgressPrimitive.Indicator,
|
|
3422
3371
|
{
|
|
3423
3372
|
"data-slot": "progress-indicator",
|
|
@@ -3431,7 +3380,7 @@ function Progress({
|
|
|
3431
3380
|
|
|
3432
3381
|
// src/components/chat/VoiceComposer.tsx
|
|
3433
3382
|
import { Keyboard, Loader2, Mic, Send, Square, Trash2 as Trash23, X as X3 } from "lucide-react";
|
|
3434
|
-
import { jsx as
|
|
3383
|
+
import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3435
3384
|
var formatDuration = (durationMs) => {
|
|
3436
3385
|
const totalSeconds = Math.max(0, Math.floor(durationMs / 1e3));
|
|
3437
3386
|
const minutes = Math.floor(totalSeconds / 60);
|
|
@@ -3526,13 +3475,13 @@ var VoiceComposer = ({
|
|
|
3526
3475
|
}
|
|
3527
3476
|
onRecordAgain();
|
|
3528
3477
|
};
|
|
3529
|
-
return /* @__PURE__ */
|
|
3530
|
-
/* @__PURE__ */
|
|
3531
|
-
/* @__PURE__ */
|
|
3532
|
-
/* @__PURE__ */
|
|
3533
|
-
/* @__PURE__ */
|
|
3478
|
+
return /* @__PURE__ */ jsxs13("div", { className: "w-full max-w-3xl rounded-2xl border bg-background p-3 shadow-sm sm:p-4 md:min-w-3xl", children: [
|
|
3479
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between gap-2 sm:gap-3", children: [
|
|
3480
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
3481
|
+
/* @__PURE__ */ jsx23(Badge, { variant: "outline", children: labels?.voiceTitle || "Voice" }),
|
|
3482
|
+
/* @__PURE__ */ jsx23("span", { className: "truncate rounded-full bg-muted px-2.5 py-1 text-[11px] sm:text-xs text-muted-foreground", children: headerLabel })
|
|
3534
3483
|
] }),
|
|
3535
|
-
/* @__PURE__ */
|
|
3484
|
+
/* @__PURE__ */ jsxs13(
|
|
3536
3485
|
Button,
|
|
3537
3486
|
{
|
|
3538
3487
|
type: "button",
|
|
@@ -3542,14 +3491,14 @@ var VoiceComposer = ({
|
|
|
3542
3491
|
onClick: onExit,
|
|
3543
3492
|
disabled: disabled || isBusy,
|
|
3544
3493
|
children: [
|
|
3545
|
-
/* @__PURE__ */
|
|
3546
|
-
/* @__PURE__ */
|
|
3494
|
+
/* @__PURE__ */ jsx23(Keyboard, { className: "h-4 w-4" }),
|
|
3495
|
+
/* @__PURE__ */ jsx23("span", { className: "hidden sm:inline", children: labels?.voiceExit || "Use keyboard" })
|
|
3547
3496
|
]
|
|
3548
3497
|
}
|
|
3549
3498
|
)
|
|
3550
3499
|
] }),
|
|
3551
|
-
!isDraftLayout ? /* @__PURE__ */
|
|
3552
|
-
/* @__PURE__ */
|
|
3500
|
+
!isDraftLayout ? /* @__PURE__ */ jsx23("div", { className: "mt-3 rounded-xl border border-dashed border-primary/30 bg-primary/5 px-3 py-3 text-center sm:px-4 sm:py-4", children: /* @__PURE__ */ jsxs13("div", { className: "mx-auto flex w-full max-w-sm flex-col items-center gap-3", children: [
|
|
3501
|
+
/* @__PURE__ */ jsx23(
|
|
3553
3502
|
Button,
|
|
3554
3503
|
{
|
|
3555
3504
|
type: "button",
|
|
@@ -3558,21 +3507,21 @@ var VoiceComposer = ({
|
|
|
3558
3507
|
className: `h-16 w-16 rounded-full sm:h-20 sm:w-20 ${isCapturing ? "bg-red-500 hover:bg-red-600 text-white border-red-500" : "border-red-200 bg-red-50 text-red-600 hover:bg-red-100 hover:text-red-700"}`,
|
|
3559
3508
|
onClick: isCapturing ? onStop : onStart,
|
|
3560
3509
|
disabled: disabled || isBusy,
|
|
3561
|
-
children: isBusy ? /* @__PURE__ */
|
|
3510
|
+
children: isBusy ? /* @__PURE__ */ jsx23(Loader2, { className: "h-7 w-7 animate-spin" }) : isCapturing ? /* @__PURE__ */ jsx23(Square, { className: "h-7 w-7" }) : /* @__PURE__ */ jsx23(Mic, { className: "h-7 w-7" })
|
|
3562
3511
|
}
|
|
3563
3512
|
),
|
|
3564
|
-
/* @__PURE__ */
|
|
3565
|
-
/* @__PURE__ */
|
|
3566
|
-
/* @__PURE__ */
|
|
3567
|
-
/* @__PURE__ */
|
|
3568
|
-
/* @__PURE__ */
|
|
3513
|
+
/* @__PURE__ */ jsxs13("div", { className: "w-full space-y-2", children: [
|
|
3514
|
+
/* @__PURE__ */ jsx23(Progress, { value: levelValue, className: "h-2" }),
|
|
3515
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
|
|
3516
|
+
/* @__PURE__ */ jsx23("span", { children: formatDuration(durationMs) }),
|
|
3517
|
+
/* @__PURE__ */ jsx23("span", { children: isCapturing ? labels?.voiceStop || "Stop recording" : labels?.voiceStart || "Start recording" })
|
|
3569
3518
|
] })
|
|
3570
3519
|
] }),
|
|
3571
|
-
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */
|
|
3572
|
-
] }) }) : /* @__PURE__ */
|
|
3573
|
-
/* @__PURE__ */
|
|
3574
|
-
/* @__PURE__ */
|
|
3575
|
-
/* @__PURE__ */
|
|
3520
|
+
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ jsx23("div", { className: "w-full rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText })
|
|
3521
|
+
] }) }) : /* @__PURE__ */ jsxs13("div", { className: "mt-3 rounded-xl border bg-muted/20 p-3 sm:p-4", children: [
|
|
3522
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between gap-2 text-xs text-muted-foreground", children: [
|
|
3523
|
+
/* @__PURE__ */ jsx23("span", { children: formatDuration(durationMs) }),
|
|
3524
|
+
/* @__PURE__ */ jsx23(
|
|
3576
3525
|
Button,
|
|
3577
3526
|
{
|
|
3578
3527
|
type: "button",
|
|
@@ -3583,12 +3532,12 @@ var VoiceComposer = ({
|
|
|
3583
3532
|
disabled,
|
|
3584
3533
|
"aria-label": labels?.voiceDiscard || "Delete recording",
|
|
3585
3534
|
title: labels?.voiceDiscard || "Delete recording",
|
|
3586
|
-
children: /* @__PURE__ */
|
|
3535
|
+
children: /* @__PURE__ */ jsx23(Trash23, { className: "h-4 w-4" })
|
|
3587
3536
|
}
|
|
3588
3537
|
)
|
|
3589
3538
|
] }),
|
|
3590
|
-
/* @__PURE__ */
|
|
3591
|
-
/* @__PURE__ */
|
|
3539
|
+
/* @__PURE__ */ jsxs13("div", { className: "mt-4 flex flex-col items-center gap-4 text-center", children: [
|
|
3540
|
+
/* @__PURE__ */ jsx23(
|
|
3592
3541
|
Button,
|
|
3593
3542
|
{
|
|
3594
3543
|
type: "button",
|
|
@@ -3597,12 +3546,12 @@ var VoiceComposer = ({
|
|
|
3597
3546
|
className: `h-20 w-20 rounded-full sm:h-24 sm:w-24 ${orbIsListening ? "border-red-500 bg-red-500 text-white hover:bg-red-600" : isArmedDraft ? "border-red-200 bg-red-50 text-red-600 shadow-[0_0_0_10px_rgba(239,68,68,0.08)] hover:bg-red-100 hover:text-red-700" : "border-red-200 bg-red-50 text-red-600 hover:bg-red-100 hover:text-red-700"}`,
|
|
3598
3547
|
onClick: handleReviewOrbClick,
|
|
3599
3548
|
disabled: disabled || orbIsReviewBusy,
|
|
3600
|
-
children: orbIsReviewBusy ? /* @__PURE__ */
|
|
3549
|
+
children: orbIsReviewBusy ? /* @__PURE__ */ jsx23(Loader2, { className: "h-7 w-7 animate-spin" }) : orbIsListening ? /* @__PURE__ */ jsx23(Square, { className: "h-7 w-7" }) : isArmedDraft ? /* @__PURE__ */ jsx23(Mic, { className: "h-7 w-7 animate-pulse" }) : /* @__PURE__ */ jsx23(Mic, { className: "h-7 w-7" })
|
|
3601
3550
|
}
|
|
3602
3551
|
),
|
|
3603
|
-
/* @__PURE__ */
|
|
3604
|
-
/* @__PURE__ */
|
|
3605
|
-
isCapturing && /* @__PURE__ */
|
|
3552
|
+
/* @__PURE__ */ jsxs13("div", { className: "max-w-sm space-y-1 px-2", children: [
|
|
3553
|
+
/* @__PURE__ */ jsx23("p", { className: "text-sm text-foreground", children: reviewHelperText }),
|
|
3554
|
+
isCapturing && /* @__PURE__ */ jsx23("div", { className: "mx-auto h-1.5 w-32 overflow-hidden rounded-full bg-red-100", children: /* @__PURE__ */ jsx23(
|
|
3606
3555
|
"div",
|
|
3607
3556
|
{
|
|
3608
3557
|
className: "h-full rounded-full bg-red-500 transition-[width] duration-150",
|
|
@@ -3611,21 +3560,21 @@ var VoiceComposer = ({
|
|
|
3611
3560
|
) })
|
|
3612
3561
|
] })
|
|
3613
3562
|
] }),
|
|
3614
|
-
attachment && /* @__PURE__ */
|
|
3615
|
-
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */
|
|
3616
|
-
isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */
|
|
3617
|
-
/* @__PURE__ */
|
|
3618
|
-
isAutoSendActive && /* @__PURE__ */
|
|
3619
|
-
/* @__PURE__ */
|
|
3563
|
+
attachment && /* @__PURE__ */ jsx23("div", { className: "mt-4 rounded-lg border bg-background/90 p-2 shadow-sm", children: /* @__PURE__ */ jsx23("audio", { controls: true, preload: "metadata", className: "w-full", children: /* @__PURE__ */ jsx23("source", { src: attachment.dataUrl, type: attachment.mimeType }) }) }),
|
|
3564
|
+
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ jsx23("div", { className: "mt-3 rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText }),
|
|
3565
|
+
isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */ jsx23("div", { className: "mt-3 flex justify-center", children: /* @__PURE__ */ jsx23("div", { className: "inline-flex items-center rounded-full border bg-background px-3 py-1 text-xs text-muted-foreground", children: interpolateSeconds(labels?.voiceAutoSendIn, countdownSeconds) }) }),
|
|
3566
|
+
/* @__PURE__ */ jsxs13("div", { className: "mt-4 grid grid-cols-1 gap-2 sm:flex sm:items-center sm:justify-end", children: [
|
|
3567
|
+
isAutoSendActive && /* @__PURE__ */ jsxs13(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancelAutoSend, disabled, className: "w-full sm:w-auto", children: [
|
|
3568
|
+
/* @__PURE__ */ jsx23(X3, { className: "h-4 w-4" }),
|
|
3620
3569
|
labels?.voiceCancel || "Cancel"
|
|
3621
3570
|
] }),
|
|
3622
|
-
/* @__PURE__ */
|
|
3623
|
-
/* @__PURE__ */
|
|
3571
|
+
/* @__PURE__ */ jsxs13(Button, { type: "button", size: "sm", onClick: onSendNow, disabled, className: "w-full sm:w-auto", children: [
|
|
3572
|
+
/* @__PURE__ */ jsx23(Send, { className: "h-4 w-4" }),
|
|
3624
3573
|
labels?.voiceSendNow || "Send now"
|
|
3625
3574
|
] })
|
|
3626
3575
|
] })
|
|
3627
3576
|
] }),
|
|
3628
|
-
errorMessage && /* @__PURE__ */
|
|
3577
|
+
errorMessage && /* @__PURE__ */ jsx23("div", { className: "mt-3 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive", children: errorMessage })
|
|
3629
3578
|
] });
|
|
3630
3579
|
};
|
|
3631
3580
|
|
|
@@ -3643,7 +3592,7 @@ import {
|
|
|
3643
3592
|
Pause,
|
|
3644
3593
|
Loader2 as Loader22
|
|
3645
3594
|
} from "lucide-react";
|
|
3646
|
-
import { Fragment as Fragment5, jsx as
|
|
3595
|
+
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3647
3596
|
function getActiveMentionMatch(value, caret) {
|
|
3648
3597
|
const prefix = value.slice(0, caret);
|
|
3649
3598
|
const match = /(^|\s)@([\w.-]*)$/.exec(prefix);
|
|
@@ -3667,7 +3616,7 @@ function resolveTargetFromMentions(value, agents) {
|
|
|
3667
3616
|
}
|
|
3668
3617
|
return null;
|
|
3669
3618
|
}
|
|
3670
|
-
var FileUploadItem =
|
|
3619
|
+
var FileUploadItem = memo4(function FileUploadItem2({ file, progress, onCancel }) {
|
|
3671
3620
|
const guessTypeFromName = (name) => {
|
|
3672
3621
|
const ext = (name || "").split(".").pop()?.toLowerCase();
|
|
3673
3622
|
switch (ext) {
|
|
@@ -3695,10 +3644,10 @@ var FileUploadItem = memo3(function FileUploadItem2({ file, progress, onCancel }
|
|
|
3695
3644
|
};
|
|
3696
3645
|
const getFileIcon = (type, name) => {
|
|
3697
3646
|
const t = typeof type === "string" && type.length > 0 ? type : guessTypeFromName(name);
|
|
3698
|
-
if (t.startsWith("image/")) return /* @__PURE__ */
|
|
3699
|
-
if (t.startsWith("video/")) return /* @__PURE__ */
|
|
3700
|
-
if (t.startsWith("audio/")) return /* @__PURE__ */
|
|
3701
|
-
return /* @__PURE__ */
|
|
3647
|
+
if (t.startsWith("image/")) return /* @__PURE__ */ jsx24(Image2, { className: "h-4 w-4" });
|
|
3648
|
+
if (t.startsWith("video/")) return /* @__PURE__ */ jsx24(Video, { className: "h-4 w-4" });
|
|
3649
|
+
if (t.startsWith("audio/")) return /* @__PURE__ */ jsx24(Mic2, { className: "h-4 w-4" });
|
|
3650
|
+
return /* @__PURE__ */ jsx24(FileText, { className: "h-4 w-4" });
|
|
3702
3651
|
};
|
|
3703
3652
|
const formatFileSize = (bytes) => {
|
|
3704
3653
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -3707,30 +3656,30 @@ var FileUploadItem = memo3(function FileUploadItem2({ file, progress, onCancel }
|
|
|
3707
3656
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
3708
3657
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
3709
3658
|
};
|
|
3710
|
-
return /* @__PURE__ */
|
|
3659
|
+
return /* @__PURE__ */ jsx24(Card, { className: "relative", children: /* @__PURE__ */ jsx24(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-3", children: [
|
|
3711
3660
|
getFileIcon(file.type, file.name),
|
|
3712
|
-
/* @__PURE__ */
|
|
3713
|
-
/* @__PURE__ */
|
|
3714
|
-
/* @__PURE__ */
|
|
3715
|
-
/* @__PURE__ */
|
|
3661
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex-1 min-w-0", children: [
|
|
3662
|
+
/* @__PURE__ */ jsx24("p", { className: "text-sm font-medium truncate", children: file.name }),
|
|
3663
|
+
/* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
|
|
3664
|
+
/* @__PURE__ */ jsx24(Progress, { value: progress, className: "h-1 mt-1" })
|
|
3716
3665
|
] }),
|
|
3717
|
-
/* @__PURE__ */
|
|
3666
|
+
/* @__PURE__ */ jsx24(
|
|
3718
3667
|
Button,
|
|
3719
3668
|
{
|
|
3720
3669
|
variant: "ghost",
|
|
3721
3670
|
size: "icon",
|
|
3722
3671
|
className: "h-6 w-6",
|
|
3723
3672
|
onClick: onCancel,
|
|
3724
|
-
children: /* @__PURE__ */
|
|
3673
|
+
children: /* @__PURE__ */ jsx24(X4, { className: "h-3 w-3" })
|
|
3725
3674
|
}
|
|
3726
3675
|
)
|
|
3727
3676
|
] }) }) });
|
|
3728
3677
|
});
|
|
3729
|
-
var AttachmentPreview =
|
|
3730
|
-
const [isPlaying, setIsPlaying] =
|
|
3731
|
-
const [audioPlaybackSrc, setAudioPlaybackSrc] =
|
|
3678
|
+
var AttachmentPreview = memo4(function AttachmentPreview2({ attachment, onRemove }) {
|
|
3679
|
+
const [isPlaying, setIsPlaying] = useState7(false);
|
|
3680
|
+
const [audioPlaybackSrc, setAudioPlaybackSrc] = useState7(attachment.dataUrl);
|
|
3732
3681
|
const audioRef = useRef5(null);
|
|
3733
|
-
|
|
3682
|
+
useEffect10(() => {
|
|
3734
3683
|
if (attachment.kind !== "audio" || !attachment.dataUrl.startsWith("data:")) {
|
|
3735
3684
|
setAudioPlaybackSrc(attachment.dataUrl);
|
|
3736
3685
|
return;
|
|
@@ -3761,9 +3710,9 @@ var AttachmentPreview = memo3(function AttachmentPreview2({ attachment, onRemove
|
|
|
3761
3710
|
const minutes = Math.floor(seconds / 60);
|
|
3762
3711
|
return `${minutes}:${(seconds % 60).toString().padStart(2, "0")}`;
|
|
3763
3712
|
};
|
|
3764
|
-
return /* @__PURE__ */
|
|
3765
|
-
attachment.kind === "image" && /* @__PURE__ */
|
|
3766
|
-
/* @__PURE__ */
|
|
3713
|
+
return /* @__PURE__ */ jsx24(Card, { className: "relative group", children: /* @__PURE__ */ jsxs14(CardContent, { className: "p-2", children: [
|
|
3714
|
+
attachment.kind === "image" && /* @__PURE__ */ jsxs14("div", { className: "relative", children: [
|
|
3715
|
+
/* @__PURE__ */ jsx24(
|
|
3767
3716
|
"img",
|
|
3768
3717
|
{
|
|
3769
3718
|
src: attachment.dataUrl,
|
|
@@ -3771,19 +3720,19 @@ var AttachmentPreview = memo3(function AttachmentPreview2({ attachment, onRemove
|
|
|
3771
3720
|
className: "w-full h-20 object-cover rounded"
|
|
3772
3721
|
}
|
|
3773
3722
|
),
|
|
3774
|
-
/* @__PURE__ */
|
|
3723
|
+
/* @__PURE__ */ jsx24("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx24(
|
|
3775
3724
|
Button,
|
|
3776
3725
|
{
|
|
3777
3726
|
variant: "destructive",
|
|
3778
3727
|
size: "icon",
|
|
3779
3728
|
className: "h-6 w-6",
|
|
3780
3729
|
onClick: onRemove,
|
|
3781
|
-
children: /* @__PURE__ */
|
|
3730
|
+
children: /* @__PURE__ */ jsx24(X4, { className: "h-3 w-3" })
|
|
3782
3731
|
}
|
|
3783
3732
|
) })
|
|
3784
3733
|
] }),
|
|
3785
|
-
attachment.kind === "video" && /* @__PURE__ */
|
|
3786
|
-
/* @__PURE__ */
|
|
3734
|
+
attachment.kind === "video" && /* @__PURE__ */ jsxs14("div", { className: "relative", children: [
|
|
3735
|
+
/* @__PURE__ */ jsx24(
|
|
3787
3736
|
"video",
|
|
3788
3737
|
{
|
|
3789
3738
|
src: attachment.dataUrl,
|
|
@@ -3792,34 +3741,34 @@ var AttachmentPreview = memo3(function AttachmentPreview2({ attachment, onRemove
|
|
|
3792
3741
|
muted: true
|
|
3793
3742
|
}
|
|
3794
3743
|
),
|
|
3795
|
-
/* @__PURE__ */
|
|
3744
|
+
/* @__PURE__ */ jsx24("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx24(
|
|
3796
3745
|
Button,
|
|
3797
3746
|
{
|
|
3798
3747
|
variant: "destructive",
|
|
3799
3748
|
size: "icon",
|
|
3800
3749
|
className: "h-6 w-6",
|
|
3801
3750
|
onClick: onRemove,
|
|
3802
|
-
children: /* @__PURE__ */
|
|
3751
|
+
children: /* @__PURE__ */ jsx24(X4, { className: "h-3 w-3" })
|
|
3803
3752
|
}
|
|
3804
3753
|
) }),
|
|
3805
|
-
/* @__PURE__ */
|
|
3754
|
+
/* @__PURE__ */ jsx24(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration2(attachment.durationMs) })
|
|
3806
3755
|
] }),
|
|
3807
|
-
attachment.kind === "audio" && /* @__PURE__ */
|
|
3808
|
-
/* @__PURE__ */
|
|
3756
|
+
attachment.kind === "audio" && /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 p-2", children: [
|
|
3757
|
+
/* @__PURE__ */ jsx24(
|
|
3809
3758
|
Button,
|
|
3810
3759
|
{
|
|
3811
3760
|
variant: "outline",
|
|
3812
3761
|
size: "icon",
|
|
3813
3762
|
className: "h-8 w-8",
|
|
3814
3763
|
onClick: handlePlayPause,
|
|
3815
|
-
children: isPlaying ? /* @__PURE__ */
|
|
3764
|
+
children: isPlaying ? /* @__PURE__ */ jsx24(Pause, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx24(Play, { className: "h-3 w-3" })
|
|
3816
3765
|
}
|
|
3817
3766
|
),
|
|
3818
|
-
/* @__PURE__ */
|
|
3819
|
-
/* @__PURE__ */
|
|
3820
|
-
/* @__PURE__ */
|
|
3767
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex-1", children: [
|
|
3768
|
+
/* @__PURE__ */ jsx24("p", { className: "text-xs font-medium", children: attachment.fileName || "Audio" }),
|
|
3769
|
+
/* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: formatDuration2(attachment.durationMs) })
|
|
3821
3770
|
] }),
|
|
3822
|
-
/* @__PURE__ */
|
|
3771
|
+
/* @__PURE__ */ jsx24(
|
|
3823
3772
|
"audio",
|
|
3824
3773
|
{
|
|
3825
3774
|
ref: audioRef,
|
|
@@ -3827,21 +3776,21 @@ var AttachmentPreview = memo3(function AttachmentPreview2({ attachment, onRemove
|
|
|
3827
3776
|
onPause: () => setIsPlaying(false),
|
|
3828
3777
|
onEnded: () => setIsPlaying(false),
|
|
3829
3778
|
preload: "metadata",
|
|
3830
|
-
children: /* @__PURE__ */
|
|
3779
|
+
children: /* @__PURE__ */ jsx24("source", { src: audioPlaybackSrc, type: attachment.mimeType })
|
|
3831
3780
|
}
|
|
3832
3781
|
),
|
|
3833
|
-
/* @__PURE__ */
|
|
3782
|
+
/* @__PURE__ */ jsx24(
|
|
3834
3783
|
Button,
|
|
3835
3784
|
{
|
|
3836
3785
|
variant: "ghost",
|
|
3837
3786
|
size: "icon",
|
|
3838
3787
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
3839
3788
|
onClick: onRemove,
|
|
3840
|
-
children: /* @__PURE__ */
|
|
3789
|
+
children: /* @__PURE__ */ jsx24(X4, { className: "h-3 w-3" })
|
|
3841
3790
|
}
|
|
3842
3791
|
)
|
|
3843
3792
|
] }),
|
|
3844
|
-
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */
|
|
3793
|
+
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ jsx24("div", { className: "absolute bottom-0 left-0 right-0 bg-black/70 text-white text-xs p-1 rounded-b", children: /* @__PURE__ */ jsx24("p", { className: "truncate", children: attachment.fileName }) })
|
|
3845
3794
|
] }) });
|
|
3846
3795
|
});
|
|
3847
3796
|
var resolveVoiceErrorMessage = (error, config) => {
|
|
@@ -3855,7 +3804,7 @@ var resolveVoiceErrorMessage = (error, config) => {
|
|
|
3855
3804
|
};
|
|
3856
3805
|
var clearVoiceTranscript = () => ({});
|
|
3857
3806
|
var resolveVoiceSegmentDuration = (segment) => segment.attachment.durationMs ?? 0;
|
|
3858
|
-
var ChatInput =
|
|
3807
|
+
var ChatInput = memo4(function ChatInput2({
|
|
3859
3808
|
value,
|
|
3860
3809
|
onChange,
|
|
3861
3810
|
onSubmit,
|
|
@@ -3884,27 +3833,27 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
3884
3833
|
const voiceTranscriptMode = config?.voiceCompose?.transcriptMode ?? "final-only";
|
|
3885
3834
|
const voiceMaxRecordingMs = config?.voiceCompose?.maxRecordingMs;
|
|
3886
3835
|
const { setContext } = useChatUserContext();
|
|
3887
|
-
const [uploadProgress, setUploadProgress] =
|
|
3888
|
-
const [isVoiceComposerOpen, setIsVoiceComposerOpen] =
|
|
3836
|
+
const [uploadProgress, setUploadProgress] = useState7(/* @__PURE__ */ new Map());
|
|
3837
|
+
const [isVoiceComposerOpen, setIsVoiceComposerOpen] = useState7(
|
|
3889
3838
|
() => enableAudioRecording && voiceDefaultMode === "voice"
|
|
3890
3839
|
);
|
|
3891
|
-
const [voiceState, setVoiceState] =
|
|
3892
|
-
const [voiceDraft, setVoiceDraft] =
|
|
3893
|
-
const [voiceTranscript, setVoiceTranscript] =
|
|
3894
|
-
const [voiceDurationMs, setVoiceDurationMs] =
|
|
3895
|
-
const [voiceAudioLevel, setVoiceAudioLevel] =
|
|
3896
|
-
const [voiceCountdownMs, setVoiceCountdownMs] =
|
|
3897
|
-
const [isVoiceAutoSendActive, setIsVoiceAutoSendActive] =
|
|
3898
|
-
const [voiceError, setVoiceError] =
|
|
3899
|
-
const [activeMention, setActiveMention] =
|
|
3900
|
-
const [activeMentionIndex, setActiveMentionIndex] =
|
|
3840
|
+
const [voiceState, setVoiceState] = useState7("idle");
|
|
3841
|
+
const [voiceDraft, setVoiceDraft] = useState7(null);
|
|
3842
|
+
const [voiceTranscript, setVoiceTranscript] = useState7(clearVoiceTranscript);
|
|
3843
|
+
const [voiceDurationMs, setVoiceDurationMs] = useState7(0);
|
|
3844
|
+
const [voiceAudioLevel, setVoiceAudioLevel] = useState7(0);
|
|
3845
|
+
const [voiceCountdownMs, setVoiceCountdownMs] = useState7(0);
|
|
3846
|
+
const [isVoiceAutoSendActive, setIsVoiceAutoSendActive] = useState7(false);
|
|
3847
|
+
const [voiceError, setVoiceError] = useState7(null);
|
|
3848
|
+
const [activeMention, setActiveMention] = useState7(null);
|
|
3849
|
+
const [activeMentionIndex, setActiveMentionIndex] = useState7(0);
|
|
3901
3850
|
const textareaRef = useRef5(null);
|
|
3902
3851
|
const fileInputRef = useRef5(null);
|
|
3903
3852
|
const voiceProviderRef = useRef5(null);
|
|
3904
3853
|
const voiceDraftRef = useRef5(null);
|
|
3905
3854
|
const voiceAppendBaseRef = useRef5(null);
|
|
3906
3855
|
const voiceAppendBaseDurationRef = useRef5(0);
|
|
3907
|
-
const filteredMentionAgents =
|
|
3856
|
+
const filteredMentionAgents = React12.useMemo(() => {
|
|
3908
3857
|
if (!activeMention || mentionAgents.length === 0) return [];
|
|
3909
3858
|
const query = activeMention.query.trim().toLowerCase();
|
|
3910
3859
|
const rank = (agent) => {
|
|
@@ -3933,7 +3882,7 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
3933
3882
|
});
|
|
3934
3883
|
setActiveMentionIndex(0);
|
|
3935
3884
|
}, []);
|
|
3936
|
-
|
|
3885
|
+
useEffect10(() => {
|
|
3937
3886
|
return () => {
|
|
3938
3887
|
if (voiceProviderRef.current) {
|
|
3939
3888
|
void voiceProviderRef.current.destroy();
|
|
@@ -3941,10 +3890,10 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
3941
3890
|
}
|
|
3942
3891
|
};
|
|
3943
3892
|
}, []);
|
|
3944
|
-
|
|
3893
|
+
useEffect10(() => {
|
|
3945
3894
|
voiceDraftRef.current = voiceDraft;
|
|
3946
3895
|
}, [voiceDraft]);
|
|
3947
|
-
|
|
3896
|
+
useEffect10(() => {
|
|
3948
3897
|
if (!isMentionMenuOpen) {
|
|
3949
3898
|
setActiveMentionIndex(0);
|
|
3950
3899
|
return;
|
|
@@ -4364,7 +4313,7 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4364
4313
|
setVoiceAudioLevel(0);
|
|
4365
4314
|
setVoiceState("review");
|
|
4366
4315
|
}, [armVoiceDraftForAppend, stopVoiceCapture, voiceReviewMode, voiceState]);
|
|
4367
|
-
|
|
4316
|
+
useEffect10(() => {
|
|
4368
4317
|
if (!voiceDraft || voiceAutoSendDelayMs <= 0 || !isVoiceAutoSendActive) {
|
|
4369
4318
|
return;
|
|
4370
4319
|
}
|
|
@@ -4392,8 +4341,8 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4392
4341
|
};
|
|
4393
4342
|
const canAddMoreAttachments = attachments.length < maxAttachments;
|
|
4394
4343
|
const showVoiceComposer = enableAudioRecording && isVoiceComposerOpen;
|
|
4395
|
-
return /* @__PURE__ */
|
|
4396
|
-
uploadProgress.size > 0 && /* @__PURE__ */
|
|
4344
|
+
return /* @__PURE__ */ jsx24(TooltipProvider, { children: /* @__PURE__ */ jsx24("div", { className: `border-t py-0 bg-transparent ${className}`, children: /* @__PURE__ */ jsxs14("div", { className: "px-0 md:p-2 pb-1 space-y-4 bg-transparent", children: [
|
|
4345
|
+
uploadProgress.size > 0 && /* @__PURE__ */ jsx24("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ jsx24(
|
|
4397
4346
|
FileUploadItem,
|
|
4398
4347
|
{
|
|
4399
4348
|
file: { name: progress.fileName },
|
|
@@ -4408,7 +4357,7 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4408
4357
|
},
|
|
4409
4358
|
id
|
|
4410
4359
|
)) }),
|
|
4411
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
4360
|
+
attachments.length > 0 && /* @__PURE__ */ jsx24("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ jsx24(
|
|
4412
4361
|
AttachmentPreview,
|
|
4413
4362
|
{
|
|
4414
4363
|
attachment,
|
|
@@ -4416,7 +4365,7 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4416
4365
|
},
|
|
4417
4366
|
index
|
|
4418
4367
|
)) }),
|
|
4419
|
-
showVoiceComposer ? /* @__PURE__ */
|
|
4368
|
+
showVoiceComposer ? /* @__PURE__ */ jsx24("div", { className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsx24(
|
|
4420
4369
|
VoiceComposer,
|
|
4421
4370
|
{
|
|
4422
4371
|
state: voiceState,
|
|
@@ -4456,15 +4405,15 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4456
4405
|
void closeVoiceComposer();
|
|
4457
4406
|
}
|
|
4458
4407
|
}
|
|
4459
|
-
) }) : /* @__PURE__ */
|
|
4408
|
+
) }) : /* @__PURE__ */ jsx24("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsxs14(
|
|
4460
4409
|
"div",
|
|
4461
4410
|
{
|
|
4462
4411
|
className: "flex items-end gap-2 p-3 border rounded-lg bg-background w-full md:min-w-3xl max-w-3xl",
|
|
4463
4412
|
onDrop: handleDrop,
|
|
4464
4413
|
onDragOver: handleDragOver,
|
|
4465
4414
|
children: [
|
|
4466
|
-
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */
|
|
4467
|
-
/* @__PURE__ */
|
|
4415
|
+
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4416
|
+
/* @__PURE__ */ jsx24(
|
|
4468
4417
|
"input",
|
|
4469
4418
|
{
|
|
4470
4419
|
ref: fileInputRef,
|
|
@@ -4475,8 +4424,8 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4475
4424
|
className: "hidden"
|
|
4476
4425
|
}
|
|
4477
4426
|
),
|
|
4478
|
-
/* @__PURE__ */
|
|
4479
|
-
/* @__PURE__ */
|
|
4427
|
+
/* @__PURE__ */ jsxs14(Tooltip, { children: [
|
|
4428
|
+
/* @__PURE__ */ jsx24(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx24(
|
|
4480
4429
|
Button,
|
|
4481
4430
|
{
|
|
4482
4431
|
type: "button",
|
|
@@ -4489,14 +4438,14 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4489
4438
|
fileInputRef.current?.click();
|
|
4490
4439
|
},
|
|
4491
4440
|
disabled,
|
|
4492
|
-
children: /* @__PURE__ */
|
|
4441
|
+
children: /* @__PURE__ */ jsx24(Paperclip, { className: "h-4 w-4" })
|
|
4493
4442
|
}
|
|
4494
4443
|
) }),
|
|
4495
|
-
/* @__PURE__ */
|
|
4444
|
+
/* @__PURE__ */ jsx24(TooltipContent, { children: config?.labels?.attachFileTooltip })
|
|
4496
4445
|
] })
|
|
4497
4446
|
] }),
|
|
4498
|
-
/* @__PURE__ */
|
|
4499
|
-
/* @__PURE__ */
|
|
4447
|
+
/* @__PURE__ */ jsxs14("div", { className: "relative flex-1", children: [
|
|
4448
|
+
/* @__PURE__ */ jsx24(
|
|
4500
4449
|
Textarea,
|
|
4501
4450
|
{
|
|
4502
4451
|
ref: textareaRef,
|
|
@@ -4520,7 +4469,7 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4520
4469
|
rows: 1
|
|
4521
4470
|
}
|
|
4522
4471
|
),
|
|
4523
|
-
isMentionMenuOpen && /* @__PURE__ */
|
|
4472
|
+
isMentionMenuOpen && /* @__PURE__ */ jsx24("div", { className: "absolute bottom-full left-0 right-0 mb-2 overflow-hidden rounded-md border bg-popover shadow-md", children: /* @__PURE__ */ jsx24("div", { className: "p-1", children: filteredMentionAgents.map((agent, index) => /* @__PURE__ */ jsxs14(
|
|
4524
4473
|
"button",
|
|
4525
4474
|
{
|
|
4526
4475
|
type: "button",
|
|
@@ -4530,15 +4479,15 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4530
4479
|
selectMentionAgent(agent);
|
|
4531
4480
|
},
|
|
4532
4481
|
children: [
|
|
4533
|
-
/* @__PURE__ */
|
|
4534
|
-
agent.description && /* @__PURE__ */
|
|
4482
|
+
/* @__PURE__ */ jsx24("span", { className: "font-medium", children: agent.name }),
|
|
4483
|
+
agent.description && /* @__PURE__ */ jsx24("span", { className: "truncate text-xs text-muted-foreground", children: agent.description })
|
|
4535
4484
|
]
|
|
4536
4485
|
},
|
|
4537
4486
|
agent.id
|
|
4538
4487
|
)) }) })
|
|
4539
4488
|
] }),
|
|
4540
|
-
enableAudioRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */
|
|
4541
|
-
/* @__PURE__ */
|
|
4489
|
+
enableAudioRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */ jsxs14(Tooltip, { children: [
|
|
4490
|
+
/* @__PURE__ */ jsx24(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx24(
|
|
4542
4491
|
Button,
|
|
4543
4492
|
{
|
|
4544
4493
|
type: "button",
|
|
@@ -4549,13 +4498,13 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4549
4498
|
void startVoiceCapture();
|
|
4550
4499
|
},
|
|
4551
4500
|
disabled: disabled || isGenerating,
|
|
4552
|
-
children: /* @__PURE__ */
|
|
4501
|
+
children: /* @__PURE__ */ jsx24(Mic2, { className: "h-4 w-4" })
|
|
4553
4502
|
}
|
|
4554
4503
|
) }),
|
|
4555
|
-
/* @__PURE__ */
|
|
4504
|
+
/* @__PURE__ */ jsx24(TooltipContent, { children: config?.labels?.voiceEnter })
|
|
4556
4505
|
] }),
|
|
4557
|
-
isGenerating ? /* @__PURE__ */
|
|
4558
|
-
/* @__PURE__ */
|
|
4506
|
+
isGenerating ? /* @__PURE__ */ jsxs14(Tooltip, { children: [
|
|
4507
|
+
/* @__PURE__ */ jsx24(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx24(
|
|
4559
4508
|
Button,
|
|
4560
4509
|
{
|
|
4561
4510
|
type: "button",
|
|
@@ -4563,36 +4512,36 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4563
4512
|
size: "icon",
|
|
4564
4513
|
className: "h-10 w-10",
|
|
4565
4514
|
onClick: onStopGeneration,
|
|
4566
|
-
children: /* @__PURE__ */
|
|
4515
|
+
children: /* @__PURE__ */ jsx24(Square2, { className: "h-4 w-4" })
|
|
4567
4516
|
}
|
|
4568
4517
|
) }),
|
|
4569
|
-
/* @__PURE__ */
|
|
4570
|
-
] }) : /* @__PURE__ */
|
|
4571
|
-
/* @__PURE__ */
|
|
4518
|
+
/* @__PURE__ */ jsx24(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
|
|
4519
|
+
] }) : /* @__PURE__ */ jsxs14(Tooltip, { children: [
|
|
4520
|
+
/* @__PURE__ */ jsx24(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx24(
|
|
4572
4521
|
Button,
|
|
4573
4522
|
{
|
|
4574
4523
|
type: "submit",
|
|
4575
4524
|
size: "icon",
|
|
4576
4525
|
className: "h-10 w-10",
|
|
4577
4526
|
disabled: disabled || !value.trim() && attachments.length === 0,
|
|
4578
|
-
children: disabled ? /* @__PURE__ */
|
|
4527
|
+
children: disabled ? /* @__PURE__ */ jsx24(Loader22, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx24(Send2, { className: "h-4 w-4" })
|
|
4579
4528
|
}
|
|
4580
4529
|
) }),
|
|
4581
|
-
/* @__PURE__ */
|
|
4530
|
+
/* @__PURE__ */ jsx24(TooltipContent, { children: config?.labels?.sendMessageTooltip })
|
|
4582
4531
|
] })
|
|
4583
4532
|
]
|
|
4584
4533
|
}
|
|
4585
4534
|
) }),
|
|
4586
|
-
/* @__PURE__ */
|
|
4535
|
+
/* @__PURE__ */ jsxs14("div", { className: "text-[10px] text-muted-foreground text-center", children: [
|
|
4587
4536
|
window.innerWidth > 768 ? config?.labels?.inputHelpText : "",
|
|
4588
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
4537
|
+
attachments.length > 0 && /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4589
4538
|
" \u2022 ",
|
|
4590
4539
|
attachments.length,
|
|
4591
4540
|
"/",
|
|
4592
4541
|
maxAttachments,
|
|
4593
4542
|
" anexos"
|
|
4594
4543
|
] }),
|
|
4595
|
-
config?.labels?.footerLabel && /* @__PURE__ */
|
|
4544
|
+
config?.labels?.footerLabel && /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4596
4545
|
" \u2022 ",
|
|
4597
4546
|
config.labels.footerLabel
|
|
4598
4547
|
] })
|
|
@@ -4601,21 +4550,21 @@ var ChatInput = memo3(function ChatInput2({
|
|
|
4601
4550
|
});
|
|
4602
4551
|
|
|
4603
4552
|
// src/components/chat/UserProfile.tsx
|
|
4604
|
-
import { useState as
|
|
4553
|
+
import { useState as useState8 } from "react";
|
|
4605
4554
|
|
|
4606
4555
|
// src/components/ui/scroll-area.tsx
|
|
4607
|
-
import * as
|
|
4556
|
+
import * as React13 from "react";
|
|
4608
4557
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
4609
|
-
import { jsx as
|
|
4610
|
-
var ScrollArea =
|
|
4611
|
-
return /* @__PURE__ */
|
|
4558
|
+
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4559
|
+
var ScrollArea = React13.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
|
|
4560
|
+
return /* @__PURE__ */ jsxs15(
|
|
4612
4561
|
ScrollAreaPrimitive.Root,
|
|
4613
4562
|
{
|
|
4614
4563
|
"data-slot": "scroll-area",
|
|
4615
4564
|
className: cn("relative", className),
|
|
4616
4565
|
...props,
|
|
4617
4566
|
children: [
|
|
4618
|
-
/* @__PURE__ */
|
|
4567
|
+
/* @__PURE__ */ jsx25(
|
|
4619
4568
|
ScrollAreaPrimitive.Viewport,
|
|
4620
4569
|
{
|
|
4621
4570
|
ref,
|
|
@@ -4629,8 +4578,8 @@ var ScrollArea = React12.forwardRef(({ className, children, viewportClassName, o
|
|
|
4629
4578
|
children
|
|
4630
4579
|
}
|
|
4631
4580
|
),
|
|
4632
|
-
/* @__PURE__ */
|
|
4633
|
-
/* @__PURE__ */
|
|
4581
|
+
/* @__PURE__ */ jsx25(ScrollBar, {}),
|
|
4582
|
+
/* @__PURE__ */ jsx25(ScrollAreaPrimitive.Corner, {})
|
|
4634
4583
|
]
|
|
4635
4584
|
}
|
|
4636
4585
|
);
|
|
@@ -4641,7 +4590,7 @@ function ScrollBar({
|
|
|
4641
4590
|
orientation = "vertical",
|
|
4642
4591
|
...props
|
|
4643
4592
|
}) {
|
|
4644
|
-
return /* @__PURE__ */
|
|
4593
|
+
return /* @__PURE__ */ jsx25(
|
|
4645
4594
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
4646
4595
|
{
|
|
4647
4596
|
"data-slot": "scroll-area-scrollbar",
|
|
@@ -4653,7 +4602,7 @@ function ScrollBar({
|
|
|
4653
4602
|
className
|
|
4654
4603
|
),
|
|
4655
4604
|
...props,
|
|
4656
|
-
children: /* @__PURE__ */
|
|
4605
|
+
children: /* @__PURE__ */ jsx25(
|
|
4657
4606
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
4658
4607
|
{
|
|
4659
4608
|
"data-slot": "scroll-area-thumb",
|
|
@@ -4692,7 +4641,7 @@ import {
|
|
|
4692
4641
|
Check as Check4,
|
|
4693
4642
|
X as X5
|
|
4694
4643
|
} from "lucide-react";
|
|
4695
|
-
import { Fragment as Fragment6, jsx as
|
|
4644
|
+
import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4696
4645
|
var getInitials2 = (name, email) => {
|
|
4697
4646
|
if (name) {
|
|
4698
4647
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -4706,29 +4655,29 @@ var getFieldIcon = (type, key) => {
|
|
|
4706
4655
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
4707
4656
|
switch (type) {
|
|
4708
4657
|
case "email":
|
|
4709
|
-
return /* @__PURE__ */
|
|
4658
|
+
return /* @__PURE__ */ jsx26(Mail, { className: iconClass });
|
|
4710
4659
|
case "phone":
|
|
4711
|
-
return /* @__PURE__ */
|
|
4660
|
+
return /* @__PURE__ */ jsx26(Phone, { className: iconClass });
|
|
4712
4661
|
case "url":
|
|
4713
|
-
return /* @__PURE__ */
|
|
4662
|
+
return /* @__PURE__ */ jsx26(Globe, { className: iconClass });
|
|
4714
4663
|
case "date":
|
|
4715
|
-
return /* @__PURE__ */
|
|
4664
|
+
return /* @__PURE__ */ jsx26(Calendar, { className: iconClass });
|
|
4716
4665
|
}
|
|
4717
4666
|
const lowerKey = key?.toLowerCase() || "";
|
|
4718
|
-
if (lowerKey.includes("follower")) return /* @__PURE__ */
|
|
4719
|
-
if (lowerKey.includes("following")) return /* @__PURE__ */
|
|
4720
|
-
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */
|
|
4721
|
-
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */
|
|
4722
|
-
if (lowerKey.includes("bio")) return /* @__PURE__ */
|
|
4723
|
-
if (lowerKey.includes("email")) return /* @__PURE__ */
|
|
4724
|
-
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */
|
|
4725
|
-
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */
|
|
4726
|
-
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */
|
|
4727
|
-
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */
|
|
4728
|
-
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */
|
|
4729
|
-
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */
|
|
4730
|
-
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */
|
|
4731
|
-
return /* @__PURE__ */
|
|
4667
|
+
if (lowerKey.includes("follower")) return /* @__PURE__ */ jsx26(Users2, { className: iconClass });
|
|
4668
|
+
if (lowerKey.includes("following")) return /* @__PURE__ */ jsx26(UserPlus, { className: iconClass });
|
|
4669
|
+
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ jsx26(Image3, { className: iconClass });
|
|
4670
|
+
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ jsx26(BadgeCheck, { className: iconClass });
|
|
4671
|
+
if (lowerKey.includes("bio")) return /* @__PURE__ */ jsx26(FileText2, { className: iconClass });
|
|
4672
|
+
if (lowerKey.includes("email")) return /* @__PURE__ */ jsx26(Mail, { className: iconClass });
|
|
4673
|
+
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ jsx26(Phone, { className: iconClass });
|
|
4674
|
+
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ jsx26(MapPin, { className: iconClass });
|
|
4675
|
+
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ jsx26(Building, { className: iconClass });
|
|
4676
|
+
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ jsx26(Briefcase, { className: iconClass });
|
|
4677
|
+
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ jsx26(Globe, { className: iconClass });
|
|
4678
|
+
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ jsx26(AtSign2, { className: iconClass });
|
|
4679
|
+
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ jsx26(Calendar, { className: iconClass });
|
|
4680
|
+
return /* @__PURE__ */ jsx26(User2, { className: iconClass });
|
|
4732
4681
|
};
|
|
4733
4682
|
var formatValue = (value, type, key) => {
|
|
4734
4683
|
if (value === null || value === void 0) return "-";
|
|
@@ -4762,15 +4711,15 @@ var getMemoryCategoryIcon = (category) => {
|
|
|
4762
4711
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
4763
4712
|
switch (category) {
|
|
4764
4713
|
case "preference":
|
|
4765
|
-
return /* @__PURE__ */
|
|
4714
|
+
return /* @__PURE__ */ jsx26(Heart, { className: iconClass });
|
|
4766
4715
|
case "fact":
|
|
4767
|
-
return /* @__PURE__ */
|
|
4716
|
+
return /* @__PURE__ */ jsx26(Info, { className: iconClass });
|
|
4768
4717
|
case "goal":
|
|
4769
|
-
return /* @__PURE__ */
|
|
4718
|
+
return /* @__PURE__ */ jsx26(Target, { className: iconClass });
|
|
4770
4719
|
case "context":
|
|
4771
|
-
return /* @__PURE__ */
|
|
4720
|
+
return /* @__PURE__ */ jsx26(Lightbulb, { className: iconClass });
|
|
4772
4721
|
default:
|
|
4773
|
-
return /* @__PURE__ */
|
|
4722
|
+
return /* @__PURE__ */ jsx26(Brain2, { className: iconClass });
|
|
4774
4723
|
}
|
|
4775
4724
|
};
|
|
4776
4725
|
var getMemoryCategoryLabel = (category) => {
|
|
@@ -4801,10 +4750,10 @@ var UserProfile = ({
|
|
|
4801
4750
|
onDeleteMemory,
|
|
4802
4751
|
className
|
|
4803
4752
|
}) => {
|
|
4804
|
-
const [newMemoryContent, setNewMemoryContent] =
|
|
4805
|
-
const [isAddingMemory, setIsAddingMemory] =
|
|
4806
|
-
const [editingMemoryId, setEditingMemoryId] =
|
|
4807
|
-
const [editingMemoryContent, setEditingMemoryContent] =
|
|
4753
|
+
const [newMemoryContent, setNewMemoryContent] = useState8("");
|
|
4754
|
+
const [isAddingMemory, setIsAddingMemory] = useState8(false);
|
|
4755
|
+
const [editingMemoryId, setEditingMemoryId] = useState8(null);
|
|
4756
|
+
const [editingMemoryContent, setEditingMemoryContent] = useState8("");
|
|
4808
4757
|
const handleAddMemory = () => {
|
|
4809
4758
|
if (newMemoryContent.trim() && onAddMemory) {
|
|
4810
4759
|
onAddMemory(newMemoryContent.trim(), "other");
|
|
@@ -4840,66 +4789,66 @@ var UserProfile = ({
|
|
|
4840
4789
|
const displayName = user?.name || user?.email?.split("@")[0] || "User";
|
|
4841
4790
|
const initials = getInitials2(user?.name, user?.email);
|
|
4842
4791
|
const normalizedFields = normalizeCustomFields(customFields);
|
|
4843
|
-
return /* @__PURE__ */
|
|
4792
|
+
return /* @__PURE__ */ jsx26(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs16(
|
|
4844
4793
|
SheetContent,
|
|
4845
4794
|
{
|
|
4846
4795
|
side: "right",
|
|
4847
4796
|
className: cn("w-full sm:max-w-md p-0 flex flex-col h-full overflow-hidden", className),
|
|
4848
4797
|
children: [
|
|
4849
|
-
/* @__PURE__ */
|
|
4850
|
-
/* @__PURE__ */
|
|
4851
|
-
/* @__PURE__ */
|
|
4852
|
-
/* @__PURE__ */
|
|
4853
|
-
user?.avatar && /* @__PURE__ */
|
|
4854
|
-
/* @__PURE__ */
|
|
4798
|
+
/* @__PURE__ */ jsx26(SheetHeader, { className: "px-6 py-4 border-b shrink-0", children: /* @__PURE__ */ jsx26("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx26(SheetTitle, { children: labels.title }) }) }),
|
|
4799
|
+
/* @__PURE__ */ jsx26(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs16("div", { className: "p-6 space-y-6", children: [
|
|
4800
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col items-center text-center space-y-4", children: [
|
|
4801
|
+
/* @__PURE__ */ jsxs16(Avatar, { className: "h-24 w-24 shrink-0", children: [
|
|
4802
|
+
user?.avatar && /* @__PURE__ */ jsx26(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
4803
|
+
/* @__PURE__ */ jsx26(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
|
|
4855
4804
|
] }),
|
|
4856
|
-
/* @__PURE__ */
|
|
4857
|
-
/* @__PURE__ */
|
|
4858
|
-
user?.email && /* @__PURE__ */
|
|
4805
|
+
/* @__PURE__ */ jsxs16("div", { className: "w-full px-2", children: [
|
|
4806
|
+
/* @__PURE__ */ jsx26("h2", { className: "text-xl font-semibold break-words", children: displayName }),
|
|
4807
|
+
user?.email && /* @__PURE__ */ jsx26("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
|
|
4859
4808
|
] })
|
|
4860
4809
|
] }),
|
|
4861
|
-
/* @__PURE__ */
|
|
4862
|
-
/* @__PURE__ */
|
|
4863
|
-
/* @__PURE__ */
|
|
4864
|
-
/* @__PURE__ */
|
|
4865
|
-
/* @__PURE__ */
|
|
4866
|
-
/* @__PURE__ */
|
|
4867
|
-
/* @__PURE__ */
|
|
4868
|
-
/* @__PURE__ */
|
|
4869
|
-
/* @__PURE__ */
|
|
4810
|
+
/* @__PURE__ */ jsx26(Separator, {}),
|
|
4811
|
+
/* @__PURE__ */ jsxs16("div", { className: "space-y-3", children: [
|
|
4812
|
+
/* @__PURE__ */ jsx26("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
|
|
4813
|
+
/* @__PURE__ */ jsxs16("div", { className: "space-y-2", children: [
|
|
4814
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
4815
|
+
/* @__PURE__ */ jsx26(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
4816
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
|
|
4817
|
+
/* @__PURE__ */ jsx26("p", { className: "text-xs text-muted-foreground", children: "Name" }),
|
|
4818
|
+
/* @__PURE__ */ jsx26("p", { className: "text-sm font-medium break-words", children: displayName })
|
|
4870
4819
|
] })
|
|
4871
4820
|
] }),
|
|
4872
|
-
user?.email && /* @__PURE__ */
|
|
4873
|
-
/* @__PURE__ */
|
|
4874
|
-
/* @__PURE__ */
|
|
4875
|
-
/* @__PURE__ */
|
|
4876
|
-
/* @__PURE__ */
|
|
4821
|
+
user?.email && /* @__PURE__ */ jsxs16("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
4822
|
+
/* @__PURE__ */ jsx26(AtSign2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
4823
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
|
|
4824
|
+
/* @__PURE__ */ jsx26("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
|
|
4825
|
+
/* @__PURE__ */ jsx26("p", { className: "text-sm font-medium break-words", children: user.email })
|
|
4877
4826
|
] })
|
|
4878
4827
|
] }),
|
|
4879
|
-
user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */
|
|
4880
|
-
/* @__PURE__ */
|
|
4881
|
-
/* @__PURE__ */
|
|
4882
|
-
/* @__PURE__ */
|
|
4883
|
-
/* @__PURE__ */
|
|
4828
|
+
user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ jsxs16("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
4829
|
+
/* @__PURE__ */ jsx26(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
4830
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
|
|
4831
|
+
/* @__PURE__ */ jsx26("p", { className: "text-xs text-muted-foreground", children: "ID" }),
|
|
4832
|
+
/* @__PURE__ */ jsx26("p", { className: "text-sm font-medium break-words", children: user.id })
|
|
4884
4833
|
] })
|
|
4885
4834
|
] })
|
|
4886
4835
|
] })
|
|
4887
4836
|
] }),
|
|
4888
|
-
normalizedFields.length > 0 && /* @__PURE__ */
|
|
4889
|
-
/* @__PURE__ */
|
|
4890
|
-
/* @__PURE__ */
|
|
4891
|
-
/* @__PURE__ */
|
|
4892
|
-
/* @__PURE__ */
|
|
4837
|
+
normalizedFields.length > 0 && /* @__PURE__ */ jsxs16(Fragment6, { children: [
|
|
4838
|
+
/* @__PURE__ */ jsx26(Separator, {}),
|
|
4839
|
+
/* @__PURE__ */ jsxs16("div", { className: "space-y-3", children: [
|
|
4840
|
+
/* @__PURE__ */ jsx26("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
|
|
4841
|
+
/* @__PURE__ */ jsx26("div", { className: "space-y-2", children: normalizedFields.map((field) => {
|
|
4893
4842
|
const isBioField = field.key.toLowerCase().includes("bio");
|
|
4894
|
-
return /* @__PURE__ */
|
|
4843
|
+
return /* @__PURE__ */ jsxs16(
|
|
4895
4844
|
"div",
|
|
4896
4845
|
{
|
|
4897
4846
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50",
|
|
4898
4847
|
children: [
|
|
4899
|
-
/* @__PURE__ */
|
|
4900
|
-
/* @__PURE__ */
|
|
4901
|
-
/* @__PURE__ */
|
|
4902
|
-
/* @__PURE__ */
|
|
4848
|
+
/* @__PURE__ */ jsx26("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
|
|
4849
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
|
|
4850
|
+
/* @__PURE__ */ jsx26("p", { className: "text-xs text-muted-foreground", children: field.label }),
|
|
4851
|
+
/* @__PURE__ */ jsx26("p", { className: cn(
|
|
4903
4852
|
"text-sm font-medium",
|
|
4904
4853
|
isBioField ? "whitespace-pre-wrap break-words" : "break-words"
|
|
4905
4854
|
), children: formatValue(field.value, field.type, field.key) })
|
|
@@ -4911,26 +4860,26 @@ var UserProfile = ({
|
|
|
4911
4860
|
}) })
|
|
4912
4861
|
] })
|
|
4913
4862
|
] }),
|
|
4914
|
-
/* @__PURE__ */
|
|
4915
|
-
/* @__PURE__ */
|
|
4916
|
-
/* @__PURE__ */
|
|
4917
|
-
/* @__PURE__ */
|
|
4918
|
-
/* @__PURE__ */
|
|
4863
|
+
/* @__PURE__ */ jsx26(Separator, {}),
|
|
4864
|
+
/* @__PURE__ */ jsxs16("div", { className: "space-y-3", children: [
|
|
4865
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between", children: [
|
|
4866
|
+
/* @__PURE__ */ jsxs16("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2", children: [
|
|
4867
|
+
/* @__PURE__ */ jsx26(Brain2, { className: "h-4 w-4" }),
|
|
4919
4868
|
labels.memories
|
|
4920
4869
|
] }),
|
|
4921
|
-
onAddMemory && /* @__PURE__ */
|
|
4870
|
+
onAddMemory && /* @__PURE__ */ jsx26(
|
|
4922
4871
|
Button,
|
|
4923
4872
|
{
|
|
4924
4873
|
variant: "ghost",
|
|
4925
4874
|
size: "sm",
|
|
4926
4875
|
className: "h-7 px-2",
|
|
4927
4876
|
onClick: () => setIsAddingMemory(true),
|
|
4928
|
-
children: /* @__PURE__ */
|
|
4877
|
+
children: /* @__PURE__ */ jsx26(Plus3, { className: "h-4 w-4" })
|
|
4929
4878
|
}
|
|
4930
4879
|
)
|
|
4931
4880
|
] }),
|
|
4932
|
-
isAddingMemory && onAddMemory && /* @__PURE__ */
|
|
4933
|
-
/* @__PURE__ */
|
|
4881
|
+
isAddingMemory && onAddMemory && /* @__PURE__ */ jsxs16("div", { className: "flex gap-2", children: [
|
|
4882
|
+
/* @__PURE__ */ jsx26(
|
|
4934
4883
|
Input,
|
|
4935
4884
|
{
|
|
4936
4885
|
value: newMemoryContent,
|
|
@@ -4947,24 +4896,24 @@ var UserProfile = ({
|
|
|
4947
4896
|
autoFocus: true
|
|
4948
4897
|
}
|
|
4949
4898
|
),
|
|
4950
|
-
/* @__PURE__ */
|
|
4899
|
+
/* @__PURE__ */ jsx26(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
|
|
4951
4900
|
] }),
|
|
4952
|
-
/* @__PURE__ */
|
|
4901
|
+
/* @__PURE__ */ jsx26("div", { className: "space-y-2", children: memories.length === 0 ? /* @__PURE__ */ jsx26("p", { className: "text-sm text-muted-foreground text-center py-4", children: labels.noMemories }) : memories.map((memory) => {
|
|
4953
4902
|
const isEditing = editingMemoryId === memory.id;
|
|
4954
|
-
return /* @__PURE__ */
|
|
4903
|
+
return /* @__PURE__ */ jsxs16(
|
|
4955
4904
|
"div",
|
|
4956
4905
|
{
|
|
4957
4906
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50 group",
|
|
4958
4907
|
children: [
|
|
4959
|
-
/* @__PURE__ */
|
|
4960
|
-
/* @__PURE__ */
|
|
4961
|
-
/* @__PURE__ */
|
|
4962
|
-
/* @__PURE__ */
|
|
4963
|
-
/* @__PURE__ */
|
|
4964
|
-
/* @__PURE__ */
|
|
4908
|
+
/* @__PURE__ */ jsx26("div", { className: "mt-0.5 shrink-0", children: memory.source === "agent" ? /* @__PURE__ */ jsx26(Bot3, { className: "h-4 w-4 text-primary" }) : getMemoryCategoryIcon(memory.category) }),
|
|
4909
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0", children: [
|
|
4910
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 mb-0.5", children: [
|
|
4911
|
+
/* @__PURE__ */ jsx26("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
|
|
4912
|
+
/* @__PURE__ */ jsx26("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
|
|
4913
|
+
/* @__PURE__ */ jsx26("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
|
|
4965
4914
|
] }),
|
|
4966
|
-
isEditing ? /* @__PURE__ */
|
|
4967
|
-
/* @__PURE__ */
|
|
4915
|
+
isEditing ? /* @__PURE__ */ jsxs16("div", { className: "space-y-2", children: [
|
|
4916
|
+
/* @__PURE__ */ jsx26(
|
|
4968
4917
|
Textarea,
|
|
4969
4918
|
{
|
|
4970
4919
|
value: editingMemoryContent,
|
|
@@ -4981,8 +4930,8 @@ var UserProfile = ({
|
|
|
4981
4930
|
}
|
|
4982
4931
|
}
|
|
4983
4932
|
),
|
|
4984
|
-
/* @__PURE__ */
|
|
4985
|
-
/* @__PURE__ */
|
|
4933
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex gap-1 justify-end", children: [
|
|
4934
|
+
/* @__PURE__ */ jsxs16(
|
|
4986
4935
|
Button,
|
|
4987
4936
|
{
|
|
4988
4937
|
variant: "ghost",
|
|
@@ -4990,12 +4939,12 @@ var UserProfile = ({
|
|
|
4990
4939
|
className: "h-7 px-2",
|
|
4991
4940
|
onClick: handleCancelEdit,
|
|
4992
4941
|
children: [
|
|
4993
|
-
/* @__PURE__ */
|
|
4942
|
+
/* @__PURE__ */ jsx26(X5, { className: "h-3.5 w-3.5 mr-1" }),
|
|
4994
4943
|
"Cancelar"
|
|
4995
4944
|
]
|
|
4996
4945
|
}
|
|
4997
4946
|
),
|
|
4998
|
-
/* @__PURE__ */
|
|
4947
|
+
/* @__PURE__ */ jsxs16(
|
|
4999
4948
|
Button,
|
|
5000
4949
|
{
|
|
5001
4950
|
size: "sm",
|
|
@@ -5003,33 +4952,33 @@ var UserProfile = ({
|
|
|
5003
4952
|
onClick: handleSaveEdit,
|
|
5004
4953
|
disabled: !editingMemoryContent.trim(),
|
|
5005
4954
|
children: [
|
|
5006
|
-
/* @__PURE__ */
|
|
4955
|
+
/* @__PURE__ */ jsx26(Check4, { className: "h-3.5 w-3.5 mr-1" }),
|
|
5007
4956
|
"Salvar"
|
|
5008
4957
|
]
|
|
5009
4958
|
}
|
|
5010
4959
|
)
|
|
5011
4960
|
] })
|
|
5012
|
-
] }) : /* @__PURE__ */
|
|
4961
|
+
] }) : /* @__PURE__ */ jsx26("p", { className: "text-sm break-words", children: memory.content })
|
|
5013
4962
|
] }),
|
|
5014
|
-
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */
|
|
5015
|
-
onUpdateMemory && /* @__PURE__ */
|
|
4963
|
+
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ jsxs16("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
|
|
4964
|
+
onUpdateMemory && /* @__PURE__ */ jsx26(
|
|
5016
4965
|
Button,
|
|
5017
4966
|
{
|
|
5018
4967
|
variant: "ghost",
|
|
5019
4968
|
size: "icon",
|
|
5020
4969
|
className: "h-7 w-7",
|
|
5021
4970
|
onClick: () => handleStartEdit(memory),
|
|
5022
|
-
children: /* @__PURE__ */
|
|
4971
|
+
children: /* @__PURE__ */ jsx26(Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
5023
4972
|
}
|
|
5024
4973
|
),
|
|
5025
|
-
onDeleteMemory && /* @__PURE__ */
|
|
4974
|
+
onDeleteMemory && /* @__PURE__ */ jsx26(
|
|
5026
4975
|
Button,
|
|
5027
4976
|
{
|
|
5028
4977
|
variant: "ghost",
|
|
5029
4978
|
size: "icon",
|
|
5030
4979
|
className: "h-7 w-7",
|
|
5031
4980
|
onClick: () => onDeleteMemory(memory.id),
|
|
5032
|
-
children: /* @__PURE__ */
|
|
4981
|
+
children: /* @__PURE__ */ jsx26(Trash24, { className: "h-3.5 w-3.5 text-destructive" })
|
|
5033
4982
|
}
|
|
5034
4983
|
)
|
|
5035
4984
|
] })
|
|
@@ -5040,8 +4989,8 @@ var UserProfile = ({
|
|
|
5040
4989
|
}) })
|
|
5041
4990
|
] })
|
|
5042
4991
|
] }) }),
|
|
5043
|
-
/* @__PURE__ */
|
|
5044
|
-
onEditProfile && /* @__PURE__ */
|
|
4992
|
+
/* @__PURE__ */ jsxs16("div", { className: "p-4 border-t space-y-2 shrink-0", children: [
|
|
4993
|
+
onEditProfile && /* @__PURE__ */ jsx26(
|
|
5045
4994
|
Button,
|
|
5046
4995
|
{
|
|
5047
4996
|
variant: "outline",
|
|
@@ -5050,7 +4999,7 @@ var UserProfile = ({
|
|
|
5050
4999
|
children: "Edit Profile"
|
|
5051
5000
|
}
|
|
5052
5001
|
),
|
|
5053
|
-
onLogout && /* @__PURE__ */
|
|
5002
|
+
onLogout && /* @__PURE__ */ jsx26(
|
|
5054
5003
|
Button,
|
|
5055
5004
|
{
|
|
5056
5005
|
variant: "destructive",
|
|
@@ -5066,8 +5015,8 @@ var UserProfile = ({
|
|
|
5066
5015
|
};
|
|
5067
5016
|
|
|
5068
5017
|
// src/components/chat/ChatUI.tsx
|
|
5069
|
-
import { Sparkles, ArrowRight, MessageSquare, Lightbulb as Lightbulb2, Zap, HelpCircle } from "lucide-react";
|
|
5070
|
-
import { jsx as
|
|
5018
|
+
import { Sparkles as Sparkles2, ArrowRight, MessageSquare, Lightbulb as Lightbulb2, Zap, HelpCircle } from "lucide-react";
|
|
5019
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5071
5020
|
function getMessageSpeakerKey(message) {
|
|
5072
5021
|
if (!message) return null;
|
|
5073
5022
|
if (message.role === "assistant") {
|
|
@@ -5078,6 +5027,81 @@ function getMessageSpeakerKey(message) {
|
|
|
5078
5027
|
}
|
|
5079
5028
|
return message.role;
|
|
5080
5029
|
}
|
|
5030
|
+
var mergeToolCalls = (activities) => {
|
|
5031
|
+
const merged = /* @__PURE__ */ new Map();
|
|
5032
|
+
for (const activity of activities) {
|
|
5033
|
+
if (!Array.isArray(activity.toolCalls)) continue;
|
|
5034
|
+
for (const toolCall of activity.toolCalls) {
|
|
5035
|
+
const key = toolCall.id || `${toolCall.name}:${JSON.stringify(toolCall.arguments ?? {})}`;
|
|
5036
|
+
merged.set(key, toolCall);
|
|
5037
|
+
}
|
|
5038
|
+
}
|
|
5039
|
+
return merged.size > 0 ? Array.from(merged.values()) : void 0;
|
|
5040
|
+
};
|
|
5041
|
+
var mergeReasoning = (activities) => {
|
|
5042
|
+
const segments = activities.map((activity) => activity.reasoning?.trim()).filter((value) => Boolean(value));
|
|
5043
|
+
if (segments.length === 0) return void 0;
|
|
5044
|
+
return segments.filter((segment, index) => index === 0 || segment !== segments[index - 1]).join("\n\n");
|
|
5045
|
+
};
|
|
5046
|
+
var mergeGroupActivity = (messages) => {
|
|
5047
|
+
const activities = messages.map((message) => message.activity).filter((activity) => Boolean(activity));
|
|
5048
|
+
if (activities.length === 0) return void 0;
|
|
5049
|
+
const lastActivity = activities[activities.length - 1];
|
|
5050
|
+
const mergedReasoning = mergeReasoning(activities);
|
|
5051
|
+
const mergedToolCalls = mergeToolCalls(activities);
|
|
5052
|
+
return {
|
|
5053
|
+
...lastActivity,
|
|
5054
|
+
...mergedReasoning ? { reasoning: mergedReasoning } : {},
|
|
5055
|
+
...mergedToolCalls ? { toolCalls: mergedToolCalls } : {}
|
|
5056
|
+
};
|
|
5057
|
+
};
|
|
5058
|
+
var mergeMessageGroup = (messages) => {
|
|
5059
|
+
const firstMessage = messages[0];
|
|
5060
|
+
const lastMessage = messages[messages.length - 1];
|
|
5061
|
+
const content = messages.map((message) => message.content.trim()).filter((value) => value.length > 0).join("\n\n");
|
|
5062
|
+
const attachments = messages.flatMap((message) => message.attachments ?? []);
|
|
5063
|
+
return {
|
|
5064
|
+
...lastMessage,
|
|
5065
|
+
id: lastMessage.id,
|
|
5066
|
+
content,
|
|
5067
|
+
timestamp: firstMessage.timestamp,
|
|
5068
|
+
attachments: attachments.length > 0 ? attachments : void 0,
|
|
5069
|
+
isStreaming: lastMessage.isStreaming,
|
|
5070
|
+
isComplete: lastMessage.isComplete,
|
|
5071
|
+
isEdited: messages.some((message) => message.isEdited),
|
|
5072
|
+
originalContent: void 0,
|
|
5073
|
+
editedAt: lastMessage.editedAt,
|
|
5074
|
+
activity: mergeGroupActivity(messages),
|
|
5075
|
+
senderName: lastMessage.senderName ?? firstMessage.senderName,
|
|
5076
|
+
senderAgentId: lastMessage.senderAgentId ?? firstMessage.senderAgentId,
|
|
5077
|
+
metadata: lastMessage.metadata
|
|
5078
|
+
};
|
|
5079
|
+
};
|
|
5080
|
+
var groupMessagesForRender = (messages) => {
|
|
5081
|
+
if (messages.length === 0) return [];
|
|
5082
|
+
const groups = [];
|
|
5083
|
+
let currentGroup = [messages[0]];
|
|
5084
|
+
const flushGroup = () => {
|
|
5085
|
+
const mergedMessage = mergeMessageGroup(currentGroup);
|
|
5086
|
+
groups.push({
|
|
5087
|
+
id: mergedMessage.id,
|
|
5088
|
+
message: mergedMessage,
|
|
5089
|
+
suggestionMessageId: currentGroup[currentGroup.length - 1].id
|
|
5090
|
+
});
|
|
5091
|
+
};
|
|
5092
|
+
for (let index = 1; index < messages.length; index++) {
|
|
5093
|
+
const previous = currentGroup[currentGroup.length - 1];
|
|
5094
|
+
const next = messages[index];
|
|
5095
|
+
if (previous.role === next.role && getMessageSpeakerKey(previous) === getMessageSpeakerKey(next)) {
|
|
5096
|
+
currentGroup.push(next);
|
|
5097
|
+
continue;
|
|
5098
|
+
}
|
|
5099
|
+
flushGroup();
|
|
5100
|
+
currentGroup = [next];
|
|
5101
|
+
}
|
|
5102
|
+
flushGroup();
|
|
5103
|
+
return groups;
|
|
5104
|
+
};
|
|
5081
5105
|
var ChatUI = ({
|
|
5082
5106
|
messages = [],
|
|
5083
5107
|
threads = [],
|
|
@@ -5108,12 +5132,12 @@ var ChatUI = ({
|
|
|
5108
5132
|
initialInput,
|
|
5109
5133
|
onInitialInputConsumed
|
|
5110
5134
|
}) => {
|
|
5111
|
-
const config =
|
|
5135
|
+
const config = useMemo6(
|
|
5112
5136
|
() => mergeConfig(defaultChatConfig, userConfig),
|
|
5113
5137
|
[userConfig]
|
|
5114
5138
|
);
|
|
5115
|
-
const [isMobile, setIsMobile] =
|
|
5116
|
-
const [isUserProfileOpen, setIsUserProfileOpen] =
|
|
5139
|
+
const [isMobile, setIsMobile] = useState9(false);
|
|
5140
|
+
const [isUserProfileOpen, setIsUserProfileOpen] = useState9(false);
|
|
5117
5141
|
let userContext;
|
|
5118
5142
|
try {
|
|
5119
5143
|
const contextValue = useChatUserContext();
|
|
@@ -5127,10 +5151,10 @@ var ChatUI = ({
|
|
|
5127
5151
|
}
|
|
5128
5152
|
return false;
|
|
5129
5153
|
};
|
|
5130
|
-
const [inputValue, setInputValue] =
|
|
5131
|
-
const [attachments, setAttachments] =
|
|
5132
|
-
const [expandedMessageIds, setExpandedMessageIds] =
|
|
5133
|
-
const [state, setState] =
|
|
5154
|
+
const [inputValue, setInputValue] = useState9("");
|
|
5155
|
+
const [attachments, setAttachments] = useState9([]);
|
|
5156
|
+
const [expandedMessageIds, setExpandedMessageIds] = useState9({});
|
|
5157
|
+
const [state, setState] = useState9({
|
|
5134
5158
|
isRecording: false,
|
|
5135
5159
|
selectedThreadId: currentThreadId,
|
|
5136
5160
|
isAtBottom: true,
|
|
@@ -5142,14 +5166,14 @@ var ChatUI = ({
|
|
|
5142
5166
|
isSidebarCollapsed: false
|
|
5143
5167
|
// No longer used for main sidebar
|
|
5144
5168
|
});
|
|
5145
|
-
|
|
5169
|
+
useEffect11(() => {
|
|
5146
5170
|
if (currentThreadId !== state.selectedThreadId) {
|
|
5147
5171
|
setState((prev) => ({ ...prev, selectedThreadId: currentThreadId }));
|
|
5148
5172
|
}
|
|
5149
5173
|
}, [currentThreadId]);
|
|
5150
5174
|
const initialInputApplied = useRef6(false);
|
|
5151
5175
|
const initialInputConsumedRef = useRef6(false);
|
|
5152
|
-
|
|
5176
|
+
useEffect11(() => {
|
|
5153
5177
|
if (initialInput && !initialInputApplied.current) {
|
|
5154
5178
|
setInputValue(initialInput);
|
|
5155
5179
|
initialInputApplied.current = true;
|
|
@@ -5160,19 +5184,20 @@ var ChatUI = ({
|
|
|
5160
5184
|
const stateRef = useRef6(state);
|
|
5161
5185
|
const inputValueRef = useRef6(inputValue);
|
|
5162
5186
|
const attachmentsRef = useRef6(attachments);
|
|
5163
|
-
|
|
5187
|
+
useEffect11(() => {
|
|
5164
5188
|
stateRef.current = state;
|
|
5165
5189
|
}, [state]);
|
|
5166
|
-
|
|
5190
|
+
useEffect11(() => {
|
|
5167
5191
|
inputValueRef.current = inputValue;
|
|
5168
5192
|
}, [inputValue]);
|
|
5169
|
-
|
|
5193
|
+
useEffect11(() => {
|
|
5170
5194
|
attachmentsRef.current = attachments;
|
|
5171
5195
|
}, [attachments]);
|
|
5172
|
-
const [isCustomMounted, setIsCustomMounted] =
|
|
5173
|
-
const [isCustomVisible, setIsCustomVisible] =
|
|
5196
|
+
const [isCustomMounted, setIsCustomMounted] = useState9(false);
|
|
5197
|
+
const [isCustomVisible, setIsCustomVisible] = useState9(false);
|
|
5198
|
+
const groupedMessages = useMemo6(() => groupMessagesForRender(messages), [messages]);
|
|
5174
5199
|
const virtualizer = useVirtualizer({
|
|
5175
|
-
count:
|
|
5200
|
+
count: groupedMessages.length,
|
|
5176
5201
|
getScrollElement: () => scrollAreaRef.current,
|
|
5177
5202
|
estimateSize: () => 100,
|
|
5178
5203
|
overscan: 5
|
|
@@ -5189,7 +5214,7 @@ var ChatUI = ({
|
|
|
5189
5214
|
[]
|
|
5190
5215
|
// No dependencies - uses refs for latest state
|
|
5191
5216
|
);
|
|
5192
|
-
|
|
5217
|
+
useEffect11(() => {
|
|
5193
5218
|
const checkMobile = () => {
|
|
5194
5219
|
setIsMobile(globalThis.innerWidth < 1024);
|
|
5195
5220
|
};
|
|
@@ -5197,7 +5222,7 @@ var ChatUI = ({
|
|
|
5197
5222
|
globalThis.addEventListener("resize", checkMobile);
|
|
5198
5223
|
return () => globalThis.removeEventListener("resize", checkMobile);
|
|
5199
5224
|
}, []);
|
|
5200
|
-
|
|
5225
|
+
useEffect11(() => {
|
|
5201
5226
|
if (!isMobile || !config.customComponent?.component) return;
|
|
5202
5227
|
if (state.showSidebar) {
|
|
5203
5228
|
setIsCustomMounted(true);
|
|
@@ -5209,21 +5234,21 @@ var ChatUI = ({
|
|
|
5209
5234
|
}
|
|
5210
5235
|
}, [state.showSidebar, isMobile, config.customComponent]);
|
|
5211
5236
|
const prevMessageCountRef = useRef6(0);
|
|
5212
|
-
|
|
5213
|
-
if (
|
|
5237
|
+
useEffect11(() => {
|
|
5238
|
+
if (groupedMessages.length === 0) {
|
|
5214
5239
|
prevMessageCountRef.current = 0;
|
|
5215
5240
|
return;
|
|
5216
5241
|
}
|
|
5217
5242
|
if (prependSnapshotRef.current) {
|
|
5218
|
-
prevMessageCountRef.current =
|
|
5243
|
+
prevMessageCountRef.current = groupedMessages.length;
|
|
5219
5244
|
return;
|
|
5220
5245
|
}
|
|
5221
5246
|
const wasEmpty = prevMessageCountRef.current === 0;
|
|
5222
|
-
prevMessageCountRef.current =
|
|
5247
|
+
prevMessageCountRef.current = groupedMessages.length;
|
|
5223
5248
|
if (wasEmpty) {
|
|
5224
5249
|
requestAnimationFrame(() => {
|
|
5225
5250
|
requestAnimationFrame(() => {
|
|
5226
|
-
virtualizer.scrollToIndex(
|
|
5251
|
+
virtualizer.scrollToIndex(groupedMessages.length - 1, { align: "end" });
|
|
5227
5252
|
});
|
|
5228
5253
|
});
|
|
5229
5254
|
return;
|
|
@@ -5238,23 +5263,23 @@ var ChatUI = ({
|
|
|
5238
5263
|
viewport.scrollTop = viewport.scrollHeight;
|
|
5239
5264
|
}
|
|
5240
5265
|
});
|
|
5241
|
-
}, [
|
|
5242
|
-
|
|
5266
|
+
}, [groupedMessages, state.isAtBottom, virtualizer]);
|
|
5267
|
+
useEffect11(() => {
|
|
5243
5268
|
virtualizer.measure();
|
|
5244
5269
|
}, [expandedMessageIds, virtualizer]);
|
|
5245
|
-
|
|
5270
|
+
useEffect11(() => {
|
|
5246
5271
|
prependSnapshotRef.current = null;
|
|
5247
5272
|
}, [currentThreadId]);
|
|
5248
|
-
|
|
5273
|
+
useEffect11(() => {
|
|
5249
5274
|
const snapshot = prependSnapshotRef.current;
|
|
5250
5275
|
if (!snapshot) return;
|
|
5251
|
-
if (
|
|
5276
|
+
if (groupedMessages.length <= snapshot.messageCount) {
|
|
5252
5277
|
if (!isLoadingOlderMessages) {
|
|
5253
5278
|
prependSnapshotRef.current = null;
|
|
5254
5279
|
}
|
|
5255
5280
|
return;
|
|
5256
5281
|
}
|
|
5257
|
-
if ((
|
|
5282
|
+
if ((groupedMessages[0]?.id ?? null) === snapshot.firstMessageId) {
|
|
5258
5283
|
if (!isLoadingOlderMessages) {
|
|
5259
5284
|
prependSnapshotRef.current = null;
|
|
5260
5285
|
}
|
|
@@ -5270,20 +5295,20 @@ var ChatUI = ({
|
|
|
5270
5295
|
prependSnapshotRef.current = null;
|
|
5271
5296
|
});
|
|
5272
5297
|
});
|
|
5273
|
-
}, [
|
|
5298
|
+
}, [groupedMessages, isLoadingOlderMessages, virtualizer]);
|
|
5274
5299
|
const requestOlderMessages = useCallback4(() => {
|
|
5275
5300
|
if (!onLoadOlderMessages || !hasMoreMessagesBefore || isLoadingOlderMessages) return;
|
|
5276
5301
|
const viewport = scrollAreaRef.current;
|
|
5277
5302
|
prependSnapshotRef.current = viewport ? {
|
|
5278
5303
|
scrollHeight: viewport.scrollHeight,
|
|
5279
5304
|
scrollTop: viewport.scrollTop,
|
|
5280
|
-
firstMessageId:
|
|
5281
|
-
messageCount:
|
|
5305
|
+
firstMessageId: groupedMessages[0]?.id ?? null,
|
|
5306
|
+
messageCount: groupedMessages.length
|
|
5282
5307
|
} : null;
|
|
5283
5308
|
onLoadOlderMessages();
|
|
5284
|
-
}, [hasMoreMessagesBefore, isLoadingOlderMessages,
|
|
5285
|
-
|
|
5286
|
-
const validMessageIds = new Set(
|
|
5309
|
+
}, [groupedMessages, hasMoreMessagesBefore, isLoadingOlderMessages, onLoadOlderMessages]);
|
|
5310
|
+
useEffect11(() => {
|
|
5311
|
+
const validMessageIds = new Set(groupedMessages.map((group) => group.id));
|
|
5287
5312
|
setExpandedMessageIds((prev) => {
|
|
5288
5313
|
const activeIds = Object.keys(prev);
|
|
5289
5314
|
const staleIds = activeIds.filter((messageId) => !validMessageIds.has(messageId));
|
|
@@ -5296,7 +5321,7 @@ var ChatUI = ({
|
|
|
5296
5321
|
});
|
|
5297
5322
|
return next;
|
|
5298
5323
|
});
|
|
5299
|
-
}, [
|
|
5324
|
+
}, [groupedMessages]);
|
|
5300
5325
|
const handleScroll = useCallback4((e) => {
|
|
5301
5326
|
const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;
|
|
5302
5327
|
const isAtBottom = scrollHeight - scrollTop - clientHeight < 50;
|
|
@@ -5372,7 +5397,7 @@ var ChatUI = ({
|
|
|
5372
5397
|
const handleCustomComponentToggle = useCallback4(() => {
|
|
5373
5398
|
setState((prev) => ({ ...prev, showSidebar: !prev.showSidebar }));
|
|
5374
5399
|
}, []);
|
|
5375
|
-
const sidebarUser =
|
|
5400
|
+
const sidebarUser = useMemo6(() => user ? {
|
|
5376
5401
|
id: user.id,
|
|
5377
5402
|
name: user.name,
|
|
5378
5403
|
email: user.email,
|
|
@@ -5382,7 +5407,7 @@ var ChatUI = ({
|
|
|
5382
5407
|
setIsUserProfileOpen(true);
|
|
5383
5408
|
callbacks.onViewProfile?.();
|
|
5384
5409
|
}, [callbacks.onViewProfile]);
|
|
5385
|
-
const sidebarUserMenuCallbacks =
|
|
5410
|
+
const sidebarUserMenuCallbacks = useMemo6(() => ({
|
|
5386
5411
|
onViewProfile: handleViewProfile,
|
|
5387
5412
|
onOpenSettings: callbacks.onOpenSettings,
|
|
5388
5413
|
onThemeChange: callbacks.onThemeChange,
|
|
@@ -5398,14 +5423,14 @@ var ChatUI = ({
|
|
|
5398
5423
|
}, [config?.customComponent?.component, closeSidebar, isMobile]);
|
|
5399
5424
|
const SuggestionIconComponents = [MessageSquare, Lightbulb2, Zap, HelpCircle];
|
|
5400
5425
|
const renderSuggestions = () => {
|
|
5401
|
-
if (
|
|
5402
|
-
return /* @__PURE__ */
|
|
5403
|
-
/* @__PURE__ */
|
|
5404
|
-
/* @__PURE__ */
|
|
5405
|
-
/* @__PURE__ */
|
|
5406
|
-
/* @__PURE__ */
|
|
5426
|
+
if (groupedMessages.length > 0 || !suggestions.length) return null;
|
|
5427
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
|
|
5428
|
+
/* @__PURE__ */ jsxs17("div", { className: "text-center mb-8", children: [
|
|
5429
|
+
/* @__PURE__ */ jsx27("div", { className: "inline-flex items-center justify-center w-14 h-14 rounded-2xl bg-gradient-to-br from-primary/20 to-primary/5 mb-4 shadow-sm", children: /* @__PURE__ */ jsx27(Sparkles2, { className: "w-7 h-7 text-primary" }) }),
|
|
5430
|
+
/* @__PURE__ */ jsx27("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
|
|
5431
|
+
/* @__PURE__ */ jsx27("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
|
|
5407
5432
|
] }),
|
|
5408
|
-
/* @__PURE__ */
|
|
5433
|
+
/* @__PURE__ */ jsx27("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-2xl", children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs17(
|
|
5409
5434
|
"button",
|
|
5410
5435
|
{
|
|
5411
5436
|
type: "button",
|
|
@@ -5414,10 +5439,10 @@ var ChatUI = ({
|
|
|
5414
5439
|
children: [
|
|
5415
5440
|
(() => {
|
|
5416
5441
|
const IconComponent = SuggestionIconComponents[index % SuggestionIconComponents.length];
|
|
5417
|
-
return /* @__PURE__ */
|
|
5442
|
+
return /* @__PURE__ */ jsx27("div", { className: "flex items-center justify-center w-8 h-8 rounded-lg bg-primary/10 text-primary shrink-0 group-hover:bg-primary/15 transition-colors", children: /* @__PURE__ */ jsx27(IconComponent, { className: "h-4 w-4" }) });
|
|
5418
5443
|
})(),
|
|
5419
|
-
/* @__PURE__ */
|
|
5420
|
-
/* @__PURE__ */
|
|
5444
|
+
/* @__PURE__ */ jsx27("div", { className: "flex-1 min-w-0 pr-6", children: /* @__PURE__ */ jsx27("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: suggestion }) }),
|
|
5445
|
+
/* @__PURE__ */ jsx27(ArrowRight, { className: "absolute right-4 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity" })
|
|
5421
5446
|
]
|
|
5422
5447
|
},
|
|
5423
5448
|
index
|
|
@@ -5428,41 +5453,41 @@ var ChatUI = ({
|
|
|
5428
5453
|
const items = messageSuggestions?.[messageId];
|
|
5429
5454
|
if (!items || items.length === 0) return null;
|
|
5430
5455
|
const inlineSuggestionOffsetClass = config.ui.showAvatars ? config.ui.compactMode ? "ml-9" : "ml-11" : "";
|
|
5431
|
-
return /* @__PURE__ */
|
|
5456
|
+
return /* @__PURE__ */ jsx27("div", { className: `flex flex-wrap gap-2 mt-2 ${inlineSuggestionOffsetClass}`, children: items.map((suggestion, index) => /* @__PURE__ */ jsxs17(
|
|
5432
5457
|
"button",
|
|
5433
5458
|
{
|
|
5434
5459
|
type: "button",
|
|
5435
5460
|
onClick: () => handleSendMessage(suggestion),
|
|
5436
5461
|
className: "group inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-full border border-border bg-background hover:bg-accent hover:border-accent-foreground/20 transition-all duration-150 text-foreground/80 hover:text-foreground",
|
|
5437
5462
|
children: [
|
|
5438
|
-
/* @__PURE__ */
|
|
5439
|
-
/* @__PURE__ */
|
|
5463
|
+
/* @__PURE__ */ jsx27(Sparkles2, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
|
|
5464
|
+
/* @__PURE__ */ jsx27("span", { className: "max-w-[200px] truncate", children: suggestion })
|
|
5440
5465
|
]
|
|
5441
5466
|
},
|
|
5442
5467
|
`${messageId}-suggestion-${index}`
|
|
5443
5468
|
)) });
|
|
5444
5469
|
};
|
|
5445
|
-
const renderMessageLoadingSkeleton = () => /* @__PURE__ */
|
|
5470
|
+
const renderMessageLoadingSkeleton = () => /* @__PURE__ */ jsx27("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
|
|
5446
5471
|
const isUserRow = index % 2 === 1;
|
|
5447
|
-
return /* @__PURE__ */
|
|
5472
|
+
return /* @__PURE__ */ jsxs17(
|
|
5448
5473
|
"div",
|
|
5449
5474
|
{
|
|
5450
5475
|
className: `flex gap-3 ${isUserRow ? "justify-end" : "justify-start"}`,
|
|
5451
5476
|
children: [
|
|
5452
|
-
!isUserRow && /* @__PURE__ */
|
|
5453
|
-
/* @__PURE__ */
|
|
5454
|
-
/* @__PURE__ */
|
|
5455
|
-
/* @__PURE__ */
|
|
5456
|
-
/* @__PURE__ */
|
|
5477
|
+
!isUserRow && /* @__PURE__ */ jsx27(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" }),
|
|
5478
|
+
/* @__PURE__ */ jsxs17("div", { className: `space-y-2 ${isUserRow ? "w-[70%]" : "w-[75%]"}`, children: [
|
|
5479
|
+
/* @__PURE__ */ jsx27(Skeleton, { className: "h-4 w-24" }),
|
|
5480
|
+
/* @__PURE__ */ jsx27(Skeleton, { className: "h-4 w-full" }),
|
|
5481
|
+
/* @__PURE__ */ jsx27(Skeleton, { className: "h-4 w-[85%]" })
|
|
5457
5482
|
] }),
|
|
5458
|
-
isUserRow && /* @__PURE__ */
|
|
5483
|
+
isUserRow && /* @__PURE__ */ jsx27(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" })
|
|
5459
5484
|
]
|
|
5460
5485
|
},
|
|
5461
5486
|
`message-skeleton-${index}`
|
|
5462
5487
|
);
|
|
5463
5488
|
}) });
|
|
5464
5489
|
const isMultiAgentMode = config.agentSelector?.mode === "multi";
|
|
5465
|
-
const messageProps =
|
|
5490
|
+
const messageProps = useMemo6(() => ({
|
|
5466
5491
|
userAvatar: user?.avatar,
|
|
5467
5492
|
userName: user?.name,
|
|
5468
5493
|
assistantAvatar: assistant?.avatar,
|
|
@@ -5472,11 +5497,10 @@ var ChatUI = ({
|
|
|
5472
5497
|
enableCopy: config.features.enableMessageCopy,
|
|
5473
5498
|
enableEdit: config.features.enableMessageEditing,
|
|
5474
5499
|
enableRegenerate: config.features.enableRegeneration,
|
|
5475
|
-
|
|
5500
|
+
activityDisplay: config.features.activityDisplay,
|
|
5476
5501
|
compactMode: config.ui.compactMode,
|
|
5477
5502
|
onAction: handleMessageAction,
|
|
5478
|
-
|
|
5479
|
-
thinkingLabel: config.labels.thinking,
|
|
5503
|
+
labels: config.labels,
|
|
5480
5504
|
showMoreLabel: config.labels.showMoreMessage,
|
|
5481
5505
|
showLessLabel: config.labels.showLessMessage,
|
|
5482
5506
|
collapseLongMessages: config.ui.collapseLongMessages,
|
|
@@ -5500,9 +5524,8 @@ var ChatUI = ({
|
|
|
5500
5524
|
config.features.enableMessageCopy,
|
|
5501
5525
|
config.features.enableMessageEditing,
|
|
5502
5526
|
config.features.enableRegeneration,
|
|
5503
|
-
config.features.
|
|
5504
|
-
config.labels
|
|
5505
|
-
config.labels.thinking,
|
|
5527
|
+
config.features.activityDisplay,
|
|
5528
|
+
config.labels,
|
|
5506
5529
|
config.labels.showMoreMessage,
|
|
5507
5530
|
config.labels.showLessMessage,
|
|
5508
5531
|
config.ui.collapseLongMessages,
|
|
@@ -5517,8 +5540,8 @@ var ChatUI = ({
|
|
|
5517
5540
|
const shouldShowAgentSelector = Boolean(
|
|
5518
5541
|
config.agentSelector?.enabled && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1) && (isMultiAgentMode ? onParticipantsChange : onSelectAgent)
|
|
5519
5542
|
);
|
|
5520
|
-
return /* @__PURE__ */
|
|
5521
|
-
/* @__PURE__ */
|
|
5543
|
+
return /* @__PURE__ */ jsx27(TooltipProvider, { children: /* @__PURE__ */ jsx27(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ jsxs17("div", { className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`, children: [
|
|
5544
|
+
/* @__PURE__ */ jsx27(
|
|
5522
5545
|
Sidebar2,
|
|
5523
5546
|
{
|
|
5524
5547
|
threads,
|
|
@@ -5535,8 +5558,8 @@ var ChatUI = ({
|
|
|
5535
5558
|
showThemeOptions: !!callbacks.onThemeChange
|
|
5536
5559
|
}
|
|
5537
5560
|
),
|
|
5538
|
-
/* @__PURE__ */
|
|
5539
|
-
/* @__PURE__ */
|
|
5561
|
+
/* @__PURE__ */ jsx27(SidebarInset, { children: /* @__PURE__ */ jsxs17("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
5562
|
+
/* @__PURE__ */ jsx27(
|
|
5540
5563
|
ChatHeader,
|
|
5541
5564
|
{
|
|
5542
5565
|
config,
|
|
@@ -5554,9 +5577,9 @@ var ChatUI = ({
|
|
|
5554
5577
|
onParticipantsChange
|
|
5555
5578
|
}
|
|
5556
5579
|
),
|
|
5557
|
-
/* @__PURE__ */
|
|
5558
|
-
/* @__PURE__ */
|
|
5559
|
-
/* @__PURE__ */
|
|
5580
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
|
|
5581
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 flex flex-col min-h-0", children: [
|
|
5582
|
+
/* @__PURE__ */ jsx27(
|
|
5560
5583
|
ScrollArea,
|
|
5561
5584
|
{
|
|
5562
5585
|
ref: scrollAreaRef,
|
|
@@ -5564,8 +5587,8 @@ var ChatUI = ({
|
|
|
5564
5587
|
viewportClassName: "p-4 overscroll-contain",
|
|
5565
5588
|
onScrollCapture: handleScroll,
|
|
5566
5589
|
style: { contain: "strict" },
|
|
5567
|
-
children: /* @__PURE__ */
|
|
5568
|
-
|
|
5590
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "max-w-4xl mx-auto pb-4", children: [
|
|
5591
|
+
groupedMessages.length > 0 && /* @__PURE__ */ jsx27("div", { className: "flex justify-center py-2", children: isLoadingOlderMessages ? /* @__PURE__ */ jsx27("span", { className: "text-xs text-muted-foreground", children: config.labels.loadingOlderMessages }) : hasMoreMessagesBefore ? /* @__PURE__ */ jsx27(
|
|
5569
5592
|
"button",
|
|
5570
5593
|
{
|
|
5571
5594
|
type: "button",
|
|
@@ -5574,7 +5597,7 @@ var ChatUI = ({
|
|
|
5574
5597
|
children: config.labels.loadOlderMessages
|
|
5575
5598
|
}
|
|
5576
5599
|
) : null }),
|
|
5577
|
-
isMessagesLoading ? renderMessageLoadingSkeleton() :
|
|
5600
|
+
isMessagesLoading ? renderMessageLoadingSkeleton() : groupedMessages.length === 0 ? renderSuggestions() : /* @__PURE__ */ jsx27(
|
|
5578
5601
|
"div",
|
|
5579
5602
|
{
|
|
5580
5603
|
style: {
|
|
@@ -5583,10 +5606,9 @@ var ChatUI = ({
|
|
|
5583
5606
|
position: "relative"
|
|
5584
5607
|
},
|
|
5585
5608
|
children: virtualizer.getVirtualItems().map((virtualRow) => {
|
|
5586
|
-
const
|
|
5587
|
-
const
|
|
5588
|
-
|
|
5589
|
-
return /* @__PURE__ */ jsx26(
|
|
5609
|
+
const group = groupedMessages[virtualRow.index];
|
|
5610
|
+
const message = group.message;
|
|
5611
|
+
return /* @__PURE__ */ jsx27(
|
|
5590
5612
|
"div",
|
|
5591
5613
|
{
|
|
5592
5614
|
"data-index": virtualRow.index,
|
|
@@ -5598,20 +5620,19 @@ var ChatUI = ({
|
|
|
5598
5620
|
width: "100%",
|
|
5599
5621
|
transform: `translateY(${virtualRow.start}px)`
|
|
5600
5622
|
},
|
|
5601
|
-
children: /* @__PURE__ */
|
|
5602
|
-
/* @__PURE__ */
|
|
5623
|
+
children: /* @__PURE__ */ jsxs17("div", { className: virtualRow.index === 0 ? "" : "pt-4", children: [
|
|
5624
|
+
/* @__PURE__ */ jsx27(
|
|
5603
5625
|
Message,
|
|
5604
5626
|
{
|
|
5605
5627
|
message,
|
|
5606
5628
|
...messageProps,
|
|
5607
|
-
isGrouped,
|
|
5608
5629
|
isExpanded: Boolean(expandedMessageIds[message.id])
|
|
5609
5630
|
}
|
|
5610
5631
|
),
|
|
5611
|
-
message.role === "assistant" && renderInlineSuggestions(
|
|
5632
|
+
message.role === "assistant" && renderInlineSuggestions(group.suggestionMessageId)
|
|
5612
5633
|
] })
|
|
5613
5634
|
},
|
|
5614
|
-
|
|
5635
|
+
group.id
|
|
5615
5636
|
);
|
|
5616
5637
|
})
|
|
5617
5638
|
}
|
|
@@ -5619,8 +5640,8 @@ var ChatUI = ({
|
|
|
5619
5640
|
] })
|
|
5620
5641
|
}
|
|
5621
5642
|
),
|
|
5622
|
-
/* @__PURE__ */
|
|
5623
|
-
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */
|
|
5643
|
+
/* @__PURE__ */ jsxs17("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: [
|
|
5644
|
+
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */ jsx27("div", { className: "px-4 pt-1", children: /* @__PURE__ */ jsx27(
|
|
5624
5645
|
TargetAgentSelector,
|
|
5625
5646
|
{
|
|
5626
5647
|
agents: participantIds && participantIds.length > 0 ? agentOptions.filter((a) => participantIds.includes(a.id)) : agentOptions,
|
|
@@ -5630,7 +5651,7 @@ var ChatUI = ({
|
|
|
5630
5651
|
disabled: isGenerating
|
|
5631
5652
|
}
|
|
5632
5653
|
) }),
|
|
5633
|
-
/* @__PURE__ */
|
|
5654
|
+
/* @__PURE__ */ jsx27(
|
|
5634
5655
|
ChatInput,
|
|
5635
5656
|
{
|
|
5636
5657
|
value: inputValue,
|
|
@@ -5659,12 +5680,12 @@ var ChatUI = ({
|
|
|
5659
5680
|
)
|
|
5660
5681
|
] })
|
|
5661
5682
|
] }),
|
|
5662
|
-
config?.customComponent?.component && !isMobile && /* @__PURE__ */
|
|
5683
|
+
config?.customComponent?.component && !isMobile && /* @__PURE__ */ jsx27(
|
|
5663
5684
|
"div",
|
|
5664
5685
|
{
|
|
5665
5686
|
className: "h-full transition-all duration-300 ease-in-out overflow-hidden",
|
|
5666
5687
|
style: { width: state.showSidebar ? config.customComponent.panelWidth ?? 320 : 0 },
|
|
5667
|
-
children: state.showSidebar && /* @__PURE__ */
|
|
5688
|
+
children: state.showSidebar && /* @__PURE__ */ jsx27(
|
|
5668
5689
|
"div",
|
|
5669
5690
|
{
|
|
5670
5691
|
className: "h-full overflow-hidden border-l bg-background animate-in slide-in-from-right-4 duration-300",
|
|
@@ -5676,8 +5697,8 @@ var ChatUI = ({
|
|
|
5676
5697
|
)
|
|
5677
5698
|
] })
|
|
5678
5699
|
] }) }),
|
|
5679
|
-
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */
|
|
5680
|
-
/* @__PURE__ */
|
|
5700
|
+
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ jsxs17("div", { className: "fixed inset-0 z-50", children: [
|
|
5701
|
+
/* @__PURE__ */ jsx27(
|
|
5681
5702
|
"div",
|
|
5682
5703
|
{
|
|
5683
5704
|
className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
|
|
@@ -5685,16 +5706,16 @@ var ChatUI = ({
|
|
|
5685
5706
|
onClick: closeSidebar
|
|
5686
5707
|
}
|
|
5687
5708
|
),
|
|
5688
|
-
/* @__PURE__ */
|
|
5709
|
+
/* @__PURE__ */ jsx27(
|
|
5689
5710
|
"div",
|
|
5690
5711
|
{
|
|
5691
5712
|
className: `absolute top-0 right-0 h-full w-full bg-background transform-gpu transition-transform duration-200 ease-out ${isCustomVisible ? "translate-x-0" : "translate-x-full"}`,
|
|
5692
5713
|
style: { willChange: "transform" },
|
|
5693
|
-
children: /* @__PURE__ */
|
|
5714
|
+
children: /* @__PURE__ */ jsx27("div", { className: "h-full overflow-hidden", children: renderCustomComponent() })
|
|
5694
5715
|
}
|
|
5695
5716
|
)
|
|
5696
5717
|
] }),
|
|
5697
|
-
isUserProfileOpen && /* @__PURE__ */
|
|
5718
|
+
isUserProfileOpen && /* @__PURE__ */ jsx27(
|
|
5698
5719
|
UserProfile,
|
|
5699
5720
|
{
|
|
5700
5721
|
isOpen: isUserProfileOpen,
|
|
@@ -5715,302 +5736,11 @@ var ChatUI = ({
|
|
|
5715
5736
|
)
|
|
5716
5737
|
] }) }) });
|
|
5717
5738
|
};
|
|
5718
|
-
|
|
5719
|
-
// src/components/chat/ThreadManager.tsx
|
|
5720
|
-
import { useState as useState9, useRef as useRef7, useEffect as useEffect11 } from "react";
|
|
5721
|
-
import {
|
|
5722
|
-
Plus as Plus4,
|
|
5723
|
-
MessageSquare as MessageSquare2,
|
|
5724
|
-
MoreVertical as MoreVertical2,
|
|
5725
|
-
Edit2 as Edit22,
|
|
5726
|
-
Trash2 as Trash25,
|
|
5727
|
-
Archive as Archive2,
|
|
5728
|
-
Search as Search2,
|
|
5729
|
-
Filter as Filter2,
|
|
5730
|
-
Calendar as Calendar2,
|
|
5731
|
-
Hash,
|
|
5732
|
-
X as X6,
|
|
5733
|
-
Check as Check5
|
|
5734
|
-
} from "lucide-react";
|
|
5735
|
-
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5736
|
-
var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onArchive }) => {
|
|
5737
|
-
const [isEditing, setIsEditing] = useState9(false);
|
|
5738
|
-
const [editTitle, setEditTitle] = useState9(thread.title);
|
|
5739
|
-
const inputRef = useRef7(null);
|
|
5740
|
-
useEffect11(() => {
|
|
5741
|
-
if (isEditing && inputRef.current) {
|
|
5742
|
-
inputRef.current.focus();
|
|
5743
|
-
inputRef.current.select();
|
|
5744
|
-
}
|
|
5745
|
-
}, [isEditing]);
|
|
5746
|
-
const handleSaveEdit = () => {
|
|
5747
|
-
const trimmedTitle = editTitle.trim();
|
|
5748
|
-
if (trimmedTitle && trimmedTitle !== thread.title) {
|
|
5749
|
-
onRename(trimmedTitle);
|
|
5750
|
-
}
|
|
5751
|
-
setIsEditing(false);
|
|
5752
|
-
};
|
|
5753
|
-
const handleCancelEdit = () => {
|
|
5754
|
-
setEditTitle(thread.title);
|
|
5755
|
-
setIsEditing(false);
|
|
5756
|
-
};
|
|
5757
|
-
const handleKeyDown = (e) => {
|
|
5758
|
-
if (e.key === "Enter") {
|
|
5759
|
-
handleSaveEdit();
|
|
5760
|
-
} else if (e.key === "Escape") {
|
|
5761
|
-
handleCancelEdit();
|
|
5762
|
-
}
|
|
5763
|
-
};
|
|
5764
|
-
return /* @__PURE__ */ jsx27(Card, { className: `cursor-pointer transition-all duration-200 hover:shadow-md py-0 ${isActive ? "ring-2 ring-primary bg-primary/5" : "hover:bg-muted/50"}`, children: /* @__PURE__ */ jsx27(CardContent, { className: "p-3 max-w-sm", children: /* @__PURE__ */ jsxs17("div", { className: "flex items-start justify-between gap-2", children: [
|
|
5765
|
-
/* @__PURE__ */ jsx27("div", { className: "flex-1 min-w-0", onClick: onSelect, children: isEditing ? /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
5766
|
-
/* @__PURE__ */ jsx27(
|
|
5767
|
-
Input,
|
|
5768
|
-
{
|
|
5769
|
-
ref: inputRef,
|
|
5770
|
-
value: editTitle,
|
|
5771
|
-
onChange: (e) => setEditTitle(e.target.value),
|
|
5772
|
-
onKeyDown: handleKeyDown,
|
|
5773
|
-
onBlur: handleSaveEdit,
|
|
5774
|
-
className: "h-8 text-sm",
|
|
5775
|
-
placeholder: config?.labels?.threadNamePlaceholder || "Conversation name"
|
|
5776
|
-
}
|
|
5777
|
-
),
|
|
5778
|
-
/* @__PURE__ */ jsx27(Button, { size: "sm", variant: "ghost", onClick: handleSaveEdit, children: /* @__PURE__ */ jsx27(Check5, { className: "h-3 w-3" }) }),
|
|
5779
|
-
/* @__PURE__ */ jsx27(Button, { size: "sm", variant: "ghost", onClick: handleCancelEdit, children: /* @__PURE__ */ jsx27(X6, { className: "h-3 w-3" }) })
|
|
5780
|
-
] }) : /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
5781
|
-
/* @__PURE__ */ jsx27("h4", { className: "font-medium text-sm truncate mb-1", children: thread.title }),
|
|
5782
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
5783
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
|
|
5784
|
-
/* @__PURE__ */ jsx27(Hash, { className: "h-3 w-3" }),
|
|
5785
|
-
thread.messageCount,
|
|
5786
|
-
" msgs"
|
|
5787
|
-
] }),
|
|
5788
|
-
/* @__PURE__ */ jsx27(Separator, { orientation: "vertical", className: "h-3" }),
|
|
5789
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
|
|
5790
|
-
/* @__PURE__ */ jsx27(Calendar2, { className: "h-3 w-3" }),
|
|
5791
|
-
formatDate(thread.updatedAt, config?.labels)
|
|
5792
|
-
] }),
|
|
5793
|
-
thread.isArchived && /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
5794
|
-
/* @__PURE__ */ jsx27(Separator, { orientation: "vertical", className: "h-3" }),
|
|
5795
|
-
/* @__PURE__ */ jsxs17(Badge, { variant: "secondary", className: "text-xs", children: [
|
|
5796
|
-
/* @__PURE__ */ jsx27(Archive2, { className: "h-2 w-2 mr-1" }),
|
|
5797
|
-
config?.labels?.archiveThread || "Archived"
|
|
5798
|
-
] })
|
|
5799
|
-
] })
|
|
5800
|
-
] })
|
|
5801
|
-
] }) }),
|
|
5802
|
-
!isEditing && /* @__PURE__ */ jsxs17(DropdownMenu, { children: [
|
|
5803
|
-
/* @__PURE__ */ jsx27(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 m-auto", children: /* @__PURE__ */ jsx27(MoreVertical2, { className: "h-3 w-3" }) }) }),
|
|
5804
|
-
/* @__PURE__ */ jsxs17(DropdownMenuContent, { align: "end", children: [
|
|
5805
|
-
/* @__PURE__ */ jsxs17(DropdownMenuItem, { onClick: () => setIsEditing(true), children: [
|
|
5806
|
-
/* @__PURE__ */ jsx27(Edit22, { className: "h-4 w-4 mr-2" }),
|
|
5807
|
-
config?.labels?.renameThread || "Rename"
|
|
5808
|
-
] }),
|
|
5809
|
-
/* @__PURE__ */ jsxs17(DropdownMenuItem, { onClick: onArchive, children: [
|
|
5810
|
-
/* @__PURE__ */ jsx27(Archive2, { className: "h-4 w-4 mr-2" }),
|
|
5811
|
-
thread.isArchived ? config?.labels?.unarchiveThread || "Unarchive" : config?.labels?.archiveThread || "Archive"
|
|
5812
|
-
] }),
|
|
5813
|
-
/* @__PURE__ */ jsx27(DropdownMenuSeparator, {}),
|
|
5814
|
-
/* @__PURE__ */ jsxs17(DropdownMenuItem, { onClick: onDelete, className: "text-destructive", children: [
|
|
5815
|
-
/* @__PURE__ */ jsx27(Trash25, { className: "h-4 w-4 mr-2" }),
|
|
5816
|
-
config?.labels?.deleteThread || "Delete"
|
|
5817
|
-
] })
|
|
5818
|
-
] })
|
|
5819
|
-
] })
|
|
5820
|
-
] }) }) });
|
|
5821
|
-
};
|
|
5822
|
-
var CreateThreadDialog2 = ({ onCreateThread, config }) => {
|
|
5823
|
-
const [title, setTitle] = useState9("");
|
|
5824
|
-
const [isOpen, setIsOpen] = useState9(false);
|
|
5825
|
-
const handleCreate = () => {
|
|
5826
|
-
onCreateThread(title.trim() || void 0);
|
|
5827
|
-
setTitle("");
|
|
5828
|
-
setIsOpen(false);
|
|
5829
|
-
};
|
|
5830
|
-
return /* @__PURE__ */ jsxs17(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
5831
|
-
/* @__PURE__ */ jsx27(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs17(Button, { variant: "outline", className: "w-full", children: [
|
|
5832
|
-
/* @__PURE__ */ jsx27(Plus4, { className: "h-4 w-4 mr-2" }),
|
|
5833
|
-
config?.labels?.createNewThread || "New Conversation"
|
|
5834
|
-
] }) }),
|
|
5835
|
-
/* @__PURE__ */ jsxs17(DialogContent, { children: [
|
|
5836
|
-
/* @__PURE__ */ jsxs17(DialogHeader, { children: [
|
|
5837
|
-
/* @__PURE__ */ jsx27(DialogTitle, { children: config?.labels?.createNewThread || "Create New Conversation" }),
|
|
5838
|
-
/* @__PURE__ */ jsx27(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
|
|
5839
|
-
] }),
|
|
5840
|
-
/* @__PURE__ */ jsx27(
|
|
5841
|
-
Input,
|
|
5842
|
-
{
|
|
5843
|
-
value: title,
|
|
5844
|
-
onChange: (e) => setTitle(e.target.value),
|
|
5845
|
-
placeholder: config?.labels?.threadNamePlaceholder || "Conversation name (optional)",
|
|
5846
|
-
onKeyDown: (e) => e.key === "Enter" && handleCreate(),
|
|
5847
|
-
autoFocus: true
|
|
5848
|
-
}
|
|
5849
|
-
),
|
|
5850
|
-
/* @__PURE__ */ jsxs17(DialogFooter, { children: [
|
|
5851
|
-
/* @__PURE__ */ jsx27(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config?.labels?.cancel || "Cancel" }),
|
|
5852
|
-
/* @__PURE__ */ jsx27(Button, { onClick: handleCreate, children: config?.labels?.create || "Create" })
|
|
5853
|
-
] })
|
|
5854
|
-
] })
|
|
5855
|
-
] });
|
|
5856
|
-
};
|
|
5857
|
-
var ThreadManager = ({
|
|
5858
|
-
threads,
|
|
5859
|
-
currentThreadId,
|
|
5860
|
-
config,
|
|
5861
|
-
onCreateThread,
|
|
5862
|
-
onSelectThread,
|
|
5863
|
-
onRenameThread,
|
|
5864
|
-
onDeleteThread,
|
|
5865
|
-
onArchiveThread,
|
|
5866
|
-
isOpen = false,
|
|
5867
|
-
onClose,
|
|
5868
|
-
className = ""
|
|
5869
|
-
}) => {
|
|
5870
|
-
const [searchQuery, setSearchQuery] = useState9("");
|
|
5871
|
-
const [showArchived, setShowArchived] = useState9(false);
|
|
5872
|
-
const [deleteThreadId, setDeleteThreadId] = useState9(null);
|
|
5873
|
-
const filteredThreads = threads.filter((thread) => {
|
|
5874
|
-
const title = (thread.title ?? "").toString();
|
|
5875
|
-
const matchesSearch = title.toLowerCase().includes(searchQuery.toLowerCase());
|
|
5876
|
-
const matchesArchiveFilter = showArchived || !thread.isArchived;
|
|
5877
|
-
return matchesSearch && matchesArchiveFilter;
|
|
5878
|
-
});
|
|
5879
|
-
const groupedThreads = filteredThreads.reduce((groups, thread) => {
|
|
5880
|
-
const date = new Date(thread.updatedAt);
|
|
5881
|
-
const today = /* @__PURE__ */ new Date();
|
|
5882
|
-
const yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1e3);
|
|
5883
|
-
let groupKey;
|
|
5884
|
-
if (date.toDateString() === today.toDateString()) {
|
|
5885
|
-
groupKey = config?.labels?.today || "Today";
|
|
5886
|
-
} else if (date.toDateString() === yesterday.toDateString()) {
|
|
5887
|
-
groupKey = config?.labels?.yesterday || "Yesterday";
|
|
5888
|
-
} else {
|
|
5889
|
-
groupKey = date.toLocaleDateString("en-US", {
|
|
5890
|
-
weekday: "long",
|
|
5891
|
-
day: "2-digit",
|
|
5892
|
-
month: "long"
|
|
5893
|
-
});
|
|
5894
|
-
}
|
|
5895
|
-
if (!groups[groupKey]) {
|
|
5896
|
-
groups[groupKey] = [];
|
|
5897
|
-
}
|
|
5898
|
-
groups[groupKey].push(thread);
|
|
5899
|
-
return groups;
|
|
5900
|
-
}, {});
|
|
5901
|
-
const handleDeleteThread = (threadId) => {
|
|
5902
|
-
onDeleteThread?.(threadId);
|
|
5903
|
-
setDeleteThreadId(null);
|
|
5904
|
-
};
|
|
5905
|
-
if (!isOpen) return null;
|
|
5906
|
-
return /* @__PURE__ */ jsx27(TooltipProvider, { children: /* @__PURE__ */ jsxs17("div", { className: `fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ${className}`, children: [
|
|
5907
|
-
/* @__PURE__ */ jsx27("div", { className: "fixed left-0 top-0 h-full w-full max-w-md border-r bg-background shadow-lg", children: /* @__PURE__ */ jsxs17(Card, { className: "h-full border-0 rounded-none", children: [
|
|
5908
|
-
/* @__PURE__ */ jsxs17(CardHeader, { className: "border-b", children: [
|
|
5909
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
5910
|
-
/* @__PURE__ */ jsxs17(CardTitle, { className: "flex items-center gap-2", children: [
|
|
5911
|
-
/* @__PURE__ */ jsx27(MessageSquare2, { className: "h-5 w-5" }),
|
|
5912
|
-
config?.labels?.newChat || "Conversations"
|
|
5913
|
-
] }),
|
|
5914
|
-
/* @__PURE__ */ jsx27(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx27(X6, { className: "h-4 w-4" }) })
|
|
5915
|
-
] }),
|
|
5916
|
-
/* @__PURE__ */ jsxs17("div", { className: "space-y-3", children: [
|
|
5917
|
-
/* @__PURE__ */ jsxs17("div", { className: "relative", children: [
|
|
5918
|
-
/* @__PURE__ */ jsx27(Search2, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
5919
|
-
/* @__PURE__ */ jsx27(
|
|
5920
|
-
Input,
|
|
5921
|
-
{
|
|
5922
|
-
placeholder: config?.labels?.search || "Search conversations...",
|
|
5923
|
-
value: searchQuery,
|
|
5924
|
-
onChange: (e) => setSearchQuery(e.target.value),
|
|
5925
|
-
className: "pl-9"
|
|
5926
|
-
}
|
|
5927
|
-
)
|
|
5928
|
-
] }),
|
|
5929
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
5930
|
-
/* @__PURE__ */ jsxs17(
|
|
5931
|
-
Button,
|
|
5932
|
-
{
|
|
5933
|
-
variant: "outline",
|
|
5934
|
-
size: "sm",
|
|
5935
|
-
onClick: () => setShowArchived(!showArchived),
|
|
5936
|
-
className: "text-xs",
|
|
5937
|
-
children: [
|
|
5938
|
-
/* @__PURE__ */ jsx27(Filter2, { className: "h-3 w-3 mr-1" }),
|
|
5939
|
-
showArchived ? config?.labels?.hideArchived || "Hide Archived" : config?.labels?.showArchived || "Show Archived"
|
|
5940
|
-
]
|
|
5941
|
-
}
|
|
5942
|
-
),
|
|
5943
|
-
/* @__PURE__ */ jsxs17(Badge, { variant: "secondary", className: "text-xs", children: [
|
|
5944
|
-
filteredThreads.length,
|
|
5945
|
-
" / ",
|
|
5946
|
-
threads.length
|
|
5947
|
-
] })
|
|
5948
|
-
] })
|
|
5949
|
-
] })
|
|
5950
|
-
] }),
|
|
5951
|
-
/* @__PURE__ */ jsxs17(CardContent, { className: "p-0 flex-1", children: [
|
|
5952
|
-
/* @__PURE__ */ jsx27("div", { className: "p-4", children: onCreateThread && /* @__PURE__ */ jsx27(CreateThreadDialog2, { onCreateThread, config }) }),
|
|
5953
|
-
/* @__PURE__ */ jsx27(ScrollArea, { className: "h-[calc(100vh-280px)]", children: /* @__PURE__ */ jsx27("div", { className: "px-4 pb-4 space-y-4", children: Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ jsxs17("div", { className: "text-center py-8 text-muted-foreground", children: [
|
|
5954
|
-
/* @__PURE__ */ jsx27(MessageSquare2, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }),
|
|
5955
|
-
/* @__PURE__ */ jsx27("p", { className: "text-sm", children: searchQuery ? config?.labels?.noThreadsFound || "No conversations found" : config?.labels?.noThreadsYet || "No conversations yet" })
|
|
5956
|
-
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs17("div", { children: [
|
|
5957
|
-
/* @__PURE__ */ jsx27("h3", { className: "text-sm font-medium text-muted-foreground mb-2 px-2", children: group }),
|
|
5958
|
-
/* @__PURE__ */ jsx27("div", { className: "space-y-2", children: groupThreads.map((thread) => /* @__PURE__ */ jsx27(
|
|
5959
|
-
ThreadItem,
|
|
5960
|
-
{
|
|
5961
|
-
thread,
|
|
5962
|
-
isActive: currentThreadId === thread.id,
|
|
5963
|
-
config,
|
|
5964
|
-
onSelect: () => onSelectThread?.(thread.id),
|
|
5965
|
-
onRename: (newTitle) => onRenameThread?.(thread.id, newTitle),
|
|
5966
|
-
onDelete: () => setDeleteThreadId(thread.id),
|
|
5967
|
-
onArchive: () => onArchiveThread?.(thread.id)
|
|
5968
|
-
},
|
|
5969
|
-
thread.id
|
|
5970
|
-
)) })
|
|
5971
|
-
] }, group)) }) })
|
|
5972
|
-
] })
|
|
5973
|
-
] }) }),
|
|
5974
|
-
deleteThreadId && /* @__PURE__ */ jsx27(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ jsxs17(AlertDialogContent, { children: [
|
|
5975
|
-
/* @__PURE__ */ jsxs17(AlertDialogHeader, { children: [
|
|
5976
|
-
/* @__PURE__ */ jsx27(AlertDialogTitle, { children: config?.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
5977
|
-
/* @__PURE__ */ jsx27(AlertDialogDescription, { children: config?.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
5978
|
-
] }),
|
|
5979
|
-
/* @__PURE__ */ jsxs17(AlertDialogFooter, { children: [
|
|
5980
|
-
/* @__PURE__ */ jsx27(AlertDialogCancel, { children: config?.labels?.cancel || "Cancel" }),
|
|
5981
|
-
/* @__PURE__ */ jsx27(
|
|
5982
|
-
AlertDialogAction,
|
|
5983
|
-
{
|
|
5984
|
-
onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
|
|
5985
|
-
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
5986
|
-
children: config?.labels?.deleteThread || "Delete"
|
|
5987
|
-
}
|
|
5988
|
-
)
|
|
5989
|
-
] })
|
|
5990
|
-
] }) })
|
|
5991
|
-
] }) });
|
|
5992
|
-
};
|
|
5993
5739
|
export {
|
|
5994
|
-
|
|
5995
|
-
ChatHeader,
|
|
5996
|
-
ChatInput,
|
|
5740
|
+
AssistantActivity,
|
|
5997
5741
|
ChatUI,
|
|
5998
5742
|
ChatUserContextProvider,
|
|
5999
|
-
Message,
|
|
6000
|
-
ParticipantsSelector,
|
|
6001
|
-
Sidebar2 as Sidebar,
|
|
6002
|
-
TargetAgentSelector,
|
|
6003
|
-
ThreadManager,
|
|
6004
|
-
UserMenu,
|
|
6005
|
-
UserProfile,
|
|
6006
|
-
assignAgentColors,
|
|
6007
|
-
chatUtils,
|
|
6008
|
-
cn,
|
|
6009
|
-
createObjectUrlFromDataUrl,
|
|
6010
5743
|
defaultChatConfig,
|
|
6011
|
-
formatDate,
|
|
6012
|
-
getAgentColor,
|
|
6013
|
-
getAgentInitials,
|
|
6014
5744
|
mergeConfig,
|
|
6015
5745
|
useChatUserContext
|
|
6016
5746
|
};
|